nodemcu-max7219 icon indicating copy to clipboard operation
nodemcu-max7219 copied to clipboard

Add scrolling support

Open marcelstoer opened this issue 8 years ago • 5 comments

marcelstoer avatar Jun 25 '16 20:06 marcelstoer

Id love this feature

phyrexia avatar Aug 26 '16 01:08 phyrexia

An idea (no code yet):

  • have a dynamic buffer of bytes storing the individual LED states => already exists, columns (check)
  • initially set buffer size to number of columns (check), expand/shrink on text write() or clear() (TBD)
  • bit (pixel/segment) operations don't change the buffer size
  • a module function to set scrolling mode (SCROLL_LEFT, SCROLL_RIGHT, perhaps SCROLL_BOUNCE; SCROLL_NONE as default) and speed
  • an asynchronous process (timer, there should be a spare one) refreshes the display, according to buffer size and scroll settings

IOW, completely decouple (public) display i/o operations and (private) display refresh. (Sounds familiar? :-))

Of course, there are heap limits lurking everywhere.

steve8x8 avatar Jul 12 '17 08:07 steve8x8

There's a bunch of commits in my fork (https://github.com/steve8x8/nodemcu-max7219), covering this issue among others (see #4). Too early for a formal merge request though.

Caveat: This makes use of the bit library, to simplify rotate and invert operations (instead of "rotate" and "invert", just have a single "rotate by n*90 deg", #10?), and to prepare for single-bit ops (issues #1 and #11) to be added to the module (to make it more similar to its Arduino counterpart at https://github.com/wayoda/LedControl).

Too bad that there's no way to keep constants off the heap (this makes #2 difficult; each font entry consumes 10 or 20 bytes). Although I'm running a rather small integer ROM, I'm running out of memory quite often - and my use case is just a simple NTP clock, nothing really serious... Time to switch to µPython or even Arduino?

steve8x8 avatar Jul 14 '17 10:07 steve8x8

Thanks for driving this into the right direction.

This makes use of the bit library

I can live with that.

just have a single "rotate by n*90 deg"

Sure, why not. I guess the increased processing time isn't noticeable, is it?

similar to its Arduino counterpart at https://github.com/wayoda/LedControl

My initial inspiration was https://github.com/squix78/MAX7219LedMatrix

Time to switch to µPython or even Arduino?

I'm a committer with the NodeMCU project so I won't be recommending either of course.

marcelstoer avatar Jul 14 '17 11:07 marcelstoer

PR https://github.com/marcelstoer/nodemcu-max7219/pull/6 fixes #3

ghost avatar Apr 18 '18 11:04 ghost