Compare commits
No commits in common. "69a8f32179c93d6f5dccac153d498e709daffcd1" and "684df16eb18ddcc8dbf49f3e123e668aa755f8e1" have entirely different histories.
69a8f32179
...
684df16eb1
@ -20,8 +20,6 @@ struct WifiConfiguration {
|
|||||||
|
|
||||||
// The interval to reconnect to WiFi if the connection is broken
|
// The interval to reconnect to WiFi if the connection is broken
|
||||||
uint32_t reconnectInterval;
|
uint32_t reconnectInterval;
|
||||||
|
|
||||||
uint32_t periodicReconnectInterval;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct KeyConfiguration {
|
struct KeyConfiguration {
|
||||||
@ -78,6 +76,4 @@ private:
|
|||||||
void prepareResponseBuffer(SesameEvent event, uint8_t deviceId = 0);
|
void prepareResponseBuffer(SesameEvent event, uint8_t deviceId = 0);
|
||||||
void sendPreparedLocalResponse(AsyncWebServerRequest *request);
|
void sendPreparedLocalResponse(AsyncWebServerRequest *request);
|
||||||
void sendPreparedServerResponse();
|
void sendPreparedServerResponse();
|
||||||
|
|
||||||
void periodicallyReconnectWifiAndSocket(uint32_t millis);
|
|
||||||
};
|
};
|
@ -49,9 +49,6 @@ constexpr const char* networkName = "Sesame-Device";
|
|||||||
// The interval to reconnect to WiFi if the connection is broken
|
// The interval to reconnect to WiFi if the connection is broken
|
||||||
constexpr uint32_t wifiReconnectInterval = 10000;
|
constexpr uint32_t wifiReconnectInterval = 10000;
|
||||||
|
|
||||||
// The interval to reconnect to WiFi if the connection is broken
|
|
||||||
constexpr uint32_t wifiPeriodicReconnectInterval = 86400;
|
|
||||||
|
|
||||||
/* Local server */
|
/* Local server */
|
||||||
|
|
||||||
// The port for the local server to directly receive messages over WiFi
|
// The port for the local server to directly receive messages over WiFi
|
||||||
|
@ -14,6 +14,6 @@ board = az-delivery-devkit-v4
|
|||||||
framework = arduino
|
framework = arduino
|
||||||
lib_deps =
|
lib_deps =
|
||||||
links2004/WebSockets@^2.3.7
|
links2004/WebSockets@^2.3.7
|
||||||
madhephaestus/ESP32Servo@^1.1.0
|
madhephaestus/ESP32Servo@^0.13.0
|
||||||
ottowinter/ESPAsyncWebServer-esphome@^3.0.0
|
ottowinter/ESPAsyncWebServer-esphome@^3.0.0
|
||||||
monitor_speed = 115200
|
monitor_speed = 115200
|
||||||
|
@ -46,7 +46,6 @@ void SesameController::loop(uint32_t millis) {
|
|||||||
server.loop();
|
server.loop();
|
||||||
servo.loop(millis);
|
servo.loop(millis);
|
||||||
|
|
||||||
periodicallyReconnectWifiAndSocket(millis);
|
|
||||||
ensureWiFiConnection(millis);
|
ensureWiFiConnection(millis);
|
||||||
ensureWebSocketConnection();
|
ensureWebSocketConnection();
|
||||||
}
|
}
|
||||||
@ -215,13 +214,3 @@ bool SesameController::convertHexMessageToBinary(const char* str) {
|
|||||||
};
|
};
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SesameController::periodicallyReconnectWifiAndSocket(uint32_t millis) {
|
|
||||||
static uint32_t nextWifiReconnect = wifiConfig.periodicReconnectInterval;
|
|
||||||
if (millis > nextWifiReconnect) {
|
|
||||||
nextWifiReconnect += wifiConfig.periodicReconnectInterval;
|
|
||||||
|
|
||||||
server.disconnect();
|
|
||||||
WiFi.disconnect();
|
|
||||||
}
|
|
||||||
}
|
|
@ -49,7 +49,6 @@ void setup() {
|
|||||||
.password = wifiPassword,
|
.password = wifiPassword,
|
||||||
.networkName = networkName,
|
.networkName = networkName,
|
||||||
.reconnectInterval = wifiReconnectInterval,
|
.reconnectInterval = wifiReconnectInterval,
|
||||||
.periodicReconnectInterval = wifiPeriodicReconnectInterval,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
KeyConfiguration keyConfig {
|
KeyConfiguration keyConfig {
|
||||||
|
Loading…
Reference in New Issue
Block a user