analyzeStatusByte method

void analyzeStatusByte(
  1. int statusByte
)

Debugging function to analyze the status byte

Implementation

void analyzeStatusByte(int statusByte) {
  String bits = statusByte.toRadixString(2).padLeft(8, "0");
  log('\n==== STATUS BYTE ANALYSIS: $statusByte (0x${statusByte.toRadixString(16).padLeft(2, "0")}) ====');
  log('Binary representation: $bits');
  log('Bit 0 (LSB): ${(statusByte & 0x01) != 0 ? "1" : "0"} - ${describeBit(0, statusByte & 0x01)}');
  log('Bit 1: ${(statusByte & 0x02) != 0 ? "1" : "0"} - ${describeBit(1, statusByte & 0x02)}');
  log('Bit 2: ${(statusByte & 0x04) != 0 ? "1" : "0"} - ${describeBit(2, statusByte & 0x04)}');
  log('Bit 3: ${(statusByte & 0x08) != 0 ? "1" : "0"} - ${describeBit(3, statusByte & 0x08)}');
  log('Bit 4: ${(statusByte & 0x10) != 0 ? "1" : "0"} - ${describeBit(4, statusByte & 0x10)}');
  log('Bit 5: ${(statusByte & 0x20) != 0 ? "1" : "0"} - ${describeBit(5, statusByte & 0x20)}');
  log('Bit 6: ${(statusByte & 0x40) != 0 ? "1" : "0"} - ${describeBit(6, statusByte & 0x40)}');
  log('Bit 7 (MSB): ${(statusByte & 0x80) != 0 ? "1" : "0"} - ${describeBit(7, statusByte & 0x80)}');
  log('========================================');
}