On a slightly different note, I'm having trouble setting the focus distance reliably with set_focus(). If I do the following (inside a shell script):
chdkptp -c -e"luar set_focus($FOCUS)"
chdkptp -c -e'shoot'
chdkptp -c -e'luar set_aflock(1)'
Then get_focus() sometimes returns something close to the value in $FOCUS, and sometimes wildly different. The A4000 is completely P&S, and there is no manual focus on it. It seems like the camera continues automatically adjusting the focus before it can be locked.
The camera manual says that the focus can be locked inside the half-shoot/release cycle using the buttons. Indeed, the following code works fine:
chdkptp -c -e'luar set_aflock(0)' -e'luar press("shoot_half")' -e'luar sleep(1000)' -e'luar set_aflock(1)' -e'luar release("shoot_half")'
except that the focus can be a bit hit and miss, depending on the subject of the photo. I've searched this forum for tips on how to use set_focus(), but none of the results worked for me (either the focus value ended up being something else, or the camera crashed). The only way I have found to be able to set the value is to put the above line inside a while loop and keep repeating until it hits the value I want. This can take a while, and isn't guaranteed to ever stop, so it's a sucky solution.
Does anyone have any tips on how to do this right with a P&S camera like the A4000?