49inline static constexpr size_t lineSize(
size_t tagLen,
size_t valueLen)
51 return 1 + tagLen + 1 + valueLen + 1 + 1 + 1;
147 static const char STX{ 0x02 };
148 static const char ETX{ 0x03 };
149 static const char LF{ 0x0A };
150 static const char CR{ 0x0D };
151 static const char TAB{ 0x09 };
165 auto* ptr =
buffer + startPos;
166 const auto* end =
buffer + endPos;
169 while (ptr + 4 <= end)
183 return (sum & 0x3F) + 0x20;
219 void send(
const char* tag, int16_t value, uint8_t
index = 0)
225 writeTag(tag,
index);
A class for managing and sending telemetry information in a structured frame format.
__attribute__((always_inline)) void endFrame()
Finalizes the frame by adding the end character and sending the buffer over Serial.
void send(const char *tag, int16_t value, uint8_t index=0)
Sends a telemetry value as an integer.
uint8_t calculateChecksum(size_t startPos, size_t endPos) const
Calculates the checksum for a portion of the buffer.
char buffer[calcBufferSize()]
__attribute__((always_inline)) void writeTag(const char *tag
Writes a tag to the buffer.
__attribute__((always_inline)) void startFrame()
Initializes a new frame by resetting the buffer and adding the start character.
Configuration values to be set by the end-user.
constexpr bool RELAY_DIVERSION
constexpr TemperatureSensing temperatureSensing
constexpr RelayEngine relays
constexpr uint8_t NO_OF_DUMPLOADS
constexpr bool TEMP_SENSOR_PRESENT
Basic configuration values to be set by the end-user.
constexpr uint8_t NO_OF_PHASES
static constexpr size_t calcBufferSize()
Calculates the total buffer size required for the telemetry frame.
static constexpr size_t lineSize(size_t tagLen, size_t valueLen)
Calculates the size of a single telemetry line in the frame.
constexpr size_t size(const _Tp(&)[_Nm]) noexcept
Helper function to retrieve the dimension of a C-array.