Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 95 additions & 0 deletions src/SCRIPTS/BF/NV14/filters.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
return {
read = 92, -- MSP_FILTER_CONFIG
write = 93, -- MSP_SET_FILTER_CONFIG
eepromWrite = true,
reboot = false,
title = "Filters",
minBytes = 37,
outputBytes = 37,
yMinLimit = 35,
yMaxLimit = 215,
text= {
{ t = "Gyro Lowpass 1 Dynamic", x = 5, y = 35 },
{ t = "Min Cutoff", x = 35, y = 55, to = SMLSIZE },
{ t = "Max Cutoff", x = 35, y = 75, to = SMLSIZE },
{ t = "Filter Type", x = 35, y = 95, to = SMLSIZE },

{ t = "Gyro Lowpass 1", x = 5, y = 115 },
{ t = "Cutoff", x = 35, y = 135, to = SMLSIZE },
{ t = "Filter Type", x = 35, y = 155, to = SMLSIZE },

{ t = "Gyro Lowpass 2", x = 5, y = 175 },
{ t = "Cutoff", x = 35, y = 195, to = SMLSIZE },
{ t = "Filter Type", x = 35, y = 215, to = SMLSIZE },

{ t = "Gyro Notch 1", x = 5, y = 235 },
{ t = "Center", x = 35, y = 255, to = SMLSIZE },
{ t = "Cutoff", x = 35, y = 275, to = SMLSIZE },

{ t = "Gyro Notch 2", x = 5, y = 295 },
{ t = "Center", x = 35, y = 315, to = SMLSIZE },
{ t = "Cutoff", x = 35, y = 335, to = SMLSIZE },

{ t = "D Term Lowpass 1 Dynamic", x = 5, y = 355 },
{ t = "Min Cutoff", x = 35, y = 375, to = SMLSIZE },
{ t = "Max Cutoff", x = 35, y = 395, to = SMLSIZE },
{ t = "Filter Type", x = 35, y = 415, to = SMLSIZE },

{ t = "D Term Lowpass 1", x = 5, y = 435 },
{ t = "Cutoff", x = 35, y = 455, to = SMLSIZE },
{ t = "Filter Type", x = 35, y = 475, to = SMLSIZE },

{ t = "D Term Lowpass 2", x = 5, y = 495 },
{ t = "Cutoff", x = 35, y = 515, to = SMLSIZE },
{ t = "Filter Type", x = 35, y = 535, to = SMLSIZE },

{ t = "D Term Notch", x = 5, y = 555 },
{ t = "Center", x = 35, y = 575, to = SMLSIZE },
{ t = "Cutoff", x = 35, y = 595, to = SMLSIZE },

{ t = "Yaw Lowpass", x = 5, y = 615 },
{ t = "Cutoff", x = 35, y = 635, to = SMLSIZE },
},
fields = {
-- Gyro Lowpass 1 Dynamic
{ x = 200, y = 55, min = 0, max = 1000, vals = { 30, 31 } },
{ x = 200, y = 75, min = 0, max = 1000, vals = { 32, 33 } },
{ x = 200, y = 95, min = 0, max = 1, vals = { 25 }, table = { [0] = "PT1", [1] = "BIQUAD" } },

-- Gyro Lowpass 1
{ x = 200, y = 135, min = 0, max = 16000, vals = { 21, 22 } },
{ x = 200, y = 155, min = 0, max = 1, vals = { 25 }, table = { [0] = "PT1", [1] = "BIQUAD" } },

-- Gyro Lowpass 2
{ x = 200, y = 195, min = 0, max = 16000, vals = { 23, 24 } },
{ x = 200, y = 215, min = 0, max = 1, vals = { 26 }, table = { [0] = "PT1", [1] = "BIQUAD" } },

-- Gyro Notch 1
{ x = 200, y = 255, min = 0, max = 16000, vals = { 6, 7 } },
{ x = 200, y = 275, min = 0, max = 16000, vals = { 8, 9 } },

-- Gyro Notch 2
{ x = 200, y = 315, min = 0, max = 16000, vals = { 14, 15 } },
{ x = 200, y = 335, min = 0, max = 16000, vals = { 16, 17 } },

-- D Term Lowpass 1 Dynamic
{ x = 200, y = 375, min = 0, max = 1000, vals = { 34, 35 } },
{ x = 200, y = 395, min = 0, max = 1000, vals = { 36, 37 } },
{ x = 200, y = 415, min = 0, max = 1, vals = { 18 }, table = { [0] = "PT1", [1] = "BIQUAD" } },

-- D Term Lowpass 1
{ x = 200, y = 455, min = 0, max = 16000, vals = { 2, 3 } },
{ x = 200, y = 475, min = 0, max = 1, vals = { 18 }, table = { [0] = "PT1", [1] = "BIQUAD" } },

-- D Term Lowpass 2
{ x = 200, y = 515, min = 0, max = 16000, vals = { 27, 28 } },
{ x = 200, y = 535, min = 0, max = 1, vals = { 29 }, table = { [0] = "PT1", [1] = "BIQUAD" } },

-- D Term Notch
{ x = 200, y = 575, min = 0, max = 16000, vals = { 10, 11 } },
{ x = 200, y = 595, min = 0, max = 16000, vals = { 12, 13 } },

-- Yaw Lowpass
{ x = 200, y = 635, min = 0, max = 500, vals = { 4, 5 } },
}
}
29 changes: 29 additions & 0 deletions src/SCRIPTS/BF/NV14/gpspids.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
return {
read = 136, -- MSP_GPS_RESCUE_PIDS
write = 226, -- MSP_SET_GPS_RESCUE_PIDS
title = "GPS Rescue / PIDs",
reboot = false,
eepromWrite = true,
minBytes = 14,
requiredVersion = 1.041,
text = {
{ t = "P", x = 100, y = 48, to = MIDSIZE },
{ t = "I", x = 180, y = 48, to = MIDSIZE },
{ t = "D", x = 260, y = 48, to = MIDSIZE },
{ t = "Throttle", x = 10, y = 100 },
{ t = "Velocity", x = 10, y = 150 },
{ t = "Yaw" , x = 10, y = 200 },
},
fields = {
-- P
{ x = 100, y = 100, min = 0, max = 200, vals = { 1, 3 }, to = MIDSIZE },
{ x = 100, y = 150, min = 0, max = 200, vals = { 7, 8 }, to = MIDSIZE },
{ x = 100, y = 200, min = 0, max = 500, vals = {13,14 }, to = MIDSIZE },
-- I
{ x = 180, y = 100, min = 0, max = 200, vals = { 3, 4 }, to = MIDSIZE },
{ x = 180, y = 150, min = 0, max = 200, vals = { 9,10 }, to = MIDSIZE },
-- D
{ x = 260, y = 100, min = 0, max = 200, vals = { 5, 6 }, to = MIDSIZE },
{ x = 260, y = 150, min = 0, max = 200, vals = { 11,12 }, to = MIDSIZE },
},
}
17 changes: 17 additions & 0 deletions src/SCRIPTS/BF/NV14/nv14pre.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
PageFiles =
{
"pids1.lua",
"pids2.lua",
"rates.lua",
"pid_advanced.lua",
"filters.lua",
"pwm.lua",
"rx.lua",
"vtx.lua",
"rescue.lua",
"gpspids.lua",
}

MenuBox = { x= (LCD_W -200)/2, y=LCD_H/2, w=200, x_offset=68, h_line=20, h_offset=6 }
SaveBox = { x= (LCD_W -200)/2, y=LCD_H/2, w=180, x_offset=12, h=60, h_offset=12 }
NoTelem = { LCD_W/2 - 50, LCD_H - 28, "No Telemetry", TEXT_COLOR + INVERS + BLINK }
48 changes: 48 additions & 0 deletions src/SCRIPTS/BF/NV14/pid_advanced.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
return {
read = 94, -- MSP_PID_ADVANCED
write = 95, -- MSP_SET_PID_ADVANCED
title = "PID Advanced",
reboot = false,
eepromWrite = true,
minBytes = 46,
outputBytes = 46,
yMinLimit = 35,
yMaxLimit = 215,
text = {
{ t = "Acro Trainer", x = 5, y = 35 },
{ t = "Angle Limit", x = 15, y = 55, to = SMLSIZE },

{ t = "Throttle Boost", x = 5, y = 75 },
{ t = "Absolute Control", x = 5, y = 95 },
{ t = "I Term Rotation", x = 5, y = 115 },
{ t = "VBAT Compensation", x = 5, y = 135 },

{ t = "I Term Relax", x = 5, y = 155 },
{ t = "Axes", x = 15, y = 175, to = SMLSIZE },
{ t = "Type", x = 15, y = 195, to = SMLSIZE },

{ t = "Integrated Yaw", x = 5, y = 215 },

{ t = "Anti Gravity", x = 5, y = 235 },
{ t = "Mode", x = 15, y = 255, to = SMLSIZE },
{ t = "Gain", x = 15, y = 275, to = SMLSIZE },
{ t = "Threshold", x = 15, y = 295, to = SMLSIZE },
},
fields = {
{ x = 200, y = 55, min = 20, max = 80, vals = { 32 } },

{ x = 200, y = 75, min = 0, max = 100, vals = { 31 } },
{ x = 200, y = 95, min = 0, max = 20, vals = { 30 } },
{ x = 200, y = 115, min = 0, max = 1, vals = { 26 }, table = { [0]="OFF", "ON" } },
{ x = 200, y = 135, min = 0, max = 1, vals = { 8 }, table = { [0]="OFF", "ON" } },

{ x = 200, y = 175, min = 0, max = 4, vals = { 28 }, table = { [0]="NONE", "RP", "RPY", "RP (increment only)", "RPY (increment only)" } },
{ x = 200, y = 195, min = 0, max = 1, vals = { 29 }, table = { [0]="Gyro", "Setpoint" } },

{ x = 200, y = 215, min = 0, max = 1, vals = { 45 }, table = { [0]="OFF", "ON" } },

{ x = 200, y = 255, min = 0, max = 1, vals = { 39 }, table = { [0]="Smooth", "Step" } },
{ x = 200, y = 275, min = 1000, max = 30000, vals = { 22, 23 }, scale = 1000, mult = 100 },
{ x = 200, y = 295, min = 20, max = 1000, vals = { 20, 21 } },
}
}
31 changes: 31 additions & 0 deletions src/SCRIPTS/BF/NV14/pids1.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

return {
read = 112, -- MSP_PID
write = 202, -- MSP_SET_PID
title = "PIDs (1/2)",
reboot = false,
eepromWrite = true,
minBytes = 9,
text = {
{ t = "P", x = 100, y = 48, to = MIDSIZE },
{ t = "I", x = 180, y = 48, to = MIDSIZE },
{ t = "D", x = 260, y = 48, to = MIDSIZE },
{ t = "ROLL", x = 10, y = 100 },
{ t = "PITCH", x = 10, y = 150 },
{ t = "YAW", x = 10, y = 200 },
},
fields = {
-- P
{ x = 100, y = 100, min = 0, max = 200, vals = { 1 }, to = MIDSIZE },
{ x = 100, y = 150, min = 0, max = 200, vals = { 4 }, to = MIDSIZE },
{ x = 100, y = 200, min = 0, max = 200, vals = { 7 }, to = MIDSIZE },
-- I
{ x = 180, y = 100, min = 0, max = 200, vals = { 2 }, to = MIDSIZE },
{ x = 180, y = 150, min = 0, max = 200, vals = { 5 }, to = MIDSIZE },
{ x = 180, y = 200, min = 0, max = 200, vals = { 8 }, to = MIDSIZE },
-- D
{ x = 260, y = 100, min = 0, max = 200, vals = { 3 }, to = MIDSIZE },
{ x = 260, y = 150, min = 0, max = 200, vals = { 6 }, to = MIDSIZE },
{ x = 260, y = 200, min = 0, max = 200, vals = { 9 }, to = MIDSIZE },
},
}
44 changes: 44 additions & 0 deletions src/SCRIPTS/BF/NV14/pids2.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@

return {
read = 94, -- MSP_PID_ADVANCED
write = 95, -- MSP_SET_PID_ADVANCED
title = "PIDs (2/2)",
reboot = false,
eepromWrite = true,
minBytes = 44,
text = {
{ t = "Feed", x = 97, y = 52 },
{ t = "forward", x = 82, y = 70 },
{ t = "D", x = 207, y = 52 },
{ t = "Min", x = 202, y = 70 },
{ t = "ROLL", x = 28, y = 100 },
{ t = "PITCH", x = 28, y = 150 },
{ t = "YAW", x = 28, y = 200 },

{ t = "Feedforward", x = 28, y = 250 },
{ t = "Transition", x = 40, y = 270, to = SMLSIZE },
{ t = "D Min", x = 28, y = 300 },
{ t = "Gain", x = 40, y = 320, to = SMLSIZE },
{ t = "Advance", x = 40, y = 350, to = SMLSIZE },
},
fields = {
-- ROLL FF
{ x = 102, y = 100, min = 0, max = 2000, vals = { 33, 34 }, to = MIDSIZE },
-- PITCH FF
{ x = 102, y = 150, min = 0, max = 2000, vals = { 35, 36 }, to = MIDSIZE },
-- YAW FF
{ x = 102, y = 200, min = 0, max = 2000, vals = { 37, 38 }, to = MIDSIZE },
-- ROLL D MIN
{ x = 202, y = 100, min = 0, max = 100, vals = { 40 }, to = MIDSIZE },
-- PITCH D MIN
{ x = 202, y = 150, min = 0, max = 100, vals = { 41 }, to = MIDSIZE },
-- YAW D MIN
{ x = 202, y = 200, min = 0, max = 100, vals = { 42 }, to = MIDSIZE },
-- FF TRANSITION
{ x = 150, y = 270, min = 0, max = 100, vals = { 9 }, scale = 100 },
-- D MIN GAIN
{ x = 150, y = 320, min = 0, max = 100, vals = { 43 } },
-- D MIN ADVANCE
{ x = 150, y = 350, min = 0, max = 200, vals = { 44 } },
},
}
66 changes: 66 additions & 0 deletions src/SCRIPTS/BF/NV14/pwm.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
return {
read = 90, -- MSP_ADVANCED_CONFIG
write = 91, -- MSP_SET_ADVANCED_CONFIG
reboot = true,
eepromWrite = true,
title = "PWM",
minBytes = 9,
text= {
{ t = "Protocol", x = 36, y = 68 },
{ t = "32K", x = 36, y = 110 },
{ t = "Gyro Rt", x = 36, y = 155 },
{ t = "PID Rt", x = 36, y = 200 },
{ t = "Unsynced", x = 36, y = 242 },
{ t = "PWM Rate", x = 36, y = 284 },
{ t = "Idle Offset", x = 36, y = 326 }
},
fields = {
{ x = 150, y = 68, vals = { 4 }, min = 0, max = 9, to = MIDSIZE,
table = { [0] = "OFF", "ONESHOT125", "ONESHOT42",
"MULTISHOT","BRUSHED",
"DSHOT150", "DSHOT300", "DSHOT600","DSHOT1200",
"PROSHOT1000" }
},
{ x = 150, y = 110, vals = { 9 }, min = 0, max = 1, to = MIDSIZE,
table = { [0] = "OFF", "ON" },
upd = function(self) self.updateRateTables(self) end
},
{ x = 150, y = 155, vals = { 1 }, min = 1, max = 32, to = MIDSIZE,
upd = function(self) self.updatePidRateTable(self) end
},
{ x = 150, y = 200, vals = { 2 }, min = 1, max = 16, to = MIDSIZE },
{ x = 150, y = 242, vals = { 3 }, min = 0, max = 1, to = MIDSIZE,
table = { [0] = "OFF", "ON" } },
{ x = 150, y = 284, vals = { 5, 6 }, min = 200, max = 32000, to = MIDSIZE },
{ x = 150, y = 326, vals = { 7, 8 }, min = 0, max = 2000, scale = 100, to = MIDSIZE },
},
calculateGyroRates = function(self, baseRate)
self.gyroRates = {}
self.fields[2].table = {}
for i=1, 32 do
self.gyroRates[i] = baseRate/i
local fmt = nil
self.fields[2].table[i] = string.format("%.2f",baseRate/i)
end
end,
calculatePidRates = function(self, baseRate)
self.fields[3].table = {}
for i=1, 16 do
self.fields[3].table[i] = string.format("%.2f",baseRate/i)
end
end,
updateRateTables = function(self)
if self.values[9] == 0 then
self.calculateGyroRates(self, 8)
self.calculatePidRates(self, 8)
elseif self.values[9] == 1 then
self.calculateGyroRates(self, 32)
self.calculatePidRates(self, 32)
end
end,
updatePidRateTable = function(self)
local newRateIdx = self.values[1]
local newRate = self.gyroRates[newRateIdx]
self.calculatePidRates(self, newRate)
end
}
50 changes: 50 additions & 0 deletions src/SCRIPTS/BF/NV14/rates.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
return {
read = 111, -- MSP_RC_TUNING
write = 204, -- MSP_SET_RC_TUNING
title = "Rates",
reboot = false,
eepromWrite = true,
minBytes = 16,
text = {
{ t = "RC", x = 100, y = 52 },
{ t = "Rate", x = 94, y = 70 },
{ t = "Super", x = 148, y = 52 },
{ t = "Rate", x = 152, y = 70 },
{ t = "RC", x = 214, y = 52 },
{ t = "Expo", x = 207, y = 70 },
{ t = "ROLL", x = 28, y = 100 },
{ t = "PITCH", x = 28, y = 150 },
{ t = "YAW", x = 28, y = 200 },

{ t = "Throttle", x = 28, y = 250 },
{ t = "Mid", x = 40, y = 270, to = SMLSIZE },
{ t = "Expo", x = 40, y = 290, to = SMLSIZE },
{ t = "Limit Type", x = 40, y = 310, to = SMLSIZE },
{ t = "Limit %", x = 40, y = 330, to = SMLSIZE },
{ t = "TPA", x = 28, y = 350 },
{ t = "Rate", x = 40, y = 370, to = SMLSIZE },
{ t = "Breakpoint", x = 40, y = 390, to = SMLSIZE },
},
fields = {
-- RC Rates
{ x = 102, y = 100, vals = { 1 }, min = 0, max = 255, scale = 100, to = MIDSIZE },
{ x = 102, y = 150, vals = { 13 }, min = 0, max = 255, scale = 100, to = MIDSIZE },
{ x = 102, y = 200, vals = { 12 }, min = 0, max = 255, scale = 100, to = MIDSIZE },
-- Super Rates
{ x = 158, y = 100, vals = { 3 }, min = 0, max = 100, scale = 100, to = MIDSIZE },
{ x = 158, y = 150, vals = { 4 }, min = 0, max = 100, scale = 100, to = MIDSIZE },
{ x = 158, y = 200, vals = { 5 }, min = 0, max = 255, scale = 100, to = MIDSIZE },
-- RC Expo
{ x = 216, y = 100, vals = { 2 }, min = 0, max = 100, scale = 100, to = MIDSIZE },
{ x = 216, y = 150, vals = { 14 }, min = 0, max = 100, scale = 100, to = MIDSIZE },
{ x = 216, y = 200, vals = { 11 }, min = 0, max = 100, scale = 100, to = MIDSIZE },
-- Throttle
{ x = 150, y = 270, vals = { 7 }, min = 0, max = 100, scale = 100 },
{ x = 150, y = 290, vals = { 8 }, min = 0, max = 100, scale = 100 },
{ x = 150, y = 310, vals = { 15 }, min = 0, max = 2, table = { [0] = "OFF", "SCALE", "CLIP" } },
{ x = 150, y = 330, vals = { 16 }, min = 25, max = 100 },
-- TPA
{ x = 150, y = 370, vals = { 6 }, min = 0, max = 100, scale = 100 },
{ x = 150, y = 390, vals = { 9, 10 }, min = 1000, max = 2000 },
},
}
Loading