update for better BLE
This commit is contained in:
parent
833dafda34
commit
dbb8976e31
|
|
@ -45,7 +45,7 @@ TinyGPSPlus gps;
|
||||||
OneButton userButton = OneButton(BUTTON_PIN, true, true);
|
OneButton userButton = OneButton(BUTTON_PIN, true, true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
String versionDate = "2024.07.11";
|
String versionDate = "2024.07.13";
|
||||||
|
|
||||||
uint8_t myBeaconsIndex = 0;
|
uint8_t myBeaconsIndex = 0;
|
||||||
int myBeaconsSize = Config.beacons.size();
|
int myBeaconsSize = Config.beacons.size();
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,9 @@ class MyServerCallbacks : public NimBLEServerCallbacks {
|
||||||
bluetoothConnected = false;
|
bluetoothConnected = false;
|
||||||
logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "BLE", "%s", "BLE client Disconnected, Started Advertising");
|
logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "BLE", "%s", "BLE client Disconnected, Started Advertising");
|
||||||
pServer->startAdvertising();
|
pServer->startAdvertising();
|
||||||
|
LoRa_Utils::sleepRadio();
|
||||||
|
delay(500);
|
||||||
|
LoRa_Utils::wakeRadio();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -184,6 +184,7 @@ namespace LoRa_Utils {
|
||||||
receivedLoraPacket.freqError = radio.getFrequencyError();
|
receivedLoraPacket.freqError = radio.getFrequencyError();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
//Serial.println(packet);
|
||||||
Serial.print(F("failed, code ")); // 7 = CRC mismatch
|
Serial.print(F("failed, code ")); // 7 = CRC mismatch
|
||||||
Serial.println(state);
|
Serial.println(state);
|
||||||
}
|
}
|
||||||
|
|
@ -192,6 +193,10 @@ namespace LoRa_Utils {
|
||||||
return receivedLoraPacket;
|
return receivedLoraPacket;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wakeRadio() {
|
||||||
|
radio.startReceive();
|
||||||
|
}
|
||||||
|
|
||||||
void sleepRadio() {
|
void sleepRadio() {
|
||||||
radio.sleep();
|
radio.sleep();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ namespace LoRa_Utils {
|
||||||
void setup();
|
void setup();
|
||||||
void sendNewPacket(const String& newPacket);
|
void sendNewPacket(const String& newPacket);
|
||||||
ReceivedLoRaPacket receivePacket();
|
ReceivedLoRaPacket receivePacket();
|
||||||
|
void wakeRadio();
|
||||||
void sleepRadio();
|
void sleepRadio();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue