mirror of
https://github.com/pelgraine/Meck.git
synced 2026-08-05 16:22:45 +02:00
”Amend mymesh.h to Meck v0.3 || ‘target.h’ - Added #include "variant.h" at the top to ensure HAS_GPS is always defined before the conditional includes || target.cpp - Added debug output to verify HAS_GPS is defined at compile and runtime || ‘TDeckBoard.h’ - Added #include "variant.h" for pin definitions || Added #include "variant.h" to ‘main.cpp’ to ensure HAS_GPS is defined || Added code to ‘main.cpp’ to enable GPS by default after sensors.begin() as longpress not currently functional for gps toggle || Changed battery icon size in ‘uitask.cpp’ from 24 to 22 width and 10 to 8 height.”
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
#endif
|
||||
|
||||
#ifndef FIRMWARE_VERSION
|
||||
#define FIRMWARE_VERSION "Meck v0.2"
|
||||
#define FIRMWARE_VERSION "Meck v0.3"
|
||||
#endif
|
||||
|
||||
#if defined(NRF52_PLATFORM) || defined(STM32_PLATFORM)
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#include <Arduino.h> // needed for PlatformIO
|
||||
#include <Mesh.h>
|
||||
#include "MyMesh.h"
|
||||
#include "variant.h" // Board-specific defines (HAS_GPS, etc.)
|
||||
#include "target.h" // For sensors, board, etc.
|
||||
|
||||
// Believe it or not, this std C function is busted on some platforms!
|
||||
static uint32_t _atoi(const char* sp) {
|
||||
@@ -287,12 +289,29 @@ void setup() {
|
||||
sensors.begin();
|
||||
Serial.println("setup() - sensors.begin() done");
|
||||
|
||||
// IMPORTANT: sensors.begin() calls initBasicGPS() which steals the GPS pins for Serial1
|
||||
// We need to reinitialize Serial2 to reclaim them
|
||||
#if HAS_GPS
|
||||
Serial2.end(); // Close any existing Serial2
|
||||
Serial2.begin(GPS_BAUDRATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN);
|
||||
Serial.println("setup() - Reinitialized Serial2 for GPS after sensors.begin()");
|
||||
#endif
|
||||
|
||||
#ifdef DISPLAY_CLASS
|
||||
Serial.println("setup() - about to call ui_task.begin()");
|
||||
ui_task.begin(disp, &sensors, the_mesh.getNodePrefs());
|
||||
Serial.println("setup() - ui_task.begin() done");
|
||||
#endif
|
||||
|
||||
// Enable GPS by default on T-Deck Pro
|
||||
#if HAS_GPS
|
||||
// Set GPS enabled in both sensor manager and node prefs
|
||||
sensors.setSettingValue("gps", "1");
|
||||
the_mesh.getNodePrefs()->gps_enabled = 1;
|
||||
the_mesh.savePrefs();
|
||||
Serial.println("setup() - GPS enabled by default");
|
||||
#endif
|
||||
|
||||
Serial.println("=== setup() - COMPLETE ===");
|
||||
}
|
||||
|
||||
@@ -303,4 +322,24 @@ void loop() {
|
||||
ui_task.loop();
|
||||
#endif
|
||||
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
|
||||
}
|
||||
@@ -111,8 +111,8 @@ class HomeScreen : public UIScreen {
|
||||
if (batteryPercentage > 100) batteryPercentage = 100; // Clamp to 100%
|
||||
|
||||
// battery icon
|
||||
int iconWidth = 24;
|
||||
int iconHeight = 10;
|
||||
int iconWidth = 22;
|
||||
int iconHeight = 8;
|
||||
int iconX = display.width() - iconWidth - 5; // Position the icon near the top-right corner
|
||||
int iconY = 0;
|
||||
display.setColor(DisplayDriver::GREEN);
|
||||
|
||||
Reference in New Issue
Block a user