Downloaded filename and AP ssid

ap ssid format have serial number
filname have last 4 digit serial number
This commit is contained in:
samuelbles07
2024-12-07 23:51:54 +07:00
parent 6cb06986c3
commit 430e908d88
2 changed files with 7 additions and 2 deletions

View File

@ -81,7 +81,9 @@ void LocalServer::_GET_dashboard(void) {
void LocalServer::_GET_storage(void) {
char *data = measure.getLocalStorage();
if (data != nullptr) {
server.sendHeader("Content-Disposition", "attachment; filename=\"measurements.csv\"");
String filename =
"measurements-" + ag->deviceId().substring(8) + ".csv"; // measurements-fdsa.csv
server.sendHeader("Content-Disposition", "attachment; filename=\"" + filename + "\"");
server.send(200, "text/plain", data);
free(data);
} else {

View File

@ -187,13 +187,16 @@ void setup() {
delay(DISPLAY_DELAY_SHOW_CONTENT_MS);
}
String deviceId = ag->deviceId();
// Connect to Wi-Fi network with SSID and password
Serial.print("Setting AP (Access Point)…");
// Remove the password parameter, if you want the AP (Access Point) to be open
WiFi.softAP("airgradient", "cleanair");
WiFi.softAP("ag_" + deviceId, "cleanair");
IPAddress IP = WiFi.softAPIP();
Serial.print("AP IP address: ");
Serial.println(IP);
Serial.printf("SSID: ag_%s\n", deviceId.c_str());
oledDisplay.setText("", "Offline Storage Mode", "");