.. _command_line:

Command Line Interface
======================

This section describes the command line interface located on the UART interface.
The command line interface is implemented using a "shellmatta" shell module <https://git.shimatta.net/shimatta/shellmatta>

Hardware Settings
-----------------

General Settings
~~~~~~~~~~~~~~~~

The UART is configured for the following settings:

- 115200 Baud
- 1 Stopbit
- No parity
- 8 data bits


Setup in Debug Build
~~~~~~~~~~~~~~~~~~~~

If the Reflow controller is build in **debug** mode, the UART is located on the internal spring contact connector, which is also used for the SWD interface.

Setup in Release Build
~~~~~~~~~~~~~~~~~~~~~~

In case of a **release** build, the UART is externally accessible on the DIGIO Header. The voltage level is 3.3 Volt LVCMOS. The inputs are ESD protected. Overvoltage is interally clamped and may dammage the clamping diodes!

- DIGIO2: Reflow Controller's TX
- DIGIO3: Reflow Controller's RX


Shell Commands
--------------

The following shell commands are available.

- `safety-flags <safety-flags_>`_ (alias: flags)
- `calibrate`_ (alias: cal)

safety-flags
~~~~~~~~~~~~

The ``safety-flags`` (``flags``) command displays the status of all safety flags and analog monitors. See: :ref:`safety_flags`


.. _shell_command_calibrate:

calibrate
~~~~~~~~~

The ``calibrate`` (``cal``) command is used to calibrate the :ref:`hw_analog_fe`, in order to ensure correct resistance measurement.
Calibration is most likely not necessary! See the :ref:`usage_calibration` page.

The command will guide you through the calibration process and will ask for two reference resistors with ``1000 Ohm`` and ``2000 Ohm`` values.
Calibration can be aborted using ``CTRL + C``.


.. _shell_command_hang:

hang
~~~~

The ``hang`` command hangs the main-loop in an infinite loop. This function tests, whether the controller is correctly rescued by the watchdog.


.. _shell_command_ui_emulate:

ui-emulate
~~~~~~~~~~

The ``ui-emulate`` command emulates the rotary encoder and button from the shell. The following keys are available:

========== ================================
Key        Emulation
========== ================================
``CTRL+C`` Exit the command
``ENTER``  Button press: short released
``s``      Rotary Encoder: anti-clockwise
``w``      Rotary Encoder: clockwise
``l``      Button press: long
``k``      Button press: short
``r``      Button press: long released
========== ================================
