diff --git a/app/src/main/java/com/example/medilightv2android/ble/BleManager.kt b/app/src/main/java/com/example/medilightv2android/ble/BleManager.kt index f9a4f0e..c799bf4 100644 --- a/app/src/main/java/com/example/medilightv2android/ble/BleManager.kt +++ b/app/src/main/java/com/example/medilightv2android/ble/BleManager.kt @@ -361,6 +361,7 @@ class BleManager private constructor(private val context: Context) { stopWatchdog() lastRxTimestamp = System.currentTimeMillis() watchdogRunning = true + debugLogger.info("WATCHDOG_STARTED timeout=${watchdogTimeoutMs}ms") watchdogJob = Thread({ while (watchdogRunning) { @@ -630,19 +631,21 @@ class BleManager private constructor(private val context: Context) { } } else { logw { "CCCD descriptor not found for RX characteristic" } - // No CCCD but still mark ready if characteristics exist handler.post { if (txCharacteristic != null && rxCharacteristic != null) { isServiceReady.value = true + startBatteryPolling() + startWatchdog() logd { "Service ready (no CCCD)" } } } } } ?: run { - // No RX characteristic, mark ready if TX exists handler.post { if (txCharacteristic != null) { isServiceReady.value = true + startBatteryPolling() + startWatchdog() logd { "Service ready (no RX)" } } }