diff --git a/pio_local.ini_example b/pio_local.ini_example index 7b41a7bc8..f38c988f1 100644 --- a/pio_local.ini_example +++ b/pio_local.ini_example @@ -16,33 +16,43 @@ ; my_build_flags = -DEMSESP_DEBUG -DEMSESP_TEST -DEMSESP_PINGTEST [platformio] -; default_envs = esp32_4M +default_envs = esp32_4M ; default_envs = esp32_16M -default_envs = lolin_s3 -; default_envs = standalone +; default_envs = lolin_s3 +; default_envs = native ; default_envs = debug ; default_envs = custom [env] ; upload settings -upload_protocol = custom +; for USB +upload_protocol = esptool +upload_port = /dev/ttyUSB* +; for OTA +; upload_protocol = custom custom_emsesp_ip = 10.10.10.173 ; custom_emsesp_ip = ems-esp.local custom_username = admin custom_password = admin -upload_port = /dev/ttyUSB* +; uncomment this next line if using the github repo +lib_deps = file://../../modules/EMS-ESP-Modules + +[env:native] +extra_scripts = +; pre:scripts/refresh_module_library_native.py +; post:scripts/run_native.py [env:esp32_4M] extra_scripts = - pre:scripts/build_interface.py ; comment out if you don't want to re-build the WebUI each time +; pre:scripts/build_interface.py ; comment out if you don't want to re-build the WebUI each time scripts/rename_fw.py -; scripts/upload.py + scripts/upload.py [env:lolin_s3] extra_scripts = pre:scripts/build_interface.py ; comment out if you don't want to re-build the WebUI each time scripts/rename_fw.py -; scripts/upload.py + scripts/upload.py [env:custom] ; use for basic ESP boards with 4MB flash @@ -60,7 +70,7 @@ board_upload.use_1200bps_touch = false board_upload.wait_for_upload_port = true upload_port = /dev/ttyUSB0 extra_scripts = - ; pre:scripts/build_interface.py + pre:scripts/build_interface.py scripts/rename_fw.py build_unflags = ${common.unbuild_flags} build_flags = diff --git a/platformio.ini b/platformio.ini index 2610727fe..7a5084f3c 100644 --- a/platformio.ini +++ b/platformio.ini @@ -12,7 +12,7 @@ extra_configs = pio_local.ini [common] -core_build_flags = -std=gnu++2a +core_build_flags = -std=gnu++2a -Isrc core_unbuild_flags = -std=gnu++11 ; my_build_flags is set in pio_local.ini @@ -64,10 +64,11 @@ extra_scripts = [env] monitor_speed = 115200 -monitor_filters = direct, esp32_exception_decoder +monitor_filters = direct upload_speed = 921600 build_type = release lib_ldf_mode = chain+ +lib_deps = https://github.com/emsesp/EMS-ESP-Modules.git check_tool = cppcheck, clangtidy check_severity = high, medium check_flags = @@ -205,15 +206,13 @@ build_flags = -D CONFIG_UART_ISR_IN_IRAM -D CONFIG_ASYNC_TCP_STACK_SIZE=5120 -; to build and run: pio run -e standalone -t exec -[env:standalone] +; to build and run: pio run -e native -t exec +[env:native] platform = native build_flags = -DARDUINOJSON_ENABLE_STD_STRING=1 -DARDUINOJSON_ENABLE_PROGMEM=1 -DARDUINOJSON_ENABLE_ARDUINO_STRING -DARDUINOJSON_USE_DOUBLE=0 -DEMSESP_DEBUG -DEMSESP_STANDALONE -DEMSESP_TEST -DEMSESP_DEFAULT_LOCALE=\"en\" -DEMSESP_DEFAULT_TX_MODE=8 -DEMSESP_DEFAULT_VERSION=\"3.7.0-dev.0\" -DEMSESP_DEFAULT_BOARD_PROFILE=\"S32\" - -lpthread - -D__linux__ -std=gnu++14 -Og -ggdb build_src_flags = -Wall -Wextra -Werror @@ -228,7 +227,7 @@ build_src_flags = -I./lib/espMqttClient/src -I./lib/espMqttClient/src/Transport build_src_filter = - +<*> + +<*> -<.git/> +<../lib_standalone> +<../lib/uuid-common> diff --git a/scripts/refresh_module_library_native.py b/scripts/refresh_module_library_native.py new file mode 100644 index 000000000..bb647ebf6 --- /dev/null +++ b/scripts/refresh_module_library_native.py @@ -0,0 +1,11 @@ +import os + +Import("env") + +def refresh_module(): + print("Fetching latest module for Native target...") + os.system("pio pkg install -f -s -e native -l file://../../modules/EMS-ESP-Modules") + +if not (env.IsCleanTarget()): + refresh_module() + diff --git a/scripts/run_native.py b/scripts/run_native.py new file mode 100644 index 000000000..dc786953d --- /dev/null +++ b/scripts/run_native.py @@ -0,0 +1,11 @@ +import os + +Import("env") + +def run_native(): + print("Running native...") + os.system("pio run -e native") + +if not (env.IsCleanTarget()): + run_native() + diff --git a/src/console.cpp b/src/console.cpp index 20271ccc1..df9b898e1 100644 --- a/src/console.cpp +++ b/src/console.cpp @@ -636,15 +636,15 @@ void EMSESPShell::stopped() { // show welcome banner void EMSESPShell::display_banner() { println(); - printfln("┌──────────────────────────────────────────┐"); - printfln("│ %sEMS-ESP version %-12s%s │", COLOR_BOLD_ON, EMSESP_APP_VERSION, COLOR_BOLD_OFF); - printfln("│ │"); - printfln("│ %shelp%s to show available commands │", COLOR_UNDERLINE, COLOR_RESET); - printfln("│ %ssu%s to access admin commands │", COLOR_UNDERLINE, COLOR_RESET); - printfln("│ │"); - printfln("│ %s%shttps://github.com/emsesp/EMS-ESP32%s │", COLOR_BRIGHT_GREEN, COLOR_UNDERLINE, COLOR_RESET); - printfln("│ │"); - printfln("└──────────────────────────────────────────┘"); + printfln("┌───────────────────────────────────────┐"); + printfln("│ %sEMS-ESP version %-20s%s │", COLOR_BOLD_ON, EMSESP_APP_VERSION, COLOR_BOLD_OFF); + printfln("│ │"); + printfln("│ %shelp%s to show available commands │", COLOR_UNDERLINE, COLOR_RESET); + printfln("│ %ssu%s to access admin commands │", COLOR_UNDERLINE, COLOR_RESET); + printfln("│ │"); + printfln("│ %s%shttps://github.com/emsesp/EMS-ESP32%s │", COLOR_BRIGHT_GREEN, COLOR_UNDERLINE, COLOR_RESET); + printfln("│ │"); + printfln("└───────────────────────────────────────┘"); println(); // set console name diff --git a/src/emsesp.cpp b/src/emsesp.cpp index 0265ec0fa..c5c6488fb 100644 --- a/src/emsesp.cpp +++ b/src/emsesp.cpp @@ -75,6 +75,7 @@ TemperatureSensor EMSESP::temperaturesensor_; // Temperature sensors AnalogSensor EMSESP::analogsensor_; // Analog sensors Shower EMSESP::shower_; // Shower logic Preferences EMSESP::nvs_; // NV Storage +ModuleLibrary EMSESP::module_; // Module Library // static/common variables uint16_t EMSESP::watch_id_ = WATCH_ID_NONE; // for when log is TRACE. 0 means no trace set @@ -1645,6 +1646,8 @@ void EMSESP::start() { #endif webServer.begin(); // start the web server + + module_.setup(this); // setup the external library modules } // main loop calling all services diff --git a/src/emsesp.h b/src/emsesp.h index c283873d8..71a1c87e6 100644 --- a/src/emsesp.h +++ b/src/emsesp.h @@ -65,6 +65,10 @@ #include "command.h" #include "version.h" +// Load external modules +class Module {}; // forward declaration +#include + #define WATCH_ID_NONE 0 // no watch id set // helpers for callback functions @@ -218,6 +222,7 @@ class EMSESP { static RxService rxservice_; static TxService txservice_; static Preferences nvs_; + static ModuleLibrary module_; // web controllers static ESP8266React esp8266React; diff --git a/src/version.h b/src/version.h index b969f3758..e0c1fdd1e 100644 --- a/src/version.h +++ b/src/version.h @@ -1 +1 @@ -#define EMSESP_APP_VERSION "3.7.0-dev.11" +#define EMSESP_APP_VERSION "3.7.0-dev.11m"