anduril2: undef USE_SIMPLE_UI breaks build due to references in ramp-mode.c

Bug #1925009 reported by Tim McMahon
6
This bug affects 1 person
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_ui_config_state’ undeclared (first use in this function)
     if (current_state == simple_ui_config_state) style = 2;
                          ^
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_config’:
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/spaghetti-monster/anduril/ramp-mode.c'
--- old/ToyKeeper/spaghetti-monster/anduril/ramp-mode.c 2020-10-17 02:45:24 +0000
+++ new/ToyKeeper/spaghetti-monster/anduril/ramp-mode.c 2021-04-19 00:31:52 +0000
@@ -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_ui_config_state) style = 2;
+ #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_config() {
     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

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.