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

Console changes for review

  • 27 Replies
  • 4847 Views
*

Offline philmoz

  • *****
  • 3138
    • Photos
Re: Console changes for review
« Reply #20 on: 21 / December / 2014, 16:37:58 »
Advertisements
I'd also suggest saving and restoring the timeout value in the C code in case the script forgets or is cancelled by the user.
I think you only need the restore part of that - just reset to whatever is in the conf.console_timeout value on script exit.
But isn't this the value the new function is going to change to give the script control over the console?
AFAIK,  only needed while the script is running?

edit :  srsa_4c's complaint was the console timing out while a script was using it for output IIRC. You can tweak the value stored in the conf.console_timeout but that doesn't get reset when the script exits.

Now I'm confused ???

I was suggesting a new function (e.g. console_timeout(N)) to allow scripts to update conf.console_timout without needing to use a magic number or load cnf_osd.lua.

To remove the need for scripts to save & restore the value (and to cater for the user cancelling the script) I was suggesting the core C code save and restore conf.console_timeout when running a script (same as it now does for the script autosave flag).

If there is a better way to do this please let me know.

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)

*

Offline srsa_4c

  • ******
  • 4058
Re: Console changes for review
« Reply #21 on: 21 / December / 2014, 17:20:21 »
I was suggesting a new function (e.g. console_timeout(N)) to allow scripts to update conf.console_timout without needing to use a magic number or load cnf_osd.lua.

To remove the need for scripts to save & restore the value (and to cater for the user cancelling the script) I was suggesting the core C code save and restore conf.console_timeout when running a script (same as it now does for the script autosave flag).
If we're about to introduce a new function (or extend an existing one), I wonder if it would be better to add a new variable, instead of saving/changing/restoring the timeout value.

Re: Console changes for review
« Reply #22 on: 21 / December / 2014, 17:23:31 »
I was suggesting a new function (e.g. console_timeout(N)) to allow scripts to update conf.console_timout without needing to use a magic number or load cnf_osd.lua.

To remove the need for scripts to save & restore the value (and to cater for the user cancelling the script) I was suggesting the core C code save and restore conf.console_timeout when running a script (same as it now does for the script autosave flag).
If we're about to introduce a new function (or extend an existing one), I wonder if it would be better to add a new variable, instead of saving/changing/restoring the timeout value.
That's what I was thinking too - sorry for the confusion.  Add a flag to the console timeout logic that can be set by a script  function ( disable_console_timeout(0/1) ).   Regardless of how the script uses that function,  clear the flag on script exit.
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline philmoz

  • *****
  • 3138
    • Photos
Re: Console changes for review
« Reply #23 on: 21 / December / 2014, 17:29:50 »
I was suggesting a new function (e.g. console_timeout(N)) to allow scripts to update conf.console_timout without needing to use a magic number or load cnf_osd.lua.

To remove the need for scripts to save & restore the value (and to cater for the user cancelling the script) I was suggesting the core C code save and restore conf.console_timeout when running a script (same as it now does for the script autosave flag).
If we're about to introduce a new function (or extend an existing one), I wonder if it would be better to add a new variable, instead of saving/changing/restoring the timeout value.
That's what I was thinking too - sorry for the confusion.  Add a flag to the console timeout logic that can be set by a script  function ( disable_console_timeout(0/1) ).   Regardless of how the script uses that function,  clear the flag on script exit.

Ok, understand now.

Would you also want the ability to turn the console off completely while the script was running?
Not needed - the console_autoredraw function takes care of it.

Edit: Why not just disable the console timeout if a script is running and leave the console displayed? No change required to any scripts that way. When the script exits the timeout kicks back in.

Phil.
« Last Edit: 21 / December / 2014, 17:38:51 by philmoz »
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)


Re: Console changes for review
« Reply #24 on: 21 / December / 2014, 17:45:45 »
Would you also want the ability to turn the console off completely while the script was running?
Not needed - the console_autoredraw function takes care of it.
Edit: Why not just disable the console timeout if a script is running and leave the console displayed? No change required to any scripts that way. When the script exits the timeout kicks back in.
That would work too / even better  - so long as console_autoredraw hides it properly.
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Console changes for review
« Reply #25 on: 21 / December / 2014, 18:03:27 »
Moved here from changelog of trunk including comments / devtalk

On scripts that hide the console, errors can be confusing.  Once the script is debugged, you live with that as the price of cleaning up the display.  If the script is well behaved you don't need to see error message as there aren't any.  ???

Unless you upgrade / switch cameras and Lua native calls are disabled.  Then you will never see the error message - your script will simply not run.   Not a crash but perplexing until you realize what went wrong.

Might be worth turning the console on automatically when an error occurs - ignoring what the script requested?
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline philmoz

  • *****
  • 3138
    • Photos
Re: Console changes for review
« Reply #26 on: 21 / December / 2014, 23:55:41 »
Revision 3840 should:
- disable the console timeout and erase if a script is running
- force console on if a script error is written

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)

Re: Console changes for review
« Reply #27 on: 22 / December / 2014, 06:52:43 »
Revision 3840 should:
- disable the console timeout and erase if a script is running
- force console on if a script error is written

Phil.

Thanks for advices and updates WW and Phil. At last i managed to find my script errors with 1,4 rev.3842.
Back again happly on the "unstable" way   :xmas


 

Related Topics