Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A very interesting issue about board autodetect #107

Open
Yixi opened this issue Nov 5, 2024 · 1 comment
Open

A very interesting issue about board autodetect #107

Yixi opened this issue Nov 5, 2024 · 1 comment

Comments

@Yixi
Copy link

Yixi commented Nov 5, 2024

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.

image

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.

M5GFX/src/M5GFX.cpp

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.

image

image

This thing is so amazing...

So, is there a way for us to manually specify the board model and skip the autodetect logic?

@lovyan03
Copy link
Collaborator

lovyan03 commented Nov 5, 2024

Hello @Yixi .

I think the IrDA LED was probably damaged by the impact of the fall. Since the M5GFX determines the model under the assumption that the hardware is not broken, it seems that it was no longer able to properly identify the model.
Currently, there is no way to disable automatic identification. I apologize for not being able to offer a solution right now.
I would like to consider some kind of countermeasure in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants