Remove unused pin from null driver

This commit is contained in:
Tobias Reisinger 2024-12-25 01:53:21 +01:00
parent 5ee542b44b
commit ea222793ca
Signed by: serguzim
GPG key ID: 13AD60C237A28DFE
2 changed files with 4 additions and 6 deletions

View file

@ -1,13 +1,11 @@
use crate::drivers::RelayDriver; use crate::drivers::RelayDriver;
use crate::errors::EmgauwaControllerError; use crate::errors::EmgauwaControllerError;
pub struct NullDriver { pub struct NullDriver {}
pub pin: u8,
}
impl NullDriver { impl NullDriver {
pub fn new(pin: u8) -> Self { pub fn new() -> Self {
Self { pin } Self {}
} }
} }

View file

@ -96,7 +96,7 @@ impl Relay {
state: bool, state: bool,
) -> Result<Box<dyn drivers::RelayDriver>, EmgauwaError> { ) -> Result<Box<dyn drivers::RelayDriver>, EmgauwaError> {
let mut driver: Box<dyn drivers::RelayDriver> = match self.driver { let mut driver: Box<dyn drivers::RelayDriver> = match self.driver {
drivers::Driver::Null => Box::new(drivers::NullDriver::new(self.pin)), drivers::Driver::Null => Box::new(drivers::NullDriver::new()),
drivers::Driver::Gpio => Box::new(drivers::GpioDriver::new(self.pin, self.inverted)?), drivers::Driver::Gpio => Box::new(drivers::GpioDriver::new(self.pin, self.inverted)?),
drivers::Driver::PiFace => { drivers::Driver::PiFace => {
if pfd.is_none() { if pfd.is_none() {