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]]
name = "tesla-charge-controller"
version = "0.1.20-prerelease"
version = "0.1.20"
dependencies = [
"async-channel",
"chrono",

View file

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

View file

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