From 0a560924bd4d0a6e7e1beb9533c880538ebf7708 Mon Sep 17 00:00:00 2001 From: Tom Ball Date: Wed, 24 Jan 2024 18:40:53 -0800 Subject: [PATCH] debugging the screen error --- libs/st7735/jddisplay.cpp | 10 +++++----- libs/st7735/screen.cpp | 14 +++++++------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/libs/st7735/jddisplay.cpp b/libs/st7735/jddisplay.cpp index 3fb24eb2ea5..4d444bbb834 100644 --- a/libs/st7735/jddisplay.cpp +++ b/libs/st7735/jddisplay.cpp @@ -14,7 +14,7 @@ codal::CodalDevice device; #define ALIGN(x) (((x) + 3) & ~3) static void jd_panic(void) { - target_panic(PANIC_SCREEN_ERROR); + target_panic(121); // PANIC_SCREEN_ERROR } static int jd_shift_frame(jd_frame_t *frame) { @@ -112,7 +112,7 @@ void JDDisplay::sendDone(Event) { void *JDDisplay::queuePkt(uint32_t service_num, uint32_t service_cmd, uint32_t size) { void *res = jd_push_in_frame(&sendFrame, service_num, service_cmd, size); if (res == NULL) - target_panic(PANIC_SCREEN_ERROR); + target_panic(122); // PANIC_SCREEN_ERROR return res; } @@ -330,11 +330,11 @@ void JDDisplay::step() { int JDDisplay::sendIndexedImage(const uint8_t *src, unsigned width, unsigned height, uint32_t *palette) { if (height & 1 || !height || !width) - target_panic(PANIC_SCREEN_ERROR); + target_panic(123); // PANIC_SCREEN_ERROR if (width != addr.width || height != addr.height) - target_panic(PANIC_SCREEN_ERROR); + target_panic(124); // PANIC_SCREEN_ERROR if (inProgress) - target_panic(PANIC_SCREEN_ERROR); + target_panic(125); // PANIC_SCREEN_ERROR if (addr.y && addr.y >= screenHeight) return 0; // out of range diff --git a/libs/st7735/screen.cpp b/libs/st7735/screen.cpp index 380c7921b1e..22e537bf79a 100644 --- a/libs/st7735/screen.cpp +++ b/libs/st7735/screen.cpp @@ -68,10 +68,10 @@ class WDisplay { io = CODAL_CREATE_PARALLEL_SCREEN_IO(cfg2 & 0xffffff, PIN(DISPLAY_MOSI), PIN(DISPLAY_MISO)); #else - target_panic(PANIC_SCREEN_ERROR); + target_panic(126); // PANIC_SCREEN_ERROR #endif } else { - target_panic(PANIC_SCREEN_ERROR); + target_panic(127); // PANIC_SCREEN_ERROR } if (dispTp == DISPLAY_TYPE_ST7735) @@ -83,7 +83,7 @@ class WDisplay { lcd = NULL; smart = new JDDisplay(spi, LOOKUP_PIN(DISPLAY_CS), LOOKUP_PIN(DISPLAY_DC)); } else - target_panic(PANIC_SCREEN_ERROR); + target_panic(128); // PANIC_SCREEN_ERROR palXOR = (cfg0 & 0x1000000) ? 0xffffff : 0x000000; auto madctl = cfg0 & 0xff; @@ -197,7 +197,7 @@ class WDisplay { *cfg0 |= 0x1000000; // inverted colors break; default: - target_panic(PANIC_SCREEN_ERROR); + target_panic(129); // PANIC_SCREEN_ERROR break; } @@ -293,7 +293,7 @@ void setPalette(Buffer buf) { return; if (48 != buf->length) - target_panic(PANIC_SCREEN_ERROR); + target_panic(130); // PANIC_SCREEN_ERROR for (int i = 0; i < 16; ++i) { display->currPalette[i] = (buf->data[i * 3] << 16) | (buf->data[i * 3 + 1] << 8) | (buf->data[i * 3 + 2] << 0); @@ -340,7 +340,7 @@ void updateScreen(SImage_ img) { if (img) { if (img->bpp() != 4 || img->width() * mult != display->width || img->height() * mult != display->displayHeight) - target_panic(PANIC_SCREEN_ERROR); + target_panic(131); // PANIC_SCREEN_ERROR // DMESG("wait for done"); display->waitForSendDone(); @@ -366,7 +366,7 @@ void updateScreen(SImage_ img) { img = display->lastStatus; auto barHeight = display->height - display->displayHeight; if (img->bpp() != 4 || barHeight != img->height() || img->width() != display->width) - target_panic(PANIC_SCREEN_ERROR); + target_panic(132); // PANIC_SCREEN_ERROR memcpy(display->screenBuf, img->pix(), img->pixLength()); display->setAddrStatus(); display->sendIndexedImage(display->screenBuf, img->width(), img->height(), NULL);