Release v0.4.0: complete rewrite #1

Merged
admar merged 13 commits from Plus-Claire into main 2024-09-24 21:54:12 +02:00
Showing only changes of commit c60c3ecb2d - Show all commits

View file

@ -16,7 +16,9 @@ static void tick(void) {
} }
void wifiManagerCb(WiFiManager::Status status) { void wifiManagerCb(WiFiManager::Status status) {
if (ticker.active()) {
ticker.detach(); ticker.detach();
}
if (status.mode == WiFiManager::Mode::CONNECTING) { if (status.mode == WiFiManager::Mode::CONNECTING) {
ticker.attach(TICKER_RATE_CONNECTING, tick); ticker.attach(TICKER_RATE_CONNECTING, tick);
@ -31,11 +33,9 @@ void wifiManagerCb(WiFiManager::Status status) {
ticker.attach(TICKER_RATE_ERASE, tick); ticker.attach(TICKER_RATE_ERASE, tick);
Serial.println("ERASING"); Serial.println("ERASING");
} else if (status.mode == WiFiManager::Mode::CONNECTED) { } else if (status.mode == WiFiManager::Mode::CONNECTED) {
ticker.detach();
digitalWrite(LED_BUILTIN, HIGH); digitalWrite(LED_BUILTIN, HIGH);
Serial.println("CONNECTED"); Serial.println("CONNECTED");
} else if (status.mode == WiFiManager::Mode::DISCONNECTED) { } else if (status.mode == WiFiManager::Mode::DISCONNECTED) {
ticker.detach();
digitalWrite(LED_BUILTIN, LOW); digitalWrite(LED_BUILTIN, LOW);
Serial.println("DISCONNECTED"); Serial.println("DISCONNECTED");
} }
@ -44,10 +44,10 @@ void wifiManagerCb(WiFiManager::Status status) {
void connect() { void connect() {
Serial.begin(115200); Serial.begin(115200);
wifiManager.resetSettings(); // wifiManager.resetSettings();
// wifiManager.configure("esp32-", true, LED_BUILTIN, true, BUTTON_BUILTIN, // wifiManager.configure("esp32-", true, LED_BUILTIN, true, BUTTON_BUILTIN,
// false); // false);
wifiManager.configure("esp32-", true, wifiManagerCb, BUTTON_BUILTIN, false); wifiManager.configure("Claire", true, wifiManagerCb, BUTTON_BUILTIN, false);
// fetches ssid and pass and tries to connect // fetches ssid and pass and tries to connect
// if it does not connect it starts an access point // if it does not connect it starts an access point