Fix battery parsing issue

This commit is contained in:
Yehor Vialov 2025-02-06 14:35:35 +02:00
parent 1f49ed6bb0
commit 5046f4f416

View File

@ -102,15 +102,15 @@ void main(List<String> arguments) async {
payload['vel'] = recordProps['velocity']; payload['vel'] = recordProps['velocity'];
int? batt = recordProps['battery'] != null double? batt = recordProps['battery'] != null
? int.tryParse(recordProps['battery']) ? double.tryParse(recordProps['battery'].toString())
: null; : null;
if (batt != null && batt <= 1) { if (batt != null && batt <= 1) {
batt = batt * 100; batt = batt * 100;
} }
payload['batt'] = batt; payload['batt'] = batt?.toInt();
payload['bs'] = recordProps['battery_status']; payload['bs'] = recordProps['battery_status'];