Skip to content

Commit

Permalink
testing GPS
Browse files Browse the repository at this point in the history
  • Loading branch information
richonguzman committed Oct 21, 2024
1 parent 0defd5b commit 5a1c6e7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/LoRa_APRS_iGate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
21 changes: 14 additions & 7 deletions src/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ bool sendStartTelemetry = true;
bool beaconUpdate = true;
uint32_t lastBeaconTx = 0;
uint32_t lastScreenOn = millis();
String beaconPacket;
String secondaryBeaconPacket;


namespace Utils {
Expand Down Expand Up @@ -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++) {
Expand Down Expand Up @@ -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);
Expand All @@ -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();
Expand Down

0 comments on commit 5a1c6e7

Please sign in to comment.