From d6cd80e0e6d1691344ae8cb4624bf8de2f96e6c4 Mon Sep 17 00:00:00 2001 From: Quency-D Date: Mon, 16 Nov 2026 10:26:39 +0800 Subject: [PATCH] Rename MeshPocket V2 board and targets with Heltec prefix --- ...cket_v2.json => heltec_meshpocket_v2.json} | 2 +- .../HeltecMeshPocketV2Board.cpp} | 24 +++++----- .../HeltecMeshPocketV2Board.h} | 4 +- .../PowerBank.cpp | 0 .../PowerBank.h | 0 .../PowerBankPage.cpp | 0 .../PowerBankPage.h | 0 .../platformio.ini | 48 +++++++++---------- .../target.cpp | 2 +- .../target.h | 4 +- .../variant.cpp | 0 .../variant.h | 0 12 files changed, 42 insertions(+), 42 deletions(-) rename boards/{meshpocket_v2.json => heltec_meshpocket_v2.json} (96%) rename variants/{meshpocket_v2/MeshPocketV2.cpp => heltec_meshpocket_v2/HeltecMeshPocketV2Board.cpp} (76%) rename variants/{meshpocket_v2/MeshPocketV2.h => heltec_meshpocket_v2/HeltecMeshPocketV2Board.h} (85%) rename variants/{meshpocket_v2 => heltec_meshpocket_v2}/PowerBank.cpp (100%) rename variants/{meshpocket_v2 => heltec_meshpocket_v2}/PowerBank.h (100%) rename variants/{meshpocket_v2 => heltec_meshpocket_v2}/PowerBankPage.cpp (100%) rename variants/{meshpocket_v2 => heltec_meshpocket_v2}/PowerBankPage.h (100%) rename variants/{meshpocket_v2 => heltec_meshpocket_v2}/platformio.ini (61%) rename variants/{meshpocket_v2 => heltec_meshpocket_v2}/target.cpp (95%) rename variants/{meshpocket_v2 => heltec_meshpocket_v2}/target.h (86%) rename variants/{meshpocket_v2 => heltec_meshpocket_v2}/variant.cpp (100%) rename variants/{meshpocket_v2 => heltec_meshpocket_v2}/variant.h (100%) diff --git a/boards/meshpocket_v2.json b/boards/heltec_meshpocket_v2.json similarity index 96% rename from boards/meshpocket_v2.json rename to boards/heltec_meshpocket_v2.json index cdc03033..169d1ef7 100644 --- a/boards/meshpocket_v2.json +++ b/boards/heltec_meshpocket_v2.json @@ -15,7 +15,7 @@ ], "usb_product": "pocket-v2", "mcu": "nrf52840", - "variant": "meshpocket_v2", + "variant": "heltec_meshpocket_v2", "bsp": { "name": "adafruit" }, diff --git a/variants/meshpocket_v2/MeshPocketV2.cpp b/variants/heltec_meshpocket_v2/HeltecMeshPocketV2Board.cpp similarity index 76% rename from variants/meshpocket_v2/MeshPocketV2.cpp rename to variants/heltec_meshpocket_v2/HeltecMeshPocketV2Board.cpp index f72fab65..60b5fc73 100644 --- a/variants/meshpocket_v2/MeshPocketV2.cpp +++ b/variants/heltec_meshpocket_v2/HeltecMeshPocketV2Board.cpp @@ -1,16 +1,16 @@ -#include "MeshPocketV2.h" +#include "HeltecMeshPocketV2Board.h" #include "PowerBankPage.h" #include #include #include -class MeshPocketV2::UiExtension : public mesh::BoardUiExtension { - MeshPocketV2& board; +class HeltecMeshPocketV2Board::UiExtension : public mesh::BoardUiExtension { + HeltecMeshPocketV2Board& board; PowerBankPage page; MomentaryButton secondaryButton; public: - explicit UiExtension(MeshPocketV2& board) : + explicit UiExtension(HeltecMeshPocketV2Board& board) : board(board), secondaryButton(PIN_BUTTON2, 1000, true, true, false) {} void begin() { @@ -47,43 +47,43 @@ public: } }; -void MeshPocketV2::begin() { +void HeltecMeshPocketV2Board::begin() { NRF52Board::begin(); powerBank.begin(); pinMode(PIN_USER_BTN, INPUT_PULLUP); uiExtension().begin(); } -MeshPocketV2::UiExtension& MeshPocketV2::uiExtension() { +HeltecMeshPocketV2Board::UiExtension& HeltecMeshPocketV2Board::uiExtension() { static UiExtension extension(*this); return extension; } -mesh::BoardUiExtension* MeshPocketV2::getUiExtension() { +mesh::BoardUiExtension* HeltecMeshPocketV2Board::getUiExtension() { return &uiExtension(); } -uint16_t MeshPocketV2::getBattMilliVolts() { +uint16_t HeltecMeshPocketV2Board::getBattMilliVolts() { const auto& status = powerBank.snapshot(); if (status.cw.ready) return status.cw.voltageMv; return status.hltLive() ? status.hlt.batteryMv : 0; } -void MeshPocketV2::setUsbDataEnabled(bool enabled) { +void HeltecMeshPocketV2Board::setUsbDataEnabled(bool enabled) { digitalWrite(PIN_IO_CSA, enabled ? HIGH : LOW); } -bool MeshPocketV2::toggleUsbData() { +bool HeltecMeshPocketV2Board::toggleUsbData() { const bool enabled = !isUsbDataEnabled(); setUsbDataEnabled(enabled); return enabled; } -bool MeshPocketV2::isUsbDataEnabled() const { +bool HeltecMeshPocketV2Board::isUsbDataEnabled() const { return digitalRead(PIN_IO_CSA) == HIGH; } -void MeshPocketV2::shutdownPeripherals() { +void HeltecMeshPocketV2Board::shutdownPeripherals() { NRF52Board::shutdownPeripherals(); powerBank.end(); nrf_gpio_cfg_sense_input(PIN_USER_BTN, NRF_GPIO_PIN_PULLUP, NRF_GPIO_PIN_SENSE_LOW); diff --git a/variants/meshpocket_v2/MeshPocketV2.h b/variants/heltec_meshpocket_v2/HeltecMeshPocketV2Board.h similarity index 85% rename from variants/meshpocket_v2/MeshPocketV2.h rename to variants/heltec_meshpocket_v2/HeltecMeshPocketV2Board.h index 0902b729..5ff4a3c5 100644 --- a/variants/meshpocket_v2/MeshPocketV2.h +++ b/variants/heltec_meshpocket_v2/HeltecMeshPocketV2Board.h @@ -3,9 +3,9 @@ #include #include "PowerBank.h" -class MeshPocketV2 : public NRF52Board { +class HeltecMeshPocketV2Board : public NRF52Board { public: - MeshPocketV2() : NRF52Board("MeshPocket_V2_OTA") {} + HeltecMeshPocketV2Board() : NRF52Board("MeshPocket_V2_OTA") {} PowerBank powerBank; void begin() override; void loop() override { powerBank.poll(); } diff --git a/variants/meshpocket_v2/PowerBank.cpp b/variants/heltec_meshpocket_v2/PowerBank.cpp similarity index 100% rename from variants/meshpocket_v2/PowerBank.cpp rename to variants/heltec_meshpocket_v2/PowerBank.cpp diff --git a/variants/meshpocket_v2/PowerBank.h b/variants/heltec_meshpocket_v2/PowerBank.h similarity index 100% rename from variants/meshpocket_v2/PowerBank.h rename to variants/heltec_meshpocket_v2/PowerBank.h diff --git a/variants/meshpocket_v2/PowerBankPage.cpp b/variants/heltec_meshpocket_v2/PowerBankPage.cpp similarity index 100% rename from variants/meshpocket_v2/PowerBankPage.cpp rename to variants/heltec_meshpocket_v2/PowerBankPage.cpp diff --git a/variants/meshpocket_v2/PowerBankPage.h b/variants/heltec_meshpocket_v2/PowerBankPage.h similarity index 100% rename from variants/meshpocket_v2/PowerBankPage.h rename to variants/heltec_meshpocket_v2/PowerBankPage.h diff --git a/variants/meshpocket_v2/platformio.ini b/variants/heltec_meshpocket_v2/platformio.ini similarity index 61% rename from variants/meshpocket_v2/platformio.ini rename to variants/heltec_meshpocket_v2/platformio.ini index 54fcb9b3..b9b8018e 100644 --- a/variants/meshpocket_v2/platformio.ini +++ b/variants/heltec_meshpocket_v2/platformio.ini @@ -1,10 +1,10 @@ -[meshpocket_v2] +[heltec_meshpocket_v2] extends = nrf52_base -board = meshpocket_v2 +board = heltec_meshpocket_v2 board_build.ldscript = boards/nrf52840_s140_v6_extrafs.ld board_upload.maximum_size = 712704 build_flags = ${nrf52_base.build_flags} - -I variants/meshpocket_v2 + -I variants/heltec_meshpocket_v2 -I src/helpers/nrf52 -I lib/nrf52/s140_nrf52_6.1.1_API/include -I lib/nrf52/s140_nrf52_6.1.1_API/include/nrf52 @@ -18,7 +18,7 @@ build_flags = ${nrf52_base.build_flags} -D ENV_INCLUDE_GPS=1 -D DISABLE_DIAGNOSTIC_OUTPUT build_src_filter = ${nrf52_base.build_src_filter} - +<../variants/meshpocket_v2/*.cpp> + +<../variants/heltec_meshpocket_v2/*.cpp> + + lib_deps = ${nrf52_base.lib_deps} @@ -28,52 +28,52 @@ lib_deps = ${nrf52_base.lib_deps} debug_tool = jlink upload_protocol = nrfutil -[meshpocket_v2_companion] -extends = meshpocket_v2 -build_flags = ${meshpocket_v2.build_flags} +[heltec_meshpocket_v2_companion] +extends = heltec_meshpocket_v2 +build_flags = ${heltec_meshpocket_v2.build_flags} -I examples/companion_radio/ui-new -D MAX_CONTACTS=350 -D MAX_GROUP_CHANNELS=40 -build_src_filter = ${meshpocket_v2.build_src_filter} +build_src_filter = ${heltec_meshpocket_v2.build_src_filter} +<../examples/companion_radio/*.cpp> +<../examples/companion_radio/ui-new/*.cpp> -lib_deps = ${meshpocket_v2.lib_deps} +lib_deps = ${heltec_meshpocket_v2.lib_deps} densaugeo/base64 @ ~1.4.0 -[env:meshpocket_v2_companion_radio_ble] -extends = meshpocket_v2_companion -build_flags = ${meshpocket_v2_companion.build_flags} +[env:heltec_meshpocket_v2_companion_radio_ble] +extends = heltec_meshpocket_v2_companion +build_flags = ${heltec_meshpocket_v2_companion.build_flags} -D BLE_PIN_CODE=123456 -D OFFLINE_QUEUE_SIZE=256 -build_src_filter = ${meshpocket_v2_companion.build_src_filter} +build_src_filter = ${heltec_meshpocket_v2_companion.build_src_filter} + -[env:meshpocket_v2_companion_radio_usb] -extends = meshpocket_v2_companion -build_flags = ${meshpocket_v2_companion.build_flags} +[env:heltec_meshpocket_v2_companion_radio_usb] +extends = heltec_meshpocket_v2_companion +build_flags = ${heltec_meshpocket_v2_companion.build_flags} -D ENABLE_USB_INTERFACE -D MESHPOCKET_V2_USB_SWITCHABLE -[env:meshpocket_v2_repeater] -extends = meshpocket_v2 -build_flags = ${meshpocket_v2.build_flags} +[env:heltec_meshpocket_v2_repeater] +extends = heltec_meshpocket_v2 +build_flags = ${heltec_meshpocket_v2.build_flags} -D MESHPOCKET_V2_USB_SWITCHABLE -D ADVERT_NAME='"MeshPocket V2 Repeater"' -D ADVERT_LAT=0.0 -D ADVERT_LON=0.0 -D ADMIN_PASSWORD='"password"' -D MAX_NEIGHBOURS=50 -build_src_filter = ${meshpocket_v2.build_src_filter} +build_src_filter = ${heltec_meshpocket_v2.build_src_filter} +<../examples/simple_repeater> -[env:meshpocket_v2_room_server] -extends = meshpocket_v2 -build_flags = ${meshpocket_v2.build_flags} +[env:heltec_meshpocket_v2_room_server] +extends = heltec_meshpocket_v2 +build_flags = ${heltec_meshpocket_v2.build_flags} -D MESHPOCKET_V2_USB_SWITCHABLE -D ADVERT_NAME='"MeshPocket V2 Room"' -D ADVERT_LAT=0.0 -D ADVERT_LON=0.0 -D ADMIN_PASSWORD='"password"' -D ROOM_PASSWORD='"hello"' -build_src_filter = ${meshpocket_v2.build_src_filter} +build_src_filter = ${heltec_meshpocket_v2.build_src_filter} +<../examples/simple_room_server> diff --git a/variants/meshpocket_v2/target.cpp b/variants/heltec_meshpocket_v2/target.cpp similarity index 95% rename from variants/meshpocket_v2/target.cpp rename to variants/heltec_meshpocket_v2/target.cpp index 714de97b..d2852bbb 100644 --- a/variants/meshpocket_v2/target.cpp +++ b/variants/heltec_meshpocket_v2/target.cpp @@ -1,7 +1,7 @@ #include "target.h" #include -MeshPocketV2 board; +HeltecMeshPocketV2Board board; RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY, SPI); WRAPPER_CLASS radio_driver(radio, board); VolatileRTCClock rtc_clock; diff --git a/variants/meshpocket_v2/target.h b/variants/heltec_meshpocket_v2/target.h similarity index 86% rename from variants/meshpocket_v2/target.h rename to variants/heltec_meshpocket_v2/target.h index 9cab738c..cb9e676f 100644 --- a/variants/meshpocket_v2/target.h +++ b/variants/heltec_meshpocket_v2/target.h @@ -5,9 +5,9 @@ #include #include #include -#include "MeshPocketV2.h" +#include "HeltecMeshPocketV2Board.h" -extern MeshPocketV2 board; +extern HeltecMeshPocketV2Board board; extern WRAPPER_CLASS radio_driver; extern VolatileRTCClock rtc_clock; extern EnvironmentSensorManager sensors; diff --git a/variants/meshpocket_v2/variant.cpp b/variants/heltec_meshpocket_v2/variant.cpp similarity index 100% rename from variants/meshpocket_v2/variant.cpp rename to variants/heltec_meshpocket_v2/variant.cpp diff --git a/variants/meshpocket_v2/variant.h b/variants/heltec_meshpocket_v2/variant.h similarity index 100% rename from variants/meshpocket_v2/variant.h rename to variants/heltec_meshpocket_v2/variant.h