Skip to content

Commit

Permalink
lint and clippy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
twoshark committed Jul 31, 2024
1 parent 804dcce commit 9575606
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 24 deletions.
27 changes: 13 additions & 14 deletions input_controller/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@

extern crate panic_halt;

use arduino_hal::hal::port::{
PE4, PJ0, PJ1,
};
use arduino_hal::hal::port::{PE4, PJ0, PJ1};
use arduino_hal::port;
use arduino_hal::port::mode::{Input, Output};
use arduino_hal::prelude::*;
use arduino_hal::port;
use max485::Max485;

use hotline::hotline_protocol::HotlineMessage;
Expand Down Expand Up @@ -94,10 +92,9 @@ fn main() -> ! {
usb.write_str("[Sign] Lighting Pilot...\n").unwrap();
}
sign_pilot = true;
} else {
if sign_pilot {
usb.write_str("[Sign] Turning Off Pilot...\n").unwrap();
}
} else if sign_pilot {
usb.write_str("[Sign] Turning Off Pilot...\n").unwrap();
sign_pilot = false;
}

let all = sign_pin_all.is_low();
Expand Down Expand Up @@ -138,11 +135,10 @@ fn main() -> ! {
usb.write_str("[MegaPoofer] Lighting Pilot...\n").unwrap();
}
mp_pilot = true;
} else {
if mp_pilot {
usb.write_str("[MegaPoofer] Turning Off Pilot...\n")
.unwrap();
}
} else if mp_pilot {
usb.write_str("[MegaPoofer] Turning Off Pilot...\n")
.unwrap();
mp_pilot = false;
}

let all = mp_pin_all.is_low();
Expand All @@ -157,7 +153,10 @@ fn main() -> ! {

match send_message(&mut rs485, msg) {
Ok(()) => {}
Err(()) => {}
Err(()) => {
usb.write_str("[MegaPoofer] Error Sending Hotline Message\n")
.unwrap();
}
}
} else {
if mp_arm {
Expand Down
20 changes: 10 additions & 10 deletions output_controller/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ fn main() -> ! {
let mut pin_output_5 = pins.d32.into_output();
let mut pin_output_6 = pins.d34.into_output();
let mut pin_output_7 = pins.d36.into_output();


// RS485 digital output pin
let mut pin_rs485_enable = pins.d2.into_output();
Expand All @@ -58,14 +57,14 @@ fn main() -> ! {
let mut rs485 = Max485::new(serial, pin_rs485_enable);
usb.write_str("Serial Initialized\n").unwrap();

let mut states: [bool; 4] = [false; 4];
let mut states: [bool; 8] = [false; 8];
loop {
// Read a byte from the serial connection
match receive_command(&mut rs485, &mut usb) {
Some(msg) => {
let device_id = msg.device_id;
// 0x00 - Sign, 0x01 - MegaPoofer, 0xFF - All outputs
if device_id == 0x01 || device_id == 0x00 || device_id == 0xFF {
if device_id == 0x01 || device_id == 0x00 || device_id == 0xFF {
if let Some(state) = msg.get_dio_state(0) {
if state != states[0] {
if state {
Expand Down Expand Up @@ -174,13 +173,14 @@ fn main() -> ! {
}
}
}
usb.write_str("Received command - ").unwrap();
ufmt::uwrite!(
usb,
"Device ID: {:X}, States: {:?}\n",
msg.device_id,
states,
).unwrap();
usb.write_str("Received command - ").unwrap();
ufmt::uwrite!(
usb,
"Device ID: {:X}, States: {:?}\n",
msg.device_id,
states,
)
.unwrap();
}
_ => {
usb.write_str("Failed to parse command.\n").unwrap();
Expand Down

0 comments on commit 9575606

Please sign in to comment.