Commit f901282e authored by Sven Greiner's avatar Sven Greiner

Fix #6: Moonlight mode

Extends the strobe mode. If options.moonlight is set and options.strobe
is not, then the light will turn on alway in moonlight and after a
single tap it will continue with the default mode.

At least with the development board there is no visibly huge difference
in output, so this should be considered WIP.
parent 74d1cdc4
......@@ -96,11 +96,12 @@ enum State {
typedef union {
uint8_t raw;
struct {
unsigned strobe : 1;
unsigned moonlight : 1;
unsigned fixed_mode : 1;
unsigned mode_memory : 1;
unsigned freeze_on_high : 1;
unsigned start_high : 1;
unsigned strobe : 1;
unsigned stealth_beacon : 1;
};
} Options;
......@@ -376,7 +377,7 @@ int main(void) {
if (coldboot) { // Initialize state after the flashlight was switched off for some time
#ifdef STROBE
state = options.strobe ? kStrobe : kDefault;
state = (options.strobe || options.moonlight) ? kStrobe : kDefault;
#else
state = kDefault;
#endif // ifdef STROBE
......@@ -528,9 +529,14 @@ int main(void) {
#ifdef STROBE
case kStrobe:
set_pwm(TURBO_PWM);
blink(4,2);
blink(4,3);
if (options.strobe) {
set_pwm(TURBO_PWM);
blink(4,2);
blink(4,3);
} else {
set_pwm(1);
enable_output();
}
break;
#endif // ifdef STROBE
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment