mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-04-20 22:13:47 +00:00
show firmware version and build date on companion screen
This commit is contained in:
parent
348db9b82f
commit
28aa94b899
3 changed files with 19 additions and 6 deletions
|
|
@ -25,16 +25,28 @@ static const uint8_t meshcore_logo [] PROGMEM = {
|
|||
0xe3, 0xe3, 0x8f, 0xff, 0x1f, 0xfc, 0x3c, 0x0e, 0x1f, 0xf8, 0xff, 0xf8, 0x70, 0x3c, 0x7f, 0xf8,
|
||||
};
|
||||
|
||||
void UITask::begin(DisplayDriver* display, const char* node_name, const char* build_date, uint32_t pin_code) {
|
||||
void UITask::begin(DisplayDriver* display, const char* node_name, const char* build_date, const char* firmware_version, uint32_t pin_code) {
|
||||
_display = display;
|
||||
_auto_off = millis() + AUTO_OFF_MILLIS;
|
||||
clearMsgPreview();
|
||||
_node_name = node_name;
|
||||
_build_date = build_date;
|
||||
_firmware_version = firmware_version;
|
||||
_pin_code = pin_code;
|
||||
if (_display != NULL) {
|
||||
_display->turnOn();
|
||||
}
|
||||
|
||||
// strip off dash and commit hash by changing dash to null terminator
|
||||
// e.g: v1.2.3-abcdef -> v1.2.3
|
||||
char *version = strdup(_firmware_version);
|
||||
char *dash = strchr(version, '-');
|
||||
if(dash){
|
||||
*dash = 0;
|
||||
}
|
||||
|
||||
// v1.2.3 (1 Jan 2025)
|
||||
sprintf(_version_info, "%s (%s)", version, _build_date);
|
||||
}
|
||||
|
||||
void UITask::msgRead(int msgcount) {
|
||||
|
|
@ -90,10 +102,9 @@ void UITask::renderCurrScreen() {
|
|||
_display->setCursor(0, 20);
|
||||
_display->setTextSize(1);
|
||||
_display->print(_node_name);
|
||||
|
||||
sprintf(tmp, "Build: %s", _build_date);
|
||||
|
||||
_display->setCursor(0, 32);
|
||||
_display->print(tmp);
|
||||
_display->print(_version_info);
|
||||
|
||||
if (_connected) {
|
||||
//_display->printf("freq : %03.2f sf %d\n", _prefs.freq, _prefs.sf);
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@ class UITask {
|
|||
uint32_t _pin_code;
|
||||
const char* _node_name;
|
||||
const char* _build_date;
|
||||
const char* _firmware_version;
|
||||
char _version_info[32];
|
||||
char _origin[62];
|
||||
char _msg[80];
|
||||
int _msgcount;
|
||||
|
|
@ -26,7 +28,7 @@ public:
|
|||
_next_refresh = 0;
|
||||
_connected = false;
|
||||
}
|
||||
void begin(DisplayDriver* display, const char* node_name, const char* build_date, uint32_t pin_code);
|
||||
void begin(DisplayDriver* display, const char* node_name, const char* build_date, const char* firmware_version, uint32_t pin_code);
|
||||
|
||||
void setHasConnection(bool connected) { _connected = connected; }
|
||||
bool hasDisplay() const { return _display != NULL; }
|
||||
|
|
|
|||
|
|
@ -1505,7 +1505,7 @@ void setup() {
|
|||
#endif
|
||||
|
||||
#ifdef HAS_UI
|
||||
ui_task.begin(disp, the_mesh.getNodeName(), FIRMWARE_BUILD_DATE, the_mesh.getBLEPin());
|
||||
ui_task.begin(disp, the_mesh.getNodeName(), FIRMWARE_BUILD_DATE, FIRMWARE_VERSION, the_mesh.getBLEPin());
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue