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:
@@ -100,8 +100,8 @@ impl OscSender {
|
|||||||
|
|
||||||
for device in &app.input_state.devices {
|
for device in &app.input_state.devices {
|
||||||
|
|
||||||
// i believe soc is the battery level, based on input.rs (status.charge)
|
// soc is the battery level (set to device status.charge)
|
||||||
let level = device.soc.unwrap();
|
let level = device.soc.unwrap_or(-1.0);
|
||||||
let mut parameter = "";
|
let mut parameter = "";
|
||||||
|
|
||||||
match device.role {
|
match device.role {
|
||||||
|
|||||||
Reference in New Issue
Block a user