File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -81,6 +81,12 @@ static const pmlevel_t pmlevels_who[] = {
8181 { -1 , 0 } // END
8282};
8383
84+ static const uint32_t stook_colors[] = {
85+ 0xFFAA00 , // yellow
86+ 0xFF5500 , // orange
87+ 0xFF0000 // red
88+ };
89+
8490static void strip_fill (Adafruit_NeoPixel & strip, uint32_t rgb)
8591{
8692 for (int i = 0 ; i < strip.numPixels (); i++) {
@@ -443,19 +449,10 @@ void loop(void)
443449 color = interpolate (pm2_5, pmlevels_who);
444450 }
445451 if (scheme == " stook" ) {
446- switch (stook_score) {
447- case 0 :
448- color = 0xFFaa00 ; // yellow
449- break ;
450- case 1 :
451- color = 0xFF5500 ; // orange
452- break ;
453- case 2 :
454- color = 0xFF0000 ; // red
455- break ;
456- default :
457- color = 0x111111 ; // grey
458- break ;
452+ if ((stook_score >= 0 ) && (stook_score < 3 )) {
453+ color = stook_colors[stook_score];
454+ } else {
455+ color = 0x111111 ;
459456 }
460457 }
461458 set_led (color);
You can’t perform that action at this time.
0 commit comments