Problem turning on camera display permanently. - page 2 - Script Writing - CHDK Forum supplierdeeply

Problem turning on camera display permanently.

  • 24 Replies
  • 4834 Views
Re: Problem turning on camera display permanently.
« Reply #10 on: 19 / December / 2013, 14:01:28 »
Advertisements
Nevertheless: This is my startup.lua, but as said it does not matter if I have it running at startup ore not. Please be aware that we are talking about two different issues here: One is the lacking possibility to make the camera have a turned on display and the other is the fact that cameras don't startup reliably.

Code: [Select]
function copyFile(_input, _output)
 io.input(_input)
 fileContent = io.read("*all")
 io.output(_output)
 io.write(fileContent)
 io.close()
 end
 sleep(1000)
 
copyFile('A/cardid.txt','A/RESET_ME.txt')
print('RESET_ME FILE CREATED')
sleep(200)
copyFile('A/cardid.txt','A/INIT_ME.TXT')
print('INIT_ME FILE CREATED')
sleep(200)

for line in io.lines("A/cardid.txt") do
copyFile('A/cardid.txt','A/'..line..'.txt')
print('CAM ID FILE CREATED')
end
sleep(2000)

if not get_mode() then
set_record(1)
while not get_mode() do
sleep(100)
end
end

exit_alt()
« Last Edit: 19 / December / 2013, 14:16:49 by Karmaschinken »

*

Offline philmoz

  • *****
  • 3128
    • Photos
Re: Problem turning on camera display permanently.
« Reply #11 on: 19 / December / 2013, 15:04:09 »
I'll try to explain a little better:


The issue happens when resetting the camera to companies defaults, afterwards CHDKs "Disable LCD off"-"Always"-feature does not work, the camera shuts down nevertheless. Even when the script at the end explicitly sets "Disable LCD off" to "never" and then "Always" again using set_config_value(67,0), then set_config_value(67,3)


Thanks for explaining.

At the moment set_config_value() does not call the function to enable/disable the camera power state, this is only done at certain points in the code, e.g. when a script exits, enter/exit ALT mode.

When you reset the camera settings, the camera unlocks the shutdown power setting; but CHDK still thinks its locked. Changing the config value with set_config_value in a script doesn't re-lock the power state.

I'll see if this can be fixed. It might be easiest to add a new Lua function to enable/disable shutdown directly rather than mess with the config value.

Edit: I don't know if it will work; but you can try adding 'exit_alt()' followed by 'enter_alt()' calls to the script after setting the config value. This might update the camera power state. Would need to be done after setting the value to 0 and then back to 3.

Phil.

« Last Edit: 19 / December / 2013, 15:14:50 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: Problem turning on camera display permanently.
« Reply #12 on: 19 / December / 2013, 15:39:56 »
Edit: I don't know if it will work; but you can try adding 'exit_alt()' followed by 'enter_alt()' calls to the script after setting the config value. This might update the camera power state. Would need to be done after setting the value to 0 and then back to 3.

Phil.

I thinks that`s a good idea, when searching for a solution I stumbled upon some threads that dealt with the lcd on/off. Btw.: exit/enter_alt does not help, unfortunately.

*

Offline philmoz

  • *****
  • 3128
    • Photos
Re: Problem turning on camera display permanently.
« Reply #13 on: 19 / December / 2013, 16:08:26 »
Edit: I don't know if it will work; but you can try adding 'exit_alt()' followed by 'enter_alt()' calls to the script after setting the config value. This might update the camera power state. Would need to be done after setting the value to 0 and then back to 3.

Phil.

I thinks that`s a good idea, when searching for a solution I stumbled upon some threads that dealt with the lcd on/off. Btw.: exit/enter_alt does not help, unfortunately.

Ok, instead of the calls to set_config_value try adding
    call_event_proc("LockMainPower")

This is what the core code is using to disable shutdown.

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: Problem turning on camera display permanently.
« Reply #14 on: 19 / December / 2013, 18:27:11 »
Thanks a lot, Phil. Doesn't work, the function returns -1.  Native calls are enabled.

Sending this on the cli

=print(call_event_proc("LockMainPower")) sleep(5000)

shows -1
« Last Edit: 19 / December / 2013, 18:34:32 by Karmaschinken »

*

Offline philmoz

  • *****
  • 3128
    • Photos
Re: Problem turning on camera display permanently.
« Reply #15 on: 19 / December / 2013, 18:35:03 »
Thanks a lot, Phil. Doesn't work, the function return -1. What does that mean? Native calls are enabled.

You might need to add this before calling LockMainPower
    call_event_proc("UI.Create")

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: Problem turning on camera display permanently.
« Reply #16 on: 19 / December / 2013, 19:04:19 »
Alright! The function works now. But the cam still falls asleep...  :o

The problem with this is, that cameras falling asleep contradict the need that all cameras are synced when sending a click() or a wheel(). If the cameras are asleep, they swallow the first command, it is used to awake them. Thus they are out of sync then.

So I really need a solution for that, otherwise the system is prone to errors.

Thanks a lot for you efforts...
« Last Edit: 19 / December / 2013, 19:07:40 by Karmaschinken »

Re: Problem turning on camera display permanently.
« Reply #17 on: 19 / December / 2013, 19:37:25 »
Okay, now I really have a workaround for that. So if you don't want to dig into that I can live with my solution!

I do this:

The first script, which resets the camera to Canons default, sets the Power Off Time to ten seconds, then wait until the camera falls asleep, then send a click("up"), which will do nothing but awake the camera. Thats it. Since it has fallen asleep once and awake again, it is up and alive forever! :-)

Nevertheless, if you have any idea left and want me to test it, I am here! Thank you very much Phil!


Re: Problem turning on camera display permanently.
« Reply #18 on: 19 / December / 2013, 19:50:27 »
Nevertheless: This is my startup.lua, but as said it does not matter if I have it running at startup ore not. Please be aware that we are talking about two different issues here: One is the lacking possibility to make the camera have a turned on display and the other is the fact that cameras don't startup reliably.
Code: [Select]
function copyFile(_input, _output)
 io.input(_input)
 fileContent = io.read("*all")
 io.output(_output)
 io.write(fileContent)
 io.close()
 end

 sleep(1000)
 
copyFile('A/cardid.txt','A/RESET_ME.txt')
print('RESET_ME FILE CREATED')
sleep(200)
copyFile('A/cardid.txt','A/INIT_ME.TXT')
print('INIT_ME FILE CREATED')
sleep(200)

for line in io.lines("A/cardid.txt") do
copyFile('A/cardid.txt','A/'..line..'.txt')
print('CAM ID FILE CREATED')
end
sleep(2000)

if not get_mode() then
set_record(1)
while not get_mode() do
sleep(100)
end
end

exit_alt()
Not starting up reliably is a concern - especially if they fail to start when the script Autostart function is [ Off ].

Regardless, one thing I would suggest is changing the sleep(1000) at the start of your script to sleep(4000) to give the camera a little more time to complete its startup activity before you start moving files around on the SD card.
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline philmoz

  • *****
  • 3128
    • Photos
Re: Problem turning on camera display permanently.
« Reply #19 on: 19 / December / 2013, 19:59:47 »
Okay, now I really have a workaround for that. So if you don't want to dig into that I can live with my solution!

I do this:

The first script, which resets the camera to Canons default, sets the Power Off Time to ten seconds, then wait until the camera falls asleep, then send a click("up"), which will do nothing but awake the camera. Thats it. Since it has fallen asleep once and awake again, it is up and alive forever! :-)

Nevertheless, if you have any idea left and want me to test it, I am here! Thank you very much Phil!

I did some testing on one of my cameras and this is probably the simplest option right now.

This is what I'm seeing:
- When you start up the camera with the CHDK 'Disable LCD off' set to Always it calls LockMainPower.
- When you reset the Canon settings, or change the Canon Display Off time, if re-enables the auto LCD off - ignoring the CHDK call to LockMainPower.
- After waking up from sleep, the camera now respects the earlier call to LockMainPower.

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)

 

Related Topics