Mercurial > code > home > repos > front-door-display
view esp/update_lcd_block.h @ 7:b46679798c51
mv esp code to this repo. still trying to get correct refreshes
author | drewp@bigasterisk.com |
---|---|
date | Sun, 10 Mar 2024 15:03:53 -0700 |
parents | |
children | 47795c3121f1 |
line wrap: on
line source
#include <string> #include "esphome.h" #include "esphome/components/ili9xxx/ili9xxx_display.h" void update_lcd_block(esphome::ili9xxx::ILI9XXXDisplay *lcd, std::string &x) { id(lcd).update(); #if 1 std::string localPayload = x; const char *buf = localPayload.data(); #else const char *buf = x.data(); #endif uint16_t seq, xp, yp, w, h; #define readu16() \ (static_cast<const uint16_t>(*(buf++)) | \ (static_cast<const uint16_t>(*(buf++)) << 8)) seq = readu16(); xp = readu16(); yp = readu16(); w = readu16(); h = readu16(); char seqDia[] = " "; seqDia[seq % 10] = '%'; ESP_LOGD("dbg", "seq=%hu%s xp=%hu, yp=%hu, w=%hu, h=%hu, full payload=%d bytes", seq, seqDia, xp, yp, w, h, x.size()); #if 1 ///// v1 id(lcd).draw_pixels_at(320+w-1-xp, yp, w, h, reinterpret_cast<const uint8_t*>(buf), COLOR_ORDER_BGR, COLOR_BITNESS_888, /*big_endian=*/false, /*x_offset=*/0, /*y_offset=*/0, /*x_pad=*/0); #elif 0 ///// v2 for (uint16_t y = 0; y < h; y++) { uint16_t row = yp + y; for (uint16_t x = 0; x < w; x++) { id(lcd).draw_pixel_at(320-1-(xp + w-1 - x), row, Color(*buf++, *buf++, *buf++)); } // App.feed_wdt(); } #else #endif id(lcd).update(); }