Skip to content

Commit

Permalink
Add ESPNOW icon (#98)
Browse files Browse the repository at this point in the history
* Add icon EspNow (thanks @Kartoffel)
* Add showEspNowIcon function to display icons on TFT screen
  • Loading branch information
melkati authored Jan 8, 2024
1 parent be5f8d9 commit 536ecd0
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
14 changes: 12 additions & 2 deletions CO2_Gadget_TFT.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,18 @@ void showBLEIcon(int32_t posX, int32_t posY) {
void showMQTTIcon(int32_t posX, int32_t posY) {
tft.drawRoundRect(posX-2, posY-2, 16+4, 16+4, 2, TFT_DARKGREY);
if (!activeMQTT) {
tft.drawBitmap(posX-1, posY-1, iconMQTT, 16, 16, TFT_BLACK, TFT_DARKGREY);
tft.drawBitmap(posX, posY, iconMQTT, 16, 16, TFT_BLACK, TFT_DARKGREY);
} else {
tft.drawBitmap(posX-1, posY-1, iconMQTT, 16, 16, TFT_BLACK, iconDefaultColor);
tft.drawBitmap(posX, posY, iconMQTT, 16, 16, TFT_BLACK, iconDefaultColor);
}
}

void showEspNowIcon(int32_t posX, int32_t posY) {
tft.drawRoundRect(posX-2, posY-2, 16+4, 16+4, 2, TFT_DARKGREY);
if (!activeESPNOW) {
tft.drawBitmap(posX, posY, iconEspNow, 16, 16, TFT_BLACK, TFT_DARKGREY);
} else {
tft.drawBitmap(posX, posY, iconEspNow, 16, 16, TFT_BLACK, iconDefaultColor);
}
}

Expand Down Expand Up @@ -284,6 +293,7 @@ void displayShowValues(uint16_t co2) {
showWiFiIcon(24, 3);
showMQTTIcon(46, 3);
showBLEIcon(2, 3);
showEspNowIcon(68, 3);

// Revert datum setting
tft.setTextDatum(defaultDatum);
Expand Down
9 changes: 7 additions & 2 deletions icons.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,13 @@ const unsigned char iconBLE[32] PROGMEM = {

// 'iconMQTT', 16x16px
const unsigned char iconMQTT[32] PROGMEM = {
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe1, 0xc3, 0xe1,0xc3, 0xe1, 0x83, 0xe1, 0x83,
0xe0, 0x83, 0xe4, 0x83, 0xe4, 0x03, 0xe4, 0x23, 0xe4, 0x23, 0xe6, 0x23, 0xe6, 0x73, 0xff, 0xff};
0xff, 0xff, 0xff, 0xff, 0x87, 0xe1, 0x87, 0xe1, 0x83, 0xc1, 0x83, 0xc1, 0x89, 0x91, 0x89, 0x91,
0x8c, 0x31, 0x8c, 0x31, 0x8e, 0x71, 0x8e, 0x71, 0x8f, 0xf1, 0x8f, 0xf1, 0xff, 0xff, 0xff, 0xff};

// 'iconEspNow', 16x16px
const unsigned char iconEspNow[32] PROGMEM = {
0xff, 0xff, 0xff, 0xff, 0xc0, 0x03, 0xc0, 0x03, 0xe6, 0x67, 0xe2, 0x47, 0xf0, 0x0f, 0xf8, 0x1f,
0xfc, 0x3f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xff, 0xff, 0xff, 0xff};

// 'iconHumidity', 16x16px
const uint16_t iconHumidity[256] PROGMEM = {
Expand Down
2 changes: 1 addition & 1 deletion platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ build_flags =

-D MQTT_BROKER_SERVER="\"192.168.1.145"\"
-D CO2_GADGET_VERSION="\"0.7."\"
-D CO2_GADGET_REV="\"005"\"
-D CO2_GADGET_REV="\"006"\"
-D CORE_DEBUG_LEVEL=0
-DNEOPIXEL_PIN=26 ; Pinnumber for button for down/next and back / exit actions
-DNEOPIXEL_COUNT=16 ; How many neopixels to control
Expand Down

0 comments on commit 536ecd0

Please sign in to comment.