Skip to content

Commit

Permalink
added version number
Browse files Browse the repository at this point in the history
  • Loading branch information
PBrunot committed Jan 13, 2024
1 parent f2b0b67 commit 4e8c24c
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 5 deletions.
2 changes: 1 addition & 1 deletion conf/pins.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion include/BoardLogic.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ namespace fablabbg
ERROR_HW,
PORTAL_FAILED,
PORTAL_OK,
PORTAL_STARTING
PORTAL_STARTING,
BOOT
};

BoardLogic();
Expand Down
5 changes: 2 additions & 3 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 4 additions & 0 deletions src/BoardLogic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,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, GIT_VERSION);
break;
default:
getLcd().setRow(0, "Unhandled status");
if (snprintf(buffer, sizeof(buffer), "Value %d", static_cast<int>(status)) > 0)
Expand Down
2 changes: 2 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
17 changes: 17 additions & 0 deletions tools/git_version.py
Original file line number Diff line number Diff line change
@@ -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: " + build_version)
return build_flag


env.Append(BUILD_SRC_FLAGS=[get_firmware_specifier_build_flag()])

0 comments on commit 4e8c24c

Please sign in to comment.