Skip to content

How does it work

venice1200 edited this page Mar 25, 2021 · 33 revisions

MiSTer

When the MiSTer boots up the script /etc/init.d/S60tty2oled is called.
This script does nothing more than calling the script /usr/bin/tty2oled and sent it to the background,
but only if /usr/bin/tty2oled is found and is executable.
The script /usr/bin/tty2oled checks at first the system for the device /dev/ttyUSB0.
If the device is not found the scripts ends here.
If the device is found the tty-device parameter are set with the stty command.
Now the script sends an First Transmission.
First Transmission?
During my tests I got sometimes weird display startup behavior when the MiSTer's was powerred on.
Sometimes the text MENU was written instead of the MiSTer Picture shown.
Maybe some sleeping bits in the serial channel 😏.
After I added the First Transmission to the script the problem was gone πŸ˜„.
Now the main loop is started and checks the existence of the file /tmp/CORENAME.
If the file doesn't exist the script tries again and again and ...
If the file exists, the file's content is read using cat /tmp/CORENAME,
stored into the variable newcore and send to the tty Device.
At the end of the main loop the script waits for the next change and re-starts the loop.
Every loop the Corename is checked but the data are sent only if the Corename has changed.

Arduino (Standard Version)

The Arduino receives the transferred Corename.
If the Corename is within a list of known Names the corresponding picture is shown.
If the Corename is unknown just the Corename is shown.
The used font for the Text can be changed within the Arduino Code.
See the list of fonts for all in the Library included fonts.
To prevent Display flickering the Text or Picture is only updated if the received Corename has changed.

Known Corenames
The following Corenames are identified and an dedicated or generic Picture is shown.
Arcade:
asteroid, atetris, atetrisc, centiped, centiped3, dkong, dkongdks, dkong3, dkong3b, frogger,
llander, mooncrgx ,mpatrol, pong, pooyan, popeye, sbrkout, zaxxon
Computers:
AcornAtom, AO486, APPLE-I, Apple-II, ARCHIE, AtariST, ATARI800, C64, Minimig, MSX, PET2001, VIC20
Console:
ATARI2600, ATARI5200, ATARI7800, AtariLynx, Astrocade, ChannelF, Coleco, GAMEBOY, GBA, Genesis,
MEGACD, NEOGEO, NES, ODYSSEY, Playstation, SMS, SNES, TGFX16, VECTREX
Other:
CHESS, MEMTEST, MENU (Menu Logo fading in with an particle effect), QWERTZ (first transmission).

Tip: Check the Arduino Code of the Standard Version for Supported Corenames.

Arduino (SD Version)

The SD Version supports the live download of Pictures from SD Card. No need to keep the Pictures in Code.
You need an Arduino compatible Hardware plus/with an SD Slot/Breakout.
I use an ESP32 TTGO-T8 v1.7.1 with an integrated SD Slot.
The SD Card must be formatted with FAT or FAT32.
If the SD Card was found an SD-Card Icon is shown on the Startup Screen.
The Arduino Sketch searches for the XBM converted pictures in the root folder of the SD Card.
The Pictures must have the size of 256x64 Pixel for the used SSD1322 Display.
The filename must be the name of the core with .xbm as extension.
Example: The Arcade Lunar Lander has the corename llander means the filename needs to be llander.xbm.
See https://github.com/venice1200/MiSTer_tty2oled/tree/main/Pictures/xbm_sd for examples.
The Arduino receives the transferred Corename and checks the SD Card for an corresponding file.
If the file is found it's loaded and shown on the Display.
If the file or the SD card is not found just the Corename is shown as Text.
With the SD Card it's easy to add or update the Pictures by adding or changing the files on the SD Card.
Tip: Just get all files from XBM_SD Folder and copy them to your SD Card.

Core with Picture
TGFX16

Core shown by name
Astrocade

Technical Note:
The SD Version uses an dedicated SPI Interface because of issues using an OLED and an SD Card together on one ESP32 SPI Interface.

Clone this wiki locally