diff --git a/src/device.rs b/src/device.rs index b15f540..9cba465 100755 --- a/src/device.rs +++ b/src/device.rs @@ -42,6 +42,8 @@ impl Device{ match response{ Some(response_value)=> { match response_value{ + //If we got back a password prompt, that's a bad place to be in. Send a + //newline to failout of the Response::PasswordPrompt=>{ usb_port.write_to_device(Command::Newline); _ = usb_port.read_from_device(None); diff --git a/src/gpio_facade.rs b/src/gpio_facade.rs index a9abc92..fee283c 100755 --- a/src/gpio_facade.rs +++ b/src/gpio_facade.rs @@ -9,9 +9,12 @@ pub struct GpioPins{ impl GpioPins{ pub fn new() -> Self { let mut output = Self { unassigned_addresses:Vec::new() }; + //For each of the relay addresses... for pin in RELAY_ADDRESSES.iter(){ match Gpio::new(){ Ok(gpio_object) =>{ + //Get the relevant GPIO pin, initialise it to be off, store the address, and + //drop the pin so the Device object can pick it back up match gpio_object.get(pin.clone()){ Ok(pin_object)=>{ _ = pin_object.into_output_low();