mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-18 16:27:34 +01:00
Simplified code
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#include <ion.h>
|
||||
#include <poincare/init.h>
|
||||
#include <poincare/exception_checkpoint.h>
|
||||
#include <ion/backlight.h>
|
||||
|
||||
extern "C" {
|
||||
#include <assert.h>
|
||||
@@ -220,7 +221,7 @@ bool AppsContainer::processEvent(Ion::Events::Event event) {
|
||||
}
|
||||
if (event == Ion::Events::BrightnessPlus || event == Ion::Events::BrightnessMinus) {
|
||||
int delta = Ion::Backlight::MaxBrightness/GlobalPreferences::NumberOfBrightnessStates;
|
||||
int direction = (event == Ion::Events::BrightnessPlus) ? NumberOfStepsForShiftPlusMinus*delta : -delta*NumberOfStepsForShiftPlusMinus;
|
||||
int direction = (event == Ion::Events::BrightnessPlus) ? Ion::Backlight::NumberOfStepsPerShortcut*delta : -delta*Ion::Backlight::NumberOfStepsPerShortcut;
|
||||
GlobalPreferences::sharedGlobalPreferences()->setBrightnessLevel(GlobalPreferences::sharedGlobalPreferences()->brightnessLevel()+direction);
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -78,7 +78,6 @@ private:
|
||||
OnBoarding::App::Snapshot m_onBoardingSnapshot;
|
||||
HardwareTest::App::Snapshot m_hardwareTestSnapshot;
|
||||
USB::App::Snapshot m_usbConnectedSnapshot;
|
||||
const int NumberOfStepsForShiftPlusMinus = 3;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "../global_preferences.h"
|
||||
#include <apps/i18n.h>
|
||||
#include <assert.h>
|
||||
#include <ion/backlight.h>
|
||||
|
||||
using namespace Poincare;
|
||||
|
||||
@@ -38,7 +39,7 @@ bool MainController::handleEvent(Ion::Events::Event event) {
|
||||
GlobalPreferences * globalPreferences = GlobalPreferences::sharedGlobalPreferences();
|
||||
if (event == Ion::Events::BrightnessPlus || event == Ion::Events::BrightnessMinus){
|
||||
int delta = Ion::Backlight::MaxBrightness/GlobalPreferences::NumberOfBrightnessStates;
|
||||
int direction = (event == Ion::Events::BrightnessPlus) ? NumberOfStepsForShiftPlusMinus*delta : -delta*NumberOfStepsForShiftPlusMinus;
|
||||
int direction = (event == Ion::Events::BrightnessPlus) ? Ion::Backlight::NumberOfStepsPerShortcut*delta : -delta*Ion::Backlight::NumberOfStepsPerShortcut;
|
||||
GlobalPreferences::sharedGlobalPreferences()->setBrightnessLevel(GlobalPreferences::sharedGlobalPreferences()->brightnessLevel()+direction);
|
||||
m_selectableTableView.reloadCellAtLocation(m_selectableTableView.selectedColumn(), 1);
|
||||
return true;
|
||||
|
||||
@@ -42,7 +42,6 @@ private:
|
||||
AccessibilityController m_accessibilityController;
|
||||
ExamModeController m_examModeController;
|
||||
AboutController m_aboutController;
|
||||
const int NumberOfStepsForShiftPlusMinus = 3;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ bool isInitialized();
|
||||
void shutdown();
|
||||
void setBrightness(uint8_t b);
|
||||
uint8_t brightness();
|
||||
const int NumberOfStepsPerShortcut = 4;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user