warnings--
This commit is contained in:
@@ -11,7 +11,7 @@ use core::ptr::addr_of_mut;
|
|||||||
use embassy_executor::Spawner;
|
use embassy_executor::Spawner;
|
||||||
use embassy_time::{Instant, Timer};
|
use embassy_time::{Instant, Timer};
|
||||||
|
|
||||||
use esp_hal::{gpio::{Output, OutputConfig}, peripherals, time::Rate};
|
use esp_hal::{gpio::{Output, OutputConfig}, time::Rate};
|
||||||
#[allow(unused_imports)]
|
#[allow(unused_imports)]
|
||||||
use esp_hal::{
|
use esp_hal::{
|
||||||
clock::CpuClock, interrupt::software::SoftwareInterruptControl, system::{AppCoreGuard, CpuControl, Stack}, timer::{systimer::SystemTimer, timg::{TimerGroup, Wdt}},
|
clock::CpuClock, interrupt::software::SoftwareInterruptControl, system::{AppCoreGuard, CpuControl, Stack}, timer::{systimer::SystemTimer, timg::{TimerGroup, Wdt}},
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
use embassy_sync::{blocking_mutex::{raw::CriticalSectionRawMutex, Mutex}, signal::Signal, watch::{Receiver, Watch}};
|
use embassy_sync::{blocking_mutex::raw::CriticalSectionRawMutex, signal::Signal, watch::{Receiver, Watch}};
|
||||||
use figments::prelude::*;
|
use figments::prelude::*;
|
||||||
use core::{fmt::Debug, sync::atomic::{AtomicBool, AtomicU8}};
|
use core::{fmt::Debug, sync::atomic::{AtomicBool, AtomicU8}};
|
||||||
use alloc::sync::Arc;
|
use alloc::sync::Arc;
|
||||||
@@ -202,7 +202,7 @@ impl DisplayControls {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl GammaCorrected for DisplayControls {
|
impl GammaCorrected for DisplayControls {
|
||||||
fn set_gamma(&mut self, gamma: GammaCurve) {
|
fn set_gamma(&mut self, _gamma: GammaCurve) {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ use nalgebra::{ComplexField, RealField};
|
|||||||
|
|
||||||
use core::fmt::Debug;
|
use core::fmt::Debug;
|
||||||
|
|
||||||
use crate::{ego::{heading::HeadingEstimator, kalman::Ekf2D, orientation::OrientationEstimator}, events::{Notification, Prediction, Telemetry}, idle::IdleClock, Breaker, CircularBuffer};
|
use crate::{ego::{heading::HeadingEstimator, kalman::Ekf2D, orientation::OrientationEstimator}, events::{Notification, Prediction}, idle::IdleClock, Breaker, CircularBuffer};
|
||||||
|
|
||||||
#[derive(PartialEq, Debug, Default, Clone, Copy)]
|
#[derive(PartialEq, Debug, Default, Clone, Copy)]
|
||||||
pub enum MotionState {
|
pub enum MotionState {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
use embassy_sync::{channel::DynamicSender, pubsub::DynPublisher};
|
use embassy_sync::pubsub::DynPublisher;
|
||||||
use embassy_time::Timer;
|
use embassy_time::Timer;
|
||||||
|
|
||||||
use crate::events::{Notification, Scene};
|
use crate::events::{Notification, Scene};
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
use core::cell::RefCell;
|
use core::cell::RefCell;
|
||||||
use core::u8;
|
|
||||||
|
|
||||||
use embassy_embedded_hal::shared_bus::asynch::i2c::I2cDevice;
|
use embassy_embedded_hal::shared_bus::asynch::i2c::I2cDevice;
|
||||||
use embassy_sync::{blocking_mutex::raw::CriticalSectionRawMutex, channel::DynamicSender};
|
use embassy_sync::{blocking_mutex::raw::CriticalSectionRawMutex, channel::DynamicSender};
|
||||||
@@ -7,11 +6,7 @@ use embassy_time::{Delay, Timer, Instant};
|
|||||||
use esp_hal::{i2c::master::I2c, Async};
|
use esp_hal::{i2c::master::I2c, Async};
|
||||||
use log::*;
|
use log::*;
|
||||||
use mpu6050_dmp::{address::Address, calibration::CalibrationParameters, error_async::Error, sensor_async::Mpu6050};
|
use mpu6050_dmp::{address::Address, calibration::CalibrationParameters, error_async::Error, sensor_async::Mpu6050};
|
||||||
use mpu6050_dmp::{
|
use mpu6050_dmp::calibration::CalibrationActions;
|
||||||
calibration::CalibrationActions,
|
|
||||||
accel::Accel,
|
|
||||||
gyro::Gyro
|
|
||||||
};
|
|
||||||
use nalgebra::Vector3;
|
use nalgebra::Vector3;
|
||||||
use core::f32::consts::PI;
|
use core::f32::consts::PI;
|
||||||
use crate::events::SensorSource;
|
use crate::events::SensorSource;
|
||||||
@@ -134,7 +129,7 @@ async fn mpu_init(sensor: &mut Mpu6050<I2cDevice<'static, CriticalSectionRawMute
|
|||||||
info!("DMP initialized in {}ms", start.as_millis());
|
info!("DMP initialized in {}ms", start.as_millis());
|
||||||
warn!("Calibrating MPU from scratch");
|
warn!("Calibrating MPU from scratch");
|
||||||
let start = Instant::now();
|
let start = Instant::now();
|
||||||
let calibration_data = backoff.attempt(async || {
|
let _calibration_data = backoff.attempt(async || {
|
||||||
// TODO: Store calibration data with set_accel_calibration, set_gyro_calibration
|
// TODO: Store calibration data with set_accel_calibration, set_gyro_calibration
|
||||||
let mut actions = CalibrationActions::all();
|
let mut actions = CalibrationActions::all();
|
||||||
let mut accel;
|
let mut accel;
|
||||||
|
|||||||
@@ -1,15 +1,14 @@
|
|||||||
use core::{cell::RefCell, fmt::Binary};
|
use core::cell::RefCell;
|
||||||
|
|
||||||
|
use alloc::format;
|
||||||
use embassy_sync::pubsub::DynSubscriber;
|
use embassy_sync::pubsub::DynSubscriber;
|
||||||
use embassy_time::Timer;
|
use embassy_time::Timer;
|
||||||
use embedded_graphics::{image::{Image, ImageRaw}, mono_font::{ascii::{FONT_6X10, FONT_10X20, FONT_9X18_BOLD}, MonoTextStyleBuilder}, pixelcolor::BinaryColor, prelude::*, primitives::{Circle, Line, Polyline, PrimitiveStyle, PrimitiveStyleBuilder, Rectangle, StyledDrawable}, text::{self, Alignment, Baseline, Text}};
|
use embedded_graphics::{image::Image, mono_font::{ascii::{FONT_6X10, FONT_10X20, FONT_9X18_BOLD}, MonoTextStyleBuilder}, pixelcolor::BinaryColor, prelude::*, primitives::{Line, PrimitiveStyleBuilder, Rectangle, StyledDrawable}, text::{Alignment, Baseline, Text}};
|
||||||
use esp_hal::{i2c::master::I2c, Async};
|
use esp_hal::{i2c::master::I2c, Async};
|
||||||
use nalgebra::Vector2;
|
use nalgebra::Vector2;
|
||||||
use ssd1306::{mode::DisplayConfigAsync, prelude::DisplayRotation, size::DisplaySize128x64, I2CDisplayInterface, Ssd1306Async};
|
use ssd1306::{mode::DisplayConfigAsync, prelude::DisplayRotation, size::DisplaySize128x64, I2CDisplayInterface, Ssd1306Async};
|
||||||
use log::*;
|
use log::*;
|
||||||
|
|
||||||
use alloc::format;
|
|
||||||
|
|
||||||
use crate::{backoff::Backoff, ego::engine::MotionState, events::{Notification, Prediction, Scene, SensorSource, Telemetry}};
|
use crate::{backoff::Backoff, ego::engine::MotionState, events::{Notification, Prediction, Scene, SensorSource, Telemetry}};
|
||||||
|
|
||||||
mod images {
|
mod images {
|
||||||
@@ -42,6 +41,7 @@ pub async fn oled_task(i2c: I2c<'static, Async>, mut events: DynSubscriber<'sta
|
|||||||
let mut display = Ssd1306Async::new(interface.replace(None).unwrap(), DisplaySize128x64, DisplayRotation::Rotate0)
|
let mut display = Ssd1306Async::new(interface.replace(None).unwrap(), DisplaySize128x64, DisplayRotation::Rotate0)
|
||||||
.into_buffered_graphics_mode();
|
.into_buffered_graphics_mode();
|
||||||
if let Err(e) = display.init().await {
|
if let Err(e) = display.init().await {
|
||||||
|
warn!("Failed to set up OLED display: {e:?}");
|
||||||
interface.replace(Some(display.release()));
|
interface.replace(Some(display.release()));
|
||||||
Err(())
|
Err(())
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -1,14 +1,13 @@
|
|||||||
use embassy_sync::{channel::DynamicReceiver, pubsub::DynSubscriber};
|
use embassy_sync::pubsub::DynSubscriber;
|
||||||
use embassy_time::{Duration, Timer};
|
use embassy_time::{Duration, Timer};
|
||||||
use figments::prelude::*;
|
use figments::prelude::*;
|
||||||
use figments_render::output::Brightness;
|
use figments_render::output::Brightness;
|
||||||
use rgb::{Rgb, Rgba};
|
use rgb::Rgba;
|
||||||
use log::*;
|
|
||||||
use alloc::sync::Arc;
|
|
||||||
use core::fmt::Debug;
|
use core::fmt::Debug;
|
||||||
use futures::join;
|
use futures::join;
|
||||||
|
use log::*;
|
||||||
|
|
||||||
use crate::{animation::{AnimDisplay, AnimatedSurface, Animation}, display::{DisplayControls, SegmentSpace, Uniforms}, events::{Notification, Scene, SensorSource}, shaders::*, tasks::ui::UiSurfacePool};
|
use crate::{animation::{AnimDisplay, AnimatedSurface, Animation}, display::{DisplayControls, SegmentSpace, Uniforms}, events::Notification, shaders::*, tasks::ui::UiSurfacePool};
|
||||||
|
|
||||||
pub struct SafetyUi<S: Surface> {
|
pub struct SafetyUi<S: Surface> {
|
||||||
// Headlight and brakelight layers can only be overpainted by the bootsplash overlay layer
|
// Headlight and brakelight layers can only be overpainted by the bootsplash overlay layer
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
use embassy_sync::{channel::{DynamicReceiver, DynamicSender}, pubsub::{DynPublisher, DynSubscriber}};
|
use embassy_sync::pubsub::{DynPublisher, DynSubscriber};
|
||||||
use embassy_time::{Duration, Timer};
|
use embassy_time::{Duration, Timer};
|
||||||
use figments::prelude::*;
|
use figments::prelude::*;
|
||||||
use rgb::{Rgb, Rgba};
|
use rgb::{Rgb, Rgba};
|
||||||
use log::*;
|
|
||||||
use alloc::sync::Arc;
|
|
||||||
use core::fmt::Debug;
|
use core::fmt::Debug;
|
||||||
use futures::join;
|
use futures::join;
|
||||||
|
use log::*;
|
||||||
|
|
||||||
use crate::{animation::{AnimDisplay, AnimatedSurface, Animation}, display::{SegmentSpace, Uniforms}, events::{Notification, Scene, SensorSource, Telemetry}, shaders::*};
|
use crate::{animation::{AnimatedSurface, Animation}, display::{SegmentSpace, Uniforms}, events::{Notification, Scene, SensorSource, Telemetry}, shaders::*};
|
||||||
|
|
||||||
pub struct Ui<S: Surface> {
|
pub struct Ui<S: Surface> {
|
||||||
// Background layer provides an always-running background for everything to draw on
|
// Background layer provides an always-running background for everything to draw on
|
||||||
@@ -176,7 +175,7 @@ impl<S: Debug + Surface<Uniforms = Uniforms, CoordinateSpace = SegmentSpace, Pix
|
|||||||
|
|
||||||
type Pixel = S::Pixel;
|
type Pixel = S::Pixel;
|
||||||
|
|
||||||
fn set_shader<T: Shader<Self::Uniforms, Self::CoordinateSpace, Self::Pixel> + 'static>(&mut self, shader: T) {
|
fn set_shader<T: Shader<Self::Uniforms, Self::CoordinateSpace, Self::Pixel> + 'static>(&mut self, _shader: T) {
|
||||||
unimplemented!()
|
unimplemented!()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,13 @@
|
|||||||
use bleps::{ad_structure::{create_advertising_data, AdStructure, BR_EDR_NOT_SUPPORTED, LE_GENERAL_DISCOVERABLE}, attribute_server::{AttributeServer, NotificationData}, gatt, Ble, HciConnector};
|
use bleps::{ad_structure::{create_advertising_data, AdStructure, BR_EDR_NOT_SUPPORTED, LE_GENERAL_DISCOVERABLE}, attribute_server::AttributeServer, gatt, Ble, HciConnector};
|
||||||
use embassy_sync::channel::DynamicReceiver;
|
use embassy_sync::channel::DynamicReceiver;
|
||||||
use embassy_sync::pubsub::DynSubscriber;
|
use embassy_sync::pubsub::DynSubscriber;
|
||||||
use embassy_time::Timer;
|
|
||||||
use esp_hal::timer::AnyTimer;
|
use esp_hal::timer::AnyTimer;
|
||||||
use esp_wifi::ble::controller::BleConnector;
|
use esp_wifi::ble::controller::BleConnector;
|
||||||
use log::*;
|
use log::*;
|
||||||
|
|
||||||
use crate::events::Notification;
|
use crate::events::Notification;
|
||||||
|
|
||||||
pub async fn ble_task(notify: DynSubscriber<'static, Notification>, wifi_init: &esp_wifi::EspWifiController<'_>, bluetooth_device: esp_hal::peripherals::BT<'static>) {
|
pub async fn ble_task(_notify: DynSubscriber<'static, Notification>, wifi_init: &esp_wifi::EspWifiController<'_>, bluetooth_device: esp_hal::peripherals::BT<'static>) {
|
||||||
info!("Setting up BLE stack");
|
info!("Setting up BLE stack");
|
||||||
let connector = BleConnector::new(wifi_init, bluetooth_device);
|
let connector = BleConnector::new(wifi_init, bluetooth_device);
|
||||||
let get_millis = || esp_hal::time::Instant::now().duration_since_epoch().as_millis();
|
let get_millis = || esp_hal::time::Instant::now().duration_since_epoch().as_millis();
|
||||||
@@ -61,7 +60,7 @@ pub async fn ble_task(notify: DynSubscriber<'static, Notification>, wifi_init: &
|
|||||||
]
|
]
|
||||||
}]);
|
}]);
|
||||||
let mut rng = bleps::no_rng::NoRng;
|
let mut rng = bleps::no_rng::NoRng;
|
||||||
let mut srv = AttributeServer::new(&mut ble, &mut gatt_attributes, &mut rng);
|
let mut _srv = AttributeServer::new(&mut ble, &mut gatt_attributes, &mut rng);
|
||||||
|
|
||||||
info!("BLE running!");
|
info!("BLE running!");
|
||||||
// TODO: Somehow need to recreate the attributeserver after disconnecting?
|
// TODO: Somehow need to recreate the attributeserver after disconnecting?
|
||||||
@@ -89,9 +88,9 @@ pub async fn ble_task(notify: DynSubscriber<'static, Notification>, wifi_init: &
|
|||||||
|
|
||||||
// TODO: Wifi task needs to know when there is data to upload, so it only connects when needed.
|
// TODO: Wifi task needs to know when there is data to upload, so it only connects when needed.
|
||||||
#[embassy_executor::task]
|
#[embassy_executor::task]
|
||||||
pub async fn wireless_task(notify: DynamicReceiver<'static, Notification>, timer: AnyTimer<'static>, rng: esp_hal::peripherals::RNG<'static>, _wifi_device: esp_hal::peripherals::WIFI<'static>, bluetooth_device: esp_hal::peripherals::BT<'static>) {
|
pub async fn wireless_task(_notify: DynamicReceiver<'static, Notification>, timer: AnyTimer<'static>, rng: esp_hal::peripherals::RNG<'static>, _wifi_device: esp_hal::peripherals::WIFI<'static>, _bluetooth_device: esp_hal::peripherals::BT<'static>) {
|
||||||
let rng = esp_hal::rng::Rng::new(rng);
|
let rng = esp_hal::rng::Rng::new(rng);
|
||||||
let wifi_init =
|
let _wifi_init =
|
||||||
esp_wifi::init(timer, rng).expect("Failed to initialize WIFI/BLE controller");
|
esp_wifi::init(timer, rng).expect("Failed to initialize WIFI/BLE controller");
|
||||||
|
|
||||||
//ble_task(notify, &wifi_init, bluetooth_device).await;
|
//ble_task(notify, &wifi_init, bluetooth_device).await;
|
||||||
|
|||||||
Reference in New Issue
Block a user