-
Notifications
You must be signed in to change notification settings - Fork 91
Description
Yesterday, after my three-year-old son dropped my Cardputer, I restarted it and found that the screen display was abnormal, with some black areas and some garbled sections.
At first, I thought the screen was damaged from the drop, but when I flashed other firmware, like M5Launcher, the screen displayed normally. Only the code I compiled based on M5Cardputer.h shows the abnormal display.
At this point, I began to suspect it was a screen configuration issue. So, I used the code Serial.printf("width:%d, height:%d\n", M5Cardputer.Display.width(), M5Cardputer.Display.height()); to print out the information, and found that both the screen width and height were 240.
However, I couldn’t find a place in M5GFX to manually configure the display settings. After extensive debugging, I discovered that during M5GFX’s autodetect process, the board was being identified as board_t::board_M5VAMeter.
The reason was that after I dropped the Cardputer, the value obtained in result at this point was 1.
Lines 1475 to 1486 in ff11e09
| auto result = lgfx::gpio::command( | |
| (const uint8_t[]) { | |
| lgfx::gpio::command_mode_input_pulldown, GPIO_NUM_44, // Cardputer = IrDA_TXD | |
| lgfx::gpio::command_mode_input_pullup , GPIO_NUM_44, | |
| lgfx::gpio::command_read , GPIO_NUM_44, | |
| lgfx::gpio::command_end | |
| } | |
| ); | |
| for (auto &bup : backup_pins) { bup.restore(); } | |
| // In "Cardputer", even if GPIO44 are set to Input_pullup, LOW is output. | |
| // This characteristic can be used to distinguish between the two models. | |
| board = (result == 0) ? board_t::board_M5Cardputer : board_t::board_M5VAMeter; |
I modified the code locally and after recompiling, the screen displayed normally.
This thing is so amazing...
So, is there a way for us to manually specify the board model and skip the autodetect logic?


