mirror of
https://github.com/OpenSolo/OpenSolo.git
synced 2025-04-29 14:14:30 +02:00
GOPRO: Set GoPro clock automatically
User or app needs to change /usr/bin/extSettings.conf "timeOffsetHrs" to be their local time offset from UTC in hours. The default is "None", and the clock will not update. The Solo has no other way to know what timezone it is in, so this must be set manually or with the app. If set, for example to -5, the GoPro clock will automatically be set for the current UTC time minus 5 hours (eastern standard time).
This commit is contained in:
parent
37a4180df0
commit
cac8cc9b5e
@ -168,6 +168,8 @@ class GoProManager():
|
||||
self.sendGoProRequest(mavutil.mavlink.GOPRO_COMMAND_PROTUNE_GAIN)
|
||||
self.sendGoProRequest(mavutil.mavlink.GOPRO_COMMAND_PROTUNE_SHARPNESS)
|
||||
self.sendGoProRequest(mavutil.mavlink.GOPRO_COMMAND_PROTUNE_EXPOSURE)
|
||||
time.sleep(5)
|
||||
self.update_gopro_time()
|
||||
|
||||
if self.captureMode != captureMode:
|
||||
self.captureMode = captureMode
|
||||
@ -362,12 +364,21 @@ class GoProManager():
|
||||
self.sendGoProRequest(command)
|
||||
|
||||
# Updates the gopro time.
|
||||
def update_gopro_time(self, timeInSecs):
|
||||
logger.log("[gopro]: Updating gopro time to " + str(timeInSecs))
|
||||
tm = int(timeInSecs)
|
||||
tm_list = [tm & 0xff, (tm >> 8) & 0xff, (tm >> 16) & 0xff, (tm >> 24) & 0xff]
|
||||
|
||||
self.sendGoProCommand(mavutil.mavlink.GOPRO_COMMAND_TIME, tm_list)
|
||||
def update_gopro_time(self):
|
||||
try:
|
||||
settings_offset=settings.readSettingExt("timeOffsetHrs")
|
||||
logger.log("[GoPro] Time offset Setting: " + str(settings_offset))
|
||||
if settings_offset != "None":
|
||||
localTimeSec = time.time()+((float(settings_offset) * 3600)) # Unix time stamp + offset seconds for local time
|
||||
logger.log("[gopro]: Updating gopro time to " + str(localTimeSec))
|
||||
tm = int(localTimeSec)
|
||||
tm_list = [tm & 0xff, (tm >> 8) & 0xff, (tm >> 16) & 0xff, (tm >> 24) & 0xff]
|
||||
self.sendGoProCommand(mavutil.mavlink.GOPRO_COMMAND_TIME, tm_list)
|
||||
else:
|
||||
logger.log("[GoPro] Time offset not configured. Could not update GoPro clock.")
|
||||
except:
|
||||
logger.log("Unable to set GoPro time.")
|
||||
|
||||
|
||||
def isValidCommandValue(self, value):
|
||||
if value[0] < 0 or value[0] > 255:
|
||||
|
@ -7,6 +7,7 @@
|
||||
7,5=-1, -1, -1
|
||||
8,7=-1, -1, -1
|
||||
8,5=-1, -1, 3
|
||||
timeOffsetHrs=None
|
||||
|
||||
|
||||
[USAGE]
|
||||
@ -68,6 +69,9 @@ APP_SHOT_RTL = 10
|
||||
19 = ADS-B Avoid (ArduCopter 3.5+ and not a user mode)
|
||||
20 = Guided No GPS (ArduCopter 3.5+)
|
||||
21 = SmartRTL (ArduCopter 3.6+ Only)
|
||||
22 = Optical Flow Hold (ArduCopter 3.6+)
|
||||
23 = Follow (ArduCopter 3.6+)
|
||||
24 = ZIGZAG (ArduCopter 3.7+)
|
||||
|
||||
|
||||
[USAGE-FUNCTIONS]
|
||||
|
Loading…
x
Reference in New Issue
Block a user