Skip to content

Commit

Permalink
Merge pull request #162 from sparkfun/release_candidate
Browse files Browse the repository at this point in the history
v2.2 Merge
  • Loading branch information
nseidle authored Jun 8, 2022
2 parents 3790450 + 165e2f4 commit c7d4219
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 15 deletions.
Binary file added Binaries/RTK_Surveyor_Firmware_v2_2.bin
Binary file not shown.
10 changes: 5 additions & 5 deletions Firmware/RTK_Surveyor/Form.ino
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ static void handleFirmwareFileUpload(AsyncWebServerRequest *request, String file
void onWsEvent(AsyncWebSocket * server, AsyncWebSocketClient * client, AwsEventType type, void * arg, uint8_t *data, size_t len)
{
if (type == WS_EVT_CONNECT) {
char settingsCSV[4000];
char settingsCSV[AP_CONFIG_SETTING_SIZE];
memset(settingsCSV, 0, sizeof(settingsCSV));
createSettingsString(settingsCSV);
log_d("Sending command: %s\n\r", settingsCSV);
Expand Down Expand Up @@ -411,12 +411,12 @@ void createSettingsString(char* settingsCSV)
stringRecord(settingsCSV, "radioPortBaud", settings.radioPortBaud);
stringRecord(settingsCSV, "dataPortChannel", settings.dataPortChannel);

//LBand
//L-Band
char hardwareID[13];
sprintf(hardwareID, "%02X%02X%02X%02X%02X%02X", unitMACAddress[0], unitMACAddress[1], unitMACAddress[2], unitMACAddress[3], unitMACAddress[4], unitMACAddress[5]); //Get ready for JSON
stringRecord(settingsCSV, "hardwareID", hardwareID);

char apDaysRemaining[50];
char apDaysRemaining[20];
if (strlen(settings.pointPerfectCurrentKey) > 0)
{
uint8_t daysRemaining = daysFromEpoch(settings.pointPerfectNextKeyStart + settings.pointPerfectNextKeyDuration + 1);
Expand Down Expand Up @@ -568,13 +568,13 @@ void updateSettingWithValue(const char *settingName, const char* settingValueStr
else if (strcmp(settingName, "pointPerfectDeviceProfileToken") == 0)
strcpy(settings.pointPerfectDeviceProfileToken, settingValueStr);
else if (strcmp(settingName, "enablePointPerfectCorrections") == 0)
settings.enablePointPerfectCorrections = settingValue;
settings.enablePointPerfectCorrections = settingValueBool;
else if (strcmp(settingName, "home_wifiSSID") == 0)
strcpy(settings.home_wifiSSID, settingValueStr);
else if (strcmp(settingName, "home_wifiPW") == 0)
strcpy(settings.home_wifiPW, settingValueStr);
else if (strcmp(settingName, "autoKeyRenewal") == 0)
settings.autoKeyRenewal = settingValue;
settings.autoKeyRenewal = settingValueBool;

//Unused variables - read to avoid errors
else if (strcmp(settingName, "measurementRateSec") == 0) {}
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 @@ -23,7 +23,7 @@
*/

const int FIRMWARE_VERSION_MAJOR = 2;
const int FIRMWARE_VERSION_MINOR = 1;
const int FIRMWARE_VERSION_MINOR = 2;

#define COMPILE_WIFI //Comment out to remove WiFi functionality
#define COMPILE_BT //Comment out to remove Bluetooth functionality
Expand Down Expand Up @@ -318,7 +318,8 @@ AsyncWebSocket ws("/ws");

//Because the incoming string is longer than max len, there are multiple callbacks so we
//use a global to combine the incoming
char incomingSettings[3000];
#define AP_CONFIG_SETTING_SIZE 3500
char incomingSettings[AP_CONFIG_SETTING_SIZE];
int incomingSettingsSpot = 0;
unsigned long timeSinceLastIncomingSetting = 0;
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Expand Down Expand Up @@ -686,9 +687,9 @@ void updateRTC()
{
//Set the internal system time
//This is normally set with WiFi NTP but we will rarely have WiFi
//rtc.setTime(gnssSecond, gnssMinute, gnssHour, gnssDay, gnssMonth, gnssYear); // 17th Jan 2021 15:24:30
//rtc.setTime(gnssSecond, gnssMinute, gnssHour, gnssDay, gnssMonth, gnssYear);
i2cGNSS.checkUblox();
rtc.setTime(i2cGNSS.getSecond(), i2cGNSS.getMinute(), i2cGNSS.getHour(), i2cGNSS.getDay(), i2cGNSS.getMonth(), i2cGNSS.getYear()); // 17th Jan 2021 15:24:30
rtc.setTime(i2cGNSS.getSecond(), i2cGNSS.getMinute(), i2cGNSS.getHour(), i2cGNSS.getDay(), i2cGNSS.getMonth(), i2cGNSS.getYear());

online.rtc = true;

Expand Down
4 changes: 2 additions & 2 deletions Firmware/RTK_Surveyor/States.ino
Original file line number Diff line number Diff line change
Expand Up @@ -1121,8 +1121,8 @@ void updateSystemState()
changeState(settings.lastState); //Go to either rover or base
}

//If there is no WiFi setup, skip everything
else if (strlen(settings.home_wifiSSID) == 0)
//If there is no WiFi setup, and no keys, skip everything
else if (strlen(settings.home_wifiSSID) == 0 && strlen(settings.pointPerfectCurrentKey) == 0)
{
changeState(settings.lastState); //Go to either rover or base
}
Expand Down
6 changes: 5 additions & 1 deletion Firmware/RTK_Surveyor/System.ino
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,11 @@ bool configureUbloxModule()
i2cGNSS.checkUblox(); //Regularly poll to get latest data and any RTCM
i2cGNSS.checkCallbacks(); //Process any callbacks: ie, eventTriggerReceived
delay(10);
if (millis() - startTime > maxWait) break;
if (millis() - startTime > maxWait)
{
log_d("PVT Update failed");
break;
}
}

//The first thing we do is go to 1Hz to lighten any I2C traffic from a previous configuration
Expand Down
10 changes: 7 additions & 3 deletions Firmware/RTK_Surveyor/menuPP.ino
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ bool updatePointPerfectKeys()
log_d("Connecting to MQTT broker: %s", settings.pointPerfectBrokerHost);

// Loop until we're reconnected
int maxTries = 3;
int maxTries = 2;
int tries = 0;
while (mqttClient.connected() == false)
{
Expand All @@ -424,8 +424,8 @@ bool updatePointPerfectKeys()
return (false);
}

log_d("failed, status code: %d try again in 5 seconds", mqttClient.state());
delay(5000);
log_d("failed, status code: %d try again in 1 second", mqttClient.state());
delay(1000);
}
}

Expand Down Expand Up @@ -876,4 +876,8 @@ void checkRXMCOR(UBX_RXM_COR_data_t *ubxDataStruct)
lbandCorrectionsReceived = true;
lastLBandDecryption = millis();
}
else
{
log_d("PMP decryption failed");
}
}

0 comments on commit c7d4219

Please sign in to comment.