What happens is the record, stop recording commands get out of sync so when my software tells it to stop recording, it actually starts recording instead. That creates a large video file that fills up the SD card. So now the SD card is full and then chdkptp tells it to record (press the shutter button). That's when it crashes. Does that help any? That scenario has happened at least 5-6 times in the last several months.
Not really. As I said, chdkptp doesn't know anything about the size free space, so that isn't the direct cause of the crash. If the camera crashes/shuts down/stops responding because the disk is full, then versions of chdkptp without the fix I mentioned earlier might crash when it goes to clean up the connection.
An alternate solution would be to know if the camera is currently recording or not. Then my software wouldn't be making assumptions that either it has stopped or started recording.
=return get_movie_status()
should do it if it's implemented correctly on your port. Known values from platform.h
#define VIDEO_RECORD_NEVER_STARTED 0
#define VIDEO_RECORD_STOPPED 1
#define VIDEO_RECORD_IN_PROGRESS 4
There may also be propcases that indicate recording.