Skip to content

Add page to change battery parameters #522

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
31 changes: 31 additions & 0 deletions src/SCRIPTS/BF/PAGES/battery.lua
Original file line number Diff line number Diff line change
@@ -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
}
4 changes: 4 additions & 0 deletions src/SCRIPTS/BF/pages.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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.45 then
PageFiles[#PageFiles + 1] = { title = "Battery", script = "battery.lua" }
end

if apiVersion >= 1.16 then
PageFiles[#PageFiles + 1] = { title = "Receiver", script = "rx.lua" }
end
Expand Down
Loading