« Reply #16 on: 21 / December / 2014, 14:06:04 »
I've used
set_config_value( 297, 30000) -- console timeout
to push the timeout to over 8 hours. That's been enough for anything I've needed it for. Obviously, the script probably should to do a get_config_value() and restore the timeout on exit.
That seems to do the job, thanks. I have currently used the config ID directly. Perhaps it would be more future-proof to use the generated cnf_osd Lua library (but that would increase memory use and may not be available in case of an incomplete install)...?
Index: CHDK/SCRIPTS/EDITOR/EDI.lua
===================================================================
--- CHDK/SCRIPTS/EDITOR/EDI.lua (revision 3835)
+++ CHDK/SCRIPTS/EDITOR/EDI.lua (working copy)
@@ -45,6 +45,11 @@
additionally: the biggest file I successfully opened on SX130IS had 916 kB. Opening 962 kB file failed. Other cameras has different size of free memory, nevertheless opening average scripts as 5-10 kb shouldn't cause any problems.
--]]
+-- store original console timeout value
+-- TODO: use the cnf_osd library instead of config ID?
+ConTO = get_config_value(297)
+set_config_value( 297, 30000)
+
-- CHECK GIVEN PARAMETERS --
if y<5 then y=5 end
if x<10 then x=10 end
@@ -498,6 +503,7 @@
cls()
print("EDI has been terminated.")
set_console_autoredraw(1)
+ set_config_value( 297, ConTO) -- restore console timeout value
set_console_layout(0,0,25,5) -- Thx, msl!
EXIT=true
end
A new function to set the timeout would be clearer (and avoid the magic number and overhead of using cnf_osd.lua).
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.
Phil.
Logged
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)