From 10355093765854053b2bff2ca96e8b0b9f2ba726 Mon Sep 17 00:00:00 2001 From: gordon1337 Date: Sat, 8 Jun 2013 14:15:32 +0200 Subject: Console Render Bug caused by touch drag event With starting the console the touch drag event is active without even touching the display. This causes to render the console at any time it is displayed, which consumes alot of battery and heats up the device. What the patch does is resetting the touch drag state to ensure it is only re-rendering the console when it it really needed. --- gui/console.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/gui/console.cpp b/gui/console.cpp index 8a7a85ea3..ee3b5e580 100644 --- a/gui/console.cpp +++ b/gui/console.cpp @@ -274,6 +274,7 @@ int GUIConsole::Update(void) { // They're still touching, so re-render Render(); + mLastTouchY = -1; return 2; } return 0; -- cgit v1.2.3 From 0d9133d654805be31a7e21f4ccb74e9e0a44fd55 Mon Sep 17 00:00:00 2001 From: gordon1337 Date: Sat, 8 Jun 2013 14:17:07 +0200 Subject: Do not render the GUI when the blanktimer turns off the display. Normally, when the display has been turned off by blanktimer, the GUI actually still renders the GUI elements (eg. progressbar while doing backup/restore/etc.) This patch will check whenever the display is turned off, and if it is turned off simply dont render. This avoids heating up the device and will save battery. --- gui/blanktimer.cpp | 7 +++++++ gui/blanktimer.hpp | 2 ++ gui/pages.cpp | 5 +++++ 3 files changed, 14 insertions(+) diff --git a/gui/blanktimer.cpp b/gui/blanktimer.cpp index 700a9ad27..0b1f0083c 100644 --- a/gui/blanktimer.cpp +++ b/gui/blanktimer.cpp @@ -48,6 +48,11 @@ blanktimer::blanktimer(void) { setTime(0); setConBlank(0); orig_brightness = getBrightness(); + screenoff = false; +} + +bool blanktimer::IsScreenOff() { + return screenoff; } void blanktimer::setTime(int newtime) { @@ -92,6 +97,7 @@ int blanktimer::setClockTimer(void) { if (sleepTimer && diff.tv_sec > sleepTimer && conblank < 2) { setConBlank(2); setBrightness(0); + screenoff = true; PageManager::ChangeOverlay("lock"); } #ifndef TW_NO_SCREEN_BLANK @@ -146,6 +152,7 @@ void blanktimer::resetTimerAndUnblank(void) { // No break here, we want to keep going case 2: gui_forceRender(); + screenoff = false; // No break here, we want to keep going case 1: setBrightness(orig_brightness); diff --git a/gui/blanktimer.hpp b/gui/blanktimer.hpp index 2d83c4dae..60d5b1b42 100644 --- a/gui/blanktimer.hpp +++ b/gui/blanktimer.hpp @@ -30,6 +30,7 @@ class blanktimer { int setTimerThread(void); void resetTimerAndUnblank(void); void setTime(int newtime); + bool IsScreenOff(); private: void setConBlank(int blank); @@ -47,6 +48,7 @@ class blanktimer { timespec btimer; unsigned long long sleepTimer; int orig_brightness; + bool screenoff; }; extern blanktimer blankTimer; diff --git a/gui/pages.cpp b/gui/pages.cpp index 11fe9b080..86d4dff9f 100644 --- a/gui/pages.cpp +++ b/gui/pages.cpp @@ -41,8 +41,10 @@ extern "C" { #include "rapidxml.hpp" #include "objects.hpp" +#include "blanktimer.hpp" extern int gGuiRunning; +extern blanktimer blankTimer; std::map PageManager::mPageSets; PageSet* PageManager::mCurrentSet; @@ -890,6 +892,9 @@ int PageManager::Render(void) int PageManager::Update(void) { + if(blankTimer.IsScreenOff()) + return 0; + return (mCurrentSet ? mCurrentSet->Update() : -1); } -- cgit v1.2.3