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"
#endif
String versionDate = "2024.10.15";
String versionDate = "2024.10.21";
Configuration Config;
WiFiClient espClient;
#ifdef HAS_GPS

View File

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