Console changes for review - General Discussion and Assistance - CHDK Forum

Console changes for review

  • 27 Replies
  • 13194 Views
*

Offline philmoz

  • *****
  • 3450
    • Photos
Console changes for review
« on: 12 / April / 2013, 19:31:43 »
Advertisements
Attached is a patch (for trunk only) that makes some changes to the console handling in CHDK (inspired by some comments from waterwingz).

The changes include:
- console redraw code cleaned up to remove drawing code from keyboard task
- console size increased to 30 lines to allow a small amount of 'history'
- menu option to set the delay before the console stops displaying (currently hard wired to 3 seconds)
- menu option to force the console to be displayed in shooting & playback modes (currently only shows in ALT mode). This allows the raw save time to be seen if the option to display it is enabled.
- menu option to reset the size & position of the console if a script has changed it with set_layout
- menu option to show the current console content in a scrollable window

I haven't found any issues in the code changes; but my testing time is limited at the moment - so I'm posting it here for review prior to adding to SVN.

Any suggestions & comments appreciated.

Phil.
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)

Re: Console changes for review
« Reply #1 on: 12 / April / 2013, 19:35:20 »
Owing to philmoz giving me a preview (tnks!),  this one already has my full support.
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline lapser

  • *****
  • 1093
Re: Console changes for review
« Reply #2 on: 12 / April / 2013, 21:05:31 »
Sounds good. Did you, or will you modify:

set_console_autoredraw(-1|0|1)

so it doesn't draw the console on the screen at all if it's disabled (-1|0)?

It would also be nice to have an option for a script to disable the <ALT> line display with the script name at the bottom when a script is running. Maybe:

set_console_autoredraw(-2)

I would like to be able to have a complete script control of all drawing on the screen, if possible.
EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos

*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: Console changes for review
« Reply #3 on: 12 / April / 2013, 23:18:13 »
Sounds good. Did you, or will you modify:

set_console_autoredraw(-1|0|1)

so it doesn't draw the console on the screen at all if it's disabled (-1|0)?

If you call set_console_autoredraw(-1) then print statements in the script are not added to the console. The console display should vanish 3 seconds after the last change (or whatever you set the timeout delay to).

Quote
It would also be nice to have an option for a script to disable the <ALT> line display with the script name at the bottom when a script is running. Maybe:

set_console_autoredraw(-2)

Since hiding the <ALT> and script name have nothing to do with the console, I'm reluctant to overload set_console_redraw with another meaning like this.

If you really need this feature then add a new 'conf' variable to control the display and add script function(s) to enable/disable it - it probably doesn't need to be saved to the configuration file.

Phil.
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)

*

Offline lapser

  • *****
  • 1093
Re: Console changes for review
« Reply #4 on: 13 / April / 2013, 13:44:27 »
If you call set_console_autoredraw(-1) then print statements in the script are not added to the console. The console display should vanish 3 seconds after the last change (or whatever you set the timeout delay to).
When taking pictures in continuous mode, the print statements aren't added, but the display doesn't vanish. Is there a way to clear it? Also, where do you set the timeout delay?
Quote
Since hiding the <ALT> and script name have nothing to do with the console, I'm reluctant to overload set_console_redraw with another meaning like this.
Would you be OK with adding an optional parameter to enter_alt()?

enter_alt(0) -- no alt display at bottom.
EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos

Re: Console changes for review
« Reply #5 on: 14 / April / 2013, 20:53:46 »
Attached is a patch (for trunk only) that makes some changes to the console handling in CHDK (inspired by some comments from waterwingz).
Are you going to update the dev trunk with this?  That would save me re-patching each release. Thanks!
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: Console changes for review
« Reply #6 on: 15 / April / 2013, 05:51:38 »
Attached is a patch (for trunk only) that makes some changes to the console handling in CHDK (inspired by some comments from waterwingz).
Are you going to update the dev trunk with this?  That would save me re-patching each release. Thanks!


In revision 2703.

Phil.
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)

*

Offline lapser

  • *****
  • 1093
Re: Console changes for review
« Reply #7 on: 21 / July / 2013, 15:55:55 »
I've noticed that set_console_layout(..) doesn't work in my time lapse script since these changes, as demonstrated by this test script:
Code: [Select]
--[[
@title console test
--]]
set_console_layout(0,11,45,13) -- this has no effect now, worked before
print("testing 1")
print("testing 2")
print("testing 3")
set_console_autoredraw(-1) -- screen disappears in 3 seconds
print("Hello") -- doesn't show on screen
sleep(5000)
--set_console_autoredraw(1) -- screen reappears
print("Good Bye")
Here's the description in the Wiki:
Quote
set_console_layout x1 y1 x2 y2 --> set console position and size, range is x=0 to 45 and y=0 to 14

Note : coordinates are in units of characters and are  numbered from the lower left hand corner of the screen. So x1,y1 is the lower left corner and x2,y2 is the upper right corner.

set_console_autoredraw(-1) does work, as Phil described. That is, the screen console disappears after 3 seconds. However, the screen console doesn't reappear when a new script starts. That is, it's not re-initialized.

Since Phil did the changes, it would probably be easier for him to fix it.


EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos

Re: Console changes for review
« Reply #8 on: 21 / July / 2013, 16:14:41 »
I've noticed that set_console_layout(..) doesn't work in my time lapse script since these changes, as demonstrated by this test script:

I alway have to fool around to get set_console_layout() to work but it is working for me with the latest build.   The ultimate.lua file has this :

Code: [Select]
set_console_layout(1, 1, 44, 6)which gives me a console box 5 lines high by 43 characters wide
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline lapser

  • *****
  • 1093
Re: Console changes for review
« Reply #9 on: 21 / July / 2013, 18:44:16 »
I alway have to fool around to get set_console_layout() to work but it is working for me with the latest build.
I'll have to check it out in the latest build. I'm pretty far behind.

I was able to get the console to disappear with:
set_console_autoredraw(-1)
sleep(3500)

I'll have to dig into it more, but apparently the console timeout is reset by printing to the log file even with the screen console disabled. It should be pretty easy to fix.

I'm now using draw_string() to display the script status, which gives a lot more control.
EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos

 

Related Topics


SimplePortal © 2008-2014, SimplePortal