change(config): remove notch adjustment logic (for now)

This commit is contained in:
Naxdy 2024-04-01 23:03:08 +02:00
parent 0090116003
commit 03d5c478ef
Signed by: Naxdy
GPG key ID: CC15075846BCE91B
3 changed files with 20 additions and 49 deletions

View file

@ -61,7 +61,7 @@ codegen-units = 1
debug = 2
debug-assertions = true
incremental = false
opt-level = 3
opt-level = 1
lto = "fat"
overflow-checks = true
@ -72,7 +72,7 @@ debug = 2
debug-assertions = false
incremental = false
lto = 'fat'
opt-level = 3
opt-level = 1
overflow-checks = false
# do not optimize proc-macro crates = faster builds from scratch

View file

@ -19,7 +19,7 @@ use crate::{
},
stick::{
calc_stick_values, legalize_notches, AppliedCalibration, NotchStatus, CALIBRATION_ORDER,
NOTCH_ADJUSTMENT_ORDER, NO_OF_ADJ_NOTCHES, NO_OF_CALIBRATION_POINTS, NO_OF_NOTCHES,
NO_OF_CALIBRATION_POINTS, NO_OF_NOTCHES,
},
ADDR_OFFSET, FLASH_SIZE,
};
@ -484,32 +484,6 @@ impl<'a> StickCalibrationProcess<'a> {
}
if self.calibration_step >= NO_OF_CALIBRATION_POINTS as u8 {
let mut notch_idx = NOTCH_ADJUSTMENT_ORDER[min(
self.calibration_step - NO_OF_CALIBRATION_POINTS as u8,
NO_OF_ADJ_NOTCHES as u8 - 1,
) as usize];
while self.applied_calibration.cleaned_calibration.notch_status[notch_idx]
== NotchStatus::TertInactive
&& self.calibration_step < NO_OF_CALIBRATION_POINTS as u8 + NO_OF_ADJ_NOTCHES as u8
{
stick_config.angles = *legalize_notches(
self.calibration_step as usize,
&self.applied_calibration.measured_notch_angles,
&stick_config.angles.map(|e| *e),
)
.to_packed_float_array();
self.calibration_step += 1;
notch_idx = NOTCH_ADJUSTMENT_ORDER[min(
self.calibration_step - NO_OF_CALIBRATION_POINTS as u8,
NO_OF_ADJ_NOTCHES as u8 - 1,
) as usize];
}
}
if self.calibration_step >= NO_OF_CALIBRATION_POINTS as u8 + NO_OF_ADJ_NOTCHES as u8 {
stick_config.cal_points_x = self.cal_points.map(|p| p.x.into());
stick_config.cal_points_y = self.cal_points.map(|p| p.y.into());
@ -528,7 +502,6 @@ impl<'a> StickCalibrationProcess<'a> {
SIGNAL_IS_CALIBRATING.signal(true);
while {
if self.calibration_step < NO_OF_CALIBRATION_POINTS as u8 {
let (x, y) = get_stick_display_coords(self.calibration_step as usize);
debug!(
"Raw display coords for step {}: {}, {}",
@ -542,16 +515,13 @@ impl<'a> StickCalibrationProcess<'a> {
Stick::CStick => Stick::ControlStick,
},
}));
} else {
// TODO: phob calls `adjustNotch` here
}
gcc_subscriber
.wait_for_button_release(&AwaitableButtons::A)
.await;
// Prevent accidental double presses
Timer::after_millis(100).await;
Timer::after_millis(20).await;
gcc_subscriber
.wait_for_button_press(&AwaitableButtons::A)
@ -659,7 +629,7 @@ pub async fn config_task(
});
// Wait for the user to release the buttons
Timer::after_millis(500).await;
Timer::after_millis(1500).await;
configuration_main_loop(&current_config, &mut flash, &mut gcc_subscriber).await;

View file

@ -494,6 +494,7 @@ pub async fn update_button_state_task(
///
/// Has to run on core0 because it makes use of SPI0.
#[embassy_executor::task]
#[link_section = ".time_critical.update_stick_states_task"]
pub async fn update_stick_states_task(
spi: Spi<'static, SPI0, embassy_rp::spi::Blocking>,
spi_acs: Output<'static, AnyPin>,
@ -554,7 +555,7 @@ pub async fn update_stick_states_task(
match Instant::now() {
n => {
match (n - last_loop_time).as_micros() {
a if a > 19999 => debug!("Loop took {} us", a),
a if a > 1999 => debug!("Loop took {} us", a),
_ => {}
};
last_loop_time = n;