From dce4db7dd68f164c666856b0bbebf2ba525f547a Mon Sep 17 00:00:00 2001 From: Ruben Andreassen Date: Sun, 23 Sep 2018 19:16:33 +0200 Subject: [PATCH] Added one-phase meter --- .../HanReader/src/HanReader.cpp | 28 ++++----- .../HanReader/src/Kamstrup.h | 57 ++++++++++++++++++- 2 files changed, 70 insertions(+), 15 deletions(-) diff --git a/Arduino Code/Arduino Libraries/HanReader/src/HanReader.cpp b/Arduino Code/Arduino Libraries/HanReader/src/HanReader.cpp index 69ca424b..76c10e16 100644 --- a/Arduino Code/Arduino Libraries/HanReader/src/HanReader.cpp +++ b/Arduino Code/Arduino Libraries/HanReader/src/HanReader.cpp @@ -60,20 +60,20 @@ bool HanReader::read(byte data) void HanReader::debugPrint(byte *buffer, int start, int length) { - for (int i = start; i < start + length; i++) - { - if (buffer[i] < 0x10) - debug->print("0"); - debug->print(buffer[i], HEX); - debug->print(" "); - if ((i - start + 1) % 16 == 0) - debug->println(""); - else if ((i - start + 1) % 4 == 0) - debug->print(" "); - - yield(); // Let other get some resources too - } - debug->println(""); + for (int i = start; i < start + length; i++) + { + if (buffer[i] < 0x10) + debug->print("0"); + debug->print(buffer[i], HEX); + debug->print(" "); + if ((i - start + 1) % 16 == 0) + debug->println(""); + else if ((i - start + 1) % 4 == 0) + debug->print(" "); + + yield(); // Let other get some resources too + } + debug->println(""); } bool HanReader::read() diff --git a/Arduino Code/Arduino Libraries/HanReader/src/Kamstrup.h b/Arduino Code/Arduino Libraries/HanReader/src/Kamstrup.h index 609628d5..49427a17 100644 --- a/Arduino Code/Arduino Libraries/HanReader/src/Kamstrup.h +++ b/Arduino Code/Arduino Libraries/HanReader/src/Kamstrup.h @@ -7,7 +7,9 @@ enum class Kamstrup { List1 = 0x19, - List2 = 0x23 + List2 = 0x23, + List3 = 0x11, + List4 = 0x1B }; enum class Kamstrup_List1 @@ -81,6 +83,59 @@ enum class Kamstrup_List2 CumulativeReactiveExportEnergy }; +enum class Kamstrup_List3 +{ + ListSize, + ListVersionIdentifier, + MeterID_OBIS, + MeterID, + MeterType_OBIS, + MeterType, + ActiveImportPower_OBIS, + ActiveImportPower, + ActiveExportPower_OBIS, + ActiveExportPower, + ReactiveImportPower_OBIS, + ReactiveImportPower, + ReactiveExportPower_OBIS, + ReactiveExportPower, + CurrentL1_OBIS, + CurrentL1, + VoltageL1_OBIS, + VoltageL1 +}; + +enum class Kamstrup_List4 +{ + ListSize, + ListVersionIdentifier, + MeterID_OBIS, + MeterID, + MeterType_OBIS, + MeterType, + ActiveImportPower_OBIS, + ActiveImportPower, + ActiveExportPower_OBIS, + ActiveExportPower, + ReactiveImportPower_OBIS, + ReactiveImportPower, + ReactiveExportPower_OBIS, + ReactiveExportPower, + CurrentL1_OBIS, + CurrentL1, + VoltageL1_OBIS, + VoltageL1, + MeterClock_OBIS, + MeterClock, + CumulativeActiveImportEnergy_OBIS, + CumulativeActiveImportEnergy, + CumulativeActiveExportEnergy_OBIS, + CumulativeActiveExportEnergy, + CumulativeReactiveImportEnergy_OBIS, + CumulativeReactiveImportEnergy, + CumulativeReactiveExportEnergy_OBIS, + CumulativeReactiveExportEnergy +}; #endif