Skip to content
Snippets Groups Projects
Commit 85b10e72 authored by zdmx's avatar zdmx :crab:
Browse files

Fix some linter warnings

parent 66e94a27
No related branches found
No related tags found
No related merge requests found
......@@ -14,7 +14,7 @@ use embedded_graphics::{
};
use esp_backtrace as _;
use esp_println::println;
use hal::{Rng, uart};
use hal::{Rng};
use heapless::Vec;
use smoltcp::wire::IpEndpoint;
use tinybmp::Bmp;
......
use embassy_executor::Spawner;
use embassy_net::{Config, Ipv6Address, Ipv6Cidr, Stack, StackResources, StaticConfigV6};
use embassy_net::{Config, Stack, StackResources};
use embassy_net_badgelink::{Device, Runner, State};
use esp_println::println;
use hal::{
efuse::Efuse,
peripherals::{UART0, UART1, UART2},
Rng, Uart,
peripherals::{UART1, UART2}, Uart,
};
use heapless::Vec;
use static_cell::StaticCell;
static STATE_LEFT: StaticCell<State<8, 8>> = StaticCell::new();
......
use hal::{i2c::I2C, peripherals::{I2C0, UART0, UART1}, Uart, Rng};
use hal::{i2c::I2C, peripherals::{I2C0}};
use port_expander::{dev::max7321::Driver, Max7321};
use shared_bus::{I2cProxy, NullMutex, XtensaMutex};
......
......@@ -93,24 +93,24 @@ impl Flow3rPetal {
pub fn pressed(&self) -> bool {
match self {
Flow3rPetal::TOP {
number,
number: _,
ccw,
base,
cw,
} => ccw.pressed | base.pressed | cw.pressed,
Flow3rPetal::BOTTOM { number, base, tip } => base.pressed | tip.pressed,
Flow3rPetal::BOTTOM { number: _, base, tip } => base.pressed | tip.pressed,
}
}
pub fn position(&self) -> i32 {
match self {
Flow3rPetal::TOP {
number,
number: _,
ccw,
base,
cw,
} => (ccw.raw as i32 + cw.raw as i32) / 2 - base.raw as i32,
Flow3rPetal::BOTTOM { number, base, tip } => base.raw as i32 + tip.raw as i32 / 2,
Flow3rPetal::BOTTOM { number: _, base, tip } => base.raw as i32 + tip.raw as i32 / 2,
}
}
......@@ -118,23 +118,23 @@ impl Flow3rPetal {
match self {
Flow3rPetal::TOP {
number,
ccw,
base,
cw,
ccw: _,
base: _,
cw: _,
} => *number,
Flow3rPetal::BOTTOM { number, base, tip } => *number,
Flow3rPetal::BOTTOM { number, base: _, tip: _ } => *number,
}
}
fn update(&mut self, pressed: &[bool], values: &[u16]) {
fn update(&mut self, pressed: &[bool], _values: &[u16]) {
match self {
Flow3rPetal::TOP {
number,
number: _,
ccw,
base,
cw,
base: _,
cw: _,
} => ccw.pressed = pressed[0],
Flow3rPetal::BOTTOM { number, base, tip } => todo!(),
Flow3rPetal::BOTTOM { number: _, base: _, tip: _ } => todo!(),
}
}
}
......@@ -515,7 +515,7 @@ static PETAL_MAPPING_TOP: [(usize, PetalPosition); 12] = [
(6, PetalPosition::BASE),
];
async fn update_petals_top(interrupts: u16, measurements: [u16; 12]) {
async fn update_petals_top(_interrupts: u16, measurements: [u16; 12]) {
let mut petals = PETALS.lock().await;
for (i, m) in PETAL_MAPPING_TOP.iter().enumerate() {
let pressed = measurements[i] > 50000;
......@@ -575,7 +575,7 @@ static PETAL_MAPPPING_BOT: [(usize, PetalPosition); 12] = [
(2, PetalPosition::CW),
];
async fn update_petals_bot(interrupts: u16, measurements: [u16; 12]) {
async fn update_petals_bot(_interrupts: u16, measurements: [u16; 12]) {
let mut petals = PETALS.lock().await;
for (i, m) in PETAL_MAPPPING_BOT.iter().enumerate() {
let pressed = measurements[i] > 40000;
......
use bmi270::{interface::I2cInterface, AuxData, AxisData, Bmi270, Error, PwrCtrl};
use esp_println::println;
use bmi270::{interface::I2cInterface, AuxData, AxisData, Bmi270, Error};
use hal::{i2c::I2C, peripherals::I2C0};
use shared_bus::{I2cProxy, XtensaMutex};
......@@ -9,7 +9,7 @@ pub struct ImuHandler {
impl ImuHandler {
pub fn new(i2c: I2cProxy<'static, XtensaMutex<I2C<'static, I2C0>>>) -> Self {
let mut bmi270 = Bmi270::new_i2c(i2c, bmi270::I2cAddr::Default, bmi270::Burst::Max);
let bmi270 = Bmi270::new_i2c(i2c, bmi270::I2cAddr::Default, bmi270::Burst::Max);
/*
if let Some(chip_id) = bmi270.get_chip_id().ok() {
......
use hal::{Uart, Rng};
use hal::peripherals::{UART0, UART1};
use hal::{Rng};
use self::badgelink::BadgeLink;
use self::badgelink::badgenet::{BadgenetUartLeft, BadgenetUartRight};
......
......@@ -10,7 +10,7 @@ use hal::Rng;
use static_cell::StaticCell;
use crate::{
demo_tasks::{display_demo, imu_demo, captouch_demo, badgelink_demo},
demo_tasks::{display_demo, imu_demo, captouch_demo},
flow3r::{display::Display, input::InputHandler, imu::ImuHandler, badgelink::{badgenet::{BadgenetUartLeft, BadgenetUartRight}, BadgeLink}},
};
......@@ -111,7 +111,7 @@ async fn play_transition_animation<'a>(
}
}
async fn start_current_app(app: &str, display: &mut Display, imu: &mut ImuHandler, badgelink: &mut BadgeLink, uart0: &'static mut BadgenetUartLeft, uart1: &'static mut BadgenetUartRight, rng: &'static mut Rng) -> (&'static mut BadgenetUartLeft, &'static mut BadgenetUartRight, &'static mut Rng) {
async fn start_current_app(app: &str, display: &mut Display, imu: &mut ImuHandler, _badgelink: &mut BadgeLink, uart0: &'static mut BadgenetUartLeft, uart1: &'static mut BadgenetUartRight, rng: &'static mut Rng) -> (&'static mut BadgenetUartLeft, &'static mut BadgenetUartRight, &'static mut Rng) {
match app {
"input_test" => {display_demo(display).await; (uart0, uart1, rng)}
"imu_test" =>{imu_demo(display, imu).await; (uart0, uart1, rng)}
......
......@@ -8,9 +8,9 @@ mod demo_tasks;
mod flow3r;
mod runtime;
use demo_tasks::{draw_start_screen, badgelink_demo};
use demo_tasks::{draw_start_screen};
use embassy_executor::Spawner;
use embassy_time::{Duration, Timer};
use esp_backtrace as _;
use flow3r::{ui::main_menu::main_menu, Flow3r};
......
......@@ -93,6 +93,8 @@ async fn init_runtime() {
let mut cpu_control = CpuControl::new(system.cpu_control);
let _ = APP_CORE_GUARD.init(cpu_control.start_app_core(app_core_fn).unwrap());
println!("started second core");
// Async requires the GPIO interrupt to wake futures
hal::interrupt::enable(
hal::peripherals::Interrupt::GPIO,
......@@ -231,6 +233,8 @@ async fn init_runtime() {
))
.ok();
println!("Init finished, handing over to main");
// Hand over to main task
spawner.spawn(main(flow3r)).ok();
/*spawner.spawn(test_pins_a(io.pins.gpio5)).unwrap();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment