Skip to content

A Hardware Hacking Tool with Web-Based CLI That Speaks Every Protocol

Centralize version to state

Geo4b1867fc00fb
diff --git a/src/Views/M5DeviceView.cpp b/src/Views/M5DeviceView.cpp
index 987df9d3..34b622e6 100644
--- a/src/Views/M5DeviceView.cpp
+++ b/src/Views/M5DeviceView.cpp
@@ -18,6 +18,8 @@ void M5DeviceView::welcome(TerminalTypeEnum& terminalType, std::string& terminal
void M5DeviceView::logo() {
clear();
+ GlobalState& state = GlobalState::getInstance();
+
M5.Lcd.fillRoundRect(8, 40, 220, 60, DEFAULT_ROUND_RECT, RECT_COLOR_DARK);
M5.Lcd.drawRoundRect(8, 40, 220, 60, DEFAULT_ROUND_RECT, PRIMARY_COLOR);
@@ -29,7 +31,7 @@ void M5DeviceView::logo() {
M5.Lcd.setTextSize(1.6);
M5.Lcd.setCursor(43, 80);
M5.Lcd.setTextColor(TEXT_COLOR);
- M5.Lcd.printf("Version 0.5 - Geo");
+ M5.Lcd.printf("Version " + std::string(state.getVersion()) + " - Geo");
delay(3000);
}
diff --git a/src/Views/SerialTerminalView.cpp b/src/Views/SerialTerminalView.cpp
index 86b74d47..860ffd68 100644
--- a/src/Views/SerialTerminalView.cpp
+++ b/src/Views/SerialTerminalView.cpp
@@ -8,7 +8,10 @@ void SerialTerminalView::initialize() {
}
void SerialTerminalView::welcome(TerminalTypeEnum& terminalType, std::string& terminalInfos) {
- Serial.println("");
+
+ GlobalState& state = GlobalState::getInstance();
+ std::string version = state.getVersion();
+
Serial.println("");
Serial.println(" ____ _ _ ");
Serial.println(" | __ ) _ _ ___ _ __ (_)_ __ __ _| |_ ___ ");
@@ -16,7 +19,7 @@ void SerialTerminalView::welcome(TerminalTypeEnum& terminalType, std::string& te
Serial.println(" | |_) | |_| \\__ \\ | |_) | | | | (_| | || __/");
Serial.println(" |____/ \\__,_|___/ | .__/|_|_| \\__,_|\\__\\___|");
Serial.println(" |_| ");
- Serial.println(" Version 0.5 Ready to board");
+ Serial.printf(" Version %s Ready to board\n", version.c_str());
Serial.println("");
Serial.println(" Type 'mode' to start or 'help' for commands");
Serial.println("");
diff --git a/src/Views/TembedDeviceView.cpp b/src/Views/TembedDeviceView.cpp
index 0db0420e..61c210ab 100644
--- a/src/Views/TembedDeviceView.cpp
+++ b/src/Views/TembedDeviceView.cpp
@@ -49,7 +49,9 @@ void TembedDeviceView::logo() {
// Sub
tft.setTextColor(TFT_WHITE, DARK_GREY_RECT);
- drawCenterText("Version 0.5 - Geo", 100, 1.9);
+ GlobalState& state = GlobalState::getInstance();
+ auto version = "Version " + std::string(state.getVersion()) + " - Geo";
+ drawCenterText(version.c_str(), 100, 1.9);
delay(3000);
}