Skip to content

Commit 0740353

Browse files
committed
Merge branch 'release_candidate' into Use_GNSS_Logging_Buffer
2 parents a85d5f1 + 216ae84 commit 0740353

File tree

7 files changed

+157
-170
lines changed

7 files changed

+157
-170
lines changed

.github/workflows/compile-rtk-firmware.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,19 +40,19 @@ jobs:
4040
ArduinoJson@6.19.4
4141
pubsubclient@2.8.0
4242
ESP32_BleSerial@1.0.4
43+
"SparkFun u-blox GNSS v3"@3.0.2
44+
"SparkFun MAX1704x Fuel Gauge Arduino Library"@1.0.4
45+
"SparkFun LIS2DH12 Arduino Library"@1.0.3
46+
"ESP32-OTA-Pull"@1.0.0
4347

4448
- name: Enable external libs
4549
run: arduino-cli config set library.enable_unsafe_install true
4650

4751
- name: Get Libraries
48-
run: arduino-cli lib install --git-url
49-
https://github.com/sparkfun/SparkFun_u-blox_GNSS_v3.git
50-
https://github.com/sparkfun/SparkFun_MAX1704x_Fuel_Gauge_Arduino_Library.git
51-
https://github.com/sparkfun/SparkFun_Qwiic_OLED_Arduino_Library.git
52-
https://github.com/sparkfun/SparkFun_LIS2DH12_Arduino_Library.git
53-
https://github.com/nseidle/ESP32-OTA-Pull.git
52+
run: arduino-cli lib install --git-url
53+
https://github.com/sparkfun/SparkFun_Qwiic_OLED_Arduino_Library.git
5454
https://github.com/me-no-dev/ESPAsyncWebServer.git
55-
https://github.com/me-no-dev/AsyncTCP.git
55+
https://github.com/me-no-dev/AsyncTCP.git
5656

5757
#Incorporate ESP-Now patch into core: https://github.com/espressif/arduino-esp32/pull/7044/files
5858
#- name: Patch ESP32 Core

Firmware/RTK_Surveyor/AP-Config/index.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1842,6 +1842,13 @@ <h2>
18421842
</div>
18431843
</div>
18441844

1845+
<div id="logFile" class="row">
1846+
<div class="mb-2">
1847+
<label for="logFile" class="form-group box-margin20">Log file name: <span id="logFileName" style="display:inline;">SFE_Log.ubx</span>
1848+
</label>
1849+
</div>
1850+
</div>
1851+
18451852
<div class="form-group row">
18461853
<div style="margin-bottom:5px;">
18471854
<button type="button" id="startNewLog" class="btn btn-primary box-margin20"

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ function parseIncoming(msg) {
128128
|| id.includes("profile7Name")
129129
|| id.includes("radioMAC")
130130
|| id.includes("deviceBTID")
131+
|| id.includes("logFileName")
131132
) {
132133
ge(id).innerHTML = val;
133134
}

Firmware/RTK_Surveyor/FileSdFatMMC.h

Lines changed: 132 additions & 150 deletions
Original file line numberDiff line numberDiff line change
@@ -14,202 +14,184 @@ class FileSdFatMMC : public SdFile
1414
#endif
1515

1616
{
17-
public:
18-
FileSdFatMMC()
19-
{
20-
if (USE_SPI_MICROSD)
21-
_sdFile = new SdFile;
22-
#ifdef COMPILE_SD_MMC
23-
else
24-
_file = new File;
25-
#endif
26-
};
17+
public:
2718

28-
~FileSdFatMMC()
29-
{
30-
if (USE_SPI_MICROSD)
31-
{
32-
;
33-
// if (_sdFile) // operator bool
34-
// delete _sdFile;
35-
}
36-
#ifdef COMPILE_SD_MMC
37-
else
19+
FileSdFatMMC()
3820
{
39-
;
40-
// if (_file) // operator bool
41-
// delete _file;
42-
}
43-
#endif
44-
};
45-
46-
operator bool()
47-
{
48-
if (USE_SPI_MICROSD)
49-
return _sdFile;
21+
if (USE_SPI_MICROSD)
22+
_sdFile = new SdFile;
5023
#ifdef COMPILE_SD_MMC
51-
else
52-
return _file;
24+
else
25+
_file = new File;
5326
#endif
54-
return false; // Keep the compiler happy
55-
};
27+
};
5628

57-
size_t println(const char printMe[])
58-
{
59-
if (USE_SPI_MICROSD)
60-
return _sdFile->println(printMe);
29+
~FileSdFatMMC()
30+
{
31+
if (USE_SPI_MICROSD)
32+
{
33+
;
34+
//if (_sdFile) // operator bool
35+
// delete _sdFile;
36+
}
6137
#ifdef COMPILE_SD_MMC
62-
else
63-
return _file->println(printMe);
38+
else
39+
{
40+
;
41+
//if (_file) // operator bool
42+
// delete _file;
43+
}
6444
#endif
65-
return 0; // Keep the compiler happy
66-
};
45+
};
6746

68-
bool open(const char *filepath, oflag_t mode)
69-
{
70-
if (USE_SPI_MICROSD)
47+
operator bool()
7148
{
72-
if (_sdFile->open(filepath, mode) == true)
73-
return true;
74-
return false;
75-
}
49+
if (USE_SPI_MICROSD)
50+
return _sdFile;
7651
#ifdef COMPILE_SD_MMC
77-
else
78-
{
79-
if (mode & O_APPEND)
80-
*_file = SD_MMC.open(filepath, FILE_APPEND);
81-
else if (mode & O_WRITE)
82-
*_file = SD_MMC.open(filepath, FILE_WRITE);
83-
else // if (mode & O_READ)
84-
*_file = SD_MMC.open(filepath, FILE_READ);
85-
if (_file) // operator bool
86-
return true;
87-
return false;
88-
}
52+
else
53+
return _file;
8954
#endif
90-
return false; // Keep the compiler happy
91-
};
55+
};
9256

93-
uint32_t size()
94-
{
95-
if (USE_SPI_MICROSD)
96-
return _sdFile->size();
57+
size_t println(const char printMe[])
58+
{
59+
if (USE_SPI_MICROSD)
60+
return _sdFile->println(printMe);
9761
#ifdef COMPILE_SD_MMC
98-
else
99-
return (uint32_t)_file->size();
62+
else
63+
return _file->println(printMe);
10064
#endif
101-
return 0; // Keep the compiler happy
102-
};
65+
};
10366

104-
uint32_t fileSize()
105-
{
106-
if (USE_SPI_MICROSD)
107-
return _sdFile->fileSize();
67+
bool open(const char *filepath, oflag_t mode)
68+
{
69+
if (USE_SPI_MICROSD)
70+
{
71+
if (_sdFile->open(filepath, mode) == true)
72+
return true;
73+
return false;
74+
}
10875
#ifdef COMPILE_SD_MMC
109-
else
110-
return (uint32_t)_file->size();
76+
else
77+
{
78+
if (mode & O_APPEND)
79+
*_file = SD_MMC.open(filepath, FILE_APPEND);
80+
else if (mode & O_WRITE)
81+
*_file = SD_MMC.open(filepath, FILE_WRITE);
82+
else // if (mode & O_READ)
83+
*_file = SD_MMC.open(filepath, FILE_READ);
84+
if (_file) // operator bool
85+
return true;
86+
return false;
87+
}
11188
#endif
112-
return 0; // Keep the compiler happy
113-
};
89+
};
11490

115-
uint32_t position()
116-
{
117-
if (USE_SPI_MICROSD)
118-
return _sdFile->position();
91+
uint32_t size()
92+
{
93+
if (USE_SPI_MICROSD)
94+
return _sdFile->size();
11995
#ifdef COMPILE_SD_MMC
120-
else
121-
return (uint32_t)_file->position();
96+
else
97+
return _file->size();
12298
#endif
123-
return 0; // Keep the compiler happy
124-
};
99+
};
125100

126-
int available()
127-
{
128-
if (USE_SPI_MICROSD)
129-
return _sdFile->available();
101+
uint32_t position()
102+
{
103+
if (USE_SPI_MICROSD)
104+
return _sdFile->position();
130105
#ifdef COMPILE_SD_MMC
131-
else
132-
return _file->available();
106+
else
107+
return _file->position();
133108
#endif
134-
return 0; // Keep the compiler happy
135-
};
109+
};
136110

137-
int read(uint8_t *buf, uint16_t nbyte)
138-
{
139-
if (USE_SPI_MICROSD)
140-
return _sdFile->read(buf, nbyte);
111+
int available()
112+
{
113+
if (USE_SPI_MICROSD)
114+
return _sdFile->available();
141115
#ifdef COMPILE_SD_MMC
142-
else
143-
return (int)_file->read(buf, nbyte);
116+
else
117+
return _file->available();
144118
#endif
145-
return 0; // Keep the compiler happy
146-
};
119+
};
147120

148-
size_t write(const uint8_t *buf, size_t size)
149-
{
150-
if (USE_SPI_MICROSD)
151-
return _sdFile->write(buf, size);
121+
int read(uint8_t *buf, uint16_t nbyte)
122+
{
123+
if (USE_SPI_MICROSD)
124+
return _sdFile->read(buf, nbyte);
152125
#ifdef COMPILE_SD_MMC
153-
else
154-
return _file->write(buf, size);
126+
else
127+
return _file->read(buf, nbyte);
155128
#endif
156-
return 0; // Keep the compiler happy
157-
};
129+
};
158130

159-
void close()
160-
{
161-
if (USE_SPI_MICROSD)
162-
_sdFile->close();
131+
size_t write(const uint8_t *buf, size_t size)
132+
{
133+
if (USE_SPI_MICROSD)
134+
return _sdFile->write(buf, size);
163135
#ifdef COMPILE_SD_MMC
164-
else
165-
_file->close();
136+
else
137+
return _file->write(buf, size);
166138
#endif
167-
};
139+
};
168140

169-
void flush()
170-
{
171-
if (USE_SPI_MICROSD)
172-
_sdFile->flush();
141+
void close()
142+
{
143+
if (USE_SPI_MICROSD)
144+
_sdFile->close();
173145
#ifdef COMPILE_SD_MMC
174-
else
175-
_file->flush();
146+
else
147+
_file->close();
176148
#endif
177-
};
149+
};
178150

179-
void updateFileAccessTimestamp()
180-
{
181-
if (USE_SPI_MICROSD)
151+
void updateFileAccessTimestamp()
182152
{
183-
if (online.rtc == true)
153+
if (USE_SPI_MICROSD)
184154
{
185-
// ESP32Time returns month:0-11
186-
_sdFile->timestamp(T_ACCESS, rtc.getYear(), rtc.getMonth() + 1, rtc.getDay(), rtc.getHour(true), rtc.getMinute(), rtc.getSecond());
187-
_sdFile->timestamp(T_WRITE, rtc.getYear(), rtc.getMonth() + 1, rtc.getDay(), rtc.getHour(true), rtc.getMinute(), rtc.getSecond());
155+
if (online.rtc == true)
156+
{
157+
//ESP32Time returns month:0-11
158+
_sdFile->timestamp(T_ACCESS, rtc.getYear(), rtc.getMonth() + 1, rtc.getDay(), rtc.getHour(true), rtc.getMinute(), rtc.getSecond());
159+
_sdFile->timestamp(T_WRITE, rtc.getYear(), rtc.getMonth() + 1, rtc.getDay(), rtc.getHour(true), rtc.getMinute(), rtc.getSecond());
160+
}
188161
}
189-
}
190-
};
162+
};
191163

192-
void updateFileCreateTimestamp()
193-
{
194-
if (USE_SPI_MICROSD)
164+
void updateFileCreateTimestamp()
195165
{
196-
if (online.rtc == true)
166+
if (USE_SPI_MICROSD)
197167
{
198-
_sdFile->timestamp(T_CREATE, rtc.getYear(), rtc.getMonth() + 1, rtc.getDay(), rtc.getHour(true), rtc.getMinute(), rtc.getSecond()); // ESP32Time returns month:0-11
168+
if (online.rtc == true)
169+
{
170+
_sdFile->timestamp(T_CREATE, rtc.getYear(), rtc.getMonth() + 1, rtc.getDay(), rtc.getHour(true), rtc.getMinute(), rtc.getSecond()); //ESP32Time returns month:0-11
171+
}
199172
}
200-
}
201-
};
173+
};
202174

203-
void sync()
204-
{
205-
if (USE_SPI_MICROSD)
206-
_sdFile->sync();
207-
};
175+
void sync()
176+
{
177+
if (USE_SPI_MICROSD)
178+
_sdFile->sync();
179+
};
180+
181+
int fileSize()
182+
{
183+
if (USE_SPI_MICROSD)
184+
return _sdFile->fileSize();
185+
#ifdef COMPILE_SD_MMC
186+
else
187+
return _file->size();
188+
#endif
189+
};
208190

209-
protected:
210-
SdFile *_sdFile;
191+
protected:
192+
SdFile * _sdFile;
211193
#ifdef COMPILE_SD_MMC
212-
File *_file;
194+
File * _file;
213195
#endif
214196
};
215197

Firmware/RTK_Surveyor/Form.ino

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1391,7 +1391,6 @@ void handleUpload(AsyncWebServerRequest * request, String filename, size_t index
13911391
return;
13921392
}
13931393
}
1394-
13951394
//Attempt to gain access to the SD card
13961395
if (xSemaphoreTake(sdCardSemaphore, fatSemaphore_longWait_ms) == pdPASS)
13971396
{

0 commit comments

Comments
 (0)