|
| 1 | +local template = loadScript(radio.templateHome.."failsafe.lua") |
| 2 | +if template then |
| 3 | + template = template() |
| 4 | +else |
| 5 | + template = assert(loadScript(radio.templateHome.."default_template.lua"))() |
| 6 | +end |
| 7 | +local margin = template.margin |
| 8 | +local indent = template.indent |
| 9 | +local lineSpacing = template.lineSpacing |
| 10 | +local tableSpacing = template.tableSpacing |
| 11 | +local sp = template.listSpacing.field |
| 12 | +local yMinLim = radio.yMinLimit |
| 13 | +local x = margin |
| 14 | +local y = yMinLim - lineSpacing |
| 15 | +local inc = { x = function(val) x = x + val return x end, y = function(val) y = y + val return y end } |
| 16 | +local labels = {} |
| 17 | +local fields = {} |
| 18 | + |
| 19 | +local procedure = { [0] = "Land", "Drop" } |
| 20 | + |
| 21 | +if apiVersion >= 1.039 then |
| 22 | + procedure[#procedure + 1] = "Rescue" |
| 23 | +end |
| 24 | + |
| 25 | +if apiVersion >= 1.039 then |
| 26 | + labels[#labels + 1] = { t = "Failsafe Switch", x = x, y = inc.y(lineSpacing) } |
| 27 | + fields[#fields + 1] = { t = "Action", x = x + indent, y = inc.y(lineSpacing), sp = x + sp, min = 0, max = 2, vals = { 5 }, table = { [0] = "Stage 1", "Kill", "Stage 2" } } |
| 28 | +else |
| 29 | + fields[#fields + 1] = { t = "Kill switch", x = x, y = inc.y(lineSpacing), sp = x + sp, min = 0, max = 1, vals = { 5 }, table = { [0] = "OFF", "ON" } } |
| 30 | +end |
| 31 | + |
| 32 | +labels[#labels + 1] = { t = "Stage 2 Settings" , x = x, y = inc.y(lineSpacing) } |
| 33 | +fields[#fields + 1] = { t = "Procedure", x = x + indent, y = inc.y(lineSpacing), sp = x + sp, min = 0, max = #procedure, vals = { 8 }, table = procedure } |
| 34 | +fields[#fields + 1] = { t = "Guard Time", x = x + indent, y = inc.y(lineSpacing), sp = x + sp, min = 0, max = 200, vals = { 1 }, scale = 10 } |
| 35 | +fields[#fields + 1] = { t = "Thrl Low Delay", x = x + indent, y = inc.y(lineSpacing), sp = x + sp, min = 0, max = 300, vals = { 6, 7 }, scale = 10 } |
| 36 | + |
| 37 | +labels[#labels + 1] = { t = "Stage 2 Land Settings", x = x, y = inc.y(lineSpacing) } |
| 38 | +fields[#fields + 1] = { t = "Thrl Land Value", x = x + indent, y = inc.y(lineSpacing), sp = x + sp, min = 750, max = 2250, vals = { 3, 4 } } |
| 39 | +fields[#fields + 1] = { t = "Motor Off Delay", x = x + indent, y = inc.y(lineSpacing), sp = x + sp, min = 0, max = 200, vals = { 2 }, scale = 10 } |
| 40 | + |
| 41 | +return { |
| 42 | + read = 75, -- MSP_FAILSAFE_CONFIG |
| 43 | + write = 76, -- MSP_SET_FAILSAFE_CONFIG |
| 44 | + title = "Failsafe", |
| 45 | + reboot = true, |
| 46 | + eepromWrite = true, |
| 47 | + minBytes = 8, |
| 48 | + labels = labels, |
| 49 | + fields = fields, |
| 50 | +} |
0 commit comments