mirror of
https://github.com/kavishdevar/librepods.git
synced 2026-04-28 09:07:14 +00:00
Fix charging states
This commit is contained in:
@@ -91,10 +91,10 @@ void BleManager::onDeviceDiscovered(const QBluetoothDeviceInfo &info)
|
|||||||
int caseNibble = flagsAndCaseBattery & 0x0F; // Extracts lower nibble
|
int caseNibble = flagsAndCaseBattery & 0x0F; // Extracts lower nibble
|
||||||
deviceInfo.caseBattery = (caseNibble == 15) ? -1 : caseNibble * 10;
|
deviceInfo.caseBattery = (caseNibble == 15) ? -1 : caseNibble * 10;
|
||||||
|
|
||||||
// Parse charging statuses from flags (lower 4 bits of data[7])
|
// Parse charging statuses from flags (uper 4 bits of data[7])
|
||||||
quint8 flags = flagsAndCaseBattery & 0x0F; // Extracts lower nibble
|
quint8 flags = (flagsAndCaseBattery >> 4) & 0x0F; // Extracts lower nibble
|
||||||
deviceInfo.leftCharging = areValuesFlipped ? (flags & 0x01) != 0 : (flags & 0x02) != 0; //
|
deviceInfo.rightCharging = areValuesFlipped ? (flags & 0x01) != 0 : (flags & 0x02) != 0; //
|
||||||
deviceInfo.rightCharging = areValuesFlipped ? (flags & 0x02) != 0 : (flags & 0x01) != 0; //
|
deviceInfo.leftCharging = areValuesFlipped ? (flags & 0x02) != 0 : (flags & 0x01) != 0; //
|
||||||
deviceInfo.caseCharging = (flags & 0x04) != 0; // Keeping original bit 1 for consistency
|
deviceInfo.caseCharging = (flags & 0x04) != 0; // Keeping original bit 1 for consistency
|
||||||
|
|
||||||
// Additional status flags from status byte (data[5])
|
// Additional status flags from status byte (data[5])
|
||||||
|
|||||||
Reference in New Issue
Block a user