Moved espnow into task manager

This commit is contained in:
2021-12-19 16:48:42 +01:00
parent b3299c8325
commit 058745abd5
4 changed files with 7 additions and 18 deletions

View File

@ -21,6 +21,7 @@ void initDebugInput()
{
Serial.begin(115200);
//Serial.setDebugOutput(true);
pinMode(3, INPUT_PULLUP);
}
void handleDebugInput()

View File

@ -41,9 +41,6 @@ using namespace std::chrono_literals;
#endif
#include "drivingstatistics.h"
#include "newsettings.h"
#ifdef FEATURE_ESPNOW
#include "espnowfunctions.h"
#endif
#include "taskmanager.h"
namespace {
@ -64,10 +61,6 @@ extern "C" void app_main()
digitalWrite(PINS_LEDBACKLIGHT, ledBacklightInverted ? LOW : HIGH);
#endif
pinMode(3, INPUT_PULLUP);
currentlyReverseBeeping = false;
initScreen();
bootLabel.redraw("settings");
@ -103,9 +96,6 @@ extern "C" void app_main()
task.setup();
}
for (Controller &controller : controllers)
controller.command.buzzer = {};
currentMode = &modes::defaultMode;
#ifdef FEATURE_CLOUD
@ -137,9 +127,6 @@ extern "C" void app_main()
}
}
#endif
#ifdef FEATURE_ESPNOW
espnow::initESPNow();
#endif
while (true)
{
@ -197,10 +184,6 @@ extern "C" void app_main()
performance.lastTime = now;
}
#ifdef FEATURE_ESPNOW
espnow::handle();
#endif
#ifdef FEATURE_CLOUD
if (!lastCloudCollect || now - *lastCloudCollect >= std::chrono::milliseconds{settings.boardcomputerHardware.timersSettings.cloudCollectRate})
{

View File

@ -60,6 +60,9 @@
#ifdef FEATURE_LEDSTRIP
#include "ledstrip.h"
#endif
#ifdef FEATURE_ESPNOW
#include "espnowfunctions.h"
#endif
using namespace std::chrono_literals;
@ -117,6 +120,8 @@ espcpputils::SchedulerTask schedulerTasksArr[] {
#ifdef FEATURE_LEDSTRIP
espcpputils::SchedulerTask { "ledstrip", initLedStrip, updateLedStrip, 30ms },
#endif
#ifdef FEATURE_ESPNOW
espcpputils::SchedulerTask { "espnow", espnow::initESPNow, espnow::handle, 100ms },
};
} // namespace

View File

@ -5,7 +5,7 @@
using namespace std::chrono_literals;
bool currentlyReverseBeeping;
bool currentlyReverseBeeping{};
bool reverseBeepToggle;
espchrono::millis_clock::time_point lastReverseBeepToggle;