small code cleaning
This commit is contained in:
parent
df803ed70a
commit
97122eec5b
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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 "
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue