ccs: tristar: explicit serial timeout
All checks were successful
Build and release .deb / Release (push) Successful in 53s

This commit is contained in:
Alex Janka 2025-01-03 14:16:34 +11:00
parent 9c87f12a7d
commit 8b26a8d6bb
3 changed files with 7 additions and 5 deletions

4
Cargo.lock generated
View file

@ -239,7 +239,7 @@ checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"
[[package]]
name = "charge-controller-supervisor"
version = "1.9.9-pre-13"
version = "1.9.9-pre-14"
dependencies = [
"chrono",
"clap",
@ -2203,7 +2203,7 @@ dependencies = [
[[package]]
name = "tesla-charge-controller"
version = "1.9.9-pre-13"
version = "1.9.9-pre-14"
dependencies = [
"chrono",
"clap",

View file

@ -4,7 +4,7 @@ default-members = ["charge-controller-supervisor"]
resolver = "2"
[workspace.package]
version = "1.9.9-pre-13"
version = "1.9.9-pre-14"
[workspace.lints.clippy]
pedantic = "warn"

View file

@ -256,8 +256,10 @@ impl ChargeStateGauges {
impl Tristar {
pub fn new(serial_port: &str, friendly_name: &str, baud_rate: u32) -> eyre::Result<Self> {
let modbus_serial =
tokio_serial::SerialStream::open(&tokio_serial::new(serial_port, baud_rate))?;
let modbus_serial = tokio_serial::SerialStream::open(
&tokio_serial::new(serial_port, baud_rate).timeout(std::time::Duration::from_secs(3)),
)?;
let slave = tokio_modbus::Slave(DEVICE_ID);
let modbus = tokio_modbus::client::rtu::attach_slave(modbus_serial, slave);
let charge_state_gauges = ChargeStateGauges::new(friendly_name);