Add extended TiltModel
This commit is contained in:
+6
-1
@@ -9,6 +9,7 @@
|
||||
#include <HalPowerManager.h>
|
||||
#include <HalStorage.h>
|
||||
#include <HalSystem.h>
|
||||
#include <HalTiltSensor.h>
|
||||
#include <I18n.h>
|
||||
#include <Logging.h>
|
||||
#include <SPI.h>
|
||||
@@ -141,6 +142,7 @@ void enterDeepSleep() {
|
||||
APP_STATE.saveToFile();
|
||||
|
||||
activityManager.goToSleep();
|
||||
halTiltSensor.deepSleep();
|
||||
|
||||
display.deepSleep();
|
||||
LOG_DBG("MAIN", "Entering deep sleep (powerBtn isPressed=%d, rawPin=%d)", gpio.isPressed(HalGPIO::BTN_POWER),
|
||||
@@ -200,6 +202,7 @@ void setup() {
|
||||
HalSystem::begin();
|
||||
gpio.begin();
|
||||
powerManager.begin();
|
||||
halTiltSensor.begin();
|
||||
gpio_deep_sleep_hold_dis(); // Release deep sleep GPIO hold state from previous sleep cycle
|
||||
|
||||
const auto wakeupReason = gpio.getWakeupReason();
|
||||
@@ -331,6 +334,7 @@ void loop() {
|
||||
gpio.update();
|
||||
buttonEventManager.update();
|
||||
HalClock::updatePeriodic();
|
||||
halTiltSensor.update(SETTINGS.tiltPageTurn, SETTINGS.tiltStabilization, SETTINGS.orientation);
|
||||
|
||||
renderer.setFadingFix(SETTINGS.fadingFix);
|
||||
renderer.setTextDarkness(SETTINGS.textDarkness);
|
||||
@@ -362,7 +366,8 @@ void loop() {
|
||||
|
||||
// Check for any user activity (button press or release) or active background work
|
||||
static unsigned long lastActivityTime = millis();
|
||||
if (gpio.wasAnyPressed() || gpio.wasAnyReleased() || activityManager.preventAutoSleep()) {
|
||||
if (gpio.wasAnyPressed() || gpio.wasAnyReleased() || halTiltSensor.hadActivity() ||
|
||||
activityManager.preventAutoSleep()) {
|
||||
lastActivityTime = millis(); // Reset inactivity timer
|
||||
powerManager.setPowerSaving(false); // Restore normal CPU frequency on user activity
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user