From 755e49180cca967c39fd890bc74d8cc2edc3f59b Mon Sep 17 00:00:00 2001 From: Naxdy Date: Tue, 2 Apr 2024 19:18:45 +0200 Subject: [PATCH] fix(calibration): correctly set intiial notch configuration --- src/config.rs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/config.rs b/src/config.rs index 8fd1302..33f7d7f 100644 --- a/src/config.rs +++ b/src/config.rs @@ -574,19 +574,19 @@ impl<'a> StickCalibrationProcess<'a> { // TODO: phob does something related to undo here if self.calibration_step == NO_OF_CALIBRATION_POINTS as u8 { - stick_config.angles = *legalize_notches( - self.calibration_step as usize, - &self.applied_calibration.measured_notch_angles, - &self.applied_calibration.notch_angles, - ) - .to_packed_float_array(); - self.applied_calibration = AppliedCalibration::from_points( &self.cal_points.map(|e| e.x), &self.cal_points.map(|e| e.y), &stick_config, self.which_stick, ); + + stick_config.angles = *legalize_notches( + self.calibration_step as usize, + &self.applied_calibration.measured_notch_angles, + &DEFAULT_ANGLES, + ) + .to_packed_float_array(); } if self.calibration_step >= NO_OF_CALIBRATION_POINTS as u8 { @@ -626,6 +626,10 @@ impl<'a> StickCalibrationProcess<'a> { return true; } + if self.calibration_step == NO_OF_CALIBRATION_POINTS as u8 { + SIGNAL_CONFIG_CHANGE.signal(self.gcc_config.clone()); + } + return false; }