Skip to content

Commit 2fdc560

Browse files
authored
Merge pull request #720 from sparkfun/pcUpdates
pcUpdates -> release_candidate
2 parents 9190074 + 8579dc9 commit 2fdc560

File tree

8 files changed

+172
-17
lines changed

8 files changed

+172
-17
lines changed

Firmware/RTK_Everywhere/Begin.ino

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1529,10 +1529,6 @@ void beginSystemState()
15291529

15301530
// Return to either Base or Rover Not Started. The last state previous to power down.
15311531
systemState = settings.lastState;
1532-
1533-
// If the setting is not set, override with default
1534-
if (settings.antennaPhaseCenter_mm == 0.0)
1535-
settings.antennaPhaseCenter_mm = present.antennaPhaseCenter_mm;
15361532
}
15371533
else if (productVariant == RTK_POSTCARD)
15381534
{

Firmware/RTK_Everywhere/GNSS_UM980.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,8 @@ bool GNSS_UM980::configureOnce()
252252
response &= _um980->setPortBaudrate("COM2", 115200); // COM2 is connected to the IMU
253253
response &= _um980->setPortBaudrate("COM3", 115200); // COM3 is connected to the switch, then ESP32
254254

255-
// For now, let's not change the baud rate of the interface. We'll be using the default 115200 for now.
256-
response &= setBaudRateCOM3(settings.dataPortBaud); // COM3 is connected to ESP UART2
255+
// // For now, let's not change the baud rate of the interface. We'll be using the default 115200 for now.
256+
// response &= setBaudRateCOM3(settings.dataPortBaud); // COM3 is connected to ESP UART2
257257

258258
// Enable PPS signal with a width of 200ms, and a period of 1 second
259259
response &= _um980->enablePPS(200000, 1000); // widthMicroseconds, periodMilliseconds

Firmware/RTK_Everywhere/System.ino

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,9 @@ void settingsToDefaults()
391391
{
392392
static const Settings defaultSettings;
393393
settings = defaultSettings;
394+
395+
checkArrayDefaults(); // This does not call recordSystemSettings
396+
checkGNSSArrayDefaults(); // This calls recordSystemSettings if any GNSS defaults are applied
394397
}
395398

396399
// Periodically print information if enabled

Firmware/RTK_Everywhere/WebServer.ino

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ static int last_ws_fd;
6363

6464
static TaskHandle_t updateWebServerTaskHandle;
6565
static const uint8_t updateWebServerTaskPriority = 0; // 3 being the highest, and 0 being the lowest
66-
static const int webServerTaskStackSize = 1024 * 4;
67-
static const int webSocketStackSize = 1024 * 20; // Needs to be large enough to hold the file manager file list
66+
static const int webServerTaskStackSize = 1024 * 4; // Needs to be large enough to hold the file manager file list
67+
static const int webSocketStackSize = 1024 * 20; // Needs to be large enough to hold the full settingsCSV
6868

6969
// Inspired by:
7070
// https://github.com/espressif/arduino-esp32/blob/master/libraries/WebServer/examples/MultiHomedServers/MultiHomedServers.ino
@@ -1375,6 +1375,34 @@ static const httpd_uri_t ws = {.uri = "/ws",
13751375
//----------------------------------------
13761376
void httpdDisplayConfig(struct httpd_config *config)
13771377
{
1378+
/*
1379+
httpd_config object:
1380+
5: task_priority
1381+
20480: stack_size
1382+
2147483647: core_id
1383+
81: server_port
1384+
32768: ctrl_port
1385+
7: max_open_sockets
1386+
8: max_uri_handlers
1387+
8: max_resp_headers
1388+
5: backlog_conn
1389+
false: lru_purge_enable
1390+
5: recv_wait_timeout
1391+
5: send_wait_timeout
1392+
0x0: global_user_ctx
1393+
0x0: global_user_ctx_free_fn
1394+
0x0: global_transport_ctx
1395+
0x0: global_transport_ctx_free_fn
1396+
false: enable_so_linger
1397+
0: linger_timeout
1398+
false: keep_alive_enable
1399+
0: keep_alive_idle
1400+
0: keep_alive_interval
1401+
0: keep_alive_count
1402+
0x0: open_fn
1403+
0x0: close_fn
1404+
0x0: uri_match_fn
1405+
*/
13781406
systemPrintf("httpd_config object:\r\n");
13791407
systemPrintf("%10d: task_priority\r\n", config->task_priority);
13801408
systemPrintf("%10d: stack_size\r\n", config->stack_size);
@@ -1416,7 +1444,7 @@ bool websocketServerStart(void)
14161444
// Use different ports for websocket and webServer - use port 81 for the websocket - also defined in main.js
14171445
config.server_port = 81;
14181446

1419-
// Increase the stack size from 4K to handle page processing
1447+
// Increase the stack size from 4K to handle page processing (settingsCSV)
14201448
config.stack_size = webSocketStackSize;
14211449

14221450
// Start the httpd server

Firmware/RTK_Everywhere/menuCommands.ino

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2016,9 +2016,6 @@ void createSettingsString(char *newSettings)
20162016
}
20172017
stringRecord(newSettings, "lastState", lastState);
20182018

2019-
stringRecord(
2020-
newSettings, "profileName",
2021-
profileNames[profileNumber]); // Must come before profile number so AP config page JS has name before number
20222019
stringRecord(newSettings, "profileNumber", profileNumber);
20232020
for (int index = 0; index < MAX_PROFILE_COUNT; index++)
20242021
{

Firmware/RTK_Everywhere/menuMessages.ino

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,13 @@ void checkGNSSArrayDefaults()
655655
#ifdef COMPILE_UM980
656656
else if (present.gnss_um980)
657657
{
658+
if (settings.dataPortBaud != 115200)
659+
{
660+
// Belt and suspenders... Let's make really sure COM3 only ever runs at 115200
661+
defaultsApplied = true;
662+
settings.dataPortBaud = 115200;
663+
}
664+
658665
if (settings.dynamicModel == 254)
659666
{
660667
defaultsApplied = true;
@@ -829,19 +836,25 @@ void checkGNSSArrayDefaults()
829836
}
830837
#endif // COMPILE_LG290P
831838

839+
// If defaults have been applied, override antennaPhaseCenter_mm with default
840+
// (This was in beginSystemState - for the Torch / UM980 only. Weird...)
841+
if (defaultsApplied)
842+
{
843+
settings.antennaPhaseCenter_mm = present.antennaPhaseCenter_mm;
844+
}
832845

833846
// If defaults were applied, also default the non-array settings for this particular GNSS receiver
834847
if (defaultsApplied == true)
835848
{
836849
if (present.gnss_um980)
837850
{
838-
settings.minCNO = 10; // Default 10 degrees
851+
settings.minCNO = 10; // Default 10 dBHz
839852
settings.surveyInStartingAccuracy = 2.0; // Default 2m
840853
settings.measurementRateMs = 500; // Default 2Hz.
841854
}
842855
else if (present.gnss_zedf9p)
843856
{
844-
settings.minCNO = 6; // Default 6 degrees
857+
settings.minCNO = 6; // Default 6 dBHz
845858
settings.surveyInStartingAccuracy = 1.0; // Default 1m
846859
settings.measurementRateMs = 250; // Default 4Hz.
847860
}

Firmware/RTK_Everywhere/settings.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -926,7 +926,7 @@ struct Settings
926926
// Rover operation
927927
uint8_t dynamicModel = 254; // Default will be applied by checkGNSSArrayDefaults
928928
bool enablePrintRoverAccuracy = true;
929-
int16_t minCNO = 6; // Minimum satellite signal level for navigation. ZED-F9P default is 6 dBHz
929+
int16_t minCNO = 6; // Minimum satellite signal level for navigation. ZED-F9P default is 6 dBHz
930930
uint8_t minElev = 10; // Minimum elevation (in deg) for a GNSS satellite to be used in NAV
931931

932932
// RTC (Real Time Clock)
@@ -1593,7 +1593,7 @@ const RTK_Settings_Entry rtkSettingsEntries[] =
15931593
// Rover operation
15941594
{ 1, 1, 0, 1, 1, 1, 1, 1, 0, ALL, _uint8_t, 0, & settings.dynamicModel, "dynamicModel", },
15951595
{ 0, 0, 0, 1, 1, 1, 1, 1, 1, ALL, _bool, 0, & settings.enablePrintRoverAccuracy, "enablePrintRoverAccuracy", },
1596-
{ 1, 1, 0, 1, 1, 1, 1, 1, 1, ALL, _int16_t, 0, & settings.minCNO, "minCNO", },
1596+
{ 0, 1, 0, 1, 1, 1, 1, 1, 1, ALL, _int16_t, 0, & settings.minCNO, "minCNO", }, // Not inWebConfig - createSettingsString gets from GNSS
15971597
{ 1, 1, 0, 1, 1, 1, 1, 1, 1, ALL, _uint8_t, 0, & settings.minElev, "minElev", },
15981598

15991599
// RTC (Real Time Clock)
@@ -1649,7 +1649,7 @@ const RTK_Settings_Entry rtkSettingsEntries[] =
16491649
// State
16501650
{ 0, 0, 0, 1, 1, 1, 1, 1, 1, ALL, _bool, 0, & settings.enablePrintDuplicateStates, "enablePrintDuplicateStates", },
16511651
{ 0, 0, 0, 1, 1, 1, 1, 1, 1, ALL, _bool, 0, & settings.enablePrintStates, "enablePrintStates", },
1652-
{ 1, 1, 0, 1, 1, 1, 1, 1, 1, ALL, tSysState, 0, & settings.lastState, "lastState", },
1652+
{ 0, 1, 0, 1, 1, 1, 1, 1, 1, ALL, tSysState, 0, & settings.lastState, "lastState", }, // Not inWebConfig - must be changed to 0:3 by createSettingsString
16531653

16541654
// TCP Client
16551655
{ 0, 0, 0, 1, 1, 1, 1, 1, 1, ALL, _bool, 0, & settings.debugTcpClient, "debugTcpClient", },

Firmware/Tools/Settings_Diff.py

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
# Performs a 'diff' on two RTK (Everywhere) Firmware settings CSV files
2+
#
3+
# E.g. the settings CSVs passed between the firmware and the web config javascript
4+
# The order of the settings going in one direction is very different to the other direction,
5+
# making it tricky to compare them directly
6+
# This code performs an exhaustive diff: looking for differences between the two;
7+
# any duplicates; and finding any settings present in one but not the other
8+
9+
import sys
10+
import os
11+
12+
class RTK_Settings_Diff():
13+
14+
def __init__(self, File1:str = None, File2:str = None):
15+
self.filename1 = File1
16+
self.filename2 = File2
17+
18+
def setFilename1(self, File:str):
19+
self.filename1 = File
20+
21+
def setFilename2(self, File:str):
22+
self.filename2 = File
23+
24+
def readByte(self, fi):
25+
fileBytes = fi.read(1)
26+
if (len(fileBytes) == 0):
27+
return None
28+
#print(chr(fileBytes[0]))
29+
return chr(fileBytes[0])
30+
31+
def readFile(self, filename):
32+
print('Processing',filename)
33+
print()
34+
filesize = os.path.getsize(filename) # Record the file size
35+
36+
# Try to open file for reading
37+
try:
38+
fi = open(filename,"rb")
39+
except:
40+
raise Exception('Invalid file!')
41+
42+
# Read the file
43+
firstThing = ''
44+
secondThing = ''
45+
isFirstThing = True
46+
things = {}
47+
48+
while filesize > 0:
49+
c = self.readByte(fi)
50+
if c == None:
51+
fi.close()
52+
return things
53+
elif c == ',':
54+
isFirstThing = not isFirstThing
55+
if isFirstThing:
56+
if firstThing in things.keys(): # Seen it before?
57+
print('Duplicate setting: {},{} : {}'.format(firstThing, things[firstThing], secondThing))
58+
things[firstThing] = secondThing
59+
firstThing = ''
60+
secondThing = ''
61+
#print(firstThing, secondThing)
62+
elif c == '\r':
63+
pass
64+
elif c == '\n':
65+
pass
66+
else:
67+
if isFirstThing:
68+
firstThing = firstThing + str(c)
69+
else:
70+
secondThing = secondThing + str(c)
71+
filesize = filesize - 1
72+
73+
fi.close()
74+
return things
75+
76+
def diff(self):
77+
78+
print()
79+
80+
things1 = self.readFile(self.filename1)
81+
#print(things1)
82+
83+
print()
84+
85+
things2 = self.readFile(self.filename2)
86+
#print(things2)
87+
88+
print()
89+
90+
for thing1 in things1.keys():
91+
if thing1 not in things2.keys():
92+
print('Only found in file 1 : {},{}'.format(thing1,things1[thing1]))
93+
94+
print()
95+
96+
for thing2 in things2.keys():
97+
if thing2 not in things1.keys():
98+
print('Only found in file 2 : {},{}'.format(thing2,things2[thing2]))
99+
100+
print()
101+
102+
for thing1 in things1.keys():
103+
if thing1 in things2.keys():
104+
if things1[thing1] != things2[thing1]:
105+
print('Diff: {},{} : {}'.format(thing1,things1[thing1],things2[thing1]))
106+
107+
if __name__ == '__main__':
108+
109+
import argparse
110+
111+
parser = argparse.ArgumentParser(description='SparkFun RTK Firmware Settings CSV Diff')
112+
parser.add_argument('File1', metavar='File1', type=str, help='The path to the first settings CSV file')
113+
parser.add_argument('File2', metavar='File2', type=str, help='The path to the second settings CSV file')
114+
args = parser.parse_args()
115+
116+
diff = RTK_Settings_Diff(args.File1, args.File2)
117+
118+
diff.diff()

0 commit comments

Comments
 (0)