Skip to content

Commit 2b6378a

Browse files
authored
Support of FlySky NV 14 added (#229)
Support of FlySky NV 14 added
2 parents 1417c39 + 6af3d20 commit 2b6378a

File tree

13 files changed

+719
-3
lines changed

13 files changed

+719
-3
lines changed

src/SCRIPTS/BF/NV14/filters.lua

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
return {
2+
read = 92, -- MSP_FILTER_CONFIG
3+
write = 93, -- MSP_SET_FILTER_CONFIG
4+
eepromWrite = true,
5+
reboot = false,
6+
title = "Filters",
7+
minBytes = 37,
8+
outputBytes = 37,
9+
yMinLimit = 35,
10+
yMaxLimit = 215,
11+
text= {
12+
{ t = "Gyro Lowpass 1 Dynamic", x = 5, y = 35 },
13+
{ t = "Min Cutoff", x = 35, y = 55, to = SMLSIZE },
14+
{ t = "Max Cutoff", x = 35, y = 75, to = SMLSIZE },
15+
{ t = "Filter Type", x = 35, y = 95, to = SMLSIZE },
16+
17+
{ t = "Gyro Lowpass 1", x = 5, y = 115 },
18+
{ t = "Cutoff", x = 35, y = 135, to = SMLSIZE },
19+
{ t = "Filter Type", x = 35, y = 155, to = SMLSIZE },
20+
21+
{ t = "Gyro Lowpass 2", x = 5, y = 175 },
22+
{ t = "Cutoff", x = 35, y = 195, to = SMLSIZE },
23+
{ t = "Filter Type", x = 35, y = 215, to = SMLSIZE },
24+
25+
{ t = "Gyro Notch 1", x = 5, y = 235 },
26+
{ t = "Center", x = 35, y = 255, to = SMLSIZE },
27+
{ t = "Cutoff", x = 35, y = 275, to = SMLSIZE },
28+
29+
{ t = "Gyro Notch 2", x = 5, y = 295 },
30+
{ t = "Center", x = 35, y = 315, to = SMLSIZE },
31+
{ t = "Cutoff", x = 35, y = 335, to = SMLSIZE },
32+
33+
{ t = "D Term Lowpass 1 Dynamic", x = 5, y = 355 },
34+
{ t = "Min Cutoff", x = 35, y = 375, to = SMLSIZE },
35+
{ t = "Max Cutoff", x = 35, y = 395, to = SMLSIZE },
36+
{ t = "Filter Type", x = 35, y = 415, to = SMLSIZE },
37+
38+
{ t = "D Term Lowpass 1", x = 5, y = 435 },
39+
{ t = "Cutoff", x = 35, y = 455, to = SMLSIZE },
40+
{ t = "Filter Type", x = 35, y = 475, to = SMLSIZE },
41+
42+
{ t = "D Term Lowpass 2", x = 5, y = 495 },
43+
{ t = "Cutoff", x = 35, y = 515, to = SMLSIZE },
44+
{ t = "Filter Type", x = 35, y = 535, to = SMLSIZE },
45+
46+
{ t = "D Term Notch", x = 5, y = 555 },
47+
{ t = "Center", x = 35, y = 575, to = SMLSIZE },
48+
{ t = "Cutoff", x = 35, y = 595, to = SMLSIZE },
49+
50+
{ t = "Yaw Lowpass", x = 5, y = 615 },
51+
{ t = "Cutoff", x = 35, y = 635, to = SMLSIZE },
52+
},
53+
fields = {
54+
-- Gyro Lowpass 1 Dynamic
55+
{ x = 200, y = 55, min = 0, max = 1000, vals = { 30, 31 } },
56+
{ x = 200, y = 75, min = 0, max = 1000, vals = { 32, 33 } },
57+
{ x = 200, y = 95, min = 0, max = 1, vals = { 25 }, table = { [0] = "PT1", [1] = "BIQUAD" } },
58+
59+
-- Gyro Lowpass 1
60+
{ x = 200, y = 135, min = 0, max = 16000, vals = { 21, 22 } },
61+
{ x = 200, y = 155, min = 0, max = 1, vals = { 25 }, table = { [0] = "PT1", [1] = "BIQUAD" } },
62+
63+
-- Gyro Lowpass 2
64+
{ x = 200, y = 195, min = 0, max = 16000, vals = { 23, 24 } },
65+
{ x = 200, y = 215, min = 0, max = 1, vals = { 26 }, table = { [0] = "PT1", [1] = "BIQUAD" } },
66+
67+
-- Gyro Notch 1
68+
{ x = 200, y = 255, min = 0, max = 16000, vals = { 6, 7 } },
69+
{ x = 200, y = 275, min = 0, max = 16000, vals = { 8, 9 } },
70+
71+
-- Gyro Notch 2
72+
{ x = 200, y = 315, min = 0, max = 16000, vals = { 14, 15 } },
73+
{ x = 200, y = 335, min = 0, max = 16000, vals = { 16, 17 } },
74+
75+
-- D Term Lowpass 1 Dynamic
76+
{ x = 200, y = 375, min = 0, max = 1000, vals = { 34, 35 } },
77+
{ x = 200, y = 395, min = 0, max = 1000, vals = { 36, 37 } },
78+
{ x = 200, y = 415, min = 0, max = 1, vals = { 18 }, table = { [0] = "PT1", [1] = "BIQUAD" } },
79+
80+
-- D Term Lowpass 1
81+
{ x = 200, y = 455, min = 0, max = 16000, vals = { 2, 3 } },
82+
{ x = 200, y = 475, min = 0, max = 1, vals = { 18 }, table = { [0] = "PT1", [1] = "BIQUAD" } },
83+
84+
-- D Term Lowpass 2
85+
{ x = 200, y = 515, min = 0, max = 16000, vals = { 27, 28 } },
86+
{ x = 200, y = 535, min = 0, max = 1, vals = { 29 }, table = { [0] = "PT1", [1] = "BIQUAD" } },
87+
88+
-- D Term Notch
89+
{ x = 200, y = 575, min = 0, max = 16000, vals = { 10, 11 } },
90+
{ x = 200, y = 595, min = 0, max = 16000, vals = { 12, 13 } },
91+
92+
-- Yaw Lowpass
93+
{ x = 200, y = 635, min = 0, max = 500, vals = { 4, 5 } },
94+
}
95+
}

src/SCRIPTS/BF/NV14/gpspids.lua

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
return {
2+
read = 136, -- MSP_GPS_RESCUE_PIDS
3+
write = 226, -- MSP_SET_GPS_RESCUE_PIDS
4+
title = "GPS Rescue / PIDs",
5+
reboot = false,
6+
eepromWrite = true,
7+
minBytes = 14,
8+
requiredVersion = 1.041,
9+
text = {
10+
{ t = "P", x = 100, y = 48, to = MIDSIZE },
11+
{ t = "I", x = 180, y = 48, to = MIDSIZE },
12+
{ t = "D", x = 260, y = 48, to = MIDSIZE },
13+
{ t = "Throttle", x = 10, y = 100 },
14+
{ t = "Velocity", x = 10, y = 150 },
15+
{ t = "Yaw" , x = 10, y = 200 },
16+
},
17+
fields = {
18+
-- P
19+
{ x = 100, y = 100, min = 0, max = 200, vals = { 1, 3 }, to = MIDSIZE },
20+
{ x = 100, y = 150, min = 0, max = 200, vals = { 7, 8 }, to = MIDSIZE },
21+
{ x = 100, y = 200, min = 0, max = 500, vals = {13,14 }, to = MIDSIZE },
22+
-- I
23+
{ x = 180, y = 100, min = 0, max = 200, vals = { 3, 4 }, to = MIDSIZE },
24+
{ x = 180, y = 150, min = 0, max = 200, vals = { 9,10 }, to = MIDSIZE },
25+
-- D
26+
{ x = 260, y = 100, min = 0, max = 200, vals = { 5, 6 }, to = MIDSIZE },
27+
{ x = 260, y = 150, min = 0, max = 200, vals = { 11,12 }, to = MIDSIZE },
28+
},
29+
}

src/SCRIPTS/BF/NV14/nv14pre.lua

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
PageFiles =
2+
{
3+
"pids1.lua",
4+
"pids2.lua",
5+
"rates.lua",
6+
"pid_advanced.lua",
7+
"filters.lua",
8+
"pwm.lua",
9+
"rx.lua",
10+
"vtx.lua",
11+
"rescue.lua",
12+
"gpspids.lua",
13+
}
14+
15+
MenuBox = { x= (LCD_W -200)/2, y=LCD_H/2, w=200, x_offset=68, h_line=20, h_offset=6 }
16+
SaveBox = { x= (LCD_W -200)/2, y=LCD_H/2, w=180, x_offset=12, h=60, h_offset=12 }
17+
NoTelem = { LCD_W/2 - 50, LCD_H - 28, "No Telemetry", TEXT_COLOR + INVERS + BLINK }

src/SCRIPTS/BF/NV14/pid_advanced.lua

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
return {
2+
read = 94, -- MSP_PID_ADVANCED
3+
write = 95, -- MSP_SET_PID_ADVANCED
4+
title = "PID Advanced",
5+
reboot = false,
6+
eepromWrite = true,
7+
minBytes = 46,
8+
outputBytes = 46,
9+
yMinLimit = 35,
10+
yMaxLimit = 215,
11+
text = {
12+
{ t = "Acro Trainer", x = 5, y = 35 },
13+
{ t = "Angle Limit", x = 15, y = 55, to = SMLSIZE },
14+
15+
{ t = "Throttle Boost", x = 5, y = 75 },
16+
{ t = "Absolute Control", x = 5, y = 95 },
17+
{ t = "I Term Rotation", x = 5, y = 115 },
18+
{ t = "VBAT Compensation", x = 5, y = 135 },
19+
20+
{ t = "I Term Relax", x = 5, y = 155 },
21+
{ t = "Axes", x = 15, y = 175, to = SMLSIZE },
22+
{ t = "Type", x = 15, y = 195, to = SMLSIZE },
23+
24+
{ t = "Integrated Yaw", x = 5, y = 215 },
25+
26+
{ t = "Anti Gravity", x = 5, y = 235 },
27+
{ t = "Mode", x = 15, y = 255, to = SMLSIZE },
28+
{ t = "Gain", x = 15, y = 275, to = SMLSIZE },
29+
{ t = "Threshold", x = 15, y = 295, to = SMLSIZE },
30+
},
31+
fields = {
32+
{ x = 200, y = 55, min = 20, max = 80, vals = { 32 } },
33+
34+
{ x = 200, y = 75, min = 0, max = 100, vals = { 31 } },
35+
{ x = 200, y = 95, min = 0, max = 20, vals = { 30 } },
36+
{ x = 200, y = 115, min = 0, max = 1, vals = { 26 }, table = { [0]="OFF", "ON" } },
37+
{ x = 200, y = 135, min = 0, max = 1, vals = { 8 }, table = { [0]="OFF", "ON" } },
38+
39+
{ x = 200, y = 175, min = 0, max = 4, vals = { 28 }, table = { [0]="NONE", "RP", "RPY", "RP (increment only)", "RPY (increment only)" } },
40+
{ x = 200, y = 195, min = 0, max = 1, vals = { 29 }, table = { [0]="Gyro", "Setpoint" } },
41+
42+
{ x = 200, y = 215, min = 0, max = 1, vals = { 45 }, table = { [0]="OFF", "ON" } },
43+
44+
{ x = 200, y = 255, min = 0, max = 1, vals = { 39 }, table = { [0]="Smooth", "Step" } },
45+
{ x = 200, y = 275, min = 1000, max = 30000, vals = { 22, 23 }, scale = 1000, mult = 100 },
46+
{ x = 200, y = 295, min = 20, max = 1000, vals = { 20, 21 } },
47+
}
48+
}

src/SCRIPTS/BF/NV14/pids1.lua

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
2+
return {
3+
read = 112, -- MSP_PID
4+
write = 202, -- MSP_SET_PID
5+
title = "PIDs (1/2)",
6+
reboot = false,
7+
eepromWrite = true,
8+
minBytes = 9,
9+
text = {
10+
{ t = "P", x = 100, y = 48, to = MIDSIZE },
11+
{ t = "I", x = 180, y = 48, to = MIDSIZE },
12+
{ t = "D", x = 260, y = 48, to = MIDSIZE },
13+
{ t = "ROLL", x = 10, y = 100 },
14+
{ t = "PITCH", x = 10, y = 150 },
15+
{ t = "YAW", x = 10, y = 200 },
16+
},
17+
fields = {
18+
-- P
19+
{ x = 100, y = 100, min = 0, max = 200, vals = { 1 }, to = MIDSIZE },
20+
{ x = 100, y = 150, min = 0, max = 200, vals = { 4 }, to = MIDSIZE },
21+
{ x = 100, y = 200, min = 0, max = 200, vals = { 7 }, to = MIDSIZE },
22+
-- I
23+
{ x = 180, y = 100, min = 0, max = 200, vals = { 2 }, to = MIDSIZE },
24+
{ x = 180, y = 150, min = 0, max = 200, vals = { 5 }, to = MIDSIZE },
25+
{ x = 180, y = 200, min = 0, max = 200, vals = { 8 }, to = MIDSIZE },
26+
-- D
27+
{ x = 260, y = 100, min = 0, max = 200, vals = { 3 }, to = MIDSIZE },
28+
{ x = 260, y = 150, min = 0, max = 200, vals = { 6 }, to = MIDSIZE },
29+
{ x = 260, y = 200, min = 0, max = 200, vals = { 9 }, to = MIDSIZE },
30+
},
31+
}

src/SCRIPTS/BF/NV14/pids2.lua

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
2+
return {
3+
read = 94, -- MSP_PID_ADVANCED
4+
write = 95, -- MSP_SET_PID_ADVANCED
5+
title = "PIDs (2/2)",
6+
reboot = false,
7+
eepromWrite = true,
8+
minBytes = 44,
9+
text = {
10+
{ t = "Feed", x = 97, y = 52 },
11+
{ t = "forward", x = 82, y = 70 },
12+
{ t = "D", x = 207, y = 52 },
13+
{ t = "Min", x = 202, y = 70 },
14+
{ t = "ROLL", x = 28, y = 100 },
15+
{ t = "PITCH", x = 28, y = 150 },
16+
{ t = "YAW", x = 28, y = 200 },
17+
18+
{ t = "Feedforward", x = 28, y = 250 },
19+
{ t = "Transition", x = 40, y = 270, to = SMLSIZE },
20+
{ t = "D Min", x = 28, y = 300 },
21+
{ t = "Gain", x = 40, y = 320, to = SMLSIZE },
22+
{ t = "Advance", x = 40, y = 350, to = SMLSIZE },
23+
},
24+
fields = {
25+
-- ROLL FF
26+
{ x = 102, y = 100, min = 0, max = 2000, vals = { 33, 34 }, to = MIDSIZE },
27+
-- PITCH FF
28+
{ x = 102, y = 150, min = 0, max = 2000, vals = { 35, 36 }, to = MIDSIZE },
29+
-- YAW FF
30+
{ x = 102, y = 200, min = 0, max = 2000, vals = { 37, 38 }, to = MIDSIZE },
31+
-- ROLL D MIN
32+
{ x = 202, y = 100, min = 0, max = 100, vals = { 40 }, to = MIDSIZE },
33+
-- PITCH D MIN
34+
{ x = 202, y = 150, min = 0, max = 100, vals = { 41 }, to = MIDSIZE },
35+
-- YAW D MIN
36+
{ x = 202, y = 200, min = 0, max = 100, vals = { 42 }, to = MIDSIZE },
37+
-- FF TRANSITION
38+
{ x = 150, y = 270, min = 0, max = 100, vals = { 9 }, scale = 100 },
39+
-- D MIN GAIN
40+
{ x = 150, y = 320, min = 0, max = 100, vals = { 43 } },
41+
-- D MIN ADVANCE
42+
{ x = 150, y = 350, min = 0, max = 200, vals = { 44 } },
43+
},
44+
}

src/SCRIPTS/BF/NV14/pwm.lua

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
return {
2+
read = 90, -- MSP_ADVANCED_CONFIG
3+
write = 91, -- MSP_SET_ADVANCED_CONFIG
4+
reboot = true,
5+
eepromWrite = true,
6+
title = "PWM",
7+
minBytes = 9,
8+
text= {
9+
{ t = "Protocol", x = 36, y = 68 },
10+
{ t = "32K", x = 36, y = 110 },
11+
{ t = "Gyro Rt", x = 36, y = 155 },
12+
{ t = "PID Rt", x = 36, y = 200 },
13+
{ t = "Unsynced", x = 36, y = 242 },
14+
{ t = "PWM Rate", x = 36, y = 284 },
15+
{ t = "Idle Offset", x = 36, y = 326 }
16+
},
17+
fields = {
18+
{ x = 150, y = 68, vals = { 4 }, min = 0, max = 9, to = MIDSIZE,
19+
table = { [0] = "OFF", "ONESHOT125", "ONESHOT42",
20+
"MULTISHOT","BRUSHED",
21+
"DSHOT150", "DSHOT300", "DSHOT600","DSHOT1200",
22+
"PROSHOT1000" }
23+
},
24+
{ x = 150, y = 110, vals = { 9 }, min = 0, max = 1, to = MIDSIZE,
25+
table = { [0] = "OFF", "ON" },
26+
upd = function(self) self.updateRateTables(self) end
27+
},
28+
{ x = 150, y = 155, vals = { 1 }, min = 1, max = 32, to = MIDSIZE,
29+
upd = function(self) self.updatePidRateTable(self) end
30+
},
31+
{ x = 150, y = 200, vals = { 2 }, min = 1, max = 16, to = MIDSIZE },
32+
{ x = 150, y = 242, vals = { 3 }, min = 0, max = 1, to = MIDSIZE,
33+
table = { [0] = "OFF", "ON" } },
34+
{ x = 150, y = 284, vals = { 5, 6 }, min = 200, max = 32000, to = MIDSIZE },
35+
{ x = 150, y = 326, vals = { 7, 8 }, min = 0, max = 2000, scale = 100, to = MIDSIZE },
36+
},
37+
calculateGyroRates = function(self, baseRate)
38+
self.gyroRates = {}
39+
self.fields[2].table = {}
40+
for i=1, 32 do
41+
self.gyroRates[i] = baseRate/i
42+
local fmt = nil
43+
self.fields[2].table[i] = string.format("%.2f",baseRate/i)
44+
end
45+
end,
46+
calculatePidRates = function(self, baseRate)
47+
self.fields[3].table = {}
48+
for i=1, 16 do
49+
self.fields[3].table[i] = string.format("%.2f",baseRate/i)
50+
end
51+
end,
52+
updateRateTables = function(self)
53+
if self.values[9] == 0 then
54+
self.calculateGyroRates(self, 8)
55+
self.calculatePidRates(self, 8)
56+
elseif self.values[9] == 1 then
57+
self.calculateGyroRates(self, 32)
58+
self.calculatePidRates(self, 32)
59+
end
60+
end,
61+
updatePidRateTable = function(self)
62+
local newRateIdx = self.values[1]
63+
local newRate = self.gyroRates[newRateIdx]
64+
self.calculatePidRates(self, newRate)
65+
end
66+
}

src/SCRIPTS/BF/NV14/rates.lua

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
return {
2+
read = 111, -- MSP_RC_TUNING
3+
write = 204, -- MSP_SET_RC_TUNING
4+
title = "Rates",
5+
reboot = false,
6+
eepromWrite = true,
7+
minBytes = 16,
8+
text = {
9+
{ t = "RC", x = 100, y = 52 },
10+
{ t = "Rate", x = 94, y = 70 },
11+
{ t = "Super", x = 148, y = 52 },
12+
{ t = "Rate", x = 152, y = 70 },
13+
{ t = "RC", x = 214, y = 52 },
14+
{ t = "Expo", x = 207, y = 70 },
15+
{ t = "ROLL", x = 28, y = 100 },
16+
{ t = "PITCH", x = 28, y = 150 },
17+
{ t = "YAW", x = 28, y = 200 },
18+
19+
{ t = "Throttle", x = 28, y = 250 },
20+
{ t = "Mid", x = 40, y = 270, to = SMLSIZE },
21+
{ t = "Expo", x = 40, y = 290, to = SMLSIZE },
22+
{ t = "Limit Type", x = 40, y = 310, to = SMLSIZE },
23+
{ t = "Limit %", x = 40, y = 330, to = SMLSIZE },
24+
{ t = "TPA", x = 28, y = 350 },
25+
{ t = "Rate", x = 40, y = 370, to = SMLSIZE },
26+
{ t = "Breakpoint", x = 40, y = 390, to = SMLSIZE },
27+
},
28+
fields = {
29+
-- RC Rates
30+
{ x = 102, y = 100, vals = { 1 }, min = 0, max = 255, scale = 100, to = MIDSIZE },
31+
{ x = 102, y = 150, vals = { 13 }, min = 0, max = 255, scale = 100, to = MIDSIZE },
32+
{ x = 102, y = 200, vals = { 12 }, min = 0, max = 255, scale = 100, to = MIDSIZE },
33+
-- Super Rates
34+
{ x = 158, y = 100, vals = { 3 }, min = 0, max = 100, scale = 100, to = MIDSIZE },
35+
{ x = 158, y = 150, vals = { 4 }, min = 0, max = 100, scale = 100, to = MIDSIZE },
36+
{ x = 158, y = 200, vals = { 5 }, min = 0, max = 255, scale = 100, to = MIDSIZE },
37+
-- RC Expo
38+
{ x = 216, y = 100, vals = { 2 }, min = 0, max = 100, scale = 100, to = MIDSIZE },
39+
{ x = 216, y = 150, vals = { 14 }, min = 0, max = 100, scale = 100, to = MIDSIZE },
40+
{ x = 216, y = 200, vals = { 11 }, min = 0, max = 100, scale = 100, to = MIDSIZE },
41+
-- Throttle
42+
{ x = 150, y = 270, vals = { 7 }, min = 0, max = 100, scale = 100 },
43+
{ x = 150, y = 290, vals = { 8 }, min = 0, max = 100, scale = 100 },
44+
{ x = 150, y = 310, vals = { 15 }, min = 0, max = 2, table = { [0] = "OFF", "SCALE", "CLIP" } },
45+
{ x = 150, y = 330, vals = { 16 }, min = 25, max = 100 },
46+
-- TPA
47+
{ x = 150, y = 370, vals = { 6 }, min = 0, max = 100, scale = 100 },
48+
{ x = 150, y = 390, vals = { 9, 10 }, min = 1000, max = 2000 },
49+
},
50+
}

0 commit comments

Comments
 (0)