diff --git a/platformio.ini b/platformio.ini index 921018c..a2ddfc7 100644 --- a/platformio.ini +++ b/platformio.ini @@ -35,6 +35,9 @@ lib_deps = lib_ignore = extra_scripts = post:tools/build.py +build_flags = + ${env.build_flags} + -D RAM_SIZE=81920 [esp32_defaults] platform = espressif32 @@ -45,6 +48,9 @@ lib_ignore = extra_scripts = post:tools/esp32.py post:tools/build.py +build_flags = + ${env.build_flags} + -D RAM_SIZE=327680 ; Boards @@ -54,6 +60,14 @@ board = d1_mini lib_deps = ${esp8266_defaults.lib_deps} lib_ignore = ${esp8266_defaults.lib_ignore} extra_scripts = ${esp8266_defaults.extra_scripts} +build_flags = + ${esp8266_defaults.build_flags} + -D OT_IN_PIN_DEFAULT=4 + -D OT_OUT_PIN_DEFAULT=5 + -D SENSOR_OUTDOOR_PIN_DEFAULT=12 + -D SENSOR_INDOOR_PIN_DEFAULT=14 + -D LED_STATUS_PIN=13 + -D LED_OT_RX_PIN=15 [env:d1_mini_lite] platform = ${esp8266_defaults.platform} @@ -61,6 +75,14 @@ board = d1_mini_lite lib_deps = ${esp8266_defaults.lib_deps} lib_ignore = ${esp8266_defaults.lib_ignore} extra_scripts = ${esp8266_defaults.extra_scripts} +build_flags = + ${esp8266_defaults.build_flags} + -D OT_IN_PIN_DEFAULT=4 + -D OT_OUT_PIN_DEFAULT=5 + -D SENSOR_OUTDOOR_PIN_DEFAULT=12 + -D SENSOR_INDOOR_PIN_DEFAULT=14 + -D LED_STATUS_PIN=13 + -D LED_OT_RX_PIN=15 [env:d1_mini_pro] platform = ${esp8266_defaults.platform} @@ -68,6 +90,14 @@ board = d1_mini_pro lib_deps = ${esp8266_defaults.lib_deps} lib_ignore = ${esp8266_defaults.lib_ignore} extra_scripts = ${esp8266_defaults.extra_scripts} +build_flags = + ${esp8266_defaults.build_flags} + -D OT_IN_PIN_DEFAULT=4 + -D OT_OUT_PIN_DEFAULT=5 + -D SENSOR_OUTDOOR_PIN_DEFAULT=12 + -D SENSOR_INDOOR_PIN_DEFAULT=14 + -D LED_STATUS_PIN=13 + -D LED_OT_RX_PIN=15 [env:s2_mini] platform = ${esp32_defaults.platform} @@ -75,6 +105,14 @@ board = lolin_s2_mini lib_deps = ${esp32_defaults.lib_deps} lib_ignore = ${esp32_defaults.lib_ignore} extra_scripts = ${esp32_defaults.extra_scripts} +build_flags = + ${esp32_defaults.build_flags} + -D OT_IN_PIN_DEFAULT=33 + -D OT_OUT_PIN_DEFAULT=35 + -D SENSOR_OUTDOOR_PIN_DEFAULT=9 + -D SENSOR_INDOOR_PIN_DEFAULT=7 + -D LED_STATUS_PIN=11 + -D LED_OT_RX_PIN=12 [env:s3_mini] platform = ${esp32_defaults.platform} @@ -82,10 +120,26 @@ board = lolin_s3_mini lib_deps = ${esp32_defaults.lib_deps} lib_ignore = ${esp32_defaults.lib_ignore} extra_scripts = ${esp32_defaults.extra_scripts} +build_flags = + ${esp32_defaults.build_flags} + -D OT_IN_PIN_DEFAULT=35 + -D OT_OUT_PIN_DEFAULT=36 + -D SENSOR_OUTDOOR_PIN_DEFAULT=13 + -D SENSOR_INDOOR_PIN_DEFAULT=12 + -D LED_STATUS_PIN=11 + -D LED_OT_RX_PIN=10 [env:nodemcu_32s] platform = ${esp32_defaults.platform} board = nodemcu-32s lib_deps = ${esp32_defaults.lib_deps} lib_ignore = ${esp32_defaults.lib_ignore} -extra_scripts = ${esp32_defaults.extra_scripts} \ No newline at end of file +extra_scripts = ${esp32_defaults.extra_scripts} +build_flags = + ${esp32_defaults.build_flags} + -D OT_IN_PIN_DEFAULT=21 + -D OT_OUT_PIN_DEFAULT=22 + -D SENSOR_OUTDOOR_PIN_DEFAULT=12 + -D SENSOR_INDOOR_PIN_DEFAULT=13 + -D LED_STATUS_PIN=18 + -D LED_OT_RX_PIN=19 \ No newline at end of file diff --git a/src/defines.h b/src/defines.h index f2c09a6..a2f3ea1 100644 --- a/src/defines.h +++ b/src/defines.h @@ -12,32 +12,38 @@ #define EXT_SENSORS_INTERVAL 5000 #define EXT_SENSORS_FILTER_K 0.15 -#define LED_STATUS_PIN 13 -#define LED_OT_RX_PIN 15 - #define CONFIG_URL "http://%s/" #define SETTINGS_VALID_VALUE "stvalid" // only 8 chars! -#if defined(ESP8266) - #define RAM_SIZE 81920 - #define OT_IN_PIN_DEFAULT 4 - #define OT_OUT_PIN_DEFAULT 5 - #define SENSOR_OUTDOOR_PIN_DEFAULT 12 - #define SENSOR_INDOOR_PIN_DEFAULT 14 -#elif defined(ESP32) - #define RAM_SIZE 327680 - #define OT_IN_PIN_DEFAULT 17 - #define OT_OUT_PIN_DEFAULT 21 - #define SENSOR_OUTDOOR_PIN_DEFAULT 2 - #define SENSOR_INDOOR_PIN_DEFAULT 4 -#else + + +#ifndef RAM_SIZE #define RAM_SIZE 999999 +#endif + +#ifndef OT_IN_PIN_DEFAULT #define OT_IN_PIN_DEFAULT 0 +#endif + +#ifndef OT_OUT_PIN_DEFAULT #define OT_OUT_PIN_DEFAULT 0 +#endif + +#ifndef SENSOR_OUTDOOR_PIN_DEFAULT #define SENSOR_OUTDOOR_PIN_DEFAULT 0 +#endif + +#ifndef SENSOR_INDOOR_PIN_DEFAULT #define SENSOR_INDOOR_PIN_DEFAULT 0 #endif +#ifndef LED_STATUS_PIN + #define LED_STATUS_PIN 0 +#endif + +#ifndef LED_OT_RX_PIN + #define LED_OT_RX_PIN 0 +#endif #ifdef USE_TELNET #define INFO_STREAM TelnetStream