testing GPS

This commit is contained in:
richonguzman 2024-10-21 08:28:35 -03:00
parent 0defd5b289
commit 5a1c6e7ed9
2 changed files with 15 additions and 8 deletions

View File

@ -40,7 +40,7 @@ ________________________________________________________________________________
#include "A7670_utils.h" #include "A7670_utils.h"
#endif #endif
String versionDate = "2024.10.15"; String versionDate = "2024.10.21";
Configuration Config; Configuration Config;
WiFiClient espClient; WiFiClient espClient;
#ifdef HAS_GPS #ifdef HAS_GPS

View File

@ -45,6 +45,8 @@ bool sendStartTelemetry = true;
bool beaconUpdate = true; bool beaconUpdate = true;
uint32_t lastBeaconTx = 0; uint32_t lastBeaconTx = 0;
uint32_t lastScreenOn = millis(); uint32_t lastScreenOn = millis();
String beaconPacket;
String secondaryBeaconPacket;
namespace Utils { namespace Utils {
@ -109,7 +111,6 @@ namespace Utils {
fourthLine.concat(String(lastHeardStations.size())); fourthLine.concat(String(lastHeardStations.size()));
} }
void sendInitialTelemetryPackets() { void sendInitialTelemetryPackets() {
String sender = Config.callsign; String sender = Config.callsign;
for (int i = sender.length(); i < 9; i++) { for (int i = sender.length(); i < 9; i++) {
@ -178,13 +179,19 @@ namespace Utils {
sendStartTelemetry = false; sendStartTelemetry = false;
} }
void checkBeaconInterval() { void checkBeaconInterval() {
uint32_t lastTx = millis() - lastBeaconTx; uint32_t lastTx = millis() - lastBeaconTx;
if (lastBeaconTx == 0 || lastTx >= Config.beacon.interval * 60 * 1000) { if (lastBeaconTx == 0 || lastTx >= Config.beacon.interval * 60 * 1000) {
beaconUpdate = true; beaconUpdate = true;
} }
#ifdef HAS_GPS
if (Config.beacon.gpsActive && gps.location.lat() == 0.0 && gps.location.lng() == 0.0) {
GPS_Utils::getData();
beaconUpdate = false;
}
#endif
if (beaconUpdate) { if (beaconUpdate) {
if (!Config.display.alwaysOn && Config.display.timeout != 0) { if (!Config.display.alwaysOn && Config.display.timeout != 0) {
displayToggle(true); displayToggle(true);
@ -198,19 +205,19 @@ namespace Utils {
activeStations(); activeStations();
String beaconPacket = iGateBeaconPacket; beaconPacket = iGateBeaconPacket;
String secondaryBeaconPacket = iGateLoRaBeaconPacket; secondaryBeaconPacket = iGateLoRaBeaconPacket;
#ifdef HAS_GPS #ifdef HAS_GPS
if (Config.beacon.gpsActive && !Config.digi.ecoMode) { if (Config.beacon.gpsActive && !Config.digi.ecoMode) {
GPS_Utils::getData(); GPS_Utils::getData();
if (gps.location.isUpdated()) { if (gps.location.isUpdated() && gps.location.lat() != 0.0 && gps.location.lng() != 0.0) {
GPS_Utils::generateBeaconFirstPart(); GPS_Utils::generateBeaconFirstPart();
String encodedGPS = GPS_Utils::encodeGPS(gps.location.lat(), gps.location.lng(), Config.beacon.overlay, Config.beacon.symbol); String encodedGPS = GPS_Utils::encodeGPS(gps.location.lat(), gps.location.lng(), Config.beacon.overlay, Config.beacon.symbol);
beaconPacket = iGateBeaconPacket + encodedGPS; beaconPacket = iGateBeaconPacket + encodedGPS;
secondaryBeaconPacket = iGateLoRaBeaconPacket + encodedGPS; secondaryBeaconPacket = iGateLoRaBeaconPacket + encodedGPS;
} }
} }
#endif #endif
if (Config.wxsensor.active && wxModuleType != 0) { if (Config.wxsensor.active && wxModuleType != 0) {
String sensorData = WX_Utils::readDataSensor(); String sensorData = WX_Utils::readDataSensor();