feat: don't inline time-critical functions
This commit is contained in:
parent
a09d21b4fd
commit
b6b5bb25a7
4 changed files with 9 additions and 3 deletions
|
@ -58,7 +58,7 @@ codegen-units = 1
|
|||
debug = 2
|
||||
debug-assertions = true
|
||||
incremental = false
|
||||
opt-level = 's'
|
||||
opt-level = 3
|
||||
lto = "fat"
|
||||
overflow-checks = true
|
||||
|
||||
|
@ -71,7 +71,7 @@ incremental = false
|
|||
lto = 'fat'
|
||||
# opt level needs to be benchmarked after every major feature
|
||||
# due to the changes in binary size and alignment
|
||||
opt-level = 's'
|
||||
opt-level = 3
|
||||
overflow-checks = false
|
||||
|
||||
# do not optimize proc-macro crates = faster builds from scratch
|
||||
|
|
|
@ -179,7 +179,7 @@ pub struct KalmanState {
|
|||
}
|
||||
|
||||
impl KalmanState {
|
||||
// runs kalman filter
|
||||
#[inline(never)]
|
||||
#[link_section = ".time_critical.run_kalman"]
|
||||
pub fn run_kalman(
|
||||
&mut self,
|
||||
|
@ -292,6 +292,7 @@ impl KalmanState {
|
|||
/// output at the rim longer when released.
|
||||
///
|
||||
/// Output is a tuple of the x and y positions.
|
||||
#[inline(never)]
|
||||
#[link_section = ".time_critical.run_waveshaping"]
|
||||
pub fn run_waveshaping(
|
||||
x_pos: f32,
|
||||
|
|
|
@ -82,6 +82,7 @@ pub enum StickAxis {
|
|||
YAxis,
|
||||
}
|
||||
|
||||
#[inline(never)]
|
||||
#[link_section = ".time_critical.read_ext_adc"]
|
||||
pub fn read_ext_adc<
|
||||
'a,
|
||||
|
@ -125,6 +126,7 @@ pub fn read_ext_adc<
|
|||
/// Gets the average stick state over a 1ms interval in a non-blocking fashion.
|
||||
/// Will wait until end_time is reached before continuing after reading the ADCs.
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
#[inline(never)]
|
||||
#[link_section = ".time_critical.update_stick_states"]
|
||||
async fn update_stick_states(
|
||||
current_stick_state: &StickState,
|
||||
|
@ -540,6 +542,7 @@ pub async fn update_button_state_task(
|
|||
///
|
||||
/// Has to run on core0 because it makes use of SPI0.
|
||||
#[embassy_executor::task]
|
||||
#[inline(never)]
|
||||
#[link_section = ".time_critical.update_stick_states_task"]
|
||||
pub async fn update_stick_states_task(
|
||||
spi: Spi<'static, SPI0, embassy_rp::spi::Blocking>,
|
||||
|
|
|
@ -882,6 +882,7 @@ pub fn calc_stick_values(angle: f32) -> (f32, f32) {
|
|||
(x, y)
|
||||
}
|
||||
|
||||
#[inline(never)]
|
||||
#[link_section = ".time_critical.linearize"]
|
||||
pub fn linearize(point: f32, coefficients: &[f32; NUM_COEFFS]) -> f32 {
|
||||
coefficients[0] * (point * point * point)
|
||||
|
@ -890,6 +891,7 @@ pub fn linearize(point: f32, coefficients: &[f32; NUM_COEFFS]) -> f32 {
|
|||
+ coefficients[3]
|
||||
}
|
||||
|
||||
#[inline(never)]
|
||||
#[link_section = ".time_critical.notch_remap"]
|
||||
pub fn notch_remap(
|
||||
x_in: f32,
|
||||
|
|
Loading…
Reference in a new issue