From d0aeafc069efb0f43e1675cdb963b75b560bed50 Mon Sep 17 00:00:00 2001 From: Naxdy Date: Wed, 27 Mar 2024 22:31:55 +0100 Subject: [PATCH] fix: disable rumble for now (or we might blow a fuse, lel) --- src/gcc_hid.rs | 2 +- src/input.rs | 8 +++++--- src/main.rs | 12 ++++++------ 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/gcc_hid.rs b/src/gcc_hid.rs index cdd3966..2718915 100644 --- a/src/gcc_hid.rs +++ b/src/gcc_hid.rs @@ -260,7 +260,7 @@ pub async fn usb_transfer_loop(driver: Driver<'static, USB>, raw_serial: [u8; 8] usb_config.manufacturer = Some("Naxdy"); usb_config.product = Some("NaxGCC"); usb_config.serial_number = Some(serial); - usb_config.max_power = 100; + usb_config.max_power = 10; usb_config.max_packet_size_0 = 64; usb_config.device_class = 0; usb_config.device_protocol = 0; diff --git a/src/input.rs b/src/input.rs index ef3c311..f77cfec 100644 --- a/src/input.rs +++ b/src/input.rs @@ -397,8 +397,8 @@ pub async fn input_loop( btn_x: Input<'static, PIN_18>, btn_y: Input<'static, PIN_19>, btn_start: Input<'static, PIN_5>, - pwm_rumble: Pwm<'static, PWM_CH4>, - pwm_brake: Pwm<'static, PWM_CH6>, + // pwm_rumble: Pwm<'static, PWM_CH4>, + // pwm_brake: Pwm<'static, PWM_CH6>, mut spi: Spi<'static, SPI0, embassy_rp::spi::Blocking>, mut spi_acs: Output<'static, PIN_24>, mut spi_ccs: Output<'static, PIN_23>, @@ -476,6 +476,8 @@ pub async fn input_loop( let input_fut = async { loop { + let timer = Timer::after_micros(500); + update_button_states( &mut gcc_state, &btn_a, @@ -492,7 +494,7 @@ pub async fn input_loop( &btn_ddown, ); - yield_now().await; + timer.await; // not every loop pass is going to update the stick state match STICK_SIGNAL.try_take() { diff --git a/src/main.rs b/src/main.rs index 6ef5e68..dfa636a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -84,11 +84,11 @@ fn main() -> ! { pwm_config.enable = true; pwm_config.compare_b = 255; - let pwm_rumble = Pwm::new_output_b(p.PWM_CH4, p.PIN_25, pwm_config.clone()); - let pwm_brake = Pwm::new_output_b(p.PWM_CH6, p.PIN_29, pwm_config.clone()); + // let pwm_rumble = Pwm::new_output_b(p.PWM_CH4, p.PIN_25, pwm_config.clone()); + // let pwm_brake = Pwm::new_output_b(p.PWM_CH6, p.PIN_29, pwm_config.clone()); - pwm_rumble.set_counter(255); - pwm_brake.set_counter(0); + // pwm_rumble.set_counter(0); + // pwm_brake.set_counter(255); executor0.run(|spawner| { spawner @@ -106,8 +106,8 @@ fn main() -> ! { Input::new(p.PIN_18, gpio::Pull::Up), Input::new(p.PIN_19, gpio::Pull::Up), Input::new(p.PIN_5, gpio::Pull::Up), - pwm_rumble, - pwm_brake, + // pwm_rumble, + // pwm_brake, spi, spi_acs, spi_ccs,