ccs: pl and tristar modules underneath controller
This commit is contained in:
parent
e914f2fd10
commit
2fbae49297
4 changed files with 7 additions and 6 deletions
|
@ -1,3 +1,6 @@
|
|||
mod pl;
|
||||
mod tristar;
|
||||
|
||||
pub struct Controller {
|
||||
name: String,
|
||||
interval: std::time::Duration,
|
||||
|
@ -28,13 +31,13 @@ impl Controller {
|
|||
)> {
|
||||
let inner = match config.variant {
|
||||
crate::config::ChargeControllerVariant::Tristar => ControllerInner::Tristar(
|
||||
crate::tristar::Tristar::new(&config.name, &config.transport).await?,
|
||||
tristar::Tristar::new(&config.name, &config.transport).await?,
|
||||
),
|
||||
crate::config::ChargeControllerVariant::Pl {
|
||||
timeout_milliseconds,
|
||||
} => match &config.transport {
|
||||
crate::config::Transport::Serial { port, baud_rate } => ControllerInner::Pl(
|
||||
crate::pl::Pli::new(port, &config.name, *baud_rate, timeout_milliseconds)?,
|
||||
pl::Pli::new(port, &config.name, *baud_rate, timeout_milliseconds)?,
|
||||
),
|
||||
crate::config::Transport::Tcp { ip: _, port: _ } => {
|
||||
return Err(eyre::eyre!("pl doesn't support tcp"))
|
||||
|
@ -138,8 +141,8 @@ impl MultiTx {
|
|||
}
|
||||
|
||||
pub enum ControllerInner {
|
||||
Pl(crate::pl::Pli),
|
||||
Tristar(crate::tristar::Tristar),
|
||||
Pl(pl::Pli),
|
||||
Tristar(tristar::Tristar),
|
||||
}
|
||||
|
||||
impl ControllerInner {
|
||||
|
|
|
@ -25,8 +25,6 @@ enum Commands {
|
|||
|
||||
mod controller;
|
||||
mod gauges;
|
||||
mod pl;
|
||||
mod tristar;
|
||||
|
||||
mod web;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue