diff --git a/src/LoRa_APRS_Tracker.cpp b/src/LoRa_APRS_Tracker.cpp index b3a6c16..3250b6a 100644 --- a/src/LoRa_APRS_Tracker.cpp +++ b/src/LoRa_APRS_Tracker.cpp @@ -147,15 +147,10 @@ void setup() { pinMode(Config.notification.buzzerPinVcc, OUTPUT); if (Config.notification.bootUpBeep) NOTIFICATION_Utils::start(); } - if (Config.notification.ledTx) { - pinMode(Config.notification.ledTxPin, OUTPUT); - } - if (Config.notification.ledMessage) { - pinMode(Config.notification.ledMessagePin, OUTPUT); - } - if (Config.notification.ledFlashlight) { - pinMode(Config.notification.ledFlashlightPin, OUTPUT); - } + if (Config.notification.ledTx) pinMode(Config.notification.ledTxPin, OUTPUT); + if (Config.notification.ledMessage) pinMode(Config.notification.ledMessagePin, OUTPUT); + if (Config.notification.ledFlashlight) pinMode(Config.notification.ledFlashlightPin, OUTPUT); + STATION_Utils::loadIndex(0); STATION_Utils::loadIndex(1); String workingFreq = " LoRa Freq ["; @@ -217,9 +212,7 @@ void loop() { } STATION_Utils::checkSmartBeaconValue(); - if (ackNumberSend >= 999) { - ackNumberSend = 1; - } + if (ackNumberSend >= 999) ackNumberSend = 1; POWER_Utils::batteryManager(); @@ -231,9 +224,7 @@ void loop() { Utils::checkDisplayEcoMode(); - if (keyboardConnected) { - KEYBOARD_Utils::read(); - } + if (keyboardConnected) KEYBOARD_Utils::read(); GPS_Utils::getData(); bool gps_time_update = gps.time.isUpdated(); @@ -268,12 +259,8 @@ void loop() { STATION_Utils::checkStandingUpdateTime(); } STATION_Utils::checkSmartBeaconState(); - if (sendUpdate && gps_loc_update) { - STATION_Utils::sendBeacon("GPS"); - } - if (gps_time_update) { - STATION_Utils::checkSmartBeaconInterval(currentSpeed); - } + if (sendUpdate && gps_loc_update) STATION_Utils::sendBeacon("GPS"); + if (gps_time_update) STATION_Utils::checkSmartBeaconInterval(currentSpeed); if (millis() - refreshDisplayTime >= 1000 || gps_time_update) { GPS_Utils::checkStartUpFrames(); diff --git a/src/gps_utils.cpp b/src/gps_utils.cpp index b2c6452..6aa79b1 100644 --- a/src/gps_utils.cpp +++ b/src/gps_utils.cpp @@ -52,18 +52,14 @@ namespace GPS_Utils { } void getData() { - if (disableGPS) { - return; - } + if (disableGPS) return; while (neo6m_gps.available() > 0) { gps.encode(neo6m_gps.read()); } } void setDateFromData() { - if (gps.time.isValid()) { - setTime(gps.time.hour(), gps.time.minute(), gps.time.second(), gps.date.day(), gps.date.month(), gps.date.year()); - } + if (gps.time.isValid()) setTime(gps.time.hour(), gps.time.minute(), gps.time.second(), gps.date.day(), gps.date.month(), gps.date.year()); } void calculateDistanceTraveled() { @@ -94,9 +90,7 @@ namespace GPS_Utils { } void checkStartUpFrames() { - if (disableGPS) { - return; - } + if (disableGPS) return; if ((millis() > 8000 && gps.charsProcessed() < 10)) { logger.log(logging::LoggerLevel::LOGGER_LEVEL_ERROR, "GPS", "No GPS frames detected! Try to reset the GPS Chip with this " diff --git a/src/lora_utils.cpp b/src/lora_utils.cpp index d57b783..b4f8f2f 100644 --- a/src/lora_utils.cpp +++ b/src/lora_utils.cpp @@ -144,12 +144,8 @@ namespace LoRa_Utils { digitalWrite(Config.ptt.io_pin, Config.ptt.reverse ? LOW : HIGH); delay(Config.ptt.preDelay); } - if (Config.notification.ledTx) { - digitalWrite(Config.notification.ledTxPin, HIGH); - } - if (Config.notification.buzzerActive && Config.notification.txBeep) { - NOTIFICATION_Utils::beaconTxBeep(); - } + if (Config.notification.ledTx) digitalWrite(Config.notification.ledTxPin, HIGH); + if (Config.notification.buzzerActive && Config.notification.txBeep) NOTIFICATION_Utils::beaconTxBeep(); #ifdef HAS_SX126X int state = radio.transmit("\x3c\xff\x01" + newPacket); if (state == RADIOLIB_ERR_NONE) { @@ -171,9 +167,7 @@ namespace LoRa_Utils { LoRa.write((const uint8_t *)newPacket.c_str(), newPacket.length()); LoRa.endPacket(); #endif - if (Config.notification.ledTx) { - digitalWrite(Config.notification.ledTxPin, LOW); - } + if (Config.notification.ledTx) digitalWrite(Config.notification.ledTxPin, LOW); if (Config.ptt.active) { delay(Config.ptt.postDelay); digitalWrite(Config.ptt.io_pin, Config.ptt.reverse ? HIGH : LOW);