diff --git a/.cargo/config.toml b/.cargo/config.toml index 008321d..c909f85 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -20,8 +20,6 @@ rustflags = [ # uncomment the next line if you wish to enable it # "-Z", "trap-unreachable=no", "-C", - "inline-threshold=5", - "-C", "no-vectorize-loops", ] diff --git a/Cargo.toml b/Cargo.toml index 7fb365a..8ec1be9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,7 +24,7 @@ micromath = { version = "2.1", features = ["vector"] } mpu6050 = { git = "https://github.com/michaelkamprath/mpu6050.git", branch = "micromath", features = [ "defmt", ] } -embedded-alloc = "0.5" +embedded-alloc = "0.6" adafruit-lcd-backpack = { version = "0.1", features = ["defmt"] } ini_core = "0.2" diff --git a/src/main.rs b/src/main.rs index f99adfb..3e8a7a2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -27,7 +27,7 @@ use rp_pico as bsp; extern crate alloc; -use embedded_alloc::Heap; +use embedded_alloc::TlsfHeap as Heap; #[global_allocator] static HEAP: Heap = Heap::empty(); diff --git a/src/robot.rs b/src/robot.rs index 11ffa9a..35567d0 100644 --- a/src/robot.rs +++ b/src/robot.rs @@ -371,7 +371,7 @@ where /// Returns a duty value normalized to the max duty of the motor. /// The duty is clamped to the range [0, 1]. fn noramlize_duty(&self, duty: f32) -> u16 { - (duty.max(0.0).min(1.0) * self.motors.enable_pin_a().get_max_duty() as f32) as u16 + (duty.clamp(0.0, 1.0) * self.motors.enable_pin_a().get_max_duty() as f32) as u16 } /// returns true if the button 1 is newly pressed diff --git a/src/system/data.rs b/src/system/data.rs index 00ae770..7ce1a38 100644 --- a/src/system/data.rs +++ b/src/system/data.rs @@ -66,8 +66,8 @@ where /// /// * `f` - The `defmt::Formatter` object that the graph should be printed to. /// * `value` - A function that gets called on each row in the data table to determine the value from that row to plot. - /// This function must take a reference to the row type and return an `i32`. The mapping of the desired - /// row value to the `i32` is for display purposes. + /// This function must take a reference to the row type and return an `i32`. The mapping of the desired + /// row value to the `i32` is for display purposes. pub fn plot(&self, f: &mut defmt::Formatter<'_>, value: fn(&T) -> i32) { // first we need to scan through the data to find the range of // values that we need to plot