File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -203,6 +203,8 @@ class Core {
203203
204204 void onLoop () {
205205 if (!isConnected ()) {
206+ receivedNotificationAt = 0 ;
207+ receivedBatteryAt = 0 ;
206208 if (advDevice != nullptr ) {
207209 auto connectionResult = connectToServer (advDevice);
208210 if (!connectionResult || !isConnected ()) {
@@ -256,10 +258,12 @@ class Core {
256258 }
257259 unsigned long getReceiveNotificationAt () { return receivedNotificationAt; }
258260 uint8_t getCountFailedConnection () { return countFailedConnection; }
261+ unsigned long getReceiveBatteryAt () { return receivedBatteryAt; }
259262
260263 private:
261264 ConnectionState connectionState = ConnectionState::Scanning;
262265 unsigned long receivedNotificationAt = 0 ;
266+ unsigned long receivedBatteryAt = 0 ;
263267 uint32_t msScanTime = 4000 ; /* * 0 = scan forever */
264268 uint8_t countFailedConnection = 0 ;
265269 uint8_t retryCountInOneConnection = 3 ;
@@ -513,6 +517,7 @@ class Core {
513517 } else {
514518 if (sUuid .equals (uuidServiceBattery)) {
515519 battery = pData[0 ];
520+ receivedBatteryAt = millis ();
516521#ifdef XBOX_SERIES_X_CONTROLLER_DEBUG_SERIAL
517522 XBOX_SERIES_X_CONTROLLER_DEBUG_SERIAL.println (" battery notification" );
518523#endif
You can’t perform that action at this time.
0 commit comments