Tbeam test initial commit

This commit is contained in:
richonguzman 2024-07-25 13:35:49 -04:00
parent 5b3550300e
commit 7e26e97a12
10 changed files with 71 additions and 58 deletions

View File

@ -52,6 +52,7 @@ build_flags =
-DHAS_SX1278 -DHAS_SX1278
-DHAS_AXP2101 -DHAS_AXP2101
-DHAS_BT_CLASSIC -DHAS_BT_CLASSIC
-DHAS_GPS_CTRL
lib_deps = lib_deps =
${common.lib_deps} ${common.lib_deps}
lewisxhe/XPowersLib @ 0.2.4 lewisxhe/XPowersLib @ 0.2.4
@ -68,6 +69,7 @@ build_flags =
-DHAS_SX1276 -DHAS_SX1276
-DHAS_AXP2101 -DHAS_AXP2101
-DHAS_BT_CLASSIC -DHAS_BT_CLASSIC
-DHAS_GPS_CTRL
lib_deps = lib_deps =
${common.lib_deps} ${common.lib_deps}
lewisxhe/XPowersLib @ 0.2.4 lewisxhe/XPowersLib @ 0.2.4
@ -85,6 +87,7 @@ build_flags =
-DHAS_SX1262 -DHAS_SX1262
-DHAS_AXP2101 -DHAS_AXP2101
-DHAS_BT_CLASSIC -DHAS_BT_CLASSIC
-DHAS_GPS_CTRL
lib_deps = lib_deps =
${common.lib_deps} ${common.lib_deps}
lewisxhe/XPowersLib @ 0.2.4 lewisxhe/XPowersLib @ 0.2.4
@ -102,6 +105,7 @@ build_flags =
-DHAS_SX1278 -DHAS_SX1278
-DHAS_AXP192 -DHAS_AXP192
-DHAS_BT_CLASSIC -DHAS_BT_CLASSIC
-DHAS_GPS_CTRL
lib_deps = lib_deps =
${common.lib_deps} ${common.lib_deps}
lewisxhe/XPowersLib @ 0.2.4 lewisxhe/XPowersLib @ 0.2.4
@ -118,6 +122,7 @@ build_flags =
-DHAS_SX1276 -DHAS_SX1276
-DHAS_AXP192 -DHAS_AXP192
-DHAS_BT_CLASSIC -DHAS_BT_CLASSIC
-DHAS_GPS_CTRL
lib_deps = lib_deps =
${common.lib_deps} ${common.lib_deps}
lewisxhe/XPowersLib @ 0.2.4 lewisxhe/XPowersLib @ 0.2.4
@ -135,6 +140,7 @@ build_flags =
-DHAS_SX1268 -DHAS_SX1268
-DHAS_AXP192 -DHAS_AXP192
-DHAS_BT_CLASSIC -DHAS_BT_CLASSIC
-DHAS_GPS_CTRL
lib_deps = lib_deps =
${common.lib_deps} ${common.lib_deps}
lewisxhe/XPowersLib @ 0.2.4 lewisxhe/XPowersLib @ 0.2.4

View File

@ -95,7 +95,6 @@ APRSPacket lastReceivedPacket;
logging::Logger logger; logging::Logger logger;
//#define DEBUG //#define DEBUG
bool gpsSleepActive = true; // currentBeacon->gpsEcoMode // true!
extern bool gpsIsActive; extern bool gpsIsActive;
void setup() { void setup() {

View File

@ -27,21 +27,22 @@ void Configuration::readFile(fs::FS &fs, const char *fileName) {
for (int i = 0; i < BeaconsArray.size(); i++) { for (int i = 0; i < BeaconsArray.size(); i++) {
Beacon bcn; Beacon bcn;
bcn.callsign = BeaconsArray[i]["callsign"].as<String>(); bcn.callsign = BeaconsArray[i]["callsign"].as<String>();
bcn.callsign.toUpperCase(); bcn.callsign.toUpperCase();
bcn.symbol = BeaconsArray[i]["symbol"].as<String>(); bcn.gpsEcoMode = BeaconsArray[i]["gpsEcoMode"].as<bool>();
bcn.overlay = BeaconsArray[i]["overlay"].as<String>(); bcn.symbol = BeaconsArray[i]["symbol"].as<String>();
bcn.micE = BeaconsArray[i]["micE"].as<String>(); bcn.overlay = BeaconsArray[i]["overlay"].as<String>();
bcn.comment = BeaconsArray[i]["comment"].as<String>(); bcn.micE = BeaconsArray[i]["micE"].as<String>();
bcn.smartBeaconState = BeaconsArray[i]["smartBeacon"]["active"].as<bool>(); bcn.comment = BeaconsArray[i]["comment"].as<String>();
bcn.slowRate = BeaconsArray[i]["smartBeacon"]["slowRate"].as<int>(); bcn.smartBeaconState = BeaconsArray[i]["smartBeacon"]["active"].as<bool>();
bcn.slowSpeed = BeaconsArray[i]["smartBeacon"]["slowSpeed"].as<int>(); bcn.slowRate = BeaconsArray[i]["smartBeacon"]["slowRate"].as<int>();
bcn.fastRate = BeaconsArray[i]["smartBeacon"]["fastRate"].as<int>(); bcn.slowSpeed = BeaconsArray[i]["smartBeacon"]["slowSpeed"].as<int>();
bcn.fastSpeed = BeaconsArray[i]["smartBeacon"]["fastSpeed"].as<int>(); bcn.fastRate = BeaconsArray[i]["smartBeacon"]["fastRate"].as<int>();
bcn.minTxDist = BeaconsArray[i]["smartBeacon"]["minTxDist"].as<int>(); bcn.fastSpeed = BeaconsArray[i]["smartBeacon"]["fastSpeed"].as<int>();
bcn.minDeltaBeacon = BeaconsArray[i]["smartBeacon"]["minDeltaBeacon"].as<int>(); bcn.minTxDist = BeaconsArray[i]["smartBeacon"]["minTxDist"].as<int>();
bcn.turnMinDeg = BeaconsArray[i]["smartBeacon"]["turnMinDeg"].as<int>(); bcn.minDeltaBeacon = BeaconsArray[i]["smartBeacon"]["minDeltaBeacon"].as<int>();
bcn.turnSlope = BeaconsArray[i]["smartBeacon"]["turnSlope"].as<int>(); bcn.turnMinDeg = BeaconsArray[i]["smartBeacon"]["turnMinDeg"].as<int>();
bcn.turnSlope = BeaconsArray[i]["smartBeacon"]["turnSlope"].as<int>();
beacons.push_back(bcn); beacons.push_back(bcn);
} }

View File

@ -7,20 +7,21 @@
class Beacon { class Beacon {
public: public:
String callsign; String callsign;
String symbol; bool gpsEcoMode;
String overlay; String symbol;
String micE; String overlay;
String comment; String micE;
bool smartBeaconState; String comment;
int slowRate; bool smartBeaconState;
int slowSpeed; int slowRate;
int fastRate; int slowSpeed;
int fastSpeed; int fastRate;
int minTxDist; int fastSpeed;
int minDeltaBeacon; int minTxDist;
int turnMinDeg; int minDeltaBeacon;
int turnSlope; int turnMinDeg;
int turnSlope;
}; };
class Display { class Display {

View File

@ -327,7 +327,7 @@ void startupScreen(uint8_t index, const String& version) {
case 1: workingFreq += "PL]"; break; case 1: workingFreq += "PL]"; break;
case 2: workingFreq += "UK]"; break; case 2: workingFreq += "UK]"; break;
} }
show_display(" LoRa APRS", " (TRACKER)", workingFreq, "", "", " CA2RXU / " + version, 4000); show_display(" LoRa APRS", " (TRACKER)", workingFreq, "", "", " CA2RXU " + version, 4000);
#ifdef HAS_TFT #ifdef HAS_TFT
cleanTFT(); cleanTFT();
#endif #endif

View File

@ -76,13 +76,14 @@ namespace GPS_Utils {
sendUpdate = true; sendUpdate = true;
sendStandingUpdate = false; sendStandingUpdate = false;
} else { } else {
if (currentBeacon->gpsEcoMode) {
// //
Serial.print("minTxDistance not achieved : "); Serial.print("minTxDistance not achieved : ");
Serial.println(lastTxDistance); Serial.println(lastTxDistance);
// //
SLEEP_Utils::gpsSleep(); SLEEP_Utils::gpsSleep();
}
} }
} }
} }

View File

@ -6,8 +6,9 @@
#include "winlink_utils.h" #include "winlink_utils.h"
#include "station_utils.h" #include "station_utils.h"
#include "configuration.h" #include "configuration.h"
#include "power_utils.h"
#include "boards_pinout.h" #include "boards_pinout.h"
#include "power_utils.h"
#include "sleep_utils.h"
#include "msg_utils.h" #include "msg_utils.h"
#include "display.h" #include "display.h"
@ -50,6 +51,7 @@ extern String winlinkBody;
extern String winlinkAlias; extern String winlinkAlias;
extern String winlinkAliasComplete; extern String winlinkAliasComplete;
extern bool winlinkCommentState; extern bool winlinkCommentState;
extern bool gpsIsActive;
extern std::vector<String> outputMessagesBuffer; extern std::vector<String> outputMessagesBuffer;
@ -160,6 +162,7 @@ namespace KEYBOARD_Utils {
if (menuDisplay == 0) { if (menuDisplay == 0) {
if (displayState) { if (displayState) {
sendUpdate = true; sendUpdate = true;
if (!gpsIsActive) SLEEP_Utils::gpsWakeUp();
} else { } else {
display_toggle(true); display_toggle(true);
displayTime = millis(); displayTime = millis();

View File

@ -593,7 +593,7 @@ namespace MENU_Utils {
fourthRowMainMenu += " ***"; fourthRowMainMenu += " ***";
} }
if (!gpsIsActive) { if (!gpsIsActive) {
fourthRowMainMenu = "*** GPS SLEEPING ***"; fourthRowMainMenu = "*** GPS SLEEPING ***";
} }
} }

View File

@ -1,33 +1,36 @@
#include "configuration.h"
#include "sleep_utils.h" #include "sleep_utils.h"
#include "power_utils.h" #include "power_utils.h"
extern bool gpsSleepActive; // currentBeacon->gpsEcoMode // true! extern Beacon *currentBeacon;
extern uint32_t lastGPSTime; extern uint32_t lastGPSTime;
extern bool gpsIsActive; extern bool gpsIsActive;
namespace SLEEP_Utils { namespace SLEEP_Utils {
void gpsSleep() { void gpsSleep() {
if (gpsSleepActive && gpsIsActive) { #ifdef HAS_GPS_CTRL
POWER_Utils::deactivateGPS(); if (currentBeacon->gpsEcoMode && gpsIsActive) {
lastGPSTime = millis(); POWER_Utils::deactivateGPS();
// lastGPSTime = millis();
Serial.println("GPS SLEEPING"); //
// Serial.println("GPS SLEEPING");
} //
}
#endif
} }
void gpsWakeUp() { void gpsWakeUp() {
if (gpsSleepActive && !gpsIsActive) { #ifdef HAS_GPS_CTRL
POWER_Utils::activateGPS(); if (currentBeacon->gpsEcoMode && !gpsIsActive) {
// POWER_Utils::activateGPS();
Serial.println("GPS WAKEUP"); //
// Serial.println("GPS WAKEUP");
} //
}
#endif
} }
} }

View File

@ -37,7 +37,6 @@ extern uint8_t winlinkStatus;
extern bool winlinkCommentState; extern bool winlinkCommentState;
extern int wxModuleType; extern int wxModuleType;
extern bool gpsSleepActive; // currentBeacon->gpsEcoMode // true!
extern bool gpsIsActive; extern bool gpsIsActive;
bool sendStandingUpdate = false; bool sendStandingUpdate = false;
@ -284,7 +283,7 @@ namespace STATION_Utils {
#ifdef HAS_TFT #ifdef HAS_TFT
cleanTFT(); cleanTFT();
#endif #endif
if (gpsSleepActive) { // currentBeacon->gpsEcoMode // true! if (currentBeacon->gpsEcoMode) { // currentBeacon->gpsEcoMode // true!
SLEEP_Utils::gpsSleep(); SLEEP_Utils::gpsSleep();
} }
} }