Skip to content

Commit

Permalink
clippy / fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
arosspope committed Dec 24, 2023
1 parent 6012c76 commit 291a018
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
10 changes: 5 additions & 5 deletions src/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ impl DotDisplay<'_> {
self.turn_on_display()?;
}

if let Err(_) = self.display.write_raw(0, input) {
if self.display.write_raw(0, input).is_err() {
error!("Failed to write to display");
}

Expand All @@ -48,7 +48,7 @@ impl DotDisplay<'_> {
error!("Display already off");
}

if let Err(_) = self.display.power_off() {
if self.display.power_off().is_err() {
error!("Failed to power off display");
}

Expand All @@ -61,7 +61,7 @@ impl DotDisplay<'_> {
error!("Display already on");
}

if let Err(_) = self.display.power_on() {
if self.display.power_on().is_err() {
error!("Failed to power on display");
}
self.display_is_on = true;
Expand All @@ -80,7 +80,7 @@ impl DotDisplay<'_> {
}

pub fn reset_display(&mut self) -> Result<(), Error> {
if let Err(_) = self.display.clear_display(0) {
if self.display.clear_display(0).is_err() {
error!("Failed to clear display");
}
Ok(())
Expand All @@ -92,7 +92,7 @@ impl DotDisplay<'_> {
}

let brightness = brightness as f32 * 2.55;
if let Err(_) = self.display.set_intensity(0, brightness as u8) {
if self.display.set_intensity(0, brightness as u8).is_err() {
error!("Failed to set intensity of display")
}
self.brightness = brightness as usize;
Expand Down
9 changes: 4 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ fn main() -> anyhow::Result<()> {
let data = PinDriver::output(peripherals.pins.gpio0)?;
let cs = PinDriver::output(peripherals.pins.gpio1)?;
let sck = PinDriver::output(peripherals.pins.gpio2)?;
let ticker = Arc::new(Mutex::new(Ticker::new(
DotDisplay::from(MAX7219::from_pins(1, data, cs, sck).unwrap())?,
)));
let ticker = Arc::new(Mutex::new(Ticker::new(DotDisplay::from(
MAX7219::from_pins(1, data, cs, sck).unwrap(),
)?)));

// Set up the HttpServer
let mut server = EspHttpServer::new(&Configuration::default())?;
Expand Down Expand Up @@ -140,8 +140,7 @@ fn main() -> anyhow::Result<()> {
// Now connected
led.set_pixel(RGB8::new(0, 100, 0))?;
if let Ok(mut t) = ticker.lock() {
t.display
.set_brightness(80)?;
t.display.set_brightness(80)?;
t.set_message(&format!(
"{:?}",
wifi.driver.wifi().sta_netif().get_ip_info()?.ip
Expand Down

0 comments on commit 291a018

Please sign in to comment.