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

[2.0.x] Light-weight status screen for ST7920 based printers #9637

Merged

Conversation

marcio-ao
Copy link
Contributor

Added an alternative light-weight status screen for the ST7920 as originally discussed in #9190

  • The status screen uses the ST7920 character generator to greatly
    reduce SPI traffic and MCU load when updating the status screen.

  • The status screen by-passes u8g and writes commands directly
    to the controller. All other menus will continue to use the u8g library.

  • Has been tested with the RepRapDiscount Full Graphics Smart Controller
    but should work with any 128x64 LCD that uses an ST7920 or fully compatible
    controller.

st7920

- The status screen uses the ST7920 character generator to greatly
  reduce SPI traffic and MCU load when updating the status screen.

- Has been tested with the RepRapDiscount Full Graphics Smart Controller
  but should work with any LCD that uses an ST7920 or fully compatible
  controller.
- avr-gcc is more strict than the Arduino IDE, it seems.
@thinkyhead thinkyhead changed the title Light-weight status screen for ST7920 based printers [2.0.x] Light-weight status screen for ST7920 based printers Feb 16, 2018
@thinkyhead
Copy link
Member

thinkyhead commented Feb 16, 2018

Is this compatible with any other ST7920 displays aside from the RRD FGSC?
Perhaps even all ST7920-based displays??

  • REPRAPWORLD_GRAPHICAL_LCD
  • REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER
  • LCD_FOR_MELZI
  • SILVER_GATE_GLCD_CONTROLLER
  • CR10_STOCKDISPLAY

@thinkyhead thinkyhead force-pushed the pr-lite-st7920-status branch 4 times, most recently from 263b742 to 3e2f86a Compare February 16, 2018 08:00
@marcio-ao
Copy link
Contributor Author

marcio-ao commented Feb 16, 2018

@thinkyhead : It should be compatible with all displays that have a ST7920 or a 100% compatible chip and provided the memory map is identical (which I assume will be for all 128x64 displays). I wasn't exactly sure which these were so I only listed the RRD FGSC, but if you know these other displays use the ST7920 then in all likelihood they would work too.

Some of the displays out there, such as the MKS 12864 OLED, are 128x64 but they seem to use a chip that only has a graphics buffer. These would not be compatible and would need to continue to use the U8G-based code.

@marcio-ao
Copy link
Contributor Author

Incidentally, one could possibly write a software character generator that emulates the ST7920 for displays that don't have one. This would negate some of the savings in SPI traffic, but it would probably run much faster than the U8G code since the characters glyphs would be byte-aligned. If there is a strong interest in this, I could look into writing such a compatibility layer to allow the light-weight status screen to work on all 128x64 displays, even the bitmap based ones. Maybe we see how popular this new interface becomes first, as it would be a fairly complex undertaking.

@ejtagle
Copy link
Contributor

ejtagle commented Feb 16, 2018

Just a point to note: The ST7920 is the slowest controller. All the others are, at least 2x faster, and OLED based ones are probably 20x faster. I am referring to the acievable SPI transfer speed. So, i guess this PR is mostly expremely valuable for the ST7920...

@marcio-ao
Copy link
Contributor Author

@ejtagle : That's perfect then. I started this work mostly because I wanted to learn more about the ST7920, not because I was trying to solve any particular problem; but it's nice to know I solved a problem by accident :)

@thinkyhead
Copy link
Member

I've enable this feature for the displays I listed above. If one of them happens not to work we're sure to find out eventually.

Please test this PR with the changes I've made. If everything functions properly then this can be merged anytime.

@thinkyhead
Copy link
Member

thinkyhead commented Feb 17, 2018

I started this work mostly because I wanted to learn more about the ST7920

And now you've taught us all a thing or two.

One of the things I like about Marlin as a project is that it collects together so much knowledge about the boards and peripherals we all use. It's one of the reasons I prefer to preserve support for older boards and obscure machines.

That said, we still might retire the Makibox configuration for 2.1.

@thinkyhead thinkyhead force-pushed the pr-lite-st7920-status branch 4 times, most recently from c5a74de to 6eb8585 Compare February 17, 2018 23:48
- The status screen uses the ST7920 character generator to greatly
  reduce SPI traffic and MCU load when updating the status screen.

- Has been tested with the RepRapDiscount Full Graphics Smart Controller
  but should work with any LCD that uses an ST7920 or fully compatible
  controller.
@thinkyhead thinkyhead force-pushed the pr-lite-st7920-status branch 3 times, most recently from 3e5ef53 to ab39dec Compare February 18, 2018 08:33
@thinkyhead
Copy link
Member

thinkyhead commented Feb 18, 2018

  • Shorter option names LIGHTWEIGHT_UI, STATUS_EXPIRE_SECONDS.
  • Moved options to Configuration_adv.h.
  • Shorter filenames that start with status_screen.
  • The standard status screen gets its own file too.
  • Added a Travis test for the new option.
  • Tweaks to spacing, code style.

@thinkyhead
Copy link
Member

Thinking about smarter status messages…. Some (e.g., "Heating Done") may be fine to expire after a period of time (as they can do with an LCD_PROGRESS_BAR sub-option). Important messages should stick around until they're seen. One thing we don't have is messages that stick around only until you click the button. That would give the best of both. Since a message could accidentally get dismissed right after it appeared, a click should not clear it until it's been up for 30 seconds.

- Also deleted old implementation files which had been renamed.
@marcio-ao
Copy link
Contributor Author

@cjsoong : I pushed a fix. Thank you for spotting that.

Did you also change the bed icon? I notice it has corners in your screenshot :)

- This will slightly reduce the SPI requirements for
  updating the progress bar.
- This makes it look less like a dash (idea stolen from cjsoong).
@thinkyhead
Copy link
Member

Rebasing and squashing… Be sure to get a fresh copy before adding on.

@thinkyhead thinkyhead force-pushed the pr-lite-st7920-status branch 2 times, most recently from 860dc6c to a8f6a3e Compare February 22, 2018 05:56
marcio-ao and others added 2 commits February 22, 2018 00:10
- This status screen uses the ST7920 character generator to greatly
  reduce SPI traffic and MCU load when updating the status screen.

- Has been tested with the RepRapDiscount Full Graphics Smart Controller
  but should work with any LCD that uses an ST7920 or fully compatible
  controller.
@cjsoong
Copy link

cjsoong commented Feb 22, 2018

@marcio-ao
bed icon A little change, this will not look like a minus sign

@thinkyhead
Copy link
Member

thinkyhead commented Feb 22, 2018

I've been playing with graphics lately. Some bed icon concepts:
image

Four- and three-frame fan animations:
image

image

@marcio-ao
Copy link
Contributor Author

@cjsoong : I made a commit with your modified bed icon. It does help make it look less like a plus sign. Thank you! One thing that's nice is that in the "lightweight" UI, the bed icon is underneath the nozzle, so it's a bit more visually unambiguous than it is in the standard UI screen, where they are side-by-side.

@marcio-ao
Copy link
Contributor Author

@thinkyhead : I like the fan icons with more frames, but unfortunately for maximum efficiency on the ST7920, I only have four custom characters to work with, and right now they are split between the fan and the heated bed, so just two frames a piece. A perspective bed icon might look decent on the lightweight UI, but there are fewer pixels to work with, so I'm not sure how good it'll look until I try scaling it down. I'll try it out.

@marcio-ao
Copy link
Contributor Author

marcio-ao commented Feb 22, 2018

Nope. Doesn't look good at all, not enough pixels. I think @cjsoong has the best icon so far for the lightweight GUI.

parallelogram1
parallelogram2

@thinkyhead
Copy link
Member

thinkyhead commented Feb 23, 2018

Actually, with the nozzle over the parallelogram, you can totally grok in-context that it's the bed.

@thinkyhead
Copy link
Member

thinkyhead commented Feb 23, 2018

I only have four custom characters to work with, and right now they are split between the fan and the heated bed, so just two frames a piece.

What happens if you use 1 character, but you redefine its bitmap between screen renderings? If that can be done then it would allow for any number of frames. Is that allowed during operation, or does it have to be part of the initialization?

@thinkyhead thinkyhead merged commit 3851ffc into MarlinFirmware:bugfix-2.0.x Feb 23, 2018
@AnHardt
Copy link
Member

AnHardt commented Feb 23, 2018

What happens if you use 1 character, but you redefine its bitmap between screen renderings?

Than you have to transfer 16 bytes per phase instead ot 1. The same amount as when drawing the icon in graphic-mode.

Running in circles.

For my taste the vertical lines in the FR-icon could be a bit fatter to match the on chip font. It looks a bit 'skinny'.

@thinkyhead
Copy link
Member

thinkyhead commented Feb 23, 2018

Then you have to transfer 16 bytes per phase…

I see. Of course, it could be done at any point in the lengthy 1s downtime between screen updates.

For my taste the vertical lines in the FR-icon could be a bit fatter to match the on chip font. It looks a bit 'skinny'.

Not a big Jony Ive fan? Me neither. And I agree, it would look better with a little weight.

@marcio-ao
Copy link
Contributor Author

@thinkyhead, @AnHardt : It's fairly easy to change the icons. I think at one point I had a fatter FR icon, but I wasn't satisfied with how it looked, so I gave up on making one. Can't say I am a fan of the parallelogram for the bed, but again, simple to change if that is desired.

Thank you for merging this in! :)

@thinkyhead
Copy link
Member

In future we'll have more configurable display options. I like the flat bed icon well enough that I don't feel the need to go all 3D. (I'd need to design a 3D nozzle first!)

@marcio-ao marcio-ao deleted the pr-lite-st7920-status branch May 8, 2018 15:13
@CdRsKuLL
Copy link

Hi, I was wondering if you had any idea why my screen is doing the following...

https://www.youtube.com/watch?v=yh-PQ7BpZl8

It was fine in 1.1.8 but now I've moved everything over to 1.1.9 the screen isn't right. However, if I enable Light-weight option, it displays the main info screen correctly but not the menus.

Any ideas?

Thanks,

@thinkyhead
Copy link
Member

@CdRsKuLL — See #3815 (comment)

@marcio-ao
Copy link
Contributor Author

marcio-ao commented Sep 17, 2018

The Klipper FW is using a port of the lighweight UI. There are some cool new icon concepts being discussed there:

Klipper3d/klipper#652 (comment)

@thinkyhead
Copy link
Member

Interesting! Checking it out…

@@ -656,6 +656,22 @@
// Swap the CW/CCW indicators in the graphics overlay
//#define OVERLAY_GFX_REVERSE

#if ENABLED(U8GLIB_ST7920)
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it make more sense to put the check for a U8GLIB_ST7920-based display into the LIGHTWEIGHT_UI code, then put a "LIGHTWEIGHT_UI requires a U8GLIB_ST7920 based graphical display." into SanityCheck.h ?

How will users know they have a U8GLIB_ST7920-based display without digging deeper beyond both Configuration*.h and the board pin*.h files ?

(I mention this because I ran into this confusion by setting LIGHTWEIGHT_UI on what I thought was a U8GLIB_ST7920 based LCD and not seeing any change, but turns out it was an U8GLIB_SSD1306 LCD).

Copy link
Member

Choose a reason for hiding this comment

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

The configurator uses these #if wrappers to decide whether to present the option. But we should also add a sanity check.

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

Successfully merging this pull request may close these issues.

7 participants