Make simulator compile
This commit is contained in:
@ -4,8 +4,14 @@
|
||||
// This is wacky preprocessor magic that allows us to count the number of
|
||||
// members of an enum. Unfortunately, it doesn't work with enum classes, so we
|
||||
// have to use C-style enums.
|
||||
|
||||
// The preprocessor magic is so wacky we have to prevent GCC from failing with a
|
||||
// -Werror=pedantic when compiling the simulator
|
||||
#pragma GCC diagnostic ignored "-Wpedantic"
|
||||
|
||||
#define CountedEnum(NAME, TYPE, ...) \
|
||||
typedef enum { __VA_ARGS__ } NAME; \
|
||||
static const size_t NAME##_COUNT = sizeof((int[]){__VA_ARGS__}) / sizeof(int);
|
||||
static const size_t NAME##_COUNT = \
|
||||
sizeof(__extension__(int[]){__VA_ARGS__}) / sizeof(int);
|
||||
|
||||
#endif // INC_UTIL_H
|
||||
|
||||
@ -230,7 +230,7 @@ void led_anim_blinker(uint8_t r, uint8_t g, uint8_t b,
|
||||
colors[i][1] = g * i / (brightness_steps - 1);
|
||||
colors[i][2] = b * i / (brightness_steps - 1);
|
||||
}
|
||||
size_t simultaneous_leds = brightness_steps / next_led_steps;
|
||||
int32_t simultaneous_leds = brightness_steps / next_led_steps;
|
||||
if (simultaneous_leds * next_led_steps != brightness_steps) {
|
||||
simultaneous_leds++;
|
||||
}
|
||||
@ -239,7 +239,7 @@ void led_anim_blinker(uint8_t r, uint8_t g, uint8_t b,
|
||||
int32_t furthest = 0;
|
||||
size_t color_idx = 0;
|
||||
while (furthest < 5 + simultaneous_leds) {
|
||||
for (size_t offset = 0; offset < simultaneous_leds; offset++) {
|
||||
for (int32_t offset = 0; offset < simultaneous_leds; offset++) {
|
||||
int32_t diff = furthest - offset;
|
||||
size_t led_color_idx = color_idx + offset * next_led_steps;
|
||||
if (diff < 0 || diff > 4 || led_color_idx >= brightness_steps) {
|
||||
|
||||
Reference in New Issue
Block a user