Moved serial controller comm to taskmanager
This commit is contained in:
@ -186,7 +186,7 @@ set(headers
|
||||
qrimport.h
|
||||
rotary.h
|
||||
screens.h
|
||||
serial.h
|
||||
serial_bobby.h
|
||||
settings.h
|
||||
settingspersister.h
|
||||
settingsutils.h
|
||||
@ -402,7 +402,7 @@ set(sources
|
||||
qrimport.cpp
|
||||
rotary.cpp
|
||||
screens.cpp
|
||||
serial.cpp
|
||||
serial_bobby.cpp
|
||||
settings.cpp
|
||||
settingspersister.cpp
|
||||
settingsutils.cpp
|
||||
|
@ -122,17 +122,6 @@ extern "C" void app_main()
|
||||
task.setup();
|
||||
}
|
||||
|
||||
#ifdef FEATURE_SERIAL
|
||||
bootLabel.redraw("front Serial begin");
|
||||
controllers.front.serial.get().begin(38400, SERIAL_8N1, PINS_RX1, PINS_TX1);
|
||||
|
||||
bootLabel.redraw("back Serial begin");
|
||||
controllers.back.serial.get().begin(38400, SERIAL_8N1, PINS_RX2, PINS_TX2);
|
||||
|
||||
bootLabel.redraw("swap front back");
|
||||
updateSwapFrontBack();
|
||||
#endif
|
||||
|
||||
#ifdef FEATURE_LEDSTRIP
|
||||
bootLabel.redraw("LED strip");
|
||||
initLedStrip();
|
||||
@ -250,11 +239,6 @@ extern "C" void app_main()
|
||||
performance.lastTime = now;
|
||||
}
|
||||
|
||||
#ifdef FEATURE_SERIAL
|
||||
for (Controller &controller : controllers)
|
||||
controller.parser.update();
|
||||
#endif
|
||||
|
||||
#ifdef FEATURE_OTA
|
||||
handleOta();
|
||||
#endif
|
||||
|
27
main/serial_bobby.cpp
Normal file
27
main/serial_bobby.cpp
Normal file
@ -0,0 +1,27 @@
|
||||
#include "serial_bobby.h"
|
||||
|
||||
// local includes
|
||||
#include "globals.h"
|
||||
#include "screens.h"
|
||||
|
||||
#ifdef FEATURE_SERIAL
|
||||
|
||||
void initSerial()
|
||||
{
|
||||
bootLabel.redraw("front Serial begin");
|
||||
controllers.front.serial.get().begin(38400, SERIAL_8N1, PINS_RX1, PINS_TX1);
|
||||
|
||||
bootLabel.redraw("back Serial begin");
|
||||
controllers.back.serial.get().begin(38400, SERIAL_8N1, PINS_RX2, PINS_TX2);
|
||||
|
||||
bootLabel.redraw("swap front back");
|
||||
updateSwapFrontBack();
|
||||
}
|
||||
|
||||
void updateSerial()
|
||||
{
|
||||
for (Controller &controller : controllers)
|
||||
controller.parser.update();
|
||||
}
|
||||
|
||||
#endif
|
8
main/serial_bobby.h
Normal file
8
main/serial_bobby.h
Normal file
@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef FEATURE_SERIAL
|
||||
|
||||
void initSerial();
|
||||
void updateSerial();
|
||||
|
||||
#endif
|
@ -45,6 +45,9 @@
|
||||
#include "can.h"
|
||||
#endif
|
||||
#include "debuginputhandler.h"
|
||||
#ifdef FEATURE_SERIAL
|
||||
#include "serial_bobby.h"
|
||||
#endif
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
@ -87,6 +90,9 @@ espcpputils::SchedulerTask schedulerTasksArr[] {
|
||||
espcpputils::SchedulerTask { "can", can::initCan, can::parseCanInput, 50ms },
|
||||
#endif
|
||||
espcpputils::SchedulerTask { "debuginput", initDebugInput, handleDebugInput, 50ms },
|
||||
#ifdef FEATURE_SERIAL
|
||||
espcpputils::SchedulerTask { "serial", initSerial, updateSerial, 50ms },
|
||||
#endif
|
||||
};
|
||||
} // namespace
|
||||
|
||||
|
Reference in New Issue
Block a user