mirror of
https://github.com/opentx/opentx.git
synced 2025-07-23 08:15:17 +03:00
Issue #469 fixed (Telemetry tab in Companion rewritten - 20% code
removed). More tests needed!
This commit is contained in:
parent
59d8653b61
commit
ce2b033ccb
10 changed files with 479 additions and 1709 deletions
|
@ -67,18 +67,15 @@ RawSourceRange RawSource::getRange(bool singleprec)
|
|||
case TELEMETRY_SOURCE_A1:
|
||||
case TELEMETRY_SOURCE_A2:
|
||||
if (model) {
|
||||
if (model->frsky.channels[index-TELEMETRY_SOURCE_A1].type==0) {
|
||||
result.step = (model->frsky.channels[index-TELEMETRY_SOURCE_A1].ratio / 2550.0);
|
||||
result.min = (model->frsky.channels[index-TELEMETRY_SOURCE_A1].offset * model->frsky.channels[index-TELEMETRY_SOURCE_A1].ratio) / 2550.0;
|
||||
result.max = model->frsky.channels[index-TELEMETRY_SOURCE_A1].ratio - (model->frsky.channels[index-TELEMETRY_SOURCE_A1].offset * model->frsky.channels[index-TELEMETRY_SOURCE_A1].ratio) / 2550.0;
|
||||
FrSkyChannelData channel = model->frsky.channels[index-TELEMETRY_SOURCE_A1]; // TODO const &
|
||||
float ratio = channel.getRatio();
|
||||
if (channel.type==0 || channel.type==1 || channel.type==2)
|
||||
result.decimals = 2;
|
||||
}
|
||||
else {
|
||||
result.step = (model->frsky.channels[index-TELEMETRY_SOURCE_A1].ratio / 255.0);
|
||||
result.min = (model->frsky.channels[index-TELEMETRY_SOURCE_A1].offset * model->frsky.channels[index-TELEMETRY_SOURCE_A1].ratio) / 255.0;
|
||||
result.max = model->frsky.channels[index-TELEMETRY_SOURCE_A1].ratio - (model->frsky.channels[index-TELEMETRY_SOURCE_A1].offset * model->frsky.channels[index-TELEMETRY_SOURCE_A1].ratio) / 255.0;
|
||||
else
|
||||
result.decimals = 0;
|
||||
}
|
||||
result.step = ratio / 255;
|
||||
result.min = channel.offset * result.step;
|
||||
result.max = ratio + result.min;
|
||||
}
|
||||
break;
|
||||
case TELEMETRY_SOURCE_ALT:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue