Command_v2 - venice1200/MiSTer_tty2oled GitHub Wiki

New Command Mode (Adafruit GFX Library)

If normally a value is sent from the MiSTer to the Display, then it is 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, Windows PowerShell).

The new Command Mode don't need a leading "att" to be sent. Every needed Parameter is included within the command.
The only Command which needs additional Data, sent after the Command himself, 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 List (find Details below):

Command Function
CMDAPD Command to announce Picture Data
CMDBYE Show Sorgelig's Cat Icon
CMDCLS Clear and Update the Display
CMDCLST Clear/Fill the Display with Transition
CMDCLSWU Clear the internal Display Buffer without Updating the Display's Content
CMDCON Set Display Contrast
CMDCOR Command to announce Corechange
CMDDOFF Switch Display off
CMDDON Power Display on
CMDDUPD Update Display Content
CMDENOTA Enable Over The Air Update on the ESP32 -Deprecated-
CMDGEO Show Geometric Figures
CMDHWINF Send this command to receive Infos about Hardware and Software
CMDNULL Null Command for testing
CMDPLED Switch the Power Control LED on/off, DTI Board >=1.2 only
CMDPNOTE Using the Piezo Beeper on DTI Board >=1.2 only
CMDPTONE Using the Piezo Beeper on DTI Board >=1.2 only
CMDRESET Reboot/Reset ESP32 only
CMDROT Disable or Enable Display Rotation
CMDSAVER Disable or Enable the ScreenSaver
CMDSECD Set command delay
CMDSETTIME Set MCU clock, ESP32 only
CMDSHCD Show command delay "On Screen"
CMDSHTEMP Show once the actual MIC184 Temperature, DTI Boards only
CMDSHSYSHW Show tty2oled System Infos
CMDSNAM Show actual loaded Corename
CMDSORG Show Startup Text
CMDSPIC Show actual loaded Picture
CMDSSCP Show small Version of actual loaded Core Picture
CMDSTTYACK Enable/Disable sending TTYACK, testing FW
CMDSWSAVER Switch Screensaver on or off
CMDTEST Show a full screen test picture
CMDTXT Send Text to the Display
CMDTZONE Switch Temperatur Sensor Zone, DTI Boards only
CMDULED Switch User LED, DTI Boards only
CMDWRDTIV Write DTIV Version, DTI Boards only

Command "CMDAPD"

Command to announce Picture Data which will be send after this Command.
You can use CMDSPIC after this Command to show the loaded Picture.
Command: echo "CMDAPD,[Corename]" > /dev/ttyUSB[x]
Example: echo "CMDAPD,llander" > /dev/ttyUSB0

After this command was send to the Display, Picture Data must be sent
using this bash command: tail -n +4 "${picturefolder}/${corename}.[xbm|gsc]" | xxd -r -p > ${TTYDEV}.
❗ This command is similar to "CMDCOR" but the picture is not shown, only transferred into the Display buffer.

Command "CMDBYE"

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

Command "CMDCLS"

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

Command "CMDCLST"

Clear/Fill the Display with Transition and clears the Picture Buffer.
Command: echo "CMDCLST,t,c" > /dev/ttyUSB[x]

Parameter Function
t Picture Transition, Scroll down for transition list
c Grayscale Color Level 0=Black...15=Full Color

Examples:
Fill the Display with Transition 19 and Color Level 13: echo "CMDCLST,19,13" > /dev/ttyUSB0
Clear the Display with Transition 15: echo "CMDCLST,15,0" > /dev/ttyUSB0

Info:
If "t" is set to -1 the transition will be chosen randomly.
0 for t means "no transition", values >0 are the effect Number himself.
❗ After using "CMDCLST" the command "CMDSPIC" is not working as the Picture Buffer was cleared ❗

Command "CMDCLSWU"

Clear the internal Display Buffer without Updating the Display's Content.
Command: echo "CMDCLSWU" > /dev/ttyUSB[x]
Example: echo "CMDCLSWU" > /dev/ttyUSB0

Info:
Use this command for Background Operation without changing the Display content.
Clear the screen Buffer and draw some other hidden Text or Geometrics and shown
them together using the Command "CMDDUPD".

Command "CMDCON"

Set Display Contrast.
Command: echo "CMDCON,c" > /dev/ttyUSB[x]

Parameter Function
c Contrast Value 0..255

Example, set Contrast to 100: echo "CMDCON,100" > /dev/ttyUSB0

Command "CMDCOR"

Command to announce Corechange.
New Picture Data must be send after this Command.
After the Data are sent, the Picture will be shown.
This Command has the optional Transition Effect Parameter t.
Command: echo "CMDCOR,[Corename]" > /dev/ttyUSB[x]
or with the optional Parameter t
Command: echo "CMDCOR,[Corename],t" > /dev/ttyUSB[x]

Parameter Function
t Transition Effect (Optional, Scroll down for transition list)

Examples:
Without Parameter: echo "CMDCOR,llander" > /dev/ttyUSB0
With Effect Parameter: echo "CMDCOR,llander,19" > /dev/ttyUSB0
If t is not given or set to -1 the Transition Effect is randomly chosen.
0 for t means "no transition", values >0 are the effect Number himself.

Info:
After this command was send from the tty2oled Daemon, Picture Data must be sent
using this bash command: tail -n +4 "${picturefolder}/${corename}.[xbm|gsc]" | xxd -r -p > ${TTYDEV}.
❗ This command is similar to "CMDAPD" but here the picture is shown.

Command "CMDDOFF"

Switch Display off.
Command: echo "CMDDOFF" > /dev/ttyUSB[x]
Example: echo "CMDDOFF" > /dev/ttyUSB0

Command "CMDDON"

Power Display on.
Command: echo "CMDDON" > /dev/ttyUSB[x]
Example: echo "CMDDON" > /dev/ttyUSB0

Command "CMDDUPD"

Update Display Content (write Display Buffer to Display Screen).
Command: echo "CMDDUPD" > /dev/ttyUSB[x]
Example: echo "CMDDUPD" > /dev/ttyUSB0

Info:
Use this Command to show hidden drawn Text and Geometrics.

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 "CMDGEO"

Send Data to show Geometric Figures on Display.
Command: echo "CMDGEO,g,c,x,y,i,j,k,l" > /dev/ttyUSB[x]

Parameter Function
g Geometric Figure 1..10, see Geometric Figure List [*]
c Grayscale Draw Color 0=Black ...15=Full Color
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)
l Variable Parameter 3 (Function depends on Geometric Figure)

Unused Parameter should be set to 0.

Examples: Draw Rectangle: echo "CMDGEO,3,15,10,20,100,20,0,0" > /dev/ttyUSB0
Clear Rectangle: echo "CMDGEO,3,0,10,20,100,20,0,0" > /dev/ttyUSB0

[*] If you add 100 to the Geometric Figure Number, the Geometric Figure will be written into the Display Buffer only.
Means you don't see the change immediately. You will see the result after the next Text or Geo Output.
You can also use the Command "CMDDUPD" to write the buffer to the Display to see the result.
Useful for Text which needs to be overwritten.

Geometric Figure List

No Figure Used Parameter
1 Pixel x,y
2 Line x,y,i,j
3 Rectangle x,y,i,j
4 Filled Rectangle x,y,i,j
5 Circle x,y,i
6 Filled Circle x,y,i
7 Rounded Rectangle x,y,i,j,k
8 Filled Rounded Rectangle x,y,i,j,k
9 Triangle x,y,i,j,k,l
10 Filled Triangle x,y,i,j,k,l

Pixel
x,y = Position of the Dot
Line
x,y = x0,y0 = Line Startpoint, i,j = x1,y1 = Line Endpoint
Rectangles
x,y = Left-Upper-Corner of Frame/Box, i,j = Frame/Box width & height, k = Corner Radius Circles
x,y = Center of Circle/Disc, i = Radius
Triangles
x,y = Position Point 1, i,j = = Position Point 2, k,l = Position Point 3

Command "CMDHWINF"

Send this command to receive Infos about Hardware and Software from tty2oled.
Command: echo "CMDHWINF" > /dev/ttyUSB[x]
Example: echo "CMDHWINF" > /dev/ttyUSB0
You should receive something similar to "HWESP32DE;211107;"

Command "CMDNULL"

This Command does absolute nothing 😃

Command "CMDPLED"

Only for DTI Boards (up from Version 1.2).
Switch the Power Control LED on d.ti Board on/off
Command: echo "CMDPLED,x" > /dev/ttyUSB[x]

Parameter Function
x 0=LED off, 1=LED on

Examples
Power on Power Control LED's: echo "CMDPLED,1" > /dev/ttyUSB0
Power off Power Control LED's: echo "CMDPLED,0" > /dev/ttyUSB0

Command "CMDPNOTE"

Only for DTI Boards (up from Version 1.2).
Play one or more Music-Notes.
Command: echo "CMDPNOTE,n,o,d,p" > /dev/ttyUSB[x]
Command: echo "CMDPNOTE,n,o,d,p,n1,o1,d1,p1,n2,o2,d2,p2,.." > /dev/ttyUSB[x]

Parameter Function
n Note (C,CS,D,EB,E,F,FS,G,GS,A,BB,B)
o Octave (Number)
d Play Duration (ms)
p Pause after Playing (ms)

WIP

Command "CMDPTONE"

Only for DTI Boards (up from Version 1.2).
Command: echo "CMDPTONE,f,d,p" > /dev/ttyUSB[x]
Play one or more Music-Frequencies.
Command: echo "CMDPTONE,f,d,p" > /dev/ttyUSB[x]
Command: echo "CMDPTONE,f,d,p,f1,d1,p1,f2,d2,p2,.." > /dev/ttyUSB[x]

Parameter Function
n Freqency (Number)
d Play Duration (ms)
p Pause after Playing (ms)

WIP

Command "CMDRESET"

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

Command "CMDROT"

Disable or Enable Display Rotation.
Command: echo "CMDROT,r"

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

Example, rotate the Screen for 180 Degrees: echo "CMDROT,1" > /dev/ttyUSB0

Command "CMDSAVER"

Disable or Enable the little ScreenSaver function.
You can configure the Mode and the re-draw-interval (in seconds).
Command: echo "CMDSAVER,m,i,l" > /dev/ttyUSB[x]

Parameter Function
m Mode: 0=ScreenSaver off, 1..31 ScreenSaver Mode
i Interval: 10..600 [seconds]
l Logo-Time: 10..600 [seconds]

Examples:
Disable ScreenSaver: echo "CMDSAVER,0,0,0" > /dev/ttyUSB0
Enable ScreenSaver after showing the Logo for 120 seconds with the interval of 10 seconds
and Mode 1: echo "CMDSAVER,1,10,120" > /dev/ttyUSB0
Mode:
The ScreenSaver Mode is calculated out of the ScreenSaver Screen Options.
See: https://github.com/venice1200/MiSTer_tty2oled/wiki/Installation#ini-file
The Mode is calculated from the Daemon Script, no need for the User to do anything.

Command "CMDSECD"

Set Command Delay.
WIP

Command "CMDSETTIME"

Send the actual time to the MCU. ESP32 only!
Command: echo "CMDSETTIME,t" > /dev/ttyUSB[x]

Parameter Function
t Time Value

Example: Use the following code in your Script.
timeoffset=$(date +%:::z)
localtime=$(date '-d now '${timeoffset}' hour' +%s)
echo "CMDSETTIME,${localtime}" > /dev/ttyUSB0

Command "CMDSHCD"

Show Command Delay.
WIP

Command "CMDSHTEMP"

Only for DTI Boards.
Show once the actual MIC145 Sensor Temperature on the Display Screen.
Command: echo "CMDSTEMP" > /dev/ttyUSB[x]
Example: echo "CMDSTEMP" > /dev/ttyUSB0

Command "CMDSHSYSHW"

Shows Information about the tty2oled Software, Hardware and Options.
Command: echo "CMDSHSYSHW" > /dev/ttyUSB[x]
Example: echo "CMDSHSYSHW" > /dev/ttyUSB0

Command "CMDSNAM"

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"

Show actual loaded Picture on Display.
Picture Data must be loaded before you run this command using CMDCOR or CMDAPD.
This Command has the optional Transition Effect Parameter t.
Command: echo "CMDSPIC" > /dev/ttyUSB[x]
or with the optional Parameter t
Command: echo "CMDSPIC,t" > /dev/ttyUSB[x]

Parameter Function
t Transition Effect (Optional), Scroll down for transition list

Examples:
echo "CMDSPIC" > /dev/ttyUSB0
echo "CMDSPIC,19" > /dev/ttyUSB0

Info:
If t is not given or set to -1 the Transition Effect is randomly chosen.
0 for t means "no transition", values >0 are the effect Number himself.
❗ "CMDSPIC" is not working after "CMDCLST" ❗

Command "CMDSSCP"

Show small Version (1/4) of the actual loaded Core Picture.
Used for the ScreenSaver function.
Command: echo "CMDSSCP,x,y" > /dev/ttyUSB[x]

Parameter Function
x X-Position 0..255
y Y-Position 0..63

Example: echo "CMDSSCP,64,16" > /dev/ttyUSB0

Command "CMDSTTYACK"

Actula available in "testing"
Enable (default)/disable sending of "ttyack" from the Display back to the MiSTer after a CMD-Command is processed.
Command: echo "CMDSTTYACK,x" > /dev/ttyUSB[x]

Parameter Function
x 0=Sending ttyack is disabled, 1=Sending ttyack is enabled

Command "CMDSWSAVER"

Switch the ScreenSaver on or off.
Command: echo "CMDSWSAVER,x" > /dev/ttyUSB[x]

Parameter Function
x 0=ScreenSaver off, 1=ScreenSaver on

Example:
Switch ScreenSaver on: echo "CMDSWSAVER,1" > /dev/ttyUSB0
Switch ScreenSaver off: echo "CMDSWSAVER,0" > /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 the Display.
Command: echo "CMDTXT,f,c,b,x,y,[Text]" > /dev/ttyUSB[x]

Parameter Function
f Text-Output Font Type, see Font list [*]
c Grayscale Font Draw Color 0=Black...15=Full Color
b Grayscale Font Background Color 0=Black...15=Full Color
x Text-Output X-Position 0..255 (SSD1322 Display)
y Text-Output Y-Position 0..63 (SSD1322 Display)
[Text] Text to write on tty2oled

Examples: Write with "Full" Color: echo "CMDTXT,1,15,0,50,30,Hello World" > /dev/ttyUSB0
Write (overwrite) with "Black" Color: echo "CMDTXT,1,0,0,50,30,Hello World" > /dev/ttyUSB0
Write only to Buffer: echo "CMDTXT,101,15,0,50,30,Hello World" > /dev/ttyUSB0
Show Temperature (DTI Board): echo "CMDTXT,1,15,0,50,30,TEP184" > /dev/ttyUSB0 [**]

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

[*] If you add 100 to the Font Number, the given Text will be written only into the Display Buffer.
Means you don't see the change immediately. You will see the result after the next Text or Geo Output.
You can also use the Command "CMDDUPD" to write the buffer to the Display to see the result.
Useful for Clocks or Text which needs to be overwritten.

[**] Special for the DTI Board
If you send "TEP184" as Text the Text will be replaced with the Actual Temperature Value and "°C".

Font list

Font Type No Font Type Font Size Width x Height, Size for Character A
0 u8g2_font_5x7_mf Transparent Font 6pt
1 u8g2_font_luBS08_tf 20x12, 8 Pixel A, Transparent
2 u8g2_font_luBS10_tf 26x15, 10 Pixel A, Transparent
3 u8g2_font_luBS14_tf 35x22, 14 Pixel A, Transparent
4 u8g2_font_luBS18_tf 44x28, 18 Pixel A, Transparent
5 u8g2_font_luBS24_tf 61x40, 24 Pixel A, Transparent
6 u8g2_font_lucasarts_scumm_subtitle_o_tf Nice 12 Pixel Font, Transparent
7 u8g2_font_tenfatguys_tr 10 Pixel Font
8 u8g2_font_7Segments_26x42_mn 42 Pixel LCD Style Font
9/default u8g2_font_commodore64_tr 14x14 Pixel Font, used if Corename is shown as Text
10 u8g2_font_8bitclassic_tf 15x16 Pixel Font

Fonts can be checked here: https://github.com/olikraus/u8g2/wiki/fntlistall

Tip:
The absolute easiest way to get something written on the display is to use echo "text" > /tmp/CORENAME. Try it.

Command "CMDTZONE"

Only for DTI Boards.
Switch Temperatur Sensor Zone to internal/external.
Command: echo "CMDTZONE,x" > /dev/ttyUSB[x]

Parameter Function
x 0=internal Zone, 1=external Zone

Examples:
Set Sensor to external Zone: echo "CMDTZONE,1" > /dev/ttyUSB0
Set Sensor to internal Zone: echo "CMDTZONE,0" > /dev/ttyUSB0

Info
If you want to use the external Zone, you need an external PNP Transitor, like the MMBT3906, as Sensor.
MIC184 Datasheet: https://ww1.microchip.com/downloads/en/DeviceDoc/MIC184-Local-Remote-Thermal-Supervisor-DS20006457A.pdf

Command "CMDULED"

Only for DTI Boards.
Switch User LED on d.ti Board on/off (Board Version 1.1).
Switch User RGB LED off or on with Color (up from Board Version 1.2). (testing)
Command: echo "CMDULED,x" > /dev/ttyUSB[x]

Parameter Function
x d.ti Board v1.1: 0=LED off, 1=LED on
x d.ti Board >=v1.2: 0=WS2812B LED off, 1..255=WS2812B LED Color

Examples: Switch LED on: echo "CMDULED,1" > /dev/ttyUSB0
Switch LED off: echo "CMDULED,0" > /dev/ttyUSB0
Switch WS2812B LED on (Red): echo "CMDULED,1" > /dev/ttyUSB0
Switch WS2812B LED on (Yellow): echo "CMDULED,50" > /dev/ttyUSB0
Switch WS2812B LED on (Green): echo "CMDULED,100" > /dev/ttyUSB0
Switch WS2812B LED on (BLue): echo "CMDULED,150" > /dev/ttyUSB0
Switch WS2812B LED on (Red): echo "CMDULED,250" > /dev/ttyUSB0
Switch WS2812B LED off: echo "CMDULED,0" > /dev/ttyUSB0

Info:
The HSV Color Model is used for the WS2812B RGB LED. Saturation and Value are fixed set to 255.
Hue is the Command Parameter in the range 1..255.
See: https://github.com/FastLED/FastLED/wiki/FastLED-HSV-Colors

Command "CMDWRDTIV"

WIP, Write the DTIV Preferences Value, for d.ti Boards only.

Transition Effect List

Effect No. Effect
01 Fade In Left to Right
02 Fade In Top to Bottom
03 Fade In Right to Left
04 Fade In Bottom to Top
05 Fade In Even Line Left to Right / Odd Line Right to Left
06 Fade In Top Part Left to Right / Bottom Part Right to Left
07 Fade In Four Parts Left to Right to Left to Right...
08 Fade In 4 Parts, Top-Left => Bottom-Right => Top-Right => Bottom-Left
09 Fade In Particle Effect
10 Fade In Left to Right Diagonally
11 Slide In Left to Right
12 Slide In Top to Bottom
13 Slide In Right to Left
14 Slide In Bottom to Top
15 Fade In Top and Bottom to Center
16 Fade In Left and Right to Center
17 Fade In Center to Top and Bottom
18 Fade In Center to Left and Right
19 Fade In Warp, Center to Left, Right, Top and Bottom
20 Fade In Slightly Clockwise
21 Fade In Shaft
22 Fade In Waterfall
23 Fade In Chess
24 WIP