Skip to content
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
36 changes: 36 additions & 0 deletions Firmware/RTK_Surveyor/AP-Config/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,42 @@ <h2>
<p id="profileNameError" class="inlineError"></p>
</div>
</div>

<div class="form-group row mt-2">
<span id="activeProfiles" style="display:inline; margin-left:20px;"><Strong>Profiles</strong></span>
</div>
<div class="form-group row">
<span id="profile0Name" style="display:inline; margin-left:40px;">1: 12345678901234567890123456789012345678901234567890</span>
</div>
<div class="form-group row">
<span id="profile1Name" style="display:inline; margin-left:40px;">2: 12345678901234567890123456789012345678901234567890</span>
</div>
<div class="form-group row">
<span id="profile2Name" style="display:inline; margin-left:40px;">3: 12345678901234567890123456789012345678901234567890</span>
</div>
<div class="form-group row">
<span id="profile3Name" style="display:inline; margin-left:40px;">4: 12345678901234567890123456789012345678901234567890</span>
</div>
<div class="form-group row">
<span id="profile4Name" style="display:inline; margin-left:40px;">5: 12345678901234567890123456789012345678901234567890</span>
</div>
<div class="form-group row">
<span id="profile5Name" style="display:inline; margin-left:40px;">6: 12345678901234567890123456789012345678901234567890</span>
</div>
<div class="form-group row">
<span id="profile6Name" style="display:inline; margin-left:40px;">7: 12345678901234567890123456789012345678901234567890</span>
</div>
<div class="form-group row mb-3">
<span id="profile7Name" style="display:inline; margin-left:40px;">8: 12345678901234567890123456789012345678901234567890</span>
</div>

<div class="form-group row">
<label for="bootProfileName" class="box-margin20 col-sm-3 col-4 col-form-label">Boot Profile</label>
<div class="col-sm-8 col-7">
<input type="text" class="form-control" id="bootProfileNumber">
<p id="bootProfileNumberError" class="inlineError"></p>
</div>
</div>
</div>
</div>

Expand Down
25 changes: 24 additions & 1 deletion Firmware/RTK_Surveyor/AP-Config/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,14 @@ function parseIncoming(msg) {
|| id.includes("zedFirmwareVersion")
|| id.includes("hardwareID")
|| id.includes("daysRemaining")
|| id.includes("profile0Name")
|| id.includes("profile1Name")
|| id.includes("profile2Name")
|| id.includes("profile3Name")
|| id.includes("profile4Name")
|| id.includes("profile5Name")
|| id.includes("profile6Name")
|| id.includes("profile7Name")
) {
ge(id).innerHTML = val;
}
Expand Down Expand Up @@ -124,6 +132,7 @@ function parseIncoming(msg) {
//Force element updates
ge("profileNumber").dispatchEvent(new CustomEvent('change'));
ge("profileName").dispatchEvent(new CustomEvent('change'));
ge("bootProfileNumber").dispatchEvent(new CustomEvent('change'));
ge("measurementRateHz").dispatchEvent(new CustomEvent('change'));
ge("baseTypeSurveyIn").dispatchEvent(new CustomEvent('change'));
ge("baseTypeFixed").dispatchEvent(new CustomEvent('change'));
Expand Down Expand Up @@ -208,8 +217,9 @@ function validateFields() {
errorCount = 0;

//Profile Config
checkElementValue("profileNumber", 1, 4, "Must be between 1 and 4", "collapseProfileConfig");
checkElementValue("profileNumber", 1, 8, "Must be between 1 and 8", "collapseProfileConfig");
checkElementString("profileName", 1, 49, "Must be 1 to 49 characters", "collapseProfileConfig");
checkBitMapValue("bootProfileNumber", 1, 8, "activeProfiles", "Must be an active profile between 1 and 8", "collapseProfileConfig");

//GNSS Config
checkElementValue("measurementRateHz", 0.00012, 10, "Must be between 0.00012 and 10Hz", "collapseGNSSConfig");
Expand Down Expand Up @@ -459,6 +469,19 @@ function checkConstellations() {
clearError("ubxConstellations");
}

function checkBitMapValue(id, min, max, bitMap, errorText, collapseID) {
value = ge(id).value;
mask = ge(bitMap).value;
if ((value < min) || (value > max) || ((mask & (1 << value)) == 0)) {
ge(id + 'Error').innerHTML = 'Error: ' + errorText;
ge(collapseID).classList.add('show');
errorCount++;
}
else {
clearError(id);
}
}

function checkElementValue(id, min, max, errorText, collapseID) {
value = ge(id).value;
if (value < min || value > max) {
Expand Down
29 changes: 28 additions & 1 deletion Firmware/RTK_Surveyor/Form.ino
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
//Once connected to the access point for WiFi Config, the ESP32 sends current setting values in one long string to websocket
//After user clicks 'save', data is validated via main.js and a long string of values is returned.

static uint8_t bootProfileNumber;

//Start webserver in AP mode
void startWebServer()
{
Expand Down Expand Up @@ -280,6 +282,9 @@ void onWsEvent(AsyncWebSocket * server, AsyncWebSocketClient * client, AwsEventT
void createSettingsString(char* settingsCSV)
{
#ifdef COMPILE_AP
char tagText[32];
char nameText[64];

//System Info
stringRecord(settingsCSV, "platformPrefix", platformPrefix);

Expand Down Expand Up @@ -407,6 +412,15 @@ void createSettingsString(char* settingsCSV)
//Profiles
stringRecord(settingsCSV, "profileNumber", profileNumber + 1);
stringRecord(settingsCSV, "profileName", profileNames[profileNumber]);
for (int index = 0; index < MAX_PROFILE_COUNT; index++)
{
sprintf(tagText, "profile%dName", index);
sprintf(nameText, "%d: %s", index + 1, profileNames[index]);
stringRecord(settingsCSV, tagText, nameText);
}
bootProfileNumber = profileNumber + 1;
stringRecord(settingsCSV, "bootProfileNumber", bootProfileNumber);
stringRecord(settingsCSV, "activeProfiles", activeProfiles);

//New settings not yet integrated
//...
Expand Down Expand Up @@ -503,7 +517,14 @@ void updateSettingWithValue(const char *settingName, const char* settingValueStr
recordProfileNumber(profileNumber);
}
}

else if (strcmp(settingName, "bootProfileNumber") == 0)
{
if ((sscanf(settingValueStr, "%d", &bootProfileNumber) != 1)
|| (bootProfileNumber < 1)
|| (bootProfileNumber > (MAX_PROFILE_COUNT + 1)))
bootProfileNumber = 1;
Serial.printf("bootProfileNumber: %d\r\n", bootProfileNumber);
}
else if (strcmp(settingName, "enableNtripServer") == 0)
settings.enableNtripServer = settingValueBool;
else if (strcmp(settingName, "ntripServer_CasterHost") == 0)
Expand Down Expand Up @@ -579,6 +600,12 @@ void updateSettingWithValue(const char *settingName, const char* settingValueStr
{
if (newAPSettings == true) recordSystemSettings(); //If we've recieved settings, record before restart

//Determine which profile to boot
bootProfileNumber -= 1;
if (bootProfileNumber != profileNumber)
recordProfileNumber(bootProfileNumber);

//Reboot the machine
ESP.restart();
}

Expand Down
2 changes: 1 addition & 1 deletion Firmware/RTK_Surveyor/RTK_Surveyor.ino
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ 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
#define AP_CONFIG_SETTING_SIZE 3500
#define AP_CONFIG_SETTING_SIZE 5000
char incomingSettings[AP_CONFIG_SETTING_SIZE];
int incomingSettingsSpot = 0;
unsigned long timeSinceLastIncomingSetting = 0;
Expand Down
61 changes: 60 additions & 1 deletion Firmware/RTK_Surveyor/form.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,14 @@ function parseIncoming(msg) {
|| id.includes("zedFirmwareVersion")
|| id.includes("hardwareID")
|| id.includes("daysRemaining")
|| id.includes("profile0Name")
|| id.includes("profile1Name")
|| id.includes("profile2Name")
|| id.includes("profile3Name")
|| id.includes("profile4Name")
|| id.includes("profile5Name")
|| id.includes("profile6Name")
|| id.includes("profile7Name")
) {
ge(id).innerHTML = val;
}
Expand Down Expand Up @@ -147,6 +155,7 @@ function parseIncoming(msg) {
//Force element updates
ge("profileNumber").dispatchEvent(new CustomEvent('change'));
ge("profileName").dispatchEvent(new CustomEvent('change'));
ge("bootProfileNumber").dispatchEvent(new CustomEvent('change'));
ge("measurementRateHz").dispatchEvent(new CustomEvent('change'));
ge("baseTypeSurveyIn").dispatchEvent(new CustomEvent('change'));
ge("baseTypeFixed").dispatchEvent(new CustomEvent('change'));
Expand Down Expand Up @@ -231,8 +240,9 @@ function validateFields() {
errorCount = 0;

//Profile Config
checkElementValue("profileNumber", 1, 4, "Must be between 1 and 4", "collapseProfileConfig");
checkElementValue("profileNumber", 1, 8, "Must be between 1 and 8", "collapseProfileConfig");
checkElementString("profileName", 1, 49, "Must be 1 to 49 characters", "collapseProfileConfig");
checkBitMapValue("bootProfileNumber", 1, 8, "activeProfiles", "Must be an active profile between 1 and 8", "collapseProfileConfig");

//GNSS Config
checkElementValue("measurementRateHz", 0.00012, 10, "Must be between 0.00012 and 10Hz", "collapseGNSSConfig");
Expand Down Expand Up @@ -482,6 +492,19 @@ function checkConstellations() {
clearError("ubxConstellations");
}

function checkBitMapValue(id, min, max, bitMap, errorText, collapseID) {
value = ge(id).value;
mask = ge(bitMap).value;
if ((value < min) || (value > max) || ((mask & (1 << value)) == 0)) {
ge(id + 'Error').innerHTML = 'Error: ' + errorText;
ge(collapseID).classList.add('show');
errorCount++;
}
else {
clearError(id);
}
}

function checkElementValue(id, min, max, errorText, collapseID) {
value = ge(id).value;
if (value < min || value > max) {
Expand Down Expand Up @@ -896,6 +919,42 @@ static const char *index_html = R"=====(
<p id="profileNameError" class="inlineError"></p>
</div>
</div>

<div class="form-group row mt-2">
<span id="activeProfiles" style="display:inline; margin-left:20px;"><Strong>Profiles</strong></span>
</div>
<div class="form-group row">
<span id="profile0Name" style="display:inline; margin-left:40px;">1: 12345678901234567890123456789012345678901234567890</span>
</div>
<div class="form-group row">
<span id="profile1Name" style="display:inline; margin-left:40px;">2: 12345678901234567890123456789012345678901234567890</span>
</div>
<div class="form-group row">
<span id="profile2Name" style="display:inline; margin-left:40px;">3: 12345678901234567890123456789012345678901234567890</span>
</div>
<div class="form-group row">
<span id="profile3Name" style="display:inline; margin-left:40px;">4: 12345678901234567890123456789012345678901234567890</span>
</div>
<div class="form-group row">
<span id="profile4Name" style="display:inline; margin-left:40px;">5: 12345678901234567890123456789012345678901234567890</span>
</div>
<div class="form-group row">
<span id="profile5Name" style="display:inline; margin-left:40px;">6: 12345678901234567890123456789012345678901234567890</span>
</div>
<div class="form-group row">
<span id="profile6Name" style="display:inline; margin-left:40px;">7: 12345678901234567890123456789012345678901234567890</span>
</div>
<div class="form-group row mb-3">
<span id="profile7Name" style="display:inline; margin-left:40px;">8: 12345678901234567890123456789012345678901234567890</span>
</div>

<div class="form-group row">
<label for="bootProfileName" class="box-margin20 col-sm-3 col-4 col-form-label">Boot Profile</label>
<div class="col-sm-8 col-7">
<input type="text" class="form-control" id="bootProfileNumber">
<p id="bootProfileNumberError" class="inlineError"></p>
</div>
</div>
</div>
</div>

Expand Down