diff --git a/conf/pins.hpp b/conf/pins.hpp index 27b00028..c3d29aaf 100644 --- a/conf/pins.hpp +++ b/conf/pins.hpp @@ -56,7 +56,7 @@ namespace fablabbg {15U, 2U, 0U, 4U, 16U, 17U, 18U, false}, // LCD {14U, 27U}, // relay {12U}, // buzzer - {19U, false} // Neopixel (non testato) + {19U, true} // Neopixel }; #endif #if (WOKWI_SIMULATION) diff --git a/include/BoardLogic.hpp b/include/BoardLogic.hpp index bfc72ed6..57e86982 100644 --- a/include/BoardLogic.hpp +++ b/include/BoardLogic.hpp @@ -40,7 +40,8 @@ namespace fablabbg ERROR_HW, PORTAL_FAILED, PORTAL_OK, - PORTAL_STARTING + PORTAL_STARTING, + BOOT }; BoardLogic(); diff --git a/platformio.ini b/platformio.ini index 4db9db66..08e9fcfb 100644 --- a/platformio.ini +++ b/platformio.ini @@ -23,6 +23,7 @@ check_flags = clangtidy: --checks=-*,cert-*,clang-analyzer-*,llvm-* --fix monitor_speed = 115200 test_build_src = yes monitor_filters = esp32_exception_decoder + colorize lib_ldf_mode = chain+ lib_deps = arduino-libraries/LiquidCrystal@^1.0.7 https://github.com/bblanchon/ArduinoJson.git#v6.21.2 @@ -51,6 +52,7 @@ debug_build_flags = ${env.build_flags} -D DEBUG -Wall -Wextra +extra_scripts = pre:tools/git_version.py [env:esp32-s3] board = esp32-s3-devkitc-1 @@ -67,9 +69,6 @@ build_src_flags = ${env.build_src_flags} [env:esp32dev] board = esp32dev build_type = release -board_build.f_cpu = 240000000L -board_build.f_flash = 40000000L -board_build.flash_mode = dio build_src_flags = ${env.build_src_flags} -D PINS_ESP32 -D WOKWI_SIMULATION=false diff --git a/src/BoardLogic.cpp b/src/BoardLogic.cpp index e7b6db8d..c4161fab 100644 --- a/src/BoardLogic.cpp +++ b/src/BoardLogic.cpp @@ -17,6 +17,10 @@ #include "SavedConfig.hpp" #include "Logging.hpp" +#ifndef GIT_VERSION +#define GIT_VERSION "??????" +#endif + namespace fablabbg { BoardLogic::BoardLogic() : server(std::make_unique()) @@ -425,6 +429,10 @@ namespace fablabbg getLcd().setRow(0, "Apri portale"); getLcd().setRow(1, WiFi.softAPIP().toString().c_str()); break; + case Status::BOOT: + getLcd().setRow(0, "Avvio..."); + getLcd().setRow(1, "V" GIT_VERSION); + break; default: getLcd().setRow(0, "Unhandled status"); if (snprintf(buffer, sizeof(buffer), "Value %d", static_cast(status)) > 0) diff --git a/src/main.cpp b/src/main.cpp index 6ad2446d..8553dc46 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -334,6 +334,8 @@ void setup() auto success = logic.configure(Board::rfid, Board::lcd); success &= logic.board_init(); + logic.changeStatus(Status::BOOT); + if (!success) { logic.changeStatus(Status::ERROR_HW); diff --git a/tools/git_version.py b/tools/git_version.py new file mode 100644 index 00000000..55b2a88f --- /dev/null +++ b/tools/git_version.py @@ -0,0 +1,17 @@ +import subprocess +import pkg_resources + +Import("env") + + +def get_firmware_specifier_build_flag(): + ret = subprocess.run( + ["git", "describe", "--tags"], stdout=subprocess.PIPE, text=True + ) # Uses only annotated tags + build_version = ret.stdout.strip() + build_flag = '-D GIT_VERSION=\\"' + build_version + '\\"' + print("Firmware Revision (GIT_VERSION) for the build: " + build_version) + return build_flag + + +env.Append(BUILD_FLAGS=[get_firmware_specifier_build_flag()])