Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/XboxSeriesXControllerESP32_asukiaaa.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,8 @@ class Core {

void onLoop() {
if (!isConnected()) {
receivedNotificationAt = 0;
receivedBatteryAt = 0;
if (advDevice != nullptr) {
auto connectionResult = connectToServer(advDevice);
if (!connectionResult || !isConnected()) {
Expand Down Expand Up @@ -256,10 +258,12 @@ class Core {
}
unsigned long getReceiveNotificationAt() { return receivedNotificationAt; }
uint8_t getCountFailedConnection() { return countFailedConnection; }
unsigned long getReceiveBatteryAt() { return receivedBatteryAt; }

private:
ConnectionState connectionState = ConnectionState::Scanning;
unsigned long receivedNotificationAt = 0;
unsigned long receivedBatteryAt = 0;
uint32_t msScanTime = 4000; /** 0 = scan forever */
uint8_t countFailedConnection = 0;
uint8_t retryCountInOneConnection = 3;
Expand Down Expand Up @@ -513,6 +517,7 @@ class Core {
} else {
if (sUuid.equals(uuidServiceBattery)) {
battery = pData[0];
receivedBatteryAt = millis();
#ifdef XBOX_SERIES_X_CONTROLLER_DEBUG_SERIAL
XBOX_SERIES_X_CONTROLLER_DEBUG_SERIAL.println("battery notification");
#endif
Expand Down