Skip to content

Commit 33bd602

Browse files
authored
Merge pull request #216 from sparkfun/release_candidate
Merge RC changes
2 parents ee58739 + ffd5284 commit 33bd602

Some content is hidden

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

47 files changed

+4799
-4587
lines changed

.github/workflows/compile-rtk-everywhere.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,6 @@ jobs:
100100
https://github.com/me-no-dev/ESPAsyncWebServer.git
101101
https://github.com/me-no-dev/AsyncTCP.git
102102

103-
#Incorporate ESP-Now patch into core: https://github.com/espressif/arduino-esp32/pull/7044/files
104-
#- name: Patch ESP32 Core
105-
# run: |
106-
# cd Firmware/RTK_Everywhere/Patch/
107-
# cp WiFiGeneric.cpp /home/runner/.arduino15/packages/esp32/hardware/esp32/2.0.2/libraries/WiFi/src/WiFiGeneric.cpp
108-
109103
- name: Setup Python
110104
uses: actions/setup-python@v4
111105
with:

.github/workflows/non-release-build.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,6 @@ jobs:
154154
cd Firmware/RTK_Everywhere/build/esp32.esp32.esp32/
155155
mkdir ${{ env.ARTIFACT }}
156156
mv RTK_Everywhere.ino.bin ${{ env.ARTIFACT }}
157-
mv RTK_Everywhere.ino.bootloader.bin ${{ env.ARTIFACT }}
158-
mv RTK_Everywhere.ino.partitions.bin ${{ env.ARTIFACT }}
159157
160158
- name: Upload artifact directory to action - avoid double-zip
161159
uses: actions/upload-artifact@v3

Firmware/RTK_Everywhere/AP-Config/index.html

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1255,7 +1255,7 @@
12551255
</div>
12561256

12571257
<div id="wifiConfigTypeDropdown" class="mt-3">
1258-
<label for="wifiConfigType">Configure Mode: </label>
1258+
<label for="wifiConfigOverAP">Configure Mode: </label>
12591259
<select name="wifiConfigType" id="wifiConfigOverAP" class="form-dropdown">
12601260
<option value="1">AP</option>
12611261
<option value="0">WiFi</option>
@@ -1346,6 +1346,39 @@
13461346
</div>
13471347
</div>
13481348

1349+
<!-- --------- Corrections Priority Config --------- -->
1350+
<div class="d-grid gap-2">
1351+
<button class="btn btn-primary mt-3 toggle-btn" type="button" data-toggle="collapse"
1352+
data-target="#collapseCorrectionsPriorityConfig" aria-expanded="false" aria-controls="collapseCorrectionsPriorityConfig">
1353+
Corrections Configuration <i id="correctionsCaret" class="caret-icon bi icon-caret-down"></i>
1354+
</button>
1355+
</div>
1356+
1357+
<div class="collapse" id="collapseCorrectionsPriorityConfig">
1358+
<div class="card card-body">
1359+
1360+
<div class="form-group mt-2">
1361+
Corrections Source:
1362+
<span class="tt" data-bs-placement="right"
1363+
title="Assign a priority to each corrections source. Priorities must be contiguous, starting at zero with no repeats. Zero is the highest priority. Changes are saved when 'Save Configuration' is pressed.">
1364+
<span class="icon-info-circle text-primary ms-2"></span>
1365+
</span>
1366+
</div>
1367+
<div class="form-group row">
1368+
<p id="collapseCorrectionsPriorityConfigError" class="inlineError"></p>
1369+
</div>
1370+
1371+
<div id="correctionsPriorityList">
1372+
</div>
1373+
1374+
<div style="margin-bottom:5px;">
1375+
<button type="button" id="correctionsPriorityDefaults" class="btn btn-primary"
1376+
onClick="resetToCorrectionsPriorityDefaults()">Reset to Defaults</button>
1377+
</div>
1378+
1379+
</div>
1380+
</div>
1381+
13491382
<!-- --------- System Config --------- -->
13501383
<div class="d-grid gap-2">
13511384
<button class="btn btn-primary mt-3 toggle-btn" type="button" data-toggle="collapse"

Firmware/RTK_Everywhere/AP-Config/src/main.js

Lines changed: 153 additions & 61 deletions
Large diffs are not rendered by default.

Firmware/RTK_Everywhere/Base.ino

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ void DevUBLOXGNSS::processRTCM(uint8_t incoming)
2929
rtcmLastReceived = millis();
3030
rtcmBytesSent++;
3131

32-
ntripServerProcessRTCM(incoming);
32+
for (int serverIndex = 0; serverIndex < NTRIP_SERVER_MAX; serverIndex++)
33+
ntripServerProcessRTCM(serverIndex, incoming);
3334

3435
espnowProcessRTCM(incoming);
3536
}

Firmware/RTK_Everywhere/Begin.ino

Lines changed: 149 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,19 @@ void identifyBoard()
7373
else if (idWithAdc(idValue, 10, 100))
7474
productVariant = RTK_EVK;
7575

76+
// Facet mosaic: 1/4.7 --> 2674mV < 2721mV < 2766mV
77+
else if (idWithAdc(idValue, 1, 4.7))
78+
productVariant = RTK_FACET_MOSAIC;
79+
7680
// ID resistors do not exist for the following:
7781
// Torch
7882
else
7983
{
8084
log_d("Out of band or nonexistent resistor IDs");
8185

8286
// Check if a bq40Z50 battery manager is on the I2C bus
87+
if (i2c_0 == nullptr)
88+
i2c_0 = new TwoWire(0);
8389
int pin_SDA = 15;
8490
int pin_SCL = 4;
8591

@@ -161,6 +167,10 @@ void beginBoard()
161167

162168
pin_beeper = 33;
163169

170+
pin_loraRadio_power = 19; // LoRa_EN
171+
pin_loraRadio_boot = 23; // LoRa_BOOT0
172+
pin_loraRadio_reset = 5; // LoRa_NRST
173+
164174
DMW_if systemPrintf("pin_bluetoothStatusLED: %d\r\n", pin_bluetoothStatusLED);
165175
pinMode(pin_bluetoothStatusLED, OUTPUT);
166176

@@ -176,6 +186,13 @@ void beginBoard()
176186
batteryStatusLedOn();
177187

178188
pinMode(pin_beeper, OUTPUT);
189+
190+
// Beep at power on if we are not locally compiled or a release candidate
191+
if (ENABLE_DEVELOPER == false)
192+
{
193+
beepOn();
194+
delay(250);
195+
}
179196
beepOff();
180197

181198
pinMode(pin_powerButton, INPUT);
@@ -191,6 +208,15 @@ void beginBoard()
191208
digitalWrite(pin_usbSelect, HIGH); // Keep CH340 connected to USB bus
192209

193210
settings.dataPortBaud = 115200; // Override settings. Use UM980 at 115200bps.
211+
212+
pinMode(pin_loraRadio_power, OUTPUT);
213+
digitalWrite(pin_loraRadio_power, LOW); // Keep LoRa powered down
214+
215+
pinMode(pin_loraRadio_boot, OUTPUT);
216+
digitalWrite(pin_loraRadio_boot, LOW);
217+
218+
pinMode(pin_loraRadio_reset, OUTPUT);
219+
digitalWrite(pin_loraRadio_reset, LOW); // Keep LoRa in reset
194220
}
195221

196222
else if (productVariant == RTK_EVK)
@@ -208,7 +234,9 @@ void beginBoard()
208234
present.antennaShortOpen = true;
209235
present.timePulseInterrupt = true;
210236
present.i2c0BusSpeed_400 = true; // Run bus at higher speed
211-
present.display_128x64_i2c1 = true;
237+
present.i2c1 = true;
238+
present.display_i2c1 = true;
239+
present.display_type = DISPLAY_128x64;
212240
present.i2c1BusSpeed_400 = true; // Run display bus at higher speed
213241

214242
// Pin Allocations:
@@ -252,6 +280,10 @@ void beginBoard()
252280
pin_microSD_CardDetect = 36;
253281
// 5, A39 : Unused analog pin - used to generate random values for SSL
254282

283+
// Select the I2C 0 data structure
284+
if (i2c_0 == nullptr)
285+
i2c_0 = new TwoWire(0);
286+
255287
// Disable the Ethernet controller
256288
DMW_if systemPrintf("pin_Ethernet_CS: %d\r\n", pin_Ethernet_CS);
257289
pinMode(pin_Ethernet_CS, OUTPUT);
@@ -274,12 +306,14 @@ void beginBoard()
274306
pinMode(pin_peripheralPowerControl, OUTPUT);
275307
peripheralsOn(); // Turn on power to OLED, SD, ZED, NEO, USB Hub,
276308
}
309+
277310
else if (productVariant == RTK_FACET_V2)
278311
{
279-
present.psram_2mb = true;
312+
present.psram_4mb = true;
280313
present.gnss_zedf9p = true;
281314
present.microSd = true;
282-
present.display_64x48_i2c0 = true;
315+
present.display_i2c0 = true;
316+
present.display_type = DISPLAY_64x48;
283317
present.button_powerLow = true; // Button is pressed when low
284318
present.battery_max17048 = true;
285319
present.portDataMux = true;
@@ -294,6 +328,47 @@ void beginBoard()
294328
pinMode(pin_powerFastOff, OUTPUT);
295329
digitalWrite(pin_powerFastOff, HIGH); // Stay on
296330
}
331+
332+
else if (productVariant == RTK_FACET_MOSAIC)
333+
{
334+
present.psram_4mb = true;
335+
present.gnss_mosaic = true;
336+
present.display_i2c0 = true;
337+
present.display_type = DISPLAY_64x48;
338+
present.i2c0BusSpeed_400 = true;
339+
present.peripheralPowerControl = true;
340+
present.button_powerLow = true; // Button is pressed when low
341+
present.battery_max17048 = true;
342+
present.portDataMux = true;
343+
present.fastPowerOff = true;
344+
345+
pin_batteryStatusLED = 34;
346+
pin_muxA = 18;
347+
pin_muxB = 19;
348+
pin_powerSenseAndControl = 32;
349+
pin_powerFastOff = 33;
350+
pin_muxDAC = 26;
351+
pin_muxADC = 39;
352+
pin_peripheralPowerControl = 27;
353+
pin_I2C0_SDA = 21;
354+
pin_I2C0_SCL = 22;
355+
pin_GnssUart_RX = 13;
356+
pin_GnssUart_TX = 14;
357+
pin_GnssLBandUart_RX = 4;
358+
pin_GnssLBandUart_TX = 25;
359+
360+
pinMode(pin_muxA, OUTPUT);
361+
pinMode(pin_muxB, OUTPUT);
362+
363+
// pinMode(pin_powerFastOff, OUTPUT);
364+
// digitalWrite(pin_powerFastOff, HIGH); // Stay on
365+
pinMode(pin_powerFastOff, INPUT);
366+
367+
// Turn on power to the mosaic and OLED
368+
DMW_if systemPrintf("pin_peripheralPowerControl: %d\r\n", pin_peripheralPowerControl);
369+
pinMode(pin_peripheralPowerControl, OUTPUT);
370+
peripheralsOn(); // Turn on power to OLED, SD, ZED, NEO, USB Hub,
371+
}
297372
}
298373

299374
void beginVersion()
@@ -744,13 +819,25 @@ void tickerBegin()
744819
}
745820
}
746821

822+
//Stop any ticker tasks and PWM control
823+
void tickerStop()
824+
{
825+
bluetoothLedTask.detach();
826+
gnssLedTask.detach();
827+
batteryLedTask.detach();
828+
829+
ledcDetachPin(pin_bluetoothStatusLED);
830+
ledcDetachPin(pin_gnssStatusLED);
831+
ledcDetachPin(pin_batteryStatusLED);
832+
}
833+
747834
// Configure the battery fuel gauge
748835
void beginFuelGauge()
749836
{
750837
if (present.battery_max17048 == true)
751838
{
752839
// Set up the MAX17048 LiPo fuel gauge
753-
if (lipo.begin() == false)
840+
if (lipo.begin(*i2c_0) == false)
754841
{
755842
systemPrintln("Fuel gauge not detected");
756843
return;
@@ -793,7 +880,7 @@ void beginFuelGauge()
793880
return;
794881
}
795882

796-
if (bq40z50Battery->begin() == false)
883+
if (bq40z50Battery->begin(*i2c_0) == false)
797884
{
798885
systemPrintln("BQ40Z50 not detected");
799886
delete bq40z50Battery;
@@ -810,14 +897,21 @@ void beginFuelGauge()
810897
// Check to see if we are dangerously low
811898
if ((batteryLevelPercent < 5) && (isCharging() == false)) // 5% and not charging
812899
{
813-
systemPrintln("Battery too low. Please charge. Shutting down...");
900+
// Currently only the Torch uses the BQ40Z50 and it does not have software shutdown
901+
// So throw a warning, but don't do anything else.
902+
systemPrintln("Battery too low. Please charge.");
814903

815-
if (online.display == true)
816-
displayMessage("Charge Battery", 0);
904+
// If future platforms use the BQ40Z50 and have software shutdown, allow it
905+
// but avoid blocking Torch with the infinite loop of powerDown().
817906

818-
delay(2000);
907+
// systemPrintln("Battery too low. Please charge. Shutting down...");
819908

820-
powerDown(false); // Don't display 'Shutting Down'
909+
// if (online.display == true)
910+
// displayMessage("Charge Battery", 0);
911+
912+
// delay(2000);
913+
914+
// powerDown(false); // Don't display 'Shutting Down'
821915
}
822916
}
823917
#endif // COMPILE_BQ40Z50
@@ -898,9 +992,19 @@ void beginSystemState()
898992
firstRoverStart = false;
899993
}
900994
else if (productVariant == RTK_EVK)
995+
{
996+
firstRoverStart = false; // Screen should have been tested when it was made ;-)
997+
// Return to either NTP, Base or Rover Not Started. The last state previous to power down.
998+
systemState = settings.lastState;
999+
}
1000+
else if (productVariant == RTK_FACET_MOSAIC)
9011001
{
9021002
// Return to either NTP, Base or Rover Not Started. The last state previous to power down.
9031003
systemState = settings.lastState;
1004+
1005+
firstRoverStart = true; // Allow user to enter test screen during first rover start
1006+
if (systemState == STATE_BASE_NOT_STARTED)
1007+
firstRoverStart = false;
9041008
}
9051009
else if (productVariant == RTK_TORCH)
9061010
{
@@ -944,10 +1048,30 @@ void beginI2C()
9441048
{
9451049
TaskHandle_t taskHandle;
9461050

947-
if (present.display_128x64_i2c1 == true)
1051+
if (i2c_0 == nullptr) // i2c_0 could have been instantiated by identifyBoard
1052+
i2c_0 = new TwoWire(0);
1053+
1054+
if (present.i2c1 == true)
1055+
{
1056+
if (i2c_1 == nullptr)
1057+
i2c_1 = new TwoWire(1);
1058+
}
1059+
1060+
if ((present.display_i2c0 == true) && (present.display_i2c1 == true))
1061+
reportFatalError("Displays on both i2c_0 and i2c_1");
1062+
1063+
if (present.display_i2c0 == true)
1064+
{
1065+
// Display is on standard Wire bus
1066+
i2cDisplay = i2c_0;
1067+
}
1068+
1069+
if (present.display_i2c1 == true)
9481070
{
1071+
if (present.i2c1 == false)
1072+
reportFatalError("No i2c1 for display_i2c1");
1073+
9491074
// Display is on I2C bus 1
950-
i2c_1 = new TwoWire(1);
9511075
i2cDisplay = i2c_1;
9521076

9531077
// Display splash screen for at least 1 second
@@ -994,7 +1118,7 @@ void pinI2CTask(void *pvParameters)
9941118
online.i2c = true;
9951119

9961120
// Initialize I2C bus 1
997-
if (i2c_1)
1121+
if (present.i2c1)
9981122
{
9991123
int bus1speed = 100;
10001124
if (present.i2c1BusSpeed_400 == true)
@@ -1157,6 +1281,18 @@ void deleteSDSizeCheckTask()
11571281
}
11581282
}
11591283

1284+
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
1285+
1286+
// Check and initialize any arrays that won't be initialized by gnssConfigure (checkGNSSArrayDefaults)
1287+
// TODO: find a better home for this
1288+
void checkArrayDefaults()
1289+
{
1290+
if (!validateCorrectionPriorities())
1291+
initializeCorrectionPriorities();
1292+
if (!validateCorrectionPriorities())
1293+
reportFatalError("initializeCorrectionPriorities failed.");
1294+
}
1295+
11601296
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
11611297
// Time Pulse ISR
11621298
// Triggered by the rising edge of the time pulse signal, indicates the top-of-second.

Firmware/RTK_Everywhere/Bluetooth.ino

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,14 @@ int bluetoothRead(uint8_t *buffer, int length)
9393
return (bytesRead);
9494

9595
bytesRead = bluetoothSerialSpp->readBytes(buffer, length);
96+
97+
return (bytesRead);
9698
}
9799
else
98100
return bluetoothSerial->readBytes(buffer, length);
101+
102+
return 0;
103+
99104
#else // COMPILE_BT
100105
return 0;
101106
#endif // COMPILE_BT
@@ -222,9 +227,9 @@ void bluetoothStart()
222227
{
223228
bluetoothState = BT_OFF;
224229
char stateName[11] = {0};
225-
if (systemState >= STATE_ROVER_NOT_STARTED && systemState <= STATE_ROVER_RTK_FIX)
230+
if (inRoverMode() == true)
226231
strncpy(stateName, "Rover-", sizeof(stateName) - 1);
227-
else if (systemState >= STATE_BASE_NOT_STARTED && systemState <= STATE_BASE_FIXED_TRANSMITTING)
232+
else if (inBaseMode() == true)
228233
strncpy(stateName, "Base-", sizeof(stateName) - 1);
229234
else
230235
{

0 commit comments

Comments
 (0)