1
0
forked from iarv/Meck

Compare commits

...

9 Commits

Author SHA1 Message Date
pelgraine 53fe89b216 "updated mymesh.h version type and date details" 2026-01-29 18:31:15 +11:00
pelgraine e194c2c48c Replace Serial.print with MESH_DEBUG macros for cleaner debug output in main cpp, tdeckboard cpp and target cpp 2026-01-29 18:28:19 +11:00
pelgraine 9d401f76d3 Updated readme.md
Revised Roadmap / To-Do to goals specific to this repo
2026-01-28 21:43:41 +11:00
pelgraine 15f392c80e Update readme.md
Removed specific references to v1.1 now that I've confirmed it works on my T-Deck v1.0 (audio only) as well
2026-01-28 21:13:31 +11:00
pelgraine 621f9f9568 "added line to readme about purchase date of v1.1" 2026-01-28 20:18:34 +11:00
pelgraine 8c9106ca86 "update readme" 2026-01-28 20:16:57 +11:00
pelgraine f4b9c89d9f "added and removed emoji variously to readme" 2026-01-28 20:15:44 +11:00
pelgraine a4f5328113 "Updated readme" 2026-01-28 20:12:53 +11:00
pelgraine 2ad02f49e6 “Fixed the max contacts 400, max channels 20, pin back to 123456 for randomisation that somehow got lost in the merge from dev to main” 2026-01-28 20:05:19 +11:00
6 changed files with 88 additions and 145 deletions
+18 -40
View File
@@ -1,13 +1,18 @@
## Meshcore + Fork = Meck
This fork was created specifically to focus on enabling BLE companion firmware for the LilyGo T-Deck Pro. Created with the assistance of Claude AI using Meshcore v1.11 code.
***Please note as of 28 Jan 2026, the T-Deck Pro repeater & usb firmware has not been finalised nor confirmed as functioning.*** ⭐
## About MeshCore ## About MeshCore
MeshCore is a lightweight, portable C++ library that enables multi-hop packet routing for embedded projects using LoRa and other packet radios. It is designed for developers who want to create resilient, decentralized communication networks that work without the internet. MeshCore is a lightweight, portable C++ library that enables multi-hop packet routing for embedded projects using LoRa and other packet radios. It is designed for developers who want to create resilient, decentralized communication networks that work without the internet.
## 🔍 What is MeshCore? ## What is MeshCore?
MeshCore now supports a range of LoRa devices, allowing for easy flashing without the need to compile firmware manually. Users can flash a pre-built binary using tools like Adafruit ESPTool and interact with the network through a serial console. MeshCore now supports a range of LoRa devices, allowing for easy flashing without the need to compile firmware manually. Users can flash a pre-built binary using tools like Adafruit ESPTool and interact with the network through a serial console.
MeshCore provides the ability to create wireless mesh networks, similar to Meshtastic and Reticulum but with a focus on lightweight multi-hop packet routing for embedded projects. Unlike Meshtastic, which is tailored for casual LoRa communication, or Reticulum, which offers advanced networking, MeshCore balances simplicity with scalability, making it ideal for custom embedded solutions., where devices (nodes) can communicate over long distances by relaying messages through intermediate nodes. This is especially useful in off-grid, emergency, or tactical situations where traditional communication infrastructure is unavailable. MeshCore provides the ability to create wireless mesh networks, similar to Meshtastic and Reticulum but with a focus on lightweight multi-hop packet routing for embedded projects. Unlike Meshtastic, which is tailored for casual LoRa communication, or Reticulum, which offers advanced networking, MeshCore balances simplicity with scalability, making it ideal for custom embedded solutions., where devices (nodes) can communicate over long distances by relaying messages through intermediate nodes. This is especially useful in off-grid, emergency, or tactical situations where traditional communication infrastructure is unavailable.
## Key Features ## Key Features
* Multi-Hop Packet Routing * Multi-Hop Packet Routing
* Devices can forward messages across multiple nodes, extending range beyond a single radio's reach. * Devices can forward messages across multiple nodes, extending range beyond a single radio's reach.
@@ -18,7 +23,7 @@ MeshCore provides the ability to create wireless mesh networks, similar to Mesht
* Low Power Consumption Ideal for battery-powered or solar-powered devices. * Low Power Consumption Ideal for battery-powered or solar-powered devices.
* Simple to Deploy Pre-built example applications make it easy to get started. * Simple to Deploy Pre-built example applications make it easy to get started.
## 🎯 What Can You Use MeshCore For? ## What Can You Use MeshCore For?
* Off-Grid Communication: Stay connected even in remote areas. * Off-Grid Communication: Stay connected even in remote areas.
* Emergency Response & Disaster Recovery: Set up instant networks where infrastructure is down. * Emergency Response & Disaster Recovery: Set up instant networks where infrastructure is down.
@@ -26,7 +31,7 @@ MeshCore provides the ability to create wireless mesh networks, similar to Mesht
* Tactical & Security Applications: Military, law enforcement, and private security use cases. * Tactical & Security Applications: Military, law enforcement, and private security use cases.
* IoT & Sensor Networks: Collect data from remote sensors and relay it back to a central location. * IoT & Sensor Networks: Collect data from remote sensors and relay it back to a central location.
## 🚀 How to Get Started ## How to Get Started
- Watch the [MeshCore Intro Video](https://www.youtube.com/watch?v=t1qne8uJBAc) by Andy Kirby. - Watch the [MeshCore Intro Video](https://www.youtube.com/watch?v=t1qne8uJBAc) by Andy Kirby.
- Read through our [Frequently Asked Questions](./docs/faq.md) section. - Read through our [Frequently Asked Questions](./docs/faq.md) section.
@@ -39,13 +44,8 @@ For developers;
- Clone and open the MeshCore repository in Visual Studio Code. - Clone and open the MeshCore repository in Visual Studio Code.
- See the example applications you can modify and run: - See the example applications you can modify and run:
- [Companion Radio](./examples/companion_radio) - For use with an external chat app, over BLE, USB or WiFi. - [Companion Radio](./examples/companion_radio) - For use with an external chat app, over BLE, USB or WiFi.
- [Simple Repeater](./examples/simple_repeater) - Extends network coverage by relaying messages.
- [Simple Room Server](./examples/simple_room_server) - A simple BBS server for shared Posts.
- [Simple Secure Chat](./examples/simple_secure_chat) - Secure terminal based text communication between devices.
The Simple Secure Chat example can be interacted with through the Serial Monitor in Visual Studio Code, or with a Serial USB Terminal on Android. ## MeshCore Flasher
## ⚡️ MeshCore Flasher
We have prebuilt firmware ready to flash on supported devices. We have prebuilt firmware ready to flash on supported devices.
@@ -55,7 +55,7 @@ We have prebuilt firmware ready to flash on supported devices.
- Companion, Repeater or Room Server - Companion, Repeater or Room Server
- Once flashing is complete, you can connect with one of the MeshCore clients below. - Once flashing is complete, you can connect with one of the MeshCore clients below.
## 📱 MeshCore Clients ## MeshCore Clients
**Companion Firmware** **Companion Firmware**
@@ -67,14 +67,6 @@ The companion firmware can be connected to via BLE, USB or WiFi depending on the
- NodeJS: https://github.com/liamcottle/meshcore.js - NodeJS: https://github.com/liamcottle/meshcore.js
- Python: https://github.com/fdlamotte/meshcore-cli - Python: https://github.com/fdlamotte/meshcore-cli
**Repeater and Room Server Firmware**
The repeater and room server firmwares can be setup via USB in the web config tool.
- https://config.meshcore.dev
They can also be managed via LoRa in the mobile app by using the Remote Management feature.
## 🛠 Hardware Compatibility ## 🛠 Hardware Compatibility
MeshCore is designed for devices listed in the [MeshCore Flasher](https://flasher.meshcore.co.uk) MeshCore is designed for devices listed in the [MeshCore Flasher](https://flasher.meshcore.co.uk)
@@ -95,30 +87,16 @@ Here are some general principals you should try to adhere to:
## Road-Map / To-Do ## Road-Map / To-Do
There are a number of fairly major features in the pipeline, with no particular time-frames attached yet. In very rough chronological order: There are a number of fairly major features in the pipeline, with no particular time-frames attached yet. In partly chronological order:
- [X] Companion radio: UI redesign - [X] Companion radio: BLE
- [ ] Repeater + Room Server: add ACL's (like Sensor Node has) - [ ] Companion radio: USB
- [ ] Standardise Bridge mode for repeaters - [ ] Simple Repeater firmware for the T-Deck Pro
- [ ] Repeater/Bridge: Standardise the Transport Codes for zoning/filtering - [ ] Get pin 45 with the screen backlight functioning for the T-Deck Pro v1.1
- [ ] Core + Repeater: enhanced zero-hop neighbour discovery - [ ] Canned messages function for Companion BLE firmware
- [ ] Core: round-trip manual path support - [ ] Text entry for Companion BLE firmware
- [ ] Companion + Apps: support for multiple sub-meshes (and 'off-grid' client repeat mode)
- [ ] Core + Apps: support for LZW message compression
- [ ] Core: dynamic CR (Coding Rate) for weak vs strong hops
- [ ] Core: new framework for hosting multiple virtual nodes on one physical device
- [ ] V2 protocol spec: discussion and consensus around V2 packet protocol, including path hashes, new encryption specs, etc
## 📞 Get Support ## 📞 Get Support
- Report bugs and request features on the [GitHub Issues](https://github.com/ripplebiz/MeshCore/issues) page.
- Find additional guides and components on [my site](https://buymeacoffee.com/ripplebiz).
- Join [MeshCore Discord](https://discord.gg/BMwCtwHj5V) to chat with the developers and get help from the community. - Join [MeshCore Discord](https://discord.gg/BMwCtwHj5V) to chat with the developers and get help from the community.
## RAK Wireless Board Support in PlatformIO
Before building/flashing the RAK4631 targets in this project, there is, unfortunately, some patching you have to do to your platformIO packages to make it work. There is a guide here on the process:
[RAK Wireless: How to Perform Installation of Board Support Package in PlatformIO](https://learn.rakwireless.com/hc/en-us/articles/26687276346775-How-To-Perform-Installation-of-Board-Support-Package-in-PlatformIO)
After building, you will need to convert the output firmware.hex file into a .uf2 file you can copy over to your RAK4631 device (after doing a full erase) by using the command `uf2conv.py -f 0xADA52840 -c firmware.hex` with the python script available from:
[GitHub: Microsoft - uf2](https://github.com/Microsoft/uf2/blob/master/utils/uf2conv.py)
+2 -2
View File
@@ -8,11 +8,11 @@
#define FIRMWARE_VER_CODE 8 #define FIRMWARE_VER_CODE 8
#ifndef FIRMWARE_BUILD_DATE #ifndef FIRMWARE_BUILD_DATE
#define FIRMWARE_BUILD_DATE "28 Jan 2026" #define FIRMWARE_BUILD_DATE "29 Jan 2026"
#endif #endif
#ifndef FIRMWARE_VERSION #ifndef FIRMWARE_VERSION
#define FIRMWARE_VERSION "Meck v0.3" #define FIRMWARE_VERSION "Meck v0.3.1"
#endif #endif
#if defined(NRF52_PLATFORM) || defined(STM32_PLATFORM) #if defined(NRF52_PLATFORM) || defined(STM32_PLATFORM)
+47 -67
View File
@@ -110,14 +110,14 @@ void halt() {
void setup() { void setup() {
Serial.begin(115200); Serial.begin(115200);
delay(100); // Give serial time to initialize delay(100); // Give serial time to initialize
Serial.println("=== setup() - STARTING ==="); MESH_DEBUG_PRINTLN("=== setup() - STARTING ===");
board.begin(); board.begin();
Serial.println("setup() - board.begin() done"); MESH_DEBUG_PRINTLN("setup() - board.begin() done");
#ifdef DISPLAY_CLASS #ifdef DISPLAY_CLASS
DisplayDriver* disp = NULL; DisplayDriver* disp = NULL;
Serial.println("setup() - about to call display.begin()"); MESH_DEBUG_PRINTLN("setup() - about to call display.begin()");
// ========================================================================= // =========================================================================
// T-Deck Pro V1.1: Initialize E-Ink reset pin BEFORE display.begin() // T-Deck Pro V1.1: Initialize E-Ink reset pin BEFORE display.begin()
@@ -127,7 +127,7 @@ void setup() {
// Initialize E-Ink reset pin (GPIO 16) // Initialize E-Ink reset pin (GPIO 16)
pinMode(PIN_DISPLAY_RST, OUTPUT); pinMode(PIN_DISPLAY_RST, OUTPUT);
digitalWrite(PIN_DISPLAY_RST, HIGH); digitalWrite(PIN_DISPLAY_RST, HIGH);
Serial.println("setup() - E-Ink reset pin initialized"); MESH_DEBUG_PRINTLN("setup() - E-Ink reset pin initialized");
// Initialize Touch reset pin (GPIO 38) // Initialize Touch reset pin (GPIO 38)
#ifdef CST328_PIN_RST #ifdef CST328_PIN_RST
@@ -138,13 +138,13 @@ void setup() {
delay(80); delay(80);
digitalWrite(CST328_PIN_RST, HIGH); digitalWrite(CST328_PIN_RST, HIGH);
delay(20); delay(20);
Serial.println("setup() - Touch reset pin initialized"); MESH_DEBUG_PRINTLN("setup() - Touch reset pin initialized");
#endif #endif
#endif #endif
// ========================================================================= // =========================================================================
if (display.begin()) { if (display.begin()) {
Serial.println("setup() - display.begin() returned true"); MESH_DEBUG_PRINTLN("setup() - display.begin() returned true");
disp = &display; disp = &display;
disp->startFrame(); disp->startFrame();
#ifdef ST7789 #ifdef ST7789
@@ -152,25 +152,25 @@ void setup() {
#endif #endif
disp->drawTextCentered(disp->width() / 2, 28, "Loading..."); disp->drawTextCentered(disp->width() / 2, 28, "Loading...");
disp->endFrame(); disp->endFrame();
Serial.println("setup() - Loading screen drawn"); MESH_DEBUG_PRINTLN("setup() - Loading screen drawn");
} else { } else {
Serial.println("setup() - display.begin() returned false!"); MESH_DEBUG_PRINTLN("setup() - display.begin() returned false!");
} }
#endif #endif
Serial.println("setup() - about to call radio_init()"); MESH_DEBUG_PRINTLN("setup() - about to call radio_init()");
if (!radio_init()) { if (!radio_init()) {
Serial.println("setup() - radio_init() FAILED! Halting."); MESH_DEBUG_PRINTLN("setup() - radio_init() FAILED! Halting.");
halt(); halt();
} }
Serial.println("setup() - radio_init() done"); MESH_DEBUG_PRINTLN("setup() - radio_init() done");
Serial.println("setup() - about to call fast_rng.begin()"); MESH_DEBUG_PRINTLN("setup() - about to call fast_rng.begin()");
fast_rng.begin(radio_get_rng_seed()); fast_rng.begin(radio_get_rng_seed());
Serial.println("setup() - fast_rng.begin() done"); MESH_DEBUG_PRINTLN("setup() - fast_rng.begin() done");
#if defined(NRF52_PLATFORM) || defined(STM32_PLATFORM) #if defined(NRF52_PLATFORM) || defined(STM32_PLATFORM)
Serial.println("setup() - NRF52/STM32 filesystem init"); MESH_DEBUG_PRINTLN("setup() - NRF52/STM32 filesystem init");
InternalFS.begin(); InternalFS.begin();
#if defined(QSPIFLASH) #if defined(QSPIFLASH)
if (!QSPIFlash.begin()) { if (!QSPIFlash.begin()) {
@@ -183,11 +183,11 @@ void setup() {
ExtraFS.begin(); ExtraFS.begin();
#endif #endif
#endif #endif
Serial.println("setup() - about to call store.begin()"); MESH_DEBUG_PRINTLN("setup() - about to call store.begin()");
store.begin(); store.begin();
Serial.println("setup() - store.begin() done"); MESH_DEBUG_PRINTLN("setup() - store.begin() done");
Serial.println("setup() - about to call the_mesh.begin()"); MESH_DEBUG_PRINTLN("setup() - about to call the_mesh.begin()");
the_mesh.begin( the_mesh.begin(
#ifdef DISPLAY_CLASS #ifdef DISPLAY_CLASS
disp != NULL disp != NULL
@@ -195,27 +195,27 @@ void setup() {
false false
#endif #endif
); );
Serial.println("setup() - the_mesh.begin() done"); MESH_DEBUG_PRINTLN("setup() - the_mesh.begin() done");
#ifdef BLE_PIN_CODE #ifdef BLE_PIN_CODE
Serial.println("setup() - about to call serial_interface.begin() with BLE"); MESH_DEBUG_PRINTLN("setup() - about to call serial_interface.begin() with BLE");
serial_interface.begin(BLE_NAME_PREFIX, the_mesh.getNodePrefs()->node_name, the_mesh.getBLEPin()); serial_interface.begin(BLE_NAME_PREFIX, the_mesh.getNodePrefs()->node_name, the_mesh.getBLEPin());
Serial.println("setup() - serial_interface.begin() done"); MESH_DEBUG_PRINTLN("setup() - serial_interface.begin() done");
#else #else
serial_interface.begin(Serial); serial_interface.begin(Serial);
#endif #endif
Serial.println("setup() - about to call the_mesh.startInterface()"); MESH_DEBUG_PRINTLN("setup() - about to call the_mesh.startInterface()");
the_mesh.startInterface(serial_interface); the_mesh.startInterface(serial_interface);
Serial.println("setup() - the_mesh.startInterface() done"); MESH_DEBUG_PRINTLN("setup() - the_mesh.startInterface() done");
#elif defined(RP2040_PLATFORM) #elif defined(RP2040_PLATFORM)
Serial.println("setup() - RP2040 filesystem init"); MESH_DEBUG_PRINTLN("setup() - RP2040 filesystem init");
LittleFS.begin(); LittleFS.begin();
Serial.println("setup() - about to call store.begin()"); MESH_DEBUG_PRINTLN("setup() - about to call store.begin()");
store.begin(); store.begin();
Serial.println("setup() - store.begin() done"); MESH_DEBUG_PRINTLN("setup() - store.begin() done");
Serial.println("setup() - about to call the_mesh.begin()"); MESH_DEBUG_PRINTLN("setup() - about to call the_mesh.begin()");
the_mesh.begin( the_mesh.begin(
#ifdef DISPLAY_CLASS #ifdef DISPLAY_CLASS
disp != NULL disp != NULL
@@ -223,7 +223,7 @@ void setup() {
false false
#endif #endif
); );
Serial.println("setup() - the_mesh.begin() done"); MESH_DEBUG_PRINTLN("setup() - the_mesh.begin() done");
//#ifdef WIFI_SSID //#ifdef WIFI_SSID
// WiFi.begin(WIFI_SSID, WIFI_PWD); // WiFi.begin(WIFI_SSID, WIFI_PWD);
@@ -239,20 +239,20 @@ void setup() {
#else #else
serial_interface.begin(Serial); serial_interface.begin(Serial);
#endif #endif
Serial.println("setup() - about to call the_mesh.startInterface()"); MESH_DEBUG_PRINTLN("setup() - about to call the_mesh.startInterface()");
the_mesh.startInterface(serial_interface); the_mesh.startInterface(serial_interface);
Serial.println("setup() - the_mesh.startInterface() done"); MESH_DEBUG_PRINTLN("setup() - the_mesh.startInterface() done");
#elif defined(ESP32) #elif defined(ESP32)
Serial.println("setup() - ESP32 filesystem init - calling SPIFFS.begin()"); MESH_DEBUG_PRINTLN("setup() - ESP32 filesystem init - calling SPIFFS.begin()");
SPIFFS.begin(true); SPIFFS.begin(true);
Serial.println("setup() - SPIFFS.begin() done"); MESH_DEBUG_PRINTLN("setup() - SPIFFS.begin() done");
Serial.println("setup() - about to call store.begin()"); MESH_DEBUG_PRINTLN("setup() - about to call store.begin()");
store.begin(); store.begin();
Serial.println("setup() - store.begin() done"); MESH_DEBUG_PRINTLN("setup() - store.begin() done");
Serial.println("setup() - about to call the_mesh.begin()"); MESH_DEBUG_PRINTLN("setup() - about to call the_mesh.begin()");
the_mesh.begin( the_mesh.begin(
#ifdef DISPLAY_CLASS #ifdef DISPLAY_CLASS
disp != NULL disp != NULL
@@ -260,16 +260,16 @@ void setup() {
false false
#endif #endif
); );
Serial.println("setup() - the_mesh.begin() done"); MESH_DEBUG_PRINTLN("setup() - the_mesh.begin() done");
#ifdef WIFI_SSID #ifdef WIFI_SSID
Serial.println("setup() - WiFi mode"); MESH_DEBUG_PRINTLN("setup() - WiFi mode");
WiFi.begin(WIFI_SSID, WIFI_PWD); WiFi.begin(WIFI_SSID, WIFI_PWD);
serial_interface.begin(TCP_PORT); serial_interface.begin(TCP_PORT);
#elif defined(BLE_PIN_CODE) #elif defined(BLE_PIN_CODE)
Serial.println("setup() - about to call serial_interface.begin() with BLE"); MESH_DEBUG_PRINTLN("setup() - about to call serial_interface.begin() with BLE");
serial_interface.begin(BLE_NAME_PREFIX, the_mesh.getNodePrefs()->node_name, the_mesh.getBLEPin()); serial_interface.begin(BLE_NAME_PREFIX, the_mesh.getNodePrefs()->node_name, the_mesh.getBLEPin());
Serial.println("setup() - serial_interface.begin() done"); MESH_DEBUG_PRINTLN("setup() - serial_interface.begin() done");
#elif defined(SERIAL_RX) #elif defined(SERIAL_RX)
companion_serial.setPins(SERIAL_RX, SERIAL_TX); companion_serial.setPins(SERIAL_RX, SERIAL_TX);
companion_serial.begin(115200); companion_serial.begin(115200);
@@ -277,30 +277,30 @@ void setup() {
#else #else
serial_interface.begin(Serial); serial_interface.begin(Serial);
#endif #endif
Serial.println("setup() - about to call the_mesh.startInterface()"); MESH_DEBUG_PRINTLN("setup() - about to call the_mesh.startInterface()");
the_mesh.startInterface(serial_interface); the_mesh.startInterface(serial_interface);
Serial.println("setup() - the_mesh.startInterface() done"); MESH_DEBUG_PRINTLN("setup() - the_mesh.startInterface() done");
#else #else
#error "need to define filesystem" #error "need to define filesystem"
#endif #endif
Serial.println("setup() - about to call sensors.begin()"); MESH_DEBUG_PRINTLN("setup() - about to call sensors.begin()");
sensors.begin(); sensors.begin();
Serial.println("setup() - sensors.begin() done"); MESH_DEBUG_PRINTLN("setup() - sensors.begin() done");
// IMPORTANT: sensors.begin() calls initBasicGPS() which steals the GPS pins for Serial1 // IMPORTANT: sensors.begin() calls initBasicGPS() which steals the GPS pins for Serial1
// We need to reinitialize Serial2 to reclaim them // We need to reinitialize Serial2 to reclaim them
#if HAS_GPS #if HAS_GPS
Serial2.end(); // Close any existing Serial2 Serial2.end(); // Close any existing Serial2
Serial2.begin(GPS_BAUDRATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); Serial2.begin(GPS_BAUDRATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN);
Serial.println("setup() - Reinitialized Serial2 for GPS after sensors.begin()"); MESH_DEBUG_PRINTLN("setup() - Reinitialized Serial2 for GPS after sensors.begin()");
#endif #endif
#ifdef DISPLAY_CLASS #ifdef DISPLAY_CLASS
Serial.println("setup() - about to call ui_task.begin()"); MESH_DEBUG_PRINTLN("setup() - about to call ui_task.begin()");
ui_task.begin(disp, &sensors, the_mesh.getNodePrefs()); ui_task.begin(disp, &sensors, the_mesh.getNodePrefs());
Serial.println("setup() - ui_task.begin() done"); MESH_DEBUG_PRINTLN("setup() - ui_task.begin() done");
#endif #endif
// Enable GPS by default on T-Deck Pro // Enable GPS by default on T-Deck Pro
@@ -309,10 +309,10 @@ void setup() {
sensors.setSettingValue("gps", "1"); sensors.setSettingValue("gps", "1");
the_mesh.getNodePrefs()->gps_enabled = 1; the_mesh.getNodePrefs()->gps_enabled = 1;
the_mesh.savePrefs(); the_mesh.savePrefs();
Serial.println("setup() - GPS enabled by default"); MESH_DEBUG_PRINTLN("setup() - GPS enabled by default");
#endif #endif
Serial.println("=== setup() - COMPLETE ==="); MESH_DEBUG_PRINTLN("=== setup() - COMPLETE ===");
} }
void loop() { void loop() {
@@ -322,24 +322,4 @@ void loop() {
ui_task.loop(); ui_task.loop();
#endif #endif
rtc_clock.tick(); rtc_clock.tick();
// Debug: Check for GPS data on Serial2
#if HAS_GPS
static unsigned long lastGpsDebug = 0;
if (millis() - lastGpsDebug > 5000) { // Every 5 seconds
lastGpsDebug = millis();
Serial.print("GPS Debug - Serial2 available: ");
Serial.print(Serial2.available());
Serial.print(" bytes");
LocationProvider* loc = sensors.getLocationProvider();
if (loc) {
Serial.print(", valid: ");
Serial.print(loc->isValid() ? "YES" : "NO");
Serial.print(", sats: ");
Serial.println(loc->satellitesCount());
} else {
Serial.println(", LocationProvider: NULL");
}
}
#endif
} }
+11 -14
View File
@@ -1,24 +1,25 @@
#include <Arduino.h> #include <Arduino.h>
#include "variant.h" #include "variant.h"
#include "TDeckBoard.h" #include "TDeckBoard.h"
#include <Mesh.h> // For MESH_DEBUG_PRINTLN
uint32_t deviceOnline = 0x00; uint32_t deviceOnline = 0x00;
void TDeckBoard::begin() { void TDeckBoard::begin() {
Serial.println("TDeckBoard::begin() - starting"); MESH_DEBUG_PRINTLN("TDeckBoard::begin() - starting");
// Enable peripheral power (keyboard, sensors, etc.) FIRST // Enable peripheral power (keyboard, sensors, etc.) FIRST
// This powers the BQ27220 fuel gauge and other I2C devices // This powers the BQ27220 fuel gauge and other I2C devices
pinMode(PIN_PERF_POWERON, OUTPUT); pinMode(PIN_PERF_POWERON, OUTPUT);
digitalWrite(PIN_PERF_POWERON, HIGH); digitalWrite(PIN_PERF_POWERON, HIGH);
delay(50); // Allow peripherals to power up before I2C init delay(50); // Allow peripherals to power up before I2C init
Serial.println("TDeckBoard::begin() - peripheral power enabled"); MESH_DEBUG_PRINTLN("TDeckBoard::begin() - peripheral power enabled");
// Initialize I2C with correct pins for T-Deck Pro // Initialize I2C with correct pins for T-Deck Pro
Wire.begin(I2C_SDA, I2C_SCL); Wire.begin(I2C_SDA, I2C_SCL);
Wire.setClock(100000); // 100kHz for reliable fuel gauge communication Wire.setClock(100000); // 100kHz for reliable fuel gauge communication
Serial.println("TDeckBoard::begin() - I2C initialized"); MESH_DEBUG_PRINTLN("TDeckBoard::begin() - I2C initialized");
// Now call parent class begin (after power and I2C are ready) // Now call parent class begin (after power and I2C are ready)
ESP32Board::begin(); ESP32Board::begin();
@@ -28,7 +29,7 @@ void TDeckBoard::begin() {
pinMode(P_LORA_EN, OUTPUT); pinMode(P_LORA_EN, OUTPUT);
digitalWrite(P_LORA_EN, HIGH); digitalWrite(P_LORA_EN, HIGH);
delay(10); // Allow module to power up delay(10); // Allow module to power up
Serial.println("TDeckBoard::begin() - LoRa power enabled"); MESH_DEBUG_PRINTLN("TDeckBoard::begin() - LoRa power enabled");
#endif #endif
// Enable GPS module power and initialize Serial2 // Enable GPS module power and initialize Serial2
@@ -37,14 +38,12 @@ void TDeckBoard::begin() {
pinMode(PIN_GPS_EN, OUTPUT); pinMode(PIN_GPS_EN, OUTPUT);
digitalWrite(PIN_GPS_EN, GPS_EN_ACTIVE); // GPS_EN_ACTIVE is 1 (HIGH) digitalWrite(PIN_GPS_EN, GPS_EN_ACTIVE); // GPS_EN_ACTIVE is 1 (HIGH)
delay(100); // Allow GPS to power up delay(100); // Allow GPS to power up
Serial.println("TDeckBoard::begin() - GPS power enabled"); MESH_DEBUG_PRINTLN("TDeckBoard::begin() - GPS power enabled");
#endif #endif
// Initialize Serial2 for GPS with correct pins // Initialize Serial2 for GPS with correct pins
Serial2.begin(GPS_BAUDRATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); Serial2.begin(GPS_BAUDRATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN);
Serial.print("TDeckBoard::begin() - GPS Serial2 initialized at "); MESH_DEBUG_PRINTLN("TDeckBoard::begin() - GPS Serial2 initialized at %d baud", GPS_BAUDRATE);
Serial.print(GPS_BAUDRATE);
Serial.println(" baud");
#endif #endif
// Configure user button // Configure user button
@@ -68,12 +67,10 @@ void TDeckBoard::begin() {
// Test BQ27220 communication // Test BQ27220 communication
#if HAS_BQ27220 #if HAS_BQ27220
uint16_t voltage = getBattMilliVolts(); uint16_t voltage = getBattMilliVolts();
Serial.print("TDeckBoard::begin() - Battery voltage: "); MESH_DEBUG_PRINTLN("TDeckBoard::begin() - Battery voltage: %d mV", voltage);
Serial.print(voltage);
Serial.println(" mV");
#endif #endif
Serial.println("TDeckBoard::begin() - complete"); MESH_DEBUG_PRINTLN("TDeckBoard::begin() - complete");
} }
uint16_t TDeckBoard::getBattMilliVolts() { uint16_t TDeckBoard::getBattMilliVolts() {
@@ -81,13 +78,13 @@ uint16_t TDeckBoard::getBattMilliVolts() {
Wire.beginTransmission(BQ27220_I2C_ADDR); Wire.beginTransmission(BQ27220_I2C_ADDR);
Wire.write(BQ27220_REG_VOLTAGE); Wire.write(BQ27220_REG_VOLTAGE);
if (Wire.endTransmission(false) != 0) { if (Wire.endTransmission(false) != 0) {
Serial.println("BQ27220: I2C error reading voltage"); MESH_DEBUG_PRINTLN("BQ27220: I2C error reading voltage");
return 0; return 0;
} }
uint8_t count = Wire.requestFrom((uint8_t)BQ27220_I2C_ADDR, (uint8_t)2); uint8_t count = Wire.requestFrom((uint8_t)BQ27220_I2C_ADDR, (uint8_t)2);
if (count != 2) { if (count != 2) {
Serial.println("BQ27220: Read error - wrong byte count"); MESH_DEBUG_PRINTLN("BQ27220: Read error - wrong byte count");
return 0; return 0;
} }
+3 -3
View File
@@ -113,9 +113,9 @@ extends = LilyGo_TDeck_Pro
build_flags = build_flags =
${LilyGo_TDeck_Pro.build_flags} ${LilyGo_TDeck_Pro.build_flags}
-I examples/companion_radio/ui-new -I examples/companion_radio/ui-new
-D MAX_CONTACTS=350 -D MAX_CONTACTS=400
-D MAX_GROUP_CHANNELS=40 -D MAX_GROUP_CHANNELS=20
-D BLE_PIN_CODE=234567 -D BLE_PIN_CODE=123456
-D OFFLINE_QUEUE_SIZE=256 -D OFFLINE_QUEUE_SIZE=256
build_src_filter = ${LilyGo_TDeck_Pro.build_src_filter} build_src_filter = ${LilyGo_TDeck_Pro.build_src_filter}
+<helpers/esp32/*.cpp> +<helpers/esp32/*.cpp>
+7 -19
View File
@@ -19,10 +19,8 @@ AutoDiscoverRTCClock rtc_clock(fallback_clock);
#if HAS_GPS #if HAS_GPS
MicroNMEALocationProvider gps(Serial2, &rtc_clock); MicroNMEALocationProvider gps(Serial2, &rtc_clock);
EnvironmentSensorManager sensors(gps); EnvironmentSensorManager sensors(gps);
#pragma message "GPS enabled - using EnvironmentSensorManager with MicroNMEALocationProvider"
#else #else
SensorManager sensors; SensorManager sensors;
#pragma message "GPS disabled - using basic SensorManager"
#endif #endif
#ifdef DISPLAY_CLASS #ifdef DISPLAY_CLASS
@@ -31,37 +29,27 @@ AutoDiscoverRTCClock rtc_clock(fallback_clock);
#endif #endif
bool radio_init() { bool radio_init() {
Serial.println("radio_init() - starting"); MESH_DEBUG_PRINTLN("radio_init() - starting");
// NOTE: board.begin() is called by main.cpp setup() before radio_init() // NOTE: board.begin() is called by main.cpp setup() before radio_init()
// I2C is already initialized there with correct pins // I2C is already initialized there with correct pins
fallback_clock.begin(); fallback_clock.begin();
Serial.println("radio_init() - fallback_clock started"); MESH_DEBUG_PRINTLN("radio_init() - fallback_clock started");
// Wire already initialized in board.begin() - just use it for RTC // Wire already initialized in board.begin() - just use it for RTC
rtc_clock.begin(Wire); rtc_clock.begin(Wire);
Serial.println("radio_init() - rtc_clock started"); MESH_DEBUG_PRINTLN("radio_init() - rtc_clock started");
// Debug GPS status
#if HAS_GPS
Serial.println("radio_init() - HAS_GPS is defined");
Serial.print("radio_init() - gps object address: ");
Serial.println((uint32_t)&gps, HEX);
#else
Serial.println("radio_init() - HAS_GPS is NOT defined");
#endif
#if defined(P_LORA_SCLK) #if defined(P_LORA_SCLK)
Serial.println("radio_init() - initializing LoRa SPI..."); MESH_DEBUG_PRINTLN("radio_init() - initializing LoRa SPI...");
loraSpi.begin(P_LORA_SCLK, P_LORA_MISO, P_LORA_MOSI, P_LORA_NSS); loraSpi.begin(P_LORA_SCLK, P_LORA_MISO, P_LORA_MOSI, P_LORA_NSS);
Serial.println("radio_init() - SPI initialized, calling radio.std_init()..."); MESH_DEBUG_PRINTLN("radio_init() - SPI initialized, calling radio.std_init()...");
bool result = radio.std_init(&loraSpi); bool result = radio.std_init(&loraSpi);
Serial.print("radio_init() - radio.std_init() returned: "); MESH_DEBUG_PRINTLN("radio_init() - radio.std_init() returned: %s", result ? "SUCCESS" : "FAILED");
Serial.println(result ? "SUCCESS" : "FAILED");
return result; return result;
#else #else
Serial.println("radio_init() - calling radio.std_init() without custom SPI..."); MESH_DEBUG_PRINTLN("radio_init() - calling radio.std_init() without custom SPI...");
return radio.std_init(); return radio.std_init();
#endif #endif
} }