Skip to content

Commit c463f69

Browse files
committed
Fixes from review.
1 parent fba4e6d commit c463f69

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

src/SCRIPTS/BF/background.lua

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ local function run_bg()
4242
-- or when connection is restored after e.g. lipo refresh
4343

4444
if API_VERSION < 1.041 then
45+
-- format: year (16) / month (8) / day (8) / hour (8) / min (8) / sec (8)
4546
local now = getDateTime()
4647
local year = now.year;
4748

@@ -55,16 +56,16 @@ local function run_bg()
5556
values[6] = now.min
5657
values[7] = now.sec
5758
else
59+
-- format: seconds after the epoch (32) / milliseconds (16)
5860
local now = getRtcTime()
5961

6062
values = {}
61-
values[1] = bit32.band(now, 0xFF)
62-
now = bit32.rshift(now, 8)
63-
values[2] = bit32.band(now, 0xFF)
64-
now = bit32.rshift(now, 8)
65-
values[3] = bit32.band(now, 0xFF)
66-
now = bit32.rshift(now, 8)
67-
values[4] = bit32.band(now, 0xFF)
63+
64+
for i = 1, 4 do
65+
values[i] = bit32.band(now, 0xFF)
66+
now = bit32.rshift(now, 8)
67+
end
68+
6869
values[5] = 0 -- we don't have milliseconds
6970
values[6] = 0
7071
end

src/SCRIPTS/TELEMETRY/bf.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ SCRIPT_HOME = "/SCRIPTS/BF"
77
-- Version mapping:
88
-- 1.041: Betaflight 4.0 and newer
99
-- <1.041: Betaflight 3.5 and older
10-
API_VERSION = 1.041
10+
API_VERSION = 1.040
1111

1212
protocol = assert(loadScript(SCRIPT_HOME.."/protocols.lua"))()
1313
radio = assert(loadScript(SCRIPT_HOME.."/radios.lua"))()

0 commit comments

Comments
 (0)