default to -1 if a device has no battery level.

this is just to make sure the unwrap() doesn't crash; -1 (or any negative value) is used as the "disconnected" value.
This commit is contained in:
cubee
2024-11-22 17:36:35 +11:00
committed by galister
parent c96ead7cf0
commit e818259b5b

View File

@@ -100,8 +100,8 @@ impl OscSender {
for device in &app.input_state.devices {
// i believe soc is the battery level, based on input.rs (status.charge)
let level = device.soc.unwrap();
// soc is the battery level (set to device status.charge)
let level = device.soc.unwrap_or(-1.0);
let mut parameter = "";
match device.role {