Change lock switch direction to match r7 standby

This commit is contained in:
jacqueline
2023-11-10 08:19:27 +11:00
parent d42de6b122
commit 0419def89b
5 changed files with 8 additions and 8 deletions
+2 -2
View File
@@ -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>();
} }
} }
+1 -1
View File
@@ -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>();
} }
} }
+1 -1
View File
@@ -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;
+2 -2
View File
@@ -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
View File
@@ -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) {