chore(config): improve naming & comments
All checks were successful
Code quality / check (pull_request) Successful in 1m51s
All checks were successful
Code quality / check (pull_request) Successful in 1m51s
This commit is contained in:
parent
6b53472817
commit
d099d4701c
1 changed files with 9 additions and 11 deletions
|
@ -465,6 +465,8 @@ pub struct OverrideStickState {
|
|||
pub which_stick: Stick,
|
||||
}
|
||||
|
||||
/// Enum button representation mainly used in the calibration process,
|
||||
/// in conjunction with `is_awaitable_button_pressed`
|
||||
#[allow(dead_code)]
|
||||
#[derive(Clone, Copy, Debug, Format, PartialEq, Eq)]
|
||||
pub enum AwaitableButtons {
|
||||
|
@ -480,11 +482,11 @@ pub enum AwaitableButtons {
|
|||
L,
|
||||
R,
|
||||
Z,
|
||||
// special, because Z is used for cstick calibration
|
||||
/// Special, because Z is used for cstick calibration.
|
||||
NotZ,
|
||||
/// Used for padding arrays to the correct length.
|
||||
/// Can be used for padding arrays to a fixed length.
|
||||
Wildcard,
|
||||
/// Used for disabling certain button combinations.\
|
||||
/// Can be used for disabling certain button combinations.
|
||||
Impossible,
|
||||
}
|
||||
|
||||
|
@ -595,12 +597,7 @@ impl ControllerConfig {
|
|||
) -> Result<Self, embassy_rp::flash::Error> {
|
||||
let mut controller_config_packed: <ControllerConfig as packed_struct::PackedStruct>::ByteArray = ControllerConfig::default().pack().unwrap();
|
||||
|
||||
let r = flash.blocking_read(ADDR_OFFSET, &mut controller_config_packed);
|
||||
|
||||
if r.is_err() {
|
||||
warn!("Controller config not found in flash, using default.");
|
||||
controller_config_packed = [0u8; 659];
|
||||
}
|
||||
flash.blocking_read(ADDR_OFFSET, &mut controller_config_packed)?;
|
||||
|
||||
match ControllerConfig::unpack(&controller_config_packed) {
|
||||
Ok(cfg) => match cfg {
|
||||
|
@ -634,7 +631,8 @@ impl ControllerConfig {
|
|||
}
|
||||
}
|
||||
|
||||
trait WaitForButtonPress {
|
||||
/// Trait for providing button presses, used in the calibration process.
|
||||
trait ButtonPressProvider {
|
||||
/// Wait for a single button press.
|
||||
async fn wait_for_button_press(&mut self, button_to_wait_for: &AwaitableButtons);
|
||||
|
||||
|
@ -666,7 +664,7 @@ trait WaitForButtonPress {
|
|||
) -> usize;
|
||||
}
|
||||
|
||||
impl<'a, T: RawMutex, const I: usize, const J: usize, const K: usize> WaitForButtonPress
|
||||
impl<'a, T: RawMutex, const I: usize, const J: usize, const K: usize> ButtonPressProvider
|
||||
for Subscriber<'a, T, GcReport, I, J, K>
|
||||
{
|
||||
async fn wait_for_button_press(&mut self, button_to_wait_for: &AwaitableButtons) {
|
||||
|
|
Loading…
Reference in a new issue