renderbug-cpp/lib/Figments/Renderer.cpp

33 lines
745 B
C++
Raw Normal View History

2019-05-10 05:17:29 +00:00
#include "./Renderer.h"
#include "./Display.h"
2021-03-29 08:10:55 +00:00
#include <ArduinoLog.h>
2019-05-10 05:17:29 +00:00
void
Renderer::loop()
{
for(Display* dpy : m_displays) {
for(Figment* figment : m_figments) {
if (figment->state == Task::Running) {
2021-04-10 18:10:25 +00:00
unsigned int frameStart = ESP.getCycleCount();
2019-05-10 05:17:29 +00:00
figment->render(dpy);
2021-04-10 18:10:25 +00:00
unsigned int runtime = (ESP.getCycleCount() - frameStart) / 160000;
if (runtime >= 8) {
Log.notice("SLOW RENDER: %s took %dms!", figment->name, runtime);
}
2019-05-10 05:17:29 +00:00
}
};
}
2021-03-29 08:10:55 +00:00
FastLED.show();
FastLED.countFPS();
2019-05-10 05:17:29 +00:00
}
void
Renderer::onStart()
{
for(Display* dpy : m_displays) {
dpy->clear();
}
2021-03-29 08:10:55 +00:00
FastLED.show();
2019-05-10 05:17:29 +00:00
}