Skip to content

Commit bdb8820

Browse files
authored
Merge pull request #390 from sparkfun/Fix_#362
Fix #362
2 parents fba06ff + 5630c13 commit bdb8820

14 files changed

+66
-15
lines changed

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,12 @@ jobs:
6868
- name: Install platform
6969
run: arduino-cli core install esp32:esp32@${{ env.CORE_VERSION }}
7070

71+
- name: Get IDF version
72+
run: |
73+
cd /home/runner/.arduino15/packages/esp32/tools/esp32-arduino-libs
74+
IDF_VERSION=$(ls | grep idf-release)
75+
echo "ESP_IDF=${IDF_VERSION}" >> "$GITHUB_ENV"
76+
7177
- name: Get Known Libraries
7278
run: arduino-cli lib install
7379
@@ -95,6 +101,14 @@ jobs:
95101
cd Firmware/RTK_Everywhere/Patch/
96102
cp BleSerial.cpp /home/runner/Arduino/libraries/ESP32_BleSerial/src/BleSerial.cpp
97103
104+
- name: Patch libmbedtls
105+
run: |
106+
cd Firmware/RTK_Everywhere/Patch/
107+
cp libmbedtls.a /home/runner/.arduino15/packages/esp32/tools/esp32-arduino-libs/${{ env.ESP_IDF }}/esp32/lib/libmbedtls.a
108+
cp libmbedtls_2.a /home/runner/.arduino15/packages/esp32/tools/esp32-arduino-libs/${{ env.ESP_IDF }}/esp32/lib/libmbedtls_2.a
109+
cp libmbedcrypto.a /home/runner/.arduino15/packages/esp32/tools/esp32-arduino-libs/${{ env.ESP_IDF }}/esp32/lib/libmbedcrypto.a
110+
cp libmbedx509.a /home/runner/.arduino15/packages/esp32/tools/esp32-arduino-libs/${{ env.ESP_IDF }}/esp32/lib/libmbedx509.a
111+
98112
- name: Setup Python
99113
uses: actions/setup-python@v4
100114
with:

.github/workflows/non-release-build.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,15 @@ jobs:
6868
- name: Install platform
6969
run: arduino-cli core install esp32:esp32@${{ env.CORE_VERSION }}
7070

71+
- name: Get IDF version
72+
run: |
73+
cd /home/runner/.arduino15/packages/esp32/tools/esp32-arduino-libs
74+
IDF_VERSION=$(ls | grep idf-release)
75+
echo "ESP_IDF=${IDF_VERSION}" >> "$GITHUB_ENV"
76+
7177
- name: Get Known Libraries
7278
run: arduino-cli lib install
73-
ArduinoJson@6.19.4
79+
ArduinoJson@7.0.4
7480
7581
7682
"ESP32-OTA-Pull"@1.0.0
@@ -95,6 +101,14 @@ jobs:
95101
cd Firmware/RTK_Everywhere/Patch/
96102
cp BleSerial.cpp /home/runner/Arduino/libraries/ESP32_BleSerial/src/BleSerial.cpp
97103
104+
- name: Patch libmbedtls
105+
run: |
106+
cd Firmware/RTK_Everywhere/Patch/
107+
cp libmbedtls.a /home/runner/.arduino15/packages/esp32/tools/esp32-arduino-libs/${{ env.ESP_IDF }}/esp32/lib/libmbedtls.a
108+
cp libmbedtls_2.a /home/runner/.arduino15/packages/esp32/tools/esp32-arduino-libs/${{ env.ESP_IDF }}/esp32/lib/libmbedtls_2.a
109+
cp libmbedcrypto.a /home/runner/.arduino15/packages/esp32/tools/esp32-arduino-libs/${{ env.ESP_IDF }}/esp32/lib/libmbedcrypto.a
110+
cp libmbedx509.a /home/runner/.arduino15/packages/esp32/tools/esp32-arduino-libs/${{ env.ESP_IDF }}/esp32/lib/libmbedx509.a
111+
98112
- name: Setup Python
99113
uses: actions/setup-python@v4
100114
with:

Firmware/RTK_Everywhere/Begin.ino

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -683,6 +683,7 @@ void beginGnssUart()
683683
length = settings.gnssHandlerBufferSize + (rbOffsetEntries * sizeof(RING_BUFFER_OFFSET));
684684
ringBuffer = nullptr;
685685

686+
// Never freed...
686687
if (rbOffsetArray == nullptr)
687688
{
688689
if (online.psram == true)

Firmware/RTK_Everywhere/Form.ino

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,7 @@ bool startWebServer(bool startWiFi = true, int httpPort = 80)
271271
MDNS.addService("http", "tcp", 80); // Add service to MDNS-SD
272272
}
273273

274+
// Freed by stopWebServer
274275
if (online.psram == true)
275276
incomingSettings = (char *)ps_malloc(AP_CONFIG_SETTING_SIZE);
276277
else
@@ -284,6 +285,7 @@ bool startWebServer(bool startWiFi = true, int httpPort = 80)
284285
memset(incomingSettings, 0, AP_CONFIG_SETTING_SIZE);
285286

286287
// Pre-load settings CSV
288+
// Freed by stopWebServer
287289
if (online.psram == true)
288290
settingsCSV = (char *)ps_malloc(AP_CONFIG_SETTING_SIZE);
289291
else

Firmware/RTK_Everywhere/MQTT_Client.ino

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@ const char MQTT_TOPIC_ASSISTNOW[] = "/pp/ubx/mga"; // AssistNow (MGA) topic
112112

113113
static MqttClient *mqttClient;
114114

115-
static char *mqttClientCertificateBuffer; // Buffer for client certificate
115+
static char *mqttClientCertificateBuffer = nullptr; // Buffer for client certificate
116+
static char *mqttClientPrivateKeyBuffer = nullptr; // Buffer for client private key
116117

117118
// Throttle the time between connection attempts
118119
static int mqttClientConnectionAttempts; // Count the number of connection attempts between restarts
@@ -121,8 +122,6 @@ static int mqttClientConnectionAttemptsTotal; // Count the number of connection
121122

122123
static volatile uint32_t mqttClientLastDataReceived; // Last time data was received via MQTT
123124

124-
static char *mqttClientPrivateKeyBuffer; // Buffer for client private key
125-
126125
static RTKNetworkSecureClient *mqttSecureClient;
127126

128127
static volatile uint8_t mqttClientState = MQTT_CLIENT_OFF;
@@ -564,15 +563,20 @@ void mqttClientUpdate()
564563
}
565564

566565
// Allocate the buffers
566+
// Freed by mqttClientShutdown / mqttClientStop
567567
if (online.psram == true)
568568
{
569-
mqttClientCertificateBuffer = (char *)ps_malloc(MQTT_CERT_SIZE);
570-
mqttClientPrivateKeyBuffer = (char *)ps_malloc(MQTT_CERT_SIZE);
569+
if (!mqttClientCertificateBuffer)
570+
mqttClientCertificateBuffer = (char *)ps_malloc(MQTT_CERT_SIZE);
571+
if (!mqttClientPrivateKeyBuffer)
572+
mqttClientPrivateKeyBuffer = (char *)ps_malloc(MQTT_CERT_SIZE);
571573
}
572574
else
573575
{
574-
mqttClientCertificateBuffer = (char *)malloc(MQTT_CERT_SIZE);
575-
mqttClientPrivateKeyBuffer = (char *)malloc(MQTT_CERT_SIZE);
576+
if (!mqttClientCertificateBuffer)
577+
mqttClientCertificateBuffer = (char *)malloc(MQTT_CERT_SIZE);
578+
if (!mqttClientPrivateKeyBuffer)
579+
mqttClientPrivateKeyBuffer = (char *)malloc(MQTT_CERT_SIZE);
576580
}
577581

578582
if ((!mqttClientCertificateBuffer) || (!mqttClientPrivateKeyBuffer))
4.36 MB
Binary file not shown.
108 KB
Binary file not shown.
1.29 MB
Binary file not shown.
670 KB
Binary file not shown.

Firmware/RTK_Everywhere/PointPerfectLibrary.ino

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ void beginPPL()
132132
reportHeapNow(false);
133133

134134
// PPL_MAX_RTCM_BUFFER is 3345 bytes so we create it on the heap
135+
// Freed by stopPPL()
135136
if (pplRtcmBuffer == nullptr)
136137
{
137138
if (online.psram == true)

0 commit comments

Comments
 (0)