Quote from: reyalp on 09 / August / 2021, 22:31:00Note that if you are switching to playback between runs, it should not be needed.Ok thanks!
Note that if you are switching to playback between runs, it should not be needed.
I have the webcam of the laptop pointing to the Canon, so I can see if the lens is retracted or if the screen is off or what the green led is doing.
I did notice the static scene once or twice. Now I know better what that was. Also Code: [Select]=return get_imager_active() is a good hit. Thanks again!Is there a way to get a return direct in chdkptp script when using codes like =return get_imager_active() ? What I do is first type chdkptp -c -i and then =return get_imager_active() but is there a way to execute it like chdkptp -c -i"=return get_imager_active() quit" and get in the powershell cmd a return of the function called?
=return get_imager_active()
exec imager_active=con:execwait[[return get_imager_active()]] if imager_active then sys.set_exit_value(1) else sys.set_exit_value(0) end
exec dofile('myfile.lua')
Where can I find a code example ore more information how to print live telemetry data to powershell cmd? like "100 photos of 1000 done"
set cli_verbose=2
Quote how to print live telemetry data to powershell cmd? You can write lines like ... Code: [Select] os.execute('echo %PATH% &&cd&& dir/b')orCode: [Select]function echo(...)local str=string.format(...)os.execute('echo '..str)endecho("%i Photos of %i", count or 0, maxcount or 1000)
how to print live telemetry data to powershell cmd?
os.execute('echo %PATH% &&cd&& dir/b')
function echo(...)local str=string.format(...)os.execute('echo '..str)endecho("%i Photos of %i", count or 0, maxcount or 1000)
To elaborate slightly: If you want to turn the sensor off the keep the temperatures down (or save power), switching to play does that.While rawopint is running, the sensor will never switch off, because it has either half press or full press held for the whole duration of the run (depending on the "cont" setting).If you want to turn the screen off in playback mode, you should just use set_lcd_display. The Canon "turn display off after N seconds" functionality doesn't apply in playback.
In that case, I'd use chdkptp side Lua with exec (aka !). For example, you could do something likeCode: [Select]exec imager_active=con:execwait[[return get_imager_active()]] if imager_active then sys.set_exit_value(1) else sys.set_exit_value(0) endThe main thing here is con:execwait is the same as luar, except the return values from camera side Lua are returned to chdkptp side Lua instead of being printed. Multiple returns and tables work just like they normally do in Lua, except that tables can't contain cyclic references or functions.Note I used sys.set_exit_status rather than Lua native os.exit(exit value) because I'm not 100% certain chdkptp cleans everything up of you use os.exit(). sys.set_exit_status just sets the return value of main() in the C code.
chdkptp -c -e"exec imager_active=con:execwait[[return get_imager_active()]] if imager_active then print'sensor is acive' else print'sensor is not active' end"
! zoom_position=con:execwait[[return get_zoom()]] if zoom_position~=28 then print'zoom wrong: set to 28%' set_zoom(28) else print'zoom ok' end
If you want live telemetry while rawopint is running, that would be quite complicated, because it would need to be integrated with the code for the remoteshoot command. You could modify cli.lua to print some things or write to a file.If you useCode: [Select]set cli_verbose=2remoteshoot will print information about each shot, but it's quite verbose.
What I noticed: the temperature of the sensor is about 10°C lower when the camera is shooting the long exposures (13s each 15s) than when the exposure is shorter than 1/4sec.
Quote from: Caefix on 10 / August / 2021, 11:13:22 You can write lines like ... Code: [Select] os.execute('echo %PATH% &&cd&& dir/b')orCode: [Select]function echo(...)local str=string.format(...)os.execute('echo '..str)endecho("%i Photos of %i", count or 0, maxcount or 1000)
You can write lines like ... Code: [Select] os.execute('echo %PATH% &&cd&& dir/b')orCode: [Select]function echo(...)local str=string.format(...)os.execute('echo '..str)endecho("%i Photos of %i", count or 0, maxcount or 1000)
I searched for such an example for a long time! This is great stuff! and it works! (actually i don't know what os.exit(exit value) or sys.set_exit_status is used for but Code: [Select]chdkptp -c -e"exec imager_active=con:execwait[[return get_imager_active()]] if imager_active then print'sensor is acive' else print'sensor is not active' end" also worked! )
The idea for a better code:Code: [Select]! zoom_position=con:execwait[[return get_zoom()]] if zoom_position~=28 then print'zoom wrong: set to 28%' set_zoom(28) else print'zoom ok' end
print(con:execwait[[if get_zoom() == 28 then return 'zoom ok'else set_zoom(28) return 'zoom wrong: set to 28%'end]])
Okay, so if remoteshoot doesn't have support printing to the cmd using the lua script running on the camera as with the code Caefix posted above, I'll put that off until later as it's just a nice to have and not necessary for running the time lapse and I can check the status of the camera with the code snippet you share above just like that.
local shot = 1 repeat rcopts.shotseq=prefs.cli_shotseq cli.dbgmsg('get data %d\n',shot) printf('shot %d\n',shot) -- added status,err = con:capture_get_data_pcall(rcopts)...
You would use sys.set_exit_status / os.exit would be if you wanted it as an exit value for whatever script or batch file is running the chdkptp commands.
set_zoom is camera side, so you'd need a con:execwait for that too, but you can put all the logic in one script if you want, likeCode: [Select]print(con:execwait[[if get_zoom() == 28 then return 'zoom ok'else set_zoom(28) return 'zoom wrong: set to 28%'end]])Above formatted as normal Lua for readability, if it's part of an exec command it would all be on one line.Personally, I'd put anything more than trivial one-liners in a separate lua file. You can then either put all your logic in the lua file, using cli:execute to execute cli commands like remoteshoot, imrm etc, or load your lua file as a module with exec mymod=require'mymode' and call functions individually like exec mymod.check_zoom()The escursionisticivatesi.it script uses the first approach https://github.com/alesanmanoweb/multilapse-CHDK/blob/master/multilapse.lua
If you want remoteshoot to print a line for every shot, you can just add something to the main loop of the remoteshoot command in cli.lua likeCode: [Select] local shot = 1 repeat rcopts.shotseq=prefs.cli_shotseq cli.dbgmsg('get data %d\n',shot) printf('shot %d\n',shot) -- added status,err = con:capture_get_data_pcall(rcopts)...If you wanted specific information from the camera side script, you'd have to modify rawopint to send messages and then handle them in the chdkptp code.
Started by cyril42e « 1 2 » General Discussion and Assistance
Started by Dr.Pat « 1 2 3 » Feature Requests
Started by Sedric General Help and Assistance on using CHDK stable releases
Started by Dave the Wave General Help and Assistance on using CHDK stable releases
Started by Hardware_Hacker General Discussion and Assistance