Skip to content

Commit

Permalink
Move alarm messages from heap to stack
Browse files Browse the repository at this point in the history
  • Loading branch information
tbnobody committed Apr 15, 2023
1 parent fc5f688 commit bec9870
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/Hoymiles/src/parser/AlarmLogParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "../Hoymiles.h"
#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, 2, "DTU command failed" },
{ AlarmMessageType_t::ALL, 121, "Over temperature protection" },
Expand Down Expand Up @@ -83,7 +83,7 @@ const std::list<AlarmMessage_t> AlarmLogParser::_alarmMessages = {
{ AlarmMessageType_t::ALL, 5200, "Firmware error" },
{ AlarmMessageType_t::ALL, 8310, "Shut down" },
{ AlarmMessageType_t::ALL, 9000, "Microinverter is suspected of being stolen" },
};
}};

void AlarmLogParser::clearBuffer()
{
Expand Down
4 changes: 2 additions & 2 deletions lib/Hoymiles/src/parser/AlarmLogParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include "Parser.h"
#include <Arduino.h>
#include <cstdint>
#include <list>
#include <array>

#define ALARM_LOG_ENTRY_COUNT 15
#define ALARM_LOG_ENTRY_SIZE 12
Expand Down Expand Up @@ -50,5 +50,5 @@ class AlarmLogParser : public Parser {

AlarmMessageType_t _messageType = AlarmMessageType_t::ALL;

static const std::list<AlarmMessage_t> _alarmMessages;
static const std::array<const AlarmMessage_t, 76> _alarmMessages;
};

0 comments on commit bec9870

Please sign in to comment.