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);
|
||||
#endif
|
||||
|
||||
String versionDate = "2024.07.24";
|
||||
String versionDate = "2024.07.25";
|
||||
|
||||
uint8_t myBeaconsIndex = 0;
|
||||
int myBeaconsSize = Config.beacons.size();
|
||||
|
|
@ -88,9 +88,9 @@ bool smartBeaconValue = true;
|
|||
|
||||
int ackRequestNumber;
|
||||
|
||||
extern bool wakeUpFlag;
|
||||
extern bool wakeUpByButton;
|
||||
extern uint32_t wakeUpByButtonTime;
|
||||
uint32_t lastGPSCheck = 0;
|
||||
uint32_t lastGPSTime = 0;
|
||||
|
||||
|
||||
APRSPacket lastReceivedPacket;
|
||||
|
||||
|
|
@ -203,8 +203,8 @@ void loop() {
|
|||
Utils::checkStatus();
|
||||
STATION_Utils::checkTelemetryTx();
|
||||
}
|
||||
lastTx = millis() - lastTxTime;
|
||||
|
||||
lastTx = millis() - lastTxTime;
|
||||
lastGPSCheck = millis() - lastGPSTime;
|
||||
if (!sendUpdate && gps_loc_update && smartBeaconValue) {
|
||||
GPS_Utils::calculateDistanceTraveled();
|
||||
if (!sendUpdate) {
|
||||
|
|
@ -222,9 +222,9 @@ void loop() {
|
|||
refreshDisplayTime = millis();
|
||||
}
|
||||
} else {
|
||||
if (millis() > lastTxTime + txInterval) {
|
||||
if (millis() > lastGPSTime + txInterval) {
|
||||
SLEEP_Utils::gpsWakeUp();
|
||||
Serial.println(txInterval);
|
||||
lastGPSTime = millis();
|
||||
}
|
||||
if (millis() - refreshDisplayTime >= 1000) {
|
||||
MENU_Utils::showOnScreen();
|
||||
|
|
|
|||
|
|
@ -26,6 +26,8 @@ extern bool sendUpdate;
|
|||
extern bool sendStandingUpdate;
|
||||
|
||||
extern uint32_t lastTxTime;
|
||||
extern uint32_t lastGPSCheck;
|
||||
extern uint32_t lastGPSTime;
|
||||
extern uint32_t txInterval;
|
||||
extern double lastTxLat;
|
||||
extern double lastTxLng;
|
||||
|
|
@ -69,10 +71,13 @@ namespace GPS_Utils {
|
|||
void calculateDistanceTraveled() {
|
||||
currentHeading = gps.course.deg();
|
||||
lastTxDistance = TinyGPSPlus::distanceBetween(gps.location.lat(), gps.location.lng(), lastTxLat, lastTxLng);
|
||||
if (lastTx >= txInterval) {
|
||||
if (lastGPSCheck >= txInterval) {
|
||||
if (lastTxDistance > currentBeacon->minTxDist) {
|
||||
sendUpdate = true;
|
||||
sendStandingUpdate = false;
|
||||
} else {
|
||||
SLEEP_Utils::gpsSleep();
|
||||
lastGPSTime = millis();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue