@@ -291,7 +291,7 @@ static void handleFirmwareFileUpload(AsyncWebServerRequest *request, String file
291291void onWsEvent (AsyncWebSocket * server, AsyncWebSocketClient * client, AwsEventType type, void * arg, uint8_t *data, size_t len)
292292{
293293 if (type == WS_EVT_CONNECT) {
294- char settingsCSV[3000 ];
294+ char settingsCSV[4000 ];
295295 memset (settingsCSV, 0 , sizeof (settingsCSV));
296296 createSettingsString (settingsCSV);
297297 log_d (" Sending command: %s\n\r " , settingsCSV);
@@ -411,22 +411,47 @@ void createSettingsString(char* settingsCSV)
411411 stringRecord (settingsCSV, " radioPortBaud" , settings.radioPortBaud );
412412 stringRecord (settingsCSV, " dataPortChannel" , settings.dataPortChannel );
413413
414- // New settings not yet integrated
414+ // LBand
415+ char hardwareID[13 ];
416+ sprintf (hardwareID, " %02X%02X%02X%02X%02X%02X" , unitMACAddress[0 ], unitMACAddress[1 ], unitMACAddress[2 ], unitMACAddress[3 ], unitMACAddress[4 ], unitMACAddress[5 ]); // Get ready for JSON
417+ stringRecord (settingsCSV, " hardwareID" , hardwareID);
418+
419+ char apDaysRemaining[50 ];
420+ if (strlen (settings.pointPerfectCurrentKey ) > 0 )
421+ {
422+ uint8_t daysRemaining = daysFromEpoch (settings.pointPerfectNextKeyStart + settings.pointPerfectNextKeyDuration + 1 );
423+ sprintf (apDaysRemaining, " %d" , daysRemaining);
424+ }
425+ else
426+ sprintf (apDaysRemaining, " No Keys" );
427+
428+ stringRecord (settingsCSV, " daysRemaining" , apDaysRemaining);
429+
430+ stringRecord (settingsCSV, " pointPerfectDeviceProfileToken" , settings.pointPerfectDeviceProfileToken );
431+ stringRecord (settingsCSV, " enablePointPerfectCorrections" , settings.enablePointPerfectCorrections );
432+ stringRecord (settingsCSV, " home_wifiSSID" , settings.home_wifiSSID );
433+ stringRecord (settingsCSV, " home_wifiPW" , settings.home_wifiPW );
434+ stringRecord (settingsCSV, " autoKeyRenewal" , settings.autoKeyRenewal );
435+
436+ // External PPS/Triggers
415437 stringRecord (settingsCSV, " enableExternalPulse" , settings.enableExternalPulse );
416438 stringRecord (settingsCSV, " externalPulseTimeBetweenPulse_us" , settings.externalPulseTimeBetweenPulse_us );
417439 stringRecord (settingsCSV, " externalPulseLength_us" , settings.externalPulseLength_us );
418440 stringRecord (settingsCSV, " externalPulsePolarity" , settings.externalPulsePolarity );
419441 stringRecord (settingsCSV, " enableExternalHardwareEventLogging" , settings.enableExternalHardwareEventLogging );
420- stringRecord (settingsCSV, " profileName " , settings. profileName );
421- stringRecord (settingsCSV, " serialTimeoutGNSS " , settings. serialTimeoutGNSS );
422- stringRecord (settingsCSV, " pointPerfectDeviceProfileToken " , settings. pointPerfectDeviceProfileToken ) ;
423- stringRecord (settingsCSV , " enableLBandCorrections " , settings.enableLBandCorrections );
424- stringRecord (settingsCSV, " enableIPCorrections " , settings. enableIPCorrections );
425- stringRecord (settingsCSV, " home_wifiSSID " , settings. home_wifiSSID );
426- stringRecord (settingsCSV, " home_wifiPW " , settings. home_wifiPW );
427- stringRecord (settingsCSV, " autoKeyRenewal " , settings. autoKeyRenewal );
442+
443+ // Profiles
444+ char apProfileName[ 50 ] ;
445+ sprintf (apProfileName , " Profile Name: %s " , settings.profileName );
446+ stringRecord (settingsCSV, " profileName " , apProfileName );
447+
448+ // New settings not yet integrated
449+ // ...
428450
429451 strcat (settingsCSV, " \0 " );
452+ if (strlen (settingsCSV) > sizeof (settingsCSV))
453+ Serial.println (" Error: settingCSV too small" );
454+
430455 Serial.printf (" settingsCSV len: %d\n\r " , strlen (settingsCSV));
431456 Serial.printf (" settingsCSV: %s\n\r " , settingsCSV);
432457#endif
@@ -545,10 +570,8 @@ void updateSettingWithValue(const char *settingName, const char* settingValueStr
545570 settings.serialTimeoutGNSS = settingValue;
546571 else if (strcmp (settingName, " pointPerfectDeviceProfileToken" ) == 0 )
547572 strcpy (settings.pointPerfectDeviceProfileToken , settingValueStr);
548- else if (strcmp (settingName, " enableLBandCorrections" ) == 0 )
549- settings.enableLBandCorrections = settingValue;
550- else if (strcmp (settingName, " enableIPCorrections" ) == 0 )
551- settings.enableIPCorrections = settingValue;
573+ else if (strcmp (settingName, " enablePointPerfectCorrections" ) == 0 )
574+ settings.enablePointPerfectCorrections = settingValue;
552575 else if (strcmp (settingName, " home_wifiSSID" ) == 0 )
553576 strcpy (settings.home_wifiSSID , settingValueStr);
554577 else if (strcmp (settingName, " home_wifiPW" ) == 0 )
@@ -680,6 +703,14 @@ void stringRecord(char* settingsCSV, const char *id, char* settingValue)
680703 strcat (settingsCSV, record);
681704}
682705
706+ // Add record with uint64_t
707+ void stringRecord (char * settingsCSV, const char *id, uint64_t settingValue)
708+ {
709+ char record[100 ];
710+ sprintf (record, " %s,%ld," , id, settingValue);
711+ strcat (settingsCSV, record);
712+ }
713+
683714// Break CSV into setting constituents
684715// Can't use strtok because we may have two commas next to each other, ie measurementRateHz,4.00,measurementRateSec,,dynamicModel,0,
685716bool parseIncomingSettings ()
0 commit comments