while (0)
#define rand_u8() (rand() & 0xff)
#define rand_u16() ((rand() << 8) + rand_u8())
-#define rand_incolor_steps(f) (min_incolor_steps[f] + \
- (rand() % range_incolor_steps[f]))
-#define rand_fade_steps(f) (min_fade_steps[f] + \
- (rand() % range_fade_steps[f]))
+#define rand_incolor_steps(f) (min_incolor_steps[f & 1] + \
+ (rand() % range_incolor_steps[f & 1]))
+#define rand_fade_steps(f) (min_fade_steps[f & 1] + \
+ (rand() % range_fade_steps[f & 1]))
#define leds_set(r,g,b,w) rgb_set((r).value >> 7, \
(g).value >> 7, \
(b).value >> 7, 0)
const static int min_fade_steps[2] = { 64, 32 };
const static int range_fade_steps[2] = { 416, 128 };
#else
-const static unsigned min_incolor_steps[2] = { 64, 64 };
+const static unsigned min_incolor_steps[2] = { 64, 32 };
const static unsigned range_incolor_steps[2] = { 1, 1 };
-const static int min_fade_steps[2] = { 32, 32 };
+const static int min_fade_steps[2] = { 64, 32 };
const static int range_fade_steps[2] = { 1, 1 };
#endif
unsigned char buttons = buttons_read();
if ((buttons & (IN_ROCKERA | IN_ROCKERB))) {
- if (buttons & IN_PUSHBTN) {
- if (!fast) {
- fast = 1;
+ /* Crappy way to detect rising edges to change state of fast var */
+ if (!(fast & 2) && (buttons & IN_PUSHBTN)) {
+ fast |= 2;
+ } else if ((fast & 2) && !(buttons & IN_PUSHBTN)) {
+ fast &= ~2;
+ fast = 1 - fast;
reset_steps();
- } else
- fast = 0;
}
if (fade_steps) {