Fixes #3117: Telemetry sensor Ratio parameter rounding problem fixed (ported from master)
This commit is contained in:
@@ -581,6 +581,7 @@ void TelemetrySensorPanel::update()
|
||||
if (sensor.unit == SensorData::UNIT_RPMS) {
|
||||
ui->offset->setDecimals(0);
|
||||
ui->ratio->setDecimals(0);
|
||||
ui->ratio->setSingleStep(1);
|
||||
ui->autoOffset->hide();
|
||||
ui->ratio->setMinimum(1);
|
||||
ui->offset->setMinimum(1);
|
||||
@@ -588,6 +589,7 @@ void TelemetrySensorPanel::update()
|
||||
else {
|
||||
ui->offset->setDecimals(sensor.prec);
|
||||
ui->ratio->setDecimals(1);
|
||||
ui->ratio->setSingleStep(0.1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,11 @@
|
||||
|
||||
#include <QDoubleSpinBox>
|
||||
#include "modeledit/modeledit.h"
|
||||
#if __GNUC__
|
||||
#include <math.h>
|
||||
#else
|
||||
#include "../targets/windows/winbuild.h"
|
||||
#endif
|
||||
|
||||
class AutoDoubleSpinBox: public QDoubleSpinBox
|
||||
{
|
||||
@@ -62,7 +67,7 @@ class AutoDoubleSpinBox: public QDoubleSpinBox
|
||||
void onValueChanged(double value)
|
||||
{
|
||||
if (field && !lock) {
|
||||
*field = value * multiplier();
|
||||
*field = round(value * multiplier());
|
||||
if (panel) {
|
||||
emit panel->modified();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user