Code Monkey home page Code Monkey logo

erika3004's Introduction

Erika3004 - Minimal Software Branch

Hardware Setup

To configure your pi you can use the following tool (at your own risk):

https://github.com/sirexeclp/pi-setup

Or follow the steps described in our wiki page:

https://github.com/Chaostreff-Potsdam/erika3004/wiki/RaspberryPI-Setup

Assuming your hardware is working ...

You should be able to run:

./erika_print < example/fox.txt

Which should print the contents of example/fox.txt:

The quick brown fox jumps over the lazy dog.

Did it work? Congrats your Erika-Setup seems to be working just fine.

You could also try printing this file and see what happens...

Use in your App

You can install this package as a dependency for your app using pip:

pip3 install git+https://github.com/Chaostreff-Potsdam/erika3004.git

Encoding

The Erika3004 Typewriter uses a proprietary encoding NOT compatible with ASCII, Unicode, etc.
Therefore, software is needed to convert the RAW encoding (or DDR ASCII (GDR ASCII) as we call it ;) ) into something more useful (by modern standands) like ASCII.

A table of all available characters and their hexadecimal value can be found in the manual (Erika-IF2014_AnwenderHandbuch) as Appendix E on page 10.
It also has a list of the most used control characters on page 11 (Appendix F).
A complete list can be found here.

We implemented the conversion in python using a json-file which contains all characters and their hexadecimal values.
Find it in the erika directory (that name was chosen because python module names are based on directory names).

The implementation for Arduino uses hard-coded arrays instead.
Find it in the arduino directory.

Hardware

If you are a proud owner of an Erika 3004 Electronic Typewriter, you might want to check out this "ServiceManual".

Description of the Erica connector:
Erika Connector

More information can be found here (German):
http://hc-ddr.hucki.net/wiki/doku.php/z9001/erweiterungen/s3004

A schematic of our Raspberry Pi based interface can be found on EasyEDA. Schematic

DDR-Halbleiter - Kurzdatenblätter und Vergleichsliste

Configure Hardware Controlflow

Hardware Controlflow is disribed in the wiki: Hardware-control-flow-(RTS,-CTS).

Documentation

For documentation, check the wiki of this projekt: https://github.com/Chaostreff-Potsdam/erika3004/wiki

Additional documentation of the Hardware can be found in: https://github.com/Chaostreff-Potsdam/erika-docs

erika3004's People

Contributors

archibaldbienetre avatar sirexeclp avatar cyroxx avatar chsterz avatar

Stargazers

joak avatar Ludwig Behm avatar  avatar Benjamin Sugar avatar JaWs avatar  avatar Erik avatar Backwoods Bob avatar Augusto Herrmann avatar  avatar Jonah Brüchert avatar  avatar manu avatar  avatar  avatar Sebastian Feustel avatar Kaibu avatar T. Mulzer avatar

Watchers

Sven Köhler avatar Kirstin Heidler avatar James Cloos avatar  avatar  avatar  avatar ajuvo avatar  avatar  avatar  avatar

erika3004's Issues

Tool zum Auswechseln von Zeichen in der CLI Pipe

Wir wünschen uns ein Tool, das im CLI pipe die Zeichen, die nicht unterstütz werden, durch äquivalente Zeichen ersetzt, sodass ASCII-Art etc nicht kaputt geht.

Auf diese Art muss nicht jede Anwendung angepasst werden.

Stream processing for Erika CLI

What works currently:

  • A user of the interface can generate an ASCII art image by themselves like so:
convert ubuntu-logo32.png jpg:- | jp2a - --width=80 --height=80 > ascii_art.txt
  • With the output saved to a file, they can reference the file in the erika CLI like so:
./erika.sh render_ascii_art_file -p "COM3" -f ascii_art.txt

What I want:

  • The user should be able to pipe the output to the CLI directly like so:
convert ubuntu-logo32.png jpg:- | jp2a - --width=80 --height=80 | ./erika.sh render_ascii_art_file -p "COM3"

Rework ANSI Escape Sequence Decoder

Some early prototype code made it into the main branch of development.

Let's remove it for now, and add it in a clean way later on.

Postponed, not given up!

See #22 for follow-up.

Idea: Integrate twitter print bot startup into CLI

The CLI could be used to fire up the new twitter listener bot in a convenient way, such as

./erika.sh twitter-bot -p "/dev/ttyACM0" --key-words berlin potsdam erika maker

Depends on: Twitter Bot being finished

ANSI Escape Sequence Proposal

Based on https://en.wikipedia.org/wiki/ANSI_escape_code

The following escape codes are defined:

    self.csi_codes = {
        "A": self._cursor_up
        , "B": self._cursor_down
        , "C": self._cursor_forward
        , "D": self._cursor_back
        , "E": self._cursor_next_line
        , "F": self._cursor_previous_line
        , "G": self._cursor_horizontal_absolute
        , "H": self._cursor_position
        , "J": self._erase_in_display
        , "K": self._erase_in_line
        , "S": self._scroll_up
        , "T": self._scroll_down
        , "f": self._cursor_position  # Horizontal Vertical Position: same as Cursor Position
        , "m": self._select_graphic_rendition
        , "i": self._decode_aux_port
        , "n": self._device_status_report
        , "s": self._save_cursor_position
        , "u": self._restore_cursor_position
    }

They should map to the following erika hex codes (where n is an int parameter):

Code Erika [HEX] Description
n A n * 2 * 76H Cursor Up
n B n * 2 * 75H Cursor Down
n C n * 2 * 73H Cursor Forward (right)
n D n * 2 * 74H Cursor Back (left)
n E n * 77H Cursor Next Line Beginning (same as n * \n)
n F n * 2 * 76H + 78H Cursor Previous Line Beginning

I suggest using the following codes in addition

Code Erika [HEX] Description
a 76H halfstep up
b 75H halfstep down
c 73H halfstep right
d 74H halfstep left
v (could use fsince it's redundant with H, but would "break" the standard) 82H Microstep (1/20th row) up
e 81H Microstep (1/20th row) down
0t 7DH set default TABs
1t 7AH set TAB
2t 7BH clear TAB
3t 7CH clear all TABs
0M 80H clear margins
1M 7EH set margin left
2M 7FH set margin right
0L 84H 1x line spacing
1L 85H 1.5x line spacing
2L 86H 2x line spacing
0l (could also use alternate fonts for this or bold /faint/normal) 87H 100 chars / line (10 chars / inch)
1l 88H 120 chars / line (12 chars / inch)
2l 89H 150 chars / line (15 chars / inch)
0k 91H keyboard echo off
1k 92H keyboard echo on
ASCII [HEX] Erika[HEX] Description
20 71H Space
08 72H Back Space
0A (\n) 77H New Line (carriage return + new line)
0D(\r) 78H Carriage Return
09 (\t) 79H HT Horizontal TAB

Microstep image rendering (1) - monochrome

Erika 3004's controls allow to move in micro steps (instead of space-wide steps and line feeds).

So, for rendering images, ASCII art is not the only option.

An easy first step could be to just use a monochrome image as input + render it (potentially using the "." character).

Control characters:

  • See docs/Erika-IF2014_AnwenderHandbuch.pdf in the repo:
    ** 0x81 - microstep down
    ** 0x82 - microstep up
    ** 0xA5 [Byte] - [Byte] many microsteps horizontally (two's complement)

Test ESP8266/32

Does the ESP support RTS/CTS, can we use it to control the erika? -- Yes it does!

ESP32 has three UART interfaces, i.e., UART0, UART1 and UART2, which provide asynchronous communication(RS232 and RS485) and IrDA support, communicating at a speed of up to 5 Mbps. UART provides hardwaremanagement of the CTS and RTS signals and software flow control (XON and XOFF). All of the interfaces can beaccessed by the DMA controller or directly by the CPU.

From: https://www.espressif.com/sites/default/files/documentation/esp32_datasheet_en.pdf

$4. Peripheral Interface Data transfers to/from UART interfaces can be implemented via hardware. The data transmission speed via UART interfaces reaches 115200 x 40 (4.5 Mbps). UART0 can be used for communication. It supports flow control. Since UART1 features only data transmit signal (TX), it is usually used for printing log.

By default, UART0 outputs some printed information when the device is powered on and booting up. The baud rate of the printed information is relevant to the frequency of the external crystal oscillator. If the frequency of the crystal oscillator is 40 MHz, then the baud rate for printing is 115200; if the frequency of the crystal oscillator is 26 MHz, then the baud rate for printing is 74880. If the printed information exerts any influence on the functionality of the device, it is suggested to block the printing during the power-on period by changing (U0TXD, U0RXD) to (MTDO, MTCK).

From: https://www.espressif.com/sites/default/files/documentation/0a-esp8266ex_datasheet_en.pdf Page 21

µ support

  File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/pi/erika3004/erika/tcp_server.py", line 53, in <module>
    print_to_erika(sanitized_tweet)
  File "/home/pi/erika3004/erika/tcp_server.py", line 30, in print_to_erika
    erika.print_ascii(sanitized_tweet[i])
  File "/home/pi/erika3004/erika/erika.py", line 47, in print_ascii
    key_id = self.ddr_ascii.encode(c)
  File "/home/pi/erika3004/erika/erica_encoder_decoder.py", line 17, in encode
    return self.ascii_2_ddr[data]
KeyError: 'µ'

pen-plotting

Fix a pen to the printhead to convert the erika into a slow and probably shitty penplotter

Integration test not working properly

The integration test just connects, moves the cursor a bit,... it seems not to be working properly :/

See run_integrationtests.sh and its triggered scripts.

Cleanup: curses-based rendering for MicrostepBasedErikaMock

CharacterBasedErikaMock is working well + smooth, way better than the old implementation that dumped the whole internal array to the commandline.

MicrostepBasedErikaMock still uses this old implementation, and should also be refactored.
It is used as part of run_manual_tests.sh and spams the output quite a bit.

In addition, this is a good opportunity to get rid of redundancy among AbstractErikaMock, MicrostepBasedErikaMock, CharacterBasedErikaMock.

SHOULD be done after #52 is merged, or based on the feature/deletebranch to avoid merge issues / future rework

Scope

  • Do not yet remove the whole internal representation of the rendered content as two-dimensional array
    • meaning CharacterBasedErikaMock.canvas resp MicrostepBasedErikaMock.canvas
    • even though I just discovered the curses instr(y, x [,n]) method.

TCP Server: allow full 65 characters

We currently enforce a line-wrap after 65 characters, whatever the characters are. So if somebody sends us lines of 65 characters + newline, we actually get 2 newlines: the one that is enforced and the one from the incoming request.

We should skip enforcing line wrap in that case since the client already sends us the newline.

Remove Erika FS

Some early prototype code made it into the main branch of development.

Let's remove it for now, and add it in a clean way later on.

Postponed, not given up!

Choose a license :)

Choose a license :)

  • Free - Apache, BSD, MIT, LGPL...
  • License with copy-left: GPL,...

Erika + Erika mocks: support "delete"

We need to support the correction tape, e.g. for #29 (Tetris).

It seems one control character is there to switch from correction to normal tape, one to switch back.
The actual deletion requires the implementer to keep track of what letter was there before - and overwrite it with with itself using the correction tape.

See #29:

Correction tape controls are not yet wrapped by our software - the website linked to by the main README.md provides some insights here, though:

8BH	Zeichen löschen OFF	Status: Drucken (die nachfolgenden Zeichen werden gedruckt)
8CH	Zeichen löschen ON	Status: Korrigieren (die nachfolgenden Zeichen werden mit Korrekturband gelöscht)

http://hc-ddr.hucki.net/wiki/doku.php/z9001/erweiterungen/s3004

Concrete requirements:

In Erika and the CharacterBasedErikaMock...

  • ... a delete_character(self, letter) function exists
    • switches on correction tape, prints the letter, switches back
  • ... switch_to_correction_tape(self) and switchToNormalTape(self) should be implemented for more fine-grained control

Discussion:

  • Do we need a "delete_pixel"?

TCP Server: Answer HTTP requests with a static page

Some users try to open the URL in the web browser. In order to optimize their experience, we should respond with a static HTML page explaining "You're doing it wrong" in nice terms and give some help on how to use the service.

Update setup.sh

setup.sh is a simple script to setup a Raspberry PI for communicating with an Erika machine (configure RTS/CTS etc).

The current script in the repository is outdated and may no longer work.

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

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)

Implement + test rendering strategies

Implementing different rendering strategies will be a great thing to have - input an ASCII art image, have Erika print it.

With varying rendering strategies, we'll have something interesting to show at Camp / Congress.

Robert (that's me!) would like to implement this

Erika game: labyrinth

Easy mode:

Erika prints a labyrinth structure (x marks the goal, current position at cursor), user navigates the labyrinth.
Controls could be WASD
Moving against a wall, the cursor will not move until the user is out of the labyrinth.

Hard mode:
Erika will no longer print the labyrinth structure

Erika Game: Tetris :o

@sirexeclp had the idea to implement Tetris on the Erika.

The implementation will make extensive use of both the normal ink tape and correction tape.

Correction tape controls are not yet wrapped by our software - the website linked to by the main README.md provides some insights here, though:

8BH	Zeichen löschen OFF	Status: Drucken (die nachfolgenden Zeichen werden gedruckt)
8CH	Zeichen löschen ON	Status: Korrigieren (die nachfolgenden Zeichen werden mit Korrekturband gelöscht)

http://hc-ddr.hucki.net/wiki/doku.php/z9001/erweiterungen/s3004

Tracking Erikas Cursor Position

How can we track the current cursor position of erika, if we need absolute values?
e.g. every method that moves / writes has to update an internal cursor position value
Or can we get the cursor position from erika?
Or can we use some kind of enstop to "home" before making absolute cursor moves.
For columns this could be done using carriage return, for lines this might be difficult.

Any ideas ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.