Skip to content

Commit 31689e4

Browse files
committed
Set messages during Base start
The GSV message needs to be updated to 1Hz. Also added is all other messages get set to the setting values in case user is logging during base mode.
1 parent 6ad96ee commit 31689e4

File tree

3 files changed

+25
-28
lines changed

3 files changed

+25
-28
lines changed

Firmware/RTK_Surveyor/Base.ino

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -18,31 +18,23 @@ bool configureUbloxModuleBase()
1818

1919
i2cGNSS.checkUblox(); //Regularly poll to get latest data and any RTCM
2020

21-
//The first thing we do is go to 1Hz to lighten any I2C traffic from a previous configuration
22-
if (i2cGNSS.getNavigationFrequency(maxWait) != 1)
23-
response &= i2cGNSS.setNavigationFrequency(1, maxWait);
24-
// response &= i2cGNSS.setNavigationFrequency(4, maxWait);
21+
const int baseNavigationFrequency = 1;
22+
23+
//In Base mode we force 1Hz
24+
if (i2cGNSS.getNavigationFrequency(maxWait) != baseNavigationFrequency)
25+
response &= i2cGNSS.setNavigationFrequency(baseNavigationFrequency, maxWait);
2526
if (response == false)
26-
Serial.println("Set rate failed");
27+
Serial.println("setNavigationFrequency failed");
2728

2829
i2cGNSS.checkUblox(); //Regularly poll to get latest data and any RTCM
2930

30-
i2cGNSS.setNMEAGPGGAcallbackPtr(NULL); // Disable GPGGA call back that may have been set during Rover Client mode
31-
i2cGNSS.disableNMEAMessage(UBX_NMEA_GGA, COM_PORT_I2C); // Disable NMEA message
31+
i2cGNSS.setNMEAGPGGAcallbackPtr(NULL); // Disable GPGGA call back that may have been set during Rover NTRIP Client mode
32+
i2cGNSS.disableNMEAMessage(UBX_NMEA_GGA, COM_PORT_I2C); // Disable NMEA message that may have been set during Rover NTRIP Client mode
3233

3334
response = i2cGNSS.setSurveyMode(0, 0, 0); //Disable Survey-In or Fixed Mode
3435
if (response == false)
3536
Serial.println("Disable TMODE3 failed");
3637

37-
//In base mode we force 1Hz
38-
if (i2cGNSS.getNavigationFrequency(maxWait) != 1)
39-
response &= i2cGNSS.setNavigationFrequency(1, maxWait);
40-
if (response == false)
41-
{
42-
Serial.println("configureUbloxModuleBase: Set rate failed");
43-
return (false);
44-
}
45-
4638
// Set dynamic model
4739
if (i2cGNSS.getDynamicModel(maxWait) != DYN_MODEL_STATIONARY)
4840
{
@@ -61,17 +53,23 @@ bool configureUbloxModuleBase()
6153
getPortSettings(COM_PORT_I2C); //Load the settingPayload with this port's settings
6254
if (settingPayload[OUTPUT_SETTING] != (COM_TYPE_UBX | COM_TYPE_NMEA | COM_TYPE_RTCM3))
6355
response &= i2cGNSS.setPortOutput(COM_PORT_I2C, COM_TYPE_UBX | COM_TYPE_NMEA | COM_TYPE_RTCM3); //Set the I2C port to output UBX (config), and RTCM3 (casting)
64-
//response &= i2cGNSS.setPortOutput(COM_PORT_I2C, COM_TYPE_UBX | COM_TYPE_RTCM3); //Not a valid state. Goes to UBX+NMEA+RTCM3 -
56+
//response &= i2cGNSS.setPortOutput(COM_PORT_I2C, COM_TYPE_UBX | COM_TYPE_RTCM3); //Not a valid state. Goes to UBX+NMEA+RTCM3
6557

66-
//In base mode the Surveyor should output RTCM over UART2 and I2C ports:
58+
//In base mode the Surveyor should output RTCM over all ports:
6759
//(Primary) UART2 in case the Surveyor is connected via radio to rover
68-
//(Optional) I2C in case user wants base to connect to WiFi and NTRIP Serve to Caster
69-
//(Seconday) USB in case the Surveyor is used as an NTRIP caster
70-
//(Tertiary) UART1 in case Surveyor is sending RTCM to phone that is then NTRIP caster
60+
//(Optional) I2C in case user wants base to connect to WiFi and NTRIP Caster
61+
//(Seconday) USB in case the Surveyor is used as an NTRIP caster connected to SBC or other
62+
//(Tertiary) UART1 in case Surveyor is sending RTCM to phone that is then NTRIP Caster
7163
response &= enableRTCMSentences(COM_PORT_UART2);
7264
response &= enableRTCMSentences(COM_PORT_UART1);
7365
response &= enableRTCMSentences(COM_PORT_USB);
74-
response &= enableRTCMSentences(COM_PORT_I2C); //Enable for plain radio so we can count RTCM packets for display (State: Base-Temp - Transmitting)
66+
response &= enableRTCMSentences(COM_PORT_I2C); //Enable for plain radio so we can count RTCM packets for display
67+
68+
//If enabled, adjust GSV NMEA to be reported at 1Hz
69+
if (settings.ubxMessages[8].msgRate > baseNavigationFrequency)
70+
setMessageRateByName("UBX_NMEA_GSV", baseNavigationFrequency); //Update GSV setting in file
71+
72+
response &= configureGNSSMessageRates(COM_PORT_UART1, settings.ubxMessages); //In the interest of logging, make sure the appropriate messages are enabled
7573

7674
if (response == false)
7775
{

Firmware/RTK_Surveyor/ESPNOW.ino

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,6 @@ void espnowStop()
178178
Serial.println("Error deinitializing ESP-NOW");
179179
return;
180180
}
181-
#endif
182181

183182
if (wifiState == WIFI_OFF)
184183
{
@@ -190,18 +189,18 @@ void espnowStop()
190189
//If WiFi is on, then disable LR protocol
191190
else if (wifiState > WIFI_OFF)
192191
{
193-
#ifdef COMPILE_WIFI
194192
wifiSetState(WIFI_NOTCONNECTED);
195-
#endif
196193

197194
// Return protocol to default settings (no WIFI_PROTOCOL_LR for ESP NOW)
198195
esp_wifi_set_protocol(WIFI_IF_STA, WIFI_PROTOCOL_11B | WIFI_PROTOCOL_11G | WIFI_PROTOCOL_11N); //Stops WiFi Station.
199196

200197
WiFi.mode(WIFI_STA);
201-
198+
202199
log_d("WiFi protocols on, LR protocol off");
203200
}
204-
201+
202+
#endif
203+
205204
espnowSetState(ESPNOW_OFF);
206205
}
207206

Firmware/RTK_Surveyor/RTK_Surveyor.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ void setup()
554554

555555
loadSettings(); //Attempt to load settings after SD is started so we can read the settings file if available
556556

557-
//beginIdleTasks(); //Enable processor load calculations
557+
beginIdleTasks(); //Enable processor load calculations
558558

559559
beginUART2(); //Start UART2 on core 0, used to receive serial from ZED and pass out over SPP
560560

0 commit comments

Comments
 (0)