Skip to content

Commit 3e94057

Browse files
authored
Merge branch 'release_candidate' into no-lband
2 parents 0ecf8ea + 4b24eeb commit 3e94057

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1998
-511
lines changed

Firmware/RTK_Surveyor/Base.ino

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,4 +228,8 @@ bool startFixedBase()
228228
void SFE_UBLOX_GNSS::processRTCM(uint8_t incoming)
229229
{
230230
ntripServerProcessRTCM(incoming);
231+
232+
#ifdef COMPILE_ESPNOW
233+
espnowProcessRTCM(incoming);
234+
#endif
231235
}

Firmware/RTK_Surveyor/Begin.ino

Lines changed: 49 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -147,28 +147,16 @@ void beginBoard()
147147
unitMACAddress[5] += 2; //Convert MAC address to Bluetooth MAC (add 2): https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/system.html#mac-address
148148

149149
//For all boards, check reset reason. If reset was due to wdt or panic, append last log
150+
loadSettingsPartial(); //Get resetCount
150151
if (esp_reset_reason() == ESP_RST_POWERON)
151152
{
152153
reuseLastLog = false; //Start new log
153-
154-
loadSettingsPartial();
155-
if (settings.enableResetDisplay == true)
156-
{
157-
settings.resetCount = 0;
158-
recordSystemSettings(); //Record to NVM
159-
}
154+
settings.resetCount = 0;
160155
}
161156
else
162157
{
163158
reuseLastLog = true; //Attempt to reuse previous log
164-
165-
loadSettingsPartial();
166-
if (settings.enableResetDisplay == true)
167-
{
168-
settings.resetCount++;
169-
Serial.printf("resetCount: %d\n\r", settings.resetCount);
170-
recordSystemSettings(); //Record to NVM
171-
}
159+
settings.resetCount++;
172160

173161
Serial.print("Reset reason: ");
174162
switch (esp_reset_reason())
@@ -186,6 +174,8 @@ void beginBoard()
186174
default : Serial.println("Unknown");
187175
}
188176
}
177+
178+
recordSystemSettings(); //Record resetCount to NVM
189179
}
190180

191181
void beginSD()
@@ -202,7 +192,7 @@ void beginSD()
202192
else if (xSemaphoreTake(sdCardSemaphore, fatSemaphore_shortWait_ms) != pdPASS)
203193
{
204194
//This is OK since a retry will occur next loop
205-
log_d("sdCardSemaphore failed to yield, Begin.ino line %d\r\n", __LINE__);
195+
log_d("sdCardSemaphore failed to yield, Begin.ino line %d", __LINE__);
206196
break;
207197
}
208198
gotSemaphore = true;
@@ -395,13 +385,15 @@ void beginFS()
395385
{
396386
if (online.fs == false)
397387
{
398-
if (!LittleFS.begin(true)) //Format LittleFS if begin fails
388+
if (LittleFS.begin(true) == false) //Format LittleFS if begin fails
399389
{
400-
log_d("Error: LittleFS not online");
401-
return;
390+
Serial.println("Error: LittleFS not online");
391+
}
392+
else
393+
{
394+
Serial.println("LittleFS Started");
395+
online.fs = true;
402396
}
403-
Serial.println("LittleFS Started");
404-
online.fs = true;
405397
}
406398
}
407399

@@ -552,6 +544,8 @@ void beginFuelGauge()
552544
return;
553545
}
554546

547+
online.battery = true;
548+
555549
//Always use hibernate mode
556550
if (lipo.getHIBRTActThr() < 0xFF) lipo.setHIBRTActThr((uint8_t)0xFF);
557551
if (lipo.getHIBRTHibThr() < 0xFF) lipo.setHIBRTHibThr((uint8_t)0xFF);
@@ -561,7 +555,7 @@ void beginFuelGauge()
561555
checkBatteryLevels(); //Force check so you see battery level immediately at power on
562556

563557
//Check to see if we are dangerously low
564-
if (battLevel < 5 && battChangeRate < 0) //5% and not charging
558+
if (battLevel < 5 && battChangeRate < 0.5) //5% and not charging
565559
{
566560
Serial.println("Battery too low. Please charge. Shutting down...");
567561

@@ -573,7 +567,6 @@ void beginFuelGauge()
573567
powerDown(false); //Don't display 'Shutting Down'
574568
}
575569

576-
online.battery = true;
577570
}
578571

579572
//Begin accelerometer if available
@@ -712,20 +705,23 @@ bool beginExternalTriggers()
712705

713706
void beginIdleTasks()
714707
{
715-
char taskName[32];
716-
717-
for (int index = 0; index < MAX_CPU_CORES; index++)
708+
if (settings.enablePrintIdleTime == true)
718709
{
719-
sprintf(taskName, "IdleTask%d", index);
720-
if (idleTaskHandle[index] == NULL)
721-
xTaskCreatePinnedToCore(
722-
idleTask,
723-
taskName, //Just for humans
724-
2000, //Stack Size
725-
NULL, //Task input parameter
726-
0, // Priority, with 3 (configMAX_PRIORITIES - 1) being the highest, and 0 being the lowest
727-
&idleTaskHandle[index], //Task handle
728-
index); //Core where task should run, 0=core, 1=Arduino
710+
char taskName[32];
711+
712+
for (int index = 0; index < MAX_CPU_CORES; index++)
713+
{
714+
sprintf(taskName, "IdleTask%d", index);
715+
if (idleTaskHandle[index] == NULL)
716+
xTaskCreatePinnedToCore(
717+
idleTask,
718+
taskName, //Just for humans
719+
2000, //Stack Size
720+
NULL, //Task input parameter
721+
0, // Priority, with 3 (configMAX_PRIORITIES - 1) being the highest, and 0 being the lowest
722+
&idleTaskHandle[index], //Task handle
723+
index); //Core where task should run, 0=core, 1=Arduino
724+
}
729725
}
730726
}
731727

@@ -741,11 +737,27 @@ void beginI2C()
741737
//SCL/GND shorted: 1000ms, response 5
742738
//SDA/VCC shorted: 1000ms, reponse 5
743739
//SDA/GND shorted: 14ms, response 5
744-
unsigned long startTime = millis();
745740
Wire.beginTransmission(0x15); //Dummy address
746741
int endValue = Wire.endTransmission();
747742
if (endValue == 2)
748743
online.i2c = true;
749744
else
750745
Serial.println("Error: I2C Bus Not Responding");
751746
}
747+
748+
//Depending on radio selection, begin hardware
749+
void radioStart()
750+
{
751+
#ifdef COMPILE_ESPNOW
752+
if (settings.radioType == RADIO_EXTERNAL)
753+
{
754+
espnowStop();
755+
756+
//Nothing to start. UART2 of ZED is connected to external Radio port and is configured at configureUbloxModule()
757+
}
758+
else if (settings.radioType == RADIO_ESPNOW)
759+
{
760+
espnowStart();
761+
}
762+
#endif
763+
}

Firmware/RTK_Surveyor/Bluetooth.ino

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,14 @@ static volatile byte bluetoothState = BT_OFF;
4040
//Used for updating the bluetoothState state machine
4141
void bluetoothCallback(esp_spp_cb_event_t event, esp_spp_cb_param_t *param) {
4242
if (event == ESP_SPP_SRV_OPEN_EVT) {
43-
Serial.println("Client Connected");
43+
Serial.println("BT client Connected");
4444
bluetoothState = BT_CONNECTED;
4545
if (productVariant == RTK_SURVEYOR)
4646
digitalWrite(pin_bluetoothStatusLED, HIGH);
4747
}
4848

4949
if (event == ESP_SPP_CLOSE_EVT ) {
50-
Serial.println("Client disconnected");
50+
Serial.println("BT client disconnected");
5151
bluetoothState = BT_NOTCONNECTED;
5252
if (productVariant == RTK_SURVEYOR)
5353
digitalWrite(pin_bluetoothStatusLED, LOW);
@@ -105,9 +105,6 @@ bool bluetoothRxDataAvailable()
105105
//This allows multiple units to be on at same time
106106
void bluetoothStart()
107107
{
108-
ntripClientStop(true);
109-
ntripServerStop(true);
110-
wifiStop();
111108
#ifdef COMPILE_BT
112109
if (bluetoothState == BT_OFF)
113110
{
@@ -186,7 +183,7 @@ void bluetoothStop()
186183
reportHeapNow();
187184
}
188185
#endif //COMPILE_BT
189-
online.rxRtcmCorrectionData = false;
186+
bluetoothIncomingRTCM = false;
190187
}
191188

192189
//Write data to the Bluetooth device

0 commit comments

Comments
 (0)