16#include <ArduinoJson.h>
49#define PROJECT_PATH (__FILE__)
53#define BRANCH_NAME ("N/A")
56#define COMMIT_HASH ("N/A")
61 DBUGLN(F(
"----------------------------------"));
62 DBUG(F(
"Sketch ID: "));
65 DBUG(F(
"From branch '"));
67 DBUG(F(
"', commit "));
78 DBUGLN(F(
"ADC mode: free-running"));
80 DBUGLN(F(
"Electrical settings"));
83 DBUG(F(
"\tf_powerCal for L"));
86 DBUGLN(f_powerCal[phase], 6);
88 DBUG(F(
"\tf_voltageCal, for Vrms_L"));
91 DBUGLN(f_voltageCal[phase], 5);
94 DBUG(F(
"\tf_phaseCal for all phases = "));
97 DBUG(F(
"\tExport rate (Watts) = "));
100 DBUG(F(
"\tzero-crossing persistence (sample sets) = "));
105 DBUG(F(
"Temperature capability "));
112 DBUGLN(F(
"is NOT present"));
115 DBUG(F(
"Dual-tariff capability "));
123 DBUGLN(F(
"is NOT present"));
126 DBUG(F(
"Load rotation feature "));
133 DBUGLN(F(
"is NOT present"));
136 DBUG(F(
"Relay diversion feature "));
141 relays.printConfiguration();
145 DBUGLN(F(
"is NOT present"));
148 DBUG(F(
"RF capability "));
150 DBUG(F(
"IS present, Freq = "));
151 if (
FREQ == RF12_433MHZ)
153 else if (
FREQ == RF12_868MHZ)
157 DBUGLN(F(
"is NOT present"));
160 DBUG(F(
"Datalogging capability "));
163 DBUGLN(F(
"in Human-readable format"));
167 DBUGLN(F(
"in IoT format"));
171 DBUGLN(F(
"in EmonCMS format"));
175 DBUGLN(F(
"is NOT present"));
200 Serial.print(F(
"P:"));
206 Serial.print(F(
",P"));
207 Serial.print(idx + 1);
208 Serial.print(F(
":"));
209 Serial.print(
tx_data.power_L[idx]);
214 Serial.print(F(
",L"));
215 Serial.print(idx + 1);
216 Serial.print(F(
":"));
230 Serial.print(F(
",T"));
231 Serial.print(idx + 1);
232 Serial.print(F(
":"));
233 Serial.print(
tx_data.temperature_x100[idx] * 0.01F);
240 Serial.print(F(
",T:"));
241 Serial.print(bOffPeak ?
"low" :
"high");
243 Serial.println(F(
""));
264 Serial.print(F(
", P:"));
269 Serial.print(F(
"/"));
270 Serial.print(
relays.get_average());
275 Serial.print(F(
", P"));
276 Serial.print(phase + 1);
277 Serial.print(F(
":"));
278 Serial.print(
tx_data.power_L[phase]);
282 Serial.print(F(
", V"));
283 Serial.print(phase + 1);
284 Serial.print(F(
":"));
285 Serial.print((
float)
tx_data.Vrms_L_x100[phase] * 0.01F);
298 Serial.print(F(
", T"));
299 Serial.print(idx + 1);
300 Serial.print(F(
":"));
301 Serial.print((
float)
tx_data.temperature_x100[idx] * 0.01F);
305 Serial.print(F(
", (minSampleSets/MC "));
307 Serial.print(F(
", #ofSampleSets "));
312 Serial.print(F(
", NoED "));
316 Serial.println(F(
")"));
353 teleInfo.
send(
"R",
static_cast< int16_t
>(
relays.get_average()));
358 teleInfo.
send(
"R",
relays.get_relay(idx).isRelayON());
359 }
while (++idx <
relays.get_size());
365 teleInfo.
send(
"V",
tx_data.Vrms_L_x100[idx], idx + 1);
383 teleInfo.
send(
"T",
tx_data.temperature_x100[idx], idx + 1);
414 static bool startup{
true };
457 DBUGLN(F(
"Load Priorities: "));
480 extern int __heap_start, *__brkval;
482 return (
int)&v - (__brkval == 0 ? (int)&__heap_start : (int)__brkval);
Calibration values definition.
A class for managing and sending telemetry information in a structured frame format.
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.
void startFrame()
Initializes a new frame by resetting the buffer and adding the start character.
constexpr bool RELAY_DIVERSION
constexpr int networkGroup
constexpr TemperatureSensing temperatureSensing
constexpr RelayEngine relays
constexpr bool DUAL_TARIFF
constexpr SerialOutputType SERIAL_OUTPUT_TYPE
constexpr uint8_t NO_OF_DUMPLOADS
constexpr bool TEMP_SENSOR_PRESENT
constexpr int16_t REQUIRED_EXPORT_IN_WATTS
constexpr float invDATALOG_PERIOD_IN_MAINS_CYCLES
constexpr float invSUPPLY_FREQUENCY
constexpr uint8_t NO_OF_PHASES
constexpr int16_t DEVICE_DISCONNECTED_RAW
constexpr int16_t OUTOFRANGE_TEMPERATURE
Classes/types needed for dual-tariff support.
void printDualTariffConfiguration()
Print the settings for off-peak period.
void sendResults(bool bOffPeak)
Prints or sends telemetry data logs based on the selected output format.
void logLoadPriorities()
Prints the load priorities to the Serial output.
void printConfiguration()
Print the configuration during startup.
void printForEmonCMS(const bool bOffPeak)
Write telemetry data to Serial in EmonCMS format.
void printForSerialText()
Prints data logs to the Serial output in text format.
void printParamsForSelectedOutputMode()
Print the settings used for the selected output mode.
Public functions/variables of processing engine.
volatile uint8_t copyOf_lowestNoOfSampleSetsPerMainsCycle
constexpr uint8_t PERSISTENCE_FOR_POLARITY_CHANGE
uint8_t loadPrioritiesAndState[NO_OF_DUMPLOADS]
volatile float copyOf_energyInBucket_main
volatile uint16_t copyOf_sampleSetsDuringThisDatalogPeriod
PayloadTx_struct< NO_OF_PHASES > tx_data
volatile uint16_t absenceOfDivertedEnergyCount
volatile uint16_t copyOf_countLoadON[NO_OF_DUMPLOADS]
Manages telemetry data and frame formatting.
void sendTelemetryData()
Sends telemetry data using the TeleInfo class.
int freeRam()
Get the available RAM during setup.
Some utility functions for the RF chip.
void send_rf_data()
Send the logging data through RF.
Provides utilities for managing temperature sensors.