A couple of fixes
This commit is contained in:
@@ -242,10 +242,10 @@ STR_DIR_DOWN: "Runter"
|
|||||||
STR_OK_BUTTON: "OK"
|
STR_OK_BUTTON: "OK"
|
||||||
STR_SLEEP_COVER_FILTER: "Standby-Coverfilter"
|
STR_SLEEP_COVER_FILTER: "Standby-Coverfilter"
|
||||||
STR_FILTER_CONTRAST: "Kontrast"
|
STR_FILTER_CONTRAST: "Kontrast"
|
||||||
STR_TILT_PAGE_TURN: "Seitenblaettern durch Neigen"
|
STR_TILT_PAGE_TURN: "Seitenblättern durch Neigen"
|
||||||
STR_TILT_STABILIZATION: "Neigungsmodus"
|
STR_TILT_STABILIZATION: "Neigungsmodus"
|
||||||
STR_TILT_MODE_RAW: "Rohbeschleunigung"
|
STR_TILT_MODE_RAW: "Rohbeschleunigung"
|
||||||
STR_TILT_MODE_SMOOTH: "Geglaettete Beschleunigung"
|
STR_TILT_MODE_SMOOTH: "Geglättete Beschleunigung"
|
||||||
STR_TILT_MODE_KALMAN: "Gyro-/Beschleunigungsfusion"
|
STR_TILT_MODE_KALMAN: "Gyro-/Beschleunigungsfusion"
|
||||||
STR_CUSTOMISE_STATUS_BAR: "Statusleiste anpassen"
|
STR_CUSTOMISE_STATUS_BAR: "Statusleiste anpassen"
|
||||||
STR_CHAPTER_PAGE_COUNT: "Kapitel-Seitenanzahl"
|
STR_CHAPTER_PAGE_COUNT: "Kapitel-Seitenanzahl"
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ void HalTiltSensor::begin() {
|
|||||||
_i2cAddr = TILT_I2C_ADDR;
|
_i2cAddr = TILT_I2C_ADDR;
|
||||||
if (!readReg(REG_WHO_AM_I, &whoami) || whoami != TILT_WHO_AM_I_VALUE) {
|
if (!readReg(REG_WHO_AM_I, &whoami) || whoami != TILT_WHO_AM_I_VALUE) {
|
||||||
_i2cAddr = TILT_I2C_ADDR_ALT;
|
_i2cAddr = TILT_I2C_ADDR_ALT;
|
||||||
if (!readReg(REG_WHO_AM_I, &whoami) || whoami != QMI8658_WHO_AM_I_VALUE) {
|
if (!readReg(REG_WHO_AM_I, &whoami) || whoami != TILT_WHO_AM_I_VALUE) {
|
||||||
LOG_INF("TILT", "QMI8658 IMU not found");
|
LOG_INF("TILT", "QMI8658 IMU not found");
|
||||||
_available = false;
|
_available = false;
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -113,18 +113,21 @@ inline PageTurnResult detectPageTurn(const MappedInputManager& input) {
|
|||||||
if (tiltNegative) {
|
if (tiltNegative) {
|
||||||
applyTiltAction(SETTINGS.tiltNegativeAction);
|
applyTiltAction(SETTINGS.tiltNegativeAction);
|
||||||
}
|
}
|
||||||
const bool prev = tiltPrev || ((SETTINGS.btnShortPageBack == BA::BTN_DEFAULT &&
|
const bool prevButtonReleased = (SETTINGS.btnShortPageBack == BA::BTN_DEFAULT &&
|
||||||
!globalButtonEvents().hasDoubleAction(MappedInputManager::Button::PageBack) &&
|
!globalButtonEvents().hasDoubleAction(MappedInputManager::Button::PageBack) &&
|
||||||
input.wasReleased(MappedInputManager::Button::PageBack)) ||
|
input.wasReleased(MappedInputManager::Button::PageBack)) ||
|
||||||
(SETTINGS.btnShortLeft == BA::BTN_DEFAULT &&
|
(SETTINGS.btnShortLeft == BA::BTN_DEFAULT &&
|
||||||
!globalButtonEvents().hasDoubleAction(MappedInputManager::Button::Left) &&
|
!globalButtonEvents().hasDoubleAction(MappedInputManager::Button::Left) &&
|
||||||
input.wasReleased(MappedInputManager::Button::Left)));
|
input.wasReleased(MappedInputManager::Button::Left));
|
||||||
const bool next = tiltNext || ((SETTINGS.btnShortPageForward == BA::BTN_DEFAULT &&
|
const bool nextButtonReleased = (SETTINGS.btnShortPageForward == BA::BTN_DEFAULT &&
|
||||||
!globalButtonEvents().hasDoubleAction(MappedInputManager::Button::PageForward) &&
|
!globalButtonEvents().hasDoubleAction(MappedInputManager::Button::PageForward) &&
|
||||||
input.wasReleased(MappedInputManager::Button::PageForward)) ||
|
input.wasReleased(MappedInputManager::Button::PageForward)) ||
|
||||||
(SETTINGS.btnShortRight == BA::BTN_DEFAULT &&
|
(SETTINGS.btnShortRight == BA::BTN_DEFAULT &&
|
||||||
!globalButtonEvents().hasDoubleAction(MappedInputManager::Button::Right) &&
|
!globalButtonEvents().hasDoubleAction(MappedInputManager::Button::Right) &&
|
||||||
input.wasReleased(MappedInputManager::Button::Right)));
|
input.wasReleased(MappedInputManager::Button::Right));
|
||||||
|
|
||||||
|
const bool prev = tiltPrev || prevButtonReleased;
|
||||||
|
const bool next = tiltNext || nextButtonReleased;
|
||||||
return {prev, next};
|
return {prev, next};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -140,7 +140,13 @@ void TxtReaderActivity::onExit() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void TxtReaderActivity::loop() {
|
void TxtReaderActivity::loop() {
|
||||||
if (inputDrainGuard.shouldDrain(mappedInput)) {
|
const bool drainActive = inputDrainGuard.shouldDrain(mappedInput);
|
||||||
|
if (!drainActive && drainWasActive) {
|
||||||
|
halTiltSensor.clearPendingEvents();
|
||||||
|
}
|
||||||
|
drainWasActive = drainActive;
|
||||||
|
|
||||||
|
if (drainActive) {
|
||||||
buttonEvents.drain();
|
buttonEvents.drain();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ class TxtReaderActivity final : public Activity {
|
|||||||
int totalPages = 1;
|
int totalPages = 1;
|
||||||
int pagesUntilFullRefresh = 0;
|
int pagesUntilFullRefresh = 0;
|
||||||
ReaderUtils::InputDrainGuard inputDrainGuard;
|
ReaderUtils::InputDrainGuard inputDrainGuard;
|
||||||
|
bool drainWasActive = false;
|
||||||
|
|
||||||
// Bookmarks (starred pages)
|
// Bookmarks (starred pages)
|
||||||
BookmarkStore bookmarkStore;
|
BookmarkStore bookmarkStore;
|
||||||
|
|||||||
@@ -30,12 +30,11 @@ constexpr std::array<ButtonRow, 7> kButtonRows = {{
|
|||||||
}};
|
}};
|
||||||
|
|
||||||
// Find the SettingInfo for a given (button submenu, press kind) pair in the shared settings list.
|
// Find the SettingInfo for a given (button submenu, press kind) pair in the shared settings list.
|
||||||
std::string cellValue(StrId submenu, StrId pressKind) {
|
std::string cellValue(const std::vector<SettingInfo>& settings, StrId submenu, StrId pressKind) {
|
||||||
const auto list = getSettingsList();
|
auto it = std::find_if(settings.begin(), settings.end(), [submenu, pressKind](const SettingInfo& s) {
|
||||||
auto it = std::find_if(list.begin(), list.end(), [submenu, pressKind](const SettingInfo& s) {
|
|
||||||
return s.submenu == submenu && s.nameId == pressKind && s.category == StrId::STR_CAT_CONTROLS;
|
return s.submenu == submenu && s.nameId == pressKind && s.category == StrId::STR_CAT_CONTROLS;
|
||||||
});
|
});
|
||||||
if (it == list.end()) return {};
|
if (it == settings.end()) return {};
|
||||||
return it->getDisplayValue();
|
return it->getDisplayValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,15 +123,17 @@ void ButtonActionsOverviewActivity::render(RenderLock&&) {
|
|||||||
renderer.fillPolygon(underlineX, underlineY, 4, true);
|
renderer.fillPolygon(underlineX, underlineY, 4, true);
|
||||||
y += 4;
|
y += 4;
|
||||||
|
|
||||||
|
const auto settings = getSettingsList();
|
||||||
|
|
||||||
// Data rows
|
// Data rows
|
||||||
for (const auto& row : kButtonRows) {
|
for (const auto& row : kButtonRows) {
|
||||||
const std::string label = I18N.get(row.labelStrId);
|
const std::string label = I18N.get(row.labelStrId);
|
||||||
const std::string clippedLabel = renderer.truncatedText(fontId, label.c_str(), colW[0], EpdFontFamily::BOLD);
|
const std::string clippedLabel = renderer.truncatedText(fontId, label.c_str(), colW[0], EpdFontFamily::BOLD);
|
||||||
renderer.drawText(fontId, colX[0], y, clippedLabel.c_str(), true, EpdFontFamily::BOLD);
|
renderer.drawText(fontId, colX[0], y, clippedLabel.c_str(), true, EpdFontFamily::BOLD);
|
||||||
|
|
||||||
const std::string vShort = cellValue(row.submenu, StrId::STR_BTN_SHORT_PRESS);
|
const std::string vShort = cellValue(settings, row.submenu, StrId::STR_BTN_SHORT_PRESS);
|
||||||
const std::string vDouble = cellValue(row.submenu, StrId::STR_BTN_DOUBLE_PRESS);
|
const std::string vDouble = cellValue(settings, row.submenu, StrId::STR_BTN_DOUBLE_PRESS);
|
||||||
const std::string vLong = cellValue(row.submenu, StrId::STR_BTN_LONG_PRESS);
|
const std::string vLong = cellValue(settings, row.submenu, StrId::STR_BTN_LONG_PRESS);
|
||||||
|
|
||||||
renderer.drawText(fontId, colX[1], y, renderer.truncatedText(fontId, vShort.c_str(), colW[1]).c_str());
|
renderer.drawText(fontId, colX[1], y, renderer.truncatedText(fontId, vShort.c_str(), colW[1]).c_str());
|
||||||
renderer.drawText(fontId, colX[2], y, renderer.truncatedText(fontId, vDouble.c_str(), colW[2]).c_str());
|
renderer.drawText(fontId, colX[2], y, renderer.truncatedText(fontId, vDouble.c_str(), colW[2]).c_str());
|
||||||
|
|||||||
@@ -210,6 +210,7 @@ void setup() {
|
|||||||
if (wakeupReason == HalGPIO::WakeupReason::AfterUSBPower) {
|
if (wakeupReason == HalGPIO::WakeupReason::AfterUSBPower) {
|
||||||
// If USB power caused a cold boot, go back to sleep immediately without initializing subsystems
|
// If USB power caused a cold boot, go back to sleep immediately without initializing subsystems
|
||||||
LOG_DBG("MAIN", "Wakeup reason: After USB Power => Deep sleep");
|
LOG_DBG("MAIN", "Wakeup reason: After USB Power => Deep sleep");
|
||||||
|
halTiltSensor.deepSleep();
|
||||||
powerManager.startDeepSleep(gpio);
|
powerManager.startDeepSleep(gpio);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user