ccs: tristar: explicit serial timeout
All checks were successful
Build and release .deb / Release (push) Successful in 53s
All checks were successful
Build and release .deb / Release (push) Successful in 53s
This commit is contained in:
parent
9c87f12a7d
commit
8b26a8d6bb
3 changed files with 7 additions and 5 deletions
4
Cargo.lock
generated
4
Cargo.lock
generated
|
@ -239,7 +239,7 @@ checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "charge-controller-supervisor"
|
name = "charge-controller-supervisor"
|
||||||
version = "1.9.9-pre-13"
|
version = "1.9.9-pre-14"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chrono",
|
"chrono",
|
||||||
"clap",
|
"clap",
|
||||||
|
@ -2203,7 +2203,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tesla-charge-controller"
|
name = "tesla-charge-controller"
|
||||||
version = "1.9.9-pre-13"
|
version = "1.9.9-pre-14"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chrono",
|
"chrono",
|
||||||
"clap",
|
"clap",
|
||||||
|
|
|
@ -4,7 +4,7 @@ default-members = ["charge-controller-supervisor"]
|
||||||
resolver = "2"
|
resolver = "2"
|
||||||
|
|
||||||
[workspace.package]
|
[workspace.package]
|
||||||
version = "1.9.9-pre-13"
|
version = "1.9.9-pre-14"
|
||||||
|
|
||||||
[workspace.lints.clippy]
|
[workspace.lints.clippy]
|
||||||
pedantic = "warn"
|
pedantic = "warn"
|
||||||
|
|
|
@ -256,8 +256,10 @@ impl ChargeStateGauges {
|
||||||
|
|
||||||
impl Tristar {
|
impl Tristar {
|
||||||
pub fn new(serial_port: &str, friendly_name: &str, baud_rate: u32) -> eyre::Result<Self> {
|
pub fn new(serial_port: &str, friendly_name: &str, baud_rate: u32) -> eyre::Result<Self> {
|
||||||
let modbus_serial =
|
let modbus_serial = tokio_serial::SerialStream::open(
|
||||||
tokio_serial::SerialStream::open(&tokio_serial::new(serial_port, baud_rate))?;
|
&tokio_serial::new(serial_port, baud_rate).timeout(std::time::Duration::from_secs(3)),
|
||||||
|
)?;
|
||||||
|
|
||||||
let slave = tokio_modbus::Slave(DEVICE_ID);
|
let slave = tokio_modbus::Slave(DEVICE_ID);
|
||||||
let modbus = tokio_modbus::client::rtu::attach_slave(modbus_serial, slave);
|
let modbus = tokio_modbus::client::rtu::attach_slave(modbus_serial, slave);
|
||||||
let charge_state_gauges = ChargeStateGauges::new(friendly_name);
|
let charge_state_gauges = ChargeStateGauges::new(friendly_name);
|
||||||
|
|
Loading…
Add table
Reference in a new issue