I am working on a feature in my app where the drone takes a GPS lapse, but also allows the user to take additional photos with the shutter button. By default, hitting the shutter button in the middle of a GPS lapse stops it, so I have grabbed the controller’s shutter button and added an event listener that will switch the camera’s photo mode from GPS_LAPSE to SINGLE, take a photo, then switch it back and restart the GPS lapse. I’ve implemented a queue of commands to send to the camera with the idea that each time the ref updates, there is a chance for the next command to execute and the command will cause the ref to update again. However, the checks I’ve added don’t seem to be accurately telling me if the camera is ready for the next step.
I would like to know what I need to check to ensure that I can:
Switch the camera’s photo mode (I thought it would just be making sure it’s nto currently updating in the Camera’s config)
Start or stop capture (I’m not sure about this one. I checked if the PhotoCapture component exists and it’s not updating the config)
The “updating” of the camera 2 config is only for the config.
It will be reset when we are receiving a new config from the drone, following a change by the user, or the drone itself.
What you can check after the switch, is that you are in SINGLE, and updating at false.
Once it is done you can start the photoCapture, and check the state received. If it is stopping you can have the reason why (captureDone), or stopped you can get the media id (latestSavedMediaId)
When you get either of those state you can do a stop() on the PhotoCapture, and then switch back to GPS_LAPSE.
Thanks, that did help a bit and I was able to get it working.
However, one thing I noticed is that switching the PhotoMode had to be done when the PhotoCapture was all the way Stopped, and the Ref was not triggering for the transition between Stopping and Stopped.
If I tried to switch while it was Stopping, it would switch then immediately switch back.
I ended up adding a timer to my queue that would retry queue items to make sure they didn’t get stuck by missing events and that did the trick.