Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/compile-rtk-firmware.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:
ArduinoJson@6.19.4
pubsubclient@2.8.0
ESP32_BleSerial@1.0.4
"SparkFun u-blox GNSS v3"@3.0.7
"SparkFun u-blox GNSS v3"@3.0.8
"SparkFun MAX1704x Fuel Gauge Arduino Library"@1.0.4
"SparkFun LIS2DH12 Arduino Library"@1.0.3
"ESP32-OTA-Pull"@1.0.0
Expand Down
58 changes: 56 additions & 2 deletions Firmware/RTK_Surveyor/Base.ino
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,15 @@ bool surveyInStart()

if (surveyInReset() == false)
{
systemPrintln("Survey reset failed");
systemPrintln("Survey reset failed - attempt 1/3");
if (surveyInReset() == false)
systemPrintln("Survey reset failed - 2nd attempt");
{
systemPrintln("Survey reset failed - attempt 2/3");
if (surveyInReset() == false)
{
systemPrintln("Survey reset failed - attempt 3/3");
}
}
}
}

Expand Down Expand Up @@ -292,6 +298,13 @@ bool startFixedBase()
//Useful for passing the RTCM correction data to a radio, Ntrip broadcaster, etc.
void DevUBLOXGNSS::processRTCM(uint8_t incoming)
{
//We need to prevent ntripServerProcessRTCM from writing data via Ethernet (SPI W5500)
//during an SPI checkUbloxSpi...
//We can pass incoming to ntripServerProcessRTCM if the GNSS is I2C or the variant does not have Ethernet.
//For the Ref Stn, processRTCMBuffer is called manually from inside ntripServerUpdate
if ((USE_SPI_GNSS) && (HAS_ETHERNET))
return;

//Check for too many digits
if (settings.enableResetDisplay == true)
{
Expand Down Expand Up @@ -319,3 +332,44 @@ void DevUBLOXGNSS::processRTCM(uint8_t incoming)
espnowProcessRTCM(incoming);
}
}

//For Ref Stn (USE_SPI_GNSS and HAS_ETHERNET), call ntripServerProcessRTCM manually if there is RTCM data in the buffer
void processRTCMBuffer()
{
if ((USE_I2C_GNSS) || (!HAS_ETHERNET))
return;

//Check if there is any data waiting in the RTCM buffer
uint16_t rtcmBytesAvail = theGNSS.rtcmBufferAvailable();
if (rtcmBytesAvail > 0)
{
//Check for too many digits
if (settings.enableResetDisplay == true)
{
if (rtcmPacketsSent > 99) rtcmPacketsSent = 1; //Trim to two digits to avoid overlap
}
else
{
if (rtcmPacketsSent > 999) rtcmPacketsSent = 1; //Trim to three digits to avoid log icon and increasing bar
}

while (rtcmBytesAvail > 0)
{
uint8_t incoming;

if (theGNSS.extractRTCMBufferData(&incoming, 1) != 1)
return;

rtcmBytesAvail--;

//Data in the u-blox library RTCM buffer is pre-checked. We don't need to check it again here.

rtcmLastReceived = millis();
rtcmBytesSent++;

ntripServerProcessRTCM(incoming);

espnowProcessRTCM(incoming);
}
}
}
9 changes: 8 additions & 1 deletion Firmware/RTK_Surveyor/Begin.ino
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,7 @@ void beginGNSS()
//Use gnssHandlerBufferSize for now. TODO: work out if the SPI GNSS needs its own buffer size setting
//Also used by Tasks.ino
theGNSS.setFileBufferSize(settings.gnssHandlerBufferSize);
theGNSS.setRTCMBufferSize(settings.gnssHandlerBufferSize);
}

if (USE_I2C_GNSS)
Expand Down Expand Up @@ -671,6 +672,12 @@ void beginGNSS()
displayGNSSFail(1000);
return;
}
if (theGNSS.getRTCMBufferSize() != settings.gnssHandlerBufferSize) //Need to call getRTCMBufferSize after begin
{
log_d("GNSS offline - no RAM for RTCM buffer");
displayGNSSFail(1000);
return;
}
}

//Increase transactions to reduce transfer time
Expand Down Expand Up @@ -841,7 +848,7 @@ void beginLEDs()
//Configure the on board MAX17048 fuel gauge
void beginFuelGauge()
{
if (productVariant == REFERENCE_STATION)
if (HAS_NO_BATTERY)
return; //Reference station does not have a battery

//Set up the MAX17048 LiPo fuel gauge
Expand Down
127 changes: 26 additions & 101 deletions Firmware/RTK_Surveyor/Display.ino
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,21 @@ void beginDisplay()
systemPrintln("Display not detected");
}

//Avoid code repetition
void displayBatteryVsEthernet()
{
if (HAS_BATTERY)
icons |= ICON_BATTERY; //Top right
else //if (HAS_ETHERNET)
{
if (online.ethernetStatus == ETH_CONNECTED)
blinking_icons |= ICON_ETHERNET; //Don't blink if link is up
else
blinking_icons ^= ICON_ETHERNET;
icons |= (blinking_icons & ICON_ETHERNET); //Top Right
}
}

//Given the system state, display the appropriate information
void updateDisplay()
{
Expand Down Expand Up @@ -205,50 +220,23 @@ void updateDisplay()
| ICON_HORIZONTAL_ACCURACY //Center right
| paintSIV() //Bottom left
| ICON_LOGGING; //Bottom right
if (productVariant != REFERENCE_STATION)
icons |= ICON_BATTERY; //Top right
else
{
if (online.ethernetStatus == ETH_CONNECTED)
blinking_icons |= ICON_ETHERNET; //Don't blink if link is up
else
blinking_icons ^= ICON_ETHERNET;
icons |= (blinking_icons & ICON_ETHERNET); //Top Right
}
displayBatteryVsEthernet(); //Top right
iconsRadio = setRadioIcons(); //Top left
break;
case (STATE_ROVER_NO_FIX):
icons = ICON_CROSS_HAIR //Center left
| ICON_HORIZONTAL_ACCURACY //Center right
| paintSIV() //Bottom left
| ICON_LOGGING; //Bottom right
if (productVariant != REFERENCE_STATION)
icons |= ICON_BATTERY; //Top right
else
{
if (online.ethernetStatus == ETH_CONNECTED)
blinking_icons |= ICON_ETHERNET; //Don't blink if link is up
else
blinking_icons ^= ICON_ETHERNET;
icons |= (blinking_icons & ICON_ETHERNET); //Top Right
}
displayBatteryVsEthernet(); //Top right
iconsRadio = setRadioIcons(); //Top left
break;
case (STATE_ROVER_FIX):
icons = ICON_CROSS_HAIR //Center left
| ICON_HORIZONTAL_ACCURACY //Center right
| paintSIV() //Bottom left
| ICON_LOGGING; //Bottom right
if (productVariant != REFERENCE_STATION)
icons |= ICON_BATTERY; //Top right
else
{
if (online.ethernetStatus == ETH_CONNECTED)
blinking_icons |= ICON_ETHERNET; //Don't blink if link is up
else
blinking_icons ^= ICON_ETHERNET;
icons |= (blinking_icons & ICON_ETHERNET); //Top Right
}
displayBatteryVsEthernet(); //Top right
iconsRadio = setRadioIcons(); //Top left
break;
case (STATE_ROVER_RTK_FLOAT):
Expand All @@ -257,33 +245,15 @@ void updateDisplay()
| ICON_HORIZONTAL_ACCURACY //Center right
| paintSIV() //Bottom left
| ICON_LOGGING; //Bottom right
if (productVariant != REFERENCE_STATION)
icons |= ICON_BATTERY; //Top right
else
{
if (online.ethernetStatus == ETH_CONNECTED)
blinking_icons |= ICON_ETHERNET; //Don't blink if link is up
else
blinking_icons ^= ICON_ETHERNET;
icons |= (blinking_icons & ICON_ETHERNET); //Top Right
}
displayBatteryVsEthernet(); //Top right
iconsRadio = setRadioIcons(); //Top left
break;
case (STATE_ROVER_RTK_FIX):
icons = ICON_CROSS_HAIR_DUAL//Center left
| ICON_HORIZONTAL_ACCURACY //Center right
| paintSIV() //Bottom left
| ICON_LOGGING; //Bottom right
if (productVariant != REFERENCE_STATION)
icons |= ICON_BATTERY; //Top right
else
{
if (online.ethernetStatus == ETH_CONNECTED)
blinking_icons |= ICON_ETHERNET; //Don't blink if link is up
else
blinking_icons ^= ICON_ETHERNET;
icons |= (blinking_icons & ICON_ETHERNET); //Top Right
}
displayBatteryVsEthernet(); //Top right
iconsRadio = setRadioIcons(); //Top left
break;

Expand All @@ -300,74 +270,29 @@ void updateDisplay()
| ICON_HORIZONTAL_ACCURACY //Center right
| paintSIV() //Bottom left
| ICON_LOGGING; //Bottom right
if (productVariant != REFERENCE_STATION)
icons |= ICON_BATTERY; //Top right
else
{
if (online.ethernetStatus == ETH_CONNECTED)
blinking_icons |= ICON_ETHERNET; //Don't blink if link is up
else
blinking_icons ^= ICON_ETHERNET;
icons |= (blinking_icons & ICON_ETHERNET); //Top Right
}
displayBatteryVsEthernet(); //Top right
iconsRadio = setRadioIcons(); //Top left
break;
case (STATE_BASE_TEMP_SURVEY_STARTED):
icons = ICON_LOGGING; //Bottom right
if (productVariant != REFERENCE_STATION)
icons |= ICON_BATTERY; //Top right
else
{
if (online.ethernetStatus == ETH_CONNECTED)
blinking_icons |= ICON_ETHERNET; //Don't blink if link is up
else
blinking_icons ^= ICON_ETHERNET;
icons |= (blinking_icons & ICON_ETHERNET); //Top Right
}
displayBatteryVsEthernet(); //Top right
iconsRadio = setRadioIcons(); //Top left
paintBaseTempSurveyStarted();
break;
case (STATE_BASE_TEMP_TRANSMITTING):
icons = ICON_LOGGING; //Bottom right
if (productVariant != REFERENCE_STATION)
icons |= ICON_BATTERY; //Top right
else
{
if (online.ethernetStatus == ETH_CONNECTED)
blinking_icons |= ICON_ETHERNET; //Don't blink if link is up
else
blinking_icons ^= ICON_ETHERNET;
icons |= (blinking_icons & ICON_ETHERNET); //Top Right
}
displayBatteryVsEthernet(); //Top right
iconsRadio = setRadioIcons(); //Top left
paintRTCM();
break;
case (STATE_BASE_FIXED_NOT_STARTED):
icons = 0; //Top right
if (productVariant != REFERENCE_STATION)
icons |= ICON_BATTERY; //Top right
else
{
if (online.ethernetStatus == ETH_CONNECTED)
blinking_icons |= ICON_ETHERNET; //Don't blink if link is up
else
blinking_icons ^= ICON_ETHERNET;
icons |= (blinking_icons & ICON_ETHERNET); //Top Right
}
displayBatteryVsEthernet(); //Top right
iconsRadio = setRadioIcons(); //Top left
break;
case (STATE_BASE_FIXED_TRANSMITTING):
icons = ICON_LOGGING; //Bottom right
if (productVariant != REFERENCE_STATION)
icons |= ICON_BATTERY; //Top right
else
{
if (online.ethernetStatus == ETH_CONNECTED)
blinking_icons |= ICON_ETHERNET; //Don't blink if link is up
else
blinking_icons ^= ICON_ETHERNET;
icons |= (blinking_icons & ICON_ETHERNET); //Top Right
}
displayBatteryVsEthernet(); //Top right
iconsRadio = setRadioIcons(); //Top left
paintRTCM();
break;
Expand Down Expand Up @@ -3268,7 +3193,7 @@ const uint8_t * getMacAddress()
return wifiMACAddress;
#endif
#ifdef COMPILE_ETHERNET
else if (online.ethernetStatus >= ETH_BEGUN_NO_LINK)
else if ((online.ethernetStatus >= ETH_STARTED_CHECK_CABLE) && (online.ethernetStatus <= ETH_CONNECTED))
return ethernetMACAddress;
#endif
#endif
Expand Down
14 changes: 12 additions & 2 deletions Firmware/RTK_Surveyor/Form.ino
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,12 @@ void createSettingsString(char* newSettings)

stringRecord(newSettings, "logFileName", logFileName);

if (productVariant != REFERENCE_STATION) //Ref Stn does not have a battery
if (HAS_NO_BATTERY) //Ref Stn does not have a battery
{
stringRecord(newSettings, "batteryIconFileName", "src/BatteryBlank.png");
stringRecord(newSettings, "batteryPercent", " ");
}
else
{
//Determine battery icon
int iconLevel = 0;
Expand Down Expand Up @@ -921,7 +926,12 @@ void createDynamicDataString(char* settingsCSV)
stringRecord(settingsCSV, "ecefY", ecefY, 3);
stringRecord(settingsCSV, "ecefZ", ecefZ, 3);

if (productVariant != REFERENCE_STATION) //Ref Stn does not have a battery
if (HAS_NO_BATTERY) //Ref Stn does not have a battery
{
stringRecord(settingsCSV, "batteryIconFileName", "src/BatteryBlank.png");
stringRecord(settingsCSV, "batteryPercent", " ");
}
else
{
//Determine battery icon
int iconLevel = 0;
Expand Down
14 changes: 7 additions & 7 deletions Firmware/RTK_Surveyor/NtripClient.ino
Original file line number Diff line number Diff line change
Expand Up @@ -367,12 +367,7 @@ void ntripClientUpdate()
#ifdef COMPILE_ETHERNET
if (HAS_ETHERNET)
{
if (online.ethernetStatus < ETH_BEGUN_NO_LINK)
{
systemPrintln("Error: Please connect Ethernet before starting NTRIP Client");
ntripClientStop(true); //Do not allocate new wifiClient
}
else
if ((online.ethernetStatus >= ETH_STARTED_CHECK_CABLE) && (online.ethernetStatus <= ETH_CONNECTED))
{
//Pause until connection timeout has passed
if (millis() - ntripClientLastConnectionAttempt > ntripClientConnectionAttemptTimeout)
Expand All @@ -382,6 +377,11 @@ void ntripClientUpdate()
ntripClientSetState(NTRIP_CLIENT_WIFI_ETHERNET_STARTED);
}
}
else
{
systemPrintln("Error: Please connect Ethernet before starting NTRIP Client");
ntripClientStop(true); //Do not allocate new wifiClient
}
}
else
#endif
Expand Down Expand Up @@ -412,7 +412,7 @@ void ntripClientUpdate()
{
if (online.ethernetStatus == ETH_CONNECTED)
ntripClientSetState(NTRIP_CLIENT_WIFI_ETHERNET_CONNECTED);
else if (online.ethernetStatus >= ETH_BEGUN_NO_LINK)
else
ntripClientSetState(NTRIP_CLIENT_OFF);
}
else
Expand Down
Loading