| 75 | } |
| 76 | |
| 77 | void ModbusServerRTU::doBegin(uint32_t baudRate, int coreID, uint32_t userInterval) { |
| 78 | // Task already running? Stop it in case. |
| 79 | end(); |
| 80 | |
| 81 | // Set minimum interval time |
| 82 | MSRinterval = RTUutils::calculateInterval(baudRate); |
| 83 | |
| 84 | // If user defined interval is longer, use that |
| 85 | if (MSRinterval < userInterval) { |
| 86 | MSRinterval = userInterval; |
| 87 | } |
| 88 | |
| 89 | // Create unique task name |
| 90 | char taskName[18]; |
| 91 | snprintf(taskName, 18, "MBsrv%02XRTU", instanceCounter); |
| 92 | |
| 93 | // Start task to handle the client |
| 94 | xTaskCreatePinnedToCore((TaskFunction_t)&serve, taskName, SERVER_TASK_STACK, this, 8, &serverTask, coreID >= 0 ? coreID : tskNO_AFFINITY); |
| 95 | |
| 96 | } |
| 97 | |
| 98 | // end: kill server task |
| 99 | void ModbusServerRTU::end() { |
nothing calls this directly
no test coverage detected