feat: add seeed xiao-esp32 platform

This commit is contained in:
s3lph 2024-12-22 03:03:08 +01:00
parent da27fd1ceb
commit 7508cbe430
Signed by: s3lph
GPG key ID: 0AA29A52FB33CFB5
2 changed files with 30 additions and 0 deletions

View file

@ -40,3 +40,22 @@ build_flags =
;; - Additional parameters in the WifiManager config menu for configuring these features.
;; Check out the README for a schematic of how to wire up the LDR.
-D FEATURE_LDR=3
[env:seeed_xiao_esp32c3]
platform = espressif32
board = seeed_xiao_esp32c3
framework = arduino
lib_deps =
adafruit/Adafruit NeoPixel@^1.12.3
bblanchon/ArduinoJson@^7.1.0
sstaub/NTP@^1.6
tzapu/WiFiManager@^2.0.17
khoih-prog/ESP32_C3_TimerInterrupt@^1.8.0
build_flags =
-D ARDUINO_USB_MODE=1
-D ARDUINO_USB_CDC_ON_BOOT=1
-D WS2812_PIN=D8
-D FEATURE_CONFIGAP=D0
-D FEATURE_CONFIGAP_GND=D1
-D FEATURE_LDR=A2

View file

@ -12,7 +12,9 @@
#include "spacemap.h"
#ifndef WS2812_PIN
#define WS2812_PIN 0
#endif
#define WS2812_LEN (sizeof(spaces)/sizeof(char*))
#define WS2812_BS 5
@ -38,6 +40,7 @@ ESP32Timer ITimer0(0);
volatile bool wmp_needs_config_save;
volatile bool timerExpired;
bool error = false;
uint16_t failcount = 0;
enum SpaceState {
Closed,
@ -330,6 +333,14 @@ void loop() {
timerExpired = false;
Serial.println("Timer expired!");
error = !updateMap();
if (error) {
++failcount;
} else {
failcount = 0;
}
if (failcount > 3) {
ESP.restart();
}
}
time_t now = ntp.epoch();