Skip to content

Commit f7d2265

Browse files
committed
Pass bootProfileNumber and profile names to WiFi Config form
1 parent 6d10b25 commit f7d2265

File tree

4 files changed

+38
-2
lines changed

4 files changed

+38
-2
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,14 @@ function parseIncoming(msg) {
8484
|| id.includes("zedFirmwareVersion")
8585
|| id.includes("hardwareID")
8686
|| id.includes("daysRemaining")
87+
|| id.includes("profile0Name")
88+
|| id.includes("profile1Name")
89+
|| id.includes("profile2Name")
90+
|| id.includes("profile3Name")
91+
|| id.includes("profile4Name")
92+
|| id.includes("profile5Name")
93+
|| id.includes("profile6Name")
94+
|| id.includes("profile7Name")
8795
) {
8896
ge(id).innerHTML = val;
8997
}

Firmware/RTK_Surveyor/Form.ino

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
//Once connected to the access point for WiFi Config, the ESP32 sends current setting values in one long string to websocket
22
//After user clicks 'save', data is validated via main.js and a long string of values is returned.
33

4+
static uint8_t bootProfileNumber;
5+
46
//Start webserver in AP mode
57
void startWebServer()
68
{
@@ -280,6 +282,9 @@ void onWsEvent(AsyncWebSocket * server, AsyncWebSocketClient * client, AwsEventT
280282
void createSettingsString(char* settingsCSV)
281283
{
282284
#ifdef COMPILE_AP
285+
char tagText[32];
286+
char nameText[64];
287+
283288
//System Info
284289
stringRecord(settingsCSV, "platformPrefix", platformPrefix);
285290

@@ -407,6 +412,15 @@ void createSettingsString(char* settingsCSV)
407412
//Profiles
408413
stringRecord(settingsCSV, "profileNumber", profileNumber + 1);
409414
stringRecord(settingsCSV, "profileName", profileNames[profileNumber]);
415+
for (int index = 0; index < MAX_PROFILE_COUNT; index++)
416+
{
417+
sprintf(tagText, "profile%dName", index);
418+
sprintf(nameText, "%d: %s", index + 1, profileNames[index]);
419+
stringRecord(settingsCSV, tagText, nameText);
420+
}
421+
bootProfileNumber = profileNumber + 1;
422+
stringRecord(settingsCSV, "bootProfileNumber", bootProfileNumber);
423+
stringRecord(settingsCSV, "activeProfiles", activeProfiles);
410424

411425
//New settings not yet integrated
412426
//...
@@ -503,7 +517,13 @@ void updateSettingWithValue(const char *settingName, const char* settingValueStr
503517
recordProfileNumber(profileNumber);
504518
}
505519
}
506-
520+
else if (strcmp(settingName, "bootProfileNumber") == 0)
521+
{
522+
if ((sscanf(settingValueStr, "%d", &bootProfileNumber) != 1)
523+
|| (bootProfileNumber < 1)
524+
|| (bootProfileNumber > (MAX_PROFILE_COUNT + 1)))
525+
bootProfileNumber = 1;
526+
}
507527
else if (strcmp(settingName, "enableNtripServer") == 0)
508528
settings.enableNtripServer = settingValueBool;
509529
else if (strcmp(settingName, "ntripServer_CasterHost") == 0)

Firmware/RTK_Surveyor/RTK_Surveyor.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ AsyncWebSocket ws("/ws");
305305

306306
//Because the incoming string is longer than max len, there are multiple callbacks so we
307307
//use a global to combine the incoming
308-
#define AP_CONFIG_SETTING_SIZE 3500
308+
#define AP_CONFIG_SETTING_SIZE 5000
309309
char incomingSettings[AP_CONFIG_SETTING_SIZE];
310310
int incomingSettingsSpot = 0;
311311
unsigned long timeSinceLastIncomingSetting = 0;

Firmware/RTK_Surveyor/form.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,14 @@ function parseIncoming(msg) {
107107
|| id.includes("zedFirmwareVersion")
108108
|| id.includes("hardwareID")
109109
|| id.includes("daysRemaining")
110+
|| id.includes("profile0Name")
111+
|| id.includes("profile1Name")
112+
|| id.includes("profile2Name")
113+
|| id.includes("profile3Name")
114+
|| id.includes("profile4Name")
115+
|| id.includes("profile5Name")
116+
|| id.includes("profile6Name")
117+
|| id.includes("profile7Name")
110118
) {
111119
ge(id).innerHTML = val;
112120
}

0 commit comments

Comments
 (0)