}
impl PowerController {
- pub fn new() -> anyhow::Result<Self> {
- let chip1 = Chip::new("/dev/gpiochip1").context("gpiod chip1")?;
+ pub fn new(is_latching_system: bool) -> anyhow::Result<Self> {
+ let chip1 = if is_latching_system {
+ "/dev/gpiochip1"
+ } else {
+ "/dev/gpiochip2"
+ };
+
+ let chip1 = Chip::new(chip1).context(chip1)?;
let lines = load_lines(&chip1);
let port1 = *lines
.get(PORT1_EN)
}
}
-impl std::fmt::Debug for PowerController {
- fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
- write!(f, "PowerController")
- }
-}
-
async fn set_mode(node_id: usize, node_state: u8) -> std::io::Result<()> {
let node_value = if node_state > 0 {
"enabled"