From 2e1a5e0fbf3b7c51446a219ffb3b61ba7100687d Mon Sep 17 00:00:00 2001 From: Winston Lowe Date: Sun, 18 Jan 2026 01:03:45 -0800 Subject: [PATCH] added CMD_SET_CUSTOM_VAR to BLE debug --- lib/services/ble_debug_log_service.dart | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/lib/services/ble_debug_log_service.dart b/lib/services/ble_debug_log_service.dart index 002161b..a53ad5d 100644 --- a/lib/services/ble_debug_log_service.dart +++ b/lib/services/ble_debug_log_service.dart @@ -16,7 +16,9 @@ class BleDebugLogEntry { String get hexPreview { const maxBytes = 64; - final bytes = payload.length > maxBytes ? payload.sublist(0, maxBytes) : payload; + final bytes = payload.length > maxBytes + ? payload.sublist(0, maxBytes) + : payload; final hex = bytes.map((b) => b.toRadixString(16).padLeft(2, '0')).join(' '); return payload.length > maxBytes ? '$hex …' : hex; } @@ -26,14 +28,13 @@ class BleRawLogRxEntry { final DateTime timestamp; final Uint8List payload; - BleRawLogRxEntry({ - required this.timestamp, - required this.payload, - }); + BleRawLogRxEntry({required this.timestamp, required this.payload}); String get hexPreview { const maxBytes = 64; - final bytes = payload.length > maxBytes ? payload.sublist(0, maxBytes) : payload; + final bytes = payload.length > maxBytes + ? payload.sublist(0, maxBytes) + : payload; final hex = bytes.map((b) => b.toRadixString(16).padLeft(2, '0')).join(' '); return payload.length > maxBytes ? '$hex …' : hex; } @@ -45,7 +46,8 @@ class BleDebugLogService extends ChangeNotifier { final List _rawLogRxEntries = []; List get entries => List.unmodifiable(_entries); - List get rawLogRxEntries => List.unmodifiable(_rawLogRxEntries); + List get rawLogRxEntries => + List.unmodifiable(_rawLogRxEntries); void logFrame(Uint8List frame, {required bool outgoing, String? note}) { if (frame.isEmpty) return; @@ -85,7 +87,12 @@ class BleDebugLogService extends ChangeNotifier { notifyListeners(); } - String _describeFrame(int code, Uint8List frame, bool outgoing, String? note) { + String _describeFrame( + int code, + Uint8List frame, + bool outgoing, + String? note, + ) { final label = _codeLabel(code, outgoing: outgoing); final prefix = outgoing ? 'TX' : 'RX'; final extra = _frameDetail(code, frame); @@ -147,6 +154,8 @@ class BleDebugLogService extends ChangeNotifier { return 'CMD_SET_CHANNEL'; case cmdGetRadioSettings: return 'CMD_GET_RADIO_SETTINGS'; + case cmdSetCustomVar: + return 'CMD_SET_CUSTOM_VAR'; default: return null; }