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

Removing multiple positioned text items and writing all new ones #129

Closed
eat-sleep-code opened this issue Jun 16, 2017 · 17 comments
Closed

Comments

@eat-sleep-code
Copy link
Contributor

eat-sleep-code commented Jun 16, 2017

I have a program that alternates between three screens.

Each of these screens has multiple items that are positioned at various places on the screen.

How do I smoothly clear the screen, and then write the next one.

I tried display.Clear() and then (after a bunch of display.AddTexts) a display.WriteAll() but this causes the screen to blink twice between each screen.

I tried a bunch of display.RemoveText('ID') and then (after a bunch of display.AddTexts) a display.WriteAll() but this leaves large chunks of unwritten screen.

So, what is the cleanest and quickest way to accomplish a Write of all new positioned text?

@shawaj
Copy link
Member

shawaj commented Jun 16, 2017

The only way to properly clear the screen is with it blinking twice as you say.

You could try and write the inverse colour of the original to the same space but I think that might cause some ghosting and wouldn't give a truly clear screen.

@eat-sleep-code
Copy link
Contributor Author

Do you think the library could be improved, to possibly allow it to clear and replace the screen contents in one action?

I am just thinking on my Kindle, there isn't a big double flash like that when I switch pages.

@shawaj
Copy link
Member

shawaj commented Jun 16, 2017

It's a hardware limitation not a software limitation so I don't think there is anything we can do.

Unless @repaper or @tvoverbeek or @francesco-vannini have any ideas?

@eat-sleep-code
Copy link
Contributor Author

I notice that this code in textpos.py seems to write a new image and then clear the display?

        # Clear the image, clear the text items, do a full update to the screen
        self.image = Image.new('1', self.papirus.size, WHITE)
        self.allText = dict()
        self.papirus.clear()

Shouldn't just one of these be necessary?

@shawaj
Copy link
Member

shawaj commented Jun 24, 2017

@eat-sleep-code are you seeing a specific error with part of this code?

@eat-sleep-code
Copy link
Contributor Author

eat-sleep-code commented Jun 27, 2017

No error, just trying to track down why there are multiple flashes between each update. If I look at how my Kindle Paperwhite (understand that the hardware is different, but both are e-ink so should operate roughly the same) there is a single flash between updates, not multiple.

In the above code -- from my understanding -- a white image is being written to the screen (that write would cause one "flash" as that image is written) and then the core EPD clear is being called (that clear would cause a second "flash" as the screen is being cleared).

@shawaj
Copy link
Member

shawaj commented Jun 27, 2017

What coffee are you running that is causing the behaviour you are seeing?

Need to be able to replicate it.

@shawaj
Copy link
Member

shawaj commented Jun 27, 2017

*code

@eat-sleep-code
Copy link
Contributor Author

Well it is a dark roast. ;-)

I will post the code into a repo tonight.

@shawaj
Copy link
Member

shawaj commented Jun 27, 2017

Thanks very much that'll be great

@eat-sleep-code
Copy link
Contributor Author

Here you go: https://github.com/eat-sleep-code/baseball-pi

Note: To see this in action, find a team that currently has a game in progress: https://www.mlb.com/

@shawaj
Copy link
Member

shawaj commented Jun 29, 2017

@eat-sleep-code and which line in there is the issue?

@eat-sleep-code
Copy link
Contributor Author

eat-sleep-code commented Jun 29, 2017

In baseball-pi/baseball/functions.py -- which I just cleaned up a bit...

Look at the displayBoxScore (line 135), displayPitch (line 161), or displayPlay (line 176).

You will see I perform a display.Clear() near the beginning and a display.WriteAll() at the end of each of these.

When a game for the selected team is in session, displayInGame (line 210) cycles through these methods every "5 seconds".

In between each screen being displayed the screen flashes multiple times before the content is written. I would think you should just see one flash of it being cleared, and then the content should be written.

@tvoverbeek
Copy link
Contributor

tvoverbeek commented Jul 1, 2017 via email

@eat-sleep-code
Copy link
Contributor Author

When I tried this I get the following error:

TypeError: WriteAll() got an unexpected keyword argument 'partial_update'

@tvoverbeek
Copy link
Contributor

tvoverbeek commented Jul 2, 2017 via email

@eat-sleep-code
Copy link
Contributor Author

Actually, I discovered I had a slightly older version of the library. partial_update=True works with the most recent version. Now, if issue #130 was fixed, my app would be working pretty much perfectly.

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

No branches or pull requests

3 participants