diff --git a/src/SCRIPTS/BF/PAGES/battery.lua b/src/SCRIPTS/BF/PAGES/battery.lua new file mode 100644 index 0000000..39c2293 --- /dev/null +++ b/src/SCRIPTS/BF/PAGES/battery.lua @@ -0,0 +1,31 @@ +local template = assert(loadScript(radio.template))() +local margin = template.margin +local indent = template.indent +local lineSpacing = template.lineSpacing +local tableSpacing = template.tableSpacing +local sp = template.listSpacing.field +local yMinLim = radio.yMinLimit +local x = margin +local y = yMinLim - lineSpacing +local inc = { x = function(val) x = x + val return x end, y = function(val) y = y + val return y end } +local labels = {} +local fields = {} + +labels[#labels + 1] = { t = "Voltage Settings", x = x, y = inc.y(lineSpacing) } +fields[#fields + 1] = { t = "Minimum Cell", x = x + indent, y = inc.y(lineSpacing), sp = x + sp, min = 0, max = 500, vals = { 8, 9 }, scale = 100 } +fields[#fields + 1] = { t = "Maximum Cell", x = x + indent, y = inc.y(lineSpacing), sp = x + sp, min = 0, max = 500, vals = { 10, 11 }, scale = 100 } +fields[#fields + 1] = { t = "Warning Cell", x = x + indent, y = inc.y(lineSpacing), sp = x + sp, min = 0, max = 500, vals = { 12, 13 }, scale = 100 } + +labels[#labels + 1] = { t = "Capacity Settings", x = x, y = inc.y(lineSpacing) } +fields[#fields + 1] = { t = "Battery Capacity", x = x + indent, y = inc.y(lineSpacing), sp = x + sp, min = 0, steps = 25, max = 10000, vals = { 4, 5 } } + +return { + read = 32, -- MSP_BATTERY_CONFIG + write = 33, -- MSP_SET_BATTERY_CONFIG + title = "Battery", + reboot = false, + eepromWrite = true, + minBytes = 13, + labels = labels, + fields = fields +} diff --git a/src/SCRIPTS/BF/pages.lua b/src/SCRIPTS/BF/pages.lua index 9763e1c..4deddf5 100644 --- a/src/SCRIPTS/BF/pages.lua +++ b/src/SCRIPTS/BF/pages.lua @@ -40,6 +40,10 @@ if apiVersion >= 1.16 then PageFiles[#PageFiles + 1] = { title = "System / Motor", script = "pwm.lua", init = "PAGES/INIT/pwm.lua" } end +if apiVersion >= 1.41 then + PageFiles[#PageFiles + 1] = { title = "Battery", script = "battery.lua" } +end + if apiVersion >= 1.16 then PageFiles[#PageFiles + 1] = { title = "Receiver", script = "rx.lua" } end