diff --git a/platformio.ini b/platformio.ini index 4e97789..9c59ee7 100644 --- a/platformio.ini +++ b/platformio.ini @@ -7,12 +7,29 @@ ; ; Please visit documentation for the other options and examples ; https://docs.platformio.org/page/projectconf.html +[common_env_data] +build_flags = + -D BUILD_ENV_NAME=$PIOENV + -D BUILD_PLATFORM=$PIOPLATFORM + -D BUILD_TIME=$UNIX_TIME + -D CORE_DEBUG_LEVEL=3 -[env:espwroom32] +[env:generic_espwroom32] platform = espressif32 board = nodemcu-32s framework = arduino upload_port = COM4 -platform_packages = platformio/framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git +platform_packages = platformio/framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#2.0.14 monitor_speed = 115200 -build_flags = -DCORE_DEBUG_LEVEL=3 +build_flags = + ${common_env_data.build_flags} + +[env:xiao_esp32s3] +platform = espressif32 +board = seeed_xiao_esp32s3 +framework = arduino +upload_port = /dev/cu.usbmodem2101 +platform_packages = platformio/framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#2.0.14 +monitor_speed = 115200 +build_flags = + ${common_env_data.build_flags} diff --git a/src/config.h b/src/config.h index d1cb6c3..207b703 100644 --- a/src/config.h +++ b/src/config.h @@ -1,9 +1,30 @@ #ifndef OPENESPRESSOPROFILER_CONFIG_H #define OPENESPRESSOPROFILER_CONFIG_H +#include + +#ifndef BUILD_ENV_NAME + #error "Add -D BUILD_ENV_NAME=$PIOENV to platformio.ini build_flags" +#else + #define generic_espwroom32 101 + #define xiao_esp32s3 102 +#endif + +#if BUILD_ENV_NAME==generic_espwroom32 #define LED_PIN 2 +#define INVERT_LED false #define PRESSURE_PIN 32 +#elif BUILD_ENV_NAME==xiao_esp32s3 +#define LED_PIN LED_BUILTIN +#define INVERT_LED true +#define PRESSURE_PIN A1 + +#else +#error "BUILD_ENV_NAME NOT RECOGNIZED" +#endif + + #define R1_OHMS 10000 #define R2_OHMS 15000 diff --git a/src/main.cpp b/src/main.cpp index 4d22d83..2ef01e5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -143,7 +143,7 @@ void loop() { Serial.println("ping"); lastPoll = now; - digitalWrite(LED_PIN, deviceConnected); + digitalWrite(LED_PIN, INVERT_LED ^ deviceConnected); if (PRESSURE != nullptr) { int16_t pressure = readPressure();