Add the Elecrow CrowPanel 7.0" as a third board, and take the packages and the add-on from Gitea (0.2.93)
A board file for the Elecrow CrowPanel 7.0" (DIS08070H, ESP32-S3-WROOM-1-N4R8): 800x480 through mipi_rgb, GT911 on the ESP32-S3's USB pins (elecrow_usb_phy.h frees them, behind a flag only this board sets), the Guition's vertical sizes across a wider page, no rotation. Its 4 MB of flash take the CYD's budget: a partition table of the component's (smart_display: partitions: 4mb_wide_slots, 1,984 KB slots), the icon fonts at 2 bits a pixel and the TLS client only bring the firmware to 1,865,440 bytes, 91.8 % of a slot, with camera images kept. docs/ELECROW.md has the numbers and the trade. The add-on reads a large board's name from the type sensor's value, the editor offers the board under New screen and draws the wide preview, tools/check.sh builds it with the budget, render_topbar and capture_ui take the panel's size. Firmware 0.2.79; the CYD image is unchanged (1,633,760 bytes). This fork builds from gittea.trippedonmy.name/Xandrossian/homeassistant_espscreen: the packages, the fonts, the component and the add-on repository point there instead of GitHub.
This commit is contained in:
@@ -1,18 +1,22 @@
|
||||
#pragma once
|
||||
#include <algorithm>
|
||||
|
||||
#include "lvgl.h"
|
||||
#include "esphome/core/log.h"
|
||||
|
||||
// On-demand 240x240 diagnostic image of LVGL's rendered screen. Nothing is
|
||||
// allocated or streamed during normal use. The RGB display signal itself
|
||||
// still needs a physical visual check.
|
||||
// On-demand diagnostic image of LVGL's rendered screen at half its resolution (240x240 on the Guition, 400x240 on
|
||||
// the Elecrow): every second pixel of every second row. Nothing is allocated or streamed during normal use. The RGB
|
||||
// display signal itself still needs a physical visual check. The geometry check takes the panel's own size.
|
||||
namespace guition {
|
||||
inline int screen_w() { return lv_display_get_horizontal_resolution(lv_display_get_default()); }
|
||||
inline int screen_h() { return lv_display_get_vertical_resolution(lv_display_get_default()); }
|
||||
inline bool check_geometry(lv_obj_t *obj) {
|
||||
if (lv_obj_has_flag(obj, LV_OBJ_FLAG_HIDDEN)) return true;
|
||||
bool ok = true;
|
||||
lv_area_t area;
|
||||
lv_obj_get_coords(obj, &area);
|
||||
if (lv_obj_has_flag(obj, LV_OBJ_FLAG_CLICKABLE) &&
|
||||
(area.x1 < 0 || area.y1 < 0 || area.x2 >= 480 || area.y2 >= 480)) {
|
||||
(area.x1 < 0 || area.y1 < 0 || area.x2 >= screen_w() || area.y2 >= screen_h())) {
|
||||
ESP_LOGE("ui_test", "GEOMETRY FAIL clickable=(%d,%d)-(%d,%d)",
|
||||
area.x1, area.y1, area.x2, area.y2);
|
||||
ok = false;
|
||||
@@ -32,7 +36,7 @@ inline void snapshot_begin() {
|
||||
overlay = nullptr;
|
||||
snapshot = lv_snapshot_take(lv_screen_active(), LV_COLOR_FORMAT_RGB565);
|
||||
snapshot_row = 0;
|
||||
if (!snapshot || snapshot->header.w != 480 || snapshot->header.h != 480) {
|
||||
if (!snapshot || (int) snapshot->header.w != screen_w() || (int) snapshot->header.h != screen_h()) {
|
||||
if (snapshot) lv_draw_buf_destroy(snapshot);
|
||||
snapshot = nullptr;
|
||||
ESP_LOGE("ui_image", "IMAGE FAIL allocation/dimensions");
|
||||
@@ -41,10 +45,10 @@ inline void snapshot_begin() {
|
||||
for (uint32_t i = 0; i < lv_obj_get_child_count(lv_layer_top()); ++i)
|
||||
if (!lv_obj_has_flag(lv_obj_get_child(lv_layer_top(), i), LV_OBJ_FLAG_HIDDEN)) {
|
||||
overlay = lv_snapshot_take(lv_layer_top(), LV_COLOR_FORMAT_ARGB8888);
|
||||
if (overlay && (overlay->header.w != 480 || overlay->header.h != 480)) { lv_draw_buf_destroy(overlay); overlay = nullptr; }
|
||||
if (overlay && ((int) overlay->header.w != screen_w() || (int) overlay->header.h != screen_h())) { lv_draw_buf_destroy(overlay); overlay = nullptr; }
|
||||
break;
|
||||
}
|
||||
ESP_LOGI("ui_image", "IMAGE BEGIN 240 240%s", overlay ? " with top layer" : "");
|
||||
ESP_LOGI("ui_image", "IMAGE BEGIN %d %d%s", screen_w() / 2, screen_h() / 2, overlay ? " with top layer" : "");
|
||||
}
|
||||
// The top layer's pixel over the page's, as the panel shows them.
|
||||
inline uint16_t layered(uint16_t pixel, int x, int y) {
|
||||
@@ -62,15 +66,17 @@ inline void snapshot_next_row() {
|
||||
const auto *row = reinterpret_cast<const uint16_t *>(
|
||||
snapshot->data + snapshot_row * 2 * snapshot->header.stride);
|
||||
static constexpr char hex[] = "0123456789abcdef";
|
||||
char line[961];
|
||||
for (int x = 0; x < 240; ++x) {
|
||||
// Four hex digits a pixel; the widest panel is 800 px, 400 in the image.
|
||||
static char line[1601];
|
||||
const int columns = std::min(screen_w() / 2, 400);
|
||||
for (int x = 0; x < columns; ++x) {
|
||||
uint16_t pixel = layered(row[x * 2], x * 2, snapshot_row * 2);
|
||||
for (int digit = 0; digit < 4; ++digit)
|
||||
line[x * 4 + digit] = hex[(pixel >> (12 - digit * 4)) & 15];
|
||||
}
|
||||
line[960] = 0;
|
||||
line[columns * 4] = 0;
|
||||
ESP_LOGI("ui_image", "ROW %03d %s", snapshot_row, line);
|
||||
if (++snapshot_row == 240) {
|
||||
if (++snapshot_row == screen_h() / 2) {
|
||||
lv_draw_buf_destroy(snapshot);
|
||||
snapshot = nullptr;
|
||||
if (overlay) lv_draw_buf_destroy(overlay);
|
||||
|
||||
Reference in New Issue
Block a user