[apps] Gather all code regarding exam mode in ExamModeCOnfiguration file

This commit is contained in:
Émilie Feral
2020-02-10 10:41:38 +01:00
committed by Léa Saviot
parent 541acb6a7c
commit e17ae9024e
17 changed files with 181 additions and 86 deletions

View File

@@ -1,6 +1,7 @@
#include "apps_container.h"
#include "apps_container_storage.h"
#include "global_preferences.h"
#include "exam_mode_configuration.h"
#include <ion.h>
#include <poincare/init.h>
#include <poincare/exception_checkpoint.h>
@@ -325,16 +326,9 @@ void AppsContainer::redrawWindow() {
}
void AppsContainer::activateExamMode(GlobalPreferences::ExamMode examMode) {
assert(examMode == GlobalPreferences::ExamMode::Standard || examMode == GlobalPreferences::ExamMode::Dutch);
assert(examMode != GlobalPreferences::ExamMode::Off && examMode != GlobalPreferences::ExamMode::Unknown);
reset();
/* The Dutch exam mode LED is supposed to be orange but we can only make
* blink "pure" colors: with RGB leds on or off (as the PWM is used for
* blinking). The closest "pure" color is Yellow. Moreover, Orange LED is
* already used when the battery is charging. Using yellow, we can assert
* that the yellow LED only means that Dutch exam mode is on and avoid
* confusing states when the battery is charging and states when the Dutch
* exam mode is on. */
Ion::LED::setColor(examMode == GlobalPreferences::ExamMode::Dutch ? KDColorYellow : KDColorRed);
Ion::LED::setColor(ExamModeConfiguration::examModeColor(examMode));
Ion::LED::setBlinking(1000, 0.1f);
}