Add IEC62056 parsing, OLED timing, and batch LoRa send
This commit is contained in:
@@ -10,7 +10,8 @@ enum class DeviceRole : uint8_t {
|
||||
enum class PayloadType : uint8_t {
|
||||
MeterData = 0,
|
||||
TestCode = 1,
|
||||
TimeSync = 2
|
||||
TimeSync = 2,
|
||||
MeterBatch = 3
|
||||
};
|
||||
|
||||
constexpr uint8_t PROTOCOL_VERSION = 1;
|
||||
@@ -53,6 +54,9 @@ constexpr uint32_t TIME_SYNC_INTERVAL_SEC = 60;
|
||||
constexpr uint32_t OLED_PAGE_INTERVAL_MS = 4000;
|
||||
constexpr uint32_t OLED_AUTO_OFF_MS = 10UL * 60UL * 1000UL;
|
||||
constexpr uint32_t SENDER_OLED_READ_MS = 10000;
|
||||
constexpr uint32_t METER_SAMPLE_INTERVAL_MS = 1000;
|
||||
constexpr uint32_t METER_SEND_INTERVAL_MS = 30000;
|
||||
constexpr uint8_t METER_BATCH_MAX_SAMPLES = 30;
|
||||
|
||||
constexpr uint8_t NUM_SENDERS = 1;
|
||||
inline constexpr uint16_t EXPECTED_SENDER_IDS[NUM_SENDERS] = {
|
||||
|
||||
@@ -5,3 +5,5 @@
|
||||
|
||||
bool meterDataToJson(const MeterData &data, String &out_json);
|
||||
bool jsonToMeterData(const String &json, MeterData &data);
|
||||
bool meterBatchToJson(const MeterData *samples, size_t count, String &out_json);
|
||||
bool jsonToMeterBatch(const String &json, MeterData *out_samples, size_t max_count, size_t &out_count);
|
||||
|
||||
@@ -7,4 +7,5 @@ void power_sender_init();
|
||||
void power_receiver_init();
|
||||
void read_battery(MeterData &data);
|
||||
uint8_t battery_percent_from_voltage(float voltage_v);
|
||||
void light_sleep_ms(uint32_t ms);
|
||||
void go_to_deep_sleep(uint32_t seconds);
|
||||
|
||||
Reference in New Issue
Block a user