From 538e5029dc426bfd61eb3c6b9e2891b3cec355b7 Mon Sep 17 00:00:00 2001 From: Shane Synan Date: Tue, 28 Nov 2023 14:57:41 -0500 Subject: bikeflash: Cap default brightness to max, define Cap fallback default bike flasher brightness to stay below MAX_BIKING_LEVEL, fixing noFET/boost driver builds where MAX_1x7135 is above MAX_BIKING_LEVEL. Add the optional define DEFAULT_BIKING_LEVEL to set the default bike flasher brightness. This is NOT checked against MAX_BIKING_LEVEL, for simplicity. Alternatively, strobe-modes.c could be updated to check if the value exceeds MAX_BIKING_LEVEL at runtime. However, that might take up more flash space. Migrated from https://code.launchpad.net/~digitalcircuit/flashlight-firmware/anduril2_fix_nofet_bikeflash/+merge/408124 --- ui/anduril/load-save-config.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'ui') diff --git a/ui/anduril/load-save-config.h b/ui/anduril/load-save-config.h index 514fcbb..eb6d798 100644 --- a/ui/anduril/load-save-config.h +++ b/ui/anduril/load-save-config.h @@ -118,7 +118,15 @@ Config cfg = { .strobe_delays = { 41, 67 }, #endif #ifdef USE_BIKE_FLASHER_MODE - .bike_flasher_brightness = MAX_1x7135, + #ifndef DEFAULT_BIKING_LEVEL + #if MAX_1x7135 > MAX_BIKING_LEVEL + // Make sure fallback default doesn't exceed maximum (e.g. noFET) + #define DEFAULT_BIKING_LEVEL MAX_BIKING_LEVEL + #else + #define DEFAULT_BIKING_LEVEL MAX_1x7135 + #endif + #endif + .bike_flasher_brightness = DEFAULT_BIKING_LEVEL, #endif #ifdef USE_BEACON_MODE // beacon timing -- cgit v1.2.3