I have an ESP32 running IO reading, processing and writing functions using TaskManagerIO and the IoAbstraction libraries which have been fantastic.
If I understand correctly all these tasks will be running on one default core of the ESP32 (say core 1)
I have now added a serial interface and would like it to run on the other core (say core 0) of ESP32 so as to isolate interface handling from the real-time functions.
Does anyone have suggestions on an appropriate way for this is done with or alongside TaskManagerIO?
// tasks to run on core 1
taskManager.scheduleFixedRate(FAST_UPDATE_INTERVAL, [] {
updateRelays();
}, TIME_MILLIS);
taskManager.scheduleFixedRate(ANALOG_ALARM_UPDATE_INTERVAL, [] {
processAnalogAlarms();
}, TIME_MILLIS);
taskManager.scheduleFixedRate(LED_UPDATE_INTERVAL, [] {
updateLEDs();
}, TIME_MILLIS);
// Task to run on core 0
taskManager.scheduleFixedRate(100, [] {
if (MySUI.checkForUser(0)) {
/* Now we keep handling the serial user's
** requests until they exit or timeout.
*/
if (MySUI.userPresent()) {
// actually respond to requests, using
for(int i=1; i <=100; i++){
MySUI.handleRequests();
}
}
} /* end if we had a user on the serial line */
}, TIME_MILLIS);