figments: renderer: store last figment name for crash reporting purposes

This commit is contained in:
Torrie Fischer 2023-12-11 07:50:28 +01:00
parent ddc3804ae0
commit ad9d6649c9
2 changed files with 15 additions and 0 deletions

View File

@ -3,6 +3,18 @@
#include <ArduinoLog.h>
#ifndef __NOINIT_ATTR // Pre-defined on esp32
#define __NOINIT_ATTR __attribute__ ((section (".noinit")))
#endif
__NOINIT_ATTR const char* s_lastFigmentName;
const char*
Renderer::lastFigmentName()
{
return s_lastFigmentName;
}
void
Renderer::loop()
{
@ -13,6 +25,7 @@ Renderer::loop()
unsigned int frameStart = ESP.getCycleCount();
#endif
Log.verbose("Render %s", figment->name);
s_lastFigmentName = figment->name;
figment->render(dpy);
#if defined(BOARD_ESP32) or defined(BOARD_ESP8266)
unsigned int runtime = (ESP.getCycleCount() - frameStart) / 160000;

View File

@ -10,6 +10,8 @@ public:
void loop() override;
void onStart() override;
static const char* lastFigmentName();
private:
const std::vector<Figment*> m_figments;
const std::vector<Display*> m_displays;