|
| 1 | +local template = loadScript(radio.templateHome.."accelerometer.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 | +labels[#labels + 1] = { t = "Make sure the craft is level", x = x, y = inc.y(lineSpacing) } |
| 20 | +labels[#labels + 1] = { t = "and stable, then press", x = x, y = inc.y(lineSpacing) } |
| 21 | +labels[#labels + 1] = { t = "[ENTER] to calibrate, or", x = x, y = inc.y(lineSpacing) } |
| 22 | +labels[#labels + 1] = { t = "[EXIT] to cancel.", x = x, y = inc.y(lineSpacing) } |
| 23 | +fields[#fields + 1] = { x = x, y = inc.y(lineSpacing), value = "", ro = true, onClick = function(self) self.accCal(self) end } |
| 24 | + |
| 25 | +return { |
| 26 | + write = 205, -- MSP_ACC_CALIBRATION |
| 27 | + title = "Accelerometer", |
| 28 | + reboot = false, |
| 29 | + eepromWrite = false, |
| 30 | + minBytes = 0, |
| 31 | + labels = labels, |
| 32 | + fields = fields, |
| 33 | + accCal = function(self) |
| 34 | + protocol.mspRead(self.write) |
| 35 | + end, |
| 36 | +} |
0 commit comments