dont cascade pl errors

This commit is contained in:
Alex Janka 2024-01-12 22:46:32 +11:00
parent e1c6759e85
commit 01dc8ab679
3 changed files with 4 additions and 4 deletions

2
Cargo.lock generated
View file

@ -2256,7 +2256,7 @@ dependencies = [
[[package]] [[package]]
name = "tesla-charge-controller" name = "tesla-charge-controller"
version = "0.1.20-prerelease" version = "0.1.20"
dependencies = [ dependencies = [
"async-channel", "async-channel",
"chrono", "chrono",

View file

@ -1,6 +1,6 @@
[package] [package]
name = "tesla-charge-controller" name = "tesla-charge-controller"
version = "0.1.20-prerelease" version = "0.1.20"
edition = "2021" edition = "2021"
license = "MITNFA" license = "MITNFA"
description = "Controls Tesla charge rate based on solar charge data" description = "Controls Tesla charge rate based on solar charge data"

View file

@ -217,9 +217,9 @@ impl Pli {
T: Into<u8>, T: Into<u8>,
{ {
self.send_command(command(20, address.into(), 0)); self.send_command(command(20, address.into(), 0));
let buf: [u8; 2] = self.receive()?; let buf: [u8; 1] = self.receive()?;
if buf[0] == 200 { if buf[0] == 200 {
Ok(buf[1]) Ok(self.receive::<1>()?[0])
} else { } else {
Err(PliError::ReadError(buf[0])) Err(PliError::ReadError(buf[0]))
} }