feat: X3 gyroscope-based tilt page turning via QMI8658 IMU (#1636)

Co-authored-by: justinian <juicecutlus@gmail.com>
Co-authored-by: Vincent Politzer <vincent@skipwithjoy.com>
This commit is contained in:
Justinian
2026-04-29 15:29:33 -04:00
committed by GitHub
co-authored by justinian Vincent Politzer
parent bc9651b664
commit 5d2e5596b4
31 changed files with 524 additions and 134 deletions
+6 -1
View File
@@ -8,6 +8,7 @@
#include <HalPowerManager.h>
#include <HalStorage.h>
#include <HalSystem.h>
#include <HalTiltSensor.h>
#include <I18n.h>
#include <Logging.h>
#include <SPI.h>
@@ -186,6 +187,7 @@ void enterDeepSleep() {
activityManager.goToSleep();
halTiltSensor.deepSleep();
display.deepSleep();
LOG_DBG("MAIN", "Entering deep sleep");
@@ -231,6 +233,7 @@ void setup() {
HalSystem::begin();
gpio.begin();
powerManager.begin();
halTiltSensor.begin();
#ifdef ENABLE_SERIAL_LOG
if (gpio.isUsbConnected()) {
@@ -318,6 +321,7 @@ void loop() {
static unsigned long lastMemPrint = 0;
gpio.update();
halTiltSensor.update(SETTINGS.tiltPageTurn, SETTINGS.orientation, activityManager.isReaderActivity());
renderer.setFadingFix(SETTINGS.fadingFix);
@@ -346,7 +350,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
}