FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Rates type support by klutvott123 · Pull Request #365 · betaflight/betaflight-tx-lua-scripts · GitHub

Rates type support - #365

Merged
mikeller merged 1 commit into
betaflight:masterfrom
klutvott123:rates-type-support
Oct 11, 2020
Merged

mikeller merged 1 commit into
betaflight:masterfrom
klutvott123:rates-type-support

Conversation

klutvott123 commented Oct 7, 2020
edited
Loading

Copy link
Copy Markdown
Member

Adds support for changing rates type.

Works like in the configurator. Changes labels, scaling, min, max, and applies default values for the selected rates type.

For testing: betaflight-tx-lua-scripts_1.5.0.zip

klutvott123 added this to the 1.6 milestone Oct 7, 2020

asizon commented Oct 7, 2020

Copy link
Copy Markdown
Member

Wow! Awesome work @klutvott123 , thankyou!

Copy link
Copy Markdown
Member Author

@asizon Thanks! 😸

Comment thread src/SCRIPTS/BF/ui.lua Outdated
end
elseif pageState == pageStatus.editing then
if event == EVT_VIRTUAL_EXIT or event == EVT_VIRTUAL_ENTER then
pcall(Page.fields[currentField].postEdit, Page)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Why do we need the pcall() here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

It just prevents the script from crashing if the field doesn't have postEdit.
Could have done this too

if Page.fields[currentField].postEdit then
    Page.fields[currentField].postEdit(Page)
end

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I actually think this is a better way, as it is more specific. Otherwise any error that snuck into a postEdit() function could go undetected for a long time, causing debug nightmares.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Good point! I'll change it

mikeller previously approved these changes Oct 8, 2020

mikeller commented Oct 8, 2020

Copy link
Copy Markdown
Member

Nicely done!

Adds support for changing rates type.

Copy link
Copy Markdown

Kudos, SonarCloud Quality Gate passed!

0 Bugs
0 Vulnerabilities (and 0 Security Hotspots to review)
0 Code Smells

No Coverage information
No Duplication information

mikeller merged commit 9e2d4b8 into betaflight:master Oct 11, 2020
klutvott123 deleted the rates-type-support branch October 24, 2021 19:41
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL