-
-
Notifications
You must be signed in to change notification settings - Fork 155
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
Conversation
WalkthroughA new battery configuration page is introduced via a Lua script, defining UI layout, labels, and fields for voltage and capacity settings. The main pages list is updated to include the "Battery" page for API versions 1.41 and above, referencing the newly added script. No other logic is altered. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant MainPages (pages.lua)
participant BatteryPage (battery.lua)
User->>MainPages: Open configuration menu
MainPages->>MainPages: Check apiVersion
alt apiVersion >= 1.41
MainPages->>BatteryPage: Load battery configuration page
BatteryPage->>User: Display battery settings UI
end
User->>BatteryPage: View or edit voltage/capacity fields
BatteryPage->>MainPages: Send read/write MSP commands as needed
Estimated code review effort🎯 2 (Simple) | ⏱️ ~7 minutes Poem
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
@Forceu please rebase now CI is fixed |
Rebased with the latest commit and added spaces as requested, min API is now 1.41 |
Changed API to 1.41
Sorry I misunderstood the requested additional space, I thought it was meant for the strings, not for formatting. Fixed in 1acac3c |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lols yeah space was for indentation in line 17
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me 🙂
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 } } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I missed this. You would have to use "mult", not "steps" as there's no such thing. Look at the code in ui.lua
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah thanks for pointing it out! Yeah I already wrote about in the initial post, as I wasn't sure what to use for steps instead. If you want to, I can create another PR changing it 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please do 🙂
This PR adds a page to the script where the following battery settings can be changed:
I wanted to add a button for applying LiPo and Li-Ion presets, but had too many problems with it, so I excluded it from the commit.
This PR would supersede #515, which uses a different approach and did not work for me.
I set it to minimum API v1.41, as this seems to be the level that BF4.0.0 was using, when the uint16 precision for battery voltage was introduced
Also is it possible to add a step value for the capacity input? So that it is changed in increments of 25 mAh instead of 1? I could not find anything about that in the code.
Closes #505
Summary by CodeRabbit