# Thermo Printer Interface / Remote Control ## Overview This is about a device that can be called by WLAN / TCP/IP and prints on a cheap thermo printer using paper rolls. Hardware used: - ESP-CPU: - Wemos ESP32 LoLin (any ESP32 should work), we are using UART1 (GPIO26=Tx) - Wemos ESP8266 (any should work), we are using UART1 Tx only (GPIO2=Tx) - GOOJPRT QR204 Micro Embedded Printer with RS232/TTL and USB-Interface - TX, RX, GND connected to ESP32 - POWER connected to seperate power supply (+5V/GND) ## How to install this app - Install and start [mos tool](https://mongoose-os.com/software.html) - Switch to the Project page, find and import this app, build and flash it:

## Interface description / API usage As Mongoose-OS is used as platform for this software, all Mongoose-OS supported RPC-Mechanisms are supported, which are: - USB: Easiest is to start browser based UI ("> mos ui") or by following command line:
*mos --port /dev/ttyUSB0 call TP.Print '{"text": "Text to be printed"}'* - MQTT: *mos --port mqtt://my.mqtt.server:1883/esp32_6732ac call TP.Print '{"text": "Text to be printed"}'* - WS (WebSocket): *mos --port ws://192.168.0.206/rpc call TP.Print '{"text": "Text to be printed"}'* - RESTful HTTP call: *curl -d '{"text": "Text to be printed"}' 192.168.0.206/rpc/TP.Print* ## Printed Text Formatting The text to be printed is formatted using markdown notation (not fully supported, just "like markdown"). You may use following formattings: - lines starting with # are used as headlines, printed with double width and height - inline formattings used: - "\*" character is used to mark begin and end of emphasized strings, which are printed bold. Example: *Text to be \*emphasized** - "\_" underline character is used to mark begin and end of underlined text. Example: *Text to be \_underlined_* - Characters can be escaped using the "\\" character. This might be changed by configuration (config parameter tp.escapeCharacter, see Config-RPC service) ## Configuration You may use the Mongoose-OS configuration service to change the behaviour and interface of this module. E.g. use *"> mos --port /dev/USB0 config-get"* to get the current configuration and *"> mos --port /dev/USB0 config-set key=value"* to set a configuration value. The only specific configuration is everything that is defined under the "tp" key. MQTT, Wifi, debugging and other settings may be changed and are available from Mongoose-OS anyway. A shortcut to set the Wifi settings is: *"> mos --port /dev/USB0 wifi WIFI_NAME WIFI_PASSWORD"*. ## OTA The firmware may be updated using OTA services offered by Mongoose-OS (see https://mongoose-os.com/docs/book/ota.html).