first test!
This commit is contained in:
parent
c507dbf4e7
commit
d591974b95
|
|
@ -1,61 +1,34 @@
|
||||||
{
|
{
|
||||||
"beacons": [
|
"beacons": [
|
||||||
{
|
{
|
||||||
"callsign": "NOCALL-7",
|
"callsign": "CA2RXU-6",
|
||||||
"gpsEcoMode": false,
|
"gpsEcoMode": false,
|
||||||
"symbol": "[",
|
"symbol": "[",
|
||||||
"overlay": "/",
|
"overlay": "/",
|
||||||
"micE": "",
|
"micE": "",
|
||||||
"comment": "",
|
"comment": "",
|
||||||
"smartBeacon": {
|
"smartBeaconActive": true,
|
||||||
"active": true,
|
"smartBeaconSetting": 0
|
||||||
"slowRate": 120,
|
|
||||||
"slowSpeed": 3,
|
|
||||||
"fastRate": 60,
|
|
||||||
"fastSpeed": 15,
|
|
||||||
"minTxDist": 50,
|
|
||||||
"minDeltaBeacon": 20,
|
|
||||||
"turnMinDeg": 12,
|
|
||||||
"turnSlope": 60
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"callsign": "NOCALL-7",
|
"callsign": "CA2RXU-6",
|
||||||
"gpsEcoMode": false,
|
"gpsEcoMode": false,
|
||||||
"symbol": ">",
|
"symbol": ">",
|
||||||
"overlay": "/",
|
"overlay": "/",
|
||||||
"micE": "",
|
"micE": "",
|
||||||
"comment": "",
|
"comment": "",
|
||||||
"smartBeacon": {
|
"smartBeaconActive": true,
|
||||||
"active": true,
|
"smartBeaconSetting": 2
|
||||||
"slowRate": 120,
|
|
||||||
"slowSpeed": 10,
|
|
||||||
"fastRate": 60,
|
|
||||||
"fastSpeed": 70,
|
|
||||||
"minTxDist": 100,
|
|
||||||
"minDeltaBeacon": 12,
|
|
||||||
"turnMinDeg": 10,
|
|
||||||
"turnSlope": 80
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"callsign": "NOCALL-7",
|
"callsign": "CA2RXU-6",
|
||||||
"gpsEcoMode": false,
|
"gpsEcoMode": false,
|
||||||
"symbol": "b",
|
"symbol": "b",
|
||||||
"overlay": "/",
|
"overlay": "/",
|
||||||
"micE": "",
|
"micE": "",
|
||||||
"comment": "",
|
"comment": "",
|
||||||
"smartBeacon": {
|
"smartBeaconActive": true,
|
||||||
"active": true,
|
"smartBeaconSetting": 1
|
||||||
"slowRate": 120,
|
|
||||||
"slowSpeed": 5,
|
|
||||||
"fastRate": 60,
|
|
||||||
"fastSpeed": 40,
|
|
||||||
"minTxDist": 100,
|
|
||||||
"minDeltaBeacon": 12,
|
|
||||||
"turnMinDeg": 12,
|
|
||||||
"turnSlope": 60
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"display": {
|
"display": {
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ ________________________________________________________________________________
|
||||||
#include <logger.h>
|
#include <logger.h>
|
||||||
#include <WiFi.h>
|
#include <WiFi.h>
|
||||||
#include "APRSPacketLib.h"
|
#include "APRSPacketLib.h"
|
||||||
|
#include "smartbeacon_utils.h"
|
||||||
#include "bluetooth_utils.h"
|
#include "bluetooth_utils.h"
|
||||||
#include "keyboard_utils.h"
|
#include "keyboard_utils.h"
|
||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
|
|
@ -46,7 +47,7 @@ TinyGPSPlus gps;
|
||||||
OneButton userButton = OneButton(BUTTON_PIN, true, true);
|
OneButton userButton = OneButton(BUTTON_PIN, true, true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
String versionDate = "2024.08.21";
|
String versionDate = "2024.08.26";
|
||||||
|
|
||||||
uint8_t myBeaconsIndex = 0;
|
uint8_t myBeaconsIndex = 0;
|
||||||
int myBeaconsSize = Config.beacons.size();
|
int myBeaconsSize = Config.beacons.size();
|
||||||
|
|
@ -84,7 +85,7 @@ bool sosActive = false;
|
||||||
|
|
||||||
bool miceActive = false;
|
bool miceActive = false;
|
||||||
|
|
||||||
bool smartBeaconValue = true;
|
bool smartBeaconActive = true;
|
||||||
|
|
||||||
int ackRequestNumber;
|
int ackRequestNumber;
|
||||||
|
|
||||||
|
|
@ -158,8 +159,9 @@ void loop() {
|
||||||
miceActive = Config.validateMicE(currentBeacon->micE);
|
miceActive = Config.validateMicE(currentBeacon->micE);
|
||||||
}
|
}
|
||||||
POWER_Utils::batteryManager();
|
POWER_Utils::batteryManager();
|
||||||
|
|
||||||
STATION_Utils::checkSmartBeaconValue();
|
SMARTBEACON_Utils::checkValues(myBeaconsIndex);
|
||||||
|
SMARTBEACON_Utils::checkState();
|
||||||
|
|
||||||
if (!Config.simplifiedTrackerMode) {
|
if (!Config.simplifiedTrackerMode) {
|
||||||
#ifdef BUTTON_PIN
|
#ifdef BUTTON_PIN
|
||||||
|
|
@ -200,16 +202,16 @@ void loop() {
|
||||||
Utils::checkStatus();
|
Utils::checkStatus();
|
||||||
STATION_Utils::checkTelemetryTx();
|
STATION_Utils::checkTelemetryTx();
|
||||||
}
|
}
|
||||||
if (!sendUpdate && gps_loc_update && smartBeaconValue) {
|
if (!sendUpdate && gps_loc_update && smartBeaconActive) {
|
||||||
GPS_Utils::calculateDistanceTraveled();
|
GPS_Utils::calculateDistanceTraveled();
|
||||||
if (!sendUpdate) {
|
if (!sendUpdate) {
|
||||||
GPS_Utils::calculateHeadingDelta(currentSpeed);
|
GPS_Utils::calculateHeadingDelta(currentSpeed);
|
||||||
}
|
}
|
||||||
STATION_Utils::checkStandingUpdateTime();
|
STATION_Utils::checkStandingUpdateTime();
|
||||||
}
|
}
|
||||||
STATION_Utils::checkSmartBeaconState();
|
SMARTBEACON_Utils::checkFixedBeaconTime();
|
||||||
if (sendUpdate && gps_loc_update) STATION_Utils::sendBeacon(0);
|
if (sendUpdate && gps_loc_update) STATION_Utils::sendBeacon(0);
|
||||||
if (gps_time_update) STATION_Utils::checkSmartBeaconInterval(currentSpeed);
|
if (gps_time_update) SMARTBEACON_Utils::checkInterval(currentSpeed);
|
||||||
|
|
||||||
if (millis() - refreshDisplayTime >= 1000 || gps_time_update) {
|
if (millis() - refreshDisplayTime >= 1000 || gps_time_update) {
|
||||||
GPS_Utils::checkStartUpFrames();
|
GPS_Utils::checkStartUpFrames();
|
||||||
|
|
|
||||||
|
|
@ -29,20 +29,13 @@ void Configuration::readFile(fs::FS &fs, const char *fileName) {
|
||||||
|
|
||||||
bcn.callsign = BeaconsArray[i]["callsign"] | "NOCALL-7";
|
bcn.callsign = BeaconsArray[i]["callsign"] | "NOCALL-7";
|
||||||
bcn.callsign.toUpperCase();
|
bcn.callsign.toUpperCase();
|
||||||
bcn.gpsEcoMode = BeaconsArray[i]["gpsEcoMode"] | false;
|
|
||||||
bcn.symbol = BeaconsArray[i]["symbol"] | ">";
|
bcn.symbol = BeaconsArray[i]["symbol"] | ">";
|
||||||
bcn.overlay = BeaconsArray[i]["overlay"] | "/";
|
bcn.overlay = BeaconsArray[i]["overlay"] | "/";
|
||||||
bcn.micE = BeaconsArray[i]["micE"] | "";
|
|
||||||
bcn.comment = BeaconsArray[i]["comment"] | "";
|
bcn.comment = BeaconsArray[i]["comment"] | "";
|
||||||
bcn.smartBeaconState = BeaconsArray[i]["smartBeacon"]["active"] | true;
|
bcn.smartBeaconActive = BeaconsArray[i]["smartBeaconActive"] | true;
|
||||||
bcn.slowRate = BeaconsArray[i]["smartBeacon"]["slowRate"] | 120;
|
bcn.smartBeaconSetting = BeaconsArray[i]["smartBeaconSetting"] | 0;
|
||||||
bcn.slowSpeed = BeaconsArray[i]["smartBeacon"]["slowSpeed"] | 10;
|
bcn.micE = BeaconsArray[i]["micE"] | "";
|
||||||
bcn.fastRate = BeaconsArray[i]["smartBeacon"]["fastRate"] | 60;
|
bcn.gpsEcoMode = BeaconsArray[i]["gpsEcoMode"] | false;
|
||||||
bcn.fastSpeed = BeaconsArray[i]["smartBeacon"]["fastSpeed"]| 70;
|
|
||||||
bcn.minTxDist = BeaconsArray[i]["smartBeacon"]["minTxDist"] | 100;
|
|
||||||
bcn.minDeltaBeacon = BeaconsArray[i]["smartBeacon"]["minDeltaBeacon"] | 12;
|
|
||||||
bcn.turnMinDeg = BeaconsArray[i]["smartBeacon"]["turnMinDeg"] | 10;
|
|
||||||
bcn.turnSlope = BeaconsArray[i]["smartBeacon"]["turnSlope"] | 80;
|
|
||||||
|
|
||||||
beacons.push_back(bcn);
|
beacons.push_back(bcn);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,20 +8,13 @@
|
||||||
class Beacon {
|
class Beacon {
|
||||||
public:
|
public:
|
||||||
String callsign;
|
String callsign;
|
||||||
bool gpsEcoMode;
|
|
||||||
String symbol;
|
String symbol;
|
||||||
String overlay;
|
String overlay;
|
||||||
String micE;
|
|
||||||
String comment;
|
String comment;
|
||||||
bool smartBeaconState;
|
bool smartBeaconActive;
|
||||||
int slowRate;
|
byte smartBeaconSetting;
|
||||||
int slowSpeed;
|
String micE;
|
||||||
int fastRate;
|
bool gpsEcoMode;
|
||||||
int fastSpeed;
|
|
||||||
int minTxDist;
|
|
||||||
int minDeltaBeacon;
|
|
||||||
int turnMinDeg;
|
|
||||||
int turnSlope;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class Display {
|
class Display {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
#include <TinyGPS++.h>
|
#include <TinyGPS++.h>
|
||||||
#include "TimeLib.h"
|
#include "TimeLib.h"
|
||||||
|
#include "smartbeacon_utils.h"
|
||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
#include "station_utils.h"
|
#include "station_utils.h"
|
||||||
#include "boards_pinout.h"
|
#include "boards_pinout.h"
|
||||||
|
|
@ -17,22 +18,23 @@
|
||||||
#define GPS_BAUD 9600
|
#define GPS_BAUD 9600
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern Configuration Config;
|
extern Configuration Config;
|
||||||
extern HardwareSerial neo6m_gps; // cambiar a gpsSerial
|
extern HardwareSerial neo6m_gps; // cambiar a gpsSerial
|
||||||
extern TinyGPSPlus gps;
|
extern TinyGPSPlus gps;
|
||||||
extern Beacon *currentBeacon;
|
extern Beacon *currentBeacon;
|
||||||
extern logging::Logger logger;
|
extern logging::Logger logger;
|
||||||
extern bool sendUpdate;
|
extern bool sendUpdate;
|
||||||
extern bool sendStandingUpdate;
|
extern bool sendStandingUpdate;
|
||||||
|
|
||||||
extern uint32_t lastTxTime;
|
extern uint32_t lastTxTime;
|
||||||
extern uint32_t txInterval;
|
extern uint32_t txInterval;
|
||||||
extern double lastTxLat;
|
extern double lastTxLat;
|
||||||
extern double lastTxLng;
|
extern double lastTxLng;
|
||||||
extern double lastTxDistance;
|
extern double lastTxDistance;
|
||||||
extern uint32_t lastTx;
|
extern uint32_t lastTx;
|
||||||
extern bool disableGPS;
|
extern bool disableGPS;
|
||||||
extern bool gpsShouldSleep;
|
extern bool gpsShouldSleep;
|
||||||
|
extern SmartBeaconValues currentSmartBeaconValues;
|
||||||
|
|
||||||
double currentHeading = 0;
|
double currentHeading = 0;
|
||||||
double previousHeading = 0;
|
double previousHeading = 0;
|
||||||
|
|
@ -73,7 +75,7 @@ namespace GPS_Utils {
|
||||||
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 (lastTx >= txInterval) {
|
||||||
if (lastTxDistance > currentBeacon->minTxDist) {
|
if (lastTxDistance > currentSmartBeaconValues.minTxDist) {
|
||||||
sendUpdate = true;
|
sendUpdate = true;
|
||||||
sendStandingUpdate = false;
|
sendStandingUpdate = false;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -91,13 +93,13 @@ namespace GPS_Utils {
|
||||||
void calculateHeadingDelta(int speed) {
|
void calculateHeadingDelta(int speed) {
|
||||||
uint8_t TurnMinAngle;
|
uint8_t TurnMinAngle;
|
||||||
double headingDelta = abs(previousHeading - currentHeading);
|
double headingDelta = abs(previousHeading - currentHeading);
|
||||||
if (lastTx > currentBeacon->minDeltaBeacon * 1000) {
|
if (lastTx > currentSmartBeaconValues.minDeltaBeacon * 1000) {
|
||||||
if (speed == 0) {
|
if (speed == 0) {
|
||||||
TurnMinAngle = currentBeacon->turnMinDeg + (currentBeacon->turnSlope/(speed + 1));
|
TurnMinAngle = currentSmartBeaconValues.turnMinDeg + (currentSmartBeaconValues.turnSlope/(speed + 1));
|
||||||
} else {
|
} else {
|
||||||
TurnMinAngle = currentBeacon->turnMinDeg + (currentBeacon->turnSlope/speed);
|
TurnMinAngle = currentSmartBeaconValues.turnMinDeg + (currentSmartBeaconValues.turnSlope/speed);
|
||||||
}
|
}
|
||||||
if (headingDelta > TurnMinAngle && lastTxDistance > currentBeacon->minTxDist) {
|
if (headingDelta > TurnMinAngle && lastTxDistance > currentSmartBeaconValues.minTxDist) {
|
||||||
sendUpdate = true;
|
sendUpdate = true;
|
||||||
sendStandingUpdate = false;
|
sendStandingUpdate = false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -322,10 +322,10 @@ namespace KEYBOARD_Utils {
|
||||||
menuDisplay = 63;
|
menuDisplay = 63;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void rightArrow() {
|
void rightArrow() {
|
||||||
if (menuDisplay == 0 || menuDisplay == 200) {
|
if (menuDisplay == 0 || menuDisplay == 200) {
|
||||||
if(myBeaconsIndex >= (myBeaconsSize-1)) {
|
if(myBeaconsIndex >= (myBeaconsSize - 1)) {
|
||||||
myBeaconsIndex = 0;
|
myBeaconsIndex = 0;
|
||||||
} else {
|
} else {
|
||||||
myBeaconsIndex++;
|
myBeaconsIndex++;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,68 @@
|
||||||
|
#include "smartbeacon_utils.h"
|
||||||
|
#include "configuration.h"
|
||||||
|
#include "winlink_utils.h"
|
||||||
|
|
||||||
|
extern Configuration Config;
|
||||||
|
extern Beacon *currentBeacon;
|
||||||
|
extern bool smartBeaconActive;
|
||||||
|
extern uint32_t txInterval;
|
||||||
|
extern uint32_t lastTxTime;
|
||||||
|
extern bool sendUpdate;
|
||||||
|
extern uint8_t winlinkStatus;
|
||||||
|
|
||||||
|
|
||||||
|
SmartBeaconValues currentSmartBeaconValues;
|
||||||
|
byte lastSmartBeaconIndex = 10;
|
||||||
|
bool wxRequestStatus = false;
|
||||||
|
uint32_t wxRequestTime = 0;
|
||||||
|
|
||||||
|
|
||||||
|
SmartBeaconValues smartBeaconSettings[3] = {
|
||||||
|
{120, 3, 60, 15, 50, 20, 12, 60}, // Runner settings = SLOW
|
||||||
|
{120, 5, 60, 40, 100, 12, 12, 60}, // Bike settings = MEDIUM
|
||||||
|
{120, 10, 60, 70, 100, 12, 10, 80} // Car settings = FAST
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
namespace SMARTBEACON_Utils {
|
||||||
|
|
||||||
|
void checkValues(byte index) {
|
||||||
|
if (lastSmartBeaconIndex != index) {
|
||||||
|
currentSmartBeaconValues = smartBeaconSettings[index];
|
||||||
|
lastSmartBeaconIndex = index;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void checkInterval(int speed) {
|
||||||
|
if (smartBeaconActive) {
|
||||||
|
if (speed < currentSmartBeaconValues.slowSpeed) {
|
||||||
|
txInterval = currentSmartBeaconValues.slowRate * 1000;
|
||||||
|
} else if (speed > currentSmartBeaconValues.fastSpeed) {
|
||||||
|
txInterval = currentSmartBeaconValues.fastRate * 1000;
|
||||||
|
} else {
|
||||||
|
txInterval = min(currentSmartBeaconValues.slowRate, currentSmartBeaconValues.fastSpeed * currentSmartBeaconValues.fastRate / speed) * 1000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void checkFixedBeaconTime() {
|
||||||
|
if (!smartBeaconActive) {
|
||||||
|
uint32_t lastTxSmartBeacon = millis() - lastTxTime;
|
||||||
|
if (lastTxSmartBeacon >= Config.nonSmartBeaconRate * 60 * 1000) {
|
||||||
|
sendUpdate = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void checkState() {
|
||||||
|
if (wxRequestStatus && (millis() - wxRequestTime) > 20000) {
|
||||||
|
wxRequestStatus = false;
|
||||||
|
}
|
||||||
|
if(winlinkStatus == 0 && !wxRequestStatus) {
|
||||||
|
smartBeaconActive = currentBeacon->smartBeaconActive;
|
||||||
|
} else {
|
||||||
|
smartBeaconActive = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
#ifndef SMARTBEACON_UTILS_H_
|
||||||
|
#define SMARTBEACON_UTILS_H_
|
||||||
|
|
||||||
|
#include <Arduino.h>
|
||||||
|
|
||||||
|
struct SmartBeaconValues {
|
||||||
|
int slowRate;
|
||||||
|
int slowSpeed;
|
||||||
|
int fastRate;
|
||||||
|
int fastSpeed;
|
||||||
|
int minTxDist;
|
||||||
|
int minDeltaBeacon;
|
||||||
|
int turnMinDeg;
|
||||||
|
int turnSlope;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
namespace SMARTBEACON_Utils {
|
||||||
|
|
||||||
|
void checkValues(byte index);
|
||||||
|
void checkInterval(int speed);
|
||||||
|
void checkFixedBeaconTime();
|
||||||
|
void checkState();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -23,8 +23,6 @@ extern uint32_t lastTxTime;
|
||||||
|
|
||||||
extern bool sendUpdate;
|
extern bool sendUpdate;
|
||||||
|
|
||||||
extern uint32_t txInterval;
|
|
||||||
|
|
||||||
extern double currentHeading;
|
extern double currentHeading;
|
||||||
extern double previousHeading;
|
extern double previousHeading;
|
||||||
|
|
||||||
|
|
@ -33,18 +31,18 @@ extern double lastTxLng;
|
||||||
extern double lastTxDistance;
|
extern double lastTxDistance;
|
||||||
|
|
||||||
extern bool miceActive;
|
extern bool miceActive;
|
||||||
extern bool smartBeaconValue;
|
extern bool smartBeaconActive;
|
||||||
extern uint8_t winlinkStatus;
|
|
||||||
extern bool winlinkCommentState;
|
extern bool winlinkCommentState;
|
||||||
|
|
||||||
extern int wxModuleType;
|
extern int wxModuleType;
|
||||||
extern bool gpsIsActive;
|
extern bool gpsIsActive;
|
||||||
extern bool gpsShouldSleep;
|
extern bool gpsShouldSleep;
|
||||||
|
|
||||||
|
|
||||||
bool sendStandingUpdate = false;
|
bool sendStandingUpdate = false;
|
||||||
uint8_t updateCounter = Config.sendCommentAfterXBeacons;
|
uint8_t updateCounter = Config.sendCommentAfterXBeacons;
|
||||||
bool wxRequestStatus = false;
|
|
||||||
uint32_t wxRequestTime = 0;
|
|
||||||
|
|
||||||
uint32_t lastTelemetryTx = 0;
|
uint32_t lastTelemetryTx = 0;
|
||||||
uint32_t telemetryTx = millis();
|
uint32_t telemetryTx = millis();
|
||||||
|
|
@ -167,18 +165,6 @@ namespace STATION_Utils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void checkSmartBeaconInterval(int speed) {
|
|
||||||
if (smartBeaconValue) {
|
|
||||||
if (speed < currentBeacon->slowSpeed) {
|
|
||||||
txInterval = currentBeacon->slowRate * 1000;
|
|
||||||
} else if (speed > currentBeacon->fastSpeed) {
|
|
||||||
txInterval = currentBeacon->fastRate * 1000;
|
|
||||||
} else {
|
|
||||||
txInterval = min(currentBeacon->slowRate, currentBeacon->fastSpeed * currentBeacon->fastRate / speed) * 1000;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void checkStandingUpdateTime() {
|
void checkStandingUpdateTime() {
|
||||||
if (!sendUpdate && lastTx >= Config.standingUpdateTime * 60 * 1000) {
|
if (!sendUpdate && lastTx >= Config.standingUpdateTime * 60 * 1000) {
|
||||||
sendUpdate = true;
|
sendUpdate = true;
|
||||||
|
|
@ -189,26 +175,6 @@ namespace STATION_Utils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void checkSmartBeaconValue() {
|
|
||||||
if (wxRequestStatus && (millis() - wxRequestTime) > 20000) {
|
|
||||||
wxRequestStatus = false;
|
|
||||||
}
|
|
||||||
if(winlinkStatus == 0 && !wxRequestStatus) {
|
|
||||||
smartBeaconValue = currentBeacon->smartBeaconState;
|
|
||||||
} else {
|
|
||||||
smartBeaconValue = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void checkSmartBeaconState() {
|
|
||||||
if (!smartBeaconValue) {
|
|
||||||
uint32_t lastTxSmartBeacon = millis() - lastTxTime;
|
|
||||||
if (lastTxSmartBeacon >= Config.nonSmartBeaconRate * 60 * 1000) {
|
|
||||||
sendUpdate = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void sendBeacon(uint8_t type) {
|
void sendBeacon(uint8_t type) {
|
||||||
String packet;
|
String packet;
|
||||||
if (Config.bme.sendTelemetry && type == 1) { // WX
|
if (Config.bme.sendTelemetry && type == 1) { // WX
|
||||||
|
|
@ -275,7 +241,7 @@ namespace STATION_Utils {
|
||||||
displayShow("<<< TX >>>", "", packet,100);
|
displayShow("<<< TX >>>", "", packet,100);
|
||||||
LoRa_Utils::sendNewPacket(packet);
|
LoRa_Utils::sendNewPacket(packet);
|
||||||
|
|
||||||
if (smartBeaconValue) {
|
if (smartBeaconActive) {
|
||||||
lastTxLat = gps.location.lat();
|
lastTxLat = gps.location.lat();
|
||||||
lastTxLng = gps.location.lng();
|
lastTxLng = gps.location.lng();
|
||||||
previousHeading = currentHeading;
|
previousHeading = currentHeading;
|
||||||
|
|
|
||||||
|
|
@ -11,10 +11,7 @@ namespace STATION_Utils {
|
||||||
void deleteListenedTrackersbyTime();
|
void deleteListenedTrackersbyTime();
|
||||||
void checkListenedTrackersByTimeAndDelete();
|
void checkListenedTrackersByTimeAndDelete();
|
||||||
void orderListenedTrackersByDistance(const String& callsign, float distance, float course);
|
void orderListenedTrackersByDistance(const String& callsign, float distance, float course);
|
||||||
void checkSmartBeaconInterval(int speed);
|
|
||||||
void checkStandingUpdateTime();
|
void checkStandingUpdateTime();
|
||||||
void checkSmartBeaconValue();
|
|
||||||
void checkSmartBeaconState();
|
|
||||||
void sendBeacon(uint8_t type);
|
void sendBeacon(uint8_t type);
|
||||||
void checkTelemetryTx();
|
void checkTelemetryTx();
|
||||||
void saveIndex(uint8_t type, uint8_t index);
|
void saveIndex(uint8_t type, uint8_t index);
|
||||||
|
|
|
||||||
|
|
@ -4,20 +4,20 @@
|
||||||
#include "display.h"
|
#include "display.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
extern Beacon *currentBeacon;
|
extern Beacon *currentBeacon;
|
||||||
extern Configuration Config;
|
extern Configuration Config;
|
||||||
|
|
||||||
extern uint32_t lastTx;
|
extern uint32_t lastTx;
|
||||||
extern uint32_t lastTxTime;
|
extern uint32_t lastTxTime;
|
||||||
|
|
||||||
extern bool displayEcoMode;
|
extern bool displayEcoMode;
|
||||||
extern uint32_t displayTime;
|
extern uint32_t displayTime;
|
||||||
extern bool displayState;
|
extern bool displayState;
|
||||||
extern int menuDisplay;
|
extern int menuDisplay;
|
||||||
extern String versionDate;
|
extern String versionDate;
|
||||||
extern bool flashlight;
|
extern bool flashlight;
|
||||||
|
|
||||||
extern bool statusState;
|
extern bool statusState;
|
||||||
|
|
||||||
uint32_t statusTime = millis();
|
uint32_t statusTime = millis();
|
||||||
|
|
||||||
|
|
@ -104,7 +104,7 @@ namespace Utils {
|
||||||
}
|
}
|
||||||
|
|
||||||
String getSmartBeaconState() {
|
String getSmartBeaconState() {
|
||||||
if (currentBeacon->smartBeaconState) return "On";
|
if (currentBeacon->smartBeaconActive) return "On";
|
||||||
return "Off";
|
return "Off";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue