Skip to content

Commit 574644b

Browse files
committed
Horus version 1.9.5
- fixed terrain error in CRSF RF Mode 1 - added support for TURTLE flight mode - added support for BLIMP vehicle - added WIND rendering - added airspeed option on the hud above groundspeed FRSKY_OPTION = current value + 1 - added plotting page with selectable sensors to plot (configure as widget page 6)
1 parent c9aeca7 commit 574644b

File tree

3,260 files changed

+5641
-12874
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

3,260 files changed

+5641
-12874
lines changed

HORUS/SD/SCRIPTS/TOOLS/Yaapu Config.lua

Lines changed: 329 additions & 324 deletions
Large diffs are not rendered by default.
Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
local CRSF_FRAME_CUSTOM_TELEM = 0x80
2+
local CRSF_FRAME_CUSTOM_TELEM_LEGACY = 0x7F
3+
local CRSF_CUSTOM_TELEM_PASSTHROUGH = 0xF0
4+
local CRSF_CUSTOM_TELEM_STATUS_TEXT = 0xF1
5+
local CRSF_CUSTOM_TELEM_PASSTHROUGH_ARRAY = 0xF2
6+
7+
local packetStats = {
8+
[0x5000] = {count = 0, avg = 0 , tot = 0},
9+
[0x5001] = {count = 0, avg = 0 , tot = 0},
10+
[0x5002] = {count = 0, avg = 0 , tot = 0},
11+
[0x5003] = {count = 0, avg = 0 , tot = 0},
12+
[0x5004] = {count = 0, avg = 0 , tot = 0},
13+
[0x5005] = {count = 0, avg = 0 , tot = 0},
14+
[0x5006] = {count = 0, avg = 0 , tot = 0},
15+
[0x5007] = {count = 0, avg = 0 , tot = 0},
16+
[0x5008] = {count = 0, avg = 0 , tot = 0},
17+
[0x5009] = {count = 0, avg = 0 , tot = 0},
18+
[0x500A] = {count = 0, avg = 0 , tot = 0},
19+
[0x500B] = {count = 0, avg = 0 , tot = 0},
20+
[0x500C] = {count = 0, avg = 0 , tot = 0},
21+
[0x500D] = {count = 0, avg = 0 , tot = 0},
22+
link_rate = 0
23+
}
24+
25+
local logfilename
26+
local logfile
27+
local flushtime = getTime()
28+
29+
local function processTelemetry(data_id, value)
30+
if packetStats[data_id] ~= nil then
31+
packetStats[data_id].tot = packetStats[data_id].tot + 1
32+
packetStats[data_id].count = packetStats[data_id].count + 1
33+
end
34+
io.write(logfile, getTime(), ";0;", data_id, ";", value, "\r\n")
35+
end
36+
37+
local function crossfirePop()
38+
local command, data = crossfireTelemetryPop()
39+
-- command is 0x80 CRSF_FRAMETYPE_ARDUPILOT
40+
if (command == CRSF_FRAME_CUSTOM_TELEM or command == CRSF_FRAME_CUSTOM_TELEM_LEGACY) and data ~= nil then
41+
-- actual payload starts at data[2]
42+
if #data >= 7 and data[1] == CRSF_CUSTOM_TELEM_PASSTHROUGH then
43+
local app_id = bit32.lshift(data[3],8) + data[2]
44+
local value = bit32.lshift(data[7],24) + bit32.lshift(data[6],16) + bit32.lshift(data[5],8) + data[4]
45+
return 0x00, 0x10, app_id, value
46+
elseif #data > 4 and data[1] == CRSF_CUSTOM_TELEM_STATUS_TEXT then
47+
return 0x00, 0x10, 0x5000, 0x00000000
48+
elseif #data > 48 and data[1] == CRSF_CUSTOM_TELEM_PASSTHROUGH_ARRAY then
49+
-- passthrough array
50+
local app_id, value
51+
for i=0,data[2]-1
52+
do
53+
app_id = bit32.lshift(data[4+(6*i)],8) + data[3+(6*i)]
54+
value = bit32.lshift(data[8+(6*i)],24) + bit32.lshift(data[7+(6*i)],16) + bit32.lshift(data[6+(6*i)],8) + data[5+(6*i)]
55+
--pushMessage(7,string.format("CRSF:%d - %04X:%08X",i, app_id, value))
56+
processTelemetry(app_id, value)
57+
end
58+
end
59+
end
60+
return nil, nil ,nil ,nil
61+
end
62+
63+
local function getLogFilename()
64+
local datenow = getDateTime()
65+
local info = model.getInfo()
66+
local modelName = string.lower(string.gsub(info.name, "[%c%p%s%z]", ""))
67+
return modelName..string.format("-crsf-%04d%02d%02d_%02d%02d%02d.plog", datenow.year, datenow.mon, datenow.day, datenow.hour, datenow.min, datenow.sec)
68+
end
69+
70+
local last_refresh = getTime()
71+
72+
local function background()
73+
for i=1,5
74+
do
75+
local success, sensor_id, frame_id, data_id, value = pcall(crossfirePop)
76+
if success and frame_id == 0x10 then
77+
processTelemetry(data_id, value)
78+
end
79+
local now = getTime()
80+
if now - last_refresh > 100 then
81+
local aggregate = 0
82+
for i=0x00,0x0D
83+
do
84+
aggregate = aggregate + packetStats[0x5000+i].count
85+
86+
if packetStats[0x5000+i].avg == 0 then
87+
packetStats[0x5000+i].avg = packetStats[0x5000+i].count
88+
end
89+
packetStats[0x5000+i].avg = packetStats[0x5000+i].avg * 0.75 + packetStats[0x5000+i].count * 0.25
90+
packetStats[0x5000+i].count = 0
91+
end
92+
packetStats.link_rate = packetStats.link_rate * 0.75 + aggregate * 0.25
93+
last_refresh = now
94+
end
95+
end
96+
97+
if getTime() - flushtime > 50 then
98+
-- flush
99+
pcall(io.close,logfile)
100+
logfile = io.open("/LOGS/"..logfilename,"a")
101+
102+
flushtime = getTime()
103+
end
104+
end
105+
106+
local function run(event)
107+
background()
108+
lcd.setColor(CUSTOM_COLOR, 0x0AB1)
109+
lcd.clear(CUSTOM_COLOR)
110+
111+
lcd.setColor(CUSTOM_COLOR, WHITE)
112+
lcd.drawText(1,1,"YAAPU CRSF DEBUG 1.9.5", CUSTOM_COLOR)
113+
114+
local link_rate = 0
115+
for i=0x00,0x0D
116+
do
117+
lcd.setColor(CUSTOM_COLOR, WHITE)
118+
if packetStats[0x5000+i].avg > 0 then
119+
lcd.setColor(CUSTOM_COLOR, lcd.RGB(0,255,0))
120+
end
121+
lcd.drawText(20,22+(i*16),string.format("0x50%02X: rate: %.01fHz, count: %d, ", i, packetStats[0x5000+i].avg, packetStats[0x5000+i].tot),CUSTOM_COLOR)
122+
end
123+
lcd.drawText(LCD_W-10, 1,string.format("link rate: %.01fHz", packetStats.link_rate), CUSTOM_COLOR+RIGHT)
124+
125+
lcd.drawText(1,LCD_H-20,tostring("/LOGS/"..logfilename),CUSTOM_COLOR)
126+
collectgarbage()
127+
collectgarbage()
128+
return 0
129+
end
130+
131+
local function init()
132+
logfilename = getLogFilename()
133+
logfile = io.open("/LOGS/"..logfilename,"a")
134+
io.write(logfile, "counter;f_time;data_id;value\r\n")
135+
end
136+
137+
return {run=run, init=init}
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
local packetStats = {
2+
[0x5000] = {count = 0, avg = 0 , tot = 0},
3+
[0x5001] = {count = 0, avg = 0 , tot = 0},
4+
[0x5002] = {count = 0, avg = 0 , tot = 0},
5+
[0x5003] = {count = 0, avg = 0 , tot = 0},
6+
[0x5004] = {count = 0, avg = 0 , tot = 0},
7+
[0x5005] = {count = 0, avg = 0 , tot = 0},
8+
[0x5006] = {count = 0, avg = 0 , tot = 0},
9+
[0x5007] = {count = 0, avg = 0 , tot = 0},
10+
[0x5008] = {count = 0, avg = 0 , tot = 0},
11+
[0x5009] = {count = 0, avg = 0 , tot = 0},
12+
[0x500A] = {count = 0, avg = 0 , tot = 0},
13+
[0x500B] = {count = 0, avg = 0 , tot = 0},
14+
[0x500C] = {count = 0, avg = 0 , tot = 0},
15+
[0x500D] = {count = 0, avg = 0 , tot = 0},
16+
link_rate = 0
17+
}
18+
19+
local sensorIds = {}
20+
21+
local logfilename
22+
local logfile
23+
local flushtime = getTime()
24+
25+
local function processTelemetry(data_id, value)
26+
if packetStats[data_id] ~= nil then
27+
packetStats[data_id].tot = packetStats[data_id].tot + 1
28+
packetStats[data_id].count = packetStats[data_id].count + 1
29+
end
30+
io.write(logfile, getTime(), ";0;", data_id, ";", value, "\r\n")
31+
end
32+
33+
local function getLogFilename()
34+
local datenow = getDateTime()
35+
local info = model.getInfo()
36+
local modelName = string.lower(string.gsub(info.name, "[%c%p%s%z]", ""))
37+
return modelName..string.format("-frsky-%04d%02d%02d_%02d%02d%02d.plog", datenow.year, datenow.mon, datenow.day, datenow.hour, datenow.min, datenow.sec)
38+
end
39+
40+
local last_refresh = getTime()
41+
42+
local function background()
43+
for i=1,5
44+
do
45+
local success,sensor_id,frame_id,data_id,value = pcall(sportTelemetryPop)
46+
if success and sensor_id ~= nil then
47+
sensorIds[sensor_id] = true
48+
processTelemetry(data_id, value)
49+
end
50+
local now = getTime()
51+
if now - last_refresh > 100 then
52+
local aggregate = 0
53+
for i=0x00,0x0D
54+
do
55+
aggregate = aggregate + packetStats[0x5000+i].count
56+
57+
if packetStats[0x5000+i].avg == 0 then
58+
packetStats[0x5000+i].avg = packetStats[0x5000+i].count
59+
end
60+
packetStats[0x5000+i].avg = packetStats[0x5000+i].avg * 0.75 + packetStats[0x5000+i].count * 0.25
61+
packetStats[0x5000+i].count = 0
62+
end
63+
packetStats.link_rate = packetStats.link_rate * 0.75 + aggregate * 0.25
64+
last_refresh = now
65+
end
66+
end
67+
68+
if getTime() - flushtime > 50 then
69+
-- flush
70+
pcall(io.close,logfile)
71+
logfile = io.open("/LOGS/"..logfilename,"a")
72+
73+
flushtime = getTime()
74+
end
75+
end
76+
77+
local function run(event)
78+
background()
79+
lcd.setColor(CUSTOM_COLOR, 0x0AB1)
80+
lcd.clear(CUSTOM_COLOR)
81+
82+
lcd.setColor(CUSTOM_COLOR, WHITE)
83+
lcd.drawText(1,1,"YAAPU FRSKY DEBUG 1.9.5", CUSTOM_COLOR)
84+
85+
local link_rate = 0
86+
for i=0x00,0x0D
87+
do
88+
lcd.setColor(CUSTOM_COLOR, WHITE)
89+
if packetStats[0x5000+i].avg > 0 then
90+
lcd.setColor(CUSTOM_COLOR, lcd.RGB(0,255,0))
91+
end
92+
lcd.drawText(20,22+(i*16),string.format("0x50%02X: rate: %.01fHz, count: %d, ", i, packetStats[0x5000+i].avg, packetStats[0x5000+i].tot),CUSTOM_COLOR)
93+
end
94+
lcd.drawText(LCD_W-10, 1,string.format("link rate: %.01fHz", packetStats.link_rate), CUSTOM_COLOR+RIGHT)
95+
96+
lcd.drawText(1,LCD_H-20,tostring("/LOGS/"..logfilename),CUSTOM_COLOR)
97+
collectgarbage()
98+
collectgarbage()
99+
return 0
100+
end
101+
102+
local function init()
103+
logfilename = getLogFilename()
104+
logfile = io.open("/LOGS/"..logfilename,"a")
105+
io.write(logfile, "counter;f_time;data_id;value\r\n")
106+
end
107+
108+
return {run=run, init=init}

HORUS/SD/SCRIPTS/TOOLS/Yaapu Debug.lua

Lines changed: 0 additions & 74 deletions
This file was deleted.

0 commit comments

Comments
 (0)