diff --git a/server/src/README.md b/server/src/README.md deleted file mode 100644 index 7f0bc7ec..00000000 --- a/server/src/README.md +++ /dev/null @@ -1,11 +0,0 @@ -# Server Structure - -- `/server`: Is Backend part that makes connection between Beckhoff and Electron. Implements machine logic. - -## EtherCAT - -- `/ethercat`: Implements logic of EtherCAT - -## Serial - -- `/serial`: Implements logic of Serial, starting from serial device detection ending with serial device registration as machine diff --git a/server/src/serial.md b/server/src/serial.md deleted file mode 100644 index 4c240349..00000000 --- a/server/src/serial.md +++ /dev/null @@ -1,56 +0,0 @@ -# Serial Devices -Serial communication interface through which information transfers in or out sequentially one bit at a time. - -`Important NOTE: Vendor ID 0x0403 and Product ID 0x6001 is not Vendor & Product ID of Laser, but USB Modbus itself.` - -Current Serial Devices: -- Laser, connected through RTU Modbus (USB). - -## Current Serial Detection (./server/src/serial/serial_detection.rs) -Serial Detection contains 3 main components: -- `Serial Registry`, the interface that is used as buffer for all registered Serial Devices, and responsible for start of registered Serial Devices and returns link to started Serial Device. (./control-core/src/serial/registry.rs) -- `Connected Serial USB`, the hashmap that saves the path to USB port with the link to started Serial Device under this port path. -- `Ports`, previously detected USB ports with pathes and usb port information (such as Vendor & Product ID, Serial Number) - -The cycle of Serial Detection is consisted from following steps: - -`1)` Detection of all current Serial Connections - -`2)` Extraction of USB Port connections (only this type of connection contains information about vid and pid of modbus itself) - -`3)` Comparison of previously detected USB ports with currently detected USB ports (from the step 2) - -`4)` Resave previously detected USB ports with current ports - -`5)` Start connection of newly detected ports with Serial Registry and save the path to the port with the link to started Serial Device to `Connected Serial USB` - -`6)` Remove serial ports from `Connected Serial USB` that was not detected (in the step 2) - -`7)` The last step is to check whether the connection with the serial devices is still active. Using the `Connected Devices` parameters or functions, we can verify if the serial device can still fulfill its functionalities. If not, the link to the connected device should be resaved with a disconnection message. -The next step is to check if the devices that were previously disconnected or unable to establish a connection can now connect to the serial device during this iteration. If they can, save the link to the device in `Connected Serial USB`. - -## Laser (/server/src/machines/laser/new.rs) -Laser Device has simple structure, it has two parameters (measured diameter) and the path to the serial port, for communication establishment. Also it is connected to the Trait of all Serial Devices. - -- After the start of Laser, it will constantly update measured diameter parameter, under current Configurations of Modbus RTU connection (30 diameter updates per second). -- If Connection could not be established with Laser 10 times in a row, then diameter update will stop, and instead of diameter parameter will be error message. -- Diameter Update is running as a separate thread task. - -### Current Laser Parameters -`1)` Baud Rate 38400 (for maximum efficiency) - -`2)` 8 bits per character. - -`3)` No parity bit. - -`4)` One stop bit. - -## Serial Init Loop (/server/src/serial/init.rs) -The main task of Serial Init loop is to run `Serial Detection` as a separate thread task. It executes `Cycle of Serial Detection` each 300 ms. - -## Serial SERIAL_DETECTION lazy static (/server/src/serial/register.rs) -The main goal is to create a global Serial Detection static using already registered Serial Product Configurations. These configurations should be accessible and updatable from different thread tasks. - -## TODO list -- We need to assign Vendor & Product ID of Laser separately as machine. -- Remake retry connection, so it will work for all devices and not only Laser specific