Skip to content

Commit f0839bd

Browse files
committed
Correctly handle truncated floats
2.01m was producing 2009mm.
1 parent 5fc762c commit f0839bd

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

Firmware/RTK_Everywhere/menuSystem.ino

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1359,16 +1359,17 @@ void menuInstrument()
13591359
systemPrintln("Menu: Instrument Setup");
13601360

13611361
// Print the combined APC
1362-
systemPrintf("Combined Height of Instrument: %0.3fm\r\n", ((settings.antennaHeight_mm + settings.antennaPhaseCenter_mm) / 1000.0));
1362+
systemPrintf("Combined Height of Instrument: %0.3fm\r\n",
1363+
((settings.antennaHeight_mm + settings.antennaPhaseCenter_mm) / 1000.0));
13631364

1364-
systemPrintf("1) Set Antenna Height (a.k.a. Pole Length): %0.3fm\r\n", settings.antennaHeight_mm / 1000.0);
1365+
systemPrintf("1) Set Antenna Height (a.k.a. Pole Length): %0.3lfm\r\n", settings.antennaHeight_mm / (double)1000.0);
13651366

13661367
systemPrintf("2) Set Antenna Phase Center (a.k.a. ARP): %0.1fmm\r\n", settings.antennaPhaseCenter_mm);
13671368

13681369
systemPrint("3) Report Tip Altitude: ");
13691370
systemPrintf("%s\r\n", settings.outputTipAltitude ? "Enabled" : "Disabled");
13701371

1371-
if(present.imu_im19)
1372+
if (present.imu_im19)
13721373
{
13731374
systemPrint("4) Tilt Compensation: ");
13741375
systemPrintf("%s\r\n", settings.enableTiltCompensation ? "Enabled" : "Disabled");
@@ -1380,11 +1381,13 @@ void menuInstrument()
13801381

13811382
if (incoming == 1)
13821383
{
1383-
float antennaHeight = 0;
1384+
double antennaHeight = 0;
13841385

1385-
if(getNewSetting("Enter the antenna height (a.k.a. pole length) in meters", -15.0, 15.0,
1386-
&antennaHeight) == INPUT_RESPONSE_VALID)
1387-
settings.antennaHeight_mm = antennaHeight * 1000.0;
1386+
if (getNewSetting("Enter the antenna height (a.k.a. pole length) in meters", -15.0, 15.0, &antennaHeight) ==
1387+
INPUT_RESPONSE_VALID)
1388+
{
1389+
settings.antennaHeight_mm = truncf(antennaHeight * 1000.0);
1390+
}
13881391
}
13891392
else if (incoming == 2)
13901393
{

0 commit comments

Comments
 (0)