File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,8 @@ local function run_bg()
4040 -- assuming when sensor value higher than 0 there is an telemetry connection
4141 -- only send datetime one time after telemetry connection became available
4242 -- or when connection is restored after e.g. lipo refresh
43+
44+ --[[ Uncomment for firmware versions before 4.0:
4345 local now = getDateTime()
4446 local year = now.year;
4547
@@ -52,6 +54,21 @@ local function run_bg()
5254 values[5] = now.hour
5355 values[6] = now.min
5456 values[7] = now.sec
57+ ]]
58+
59+ --[[ Uncomment for firmware versions 4.0 and up:]]
60+ local now = getRtcTime ()
61+
62+ values = {}
63+ values [1 ] = bit32.band (now , 0xFF )
64+ now = bit32.rshift (now , 8 )
65+ values [2 ] = bit32.band (now , 0xFF )
66+ now = bit32.rshift (now , 8 )
67+ values [3 ] = bit32.band (now , 0xFF )
68+ now = bit32.rshift (now , 8 )
69+ values [4 ] = bit32.band (now , 0xFF )
70+ values [5 ] = 0 -- we don't have milliseconds
71+ values [6 ] = 0
5572
5673 -- send msp message
5774 protocol .mspWrite (MSP_SET_RTC , values )
You can’t perform that action at this time.
0 commit comments