clippy: input.rs
This commit is contained in:
parent
3d803f342a
commit
a2d5620fd0
1 changed files with 9 additions and 9 deletions
18
src/input.rs
18
src/input.rs
|
@ -117,7 +117,7 @@ pub fn read_ext_adc<
|
||||||
spi_ccs.set_high();
|
spi_ccs.set_high();
|
||||||
}
|
}
|
||||||
|
|
||||||
return temp_value;
|
temp_value
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Gets the average stick state over a 1ms interval in a non-blocking fashion.
|
/// Gets the average stick state over a 1ms interval in a non-blocking fashion.
|
||||||
|
@ -198,7 +198,7 @@ async fn update_stick_states(
|
||||||
trace!("Raw Stick Values 001: {:?}", raw_stick_values);
|
trace!("Raw Stick Values 001: {:?}", raw_stick_values);
|
||||||
|
|
||||||
let (x_pos_filt, y_pos_filt) =
|
let (x_pos_filt, y_pos_filt) =
|
||||||
kalman_state.run_kalman(x_z, y_z, &controller_config.astick_config, &filter_gains);
|
kalman_state.run_kalman(x_z, y_z, &controller_config.astick_config, filter_gains);
|
||||||
|
|
||||||
let shaped_astick = match run_waveshaping(
|
let shaped_astick = match run_waveshaping(
|
||||||
x_pos_filt,
|
x_pos_filt,
|
||||||
|
@ -206,7 +206,7 @@ async fn update_stick_states(
|
||||||
controller_config.astick_config.x_waveshaping,
|
controller_config.astick_config.x_waveshaping,
|
||||||
controller_config.astick_config.y_waveshaping,
|
controller_config.astick_config.y_waveshaping,
|
||||||
controlstick_waveshaping_values,
|
controlstick_waveshaping_values,
|
||||||
&filter_gains,
|
filter_gains,
|
||||||
) {
|
) {
|
||||||
(x, y) => XyValuePair { x, y },
|
(x, y) => XyValuePair { x, y },
|
||||||
};
|
};
|
||||||
|
@ -226,7 +226,7 @@ async fn update_stick_states(
|
||||||
controller_config.cstick_config.x_waveshaping,
|
controller_config.cstick_config.x_waveshaping,
|
||||||
controller_config.cstick_config.y_waveshaping,
|
controller_config.cstick_config.y_waveshaping,
|
||||||
cstick_waveshaping_values,
|
cstick_waveshaping_values,
|
||||||
&filter_gains,
|
filter_gains,
|
||||||
) {
|
) {
|
||||||
(x, y) => XyValuePair { x, y },
|
(x, y) => XyValuePair { x, y },
|
||||||
};
|
};
|
||||||
|
@ -309,20 +309,20 @@ async fn update_stick_states(
|
||||||
let mut out_stick_state = current_stick_state.clone();
|
let mut out_stick_state = current_stick_state.clone();
|
||||||
|
|
||||||
let diff_x = (remapped.x + FLOAT_ORIGIN) - current_stick_state.ax as f32;
|
let diff_x = (remapped.x + FLOAT_ORIGIN) - current_stick_state.ax as f32;
|
||||||
if (diff_x > (1.0 + STICK_HYST_VAL)) || (diff_x < -STICK_HYST_VAL) {
|
if !(-STICK_HYST_VAL..=(1.0 + STICK_HYST_VAL)).contains(&diff_x) {
|
||||||
out_stick_state.ax = (remapped.x + FLOAT_ORIGIN) as u8;
|
out_stick_state.ax = (remapped.x + FLOAT_ORIGIN) as u8;
|
||||||
}
|
}
|
||||||
let diff_y = (remapped.y + FLOAT_ORIGIN) - current_stick_state.ay as f32;
|
let diff_y = (remapped.y + FLOAT_ORIGIN) - current_stick_state.ay as f32;
|
||||||
if (diff_y > (1.0 + STICK_HYST_VAL)) || (diff_y < -STICK_HYST_VAL) {
|
if !(-STICK_HYST_VAL..=(1.0 + STICK_HYST_VAL)).contains(&diff_y) {
|
||||||
out_stick_state.ay = (remapped.y + FLOAT_ORIGIN) as u8;
|
out_stick_state.ay = (remapped.y + FLOAT_ORIGIN) as u8;
|
||||||
}
|
}
|
||||||
|
|
||||||
let diff_cx = (remapped_c.x + FLOAT_ORIGIN) - current_stick_state.cx as f32;
|
let diff_cx = (remapped_c.x + FLOAT_ORIGIN) - current_stick_state.cx as f32;
|
||||||
if (diff_cx > (1.0 + STICK_HYST_VAL)) || (diff_cx < -STICK_HYST_VAL) {
|
if !(-STICK_HYST_VAL..=(1.0 + STICK_HYST_VAL)).contains(&diff_cx) {
|
||||||
out_stick_state.cx = (remapped_c.x + FLOAT_ORIGIN) as u8;
|
out_stick_state.cx = (remapped_c.x + FLOAT_ORIGIN) as u8;
|
||||||
}
|
}
|
||||||
let diff_cy = (remapped_c.y + FLOAT_ORIGIN) - current_stick_state.cy as f32;
|
let diff_cy = (remapped_c.y + FLOAT_ORIGIN) - current_stick_state.cy as f32;
|
||||||
if (diff_cy > (1.0 + STICK_HYST_VAL)) || (diff_cy < -STICK_HYST_VAL) {
|
if !(-STICK_HYST_VAL..=(1.0 + STICK_HYST_VAL)).contains(&diff_cy) {
|
||||||
out_stick_state.cy = (remapped_c.y + FLOAT_ORIGIN) as u8;
|
out_stick_state.cy = (remapped_c.y + FLOAT_ORIGIN) as u8;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -474,7 +474,7 @@ pub async fn update_button_state_task(
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Some(override_state) = &override_stick_state {
|
if let Some(override_state) = &override_stick_state {
|
||||||
let mut overriden_gcc_state = gcc_state.clone();
|
let mut overriden_gcc_state = gcc_state;
|
||||||
match override_state.which_stick {
|
match override_state.which_stick {
|
||||||
Stick::ControlStick => {
|
Stick::ControlStick => {
|
||||||
overriden_gcc_state.stick_x = override_state.x;
|
overriden_gcc_state.stick_x = override_state.x;
|
||||||
|
|
Loading…
Reference in a new issue