diff --git a/data/tracker_config.json b/data/tracker_config.json index 38b9ccb..7531787 100644 --- a/data/tracker_config.json +++ b/data/tracker_config.json @@ -1,7 +1,7 @@ { "beacons": [ { - "callsign": "NOCALL-7", + "callsign": "CD2RXU-7", "symbol": "[", "comment": "", "smart_beacon": { @@ -17,7 +17,7 @@ } }, { - "callsign": "NOCALL-7", + "callsign": "CD2RXU-7", "symbol": ">", "comment": "", "smart_beacon": { @@ -33,8 +33,8 @@ } }, { - "callsign": "NOCALL-7", - "symbol": "b", + "callsign": "CD2RXU-7", + "symbol": "j", "comment": "", "smart_beacon": { "active": true, @@ -67,6 +67,7 @@ "rememberStationTime": 30, "maxDistanceToTracker": 30, "standingUpdateTime": 15, - "sendAltitude": true + "sendAltitude": true, + "sendBatteryInfo": false } } \ No newline at end of file diff --git a/src/LoRa_APRS_Tracker.cpp b/src/LoRa_APRS_Tracker.cpp index 0b3c463..6381fea 100644 --- a/src/LoRa_APRS_Tracker.cpp +++ b/src/LoRa_APRS_Tracker.cpp @@ -82,12 +82,12 @@ void setup() { GPS_Utils::setup(); LoRa_Utils::setup(); - /*WiFi.mode(WIFI_OFF); + WiFi.mode(WIFI_OFF); btStop(); logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "Main", "WiFi and BT controller stopped"); esp_bt_controller_disable(); - logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "Main", "BT controller disabled");*/ - BLE_Utils::setup(); + logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "Main", "BT controller disabled"); + //BLE_Utils::setup(); userButton.attachClick(BUTTON_Utils::singlePress); userButton.attachLongPressStart(BUTTON_Utils::longPress); diff --git a/src/configuration.cpp b/src/configuration.cpp index a95492a..40f7611 100644 --- a/src/configuration.cpp +++ b/src/configuration.cpp @@ -61,6 +61,7 @@ void Configuration::readFile(fs::FS &fs, const char *fileName) { maxDistanceToTracker = data["other"]["maxDistanceToTracker"].as(); standingUpdateTime = data["other"]["standingUpdateTime"].as(); sendAltitude = data["other"]["sendAltitude"].as(); + sendBatteryInfo = data["other"]["sendBatteryInfo"].as(); configFile.close(); } diff --git a/src/configuration.h b/src/configuration.h index 48d1fd2..a22b859 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -47,6 +47,7 @@ public: int maxDistanceToTracker; int standingUpdateTime; bool sendAltitude; + bool sendBatteryInfo; Configuration(); void validateConfigFile(String currentBeaconCallsign); diff --git a/src/station_utils.cpp b/src/station_utils.cpp index d8f51e8..0baef37 100644 --- a/src/station_utils.cpp +++ b/src/station_utils.cpp @@ -2,6 +2,7 @@ #include #include "station_utils.h" #include "configuration.h" +#include "power_utils.h" #include "lora_utils.h" #include "msg_utils.h" #include "gps_utils.h" @@ -13,6 +14,7 @@ extern Configuration Config; extern Beacon *currentBeacon; extern logging::Logger logger; extern TinyGPSPlus gps; +extern PowerManagement powerManagement; extern std::vector lastHeardStation; extern std::vector lastHeardStation_temp; extern String fourthLine; @@ -395,6 +397,17 @@ void sendBeacon() { } } + if (Config.sendBatteryInfo) { + String batteryVoltage = powerManagement.getBatteryInfoVoltage(); + String batteryChargeCurrent = powerManagement.getBatteryInfoCurrent(); + #ifdef TTGO_T_Beam_V1_0 + packet += " Bat=" + batteryVoltage + "V (" + batteryChargeCurrent + "mA)"; + #endif + #ifdef TTGO_T_Beam_V1_2 + packet += " Bat=" + String(batteryVoltage.toFloat()/1000,2) + "V (" + batteryChargeCurrent + "%)"; + #endif + } + logger.log(logging::LoggerLevel::LOGGER_LEVEL_DEBUG, "Loop", "%s", packet.c_str()); show_display("<<< TX >>>", "", packet,100); LoRa_Utils::sendNewPacket(packet);