From e110fd87a8e2f70eaf1079975fbab127fa5b3b62 Mon Sep 17 00:00:00 2001 From: Roman Terekhov Date: Mon, 12 Oct 2026 08:02:35 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A1=D1=82=D0=B0=D1=80=D1=82=D0=BE=D0=B2?= =?UTF-8?q?=D1=8B=D0=B9=20=D1=8D=D0=BA=D1=80=D0=B0=D0=BD:=20=D0=B2=D0=B5?= =?UTF-8?q?=D1=80=D1=81=D0=B8=D1=8F=20MeshCore,=20MESHINFO=20=D0=B8=20mesh?= =?UTF-8?q?info.ru=20=D0=B2=D0=BC=D0=B5=D1=81=D1=82=D0=BE=20=D0=B4=D0=B0?= =?UTF-8?q?=D1=82=D1=8B=20=D1=81=D0=B1=D0=BE=D1=80=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 11 +++++++++ build.sh | 7 +++++- examples/companion_radio/MyMesh.h | 6 +++++ examples/companion_radio/ui-new/UITask.cpp | 27 ++++++++++++--------- examples/simple_repeater/MyMesh.h | 5 ++++ examples/simple_repeater/UITask.cpp | 24 +++++++++++++------ examples/simple_room_server/MyMesh.h | 5 ++++ examples/simple_room_server/UITask.cpp | 28 +++++++++++++--------- examples/simple_sensor/SensorMesh.h | 5 ++++ examples/simple_sensor/UITask.cpp | 28 +++++++++++++--------- 10 files changed, 105 insertions(+), 41 deletions(-) diff --git a/README.md b/README.md index a2f46fa5..8bee8407 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,17 @@ git merge upstream/main # правки для upstream отправляю - **Индикатор страниц** в `ui-new` строится на `warning_txt` / `secondary_txt`: в upstream цвета брались из `title_bkg`, из-за чего на тёмных темах активная точка сливалась с фоном. +### Стартовый экран + +- Показывает версию **MeshCore** (`v1.17.1` — из исходников), строку **`MESHINFO v0.1.0`** + (версия форка) и сайт **`meshinfo.ru`**. Дата сборки с экрана убрана — она только путала, + потому что рядом стояла версия. +- Версия форка передаётся отдельным макросом `MESHINFO_VERSION` (`build.sh`), поэтому + `FIRMWARE_VERSION` остаётся версией MeshCore: её же отдаёт приложению команда версии + и она попадает в стартовый экран. Так на устройстве видно и базу, и форк. +- Правка сделана во всех стартовых экранах: `companion_radio/ui-new`, а также в `UITask.cpp` + у `simple_repeater`, `simple_room_server` и `simple_sensor`. + ### Интерфейс (companion_radio / ui-new) - **Настройка радио прямо с устройства** — страница RADIO, длинное нажатие: частота diff --git a/build.sh b/build.sh index 80ff4cdf..dbd6c80c 100755 --- a/build.sh +++ b/build.sh @@ -146,8 +146,13 @@ build_firmware() { # e.g: RAK_4631_Repeater-v1.0.0-SHA FIRMWARE_FILENAME="$1-${FIRMWARE_VERSION_STRING}" + # Версия форка передаётся отдельным макросом: FIRMWARE_VERSION остаётся версией + # MeshCore (v1.17.1 из MyMesh.h) — её показывают приложение и стартовый экран. + # В FIRMWARE_VERSION_STRING (имя файла) по-прежнему уходит версия сборки. + MESHINFO_VERSION="${MESHINFO_VERSION:-$FIRMWARE_VERSION}" + # add firmware version info to end of existing platformio build flags in environment vars - export PLATFORMIO_BUILD_FLAGS="${PLATFORMIO_BUILD_FLAGS} -DFIRMWARE_BUILD_DATE='\"${FIRMWARE_BUILD_DATE}\"' -DFIRMWARE_VERSION='\"${FIRMWARE_VERSION_STRING}\"'" + export PLATFORMIO_BUILD_FLAGS="${PLATFORMIO_BUILD_FLAGS} -DFIRMWARE_BUILD_DATE='\"${FIRMWARE_BUILD_DATE}\"' -DMESHINFO_VERSION='\"${MESHINFO_VERSION}\"'" # disable debug flags if requested disable_debug_flags diff --git a/examples/companion_radio/MyMesh.h b/examples/companion_radio/MyMesh.h index 54e2ff2d..3eb0b580 100644 --- a/examples/companion_radio/MyMesh.h +++ b/examples/companion_radio/MyMesh.h @@ -15,6 +15,12 @@ #define FIRMWARE_VERSION "v1.17.1" #endif +// версия форка MESHINFO — показывается на стартовом экране отдельной строкой, +// передаётся сборкой как -DMESHINFO_VERSION=\"v0.1.0\" +#ifndef MESHINFO_VERSION +#define MESHINFO_VERSION "dev" +#endif + #if defined(NRF52_PLATFORM) || defined(STM32_PLATFORM) #include #elif defined(RP2040_PLATFORM) diff --git a/examples/companion_radio/ui-new/UITask.cpp b/examples/companion_radio/ui-new/UITask.cpp index 836bd4bb..bdedd60c 100644 --- a/examples/companion_radio/ui-new/UITask.cpp +++ b/examples/companion_radio/ui-new/UITask.cpp @@ -73,6 +73,7 @@ class SplashScreen : public UIScreen { UITask* _task; unsigned long dismiss_after; char _version_info[12]; + char _meshinfo_info[20]; public: SplashScreen(UITask* task) : _task(task) { @@ -86,6 +87,13 @@ public: memcpy(_version_info, ver, len); _version_info[len] = 0; + // версия форка MESHINFO (суффикс -sha отбрасываем так же) + const char *mf = MESHINFO_VERSION; + const char *mf_dash = strchr(mf, '-'); + int mf_len = mf_dash ? mf_dash - mf : strlen(mf); + if (mf_len > (int)sizeof(_meshinfo_info) - 10) mf_len = sizeof(_meshinfo_info) - 10; + snprintf(_meshinfo_info, sizeof(_meshinfo_info), "MESHINFO %.*s", mf_len, mf); + dismiss_after = millis() + BOOT_SCREEN_MILLIS; } @@ -100,23 +108,20 @@ public: display.setColor(UIColor::primary_txt); display.setTextSize(1); uint16_t websiteWidth = display.getTextWidth(website); - display.setCursor((display.width() - websiteWidth) / 2, 22); + display.setCursor((display.width() - websiteWidth) / 2, 20); display.print(website); - // version info + // версия MeshCore — основная версия прошивки display.setColor(UIColor::primary_txt); display.setTextSize(1); - display.drawTextCentered(display.width()/2, 35, _version_info); + display.drawTextCentered(display.width()/2, 31, _version_info); + // версия форка и его сайт (дату сборки на стартовом экране не показываем) + display.setColor(UIColor::warning_txt); + display.drawTextCentered(display.width()/2, 41, _meshinfo_info); display.setColor(UIColor::secondary_txt); - display.setTextSize(1); - #ifdef OLED_RU - char filtered_date[sizeof(FIRMWARE_BUILD_DATE)]; - display.translateUTF8ToBlocks(filtered_date, FIRMWARE_BUILD_DATE, sizeof(filtered_date)); - display.drawTextCentered(display.width()/2, 42, filtered_date); - #else - display.drawTextCentered(display.width()/2, 42, FIRMWARE_BUILD_DATE); - #endif + display.drawTextCentered(display.width()/2, 51, "meshinfo.ru"); + return 1000; } diff --git a/examples/simple_repeater/MyMesh.h b/examples/simple_repeater/MyMesh.h index 04bd4fb9..3818bd93 100644 --- a/examples/simple_repeater/MyMesh.h +++ b/examples/simple_repeater/MyMesh.h @@ -78,6 +78,11 @@ struct NeighbourInfo { #define FIRMWARE_VERSION "v1.17.1" #endif +// версия форка MESHINFO (передаётся сборкой как -DMESHINFO_VERSION=\"v0.1.0\") +#ifndef MESHINFO_VERSION + #define MESHINFO_VERSION "dev" +#endif + #define FIRMWARE_ROLE "repeater" #define PACKET_LOG_FILE "/packet_log" diff --git a/examples/simple_repeater/UITask.cpp b/examples/simple_repeater/UITask.cpp index fe1c8103..a0e277d1 100644 --- a/examples/simple_repeater/UITask.cpp +++ b/examples/simple_repeater/UITask.cpp @@ -10,6 +10,11 @@ #define AUTO_OFF_MILLIS 20000 // 20 seconds #define BOOT_SCREEN_MILLIS 4000 // 4 seconds +// версия форка MESHINFO (в сборке задаётся как -DMESHINFO_VERSION=\"v0.1.0\") +#ifndef MESHINFO_VERSION + #define MESHINFO_VERSION "dev" +#endif + #define POWEROFF_DELAY 3000 // 'meshcore', 128x13px @@ -48,8 +53,9 @@ void UITask::begin(NodePrefs* node_prefs, const char* build_date, const char* fi *dash = 0; } - // v1.2.3 (1 Jan 2025) - snprintf(_version_info, sizeof(_version_info), "%s (%s)", version, build_date); + // дату сборки на стартовом экране не показываем — только версия MeshCore + (void)build_date; + snprintf(_version_info, sizeof(_version_info), "%s", version); free(version); } @@ -67,13 +73,17 @@ void UITask::renderCurrScreen() { _display->setTextSize(1); _display->drawTextCentered(_display->width() / 2, 22, website); - // version info + // версия MeshCore _display->setTextSize(1); - _display->drawTextCentered(_display->width() / 2, 35, _version_info); + _display->drawTextCentered(_display->width() / 2, 31, _version_info); - // node type - const char* node_type = "< Repeater >"; - _display->drawTextCentered(_display->width() / 2, 48, node_type); + // версия форка и его сайт + char meshinfo[24]; + snprintf(meshinfo, sizeof(meshinfo), "MESHINFO %s", MESHINFO_VERSION); + _display->setColor(UIColor::warning_txt); + _display->drawTextCentered(_display->width() / 2, 41, meshinfo); + _display->setColor(UIColor::secondary_txt); + _display->drawTextCentered(_display->width() / 2, 51, "meshinfo.ru"); } else if (_powering_off_at > 0) { // meshcore logo _display->setColor(UIColor::corp_blue); diff --git a/examples/simple_room_server/MyMesh.h b/examples/simple_room_server/MyMesh.h index 5cf949c6..bee57d70 100644 --- a/examples/simple_room_server/MyMesh.h +++ b/examples/simple_room_server/MyMesh.h @@ -35,6 +35,11 @@ #define FIRMWARE_VERSION "v1.17.1" #endif +// версия форка MESHINFO (передаётся сборкой как -DMESHINFO_VERSION=\"v0.1.0\") +#ifndef MESHINFO_VERSION + #define MESHINFO_VERSION "dev" +#endif + #ifndef LORA_FREQ #define LORA_FREQ 915.0 #endif diff --git a/examples/simple_room_server/UITask.cpp b/examples/simple_room_server/UITask.cpp index 1c283bdc..db069ad2 100644 --- a/examples/simple_room_server/UITask.cpp +++ b/examples/simple_room_server/UITask.cpp @@ -9,6 +9,11 @@ #define AUTO_OFF_MILLIS 20000 // 20 seconds #define BOOT_SCREEN_MILLIS 4000 // 4 seconds +// версия форка MESHINFO (в сборке задаётся как -DMESHINFO_VERSION=\"v0.1.0\") +#ifndef MESHINFO_VERSION + #define MESHINFO_VERSION "dev" +#endif + // 'meshcore', 128x13px static const uint8_t meshcore_logo [] PROGMEM = { 0x3c, 0x01, 0xe3, 0xff, 0xc7, 0xff, 0x8f, 0x03, 0x87, 0xfe, 0x1f, 0xfe, 0x1f, 0xfe, 0x1f, 0xfe, @@ -40,8 +45,9 @@ void UITask::begin(NodePrefs* node_prefs, const char* build_date, const char* fi *dash = 0; } - // v1.2.3 (1 Jan 2025) - snprintf(_version_info, sizeof(_version_info), "%s (%s)", version, build_date); + // дату сборки на стартовом экране не показываем — только версия MeshCore + (void)build_date; + snprintf(_version_info, sizeof(_version_info), "%s", version); free(version); } @@ -61,17 +67,17 @@ void UITask::renderCurrScreen() { _display->setCursor((_display->width() - websiteWidth) / 2, 22); _display->print(website); - // version info + // версия MeshCore _display->setTextSize(1); - uint16_t versionWidth = _display->getTextWidth(_version_info); - _display->setCursor((_display->width() - versionWidth) / 2, 35); - _display->print(_version_info); + _display->drawTextCentered(_display->width() / 2, 31, _version_info); - // node type - const char* node_type = "< Room Server >"; - uint16_t typeWidth = _display->getTextWidth(node_type); - _display->setCursor((_display->width() - typeWidth) / 2, 48); - _display->print(node_type); + // версия форка и его сайт + char meshinfo[24]; + snprintf(meshinfo, sizeof(meshinfo), "MESHINFO %s", MESHINFO_VERSION); + _display->setColor(UIColor::warning_txt); + _display->drawTextCentered(_display->width() / 2, 41, meshinfo); + _display->setColor(UIColor::secondary_txt); + _display->drawTextCentered(_display->width() / 2, 51, "meshinfo.ru"); } else { // home screen // node name _display->setCursor(0, 0); diff --git a/examples/simple_sensor/SensorMesh.h b/examples/simple_sensor/SensorMesh.h index b5e96d5c..9a235f0e 100644 --- a/examples/simple_sensor/SensorMesh.h +++ b/examples/simple_sensor/SensorMesh.h @@ -41,6 +41,11 @@ #define FIRMWARE_VERSION "v1.17.1" #endif +// версия форка MESHINFO (передаётся сборкой как -DMESHINFO_VERSION=\"v0.1.0\") +#ifndef MESHINFO_VERSION + #define MESHINFO_VERSION "dev" +#endif + #define FIRMWARE_ROLE "sensor" #define MAX_SEARCH_RESULTS 8 diff --git a/examples/simple_sensor/UITask.cpp b/examples/simple_sensor/UITask.cpp index 391c305e..db069ad2 100644 --- a/examples/simple_sensor/UITask.cpp +++ b/examples/simple_sensor/UITask.cpp @@ -9,6 +9,11 @@ #define AUTO_OFF_MILLIS 20000 // 20 seconds #define BOOT_SCREEN_MILLIS 4000 // 4 seconds +// версия форка MESHINFO (в сборке задаётся как -DMESHINFO_VERSION=\"v0.1.0\") +#ifndef MESHINFO_VERSION + #define MESHINFO_VERSION "dev" +#endif + // 'meshcore', 128x13px static const uint8_t meshcore_logo [] PROGMEM = { 0x3c, 0x01, 0xe3, 0xff, 0xc7, 0xff, 0x8f, 0x03, 0x87, 0xfe, 0x1f, 0xfe, 0x1f, 0xfe, 0x1f, 0xfe, @@ -40,8 +45,9 @@ void UITask::begin(NodePrefs* node_prefs, const char* build_date, const char* fi *dash = 0; } - // v1.2.3 (1 Jan 2025) - snprintf(_version_info, sizeof(_version_info), "%s (%s)", version, build_date); + // дату сборки на стартовом экране не показываем — только версия MeshCore + (void)build_date; + snprintf(_version_info, sizeof(_version_info), "%s", version); free(version); } @@ -61,17 +67,17 @@ void UITask::renderCurrScreen() { _display->setCursor((_display->width() - websiteWidth) / 2, 22); _display->print(website); - // version info + // версия MeshCore _display->setTextSize(1); - uint16_t versionWidth = _display->getTextWidth(_version_info); - _display->setCursor((_display->width() - versionWidth) / 2, 35); - _display->print(_version_info); + _display->drawTextCentered(_display->width() / 2, 31, _version_info); - // node type - const char* node_type = "< Sensor >"; - uint16_t typeWidth = _display->getTextWidth(node_type); - _display->setCursor((_display->width() - typeWidth) / 2, 48); - _display->print(node_type); + // версия форка и его сайт + char meshinfo[24]; + snprintf(meshinfo, sizeof(meshinfo), "MESHINFO %s", MESHINFO_VERSION); + _display->setColor(UIColor::warning_txt); + _display->drawTextCentered(_display->width() / 2, 41, meshinfo); + _display->setColor(UIColor::secondary_txt); + _display->drawTextCentered(_display->width() / 2, 51, "meshinfo.ru"); } else { // home screen // node name _display->setCursor(0, 0);