Command - venice1200/MiSTer_tty2oled GitHub Wiki

New Command Mode (U8G2 Library)

If normally a value is sent from the MiSTer to the Display it's the Corename.
To be able to send "other Data" to the Display we added the "Command Mode".
The "Command Mode" Command's can be used outside the tty2oled script as well (ssh,cli).

The new Command Mode don't need an leading "att" to be sent. Every needed Parameter is included with the command.
The only Command which needs additional Data sent after the Command is the Command for Corechange.

❗ The Serial Interface on the Host must be correctly configured before you can use the "Command-Mode". ❗

For the examples it's assumed that the MiSTer's Interface for tty2oled is /dev/ttyUSB0.

Command "CMDAPD" (testing)

Command to announce Picture Data which will be send after this Command.
Command: echo "CMDAPD,[Corename]" > /dev/ttyUSB[x]
Example: echo "CMDAPD,llander" > /dev/ttyUSB0
After this command was send from the tty2oled Daemon, Picture Data must be sent
using this bash command: tail -n +4 "${picturefolder}/${1}.xbm" | xxd -r -p > ${TTYDEV}.
❗ This command is similar to "CMDCOR" but the picture is not shown, only transferred.

Command "CMDBYE"

Show Sorgelig's Cat Icon 😄
Command: echo "CMDBYE" > /dev/ttyUSB[x]
Example: echo "CMDBYE" > /dev/ttyUSB0

Command "CMDCLS"

Clear the Display
Command: echo "CMDCLS" > /dev/ttyUSB[x]
Example: echo "CMDCLS" > /dev/ttyUSB0

Command "CMDCON"

Set Display Contrast
Command: echo "CMDCON,[Parameter]" > /dev/ttyUSB[x]
Parameter-Format: "c"
Example: echo "CMDCON,200" > /dev/ttyUSB0

Parameter Function
c Contrast Value 0..255

Command "CMDCOR"

Command to announce Corechange. New Picture Data will be send after this Command.
Command: echo "CMDCOR,[Corename]" > /dev/ttyUSB[x]
Example: echo "CMDCOR,llander" > /dev/ttyUSB0
After this command was send from the tty2oled Daemon, Picture Data must be sent
using this bash command: tail -n +4 "${picturefolder}/${1}.xbm" | xxd -r -p > ${TTYDEV}.

Command "CMDENOTA"

Enable Over The Air (OTA) Update on the ESP32 for the Upload of an new Arduino Program via Wireless Network.
Command: echo "CMDENOTA" > /dev/ttyUSB[x]
Example: echo "CMDENOTA" > /dev/ttyUSB0

Command "CMDFOD" (testing)

Set Font Direction
Command: echo "CMDFOD,[Parameter]
Parameter-Format: "d"
Example: echo "CMDOFF,1"

Parameter Function
d 0=Left to Right (0°, default), 1=Top to Down (90°), 2=Right to Left (180°), 3=Down to Top (270°)

Command "CMDGEO"

Send Data to show Geometric Figures on Display
Command: echo "CMDGEO,[Parameter]" > /dev/ttyUSB[x]
Parameter Format = "g,c,x,y,i,j,k"
Example (Draw): echo "CMDGEO,3,1,10,20,100,20,0" > /dev/ttyUSB0
Example (Clear): echo "CMDGEO,3,0,10,20,100,20,0" > /dev/ttyUSB0

Parameter Function
g Geometric Figure 1..10, see Geometric Figure List
c Draw Color 0=Clear, 1=Draw, 2=XOR/Invert Pixel
x X-Position 0..255
y Y-Position 0..63
i Variable Parameter 1 (Function depends on Geometric Figure)
j Variable Parameter 2 (Function depends on Geometric Figure)
k Variable Parameter 3 (Function depends on Geometric Figure)

Geometric Figure List

No Figure Used Parameter Link
1 Pixel x,y https://github.com/olikraus/u8g2/wiki/u8g2reference#drawpixel
2 Line x,y,i,j https://github.com/olikraus/u8g2/wiki/u8g2reference#drawline
3 Frame x,y,i,j https://github.com/olikraus/u8g2/wiki/u8g2reference#drawframe
4 Box (Filled Frame) x,y,i,j https://github.com/olikraus/u8g2/wiki/u8g2reference#drawbox
5 Circle x,y,i https://github.com/olikraus/u8g2/wiki/u8g2reference#drawcircle
6 Disc (Filled Circle) x,y,i https://github.com/olikraus/u8g2/wiki/u8g2reference#drawdisc
7 Ellipse x,y,i,j https://github.com/olikraus/u8g2/wiki/u8g2reference#drawellipse
8 Filled Ellipse x,y,i,j https://github.com/olikraus/u8g2/wiki/u8g2reference#drawfilledellipse
9 Rounded Frame x,y,i,j,k https://github.com/olikraus/u8g2/wiki/u8g2reference#drawrframe
10 Rounded Box x,y,i,j,k https://github.com/olikraus/u8g2/wiki/u8g2reference#drawrbox

Pixel
x,y = Position of the Dot
Line
x,y = x0,y0 = Line Startpoint, i,j = x1,y1 = Line Endpoint
Frames and Boxes
x,y = Left-Upper-Corner of Frame/Box, i,j = Frame/Box width & height, k = Corner Radius for Geometric Figure 9&10
Circle and Disc
x,y = Center of Circle/Disc, i = Radius
Ellipses
x,y = Center of Ellipse, i,j = Radius in x,y direction

Command "CMDOFF"

Set Power Save Mode/Switch Display On/Off
Command: echo "CMDOFF,[Parameter]
Parameter-Format: "p"
Example: echo "CMDOFF,1"

Parameter Function
p Power Save Mode: 0 =Disabled/Display ON (default), 1 =Enabled/Display OFF

Command "CMDRESET"

Reboot/Reset ESP32
Command: echo "CMDRESET" > /dev/ttyUSB[x]
Example: echo "CMDRESET" > /dev/ttyUSB0

Command "CMDROT"

Set Display Rotation
Command: echo "CMDROT,[Parameter]
Parameter-Format: "r"
Example: echo "CMDROT,1"

Parameter Function
r Display Rotation: 0 =Disabled (default), 1 =Enable 180 degree Rotation

Command "CMDSNAM" (testing)

Show actual loaded Corename on Display
Command: echo "CMDSORG" > /dev/ttyUSB[x]
Example: echo "CMDSORG" > /dev/ttyUSB0

Command "CMDSORG"

Show Startup Text on Display
Command: echo "CMDSORG" > /dev/ttyUSB[x]
Example: echo "CMDSORG" > /dev/ttyUSB0

Command "CMDSPIC" (testing)

Show actual loaded Picture on Display
Command: echo "CMDSPIC" > /dev/ttyUSB[x]
Example: echo "CMDSPIC" > /dev/ttyUSB0

Command "CMDTEST"

Show a full screen test picture which is included in the Arduino Code
Command: echo "CMDTEST" > /dev/ttyUSB[x]
Example: echo "CMDTEST" > /dev/ttyUSB0

Command "CMDTXT"

Send Text to be shown on Display
Command: echo "CMDTXT,[Parameter]" > /dev/ttyUSB[x]
Parameter-Format = "f,c,x,y,[Text]
Example: echo "CMDTXT,1,1,50,30,Hello World" > /dev/ttyUSB0

Parameter Function
f Text-Output Font Type, see Font list
c Draw Color 0=Clear, 1=Draw, 2=XOR/Invert Pixel
x Text-Output X-Position 0..255 (SSD1322 Display)
y Text-Output Y-Position 0..63 (SSD1322 Display)
[Text] Text to write on tty2oled

❗ The text starts at the bottom left of the pixel grid coordinates.

Font list

Font Type No Font Type Font Size Width x Height, Size for Character A
0 u8g2_font_luBS08_tf 11x12, 8 Pixel A, Transparent
1 u8g2_font_luBS10_tf 13x15, 10 Pixel A, Transparent
2 u8g2_font_luBS14_tf 20x22, 14 Pixel A, Transparent
3 u8g2_font_luBS18_tf 26x28, 18 Pixel A, Transparent
4 u8g2_font_luBS24_tf 34x36, 24 Pixel A, Transparent
5 u8g2_font_profont12_mf 6x12, 8 Pixel A, Non-Transparent
6 u8g2_font_profont17_mf 9x17, 11 Pixel A, Non-Transparent
7 u8g2_font_profont22_mf 12x22, 14 Pixel A, Non-Transparent
8 u8g2_font_profont29_mf 16x29, 19 Pixel A, Non-Transparent
9 u8g2_font_open_iconic_all_2x_t 16x16 Icons, Transparent
10 u8g2_font_lucasarts_scumm_subtitle_o_tf Nice 12 Pixel Fon, Transparent

Old "att" Command Mode

If normally a value is sent from the MiSTer to the Display it's the Corename.
To send "other Data" to the Display we added the "Command Mode".
The "Command Mode" Commands can be used outside (ssh,cli) the tty2oled script as well.

❗ The Serial Interface on the Host must be correctly configured before you can use the "Command-Mode". ❗

The "Command Mode" starts by sending "att" (Step 1) to the Display
followed by the "Command" (Step 2) and the "Command-Parameter" (Step 3) if needed.

It's assumed the MiSTer's tty2oled Interface is /dev/ttyUSB0.

Command "CONTRAST"

Set Display Contrast

Step Linux Command Function
1 echo "att" > /dev/ttyUSB0 Is needed
2 echo "CONTRAST" > /dev/ttyUSB0 Enable CONTRAST Mode
3 echo "200" > /dev/ttyUSB0 Send Display Contrast Value to tty2oled

Command "CORECHANGE"

Send Picture Data to the Display

Step Linux Command Function
1 echo "att" > /dev/ttyUSB0 Is needed
2 echo "CORECHANGE" > /dev/ttyUSB0 Enable CORECHANGE Mode
3 tail -n +4 "/path/to/picture.xbm" | xxd -r -p > /dev/ttyUSB0 Transfer Picture Data to tty2oled

Command "TEXTOUTXY"

Show some Text, without the need to use the tty2oled script, at Position X,Y.

Step Linux Command Function
1 echo "att" > /dev/ttyUSB0 Is needed
2 echo "TEXTOUTXY" > /dev/ttyUSB0 Enable TEXTOUTXY Mode
3 echo "x,y,f,[Text]" > /dev/ttyUSB0 Send [Text] with Font f and Position x,y to tty2oled

Command Parameter Format "x,y,f,[Text]"

Parameter Function
x Text-Output X-Position 0..255 (SSD1322 Display)
y Text-Output Y-Position 0..63 (SSD1322 Display)
f Text-Output Font Type, see Font list
[Text] Text to write on tty2oled

❗ The text starts at the bottom left of the pixel grid coordinates.

Font list

Font Type No Font Type Font Size Width x Height, Size for Character A
0 u8g2_font_luBS08_tf 20x12, 8 Pixel A, Transparent
1 u8g2_font_luBS10_tf 26x15, 10 Pixel A, Transparent
2 u8g2_font_luBS14_tf 35x22, 14 Pixel A, Transparent
3 u8g2_font_luBS18_tf 44x28, 18 Pixel A, Transparent
4 u8g2_font_luBS24_tf 61x40, 24 Pixel A, Transparent
5 u8g2_font_profont12_mf 6x12, 8 Pixel A, Non-Transparent
6 u8g2_font_profont17_mf 9x17, 11 Pixel A, Non-Transparent
7 u8g2_font_profont22_mf 12x22, 14 Pixel A, Non-Transparent
8 u8g2_font_profont29_mf 16x29, 19 Pixel A, Non-Transparent
9 u8g2_font_open_iconic_all_2x_t 16x16 Icons, Transparent
10 u8g2_font_lucasarts_scumm_subtitle_o_tf Nice 12 Pixel Fon, Transparent

All Data taken from the U8G2 Wiki at https://github.com/olikraus/u8g2/wiki/fntlistall

Command "GEOOUTXY"

Draw/Clear Geometric Figures (Pixel, Line, Frame, Box (Filled Frame), Circle, Disc (Filled Circle), Ellipse, Filled Ellipse, Rounded Frame, Rounded Box)

Draw Example

Step Linux Command Function
1 echo "att" > /dev/ttyUSB0 Is needed
2 echo "GEOOUTXY" > /dev/ttyUSB0 Enable GEOOUTXY Mode
3 echo "3,1,20,10,40,10,0" > /dev/ttyUSB0 Draw Frame starting at x=20, y=10 with width=40 and height=10

Clear Example

Step Linux Command Function
1 echo "att" > /dev/ttyUSB0 Is needed
2 echo "GEOOUTXY" > /dev/ttyUSB0 Enable GEOOUTXY Mode
3 echo "4,0,20,10,30,20,0" > /dev/ttyUSB0 Clear Box starting at x=20, y=10 with width=30 and height=20

Command-Parameter Format is "g,c,x,y,i,j,k"

Parameter Function
g Geometric Figure 1..10, see Geometric Figure List
c Draw Color 0=Clear, 1=Draw, 2=XOR/Invert Pixel
x X-Position 0..255
y Y-Position 0..63
i Variable Parameter 1 (Function depends on Geometric Figure)
j Variable Parameter 2 (Function depends on Geometric Figure)
k Variable Parameter 3 (Function depends on Geometric Figure)

Geometric Figure List

No Figure Used Parameter Link
1 Pixel x,y https://github.com/olikraus/u8g2/wiki/u8g2reference#drawpixel
2 Line x,y,i,j https://github.com/olikraus/u8g2/wiki/u8g2reference#drawline
3 Frame x,y,i,j https://github.com/olikraus/u8g2/wiki/u8g2reference#drawframe
4 Box (Filled Frame) x,y,i,j https://github.com/olikraus/u8g2/wiki/u8g2reference#drawbox
5 Circle x,y,i https://github.com/olikraus/u8g2/wiki/u8g2reference#drawcircle
6 Disc (Filled Circle) x,y,i https://github.com/olikraus/u8g2/wiki/u8g2reference#drawdisc
7 Ellipse x,y,i,j https://github.com/olikraus/u8g2/wiki/u8g2reference#drawellipse
8 Filled Ellipse x,y,i,j https://github.com/olikraus/u8g2/wiki/u8g2reference#drawfilledellipse
9 Rounded Frame x,y,i,j,k https://github.com/olikraus/u8g2/wiki/u8g2reference#drawrframe
10 Rounded Box x,y,i,j,k https://github.com/olikraus/u8g2/wiki/u8g2reference#drawrbox

Pixel
x,y = Position of the Dot
Line
x,y = x0,y0 = Line Startpoint, i,j = x1,y1 = Line Endpoint
Frames and Boxs
x,y = Left-Upper-Corner of Frame/Box, i,j = Frame/Box width & height, k = Corner Radius for Geometric Figure 9&10
Circle and Disc
x,y = Center of Circle/Disc, i = Radius
Ellipses
x,y = Center of Ellipse, i,j = Radius in x,y direction

...work in Progress