Change lock switch direction to match r7 standby
This commit is contained in:
@@ -114,9 +114,9 @@ auto Booting::react(const BootComplete& ev) -> void {
|
|||||||
ESP_LOGI(kTag, "bootup completely successfully");
|
ESP_LOGI(kTag, "bootup completely successfully");
|
||||||
|
|
||||||
if (sServices->gpios().Get(drivers::Gpios::Pin::kKeyLock)) {
|
if (sServices->gpios().Get(drivers::Gpios::Pin::kKeyLock)) {
|
||||||
transit<Running>();
|
|
||||||
} else {
|
|
||||||
transit<Idle>();
|
transit<Idle>();
|
||||||
|
} else {
|
||||||
|
transit<Running>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ void Idle::exit() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Idle::react(const KeyLockChanged& ev) {
|
void Idle::react(const KeyLockChanged& ev) {
|
||||||
if (ev.falling) {
|
if (!ev.locking) {
|
||||||
transit<Running>();
|
transit<Running>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ struct StorageMounted : tinyfsm::Event {};
|
|||||||
struct StorageError : tinyfsm::Event {};
|
struct StorageError : tinyfsm::Event {};
|
||||||
|
|
||||||
struct KeyLockChanged : tinyfsm::Event {
|
struct KeyLockChanged : tinyfsm::Event {
|
||||||
bool falling;
|
bool locking;
|
||||||
};
|
};
|
||||||
struct HasPhonesChanged : tinyfsm::Event {
|
struct HasPhonesChanged : tinyfsm::Event {
|
||||||
bool falling;
|
bool falling;
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ void SystemState::react(const internal::GpioInterrupt&) {
|
|||||||
bool has_headphones = !gpios.Get(drivers::Gpios::Pin::kPhoneDetect);
|
bool has_headphones = !gpios.Get(drivers::Gpios::Pin::kPhoneDetect);
|
||||||
|
|
||||||
if (key_lock != prev_key_lock) {
|
if (key_lock != prev_key_lock) {
|
||||||
KeyLockChanged ev{.falling = key_lock};
|
KeyLockChanged ev{.locking = key_lock};
|
||||||
events::System().Dispatch(ev);
|
events::System().Dispatch(ev);
|
||||||
events::Ui().Dispatch(ev);
|
events::Ui().Dispatch(ev);
|
||||||
}
|
}
|
||||||
@@ -77,7 +77,7 @@ void SystemState::react(const internal::SamdInterrupt&) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto SystemState::IdleCondition() -> bool {
|
auto SystemState::IdleCondition() -> bool {
|
||||||
return !sServices->gpios().Get(drivers::IGpios::Pin::kKeyLock) &&
|
return sServices->gpios().Get(drivers::IGpios::Pin::kKeyLock) &&
|
||||||
audio::AudioState::is_in_state<audio::states::Standby>();
|
audio::AudioState::is_in_state<audio::states::Standby>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -91,8 +91,8 @@ void UiState::PopScreen() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void UiState::react(const system_fsm::KeyLockChanged& ev) {
|
void UiState::react(const system_fsm::KeyLockChanged& ev) {
|
||||||
sDisplay->SetDisplayOn(ev.falling);
|
sDisplay->SetDisplayOn(!ev.locking);
|
||||||
sInput->lock(!ev.falling);
|
sInput->lock(ev.locking);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UiState::react(const system_fsm::BatteryStateChanged& ev) {
|
void UiState::react(const system_fsm::BatteryStateChanged& ev) {
|
||||||
|
|||||||
Reference in New Issue
Block a user