forked from Omega-Numworks/Omega
-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added backlight settings * Changed location of the brightness setting * Fix row size of brightness settings * [apps/settings/brightness] Update translations * Fix dimmer * Update translations * [apps/settings] Add dimmer duration setting * [apps/settings] Ensure of the brightness level is greater than the dimmed brightness level * Make transition smooth * Removed transition time setting I personally think that this setting is completely useless except if you absolutely want a transition that is not smooth, which is weird. * Moved everything related to brightness in one submenu * Some refactoring * Update defaults * Removed unnecessary translation * [apps/settings] Fix Shift + Minus/Plus in settings * Apply suggestions from code review * [apps/shared] Remove a think that I don't know what it is * Apply review suggestions Co-authored-by: Joachim LF <[email protected]> Co-authored-by: lolocomotive <[email protected]>
- Loading branch information
1 parent
865bacf
commit 8ac969d
Showing
26 changed files
with
288 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,26 @@ | ||
#include "backlight_dimming_timer.h" | ||
#include "global_preferences.h" | ||
#include <ion/backlight.h> | ||
#include <ion/events.h> | ||
#include <apps/apps_container.h> | ||
|
||
BacklightDimmingTimer::BacklightDimmingTimer() : | ||
Timer(k_idleBeforeDimmingDuration/Timer::TickDuration) | ||
Timer(GlobalPreferences::sharedGlobalPreferences()->idleBeforeDimmingSeconds()*1000/Timer::TickDuration) | ||
{ | ||
} | ||
|
||
bool BacklightDimmingTimer::fire() { | ||
if (m_dimerExecutions == 0) { | ||
m_brightnessLevel = GlobalPreferences::sharedGlobalPreferences()->brightnessLevel(); | ||
m_dimerSteps = m_brightnessLevel / decreaseBy; | ||
m_timeToSleep = decreasetime / m_dimerSteps; | ||
m_period = m_timeToSleep / Timer::TickDuration; | ||
if (m_period == 0) { | ||
m_period = 1; | ||
bool BacklightDimmingTimer::fire(){ | ||
int i = Ion::Backlight::brightness(); | ||
while (i > 0){ | ||
int t = 20; | ||
Ion::Events::Event e = Ion::Events::getEvent(&t); | ||
AppsContainer::sharedAppsContainer()->dispatchEvent(e); | ||
if (e.isKeyboardEvent()){ | ||
return false; | ||
} | ||
resetTimer(); | ||
} | ||
if (m_dimerExecutions < m_dimerSteps) { | ||
m_nextbrightness = (m_brightnessLevel-k_dimBacklightBrightness)/m_dimerSteps * (m_dimerSteps-m_dimerExecutions); | ||
Ion::Backlight::setBrightness(m_nextbrightness); | ||
resetTimer(); | ||
} else if (m_dimerExecutions == m_dimerSteps) { | ||
Ion::Backlight::setBrightness(k_dimBacklightBrightness); | ||
|
||
Ion::Backlight::setBrightness(i); | ||
i -= 15; | ||
} | ||
m_dimerExecutions++; | ||
return false; | ||
} | ||
|
||
void BacklightDimmingTimer::reset() { | ||
m_dimerExecutions = 0; | ||
m_period = k_idleBeforeDimmingDuration / Timer::TickDuration; | ||
resetTimer(); | ||
} | ||
|
||
void BacklightDimmingTimer::resetTimer() { | ||
BacklightDimmingTimer::m_numberOfTicksBeforeFire = BacklightDimmingTimer::m_period; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.