Skip to content

Commit

Permalink
debugging the screen error
Browse files Browse the repository at this point in the history
  • Loading branch information
tballmsft committed Jan 25, 2024
1 parent 013e0e6 commit 0a56092
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
10 changes: 5 additions & 5 deletions libs/st7735/jddisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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
Expand Down
14 changes: 7 additions & 7 deletions libs/st7735/screen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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;
Expand Down Expand Up @@ -197,7 +197,7 @@ class WDisplay {
*cfg0 |= 0x1000000; // inverted colors
break;
default:
target_panic(PANIC_SCREEN_ERROR);
target_panic(129); // PANIC_SCREEN_ERROR
break;
}

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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();
Expand All @@ -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);
Expand Down

0 comments on commit 0a56092

Please sign in to comment.