Skip to content

v19 Release #73

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Dec 7, 2021
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
Binary file not shown.
Binary file not shown.
Binary file added Binaries/RTK_Surveyor_Firmware_v18_combined.bin
Binary file not shown.
Binary file added Binaries/RTK_Surveyor_Firmware_v19_combined.bin
Binary file not shown.
2 changes: 1 addition & 1 deletion Firmware/RTK_Surveyor/AP-Config/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function parseIncoming(msg) {
hide("msgUBX_ESF_ALG");
hide("msgUBX_ESF_INS");
}
else if (platformPrefix == "Express") {
else if (platformPrefix == "Express" || platformPrefix == "Facet") {
hide("sensorConfig"); //Hide Sensor Config section

hide("msgUBX_ESF_MEAS"); //Hide unsupported messages
Expand Down
7 changes: 6 additions & 1 deletion Firmware/RTK_Surveyor/Begin.ino
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ void beginSD()
if (sd.begin(SdSpiConfig(pin_microSD_CS, SHARED_SPI, SD_SCK_MHZ(settings.spiFrequency))) == false)
{
int tries = 0;
int maxTries = 2;
int maxTries = 1;
for ( ; tries < maxTries ; tries++)
{
Serial.printf("SD init failed. Trying again %d out of %d\n\r", tries + 1, maxTries);
Expand Down Expand Up @@ -447,6 +447,9 @@ void beginAccelerometer()
if (accel.begin() == false)
{
online.accelerometer = false;

displayAccelFail(1000);

return;
}

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

powerBtn = new Button(pin_powerSenseAndControl); //Create the button in memory
}
Expand Down
4 changes: 2 additions & 2 deletions Firmware/RTK_Surveyor/Buttons.ino
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//User has pressed the power button to turn on the system
//Was it an accidental bump or do they really want to turn on?
//Let's make sure they continue to press for two seconds
//Let's make sure they continue to press for 500ms
void powerOnCheck()
{
#ifdef ENABLE_DEVELOPER
Expand All @@ -10,7 +10,7 @@ void powerOnCheck()
powerPressedStartTime = millis();
while (digitalRead(pin_powerSenseAndControl) == LOW)
{
delay(100); //Wait for user to stop pressing button.
delay(10);

if (millis() - powerPressedStartTime > 500)
break;
Expand Down
64 changes: 51 additions & 13 deletions Firmware/RTK_Surveyor/Display.ino
Original file line number Diff line number Diff line change
Expand Up @@ -1170,6 +1170,24 @@ void displayRoverFail(uint16_t displayTime)
}
}

void displayAccelFail(uint16_t displayTime)
{
if (online.display == true)
{
oled.clear(PAGE);

uint8_t fontHeight = 15;
uint8_t yPos = LCDHEIGHT / 2 - fontHeight;

printTextCenter("Accel", yPos, 1, 1, false); //text, y, font type, kerning, inverted
printTextCenter("Failed", yPos + fontHeight, 1, 1, false); //text, y, font type, kerning, inverted

oled.display();

delay(displayTime);
}
}

//When user enters serial config menu the display will freeze so show splash while config happens
void displaySerialConfig()
{
Expand Down Expand Up @@ -1429,8 +1447,21 @@ void paintSystemTest()
oled.setCursor(xOffset, yOffset + (5 * charHeight) ); //x, y
oled.print(macAddress);
oled.print(":");

//Verify the ESP UART2 can communicate TX/RX to ZED UART1
if (zedUartPassed == false)
oled.print(F("FAIL"));
{
SFE_UBLOX_GNSS myGNSS;

//begin() attempts 3 connections
if (myGNSS.begin(serialGNSS) == true)
{
zedUartPassed = true;
oled.print(F("OK"));
}
else
oled.print(F("FAIL"));
}
else
oled.print(F("OK"));
}
Expand All @@ -1445,22 +1476,29 @@ void paintBubbleLevel()
{
if (online.display == true)
{
forceDisplayUpdate = true; //Update the display as quickly as possible
if (online.accelerometer == true)
{
forceDisplayUpdate = true; //Update the display as quickly as possible

getAngles();
getAngles();

//Draw dot in middle
oled.pixel(LCDWIDTH / 2, LCDHEIGHT / 2);
oled.pixel(LCDWIDTH / 2 + 1, LCDHEIGHT / 2);
oled.pixel(LCDWIDTH / 2, LCDHEIGHT / 2 + 1);
oled.pixel(LCDWIDTH / 2 + 1, LCDHEIGHT / 2 + 1);
//Draw dot in middle
oled.pixel(LCDWIDTH / 2, LCDHEIGHT / 2);
oled.pixel(LCDWIDTH / 2 + 1, LCDHEIGHT / 2);
oled.pixel(LCDWIDTH / 2, LCDHEIGHT / 2 + 1);
oled.pixel(LCDWIDTH / 2 + 1, LCDHEIGHT / 2 + 1);

//Draw circle relative to dot
const int radiusLarge = 10;
const int radiusSmall = 4;
//Draw circle relative to dot
const int radiusLarge = 10;
const int radiusSmall = 4;

oled.circle(LCDWIDTH / 2 - averagedPitch, LCDHEIGHT / 2 + averagedRoll, radiusLarge);
oled.circle(LCDWIDTH / 2 - averagedPitch, LCDHEIGHT / 2 + averagedRoll, radiusSmall);
oled.circle(LCDWIDTH / 2 - averagedPitch, LCDHEIGHT / 2 + averagedRoll, radiusLarge);
oled.circle(LCDWIDTH / 2 - averagedPitch, LCDHEIGHT / 2 + averagedRoll, radiusSmall);
}
else
{
displayAccelFail(0);
}
}
}

Expand Down
7 changes: 6 additions & 1 deletion Firmware/RTK_Surveyor/Form.ino
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,10 @@ static void handleFirmwareFileUpload(AsyncWebServerRequest *request, String file
fileName.toCharArray(tempFileName, sizeof(tempFileName));

if (sd.exists(tempFileName))
{
sd.remove(tempFileName);
Serial.printf("Removed old firmware file: %s\n\r", tempFileName);
}

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

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

//Record to file
if (newFirmwareFile.write(data, len) != len)
Serial.println(F("Error writing to firmware file"));
log_e("Error writing to firmware file");
else
log_d("Recorded %d bytes to file\n\r", len);

if (final)
{
Expand Down
9 changes: 5 additions & 4 deletions Firmware/RTK_Surveyor/RTK_Surveyor.ino
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@
*/

const int FIRMWARE_VERSION_MAJOR = 1;
const int FIRMWARE_VERSION_MINOR = 8;
const int FIRMWARE_VERSION_MINOR = 9;

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

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

SdFat sd;

Expand Down Expand Up @@ -135,7 +135,6 @@ uint32_t sdUsedSpaceMB = 0;

WiFiClient caster;
#endif
const char * ntrip_server_name = "SparkFun_RTK_Surveyor";

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

uint32_t lastSetupMenuChange = 0; //Auto-selects the setup menu option after 1500ms
uint32_t lastTestMenuChange = 0; //Avoids exiting the test menu for at least 1 second

bool firstRoverStart = false; //Used to detect if user is toggling power button at POR to enter test menu
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

void setup()
Expand Down
27 changes: 8 additions & 19 deletions Firmware/RTK_Surveyor/States.ino
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ void updateSystemState()
displayRoverSuccess(500);

changeState(STATE_ROVER_NO_FIX);
firstRoverStart = false; //Do not allow entry into test menu again
}
break;

Expand Down Expand Up @@ -298,11 +299,11 @@ void updateSystemState()

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

const int SERVER_BUFFER_SIZE = 512;
const int SERVER_BUFFER_SIZE = 512;
char serverBuffer[SERVER_BUFFER_SIZE];

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

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

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

//Serial.printf("Sending credentials:\n%s\n\r", serverBuffer);
caster.write(serverBuffer, strlen(serverBuffer));
Expand Down Expand Up @@ -641,24 +642,12 @@ void updateSystemState()
//Debounce entry into test menu
if (millis() - lastTestMenuChange > 500)
{
zedUartPassed = false;

//Enable RTCM 1230. This is the GLONASS bias sentence and is transmitted
//even if there is no GPS fix. We use it to test serial output.
i2cGNSS.enableRTCMmessage(UBX_RTCM_1230, COM_PORT_UART2, 1); //Enable message every second

//Verify the ESP UART2 can communicate TX/RX to ZED UART1
SFE_UBLOX_GNSS myGNSS;

//Attempt 3 connections
for (int x = 0 ; x < 3 ; x++)
{
if (myGNSS.begin(serialGNSS) == true)
{
zedUartPassed = true;
break;
}
delay(250);
}

changeState(STATE_TESTING);
}
}
Expand Down
6 changes: 3 additions & 3 deletions Firmware/RTK_Surveyor/System.ino
Original file line number Diff line number Diff line change
Expand Up @@ -226,12 +226,12 @@ bool configureUbloxModule()
if (getSerialRate(COM_PORT_UART1) != settings.dataPortBaud)
{
Serial.println(F("Updating UART1 rate"));
i2cGNSS.setSerialRate(settings.dataPortBaud, COM_PORT_UART1); //Set UART1 to 115200
i2cGNSS.setSerialRate(settings.dataPortBaud, COM_PORT_UART1);
}
if (getSerialRate(COM_PORT_UART2) != settings.radioPortBaud)
if (getSerialRate(COM_PORT_UART2) != settings.radioPortBaud) //Defaults to 460800 to maximize message output support
{
Serial.println(F("Updating UART2 rate"));
i2cGNSS.setSerialRate(settings.radioPortBaud, COM_PORT_UART2); //Set UART2 to 57600 to match SiK telemetry radio firmware default
i2cGNSS.setSerialRate(settings.radioPortBaud, COM_PORT_UART2); //Defaults to 57600 to match SiK telemetry radio firmware default
}

if (response == false)
Expand Down
14 changes: 7 additions & 7 deletions Firmware/RTK_Surveyor/Tasks.ino
Original file line number Diff line number Diff line change
Expand Up @@ -292,13 +292,13 @@ void ButtonCheckTask(void *e)
forceSystemStateUpdate = true;
requestChangeState(STATE_SHUTDOWN);
}
// else if ((setupBtn != NULL && setupBtn->pressedFor(500)) &&
// (powerBtn != NULL && powerBtn->pressedFor(500)))
// {
// forceSystemStateUpdate = true;
// requestChangeState(STATE_TEST);
// }
else if (powerBtn != NULL && powerBtn->wasReleased())
else if (powerBtn != NULL && systemState == STATE_ROVER_NOT_STARTED && firstRoverStart == true && powerBtn->pressedFor(500))
{
forceSystemStateUpdate = true;
requestChangeState(STATE_TEST);
lastTestMenuChange = millis(); //Avoid exiting test menu for 1s
}
else if (powerBtn != NULL && powerBtn->wasReleased() && firstRoverStart == false)
{
switch (systemState)
{
Expand Down
2 changes: 1 addition & 1 deletion Firmware/RTK_Surveyor/form.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function parseIncoming(msg) {
hide("msgUBX_ESF_ALG");
hide("msgUBX_ESF_INS");
}
else if (platformPrefix == "Express") {
else if (platformPrefix == "Express" || platformPrefix == "Facet") {
hide("sensorConfig"); //Hide Sensor Config section

hide("msgUBX_ESF_MEAS"); //Hide unsupported messages
Expand Down