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

P8B Display Flipped #3

Closed
izzeho opened this issue Jun 22, 2022 · 12 comments
Closed

P8B Display Flipped #3

izzeho opened this issue Jun 22, 2022 · 12 comments
Labels
enhancement New feature or request new-variant New watch variants

Comments

@izzeho
Copy link

izzeho commented Jun 22, 2022

Have flashed your zip as I'm not sure the state of the PRs into the standard Infinitime release. I believe I have a p8b based on magnetic charger. Ordered recently from Aliexpress and the stock firmware worked okay.

Everything seems to be working except ... the display is flipped left-to-right. Same behaviour was seen in the bootloader.

20220622_204727

I don't see anything immediately obvious for build options or config. The touchscreen interactions aren't flipped. Before I start digging in driver code, do you have any suggestions?

@StarGate01
Copy link
Owner

StarGate01 commented Jun 22, 2022

Oh wow, that is a new one :D Where did you buy that one? I am interested in collecting more variants.

What was your firmware identification string? E.g. something like MOY-TFK5-1.7.7 .

As for fixing this, I think the display controller itself has an option/register to flip the display. I am not sure weather the driver exposes this function. Maybe LVGL has a function to mirror everything in software as well.

Is your touch flipped as well? Does it align with the display content?

I'm not sure the state of the PRs into the standard Infinitime release

Upstreaming is still in progress and will take quite some time still.

@izzeho
Copy link
Author

izzeho commented Jun 22, 2022

Touch is not flipped. I didn't take note of the firmware string before trying to flash wasp-os (also was flipped). I'll start having a dig through LVGL and the display driver.

This was the model purchased:
https://www.aliexpress.com/item/4000557708951.html

@StarGate01
Copy link
Owner

I see. So your touch inputs don't line up with the elements on the display you want to tap?

I guess the manufacturer decided to mount the LCD in reverse, or used a slightly different model.

@izzeho
Copy link
Author

izzeho commented Jun 23, 2022

I couldn't find anything in LVGL to flip, only rotate. Setting MX bit in MADCTL register fixes the display

void St7789::MemoryDataAccessControl() { WriteCommand(static_cast<uint8_t>(Commands::MemoryDataAccessControl)); WriteData(0x40); // MY(0) MX(1) MV(0) ML(0) RGB(0) 0 0 0 }

in St7789 header. Uploading the firmware, it shows correct for about 10 seconds before reverting back to the bootloader. More digging for another day.

I'm at a loss how I have a flipped screen, seems like a very strange sku change. Unless they have a bad production run and worked around it?

@StarGate01
Copy link
Owner

Good find! I ordered one of these watches. I will add support for the register config once I can reproduce and debug the issue.

The 10 second reboot is probably triggered by the watchdog, indicating a hard error lockup .

@izzeho
Copy link
Author

izzeho commented Jun 24, 2022

Built from clean 1.9.0.2 source and it is now working and (seemingly) stable. I'm surprised how precise and responsive the touchscreen is. The stock firmware was nowhere near this reliable (for the 15 minutes I played with it).

Accelerometer works, heart rate works, time and gadgetbridge sync works. The step counter doesn't work.

I'm not really sure the best way to incorporate this. There's no real way to detect screen flip, so compile flag/yet-another-version or a setting in the watch are seemingly the options?

@StarGate01
Copy link
Owner

StarGate01 commented Jun 24, 2022

Great to hear! If you want to create a PR, please make one to https://github.com/StarGate01/InfiniTime/tree/p8b-base , since that is the one that will get upstreamed via InfiniTimeOrg/InfiniTime#1128 (see also: InfiniTimeOrg/InfiniTime#1050). The p8b branch in my InfiniTime fork is a big merge of all these PRs for convenience.

I recommend adding an entry to https://github.com/StarGate01/InfiniTime/blob/p8b-base/src/CMakeLists.txt#L796= , e.g. P8B_FLIP. I will replace that name once I figured out its original MOY name.

Then, you can define a variable: add_definitions(-DDRIVER_DISPLAY_FLIP), and check for that one in your code.

For testing, you can just merge your PR fork back into p8b.

Once I verified your patch, I will make sure your version and also #2 are incorporated into InfiniTimeOrg/InfiniTime#1128 .

@StarGate01
Copy link
Owner

The step counter doesn't work.

Step counting in hardware is not supported by the SC7A20 accelerometer used in the P8b, and no software implementation exists yet.

@StarGate01
Copy link
Owner

StarGate01 commented Jun 25, 2022

I have squashed, rebased and integrated the changes from your fork into the branch p8b-mirror (https://github.com/StarGate01/InfiniTime/tree/p8b-mirror), and created a PR at InfiniTimeOrg/InfiniTime#1200 . It is also linked to InfiniTimeOrg/InfiniTime#1050 .

If you want to make further changes, please rebase and PR to p8b-mirror.

@StarGate01
Copy link
Owner

Please test the new 1.9.0.3 MOY-UNK release: https://github.com/StarGate01/p8b-infinitime/releases/tag/v1.9.0.3 .

@StarGate01 StarGate01 added new-variant New watch variants enhancement New feature or request labels Jun 27, 2022
@izzeho
Copy link
Author

izzeho commented Jun 28, 2022

Have flashed 1.9.0.3 and confirm happily running.

@izzeho izzeho closed this as completed Jun 28, 2022
@StarGate01
Copy link
Owner

The model I received from your AliExpress link appears to be a atock MOY-TON5 P8b, colors are correct, however the SPI Flash might have changed. I will have to debug this in depth (already ripped it open). I suspect the manufacturer mixes and matches parts depending on availability.

In any case, your model will continue to be called MOY-UNK.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request new-variant New watch variants
Projects
None yet
Development

No branches or pull requests

2 participants