Skip to content

Commit a83227b

Browse files
authored
Merge pull request #394 from sparkfun/AddTipAltitudeSetting
Update warning print
2 parents 1084f98 + 558bc83 commit a83227b

File tree

3 files changed

+27
-28
lines changed

3 files changed

+27
-28
lines changed

Firmware/RTK_Everywhere/System.ino

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -606,13 +606,13 @@ void coordinateConvertInput(double coordinate, CoordinateInputType coordinateInp
606606
coordinate *= -1;
607607

608608
if (coordinateInputType == COORDINATE_INPUT_TYPE_DDMM)
609-
snprintf(coordinateString, sizeOfCoordinateString, "%02d%010.7f", longitudeDegrees, coordinate);
609+
snprintf(coordinateString, sizeOfCoordinateString, "%02d%011.8f", longitudeDegrees, coordinate);
610610
else if (coordinateInputType == COORDINATE_INPUT_TYPE_DD_MM_DASH)
611-
snprintf(coordinateString, sizeOfCoordinateString, "%02d-%010.7f", longitudeDegrees, coordinate);
611+
snprintf(coordinateString, sizeOfCoordinateString, "%02d-%011.8f", longitudeDegrees, coordinate);
612612
else if (coordinateInputType == COORDINATE_INPUT_TYPE_DD_MM_SYMBOL)
613-
snprintf(coordinateString, sizeOfCoordinateString, "%02d°%010.7f'", longitudeDegrees, coordinate);
613+
snprintf(coordinateString, sizeOfCoordinateString, "%02d°%011.8f'", longitudeDegrees, coordinate);
614614
else if (coordinateInputType == COORDINATE_INPUT_TYPE_DD_MM)
615-
snprintf(coordinateString, sizeOfCoordinateString, "%02d %010.7f", longitudeDegrees, coordinate);
615+
snprintf(coordinateString, sizeOfCoordinateString, "%02d %011.8f", longitudeDegrees, coordinate);
616616
}
617617
else if (coordinateInputType == COORDINATE_INPUT_TYPE_DD_MM_SS ||
618618
coordinateInputType == COORDINATE_INPUT_TYPE_DDMMSS ||

Firmware/RTK_Everywhere/Tilt.ino

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Once RTK Fix is achieved, and the tilt sensor is activated (ie shaken) the tilt sensor
2+
Once RTK Fix is achieved, and the tilt sensor is activated (ie rocked back and forth) the tilt sensor
33
generates binary-encoded lat/lon/alt values that are tilt-compensated. To get these values to the
44
GIS Data Collector software, we need to transmit corrected NMEA sentences over Bluetooth. The
55
Data Collector does not know anything is being tilt-compensated. To do this we must intercept
@@ -64,7 +64,7 @@ void tiltUpdate()
6464
break;
6565

6666
case TILT_STARTED:
67-
// Waiting for user to shake unit (RTK Fix required for isInitialized)
67+
// Waiting for user to rock unit back and forth (RTK Fix required for isInitialized)
6868
tiltSensor->update(); // Check for the most recent incoming binary data
6969

7070
// Check IMU state at 1Hz
@@ -73,12 +73,12 @@ void tiltUpdate()
7373
lastTiltCheck = millis();
7474

7575
if (settings.antennaHeight_mm < 500)
76-
systemPrintf("Warning: Short pole length detected: %0.3f\r\n", settings.antennaHeight_mm);
76+
systemPrintf("Warning: Short pole length detected: %0.3fm\r\n", settings.antennaHeight_mm / 1000.0);
7777

7878
if (settings.enableImuDebug == true)
7979
printTiltDebug();
8080

81-
// Check to see if tilt sensor has been shaken
81+
// Check to see if tilt sensor has been rocked
8282
if (tiltSensor->isInitialized())
8383
{
8484
beepDurationMs(1000); // Audibly indicate the init of tilt
@@ -110,7 +110,7 @@ void tiltUpdate()
110110
lastTiltCheck = millis();
111111

112112
if (settings.antennaHeight_mm < 500)
113-
systemPrintf("Warning: Short pole length detected: %0.3f\r\n", settings.antennaHeight_mm);
113+
systemPrintf("Warning: Short pole length detected: %0.3fm\r\n", settings.antennaHeight_mm / 1000.0);
114114

115115
if (settings.enableImuDebug == true)
116116
printTiltDebug();
@@ -301,6 +301,10 @@ void beginTilt()
301301

302302
snprintf(clubVector, sizeof(clubVector), "CLUB_VECTOR=0,0,%0.3f",
303303
(settings.antennaHeight_mm + settings.antennaPhaseCenter_mm) / 1000.0);
304+
305+
if (settings.enableImuCompensationDebug == true)
306+
systemPrintf("Setting club vector to: %s\r\n", clubVector);
307+
304308
result &= tiltSensor->sendCommand(clubVector);
305309

306310
// Configure interface type. This allows IM19 to receive Unicore-style binary messages
@@ -553,7 +557,7 @@ void applyCompensationGNS(char *nmeaSentence, int arraySize)
553557
// Add interstitial between end of lon and beginning of alt
554558
strncat(newSentence, nmeaSentence + longitudeStop, altitudeStart - longitudeStop);
555559
}
556-
else // No tilt compensation, no changes the lat/lon
560+
else // No tilt compensation, no changes to the lat/lon
557561
{
558562
// Add start of message up to altitude
559563
strncat(newSentence, nmeaSentence, altitudeStart);
@@ -820,7 +824,7 @@ void applyCompensationGGA(char *nmeaSentence, int arraySize)
820824
uint8_t undulationStop = 0;
821825
uint8_t checksumStart = 0;
822826

823-
if (settings.enableImuCompensationDebug == true)
827+
if (settings.enableImuCompensationDebug == true && !inMainMenu)
824828
systemPrintf("Original GNGGA: %s\r\n", nmeaSentence);
825829

826830
int commaCount = 0;
@@ -870,14 +874,6 @@ void applyCompensationGGA(char *nmeaSentence, int arraySize)
870874
strncpy(undulationStr, &nmeaSentence[undulationStart], undulationStop - undulationStart);
871875
float undulation = (float)atof(undulationStr);
872876

873-
float orthometricHeight = 0;
874-
875-
if (tiltIsCorrecting() == true)
876-
{
877-
// Remove the undulation from the IMU's altitude
878-
orthometricHeight = tiltSensor->getNaviAltitude() - undulation;
879-
}
880-
881877
char newSentence[150] = {0};
882878

883879
if (sizeof(newSentence) < arraySize)
@@ -915,7 +911,7 @@ void applyCompensationGGA(char *nmeaSentence, int arraySize)
915911
// Add interstitial between end of lon and beginning of alt
916912
strncat(newSentence, nmeaSentence + longitudeStop, altitudeStart - longitudeStop);
917913
}
918-
else // No tilt compensation, no changes the lat/lon
914+
else // No tilt compensation, no changes to the lat/lon
919915
{
920916
// Add start of message up to altitude
921917
strncat(newSentence, nmeaSentence, altitudeStart);
@@ -967,7 +963,7 @@ void applyCompensationGGA(char *nmeaSentence, int arraySize)
967963
// Overwrite the original NMEA
968964
strncpy(nmeaSentence, newSentence, arraySize);
969965

970-
if (settings.enableImuCompensationDebug == true)
966+
if (settings.enableImuCompensationDebug == true && !inMainMenu)
971967
systemPrintf("Compensated GNGGA: %s\r\n", nmeaSentence);
972968
}
973969

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)