anduril2: undef USE_SIMPLE_UI breaks build due to references in ramp-mode.c
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Flashlight Firmware Repository |
New
|
Undecided
|
Unassigned |
Bug Description
I tried to disable Simple UI in my cfg-*.h:
#ifdef USE_SIMPLE_UI
#undef USE_SIMPLE_UI
#endif
But I was getting an error while running make due to some references to Simple UI in ramp-mode.c:
ramp-mode.c: In function ‘ramp_config_save’:
ramp-mode.c:425:26: error: ‘simple_
if (current_state == simple_
ramp-mode.c:425:26: note: each undeclared identifier is reported only once for each function it appears in
ramp-mode.c: In function ‘nearest_level’:
ramp-mode.c:480:41: error: ‘simple_ui_active’ undeclared (first use in this function)
uint8_t num_steps = ramp_stepss[1 + simple_ui_active];
ramp-mode.c: In function ‘ramp_update_
ramp-mode.c:508:9: error: ‘simple_ui_active’ undeclared (first use in this function)
if (simple_ui_active) { which = 2; }
I fixed it by adding some conditions:
=== modified file 'ToyKeeper/
--- old/ToyKeeper/
+++ new/ToyKeeper/
@@ -422,7 +422,9 @@
// 0 = smooth ramp, 1 = stepped ramp, 2 = simple UI's ramp
uint8_t style = ramp_style;
+ #ifdef USE_SIMPLE_UI
if (current_state == simple_
+ #endif
// save adjusted value to the correct slot
if (value) {
@@ -477,7 +479,11 @@
// bounds check
uint8_t mode_min = ramp_floor;
uint8_t mode_max = ramp_ceil;
- uint8_t num_steps = ramp_stepss[1 + simple_ui_active];
+ uint8_t num_steps = ramp_stepss[1
+ #ifdef USE_SIMPLE_UI
+ + simple_ui_active
+ #endif
+ ];
// special case for 1-step ramp... use halfway point between floor and ceiling
if (ramp_style && (1 == num_steps)) {
uint8_t mid = (mode_max + mode_min) >> 1;
@@ -505,7 +511,9 @@
// ensure ramp globals are correct
void ramp_update_
uint8_t which = ramp_style;
+ #ifdef USE_SIMPLE_UI
if (simple_ui_active) { which = 2; }
+ #endif
ramp_floor = ramp_floors[which];
ramp_ceil = ramp_ceils[which];
Revision: 586