Skip to content

Conversation

klutvott123
Copy link
Member

@klutvott123 klutvott123 commented Oct 7, 2020

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 klutvott123 added this to the 1.6 milestone Oct 7, 2020
@asizon
Copy link
Member

asizon commented Oct 7, 2020

Wow! Awesome work @klutvott123 , thankyou!

@klutvott123
Copy link
Member Author

@asizon Thanks! 😸

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
Member

Choose a reason for hiding this comment

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

Why do we need the pcall() here?

Copy link
Member Author

Choose a reason for hiding this comment

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

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
Member

Choose a reason for hiding this comment

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

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
Member Author

Choose a reason for hiding this comment

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

Good point! I'll change it

mikeller
mikeller previously approved these changes Oct 8, 2020
@mikeller
Copy link
Member

mikeller commented Oct 8, 2020

Nicely done!

Adds support for changing rates type.
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@mikeller mikeller merged commit 9e2d4b8 into betaflight:master Oct 11, 2020
@klutvott123 klutvott123 deleted the rates-type-support branch October 24, 2021 19:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

3 participants