Moved serial controller comm to taskmanager
This commit is contained in:
@ -186,7 +186,7 @@ set(headers
|
|||||||
qrimport.h
|
qrimport.h
|
||||||
rotary.h
|
rotary.h
|
||||||
screens.h
|
screens.h
|
||||||
serial.h
|
serial_bobby.h
|
||||||
settings.h
|
settings.h
|
||||||
settingspersister.h
|
settingspersister.h
|
||||||
settingsutils.h
|
settingsutils.h
|
||||||
@ -402,7 +402,7 @@ set(sources
|
|||||||
qrimport.cpp
|
qrimport.cpp
|
||||||
rotary.cpp
|
rotary.cpp
|
||||||
screens.cpp
|
screens.cpp
|
||||||
serial.cpp
|
serial_bobby.cpp
|
||||||
settings.cpp
|
settings.cpp
|
||||||
settingspersister.cpp
|
settingspersister.cpp
|
||||||
settingsutils.cpp
|
settingsutils.cpp
|
||||||
|
@ -122,17 +122,6 @@ extern "C" void app_main()
|
|||||||
task.setup();
|
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
|
#ifdef FEATURE_LEDSTRIP
|
||||||
bootLabel.redraw("LED strip");
|
bootLabel.redraw("LED strip");
|
||||||
initLedStrip();
|
initLedStrip();
|
||||||
@ -250,11 +239,6 @@ extern "C" void app_main()
|
|||||||
performance.lastTime = now;
|
performance.lastTime = now;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FEATURE_SERIAL
|
|
||||||
for (Controller &controller : controllers)
|
|
||||||
controller.parser.update();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef FEATURE_OTA
|
#ifdef FEATURE_OTA
|
||||||
handleOta();
|
handleOta();
|
||||||
#endif
|
#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"
|
#include "can.h"
|
||||||
#endif
|
#endif
|
||||||
#include "debuginputhandler.h"
|
#include "debuginputhandler.h"
|
||||||
|
#ifdef FEATURE_SERIAL
|
||||||
|
#include "serial_bobby.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
using namespace std::chrono_literals;
|
using namespace std::chrono_literals;
|
||||||
|
|
||||||
@ -87,6 +90,9 @@ espcpputils::SchedulerTask schedulerTasksArr[] {
|
|||||||
espcpputils::SchedulerTask { "can", can::initCan, can::parseCanInput, 50ms },
|
espcpputils::SchedulerTask { "can", can::initCan, can::parseCanInput, 50ms },
|
||||||
#endif
|
#endif
|
||||||
espcpputils::SchedulerTask { "debuginput", initDebugInput, handleDebugInput, 50ms },
|
espcpputils::SchedulerTask { "debuginput", initDebugInput, handleDebugInput, 50ms },
|
||||||
|
#ifdef FEATURE_SERIAL
|
||||||
|
espcpputils::SchedulerTask { "serial", initSerial, updateSerial, 50ms },
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user