cargo: clean up dependencies and improve build times

This commit is contained in:
2025-10-17 18:06:24 +02:00
parent baa85612b7
commit 088dde4450
13 changed files with 184 additions and 237 deletions

View File

@@ -1,25 +1,23 @@
use embassy_time::{Duration, Instant, Timer};
use esp_hal::{gpio::AnyPin, rmt::Rmt, time::Rate, timer::timg::Wdt};
use esp_hal_smartled::{buffer_size_async, SmartLedsAdapterAsync};
use figments::{prelude::*, surface::{BufferedSurfacePool, Surfaces}};
use figments::{prelude::*, surface::Surfaces};
use figments_render::gamma::GammaCurve;
use figments_render::output::{GammaCorrected, OutputAsync};
use log::{info, warn};
use rgb::Rgba;
use nalgebra::ComplexField;
use micromath::F32Ext;
use crate::display::{BikeOutput, DisplayControls, SegmentSpace, Uniforms};
//TODO: Import the bike surfaces from renderbug-prime, somehow make those surfaces into tasks
use crate::display::NUM_PIXELS;
use crate::{display::{BikeOutput, DisplayControls, Uniforms}, tasks::ui::UiSurfacePool};
#[embassy_executor::task]
pub async fn render(rmt: esp_hal::peripherals::RMT<'static>, gpio: AnyPin<'static>, surfaces: BufferedSurfacePool<Uniforms, SegmentSpace, Rgba<u8>>, safety_surfaces: BufferedSurfacePool<Uniforms, SegmentSpace, Rgba<u8>>, mut controls: DisplayControls, mut wdt: Wdt<esp_hal::peripherals::TIMG0<'static>>) {
pub async fn render(rmt: esp_hal::peripherals::RMT<'static>, gpio: AnyPin<'static>, surfaces: UiSurfacePool, safety_surfaces: UiSurfacePool, mut controls: DisplayControls, mut wdt: Wdt<esp_hal::peripherals::TIMG0<'static>>) {
let frequency: Rate = Rate::from_mhz(80);
let rmt = Rmt::new(rmt, frequency)
.expect("Failed to initialize RMT").into_async();
let rmt_channel = rmt.channel0;
let rmt_buffer = [0u32; buffer_size_async(178)];
let rmt_buffer = [0u32; buffer_size_async(NUM_PIXELS)];
//let target = SmartLedsAdapterAsync::new(rmt_channel, gpio, rmt_buffer);
let target = SmartLedsAdapterAsync::new(rmt_channel, gpio, rmt_buffer);
@@ -40,8 +38,6 @@ pub async fn render(rmt: esp_hal::peripherals::RMT<'static>, gpio: AnyPin<'stati
let mut output = BikeOutput::new(target, MAX_POWER_MW, controls.clone());
output.set_gamma(GammaCurve::new(1.3));
//#[cfg(not(feature="wokwi"))]
//output.set_gamma(GammaCurve::new(2.1));
info!("Rendering started! {}ms since boot", Instant::now().as_millis());
controls.notify_render_is_running(true);