joukos / PaperTTY

PaperTTY - Python module to render a TTY or VNC on e-ink
941 stars 101 forks source link

EPD2in13v4 and moving in line with waveshare reccommendations #126

Open BOTButtcheeks opened 7 months ago

BOTButtcheeks commented 7 months ago

Hi,

Excellent work on originally maintaining this large and pivotal project I have been staring at the driver code and the code in general for half the day motivated by needing to make this work.

Unfortunately it appears, as waveshare has started embedding the waveforms in the ic, the driver code for EPD2in13V3 and EPD2in13V4 has significantly changed typical structure from what I can see. I might be wrong but EPD2in13V4's waveshare driver is very different from V1 and V2 and might need extra work in either writing new drivers, or even creating a wrapper for waveshare's driver

(I'll also ruin the tunnel vision of the people reading this that there is an open issue about display safety, sleep and full refresh intervals that really needs attending to)

I know the original maintainer is busy, and this isn't a request for them to look specifically but more for new maintainers. If you are reading this and are proficient at python I encourage you to assist in this project. It really is a gamechanger in terms of FOSS systems.

(Unfortunately while I can read the code to a degree after hours of determination, I do not think I have the time to suddenly become proficient at programmer mindset and do the work. Maybe one day.)

MykeHalk commented 6 months ago

Try Tomfullylove's fork https://github.com/tomfullylove/papertty

mcarr823 commented 6 months ago

I've just submitted a PR for the EPD2in13V4: https://github.com/joukos/PaperTTY/pull/127

It hasn't been merged, but in the meantime you could try running that branch yourself: https://github.com/mcarr823/PaperTTY/tree/epd2in13v4

MykeHalk commented 6 months ago

@mcarr823 Finally, thank you.

hunter-meloche commented 4 months ago

@mcarr823 I'm trying to run your branch, but I'm getting an error. Should I be using a Python version older than 3.9? Any help would be appreciated.

poetry run papertty --driver EPD2in13v4 terminal

gpiozero found - using that instead of RPi.GPIO
Loading PIL font /home/user/PaperTTY/papertty/resources/tom-thumb.pil. Font size is ignored.
Started displaying /dev/vcsa1, minimum update interval 0.1 s, exit with Ctrl-C
Font /home/user/PaperTTY/papertty/resources/tom-thumb.pbm doesn't support Unicode. Falling back to 8-bit encoding.
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/root/.cache/pypoetry/virtualenvs/papertty-ah46anYm-py3.9/lib/python3.9/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/root/.cache/pypoetry/virtualenvs/papertty-ah46anYm-py3.9/lib/python3.9/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/root/.cache/pypoetry/virtualenvs/papertty-ah46anYm-py3.9/lib/python3.9/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/root/.cache/pypoetry/virtualenvs/papertty-ah46anYm-py3.9/lib/python3.9/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/root/.cache/pypoetry/virtualenvs/papertty-ah46anYm-py3.9/lib/python3.9/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/root/.cache/pypoetry/virtualenvs/papertty-ah46anYm-py3.9/lib/python3.9/site-packages/click/decorators.py", line 33, in new_func
    return f(get_current_context().obj, *args, **kwargs)
  File "/home/user/PaperTTY/papertty/papertty.py", line 1495, in terminal
    oldimage = ptty.showtext(buff, fill=ptty.black, cursor=cursor if not nocursor else None,
  File "/home/user/PaperTTY/papertty/papertty.py", line 413, in showtext
    return self.partialdraw_showtext(text=text, fill=fill, cursor=cursor, portrait=portrait, flipx=flipx, flipy=flipy, oldimage=oldimage, oldtext=oldtext, oldcursor=oldcursor)
  File "/home/user/PaperTTY/papertty/papertty.py", line 494, in partialdraw_showtext
    changedLines = self.partialdraw_get_changed_lines(cursor, oldcursor, oldlines, newlines)
  File "/home/user/PaperTTY/papertty/papertty.py", line 602, in partialdraw_get_changed_lines
    for i in range(self.rows):
TypeError: 'NoneType' object cannot be interpreted as an integer
hunter-meloche commented 3 months ago

Ah I figured it out. I think I just needed --autofit at the end of my command.

sudo poetry run papertty --driver EPD2in13v4 terminal --autofit
mcarr823 commented 3 months ago

@hunter-meloche Sorry for the delayed response. Yeah, you either need to supply --autofit or --rows and --cols so that PaperTTY knows how big to make the terminal area.