From 37652459a11cbfb812eb92e2dc599ea52fe6fe15 Mon Sep 17 00:00:00 2001 From: Alex Wolden Date: Fri, 7 Mar 2025 13:18:24 -0800 Subject: [PATCH 1/5] Enable SSD1306 display class for LilyGo_TLora_V2_1_1_6 --- platformio.ini | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/platformio.ini b/platformio.ini index e9a615d4..c3ad2b25 100644 --- a/platformio.ini +++ b/platformio.ini @@ -365,10 +365,15 @@ build_flags = -D P_LORA_MOSI=27 ; SPI MOSI -D P_LORA_TX_LED=2 ; LED pin for TX indication -D PIN_VBAT_READ=35 ; Battery voltage reading (analog pin) + -D PIN_USER_BTN=0 -D RADIO_CLASS=CustomSX1276 -D ARDUINO_LOOP_STACK_SIZE=16384 + -D DISPLAY_CLASS=SSD1306Display -D WRAPPER_CLASS=CustomSX1276Wrapper -D LORA_TX_POWER=20 +lib_deps = + ${esp32_base.lib_deps} + adafruit/Adafruit SSD1306 @ ^2.5.13 ; ============= [LilyGo_T3S3_sx1262] @@ -396,7 +401,7 @@ build_flags = ${esp32_base.build_flags} ; === LILYGO T-LoRa V2.1-1.6 with SX1276 environments === [env:LilyGo_TLora_V2_1_1_6_Repeater] extends = LilyGo_TLora_V2_1_1_6 -build_src_filter = ${LilyGo_TLora_V2_1_1_6.build_src_filter} +<../examples/simple_repeater/main.cpp> +build_src_filter = ${LilyGo_TLora_V2_1_1_6.build_src_filter} + +<../examples/simple_repeater> build_flags = ${LilyGo_TLora_V2_1_1_6.build_flags} -D ADVERT_NAME="\"TLora-V2.1-1.6 Repeater\"" @@ -415,7 +420,7 @@ build_flags = -D MAX_GROUP_CHANNELS=1 ; -D MESH_PACKET_LOGGING=1 ; -D MESH_DEBUG=1 -build_src_filter = ${LilyGo_TLora_V2_1_1_6.build_src_filter} +<../examples/simple_secure_chat/main.cpp> +build_src_filter = ${LilyGo_TLora_V2_1_1_6.build_src_filter} + +<../examples/simple_repeater> lib_deps = ${LilyGo_TLora_V2_1_1_6.lib_deps} densaugeo/base64 @ ~1.4.0 @@ -430,7 +435,7 @@ build_flags = ; -D ENABLE_PRIVATE_KEY_EXPORT=1 ; NOTE: DO NOT ENABLE --> -D MESH_PACKET_LOGGING=1 ; NOTE: DO NOT ENABLE --> -D MESH_DEBUG=1 -build_src_filter = ${LilyGo_TLora_V2_1_1_6.build_src_filter} +<../examples/companion_radio/main.cpp> +build_src_filter = ${LilyGo_TLora_V2_1_1_6.build_src_filter} + +<../examples/companion_radio> lib_deps = ${LilyGo_TLora_V2_1_1_6.lib_deps} densaugeo/base64 @ ~1.4.0 @@ -447,14 +452,14 @@ build_flags = ; -D ENABLE_PRIVATE_KEY_EXPORT=1 ; -D MESH_PACKET_LOGGING=1 ; -D MESH_DEBUG=1 -build_src_filter = ${LilyGo_TLora_V2_1_1_6.build_src_filter} + +<../examples/companion_radio/main.cpp> +build_src_filter = ${LilyGo_TLora_V2_1_1_6.build_src_filter} + +<../examples/companion_radio> lib_deps = ${LilyGo_TLora_V2_1_1_6.lib_deps} densaugeo/base64 @ ~1.4.0 [env:LilyGo_TLora_V2_1_1_6_room_server] extends = LilyGo_TLora_V2_1_1_6 -build_src_filter = ${LilyGo_TLora_V2_1_1_6.build_src_filter} +<../examples/simple_room_server/main.cpp> +build_src_filter = ${LilyGo_TLora_V2_1_1_6.build_src_filter} + +<../examples/simple_room_server> build_flags = ${LilyGo_TLora_V2_1_1_6.build_flags} -D ADVERT_NAME="\"TLora-V2.1-1.6 Room\"" From 87d4285cf1ef37bbf17e93d6a6f3f9bff3ef1ceb Mon Sep 17 00:00:00 2001 From: Scott Powell Date: Sat, 8 Mar 2025 13:40:39 +1100 Subject: [PATCH 2/5] * doc updates --- README.md | 12 +++++++----- docs/faq.md | 1 + 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 97890ce8..0103da77 100644 --- a/README.md +++ b/README.md @@ -25,10 +25,11 @@ MeshCore provides the ability to create wireless mesh networks, similar to Mesht ## 🚀 How to Get Started -Flash the Firmware: Download the pre-built firmware binary for Heltec V3 and flash it using Adafruit ESPTool. -Install [PlatformIO](https://docs.platformio.org) in Visual Studio Code (optional for developers who want to modify the firmware). +Andy Kirby has published a very useful [intro video](https://www.youtube.com/watch?v=t1qne8uJBAc) which explains the steps for beginners. + +For developers, install [PlatformIO](https://docs.platformio.org) in Visual Studio Code. Download & Open the MeshCore repository. -Select a Sample Application: Choose from chat, ping, repeater, or admin test tools. +Select a Sample Application: Choose from chat, repeater, other example app. Monitor & Communicate using the Serial Monitor (e.g., Serial USB Terminal on Android). 📁 Included Example Applications @@ -36,8 +37,6 @@ Monitor & Communicate using the Serial Monitor (e.g., Serial USB Terminal on And * 📡 Simple Repeater: Extends network coverage by relaying messages. * 📡 Companion Radio: For use with an external chat app, over BLE or USB. * 📡 Room Server: A simple BBS server for shared Posts. -* 📡 Ping Client, Ping Server & Client: Basic client/server example. -* 📡 Test Admin: Monitors and manages repeaters remotely. ## 🛠 Hardware Compatibility @@ -49,6 +48,9 @@ MeshCore is designed for use with: * LilyGo T3S3 * Heltec T114 * Station G2 +* Sensecap T1000e +* Heltec V2 +* LilyGo TLora32 v1.6 ## 📜 License MeshCore is open-source software released under the MIT License. You are free to use, modify, and distribute it for personal and commercial projects. diff --git a/docs/faq.md b/docs/faq.md index a7169a0e..eb5fdf29 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -26,6 +26,7 @@ Anyone is able to build anything they like on top of MeshCore without paying any Phone Client Applications: https://meshcore.co.uk/apps.html MeshCore Fimrware Github: https://github.com/ripplebiz/MeshCore + NOTE: Andy Kirby has a very useful [intro video](https://www.youtube.com/watch?v=t1qne8uJBAc) for beginners. You need LoRa hardware devices to run MeshCore firmware as clients or server (repeater and room server). From 9b5a294695654d2dd4e39ff629e505149b6b5874 Mon Sep 17 00:00:00 2001 From: Scott Powell Date: Sat, 8 Mar 2025 20:18:15 +1100 Subject: [PATCH 3/5] * T1000e battery measure fix --- src/helpers/nrf52/T1000eBoard.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/helpers/nrf52/T1000eBoard.h b/src/helpers/nrf52/T1000eBoard.h index 14272edb..3c0f30b4 100644 --- a/src/helpers/nrf52/T1000eBoard.h +++ b/src/helpers/nrf52/T1000eBoard.h @@ -31,8 +31,13 @@ public: uint16_t getBattMilliVolts() override { #ifdef BATTERY_PIN + analogReference(AR_INTERNAL_3_0); analogReadResolution(12); float volts = (analogRead(BATTERY_PIN) * ADC_MULTIPLIER * AREF_VOLTAGE) / 4096; + + analogReference(AR_DEFAULT); // put back to default + analogReadResolution(10); + return volts * 1000; #else return 0; From 8f609524bda17154ec6290a570ad83ab5e82263e Mon Sep 17 00:00:00 2001 From: Scott Powell Date: Sun, 9 Mar 2025 15:41:32 +1100 Subject: [PATCH 4/5] * companion: added new PUSH_CODE_LOG_RX_DATA (0x88) for inspecting all received packets --- examples/companion_radio/main.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/examples/companion_radio/main.cpp b/examples/companion_radio/main.cpp index ea5efc5e..dd3b9e32 100644 --- a/examples/companion_radio/main.cpp +++ b/examples/companion_radio/main.cpp @@ -184,6 +184,7 @@ static uint32_t _atoi(const char* sp) { #define PUSH_CODE_LOGIN_SUCCESS 0x85 #define PUSH_CODE_LOGIN_FAIL 0x86 #define PUSH_CODE_STATUS_RESPONSE 0x87 +#define PUSH_CODE_LOG_RX_DATA 0x88 /* -------------------------------------------------------------------------------------- */ @@ -435,6 +436,24 @@ protected: return (int) ((pow(_prefs.rx_delay_base, 0.85f - score) - 1.0) * air_time); } + void logRx(mesh::Packet* pkt, int len, float score) override { + if (_serial->isConnected()) { + int i = 0; + out_frame[i++] = PUSH_CODE_LOG_RX_DATA; + out_frame[i++] = (int8_t)(_radio->getLastSNR() * 4); + out_frame[i++] = (int8_t)(_radio->getLastRSSI()); + if (pkt->isRouteFlood()) { + out_frame[i++] = pkt->path_len; + memcpy(&out_frame[i], pkt->path, pkt->path_len); i += pkt->path_len; + } else { + out_frame[i++] = 0xFF; + } + memcpy(&out_frame[i], pkt->payload, pkt->payload_len); i += pkt->payload_len; + + _serial->writeFrame(out_frame, i); + } + } + void onDiscoveredContact(ContactInfo& contact, bool is_new) override { if (_serial->isConnected()) { out_frame[0] = PUSH_CODE_ADVERT; From f77a6944f93738b67ad0dbac54ccd39cb0460f75 Mon Sep 17 00:00:00 2001 From: Scott Powell Date: Sun, 9 Mar 2025 17:04:22 +1100 Subject: [PATCH 5/5] * PUSH_CODE_LOG_RX_DATA: is now just: {snr*4},{rssi},{raw-lora-packet} --- examples/companion_radio/main.cpp | 14 ++++---------- src/Dispatcher.cpp | 4 +++- src/Dispatcher.h | 2 ++ 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/examples/companion_radio/main.cpp b/examples/companion_radio/main.cpp index dd3b9e32..10eca8c9 100644 --- a/examples/companion_radio/main.cpp +++ b/examples/companion_radio/main.cpp @@ -436,19 +436,13 @@ protected: return (int) ((pow(_prefs.rx_delay_base, 0.85f - score) - 1.0) * air_time); } - void logRx(mesh::Packet* pkt, int len, float score) override { + void logRxRaw(float snr, float rssi, const uint8_t raw[], int len) override { if (_serial->isConnected()) { int i = 0; out_frame[i++] = PUSH_CODE_LOG_RX_DATA; - out_frame[i++] = (int8_t)(_radio->getLastSNR() * 4); - out_frame[i++] = (int8_t)(_radio->getLastRSSI()); - if (pkt->isRouteFlood()) { - out_frame[i++] = pkt->path_len; - memcpy(&out_frame[i], pkt->path, pkt->path_len); i += pkt->path_len; - } else { - out_frame[i++] = 0xFF; - } - memcpy(&out_frame[i], pkt->payload, pkt->payload_len); i += pkt->payload_len; + out_frame[i++] = (int8_t)(snr * 4); + out_frame[i++] = (int8_t)(rssi); + memcpy(&out_frame[i], raw, len); i += len; _serial->writeFrame(out_frame, i); } diff --git a/src/Dispatcher.cpp b/src/Dispatcher.cpp index b9da0e65..e4943254 100644 --- a/src/Dispatcher.cpp +++ b/src/Dispatcher.cpp @@ -78,9 +78,11 @@ void Dispatcher::checkRecv() { float score; uint32_t air_time; { - uint8_t raw[MAX_TRANS_UNIT]; + uint8_t raw[MAX_TRANS_UNIT+1]; int len = _radio->recvRaw(raw, MAX_TRANS_UNIT); if (len > 0) { + logRxRaw(_radio->getLastSNR(), _radio->getLastRSSI(), raw, len); + pkt = _mgr->allocNew(); if (pkt == NULL) { MESH_DEBUG_PRINTLN("%s Dispatcher::checkRecv(): WARNING: received data, no unused packets available!", getLogDateTime()); diff --git a/src/Dispatcher.h b/src/Dispatcher.h index 7d75c219..0b00f1a9 100644 --- a/src/Dispatcher.h +++ b/src/Dispatcher.h @@ -117,6 +117,8 @@ protected: virtual DispatcherAction onRecvPacket(Packet* pkt) = 0; + virtual void logRxRaw(float snr, float rssi, const uint8_t raw[], int len) { } // custom hook + virtual void logRx(Packet* packet, int len, float score) { } // hooks for custom logging virtual void logTx(Packet* packet, int len) { } virtual void logTxFail(Packet* packet, int len) { }