Compare commits
2 Commits
Author | SHA1 | Date |
---|---|---|
Thomas Kolb | 3ac26d35d2 | |
Thomas Kolb | ecfc78c48a |
30
src/main.cpp
30
src/main.cpp
|
@ -6,6 +6,8 @@
|
|||
#include <WiFiMulti.h>
|
||||
#include <SPIFFS.h>
|
||||
|
||||
#include <esp_wifi.h>
|
||||
|
||||
#include <freertos/FreeRTOS.h>
|
||||
#include <freertos/semphr.h>
|
||||
|
||||
|
@ -188,20 +190,20 @@ static void ledFSM(void)
|
|||
|
||||
animController.loop();
|
||||
|
||||
if(((WiFi.status() == WL_CONNECTED) || (WiFi.getMode() == WIFI_MODE_AP)) &&
|
||||
udpProto.check()) {
|
||||
// UDP packet received -> transition to UDP state
|
||||
nextState = UDP;
|
||||
ledState = TRANSITION;
|
||||
// ensure the correct animation plays after UDP transfers stop
|
||||
animController.changeAnimation(loadSavedAnimation(), false);
|
||||
}
|
||||
|
||||
// change to last used animation after some time
|
||||
if((millis() - stateEnteredTime) > 60000) {
|
||||
// change to last used animation or UDP visualization after some time
|
||||
if((millis() - stateEnteredTime) > 30000) {
|
||||
// load the saved animation
|
||||
// FIXME: does not work with transition because of restart() call in ANIMATION state
|
||||
animController.changeAnimation(loadSavedAnimation(), false);
|
||||
ledState = ANIMATION;
|
||||
|
||||
if(((WiFi.status() == WL_CONNECTED) || (WiFi.getMode() == WIFI_MODE_AP)) &&
|
||||
udpProto.check()) {
|
||||
// UDP packet received -> transition to UDP state
|
||||
nextState = UDP;
|
||||
ledState = TRANSITION;
|
||||
} else {
|
||||
ledState = ANIMATION;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -383,6 +385,10 @@ void wifi_setup(void)
|
|||
WiFi.mode(WIFI_AP);
|
||||
WiFi.softAPConfig(apIP, apIP, IPAddress(255, 255, 255, 0));
|
||||
WiFi.softAP("🕯️💡☀️", "Licht234");
|
||||
WiFi.setTxPower(WIFI_POWER_2dBm);
|
||||
esp_wifi_set_bandwidth(WIFI_IF_AP, WIFI_BW_HT20);
|
||||
esp_wifi_config_11b_rate(WIFI_IF_AP, true);
|
||||
esp_wifi_set_protocol(WIFI_IF_AP, WIFI_PROTOCOL_11N);
|
||||
WiFi.enableAP(true);
|
||||
|
||||
animController.changeAnimation(std::unique_ptr<Animation>(new ConnectionEstablishedAnimation(&ledFader, false)));
|
||||
|
|
Loading…
Reference in New Issue