-
-
Notifications
You must be signed in to change notification settings - Fork 151
Accelerometer calibration #375
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
Merged
mikeller
merged 1 commit into
betaflight:master
from
klutvott123:accelerometer-calibration
Dec 19, 2020
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
local template = loadScript(radio.templateHome.."accelerometer.lua") | ||
if template then | ||
template = template() | ||
else | ||
template = assert(loadScript(radio.templateHome.."default_template.lua"))() | ||
end | ||
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 = "Make sure the craft is level", x = x, y = inc.y(lineSpacing) } | ||
labels[#labels + 1] = { t = "and stable, then press", x = x, y = inc.y(lineSpacing) } | ||
labels[#labels + 1] = { t = "[ENTER] to calibrate, or", x = x, y = inc.y(lineSpacing) } | ||
labels[#labels + 1] = { t = "[EXIT] to cancel.", x = x, y = inc.y(lineSpacing) } | ||
fields[#fields + 1] = { x = x, y = inc.y(lineSpacing), value = "", ro = true, onClick = function(self) self.accCal(self) end } | ||
|
||
return { | ||
write = 205, -- MSP_ACC_CALIBRATION | ||
title = "Accelerometer", | ||
reboot = false, | ||
eepromWrite = false, | ||
minBytes = 0, | ||
labels = labels, | ||
fields = fields, | ||
accCal = function(self) | ||
protocol.mspRead(self.write) | ||
end, | ||
} |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Not sure if we want to make this a bit more verbose, like pop up a dialog saying something like 'Make sure the craft is level and stable, then press [Enter] to continue, or [Cancel]'?
Otherwise I suspect unsuspecting newbie pilots will 'test' this function and then end up un-calibrating their craft when they 'try' this.
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.
Good point! I'll see what I can do. I think the best approach would be to just make it a special page that can only be entered from the popup menu. I looked into the built in popup dialogue in opentx but it's very limited and behaves differently on different radios
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.
@mikeller It's done. I updated the first post with a description of how this works with pictures