MCPcopy Create free account
hub / github.com/dalathegreat/Battery-Emulator / doBegin

Method doBegin

Software/src/lib/eModbus-eModbus/ModbusServerRTU.cpp:77–96  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

75}
76
77void 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
99void ModbusServerRTU::end() {

Callers

nothing calls this directly

Calls 2

endFunction · 0.85
xTaskCreatePinnedToCoreFunction · 0.85

Tested by

no test coverage detected