Moved espnow into task manager
This commit is contained in:
@ -21,6 +21,7 @@ void initDebugInput()
|
|||||||
{
|
{
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
//Serial.setDebugOutput(true);
|
//Serial.setDebugOutput(true);
|
||||||
|
pinMode(3, INPUT_PULLUP);
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleDebugInput()
|
void handleDebugInput()
|
||||||
|
@ -41,9 +41,6 @@ using namespace std::chrono_literals;
|
|||||||
#endif
|
#endif
|
||||||
#include "drivingstatistics.h"
|
#include "drivingstatistics.h"
|
||||||
#include "newsettings.h"
|
#include "newsettings.h"
|
||||||
#ifdef FEATURE_ESPNOW
|
|
||||||
#include "espnowfunctions.h"
|
|
||||||
#endif
|
|
||||||
#include "taskmanager.h"
|
#include "taskmanager.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@ -64,10 +61,6 @@ extern "C" void app_main()
|
|||||||
digitalWrite(PINS_LEDBACKLIGHT, ledBacklightInverted ? LOW : HIGH);
|
digitalWrite(PINS_LEDBACKLIGHT, ledBacklightInverted ? LOW : HIGH);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
pinMode(3, INPUT_PULLUP);
|
|
||||||
|
|
||||||
currentlyReverseBeeping = false;
|
|
||||||
|
|
||||||
initScreen();
|
initScreen();
|
||||||
|
|
||||||
bootLabel.redraw("settings");
|
bootLabel.redraw("settings");
|
||||||
@ -103,9 +96,6 @@ extern "C" void app_main()
|
|||||||
task.setup();
|
task.setup();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Controller &controller : controllers)
|
|
||||||
controller.command.buzzer = {};
|
|
||||||
|
|
||||||
currentMode = &modes::defaultMode;
|
currentMode = &modes::defaultMode;
|
||||||
|
|
||||||
#ifdef FEATURE_CLOUD
|
#ifdef FEATURE_CLOUD
|
||||||
@ -137,9 +127,6 @@ extern "C" void app_main()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef FEATURE_ESPNOW
|
|
||||||
espnow::initESPNow();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
@ -197,10 +184,6 @@ extern "C" void app_main()
|
|||||||
performance.lastTime = now;
|
performance.lastTime = now;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FEATURE_ESPNOW
|
|
||||||
espnow::handle();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef FEATURE_CLOUD
|
#ifdef FEATURE_CLOUD
|
||||||
if (!lastCloudCollect || now - *lastCloudCollect >= std::chrono::milliseconds{settings.boardcomputerHardware.timersSettings.cloudCollectRate})
|
if (!lastCloudCollect || now - *lastCloudCollect >= std::chrono::milliseconds{settings.boardcomputerHardware.timersSettings.cloudCollectRate})
|
||||||
{
|
{
|
||||||
|
@ -60,6 +60,9 @@
|
|||||||
#ifdef FEATURE_LEDSTRIP
|
#ifdef FEATURE_LEDSTRIP
|
||||||
#include "ledstrip.h"
|
#include "ledstrip.h"
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef FEATURE_ESPNOW
|
||||||
|
#include "espnowfunctions.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
using namespace std::chrono_literals;
|
using namespace std::chrono_literals;
|
||||||
|
|
||||||
@ -117,6 +120,8 @@ espcpputils::SchedulerTask schedulerTasksArr[] {
|
|||||||
#ifdef FEATURE_LEDSTRIP
|
#ifdef FEATURE_LEDSTRIP
|
||||||
espcpputils::SchedulerTask { "ledstrip", initLedStrip, updateLedStrip, 30ms },
|
espcpputils::SchedulerTask { "ledstrip", initLedStrip, updateLedStrip, 30ms },
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef FEATURE_ESPNOW
|
||||||
|
espcpputils::SchedulerTask { "espnow", espnow::initESPNow, espnow::handle, 100ms },
|
||||||
};
|
};
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
using namespace std::chrono_literals;
|
using namespace std::chrono_literals;
|
||||||
|
|
||||||
bool currentlyReverseBeeping;
|
bool currentlyReverseBeeping{};
|
||||||
bool reverseBeepToggle;
|
bool reverseBeepToggle;
|
||||||
espchrono::millis_clock::time_point lastReverseBeepToggle;
|
espchrono::millis_clock::time_point lastReverseBeepToggle;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user