Fixes #3117: Telemetry sensor Ratio parameter rounding problem fixed (ported from master)

This commit is contained in:
Damjan Adamic
2015-12-26 16:08:03 +01:00
parent e9f23b2109
commit d734e3465d
2 changed files with 8 additions and 1 deletions
+2
View File
@@ -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);
}
}
+6 -1
View File
@@ -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();
}