ZPP and ZSU updates (WebSocket service)
ZPP and ZSU updates (WebSocket service)
This module contains implementations of some of ZIMO's ULF_COM protocols. These serial protocols are mainly used to update decoder firmware or sound.
Before we go deeper into the implementation, here is a graphical overview of the different operating modes and their transitions from the official documentation. The transitions themselves are handled by the USB receive task.
Details on the individual protocols can be found in the corresponding GitHub repositories.
This function basically does nothing except set the function pointer for the corresponding protocol tasks:
This task is created by the USB receive task when a DCC_EIN\r
protocol string is received. Once running the task scans the CDC character stream for strings with pattern senddcc([\d0-9a-fA-F]{2})+\r
, converts them to DCC packets and then transmits them to drv::out::tx_message_buffer.
If no further senddcc string is received before the HTTP receive timeout, the USB receive task is created and this task destroys itself.
This task is created by the USB receive task when a DECUP_EIN\r
protocol string is received. Unfortunately, the protocol itself is stateful and requires its own receiver class. An instance of this receiver on the stack takes care of decoding the raw USB data to DECUP packets. Those packets are then transmitted to drv::out::tx_message_buffer.
A special feature of this protocol is that the RTS line is used to switch the track voltage on and off. For this reason, the RTS line is monitored and its state is stored in a global variable intf::usb::rts.
At the end of an upload, the USB receive task is created and this task destroys itself.
This task is created by the USB receive task when a SUSIV2\r
protocol string is received. Once running the task scans the CDC character stream for SUSIV2 frames, converts them to ZUSI packets and transmits them to drv::out::tx_message_buffer.
Upon receiving an exit command the USB receive task is created and this task destroys itself.
ZPP updates (WebSocket service)