Skip to content

Commit 4198742

Browse files
authored
Merge pull request #73 from sparkfun/release_candidate
v19 Release
2 parents 6681dd6 + 6c17c78 commit 4198742

File tree

12 files changed

+90
-52
lines changed

12 files changed

+90
-52
lines changed
Binary file not shown.
1.81 MB
Binary file not shown.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ function parseIncoming(msg) {
4545
hide("msgUBX_ESF_ALG");
4646
hide("msgUBX_ESF_INS");
4747
}
48-
else if (platformPrefix == "Express") {
48+
else if (platformPrefix == "Express" || platformPrefix == "Facet") {
4949
hide("sensorConfig"); //Hide Sensor Config section
5050

5151
hide("msgUBX_ESF_MEAS"); //Hide unsupported messages

Firmware/RTK_Surveyor/Begin.ino

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ void beginSD()
164164
if (sd.begin(SdSpiConfig(pin_microSD_CS, SHARED_SPI, SD_SCK_MHZ(settings.spiFrequency))) == false)
165165
{
166166
int tries = 0;
167-
int maxTries = 2;
167+
int maxTries = 1;
168168
for ( ; tries < maxTries ; tries++)
169169
{
170170
Serial.printf("SD init failed. Trying again %d out of %d\n\r", tries + 1, maxTries);
@@ -447,6 +447,9 @@ void beginAccelerometer()
447447
if (accel.begin() == false)
448448
{
449449
online.accelerometer = false;
450+
451+
displayAccelFail(1000);
452+
450453
return;
451454
}
452455

@@ -478,6 +481,8 @@ void beginSystemState()
478481
else if (productVariant == RTK_FACET)
479482
{
480483
systemState = settings.lastState; //Return to system state previous to power down.
484+
if (systemState == STATE_ROVER_NOT_STARTED)
485+
firstRoverStart = true; //Allow user to enter test screen during first rover start
481486

482487
powerBtn = new Button(pin_powerSenseAndControl); //Create the button in memory
483488
}

Firmware/RTK_Surveyor/Buttons.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//User has pressed the power button to turn on the system
22
//Was it an accidental bump or do they really want to turn on?
3-
//Let's make sure they continue to press for two seconds
3+
//Let's make sure they continue to press for 500ms
44
void powerOnCheck()
55
{
66
#ifdef ENABLE_DEVELOPER
@@ -10,7 +10,7 @@ void powerOnCheck()
1010
powerPressedStartTime = millis();
1111
while (digitalRead(pin_powerSenseAndControl) == LOW)
1212
{
13-
delay(100); //Wait for user to stop pressing button.
13+
delay(10);
1414

1515
if (millis() - powerPressedStartTime > 500)
1616
break;

Firmware/RTK_Surveyor/Display.ino

Lines changed: 51 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1170,6 +1170,24 @@ void displayRoverFail(uint16_t displayTime)
11701170
}
11711171
}
11721172

1173+
void displayAccelFail(uint16_t displayTime)
1174+
{
1175+
if (online.display == true)
1176+
{
1177+
oled.clear(PAGE);
1178+
1179+
uint8_t fontHeight = 15;
1180+
uint8_t yPos = LCDHEIGHT / 2 - fontHeight;
1181+
1182+
printTextCenter("Accel", yPos, 1, 1, false); //text, y, font type, kerning, inverted
1183+
printTextCenter("Failed", yPos + fontHeight, 1, 1, false); //text, y, font type, kerning, inverted
1184+
1185+
oled.display();
1186+
1187+
delay(displayTime);
1188+
}
1189+
}
1190+
11731191
//When user enters serial config menu the display will freeze so show splash while config happens
11741192
void displaySerialConfig()
11751193
{
@@ -1429,8 +1447,21 @@ void paintSystemTest()
14291447
oled.setCursor(xOffset, yOffset + (5 * charHeight) ); //x, y
14301448
oled.print(macAddress);
14311449
oled.print(":");
1450+
1451+
//Verify the ESP UART2 can communicate TX/RX to ZED UART1
14321452
if (zedUartPassed == false)
1433-
oled.print(F("FAIL"));
1453+
{
1454+
SFE_UBLOX_GNSS myGNSS;
1455+
1456+
//begin() attempts 3 connections
1457+
if (myGNSS.begin(serialGNSS) == true)
1458+
{
1459+
zedUartPassed = true;
1460+
oled.print(F("OK"));
1461+
}
1462+
else
1463+
oled.print(F("FAIL"));
1464+
}
14341465
else
14351466
oled.print(F("OK"));
14361467
}
@@ -1445,22 +1476,29 @@ void paintBubbleLevel()
14451476
{
14461477
if (online.display == true)
14471478
{
1448-
forceDisplayUpdate = true; //Update the display as quickly as possible
1479+
if (online.accelerometer == true)
1480+
{
1481+
forceDisplayUpdate = true; //Update the display as quickly as possible
14491482

1450-
getAngles();
1483+
getAngles();
14511484

1452-
//Draw dot in middle
1453-
oled.pixel(LCDWIDTH / 2, LCDHEIGHT / 2);
1454-
oled.pixel(LCDWIDTH / 2 + 1, LCDHEIGHT / 2);
1455-
oled.pixel(LCDWIDTH / 2, LCDHEIGHT / 2 + 1);
1456-
oled.pixel(LCDWIDTH / 2 + 1, LCDHEIGHT / 2 + 1);
1485+
//Draw dot in middle
1486+
oled.pixel(LCDWIDTH / 2, LCDHEIGHT / 2);
1487+
oled.pixel(LCDWIDTH / 2 + 1, LCDHEIGHT / 2);
1488+
oled.pixel(LCDWIDTH / 2, LCDHEIGHT / 2 + 1);
1489+
oled.pixel(LCDWIDTH / 2 + 1, LCDHEIGHT / 2 + 1);
14571490

1458-
//Draw circle relative to dot
1459-
const int radiusLarge = 10;
1460-
const int radiusSmall = 4;
1491+
//Draw circle relative to dot
1492+
const int radiusLarge = 10;
1493+
const int radiusSmall = 4;
14611494

1462-
oled.circle(LCDWIDTH / 2 - averagedPitch, LCDHEIGHT / 2 + averagedRoll, radiusLarge);
1463-
oled.circle(LCDWIDTH / 2 - averagedPitch, LCDHEIGHT / 2 + averagedRoll, radiusSmall);
1495+
oled.circle(LCDWIDTH / 2 - averagedPitch, LCDHEIGHT / 2 + averagedRoll, radiusLarge);
1496+
oled.circle(LCDWIDTH / 2 - averagedPitch, LCDHEIGHT / 2 + averagedRoll, radiusSmall);
1497+
}
1498+
else
1499+
{
1500+
displayAccelFail(0);
1501+
}
14641502
}
14651503
}
14661504

Firmware/RTK_Surveyor/Form.ino

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,10 @@ static void handleFirmwareFileUpload(AsyncWebServerRequest *request, String file
201201
fileName.toCharArray(tempFileName, sizeof(tempFileName));
202202

203203
if (sd.exists(tempFileName))
204+
{
204205
sd.remove(tempFileName);
206+
Serial.printf("Removed old firmware file: %s\n\r", tempFileName);
207+
}
205208

206209
Serial.printf("Start Firmware Upload: %s\n\r", tempFileName);
207210

@@ -218,7 +221,9 @@ static void handleFirmwareFileUpload(AsyncWebServerRequest *request, String file
218221

219222
//Record to file
220223
if (newFirmwareFile.write(data, len) != len)
221-
Serial.println(F("Error writing to firmware file"));
224+
log_e("Error writing to firmware file");
225+
else
226+
log_d("Recorded %d bytes to file\n\r", len);
222227

223228
if (final)
224229
{

Firmware/RTK_Surveyor/RTK_Surveyor.ino

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@
4242
*/
4343

4444
const int FIRMWARE_VERSION_MAJOR = 1;
45-
const int FIRMWARE_VERSION_MINOR = 8;
45+
const int FIRMWARE_VERSION_MINOR = 9;
4646

4747
#define COMPILE_WIFI //Comment out to remove all WiFi functionality
4848
#define COMPILE_BT //Comment out to disable all Bluetooth
49-
#define ENABLE_DEVELOPER //Uncomment this line to enable special developer modes (don't check power button at startup)
49+
//#define ENABLE_DEVELOPER //Uncomment this line to enable special developer modes (don't check power button at startup)
5050

5151
//Define the RTK board identifier:
5252
// This is an int which is unique to this variant of the RTK Surveyor hardware which allows us
@@ -104,7 +104,7 @@ ESP32Time rtc;
104104
//microSD Interface
105105
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
106106
#include <SPI.h>
107-
#include "SdFat.h"
107+
#include "SdFat.h" //Currently uses v2.1.1
108108

109109
SdFat sd;
110110

@@ -135,7 +135,6 @@ uint32_t sdUsedSpaceMB = 0;
135135

136136
WiFiClient caster;
137137
#endif
138-
const char * ntrip_server_name = "SparkFun_RTK_Surveyor";
139138

140139
unsigned long lastServerSent_ms = 0; //Time of last data pushed to caster
141140
unsigned long lastServerReport_ms = 0; //Time of last report of caster bytes sent
@@ -352,6 +351,8 @@ float svinMeanAccuracy = 0;
352351

353352
uint32_t lastSetupMenuChange = 0; //Auto-selects the setup menu option after 1500ms
354353
uint32_t lastTestMenuChange = 0; //Avoids exiting the test menu for at least 1 second
354+
355+
bool firstRoverStart = false; //Used to detect if user is toggling power button at POR to enter test menu
355356
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
356357

357358
void setup()

Firmware/RTK_Surveyor/States.ino

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ void updateSystemState()
5959
displayRoverSuccess(500);
6060

6161
changeState(STATE_ROVER_NO_FIX);
62+
firstRoverStart = false; //Do not allow entry into test menu again
6263
}
6364
break;
6465

@@ -298,11 +299,11 @@ void updateSystemState()
298299

299300
Serial.printf("Connected to %s:%d\n\r", settings.casterHost, settings.casterPort);
300301

301-
const int SERVER_BUFFER_SIZE = 512;
302+
const int SERVER_BUFFER_SIZE = 512;
302303
char serverBuffer[SERVER_BUFFER_SIZE];
303304

304-
snprintf(serverBuffer, SERVER_BUFFER_SIZE, "SOURCE %s /%s\r\nSource-Agent: NTRIP %s/%s\r\n\r\n",
305-
settings.mountPointPW, settings.mountPoint, ntrip_server_name, "App Version 1.0");
305+
snprintf(serverBuffer, SERVER_BUFFER_SIZE, "SOURCE %s /%s\r\nSource-Agent: NTRIP SparkFun_RTK_%s/v%d.%d\r\n\r\n",
306+
settings.mountPointPW, settings.mountPoint, platformPrefix, FIRMWARE_VERSION_MAJOR, FIRMWARE_VERSION_MINOR);
306307

307308
//Serial.printf("Sending credentials:\n%s\n\r", serverBuffer);
308309
caster.write(serverBuffer, strlen(serverBuffer));
@@ -475,8 +476,8 @@ void updateSystemState()
475476
const int SERVER_BUFFER_SIZE = 512;
476477
char serverBuffer[SERVER_BUFFER_SIZE];
477478

478-
snprintf(serverBuffer, SERVER_BUFFER_SIZE, "SOURCE %s /%s\r\nSource-Agent: NTRIP %s/%s\r\n\r\n",
479-
settings.mountPointPW, settings.mountPoint, ntrip_server_name, "App Version 1.0");
479+
snprintf(serverBuffer, SERVER_BUFFER_SIZE, "SOURCE %s /%s\r\nSource-Agent: NTRIP SparkFun_RTK_%s/v%d.%d\r\n\r\n",
480+
settings.mountPointPW, settings.mountPoint, platformPrefix, FIRMWARE_VERSION_MAJOR, FIRMWARE_VERSION_MINOR);
480481

481482
//Serial.printf("Sending credentials:\n%s\n\r", serverBuffer);
482483
caster.write(serverBuffer, strlen(serverBuffer));
@@ -641,24 +642,12 @@ void updateSystemState()
641642
//Debounce entry into test menu
642643
if (millis() - lastTestMenuChange > 500)
643644
{
645+
zedUartPassed = false;
646+
644647
//Enable RTCM 1230. This is the GLONASS bias sentence and is transmitted
645648
//even if there is no GPS fix. We use it to test serial output.
646649
i2cGNSS.enableRTCMmessage(UBX_RTCM_1230, COM_PORT_UART2, 1); //Enable message every second
647650

648-
//Verify the ESP UART2 can communicate TX/RX to ZED UART1
649-
SFE_UBLOX_GNSS myGNSS;
650-
651-
//Attempt 3 connections
652-
for (int x = 0 ; x < 3 ; x++)
653-
{
654-
if (myGNSS.begin(serialGNSS) == true)
655-
{
656-
zedUartPassed = true;
657-
break;
658-
}
659-
delay(250);
660-
}
661-
662651
changeState(STATE_TESTING);
663652
}
664653
}

Firmware/RTK_Surveyor/System.ino

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,12 +226,12 @@ bool configureUbloxModule()
226226
if (getSerialRate(COM_PORT_UART1) != settings.dataPortBaud)
227227
{
228228
Serial.println(F("Updating UART1 rate"));
229-
i2cGNSS.setSerialRate(settings.dataPortBaud, COM_PORT_UART1); //Set UART1 to 115200
229+
i2cGNSS.setSerialRate(settings.dataPortBaud, COM_PORT_UART1);
230230
}
231-
if (getSerialRate(COM_PORT_UART2) != settings.radioPortBaud)
231+
if (getSerialRate(COM_PORT_UART2) != settings.radioPortBaud) //Defaults to 460800 to maximize message output support
232232
{
233233
Serial.println(F("Updating UART2 rate"));
234-
i2cGNSS.setSerialRate(settings.radioPortBaud, COM_PORT_UART2); //Set UART2 to 57600 to match SiK telemetry radio firmware default
234+
i2cGNSS.setSerialRate(settings.radioPortBaud, COM_PORT_UART2); //Defaults to 57600 to match SiK telemetry radio firmware default
235235
}
236236

237237
if (response == false)

Firmware/RTK_Surveyor/Tasks.ino

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -292,13 +292,13 @@ void ButtonCheckTask(void *e)
292292
forceSystemStateUpdate = true;
293293
requestChangeState(STATE_SHUTDOWN);
294294
}
295-
// else if ((setupBtn != NULL && setupBtn->pressedFor(500)) &&
296-
// (powerBtn != NULL && powerBtn->pressedFor(500)))
297-
// {
298-
// forceSystemStateUpdate = true;
299-
// requestChangeState(STATE_TEST);
300-
// }
301-
else if (powerBtn != NULL && powerBtn->wasReleased())
295+
else if (powerBtn != NULL && systemState == STATE_ROVER_NOT_STARTED && firstRoverStart == true && powerBtn->pressedFor(500))
296+
{
297+
forceSystemStateUpdate = true;
298+
requestChangeState(STATE_TEST);
299+
lastTestMenuChange = millis(); //Avoid exiting test menu for 1s
300+
}
301+
else if (powerBtn != NULL && powerBtn->wasReleased() && firstRoverStart == false)
302302
{
303303
switch (systemState)
304304
{

Firmware/RTK_Surveyor/form.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ function parseIncoming(msg) {
6868
hide("msgUBX_ESF_ALG");
6969
hide("msgUBX_ESF_INS");
7070
}
71-
else if (platformPrefix == "Express") {
71+
else if (platformPrefix == "Express" || platformPrefix == "Facet") {
7272
hide("sensorConfig"); //Hide Sensor Config section
7373

7474
hide("msgUBX_ESF_MEAS"); //Hide unsupported messages

0 commit comments

Comments
 (0)