Move alarm messages from heap to stack

This commit is contained in:
Thomas Basler 2023-03-28 20:04:10 +02:00
parent fc5f6887cb
commit bec9870347
2 changed files with 4 additions and 4 deletions

View File

@ -6,7 +6,7 @@
#include "../Hoymiles.h" #include "../Hoymiles.h"
#include <cstring> #include <cstring>
const std::list<AlarmMessage_t> AlarmLogParser::_alarmMessages = { const std::array<const AlarmMessage_t, 76> AlarmLogParser::_alarmMessages = {{
{ AlarmMessageType_t::ALL, 1, "Inverter start" }, { AlarmMessageType_t::ALL, 1, "Inverter start" },
{ AlarmMessageType_t::ALL, 2, "DTU command failed" }, { AlarmMessageType_t::ALL, 2, "DTU command failed" },
{ AlarmMessageType_t::ALL, 121, "Over temperature protection" }, { AlarmMessageType_t::ALL, 121, "Over temperature protection" },
@ -83,7 +83,7 @@ const std::list<AlarmMessage_t> AlarmLogParser::_alarmMessages = {
{ AlarmMessageType_t::ALL, 5200, "Firmware error" }, { AlarmMessageType_t::ALL, 5200, "Firmware error" },
{ AlarmMessageType_t::ALL, 8310, "Shut down" }, { AlarmMessageType_t::ALL, 8310, "Shut down" },
{ AlarmMessageType_t::ALL, 9000, "Microinverter is suspected of being stolen" }, { AlarmMessageType_t::ALL, 9000, "Microinverter is suspected of being stolen" },
}; }};
void AlarmLogParser::clearBuffer() void AlarmLogParser::clearBuffer()
{ {

View File

@ -3,7 +3,7 @@
#include "Parser.h" #include "Parser.h"
#include <Arduino.h> #include <Arduino.h>
#include <cstdint> #include <cstdint>
#include <list> #include <array>
#define ALARM_LOG_ENTRY_COUNT 15 #define ALARM_LOG_ENTRY_COUNT 15
#define ALARM_LOG_ENTRY_SIZE 12 #define ALARM_LOG_ENTRY_SIZE 12
@ -50,5 +50,5 @@ private:
AlarmMessageType_t _messageType = AlarmMessageType_t::ALL; AlarmMessageType_t _messageType = AlarmMessageType_t::ALL;
static const std::list<AlarmMessage_t> _alarmMessages; static const std::array<const AlarmMessage_t, 76> _alarmMessages;
}; };