AIR版的功能添加

This commit is contained in:
2026-09-21 10:50:42 +08:00
parent 413a1c2815
commit d49184c06e
2 changed files with 56 additions and 79 deletions

View File

@@ -173,11 +173,13 @@ class BleProtocolDecoder {
}
String obstacleText(String v) {
final o = int.tryParse(v) ?? -1;
// 障碍物只有 0/1 两种状态;无法识别为数字时一律显示 '--',
// 绝不回吐原始值,避免数据包尾字节导致的乱码显示。
final o = int.tryParse(v.trim());
return switch (o) {
0 => '无障碍',
1 => '有障碍',
_ => v.isNotEmpty ? v : '--',
_ => '--',
};
}