From a5919f128ca2ede19ba472bffb69f2bcb37da2c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Fri, 12 Apr 2019 16:44:57 +0200 Subject: [PATCH] [ion] Power: fix names; Power key actually refers to OnOff key (to avoid confusing with exponentiation key) --- apps/apps_container.cpp | 4 ++-- apps/apps_container.h | 2 +- ion/include/ion/power.h | 2 +- ion/src/device/shared/drivers/power.cpp | 16 ++++++++-------- ion/src/device/shared/drivers/wakeup.cpp | 2 +- ion/src/device/shared/drivers/wakeup.h | 2 +- ion/src/shared/power.cpp | 2 +- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/apps/apps_container.cpp b/apps/apps_container.cpp index 6170fafb3..cf7b4d2bd 100644 --- a/apps/apps_container.cpp +++ b/apps/apps_container.cpp @@ -128,7 +128,7 @@ VariableBoxController * AppsContainer::variableBoxController() { return &m_variableBoxController; } -void AppsContainer::suspend(bool checkIfPowerKeyReleased) { +void AppsContainer::suspend(bool checkIfOnOffKeyReleased) { resetShiftAlphaStatus(); GlobalPreferences * globalPreferences = GlobalPreferences::sharedGlobalPreferences(); #ifdef EPSILON_BOOT_PROMPT @@ -136,7 +136,7 @@ void AppsContainer::suspend(bool checkIfPowerKeyReleased) { activeApp()->displayModalViewController(&m_promptController, 0.f, 0.f); } #endif - Ion::Power::suspend(checkIfPowerKeyReleased); + Ion::Power::suspend(checkIfOnOffKeyReleased); /* Ion::Power::suspend() completely shuts down the LCD controller. Therefore * the frame memory is lost. That's why we need to force a window redraw * upon wakeup, otherwise the screen is filled with noise. */ diff --git a/apps/apps_container.h b/apps/apps_container.h index a46dcebfc..b1735778b 100644 --- a/apps/apps_container.h +++ b/apps/apps_container.h @@ -35,7 +35,7 @@ public: Poincare::Context * globalContext(); MathToolbox * mathToolbox(); VariableBoxController * variableBoxController(); - void suspend(bool checkIfPowerKeyReleased = false); + void suspend(bool checkIfOnOffKeyReleased = false); virtual bool dispatchEvent(Ion::Events::Event event) override; bool switchTo(App::Snapshot * snapshot) override; void run() override; diff --git a/ion/include/ion/power.h b/ion/include/ion/power.h index ea540c229..0f08cfc44 100644 --- a/ion/include/ion/power.h +++ b/ion/include/ion/power.h @@ -4,7 +4,7 @@ namespace Ion { namespace Power { -void suspend(bool checkIfPowerKeyReleased = false); +void suspend(bool checkIfOnOffKeyReleased = false); void standby(); } diff --git a/ion/src/device/shared/drivers/power.cpp b/ion/src/device/shared/drivers/power.cpp index 08b7fc107..e76643949 100644 --- a/ion/src/device/shared/drivers/power.cpp +++ b/ion/src/device/shared/drivers/power.cpp @@ -22,7 +22,7 @@ namespace Power { using namespace Device::Regs; void configWakeUp() { - Device::WakeUp::onPowerKeyDown(); + Device::WakeUp::onOnOffKeyDown(); Device::WakeUp::onUSBPlugging(); Device::WakeUp::onChargingEvent(); } @@ -71,7 +71,7 @@ void standbyConfiguration() { CORTEX.SCR()->setSLEEPDEEP(true); // Allow Cortex-M7 deepsleep state } -void waitUntilPowerKeyReleased() { +void waitUntilOnOffKeyReleased() { /* Wait until power is released to avoid restarting just after suspending */ bool isPowerDown = true; while (isPowerDown) { @@ -93,19 +93,19 @@ void enterLowPowerMode() { } void standby() { - waitUntilPowerKeyReleased(); + waitUntilOnOffKeyReleased(); standbyConfiguration(); Device::Board::shutdown(); enterLowPowerMode(); Device::Reset::core(); } -void suspend(bool checkIfPowerKeyReleased) { +void suspend(bool checkIfOnOffKeyReleased) { bool isLEDActive = Ion::LED::getColor() != KDColorBlack; bool plugged = USB::isPlugged(); - if (checkIfPowerKeyReleased) { - waitUntilPowerKeyReleased(); + if (checkIfOnOffKeyReleased) { + waitUntilOnOffKeyReleased(); } /* First, shutdown all peripherals except LED. Indeed, the charging pin state @@ -149,11 +149,11 @@ void suspend(bool checkIfPowerKeyReleased) { // Check power key Device::Keyboard::init(); Keyboard::State scan = Keyboard::scan(); - Ion::Keyboard::State OnlyPowerKeyDown = Keyboard::State(Keyboard::Key::OnOff); + Ion::Keyboard::State OnlyOnOffKeyDown = Keyboard::State(Keyboard::Key::OnOff); // Check plugging state Device::USB::initGPIO(); - if (scan == OnlyPowerKeyDown || (!plugged && USB::isPlugged())) { + if (scan == OnlyOnOffKeyDown || (!plugged && USB::isPlugged())) { // Wake up break; } else { diff --git a/ion/src/device/shared/drivers/wakeup.cpp b/ion/src/device/shared/drivers/wakeup.cpp index b24630c06..a20c748d5 100644 --- a/ion/src/device/shared/drivers/wakeup.cpp +++ b/ion/src/device/shared/drivers/wakeup.cpp @@ -43,7 +43,7 @@ void onUSBPlugging() { } -void onPowerKeyDown() { +void onOnOffKeyDown() { Keyboard::Key key = Keyboard::Key::OnOff; uint8_t rowPin = Keyboard::Config::RowPins[Keyboard::rowForKey(key)]; Keyboard::Config::RowGPIO.MODER()->setMode(rowPin, GPIO::MODER::Mode::Output); diff --git a/ion/src/device/shared/drivers/wakeup.h b/ion/src/device/shared/drivers/wakeup.h index 7415fddc2..d8cb22c7b 100644 --- a/ion/src/device/shared/drivers/wakeup.h +++ b/ion/src/device/shared/drivers/wakeup.h @@ -32,7 +32,7 @@ namespace WakeUp { void onChargingEvent(); void onUSBPlugging(); -void onPowerKeyDown(); +void onOnOffKeyDown(); } } diff --git a/ion/src/shared/power.cpp b/ion/src/shared/power.cpp index 81a2fa450..b476e006b 100644 --- a/ion/src/shared/power.cpp +++ b/ion/src/shared/power.cpp @@ -1,4 +1,4 @@ #include -void Ion::Power::suspend(bool checkIfPowerKeyReleased) { +void Ion::Power::suspend(bool checkIfOnOffKeyReleased) { }