dim_mode = 0;
towbar_mode = 0;
braking = 0;
+
+ pwmled_select_brightness();
}
void brake_on()
void toggle_dim_mode()
{
dim_mode = !dim_mode;
+ pwmled_select_brightness();
pattern_reload();
}
else
return NULL;
}
+
+void pwmled_select_brightness()
+{
+ uint16_t brightness = PWMLED_BRIGHTNESS(0, 2, 1, 0, 2); // default
+
+ if (battery_critical) {
+ brightness = PWMLED_BRIGHTNESS(0, 0, 0, 0, 0);
+ } else if (ambient_zone < 2) {
+ if (dim_mode)
+ brightness = PWMLED_BRIGHTNESS(0, 1, 0, 0, 1);
+ else
+ brightness = PWMLED_BRIGHTNESS(0, 2, 1, 0, 2);
+ } else if (ambient_zone == 2) {
+ brightness = PWMLED_BRIGHTNESS(1, 3, 2, 1, 3);
+ } else if (ambient_zone == 3) {
+ brightness = PWMLED_BRIGHTNESS(2, 4, 2, 2, 4);
+ }
+
+ pwmled_set_brightness(brightness);
+}