Commits

Trammell Hudson committed 665691e

Hexascroller integration works

  • Participants
  • Parent commits ccc85ad

Comments (0)

Files changed (1)

 static const uint8_t num_colors = sizeof(colors) / sizeof(*colors);
 
 
-static void pattern_fade(void)
+static void pattern_smooth(void)
 {
 	uint8_t cycle = 0;
 	const uint16_t iter_count = 256;
 			p[0] = (s->r * (uint16_t) 3 + p[0]) / 4;
 			p[1] = (s->g * (uint16_t) 3 + p[1]) / 4;
 			p[2] = (s->b * (uint16_t) 3 + p[2]) / 4;
+
+			if (do_change)
+				return;
 		}
 
 		send_pixels();
 		fade_pixels(0, 0, 0);
 		_delay_ms(30);
-
-		if (cycle & 1)
-			LED_OFF;
-		else
-			LED_ON;
-
-		if (do_change)
-			return;
 	}
 }
 
 
 static const pattern_t patterns[] = {
 	pattern_flash,
+	pattern_decay,
 	pattern_chase,
-	pattern_fade,
+	pattern_decay,
+	pattern_smooth,
 };
 
 static const uint8_t num_patterns = sizeof(patterns) / sizeof(*patterns);
 
 ISR(USART1_RX_vect)
 {
+	LED_ON;
 	const uint8_t c = UDR1;
-	if ('0' <= c && c <= num_patterns)
+
+	if ('0' <= c && c <= '0' + num_patterns)
 	{
 		pattern = c - '0';
 		do_change = 1;
+
+		print("read: ");
+		pchar(c);
+		pchar('\n');
 	}
+
+	LED_OFF;
 }
 
 
 
 
 	LED_ON;
+	print("started up\n");
 
 	DDRB |= 1 << 2;
 	DDRB |= 1 << 1;