Update IAQI colormap + fix led ordering for proto V1
This commit is contained in:
parent
971c3bcee2
commit
25dd53116c
66
Claire.ino
66
Claire.ino
|
@ -40,6 +40,13 @@ static int CONNECT_SW_PIN = 0;
|
|||
Adafruit_NeoPixel leds_rgb_proto_paper(NUM_LEDS_PROTO_PAPER, DATA_PIN_PROTO_PAPER, NEO_GRB + NEO_KHZ800);
|
||||
Adafruit_NeoPixel leds_rgbw_proto_v1(NUM_LEDS_PROTO_V1, DATA_PIN_PROTO_V1, NEO_RGBW + NEO_KHZ800);
|
||||
|
||||
static int ledMapPrecipitation[12] = {0};
|
||||
static int ledMapPAQI[12] = {0};
|
||||
static int ledMapUVI = 0;
|
||||
static int ledMapPollen = 0;
|
||||
static int ledMapIAQI = 0;
|
||||
static int ledMapAQI = 0;
|
||||
|
||||
#define SEALEVELPRESSURE_HPA (1013.25)
|
||||
#define BME_CS 5
|
||||
String output;
|
||||
|
@ -183,6 +190,8 @@ void parseJson(String * payload)
|
|||
|
||||
static void setup_pins_proto_paper(void)
|
||||
{
|
||||
int n = 0;
|
||||
|
||||
BUIENRADAR_START_LED = 32;
|
||||
BUIENRADAR_SKIP_LED = 1;
|
||||
BUIENRADAR_NUM_LEDS = 12;
|
||||
|
@ -198,10 +207,29 @@ static void setup_pins_proto_paper(void)
|
|||
IAQI_LED = 88; // LED below center
|
||||
|
||||
CONNECT_SW_PIN = CONNECT_SW_PIN_PROTO_PAPER;
|
||||
|
||||
n = 0;
|
||||
while (n < BUIENRADAR_NUM_LEDS) {
|
||||
ledMapPrecipitation[n] = BUIENRADAR_START_LED + n * (BUIENRADAR_SKIP_LED + 1);
|
||||
n = n + 1;
|
||||
}
|
||||
|
||||
n = 0;
|
||||
while (n < PAQI_NUM_LEDS) {
|
||||
ledMapPAQI[n] = PAQI_START_LED + n * (PAQI_SKIP_LED + 1);
|
||||
n = n + 1;
|
||||
}
|
||||
|
||||
ledMapAQI = AQI_LED;
|
||||
ledMapUVI = UVI_LED;
|
||||
ledMapPollen = POLLEN_LED;
|
||||
ledMapIAQI = IAQI_LED;
|
||||
}
|
||||
|
||||
static void setup_pins_proto_v1(void)
|
||||
{
|
||||
int n = 0;
|
||||
|
||||
BUIENRADAR_START_LED = 0;
|
||||
BUIENRADAR_SKIP_LED = 0;
|
||||
BUIENRADAR_NUM_LEDS = 12;
|
||||
|
@ -216,6 +244,25 @@ static void setup_pins_proto_v1(void)
|
|||
IAQI_LED = 25; // LED below center
|
||||
|
||||
CONNECT_SW_PIN = CONNECT_SW_PIN_PROTO_V1;
|
||||
|
||||
ledMapPrecipitation[0] = 11;
|
||||
n = 1;
|
||||
while (n < BUIENRADAR_NUM_LEDS) {
|
||||
ledMapPrecipitation[n] = BUIENRADAR_START_LED + (n - 1) * (BUIENRADAR_SKIP_LED + 1);
|
||||
n = n + 1;
|
||||
}
|
||||
|
||||
ledMapPAQI[0] = 23;
|
||||
n = 1;
|
||||
while (n < PAQI_NUM_LEDS) {
|
||||
ledMapPAQI[n] = PAQI_START_LED + (n - 1) * (PAQI_SKIP_LED + 1);
|
||||
n = n + 1;
|
||||
}
|
||||
|
||||
ledMapAQI = AQI_LED;
|
||||
ledMapUVI = UVI_LED;
|
||||
ledMapPollen = POLLEN_LED;
|
||||
ledMapIAQI = IAQI_LED;
|
||||
}
|
||||
|
||||
void leds_clear(void) {
|
||||
|
@ -590,12 +637,20 @@ float colormapIaqi(void)
|
|||
x = 1.0f; // Excellent
|
||||
} else if (iaqi <= 100.0f) {
|
||||
x = 2.0f; // Good
|
||||
} else if (iaqi <= 125.0f) {
|
||||
x = 4.0f;
|
||||
} else if (iaqi <= 150.0f) {
|
||||
x = 4.0f; // Lightly polluted
|
||||
} else if (iaqi <= 175.0f) {
|
||||
x = 5.0f;
|
||||
} else if (iaqi <= 200.0f) {
|
||||
x = 7.0f; // Moderately polluted
|
||||
x = 6.0f; // Moderately polluted
|
||||
} else if (iaqi <= 225.0f) {
|
||||
x = 7.0f;
|
||||
} else if (iaqi <= 250.0f) {
|
||||
x = 9.0f; // Heavily polluted
|
||||
x = 8.0f; // Heavily polluted
|
||||
} else if (iaqi <= 300.0f) {
|
||||
x = 9.0f;
|
||||
} else if (iaqi <= 350.0f) {
|
||||
x = 10.0f; // Severely polluted
|
||||
} else {
|
||||
|
@ -705,7 +760,7 @@ static void updateLeds(void) {
|
|||
b = (color & 0x0000FF);
|
||||
w = (color & 0xFF000000) >> 24;
|
||||
|
||||
ledsSetPixelColor(ledIdx, r, g, b);
|
||||
ledsSetPixelColor(ledMapPAQI[ledCount], r, g, b);
|
||||
ledIdx = ledIdx + PAQI_SKIP_LED + 1;
|
||||
}
|
||||
|
||||
|
@ -727,7 +782,7 @@ static void updateLeds(void) {
|
|||
b = (color & 0x0000FF);
|
||||
w = (color & 0xFF000000) >> 24;
|
||||
|
||||
ledsSetPixelColor(ledIdx, r, g, b);
|
||||
ledsSetPixelColor(ledMapPAQI[ledCount], r, g, b);
|
||||
}
|
||||
|
||||
#ifdef SHOW_AQI_LED
|
||||
|
@ -813,6 +868,7 @@ static void updateLeds(void) {
|
|||
g = (color & 0x00FF00) >> 8;
|
||||
b = (color & 0x0000FF);
|
||||
|
||||
ledsSetPixelColor(ledMapPrecipitation[ledCount], r, g, b);
|
||||
ledIdx = ledIdx + BUIENRADAR_SKIP_LED + 1;
|
||||
}
|
||||
|
||||
|
@ -832,7 +888,7 @@ static void updateLeds(void) {
|
|||
r = (color & 0xFF0000) >> 16;
|
||||
g = (color & 0x00FF00) >> 8;
|
||||
b = (color & 0x0000FF);
|
||||
ledsSetPixelColor(ledIdx, r, g, b);
|
||||
ledsSetPixelColor(ledMapPrecipitation[ledCount], r, g, b);
|
||||
}
|
||||
|
||||
ledsSetPixelColor(IAQI_LED, r, g, b);
|
||||
|
|
Loading…
Reference in a new issue