I redid the shutdown process, since issuing a mc:cmdwait('play') before the shut_down gave me a couple of errors and some cameras would turn off with the lens out, and some others would retract the lens but not turn off.
Some cameras will crash if you delete images in rec mode.
I removed the line and now they all shut down properly (despite some errors showing up on the CLI)
What kind of errors?
In general, I'd recommend trying to understand the cause of things like this, even if it seems too work.
- Image numbering: I've inserted a read-only jpg in the DCIM folder, tried the line you suggested in different ways
I didn't suggest the file should be read-only. The camera looks for files called IMG_nnnn.JPG, and sets the counter to the highest numbered image on startup.
mc:cmdwait('call local fh=io.open(get_image_dir().."/IMG_1000.JPG","wb") fh:close()')
(before the 'repeat' loop, and into option 1) but had little success. Will keep trying to debug what's causing the problem.
Since the effect is based on what the camera sees
at startup it should be done as the last part of your shooting session (i.e. in your shutdown option) rather than at startup, and all higher number images must have been deleted from the card.
You should also verify that your code is actually creating the file, for example by connecting to a single camera and doing imls.
All that said, I'd still recommend using download_images options to number the files instead of relying on the camera shot counters.
- Some cameras (they're all second hand) seem to have the internal clock battery gone (or whatever keeps date and time when off). Maybe this is somehow related to the numbering issue??
Unlikely. Generally, saved settings are saved in the cameras onboard flash, not volatile memory powered by the clock battery.
Many older cameras have a replaceable clock battery. If that's true of yours, I would strongly recommend just replacing the batteries. You can get them bulk on amazon at reasonable prices.
Anyway, I'd like to add a line at startup to set the current date and time (or anything that matches between all cameras), but couldn't find anything except get_time command. Any ideas?
The module in lua/extras/syntime.lua can set the camera clock from PC clock.
However, there's a some of caveats:
* You need to enable Lua native function calls in the CHDK menu under miscellaneous. You should be able to do this on one camera and copy the configs. You cannot do it with set_config_value.
* It's set up to work in the normal CLI with a single camera, not multicam.
* It registers some eventprocs which can cause crashes on some cameras if you try to shoot after using it (and could possibly have other side effects). I normally recommend rebooting after using synctime, but if the clock battery is dead, you might end up back at the clock prompt in that case (it's possible a "soft reboot" is OK, I haven't tested).
Anyway, if you want to try the synctime code, you could do something like this in your Lua file
local lt=os.date("*t")
mc:print_cmd_status(mc:cmdwait(string.format([[
call
if call_event_proc('FA.Create') == -1 then
return 'FA.Create failed'
end
if call_event_proc('InitializeAdjustmentFunction') == -1 then
return 'InitializeAdjustmentFunction failed'
end
if call_event_proc('SetYear',%d) == -1
or call_event_proc('SetMonth',%d) == -1
or call_event_proc('SetDay',%d) == -1
or call_event_proc('SetHour',%d) == -1
or call_event_proc('SetMinute',%d) == -1
or call_event_proc('SetSecond',%d) == -1 then
return 'set failed'
end
return true
]],lt.year,lt.month,lt.day,lt.hour,lt.min,lt.sec),{libs='serialize_msgs'}))
edit:
If the cameras are sitting with the clock prompt open, you'll probably want to send something like
mc:cmdwait('call click"set"')
to make it go away