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

WIP: Split Render for multiple screen resolutions #1888

Open
wants to merge 36 commits into
base: dev
Choose a base branch
from
Open

Conversation

Ralim
Copy link
Owner

@Ralim Ralim commented Feb 28, 2024

  • Please check if the PR fulfills these requirements
  • [] The changes have been tested locally
  • [] There are no breaking changes
  • What kind of change does this PR introduce?
    To enable future expansion by having multiple screen sizes, this aims to pull all the OLED rendering code out into a folder per screen size.
    This way we can mask in these files only and collect all the drawing logic.

Things to do:

  • Boot screen
  • Audit other drawing code
  • Check no regressions on smaller screens
  • Create drawing functions and screen layouts for larger screens
  • What is the current behavior?
  • What is the new behavior (if this is a feature change)?

  • Other information:

@discip
Copy link
Collaborator

discip commented Feb 29, 2024

Thank you! 😀 👍🏻

Successfully tested on both TS80P & Pinecil-2.

Oh, 🤦🏻 I just realized that I may have ticked that box too soon in the first post, since you're obviously going to change more of the code, right?
I'm sorry if that's true.

@Ralim
Copy link
Owner Author

Ralim commented Feb 29, 2024

Its all good on the tick.
Boot logo is the only problem I know of, as the current encoding for animated ones doesnt work on 128x32. (as the addressing for pixels only allows for 256 positions (where as this screen needs 512)).

@Ralim
Copy link
Owner Author

Ralim commented Mar 22, 2024

Alrighty all the templating is done (I think).
So; now we need to find every screen that needs to be updated and fix them all 😓
Which.. is basically all of them 😅

@Ralim
Copy link
Owner Author

Ralim commented Apr 3, 2024

I think the OLED driver is good to go now.
I'm happy for testing and a list of things that should be fixed.

Things I'm not sure how to handle:

  1. Settings menu entry names (do we just draw them with the larger font and try and make it all line up)
  2. Bootup logo, do we centre draw the existing ones, or new format for larger images? (will get far fewer animation frames due to larger image unless we increase size allocated to bootup logos)

@discip
Copy link
Collaborator

discip commented Apr 3, 2024

I'm happy for testing and a list of things that should be fixed.

Will do later (when back home again). 😊

@discip
Copy link
Collaborator

discip commented Apr 8, 2024

@Ralim
After a test on the S60P I noticed, that:

  1. The icons for the idle-screen and the main menu animations work as intended. 👍

  2. Settings menu entry names (do we just draw them with the larger font and try and make it all line up)

    Most likely this is related, since the unavailable icon and the other 2 icons for the bootlogo timing are not displayed correctly, scrambled & only partially.

  3. the scrollbar is only visible in the upper half of the screen.

  4. The horizontal sliding animation is sometimes torn in that the top and bottom halves slide out of sync.



Not related to the GUI changes (Nonetheless, needs to be fixed in order to be able test these too.)

  1. The Power settings-menu is still missing.
  2. The auto screen orientation does not work.



Settings menu entry names (do we just draw them with the larger font and try and make it all line up)

I assume this should be enough for now.

Bootup logo, do we centre draw the existing ones, or new format for larger images? (will get far fewer animation frames due to larger image unless we increase size allocated to bootup logos)

Yes, please center the logo for now, to preserve the current frame count.

btw:
Should I close #1819, since you already implemented it into this PR?

}

void BootLogo::showOldFormat(const uint8_t *ptrLogoArea) {
#ifdef OLED_128x32
// Draw in middle
OLED::drawAreaSwapped(16, 8, 96, 16, (uint8_t *)(ptrLogoArea + 4));
Copy link
Collaborator

@discip discip Apr 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just from a parametric perspective:
Could we use something like this here (instead of static values):
https://github.com/Ralim/IronOS-dfu/blob/7ab0a57c49e1913b87b49ae458e641aa48adea87/src/oled.c#L168

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the moment the whole bootlogo stuff is setup only for that sizing. Which is sort of why I left it like that. 🤔

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious? 😊

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very valid question.
Still on the fence for what to do about the boot logo stuff.
Since limited frames could be messy, but also nice to do static full screen at the least.
But having half-half also feels messy.

So maybe I just carve out a little more logo space on these devices to have at least some frames of boot logo?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inclined to leave it as-is for the super short term as there are probably bigger issues to solve 🙃

@discip
Copy link
Collaborator

discip commented Apr 10, 2024

btw:
Unfortunately I was not able to revive my TS80P to test a certain behavior I'm not sure how it worked on the TS80P.

  1. issue
    On the S60P, if in detailed idle screen the unit is on top of the value if the tip is disconnected.

  2. Regarding the TS80P:
    I'm able to get into the DFU mode but not able to flash anything as it states something like: not writeable (unfortunately not near my PC and iron).
    And when trying to flash via ST-Link id does not work either.

Will provide screenshots later. 😊

@Ralim
Copy link
Owner Author

Ralim commented Apr 10, 2024

I'm able to get into the DFU mode but not able to flash anything as it states something like: not writeable (unfortunately not near my PC and iron).

Ah that will be because I fixed it so you can try and write out-of-bounds.

Can you dump the logs over on the that thread and ill try and make you a recovery method

@discip
Copy link
Collaborator

discip commented Apr 10, 2024

Can you dump the logs over on the that thread and ill try and make you a recovery method

Will do. 😃👍

@discip
Copy link
Collaborator

discip commented Apr 10, 2024

@Ralim

Can you dump the logs over on the that thread and ill try and make you a recovery method

I hope this is what you asked for:

dfu-util -D TS80P_EN.dfu                                                      
dfu-util 0.11

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2021 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/

Match vendor ID from file: 1209
Match product ID from file: db42
Multiple alternate interfaces for DfuSe file
Opening DFU capable USB device...
Device ID 28e9:0189
Device DFU version 011a
Claiming USB DFU Interface...
Setting Alternate Interface #0 ...
Determining device status...
DFU state(2) = dfuIDLE, status(0) = No error condition is present
DFU mode device DFU version 011a
Device returned transfer size 1024
DfuSe interface name: "Internal Flash "
File contains 1 DFU images
Parsing DFU image 1
Target name: ST...
Image for alternate setting 0, (1 elements, total size = 41012)
Setting Alternate Interface #0 ...
Parsing element 1, address = 0x08004000, size = 41004
Erase   	[                         ]   0%            0 bytesdfu-util: Page at 0x08004000 is not writeable

@discip
Copy link
Collaborator

discip commented Apr 10, 2024

Is this on the S60/S60P? Its missing at the moment as there is nothing to show in it (not settings are applicable yet)

But could we then set PD timeout to 0 for now, as there is no other way to set this?

@Ralim
Copy link
Owner Author

Ralim commented Apr 11, 2024

PD Timeout isnt supported by S60P or used anywhere in the code really. :/ what should this do in your book?

@discip
Copy link
Collaborator

discip commented Apr 11, 2024

It delays the CJC calibration.
At least I think that it is caused by PD timeout. Don't know what else could cause this. 🤷‍♂️

@Ralim
Copy link
Owner Author

Ralim commented Apr 11, 2024

Ahh, hmmm, it shouldn't affect CJC 🙃

For the TS80 bootloader, I had a crazy idea that may work (and be low effort). Can you try and flash the S60P runtime in the bootloader (screen will look wonky, but usb might work). Then if the runtime works, use that to flash the TS80(P) version and try that. If it doesnt work LMK and ill try and make a custom built to do this

@discip
Copy link
Collaborator

discip commented Apr 11, 2024

Can you try and flash the S60P runtime in the bootloader

Nice approach, will definitely try.
But than it should be the old runtime, that one prior to the change that made the S60P work, the one from the build that bricked the TS80P, right?

@Ralim
Copy link
Owner Author

Ralim commented Apr 11, 2024

Naah I meant the new working one.

What we did by accident (sorry again) is flashed a main bootloader that wants the code at the wrong offset. the new S60 code is at that wrong offset so should take. Once you have a working runtime on there, that should let you flash the main bootloader to the right one

@discip
Copy link
Collaborator

discip commented Apr 11, 2024

@Ralim
Flashing the runtime.dfu worked as expected, but unfortunately in DFU RUNTIME flashing the bootloader.dfu didn't work:

dfu-util -D bootloader.dfu
dfu-util 0.11

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2021 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/

Match vendor ID from file: 0483
Match product ID from file: df11
dfu-util: No DFU capable USB device available

@Ralim
Copy link
Owner Author

Ralim commented Apr 12, 2024

Dang, can you try and flash the runtime from this, then flash the correct normal bootloader if this runtime works?
TS80P.zip

@discip
Copy link
Collaborator

discip commented Apr 12, 2024

can you try and flash the runtime from this

Unfortunately that didn't work.

@discip
Copy link
Collaborator

discip commented Apr 19, 2024

@Ralim
Not sure how to approach this, but have you had by any chance time to think about a viable solution to revive my TS80P? 😊

thanks in advance

@Ralim
Copy link
Owner Author

Ralim commented Apr 19, 2024

Best answer is SWD over the usb-c port.

I'm just not sure in which way it's wrong and not starting

@discip
Copy link
Collaborator

discip commented Apr 20, 2024

Best answer is SWD over the usb-c port.

No clue what that might mean. 😓

What am I supposed to do?

@discip
Copy link
Collaborator

discip commented Apr 26, 2024

@Ralim
Please help I'm not able to get the TS80P back to life.

@Ralim
Copy link
Owner Author

Ralim commented Apr 26, 2024

Best answer is to reflash using the SWD (via stlink) over the USB port.

I'm not sure what address is out of whack so a flash via the external connection would be the easiest.

Try to power the stlink before connecting to the device if it's being flaky?

@discip
Copy link
Collaborator

discip commented May 7, 2024

@Ralim
I don't know what I'm doing wrong here, but if I use the ST-link, no uploads are possible despite the device being connected, no matter which setting I use. Also did power up ST-link first.

Tried on both Windows & Linux no luck what so ever. 😟

That's what I'm seeing if connected using Linux:

image

After trying to flash the original bootloader:

image

@Ralim
Copy link
Owner Author

Ralim commented May 14, 2024

Ohhh, does your device have an off-brand of the ST chip in it (if you recall)? Wonder if the tool is spitting the dummy on that?

Could you try the cli sudo st-flash write <file_to_flash>.bin 0x08000000 and see what errors that dumps? Looks like it can read coreID so likely hardware is ok?

@Ralim
Copy link
Owner Author

Ralim commented May 14, 2024

Also apologies for delay :(

@discip
Copy link
Collaborator

discip commented May 14, 2024

@Ralim

Ohhh, does your device have an off-brand of the ST chip in it (if you recall)? Wonder if the tool is spitting the dummy on that?

Genuine STM32.
Remember: #630 (comment)

Could you try the cli sudo st-flash write <file_to_flash>.bin 0x08000000

st-flash 1.8.0
Failed to enter SWD mode
Failed to connect to target
Failed to parse flash type or unrecognized flash type

And that what I get when I do what you suggested:

Try to power the stlink before connecting to the device if it's being flaky?

st-flash 1.8.0
2024-05-14T21:24:39 WARN usb.c: Couldn't find any ST-Link devices

Also apologies for delay :(

No worries! 😊

@Ralim
Copy link
Owner Author

Ralim commented May 22, 2024

Hmm okay, so that definitely looks like the st-link isn't showing up to the pc at all. Likely this is not replaced the TS80 at all but rather is specific to the st-link. Does it show up in device manager / lsusb at all?

@discip
Copy link
Collaborator

discip commented May 25, 2024

@Ralim
Sorry Ben, somehow I forgot to answer in time.

This only shows up in DFU mode as:

Bus 003 Device 012: ID 28e9:0189 GDMicroelectronics GD32 DFU Bootloader (Longan Nano)

And via ST-Link as:

Bus 003 Device 013: ID 0483:3748 STMicroelectronics ST-LINK/V2

@Ralim
Copy link
Owner Author

Ralim commented May 26, 2024

😓 Dang. Well that makes it harder to debug as both look to work in isolation.

Just to confirm, when in the bootloader on the device, can you flash this runtime?
(try as a .dfu first, if that doesnt work see if you can get it to take the .bin or .hex)

runtime.zip

If that doesnt work send me an email and i'll try and figure out a different option.

@discip
Copy link
Collaborator

discip commented May 26, 2024

@Ralim
Here is the output of the .dfu:

dfu-util 0.11

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2021 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/

Match vendor ID from file: 0483
Match product ID from file: df11
Multiple alternate interfaces for DfuSe file
Opening DFU capable USB device...
Device ID 28e9:0189
Device DFU version 011a
Claiming USB DFU Interface...
Setting Alternate Interface #0 ...
Determining device status...
DFU state(2) = dfuIDLE, status(0) = No error condition is present
DFU mode device DFU version 011a
Device returned transfer size 1024
DfuSe interface name: "Internal Flash "
File contains 1 DFU images
Parsing DFU image 1
Target name: ST...
Image for alternate setting 0, (1 elements, total size = 4916)
Setting Alternate Interface #0 ...
Parsing element 1, address = 0x08004000, size = 4908
Erase   	[                         ]   0%            0 bytesdfu-util: Page at 0x08004000 is not writeable

That is what it gives me when flashing not in dfu but in runtime:

dfu-util 0.11

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2021 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/

Match vendor ID from file: 0483
Match product ID from file: df11
dfu-util: No DFU capable USB device available

.bin & .hex resulted in:

dfu-util 0.11

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2021 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/

dfu-util: Warning: Invalid DFU suffix signature
dfu-util: A valid DFU suffix will be required in a future dfu-util release
Opening DFU capable USB device...
Device ID 28e9:0189
Device DFU version 011a
Claiming USB DFU Interface...
Setting Alternate Interface #0 ...
Determining device status...
DFU state(2) = dfuIDLE, status(0) = No error condition is present
DFU mode device DFU version 011a
Device returned transfer size 1024
DfuSe interface name: "Internal Flash "
dfu-util: Only DfuSe file version 1.1a is supported
dfu-util: (for raw binary download, use the --dfuse-address option)

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

Successfully merging this pull request may close these issues.

None yet

2 participants