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
0 commit comments