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

[FR] [ST7920_Simulator.c] Add a character generator in order to use klipper #290

Closed
derBG opened this issue Jan 9, 2020 · 87 comments · Fixed by #1913
Closed

[FR] [ST7920_Simulator.c] Add a character generator in order to use klipper #290

derBG opened this issue Jan 9, 2020 · 87 comments · Fixed by #1913
Labels
enhancement New feature or request

Comments

@derBG
Copy link

derBG commented Jan 9, 2020

Many users of your skr boards use klipper (https://github.com/KevinOConnor/klipper).

Please add a character generator to TFT / src / User / API / UI / ST7920_Simulator.c to make your tft24 screen and similiar usable.

Further information can be found in the Klipper issue at Klipper3d/klipper#2231

Your community will appreciate it very much

Thank you very much

@derBG derBG added the enhancement New feature or request label Jan 9, 2020
@erik23de
Copy link

I'd like to expicitely agree to the post before. Please, add a character generator!

@DeviousPenguin
Copy link

I use Klipper, and an currently unable to use my TFT24 with it.

I looks like the emulation of the reprap display needs a character generator.

If you could add a character generator that would be really nice, as I'd like to use the TFT24 with the printer I am building.

@DeviousPenguin
Copy link

For anyone looking to do this, the ST7920 datasheet is a good resource:

ST7920 provides character generation ROM supporting 8192 16 x 16 character fonts and 126 8 x 16 alphanumeric
characters. It is easy to support multi languages application such as Chinese and English. Two consecutive bytes are used to specify one 16x16 character or two 8x16 half-height characters. Character codes are written into DDRAM and the corresponding fonts are mapped from CGROM or HCGROM to the display drivers.

@bigtreetech bigtreetech pinned this issue Mar 20, 2020
@kakou-fr
Copy link

yes please add it

@tpipits
Copy link

tpipits commented Apr 2, 2020

+1

@AnHardt
Copy link

AnHardt commented Apr 2, 2020

The original font-ROM of the ST7920 is about 130 kByte.
Even for the larger processors of the displays, this is more than 50% of the flash memory.
Better do something more useful with the memory.

@JohnEdwa
Copy link

JohnEdwa commented Apr 2, 2020

The ASCII half-height HCGROM is just 16K-bits, which is 2kB. The rest is for chinese characters, which I would assume are rarely needed with 3D printers.

@bigtreetech
Copy link
Owner

The original font-ROM of the ST7920 is about 130 kByte.
Even for the larger processors of the displays, this is more than 50% of the flash memory.
Better do something more useful with the memory.

BTT's touch screen has an external flash(W25Qxx) storage bitmap fonts, so don't worry about this. This function should be easy to implement, but I'm busy recently, so I don't have time to test this. After a new version is released this week, I will start to implement this function

@combolek
Copy link

I would like to register another request to get this implemented. Thanks!

@mbgroot
Copy link

mbgroot commented Apr 24, 2020

I'm very much looking forward to a solution to this problem. The printer is without screen :(

@kakou-fr
Copy link

no news ?

@dushyantahuja
Copy link

This would be great.

@TakeThisBanana
Copy link

I would also love to see the TFT35 E3 implemented.

@Lyngtoft
Copy link

Lyngtoft commented May 9, 2020

Brilliant, just switched to klipper, would love to use my tft35

@Depman
Copy link

Depman commented May 11, 2020

+1

@bigtreetech
Copy link
Owner

image

image

Debuging... It will be realized soon

@mbgroot
Copy link

mbgroot commented May 14, 2020

the font will depend on the klipper or is it hard to set in the screen firmware?

@JohnEdwa
Copy link

It's set by the screen, this whole thing is because Klipper uses the internal text generator on the display driver for the text, which was missing from this simulator. And as it is a simulator, it needs to include that character rom data as well which means it should be rather easy to swap it for a different font - if one exists or can be easily created, that is.

@eddietheengineer
Copy link

@bigtreetech thank you for working on this, I know a lot of people are excited to have some high quality display options!

@eboblin
Copy link

eboblin commented May 21, 2020

@bigtreetech any updates on this issue?

@TakeThisBanana
Copy link

image

image

Debuging... It will be realized soon

How is the debugging comming along? I am really looking forward to using my tft35 e3 again :D

@JeffMedd
Copy link

I'll add a +1 of interest for this feature also! Thanks for prioritizing the development of this, it will be very much appreciated.

@maketo3D
Copy link

+1 very interested on it.

@RomRider
Copy link

Still a bunch of glitches, but this is great progress!!
IMG_20200525_201843

@RomRider
Copy link

RomRider commented May 27, 2020

@bigtreetech, when the printer starts with the latest master branch version, I have to switch to touchmode and back to marlin mode before something is displayed on the screen else it stays black.
I have SPI_ReEnable(0); set + the other function updated and a TFT35 v3. Also I have a SKR1.3 board.

EDIT: SPI_ReEnable(1); doesn't fix the initial black screen issue.

@tsndr
Copy link

tsndr commented Dec 28, 2020

And I would like to use the BTT screen again, beacuse I'm not ditching Klipper because of a stupid screen. If they don't fix it I'll never buy BTT stuff again!

@bung69
Copy link

bung69 commented Dec 28, 2020

BTT just lost another sale of a TFT35 because this is not fixed

@ETE-Design
Copy link

@bigtreetech Could you pls. look at this feature and make the last work to make it work as intended? Thanks....

@teeminus
Copy link

After digging through the code and the ST7920 datasheet I think I found the solution to make the TFT35 and likely other BTT screens work with klipper. I fixed the issue in my fork and can confirm that it works for the TFT35v3: https://github.com/teeminus/BIGTREETECH-TouchScreenFirmware

I am not sure if I should create a MR for that as I hardcoded SPI mode 1 as suggested somewhere else.

I also created a stripped down version of the firmware that has only the ST7920 emulator left as I don't use the touch functionality at all. Feel free to check it out as well: https://github.com/teeminus/NoTouchScreenFirmware

@ETE-Design
Copy link

@teeminus Great work... Is there support for touch in Klipper? Else the "Stripped" down menu should mabye be an Env to define when compiling, mabye called "Klipper Mode"?

@teeminus
Copy link

@ETE-Design I don't know if klipper has touch support, but I would guess there isn't as "real" ST7920 based screens just have a rotary knob.

Technically one could create klipper build targets for the different screen models. But it seems that the spi mode auto detection is not working correctly, so that needs to be disabled in that mode as well.

@DeviousPenguin
Copy link

DeviousPenguin commented Jan 14, 2021

@teeminus thank you very much for your work on this. I would be more than happy simply having a text only ST7920 firmware, as I only use Klipper now and I personally prefer to have no touchscreen functionality on a 3d printer as I'm clumsy and have sometimes accidentally cancelled long prints in the past!

I only have the TFT24 however, I'll try building it and see how it goes, right now the screen has been gathering dust for almost 1 year so it would be great to use it for something. 👍

@teeminus
Copy link

@DeviousPenguin As not all BTT screens have the required "ST7920_SPI" define set, I updated the readme of the minimalistic firmware so one can easily see if the screen is currently supported. I also uploaded precompiled binaries, which came out as byproducts of the compile test.

@cropduster
Copy link

After digging through the code and the ST7920 datasheet I think I found the solution to make the TFT35 and likely other BTT screens work with klipper. I fixed the issue in my fork and can confirm that it works for the TFT35v3: https://github.com/teeminus/BIGTREETECH-TouchScreenFirmware

I am not sure if I should create a MR for that as I hardcoded SPI mode 1 as suggested somewhere else.

I also created a stripped down version of the firmware that has only the ST7920 emulator left as I don't use the touch functionality at all. Feel free to check it out as well: https://github.com/teeminus/NoTouchScreenFirmware

The touchscreen firmware is gone. Anyone knows where I can find it? I currently use the notouchfirmware.

@teeminus
Copy link

That was just my fork to investigate the issue. I deleted that fork as it turns out the "fix" I found was no real fix for the issue.

@cropduster
Copy link

That was just my fork to investigate the issue. I deleted that fork as it turns out the "fix" I found was no real fix for the issue.

Is there any way to increase the resolution of the notouchscreenfirmware?

@teeminus
Copy link

What do you mean by resolution? The firmware uses the biggest pixel size possible. There is no fullscreen mode because this produces fractional pixel sizes.

@cropduster
Copy link

The TFT35 has a resolution of 480x320, but the emulation utilizes 128x64, so it is quite blocky. Not sure if this can be scaled up somehow or if this is technically impossible.

@teeminus
Copy link

teeminus commented Mar 11, 2021

The firmware uses a pixel size of 3x3 (which is the biggest pixel size if you want square and non fractional pixel dimensions when upscaling) for the TFT35. The image will always be blocky because there is no edge smoothing or something like that.

@bigtreetech bigtreetech mentioned this issue Apr 12, 2021
8 tasks
@DaStivi
Copy link

DaStivi commented Apr 13, 2021

whats the status right now of this?? i'm testing klipper currently, and with BTT Firmware i did have ah "working" screen sometimes, sometimes after i turn the decoder wheel, and sometimes its only displaying rubish... as far as i understand there happens same bit mismatch, does this also happen on the noscreenfirmware ? @teeminus (i gonna test this in a seconds on my B1 TFT35)

@teeminus
Copy link

It depends on your printer mainboard. On some mainboards, the display is not reset when Klipper is restarted which causes the bit shifts. This problem is independent from the TFT firmware.

However, for Klipper there is a "emulated_st7920" display driver which has been developed to fix this problem with the NoTouchFW. This might fix the communication problems for the BTT firmware as well.

@DaStivi
Copy link

DaStivi commented Apr 14, 2021

@teeminus i've tested the notouchFW... looks like it works better with klipper as the current-normal BTT TFT... as i didn't get any character gitter anymore.... BUT i can't touch the wheel.... ah couple of times i had klipper to "shutdown", looks like i fixed this too now... as something odd with PI + picam v2 goes on... i even had this before with marlin and octoprint, but fixed it with wifi firmware downgrade... did now an update with kiauh and looks like i updated the firmware again, but can't revert it back to the old state now... idk... but anyway when webcam is running pi's cpu usage gets high and wifi starts dropping packages... and i think i had some random shutdowns from klipper because of this... so not sure if this was ah coincidence when i pressed the encoder, but for sure i can't get into the menu... also tried so set the klipper config allready to the emulated_st9720

but i'd might try to reflash the btt firmware... because i had the encoder wheel working there...

@teeminus
Copy link

teeminus commented Apr 14, 2021

@DaStivi The encoder wheel and button is handled by Klipper, not by the TFT firmware.

@DaStivi
Copy link

DaStivi commented Apr 15, 2021

Thx for explanation, indeed it worked once yesterday... So sometimes the screen still looks like to freeze, aber had also ah garbeled screen yesterday again.. I'd might install your debug Version... But maybe also try again btt FW with the emulated screen Config again...

@DaStivi
Copy link

DaStivi commented Apr 19, 2021

@teeminus flashed the debug today as i got random freezes of the tft.... started another calibration print, and noticed the new debug ui... allready noticed some lag of the display... but after that it resumed... look at the printer 10min later and just welcomed with following garbage... as you may can see the debug counter still counts as expected i guess...

image

edit, again after 5minutes... some paramters show values again...
image

@teeminus
Copy link

@DaStivi Could you please create a new issue at the NoTouchFW repo? I think it's better to discuss you problem there as it is not related to this firmware.

@Vybramo
Copy link

Vybramo commented May 10, 2021

+1

@oldman4U
Copy link
Contributor

oldman4U commented May 19, 2021

Good news for all Klipper users. User teeminus was able to solve an outstanding issue together with BTT and now a PR is available.

#1913

Happy testing

Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked and limited conversation to collaborators Mar 30, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.