fixing minor things to start testing if it does smartbeacon
This commit is contained in:
parent
c119f1346f
commit
78c70af472
|
|
@ -46,7 +46,7 @@ TinyGPSPlus gps;
|
||||||
OneButton userButton = OneButton(BUTTON_PIN, true, true);
|
OneButton userButton = OneButton(BUTTON_PIN, true, true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
String versionDate = "2024.07.24";
|
String versionDate = "2024.07.25";
|
||||||
|
|
||||||
uint8_t myBeaconsIndex = 0;
|
uint8_t myBeaconsIndex = 0;
|
||||||
int myBeaconsSize = Config.beacons.size();
|
int myBeaconsSize = Config.beacons.size();
|
||||||
|
|
@ -88,9 +88,9 @@ bool smartBeaconValue = true;
|
||||||
|
|
||||||
int ackRequestNumber;
|
int ackRequestNumber;
|
||||||
|
|
||||||
extern bool wakeUpFlag;
|
uint32_t lastGPSCheck = 0;
|
||||||
extern bool wakeUpByButton;
|
uint32_t lastGPSTime = 0;
|
||||||
extern uint32_t wakeUpByButtonTime;
|
|
||||||
|
|
||||||
APRSPacket lastReceivedPacket;
|
APRSPacket lastReceivedPacket;
|
||||||
|
|
||||||
|
|
@ -204,7 +204,7 @@ void loop() {
|
||||||
STATION_Utils::checkTelemetryTx();
|
STATION_Utils::checkTelemetryTx();
|
||||||
}
|
}
|
||||||
lastTx = millis() - lastTxTime;
|
lastTx = millis() - lastTxTime;
|
||||||
|
lastGPSCheck = millis() - lastGPSTime;
|
||||||
if (!sendUpdate && gps_loc_update && smartBeaconValue) {
|
if (!sendUpdate && gps_loc_update && smartBeaconValue) {
|
||||||
GPS_Utils::calculateDistanceTraveled();
|
GPS_Utils::calculateDistanceTraveled();
|
||||||
if (!sendUpdate) {
|
if (!sendUpdate) {
|
||||||
|
|
@ -222,9 +222,9 @@ void loop() {
|
||||||
refreshDisplayTime = millis();
|
refreshDisplayTime = millis();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (millis() > lastTxTime + txInterval) {
|
if (millis() > lastGPSTime + txInterval) {
|
||||||
SLEEP_Utils::gpsWakeUp();
|
SLEEP_Utils::gpsWakeUp();
|
||||||
Serial.println(txInterval);
|
lastGPSTime = millis();
|
||||||
}
|
}
|
||||||
if (millis() - refreshDisplayTime >= 1000) {
|
if (millis() - refreshDisplayTime >= 1000) {
|
||||||
MENU_Utils::showOnScreen();
|
MENU_Utils::showOnScreen();
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,8 @@ extern bool sendUpdate;
|
||||||
extern bool sendStandingUpdate;
|
extern bool sendStandingUpdate;
|
||||||
|
|
||||||
extern uint32_t lastTxTime;
|
extern uint32_t lastTxTime;
|
||||||
|
extern uint32_t lastGPSCheck;
|
||||||
|
extern uint32_t lastGPSTime;
|
||||||
extern uint32_t txInterval;
|
extern uint32_t txInterval;
|
||||||
extern double lastTxLat;
|
extern double lastTxLat;
|
||||||
extern double lastTxLng;
|
extern double lastTxLng;
|
||||||
|
|
@ -69,10 +71,13 @@ namespace GPS_Utils {
|
||||||
void calculateDistanceTraveled() {
|
void calculateDistanceTraveled() {
|
||||||
currentHeading = gps.course.deg();
|
currentHeading = gps.course.deg();
|
||||||
lastTxDistance = TinyGPSPlus::distanceBetween(gps.location.lat(), gps.location.lng(), lastTxLat, lastTxLng);
|
lastTxDistance = TinyGPSPlus::distanceBetween(gps.location.lat(), gps.location.lng(), lastTxLat, lastTxLng);
|
||||||
if (lastTx >= txInterval) {
|
if (lastGPSCheck >= txInterval) {
|
||||||
if (lastTxDistance > currentBeacon->minTxDist) {
|
if (lastTxDistance > currentBeacon->minTxDist) {
|
||||||
sendUpdate = true;
|
sendUpdate = true;
|
||||||
sendStandingUpdate = false;
|
sendStandingUpdate = false;
|
||||||
|
} else {
|
||||||
|
SLEEP_Utils::gpsSleep();
|
||||||
|
lastGPSTime = millis();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue