Chaostreff-Potsdam / erika3004

18 stars 5 forks source link

Faster printing by printing from right to left, when at the end of a line #50

Open sirexeclp opened 4 years ago

sirexeclp commented 4 years ago

The Olivetti 900X in this video prints in both directions: https://www.youtube.com/watch?v=SpOyk6n5WTw Obviously this needs to be done in software, but if more than one line are to be printed and are buffered somewhere or passed to the print function, it could do just a new line , no carriage return and print the next line in reverse.

8DH Rückwärtsdruck OFF Rückwärtsdruck aus (*); Vorwärtsdruck (Zeichendruck, dann Vorschub)
8EH Rückwärtsdruck ON Rückwärtsdruck ein (*); Rückwärtsdruck (erst Vorschub rückwärts, dann Zeichendruck)
ArchibaldBienetre commented 4 years ago

Out of scope? optimizing ASCII art rendering

ArchibaldBienetre commented 4 years ago

53 is merged, but def _fast_print(self, text) is not a fully-fledged part of the API, yet.

I'll add some tests, rename the method (remove leading "_"), and propose a pull request here, soon.

Also, I'll try to fix the current bug that for odd-numbered line input, fast_print will ignore the last line, because of the way the lines are zipped into pairs:

>>> lines = ["line1", "line2", "line3", "line4", "line5"]
>>> line_pairs=zip(lines[::2], lines[1::2])
>>> for pair in line_pairs: 
...     print(f"pair: ({pair[0]}, {pair[1]})")
... 
pair: (line1, line2)
pair: (line3, line4)
>>>