diff --git a/WiFi_Shield.ino b/WiFi_Shield.ino index a44a9d7..6ad1cbd 100644 --- a/WiFi_Shield.ino +++ b/WiFi_Shield.ino @@ -70,7 +70,7 @@ enum UpdateStatus { */ unsigned long HW_GROUP = 1; // Changes with hardware changes that require software changes -unsigned long FW_VERSION = 1807020001; // Changes with each release; must always increase +unsigned long FW_VERSION = 1808070002; // Changes with each release; must always increase unsigned long SP_VERSION = 0; // Loaded from SPIFFS; changed with each SPIFFS build; must always increase (uses timestamp as version) // FW & SPIFFS update settings @@ -105,6 +105,7 @@ bool AP_ACTIVE = false; // Variables for keeping track of the config button volatile bool btnState = 0; // Current button state +bool oldBtnState = 0; // Previous button state volatile bool btnPressed = 0; // Flag to check if the last button press has already been processed volatile unsigned long btnTimer = 0; // Start time of last button press (only while pressed) volatile unsigned long btnDur = 0; // Duration of the last button press (only while released) @@ -220,6 +221,25 @@ void blinkLEDStatusLoop(unsigned int duration) { delay(duration); } +void handleConfigButton() { + // Read the config button state to determine if it has been pressed or released + btnState = !digitalRead(PIN_CONFIG); + // Calculate the last press duration + if (btnState) { + btnTimer = millis(); + btnDur = 0; + } else { + btnDur = millis() - btnTimer; + btnTimer = 0; + // Discard presses <= 50ms + if (btnDur > 50) { + btnPressed = 1; + } else { + btnDur = 0; + } + } +} + /* WEB SERVER */ @@ -251,6 +271,7 @@ String formatPageBaseWithExtraHead(String content, String extraHead) { page += extraHead; page += ""; page += ""; + page += ""; page += content; page += ""; page += ""; @@ -392,22 +413,7 @@ void handle_update_running() { */ void ISR_config() { - // Read the config button state to determine if it has been pressed or released - btnState = !digitalRead(PIN_CONFIG); - // Calculate the last press duration - if (btnState) { - btnTimer = millis(); - btnDur = 0; - } else { - btnDur = millis() - btnTimer; - btnTimer = 0; - // Discard presses <= 50ms - if (btnDur > 50) { - btnPressed = 1; - } else { - btnDur = 0; - } - } + handleConfigButton(); } /* @@ -629,7 +635,7 @@ void setup() { pinMode(PIN_STATUS, OUTPUT); pinMode(PIN_CONFIG, INPUT_PULLUP); - attachInterrupt(digitalPinToInterrupt(PIN_CONFIG), ISR_config, CHANGE); + //attachInterrupt(digitalPinToInterrupt(PIN_CONFIG), ISR_config, CHANGE); #ifdef ARDUINO_OTA_ENABLED ArduinoOTA.setHostname("WiFi-Shield"); @@ -683,6 +689,7 @@ void setup() { server.on("/update-running", handle_update_running); server.serveStatic("/main.css", SPIFFS, "/main.css"); server.serveStatic("/favicon.ico", SPIFFS, "/favicon.ico"); + server.serveStatic("/xatlabs_logo.png", SPIFFS, "/xatlabs_logo.png"); server.begin(); #ifdef SERIAL_DEBUG @@ -714,6 +721,12 @@ void loop() { #endif server.handleClient(); + btnState = !digitalRead(PIN_CONFIG); + if (btnState != oldBtnState) { + oldBtnState = btnState; + handleConfigButton(); + } + WiFiClient newClient = IBISServer.available(); if (newClient) client = newClient; if (client) { diff --git a/data/config.json b/data/config.json index 05955c8..5103eea 100644 --- a/data/config.json +++ b/data/config.json @@ -1 +1 @@ -{"SPVersion": 1802082058} \ No newline at end of file +{"SPVersion": 1808072004} \ No newline at end of file diff --git a/data/main.css b/data/main.css index 998bdfa..efc04c9 100644 --- a/data/main.css +++ b/data/main.css @@ -5,4 +5,8 @@ body { form { margin: 0; +} + +#logo { + display: block; } \ No newline at end of file diff --git a/data/xatlabs_logo.png b/data/xatlabs_logo.png new file mode 100644 index 0000000..b754a65 Binary files /dev/null and b/data/xatlabs_logo.png differ diff --git a/firmware.bin b/firmware.bin index 808d810..c51e814 100644 Binary files a/firmware.bin and b/firmware.bin differ diff --git a/firmware.version b/firmware.version index 3ee003a..0f2adb4 100644 --- a/firmware.version +++ b/firmware.version @@ -1 +1 @@ -1807020001 \ No newline at end of file +1808070002 \ No newline at end of file diff --git a/spiffs.bin b/spiffs.bin index 24b16e6..6ccc076 100644 Binary files a/spiffs.bin and b/spiffs.bin differ diff --git a/spiffs.version b/spiffs.version index bd0876a..6427eb6 100644 --- a/spiffs.version +++ b/spiffs.version @@ -1 +1 @@ -1802082058 \ No newline at end of file +1808072004 \ No newline at end of file