Skip to content

Commit 054de4c

Browse files
committed
Allow carve out of Access Point for firmware size reduction
1 parent 639b8b9 commit 054de4c

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

Firmware/RTK_Surveyor/Form.ino

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ void startConfigAP()
88
stopUART2Tasks(); //Delete F9 serial tasks if running
99

1010
#ifdef COMPILE_WIFI
11+
#ifdef COMPILE_AP
1112

1213
wifi_init_config_t wifi_init_config = WIFI_INIT_CONFIG_DEFAULT();
1314
esp_wifi_init(&wifi_init_config); //Restart WiFi resources
@@ -175,13 +176,15 @@ void startConfigAP()
175176
}, handleFirmwareFileUpload);
176177

177178
server.begin();
179+
#endif
178180
#endif
179181

180182
radioState = WIFI_ON_NOCONNECTION;
181183
}
182184

183185
//Handler for firmware file upload
184186
#ifdef COMPILE_WIFI
187+
#ifdef COMPILT_AP
185188
static void handleFirmwareFileUpload(AsyncWebServerRequest *request, String fileName, size_t index, uint8_t *data, size_t len, bool final)
186189
{
187190
if (!index)
@@ -266,9 +269,11 @@ static void handleFirmwareFileUpload(AsyncWebServerRequest *request, String file
266269
}
267270
}
268271
#endif
272+
#endif
269273

270274
//Events triggered by web sockets
271275
#ifdef COMPILE_WIFI
276+
#ifdef COMPILE_AP
272277
void onWsEvent(AsyncWebSocket * server, AsyncWebSocketClient * client, AwsEventType type, void * arg, uint8_t *data, size_t len)
273278
{
274279
if (type == WS_EVT_CONNECT) {
@@ -291,10 +296,12 @@ void onWsEvent(AsyncWebSocket * server, AsyncWebSocketClient * client, AwsEventT
291296
}
292297
}
293298
#endif
299+
#endif
294300

295301
//Create a csv string with current settings
296302
void createSettingsString(char* settingsCSV)
297303
{
304+
#ifdef COMPILE_AP
298305
//System Info
299306
stringRecord(settingsCSV, "platformPrefix", platformPrefix);
300307

@@ -408,11 +415,13 @@ void createSettingsString(char* settingsCSV)
408415
strcat(settingsCSV, "\0");
409416
Serial.printf("settingsCSV len: %d\n\r", strlen(settingsCSV));
410417
Serial.printf("settingsCSV: %s\n\r", settingsCSV);
418+
#endif
411419
}
412420

413421
//Given a settingName, and string value, update a given setting
414422
void updateSettingWithValue(const char *settingName, const char* settingValueStr)
415423
{
424+
#ifdef COMPILE_AP
416425
char* ptr;
417426
double settingValue = strtod(settingValueStr, &ptr);
418427

@@ -602,6 +611,7 @@ void updateSettingWithValue(const char *settingName, const char* settingValueStr
602611
Serial.printf("Unknown '%s': %0.3lf\n\r", settingName, settingValue);
603612
}
604613
} //End last strcpy catch
614+
#endif
605615
}
606616

607617
//Add record with int

Firmware/RTK_Surveyor/RTK_Surveyor.ino

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,9 @@
4949
const int FIRMWARE_VERSION_MAJOR = 1;
5050
const int FIRMWARE_VERSION_MINOR = 13;
5151

52-
//#define COMPILE_WIFI //Comment out to remove all WiFi functionality
53-
//#define COMPILE_BT //Comment out to disable all Bluetooth
52+
#define COMPILE_WIFI //Comment out to remove all WiFi functionality
53+
#define COMPILE_BT //Comment out to disable all Bluetooth
54+
//#define COMPILE_AP //Comment out to disable Access Point functionality
5455
#define ENABLE_DEVELOPER //Uncomment this line to enable special developer modes (don't check power button at startup)
5556

5657
//Define the RTK board identifier:
@@ -340,13 +341,14 @@ unsigned long lastRockerSwitchChange = 0; //If quick toggle is detected (less th
340341
//Webserver for serving config page from ESP32 as Acess Point
341342
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
342343
#ifdef COMPILE_WIFI
343-
344+
#ifdef COMPILE_AP
344345
#include "ESPAsyncWebServer.h" //Get from: https://github.com/me-no-dev/ESPAsyncWebServer
345346
#include "form.h"
346347

347348
AsyncWebServer server(80);
348349
AsyncWebSocket ws("/ws");
349350
#endif
351+
#endif
350352

351353
//Because the incoming string is longer than max len, there are multiple callbacks so we
352354
//use a global to combine the incoming

0 commit comments

Comments
 (0)