Skip to content

Commit

Permalink
Merge pull request #394 from sparkfun/AddTipAltitudeSetting
Browse files Browse the repository at this point in the history
Update warning print
  • Loading branch information
nseidle authored Jun 27, 2024
2 parents 1084f98 + 558bc83 commit a83227b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 28 deletions.
8 changes: 4 additions & 4 deletions Firmware/RTK_Everywhere/System.ino
Original file line number Diff line number Diff line change
Expand Up @@ -606,13 +606,13 @@ void coordinateConvertInput(double coordinate, CoordinateInputType coordinateInp
coordinate *= -1;

if (coordinateInputType == COORDINATE_INPUT_TYPE_DDMM)
snprintf(coordinateString, sizeOfCoordinateString, "%02d%010.7f", longitudeDegrees, coordinate);
snprintf(coordinateString, sizeOfCoordinateString, "%02d%011.8f", longitudeDegrees, coordinate);
else if (coordinateInputType == COORDINATE_INPUT_TYPE_DD_MM_DASH)
snprintf(coordinateString, sizeOfCoordinateString, "%02d-%010.7f", longitudeDegrees, coordinate);
snprintf(coordinateString, sizeOfCoordinateString, "%02d-%011.8f", longitudeDegrees, coordinate);
else if (coordinateInputType == COORDINATE_INPUT_TYPE_DD_MM_SYMBOL)
snprintf(coordinateString, sizeOfCoordinateString, "%02d°%010.7f'", longitudeDegrees, coordinate);
snprintf(coordinateString, sizeOfCoordinateString, "%02d°%011.8f'", longitudeDegrees, coordinate);
else if (coordinateInputType == COORDINATE_INPUT_TYPE_DD_MM)
snprintf(coordinateString, sizeOfCoordinateString, "%02d %010.7f", longitudeDegrees, coordinate);
snprintf(coordinateString, sizeOfCoordinateString, "%02d %011.8f", longitudeDegrees, coordinate);
}
else if (coordinateInputType == COORDINATE_INPUT_TYPE_DD_MM_SS ||
coordinateInputType == COORDINATE_INPUT_TYPE_DDMMSS ||
Expand Down
30 changes: 13 additions & 17 deletions Firmware/RTK_Everywhere/Tilt.ino
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Once RTK Fix is achieved, and the tilt sensor is activated (ie shaken) the tilt sensor
Once RTK Fix is achieved, and the tilt sensor is activated (ie rocked back and forth) the tilt sensor
generates binary-encoded lat/lon/alt values that are tilt-compensated. To get these values to the
GIS Data Collector software, we need to transmit corrected NMEA sentences over Bluetooth. The
Data Collector does not know anything is being tilt-compensated. To do this we must intercept
Expand Down Expand Up @@ -64,7 +64,7 @@ void tiltUpdate()
break;

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

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

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

if (settings.enableImuDebug == true)
printTiltDebug();

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

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

if (settings.enableImuDebug == true)
printTiltDebug();
Expand Down Expand Up @@ -301,6 +301,10 @@ void beginTilt()

snprintf(clubVector, sizeof(clubVector), "CLUB_VECTOR=0,0,%0.3f",
(settings.antennaHeight_mm + settings.antennaPhaseCenter_mm) / 1000.0);

if (settings.enableImuCompensationDebug == true)
systemPrintf("Setting club vector to: %s\r\n", clubVector);

result &= tiltSensor->sendCommand(clubVector);

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

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

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

float orthometricHeight = 0;

if (tiltIsCorrecting() == true)
{
// Remove the undulation from the IMU's altitude
orthometricHeight = tiltSensor->getNaviAltitude() - undulation;
}

char newSentence[150] = {0};

if (sizeof(newSentence) < arraySize)
Expand Down Expand Up @@ -915,7 +911,7 @@ void applyCompensationGGA(char *nmeaSentence, int arraySize)
// Add interstitial between end of lon and beginning of alt
strncat(newSentence, nmeaSentence + longitudeStop, altitudeStart - longitudeStop);
}
else // No tilt compensation, no changes the lat/lon
else // No tilt compensation, no changes to the lat/lon
{
// Add start of message up to altitude
strncat(newSentence, nmeaSentence, altitudeStart);
Expand Down Expand Up @@ -967,7 +963,7 @@ void applyCompensationGGA(char *nmeaSentence, int arraySize)
// Overwrite the original NMEA
strncpy(nmeaSentence, newSentence, arraySize);

if (settings.enableImuCompensationDebug == true)
if (settings.enableImuCompensationDebug == true && !inMainMenu)
systemPrintf("Compensated GNGGA: %s\r\n", nmeaSentence);
}

Expand Down
17 changes: 10 additions & 7 deletions Firmware/RTK_Everywhere/menuSystem.ino
Original file line number Diff line number Diff line change
Expand Up @@ -1359,16 +1359,17 @@ void menuInstrument()
systemPrintln("Menu: Instrument Setup");

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

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

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

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

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

if (incoming == 1)
{
float antennaHeight = 0;
double antennaHeight = 0;

if(getNewSetting("Enter the antenna height (a.k.a. pole length) in meters", -15.0, 15.0,
&antennaHeight) == INPUT_RESPONSE_VALID)
settings.antennaHeight_mm = antennaHeight * 1000.0;
if (getNewSetting("Enter the antenna height (a.k.a. pole length) in meters", -15.0, 15.0, &antennaHeight) ==
INPUT_RESPONSE_VALID)
{
settings.antennaHeight_mm = truncf(antennaHeight * 1000.0);
}
}
else if (incoming == 2)
{
Expand Down

0 comments on commit a83227b

Please sign in to comment.