Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add battery voltage warnings setup via LUA from radio #515

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

Conversation

Copy link

@vishwamartur vishwamartur commented Dec 29, 2024

Related to #505

Add battery voltage warning and minimum values configuration via LUA scripts from the radio.

  • New LUA Script: Add src/SCRIPTS/BF/battery_voltage.lua to handle battery voltage warning and minimum values configuration.
    • Define functions to read and set battery voltage warning values for different battery types (Li-ion, LiPo).
    • Use MSP commands to communicate with the flight controller.
  • Pages Update: Modify src/SCRIPTS/BF/pages.lua to include a new page entry for battery settings configuration.
    • Add a new page entry with the title "Battery Settings" and script "battery_voltage.lua".
  • UI Update: Modify src/SCRIPTS/BF/ui.lua to include the new battery settings page in the UI menu.
    • Add the new battery settings page to the UI menu.

pfeerick reacted with heart emoji
Related to betaflight#505
Add battery voltage warning and minimum values configuration via LUA scripts from the radio.
* **New LUA Script**: Add `src/SCRIPTS/BF/battery_voltage.lua` to handle battery voltage warning and minimum values configuration.
 * Define functions to read and set battery voltage warning values for different battery types (Li-ion, LiPo).
 * Use MSP commands to communicate with the flight controller.
* **Pages Update**: Modify `src/SCRIPTS/BF/pages.lua` to include a new page entry for battery settings configuration.
 * Add a new page entry with the title "Battery Settings" and script "battery_voltage.lua".
* **UI Update**: Modify `src/SCRIPTS/BF/ui.lua` to include the new battery settings page in the UI menu.
 * Add the new battery settings page to the UI menu.
Copy link
Member

klutvott123 commented Feb 7, 2025
edited
Loading

Is there a reason why this can't just be a regular page like the rest of them? 🙂

Copy link
Contributor

Forceu commented Jul 21, 2025
edited
Loading

I wanted to built something like this on my own, but saw your PR - thank you and I hope it gets merged at some point.

After compiling the script, I can however not open the battery page, when selecting it on a monochrome display, I get the error that battery_voltage.lua was not found. After moving the file to the SCRIPTS/BF/PAGES folder (currently it is in the SCRIPTS/BF folder), it finds the file, but then I get the error

Syntax error
?:0
attempt to index field 'fields' (a nil value).

Looking through the other page files, all start with

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 = {}

and have a different syntax. So I think it needs to be modified to work, before it can be merged.

Also you set the MSP commands to 210 and 211 - however they are defined as

#define MSP_SELECT_SETTING 210 // in message: Select setting number (0-2)
#define MSP_SET_HEADING 211 // in message: Define a new heading hold direction

So would that even work?

Copy link
Member

This is not the correct way to do it. Closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers
No reviews
Projects
None yet
Milestone
1.8
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /