forked from NaxdyOrg/NaxGCC-FW
chore: clean up rumble & misc debug stuff
This commit is contained in:
parent
d6bb5d5266
commit
ef02ca6950
3 changed files with 19 additions and 20 deletions
|
@ -379,7 +379,6 @@ pub const DEFAULT_NOTCH_STATUS: [NotchStatus; NO_OF_NOTCHES] = [
|
|||
NotchStatus::TertActive,
|
||||
];
|
||||
|
||||
// new default cal points x
|
||||
#[rustfmt::skip]
|
||||
const DEFAULT_CAL_POINTS_X: [f32; NO_OF_CALIBRATION_POINTS] = [
|
||||
0.5279579, 0.37779236, // right
|
||||
|
@ -476,7 +475,7 @@ enum NotchAdjustmentType {
|
|||
|
||||
/// This needs to be incremented for ANY change to ControllerConfig
|
||||
/// else we risk loading uninitialized memory.
|
||||
pub const CONTROLLER_CONFIG_REVISION: u8 = 21;
|
||||
pub const CONTROLLER_CONFIG_REVISION: u8 = 1;
|
||||
|
||||
#[derive(Debug, Clone, Format, PackedStruct)]
|
||||
#[packed_struct(endian = "msb")]
|
||||
|
@ -492,7 +491,7 @@ pub struct StickConfig {
|
|||
#[packed_field(size_bits = "8")]
|
||||
pub y_snapback: i8, // not used for CStick
|
||||
#[packed_field(size_bits = "8")]
|
||||
pub cardinal_snapping: i8, // not used for CStick
|
||||
pub cardinal_snapping: i8,
|
||||
#[packed_field(size_bits = "8")]
|
||||
pub x_smoothing: u8,
|
||||
#[packed_field(size_bits = "8")]
|
||||
|
@ -549,11 +548,7 @@ impl Default for ControllerConfig {
|
|||
input_consistency_mode: true,
|
||||
astick_config: StickConfig::default(),
|
||||
rumble_strength: 9,
|
||||
cstick_config: {
|
||||
let mut cstick = StickConfig::default();
|
||||
cstick.cardinal_snapping = 0;
|
||||
cstick
|
||||
},
|
||||
cstick_config: StickConfig::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -923,10 +918,10 @@ impl<'a> StickCalibrationProcess<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
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());
|
||||
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());
|
||||
|
||||
if self.calibration_step >= NO_OF_CALIBRATION_POINTS as u8 + NO_OF_ADJ_NOTCHES as u8 {
|
||||
SIGNAL_CONFIG_CHANGE.signal(self.gcc_config.clone());
|
||||
|
||||
info!("Finished calibrating stick {}", self.which_stick);
|
||||
|
@ -1634,7 +1629,7 @@ pub async fn config_task(
|
|||
|
||||
info!("Config task is running.");
|
||||
|
||||
Timer::after_millis(1000).await;
|
||||
Timer::after_millis(100).await;
|
||||
|
||||
let new_config = ControllerConfig::from_flash_memory(&mut flash).unwrap();
|
||||
|
||||
|
|
17
src/input.rs
17
src/input.rs
|
@ -185,6 +185,8 @@ async fn update_stick_states(
|
|||
|
||||
trace!("Raw Control Stick: {}", raw_controlstick);
|
||||
|
||||
trace!("Raw CSTICK: {:?}", raw_cstick);
|
||||
|
||||
raw_stick_values.a_raw = raw_controlstick;
|
||||
raw_stick_values.c_raw = raw_cstick;
|
||||
|
||||
|
@ -252,7 +254,7 @@ async fn update_stick_states(
|
|||
|
||||
// phob optionally runs a median filter here, but we leave it for now
|
||||
|
||||
trace!("Controlstick position: {}, {}", pos_x, pos_y);
|
||||
trace!("Cstick position: {}, {}", pos_cx, pos_cy);
|
||||
|
||||
let mut remapped = match notch_remap(
|
||||
pos_x,
|
||||
|
@ -291,7 +293,11 @@ async fn update_stick_states(
|
|||
(x, y) => XyValuePair { x, y },
|
||||
};
|
||||
|
||||
trace!("Remapped Control Stick: {}", remapped);
|
||||
trace!(
|
||||
"Remapped Control Stick: {}; C stick: {}",
|
||||
remapped,
|
||||
remapped_c
|
||||
);
|
||||
|
||||
remapped = XyValuePair {
|
||||
x: fminf(125., fmaxf(-125., remapped.x)),
|
||||
|
@ -507,7 +513,7 @@ pub async fn update_stick_states_task(
|
|||
spi_ccs: Output<'static, AnyPin>,
|
||||
mut controller_config: ControllerConfig,
|
||||
) {
|
||||
Timer::after_secs(5).await;
|
||||
Timer::after_secs(1).await;
|
||||
*SPI_SHARED.lock().await = Some(spi);
|
||||
*SPI_ACS_SHARED.lock().await = Some(spi_acs);
|
||||
*SPI_CCS_SHARED.lock().await = Some(spi_ccs);
|
||||
|
@ -516,8 +522,6 @@ pub async fn update_stick_states_task(
|
|||
let mut cstick_params = StickParams::from_stick_config(&controller_config.cstick_config);
|
||||
let mut filter_gains = FILTER_GAINS.get_normalized_gains(&controller_config);
|
||||
|
||||
info!("Controlstick params: {:?}", controlstick_params);
|
||||
|
||||
let mut current_stick_state = StickState {
|
||||
ax: 127,
|
||||
ay: 127,
|
||||
|
@ -582,6 +586,9 @@ pub async fn update_stick_states_task(
|
|||
controlstick_params = StickParams::from_stick_config(&controller_config.astick_config);
|
||||
cstick_params = StickParams::from_stick_config(&controller_config.cstick_config);
|
||||
filter_gains = FILTER_GAINS.get_normalized_gains(&controller_config);
|
||||
|
||||
info!("Controlstick params: {:?}", controlstick_params);
|
||||
info!("CStick params: {:?}", cstick_params);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -94,9 +94,6 @@ fn main() -> ! {
|
|||
let pwm_rumble = Pwm::new_output_b(p.PWM_CH4, p.PIN_25, rumble_config.clone());
|
||||
let pwm_brake = Pwm::new_output_b(p.PWM_CH6, p.PIN_29, brake_config.clone());
|
||||
|
||||
pwm_rumble.set_counter(0);
|
||||
pwm_brake.set_counter(255);
|
||||
|
||||
spawn_core1(p.CORE1, unsafe { &mut CORE1_STACK }, move || {
|
||||
let executor1 = EXECUTOR1.init(Executor::new());
|
||||
debug!("Mana");
|
||||
|
|
Loading…
Reference in a new issue