Start commenting code
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
86e67f42cb
commit
6da1676840
2 changed files with 5 additions and 0 deletions
|
@ -42,6 +42,8 @@ impl Device{
|
||||||
match response{
|
match response{
|
||||||
Some(response_value)=> {
|
Some(response_value)=> {
|
||||||
match 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=>{
|
Response::PasswordPrompt=>{
|
||||||
usb_port.write_to_device(Command::Newline);
|
usb_port.write_to_device(Command::Newline);
|
||||||
_ = usb_port.read_from_device(None);
|
_ = usb_port.read_from_device(None);
|
||||||
|
|
|
@ -9,9 +9,12 @@ pub struct GpioPins{
|
||||||
impl GpioPins{
|
impl GpioPins{
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
let mut output = Self { unassigned_addresses:Vec::new() };
|
let mut output = Self { unassigned_addresses:Vec::new() };
|
||||||
|
//For each of the relay addresses...
|
||||||
for pin in RELAY_ADDRESSES.iter(){
|
for pin in RELAY_ADDRESSES.iter(){
|
||||||
match Gpio::new(){
|
match Gpio::new(){
|
||||||
Ok(gpio_object) =>{
|
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()){
|
match gpio_object.get(pin.clone()){
|
||||||
Ok(pin_object)=>{
|
Ok(pin_object)=>{
|
||||||
_ = pin_object.into_output_low();
|
_ = pin_object.into_output_low();
|
||||||
|
|
Loading…
Add table
Reference in a new issue