49inline static constexpr size_t lineSize(
size_t tagLen,
size_t valueLen)
51 return 1 + tagLen + 1 + valueLen + 1 + 1 + 1;
157 static const char STX{ 0x02 };
158 static const char ETX{ 0x03 };
159 static const char LF{ 0x0A };
160 static const char CR{ 0x0D };
161 static const char TAB{ 0x09 };
175 auto* ptr =
buffer + startPos;
176 const auto* end =
buffer + endPos;
179 while (ptr + 4 <= end)
193 return (sum & 0x3F) + 0x20;
229 void send(
const char* tag, int16_t value, uint8_t
index = 0)
235 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.