Skip to content

Commit 244efc7

Browse files
committed
Horus version 1.9.6 dev
- better handling of status text messages - added support CRSF telemetry packets with variable size - tuned script for lower cpu with CRSF
1 parent b4e0d46 commit 244efc7

86 files changed

Lines changed: 5625 additions & 581 deletions

Some content is hidden

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

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -126,13 +126,13 @@ local plotSources = {
126126
{"HDOP", "gpsHdopC", 5, 0.1},
127127
{"Num Sats", "numSats", 5, 1},
128128
{"Pitch", "pitch", 5, 1 },
129-
{"Rangefinder", "range", 5, 1 }, --cm
129+
{"Rangefinder", "range", 5, 1 },
130130
{"Roll", "roll", 5, 1 },
131131
{"RPM[1]", "rpm1", 5, 1 },
132132
{"RPM[2]", "rpm2", 5, 1 },
133133
{"RSSI", "rssi", 5, 1 },
134134
{"RSSI CRSF", "rssiCRSF", 5, 1 },
135-
{"Sonar", "range", 5, 1 }, --cm
135+
{"Sonar", "range", 5, 1 },
136136
{"Throttle", "throttle", 5, 1 },
137137
{"Vertical Speed", "vSpeed", 4, 0.1}, -- dm
138138
{"Wind Speed", "trueWindSpeed", 3, 0.1 },
@@ -499,14 +499,14 @@ local function saveConfig(conf)
499499
end
500500

501501
local function drawConfigMenuBars()
502-
lcd.setColor(CUSTOM_COLOR,0x0000)
502+
lcd.setColor(CUSTOM_COLOR,lcd.RGB(16,20,25))
503503
local itemIdx = string.format("%d/%d",menu.selectedItem,#menuItems)
504504
lcd.drawFilledRectangle(0,0, LCD_W, 20, CUSTOM_COLOR)
505505
lcd.drawRectangle(0, 0, LCD_W, 20, CUSTOM_COLOR)
506506
lcd.drawFilledRectangle(0,LCD_H-20, LCD_W, 20, CUSTOM_COLOR)
507507
lcd.drawRectangle(0, LCD_H-20, LCD_W, 20, CUSTOM_COLOR)
508-
lcd.setColor(CUSTOM_COLOR,0xFFFF)
509-
lcd.drawText(2,0,"Yaapu Telemetry Widget 1.9.5".." ("..'c47a1df'..")",CUSTOM_COLOR)
508+
lcd.setColor(CUSTOM_COLOR,WHITE)
509+
lcd.drawText(2,0,"Yaapu Telemetry Widget 1.9.6 dev".." ("..'4265d2f'..")",CUSTOM_COLOR)
510510
lcd.drawText(2,LCD_H-20+1,getConfigFilename(),CUSTOM_COLOR)
511511
lcd.drawText(LCD_W,LCD_H-20+1,itemIdx,CUSTOM_COLOR+RIGHT)
512512
end
@@ -540,7 +540,7 @@ local function decMenuItem(idx)
540540
end
541541

542542
local function drawItem(idx,flags)
543-
lcd.setColor(CUSTOM_COLOR,0xFFFF)
543+
lcd.setColor(CUSTOM_COLOR,WHITE)
544544
if type(menuItems[idx][4]) == "table" then
545545
lcd.drawText(280,25 + (idx-menu.offset-1)*20, menuItems[idx][4][menuItems[idx][3]],flags+CUSTOM_COLOR)
546546
else
@@ -590,7 +590,7 @@ local function drawConfigMenu(event)
590590
end
591591
--
592592
for m=1+menu.offset,math.min(#menuItems,11+menu.offset) do
593-
lcd.setColor(CUSTOM_COLOR,0xFFFF)
593+
lcd.setColor(CUSTOM_COLOR,WHITE)
594594
lcd.drawText(2,25 + (m-menu.offset-1)*20, menuItems[m][1],CUSTOM_COLOR)
595595
if m == menu.selectedItem then
596596
if menu.editSelected then
@@ -609,7 +609,7 @@ end
609609
-- RUN
610610
--------------------------
611611
local function run(event)
612-
lcd.setColor(CUSTOM_COLOR, 0x0AB1) -- hex 0x084c7b -- 073f66
612+
lcd.setColor(CUSTOM_COLOR, lcd.RGB(8,84,136)) -- hex 0x084c7b -- 073f66
613613
lcd.clear(CUSTOM_COLOR)
614614
---------------------
615615
-- CONFIG MENU

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ local function crossfirePop()
4545
return 0x00, 0x10, app_id, value
4646
elseif #data > 4 and data[1] == CRSF_CUSTOM_TELEM_STATUS_TEXT then
4747
return 0x00, 0x10, 0x5000, 0x00000000
48-
elseif #data > 48 and data[1] == CRSF_CUSTOM_TELEM_PASSTHROUGH_ARRAY then
48+
elseif #data >= 8 and data[1] == CRSF_CUSTOM_TELEM_PASSTHROUGH_ARRAY then
4949
-- passthrough array
5050
local app_id, value
51-
for i=0,data[2]-1
51+
for i=0,math.min(data[2]-1, 9)
5252
do
5353
app_id = bit32.lshift(data[4+(6*i)],8) + data[3+(6*i)]
5454
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)]
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
--[[
2+
// Auto Pilot Modes enumeration
3+
enum control_mode_t {
4+
LAND = 0, // currently just stops moving
5+
MANUAL = 1, // manual control
6+
VELOCITY = 2, // velocity mode
7+
LOITER = 3, // loiter mode (position hold)
8+
};
9+
--]]
10+
local flightModes = {}
11+
12+
-- copter flight modes
13+
flightModes[0]=""
14+
flightModes[1]="Land"
15+
flightModes[2]="Manual"
16+
flightModes[3]="Velocity"
17+
flightModes[4]="Loiter"
18+
19+
return {flightModes=flightModes}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
--[[
2+
// Auto Pilot Modes enumeration
3+
enum control_mode_t {
4+
STABILIZE = 0, // manual airframe angle with manual throttle
5+
ACRO = 1, // manual body-frame angular rate with manual throttle
6+
ALT_HOLD = 2, // manual airframe angle with automatic throttle
7+
AUTO = 3, // fully automatic waypoint control using mission commands
8+
GUIDED = 4, // fully automatic fly to coordinate or fly at velocity/direction using GCS immediate commands
9+
LOITER = 5, // automatic horizontal acceleration with automatic throttle
10+
RTL = 6, // automatic return to launching point
11+
CIRCLE = 7, // automatic circular flight with automatic throttle
12+
LAND = 9, // automatic landing with horizontal position control
13+
DRIFT = 11, // semi-automous position, yaw and throttle control
14+
SPORT = 13, // manual earth-frame angular rate control with manual throttle
15+
FLIP = 14, // automatically flip the vehicle on the roll axis
16+
AUTOTUNE = 15, // automatically tune the vehicle's roll and pitch gains
17+
POSHOLD = 16, // automatic position hold with manual override, with automatic throttle
18+
BRAKE = 17, // full-brake using inertial/GPS system, no pilot input
19+
THROW = 18, // throw to launch mode using inertial/GPS system, no pilot input
20+
AVOID_ADSB = 19, // automatic avoidance of obstacles in the macro scale - e.g. full-sized aircraft
21+
GUIDED_NOGPS = 20, // guided mode but only accepts attitude and altitude
22+
SMART_RTL = 21, // SMART_RTL returns to home by retracing its steps
23+
FLOWHOLD = 22, // FLOWHOLD holds position with optical flow without rangefinder
24+
FOLLOW = 23, // follow attempts to follow another vehicle or ground station
25+
ZIGZAG = 24, // ZIGZAG mode is able to fly in a zigzag manner with predefined point A and point B
26+
SYSTEMID = 25, // System ID mode produces automated system identification signals in the controllers
27+
AUTOROTATE = 26, // Autonomous autorotation
28+
AUTO_RTL = 27, // Auto RTL, this is not a true mode, AUTO will report as this mode if entered to perform a DO_LAND_START Landing sequence
29+
TURTLE = 28, // Flip over after crash
30+
};
31+
--]]
32+
local flightModes = {}
33+
34+
-- copter flight modes
35+
flightModes[0]=""
36+
flightModes[1]="Stabilize"
37+
flightModes[2]="Acro"
38+
flightModes[3]="AltHold"
39+
flightModes[4]="Auto"
40+
flightModes[5]="Guided"
41+
flightModes[6]="Loiter"
42+
flightModes[7]="RTL"
43+
flightModes[8]="Circle"
44+
flightModes[9]=""
45+
flightModes[10]="Land"
46+
flightModes[11]=""
47+
flightModes[12]="Drift"
48+
flightModes[13]=""
49+
flightModes[14]="Sport"
50+
flightModes[15]="Flip"
51+
flightModes[16]="AutoTune"
52+
flightModes[17]="PosHold"
53+
flightModes[18]="Brake"
54+
flightModes[19]="Throw"
55+
flightModes[20]="AvoidADSB"
56+
flightModes[21]="GuidedNOGPS"
57+
flightModes[22]="SmartRTL"
58+
flightModes[23]="FlowHold"
59+
flightModes[24]="Follow"
60+
flightModes[25]="ZigZag"
61+
flightModes[26]="SystemID"
62+
flightModes[27]="Autorotate"
63+
flightModes[28]="AutoRTL"
64+
flightModes[29]="Turtle"
65+
66+
return {flightModes=flightModes}
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
--[[
2+
MavToPT 2.63
3+
4+
uint8_t PX4FlightModeNum(uint8_t main, uint8_t sub) {
5+
switch(main) {
6+
case 1:
7+
return 0; // MANUAL
8+
case 2:
9+
return 1; // ALTITUDE
10+
case 3:
11+
return 2; // POSCTL
12+
case 4:
13+
switch(sub) {
14+
case 1:
15+
return 12; // AUTO READY
16+
case 2:
17+
return 13; // AUTO TAKEOFF
18+
case 3:
19+
return 14; // AUTO LOITER
20+
case 4:
21+
return 15; // AUTO MISSION
22+
case 5:
23+
return 16; // AUTO RTL
24+
case 6:
25+
return 17; // AUTO LAND
26+
case 7:
27+
return 18; // AUTO RTGS
28+
case 8:
29+
return 19; // AUTO FOLLOW ME
30+
case 9:
31+
return 20; // AUTO PRECLAND
32+
default:
33+
return 31; // AUTO UNKNOWN
34+
}
35+
case 5:
36+
return 3; // ACRO
37+
case 6:
38+
return 4; // OFFBOARD
39+
case 7:
40+
return 5; // STABILIZED
41+
case 8:
42+
return 6; // RATTITUDE
43+
case 9:
44+
return 7; // SIMPLE
45+
default:
46+
return 11; // UNKNOWN
47+
}
48+
}
49+
--]]
50+
local flightModes = {}
51+
-- plane flight modes
52+
flightModes[0] = "Manual"
53+
flightModes[1] = "AltCtl" --px4 specific
54+
flightModes[2] = "PosCtl" --px4 specific
55+
flightModes[3] = "Acro"
56+
flightModes[4] = "OffBoard" --px4 specific
57+
flightModes[5] = "Stabilize"
58+
flightModes[6] = "RAttitude" --px4 specific
59+
flightModes[7] = "Simple" --px4 specific
60+
flightModes[8] = ""
61+
flightModes[9] = ""
62+
flightModes[10] = ""
63+
flightModes[11] = ""
64+
flightModes[12] = "Ready" --px4 specific
65+
flightModes[13] = "Takeoff" --px4 specific
66+
flightModes[14] = "Loiter"
67+
flightModes[15] = "Mission" --px4 specific
68+
flightModes[16] = "RTL"
69+
flightModes[17] = "Land"
70+
flightModes[18] = ""
71+
flightModes[19] = "Follow"
72+
flightModes[20] = "PrecLand" --px4 specific
73+
flightModes[21] = ""
74+
flightModes[22] = ""
75+
flightModes[23] = ""
76+
flightModes[24] = ""
77+
flightModes[25] = ""
78+
flightModes[26] = ""
79+
flightModes[27] = ""
80+
flightModes[28] = ""
81+
flightModes[29] = ""
82+
flightModes[30] = ""
83+
flightModes[31] = "Unknown"
84+
85+
return {flightModes=flightModes}
86+

0 commit comments

Comments
 (0)