I'm currently in process of re-organizing the hook wait / timeout / cancel code, since after I implemented the adjustable timeout I found the behavior wasn't well defined. I'll probably break something...
This is done (or at least started...) in
changeset 2917I've tried to make it so any error condition including timeouts will free all the hooks, clear all the chunk types, and clear the remotecap settings. I also tried to clean up the logic in PTP_CHDK_RemoteCaptureGetData a bit.
One thing that is not very well defined is what happens if the timeout happens in the middle of a download. What will happen is that the (spytask/filewrite) hook will be unblocked as soon as the timeout expires, and continue on it's way. The ptp task will continue transferring data, which could potentially get corrupted. There will be no error status, unless the client expected to get more chunks or data types. I'm not really sure how we could make this safe. I don't think this is likely to crash or corrupt memory on the cam, but I could be wrong.
We do want the timeout to be possible even if the transfer has started, because the client could lose connection or crash etc. We might be able to make the ptp command return an error status, but it would be convoluted.
There's a fair chance I broke CAM_FILEWRITETASK_SEEKS (dryos >= r50) cams. I'd appreciate if anyone with those cams can test.
Some things to check
rs with the various format options. Be sure to check the actual jpeg and dng to make sure they are valid.
Timeout error status:
=set_remotecap_timeout(10)
rs
This should shoot a shot without any delay and return something like
ERROR: remote shoot error
Timeout, data not downloaded
=set_remotecap_timeout(10000)
=init_remotecap(1) ; shoot()
This should shoot, and then wait 10 seconds, doing whatever LED activity would be normal when writing a jpeg.
Cancel remotecap from script:
=set_remotecap_timeout();init_remotecap(1);press('shoot_half');repeat sleep(10) until get_shooting();click('shoot_full');sleep(3000);init_remotecap(0)
This should shoot, wait 3 seconds and then finish. No files should be written.
Note that set_remotecap_timeout state is global, and stays set until you change it. To reset back to default, you can use set_remotecap_timeout() with no arguments.