diff --git a/src/lib/ebus/data.cpp b/src/lib/ebus/data.cpp index 569c9353..6957c99c 100644 --- a/src/lib/ebus/data.cpp +++ b/src/lib/ebus/data.cpp @@ -47,8 +47,8 @@ static const dataType_t dataTypes[] = { {"HEX",16*8,bt_hexstr, ADJ, 0, 2, 47, 0, 0}, // >= 1 byte hex digit string, usually separated by space, e.g. 0a 1b 2c 3d {"BDA", 32, bt_dat, BCD, 0, 10, 10, 0, 0}, // date with weekday in BCD, 01.01.2000 - 31.12.2099 (0x01,0x01,WW,0x00 - 0x31,0x12,WW,0x99, WW is weekday Mon=0x00 - Sun=0x06) {"BDA", 24, bt_dat, BCD, 0, 10, 10, 0, 0}, // date in BCD, 01.01.2000 - 31.12.2099 (0x01,0x01,0x00 - 0x31,0x12,0x99) - {"HDA", 32, bt_dat, 0, 0, 10, 10, 0, 0}, // date with weekday, 01.01.2000 - 31.12.2099 (0x01,0x01,WW,0x00 - 0x31,0x12,WW,0x99, WW is weekday Mon=0x01 - Sun=0x07)) - {"HDA", 24, bt_dat, 0, 0, 10, 10, 0, 0}, // date, 01.01.2000 - 31.12.2099 (0x01,0x01,0x00 - 0x31,0x12,0x99) // TODO remove duplicate of BDA + {"HDA", 32, bt_dat, 0, 0, 10, 10, 0, 0}, // date with weekday, 01.01.2000 - 31.12.2099 (0x01,0x01,WW,0x00 - 0x1f,0x0c,WW,0x63, WW is weekday Mon=0x01 - Sun=0x07)) + {"HDA", 24, bt_dat, 0, 0, 10, 10, 0, 0}, // date, 01.01.2000 - 31.12.2099 (0x01,0x01,0x00 - 0x1f,0x0c,0x63) {"BTI", 24, bt_tim, BCD|REV, 0, 8, 8, 0, 0}, // time in BCD, 00:00:00 - 23:59:59 (0x00,0x00,0x00 - 0x59,0x59,0x23) {"HTI", 24, bt_tim, 0, 0, 8, 8, 0, 0}, // time, 00:00:00 - 23:59:59 (0x00,0x00,0x00 - 0x17,0x3b,0x3b) {"VTI", 24, bt_tim, REV, 0x63, 8, 8, 0, 0}, // time, 00:00:00 - 23:59:59 (0x00,0x00,0x00 - 0x3b,0x3b,0x17, replacement 0x63) [Vaillant type] @@ -493,7 +493,7 @@ result_t StringDataField::readSymbols(SymbolString& input, if (m_length == 4 && i == 2 && m_dataType.type == bt_dat) continue; // skip weekday in between ch = input[baseOffset + offset]; - if ((m_dataType.flags & BCD) != 0 || m_dataType.type == bt_dat) { + if ((m_dataType.flags & BCD) != 0) { if ((ch & 0xf0) > 0x90 || (ch & 0x0f) > 0x09) return RESULT_ERR_OUT_OF_RANGE; // invalid BCD ch = (ch >> 4) * 10 + (ch & 0x0f); @@ -675,7 +675,7 @@ result_t StringDataField::writeSymbols(istringstream& input, } lastLast = last; last = value; - if ((m_dataType.flags & BCD) != 0 || m_dataType.type == bt_dat) { + if ((m_dataType.flags & BCD) != 0) { if (value > 99) return RESULT_ERR_OUT_OF_RANGE; // invalid BCD value = ((value / 10) << 4) | (value % 10); diff --git a/src/lib/ebus/test/test_data.cpp b/src/lib/ebus/test/test_data.cpp index 2e4af306..cf88a52d 100644 --- a/src/lib/ebus/test/test_data.cpp +++ b/src/lib/ebus/test/test_data.cpp @@ -54,16 +54,20 @@ int main() {"x,,hex:10", "48 61 6c 6c 6f 2c 20 44 75 21", "10fe07000a48616c6c6f2c20447521", "00", ""}, {"x,,hex:11", "", "10fe07000a48616c6c6f2c20447521", "00", "rW"}, {"x,,bda", "26.10.2014","10fe07000426100614", "00", ""}, // Sunday - {"x,,hda", "26.10.2014","10fe07000426100714", "00", ""}, // Sunday + {"x,,hda", "26.10.2014","10fe0700041a0a070e", "00", ""}, // Sunday {"x,,bda", "01.01.2000","10fe07000401010500", "00", ""}, // Saturday {"x,,hda", "01.01.2000","10fe07000401010600", "00", ""}, // Saturday {"x,,bda", "31.12.2099","10fe07000431120399", "00", ""}, // Thursday - {"x,,hda", "31.12.2099","10fe07000431120499", "00", ""}, // Thursday + {"x,,hda", "31.12.2099","10fe0700041f0c0463", "00", ""}, // Thursday {"x,,bda", "", "10fe07000432100014", "00", "rw"}, {"x,,bda:3", "26.10.2014","10fe070003261014", "00", ""}, {"x,,bda:3", "01.01.2000","10fe070003010100", "00", ""}, {"x,,bda:3", "31.12.2099","10fe070003311299", "00", ""}, {"x,,bda:3", "", "10fe070003321299", "00", "rw"}, + {"x,,hda:3", "26.10.2014","10fe0700031a0a0e", "00", ""}, + {"x,,hda:3", "01.01.2000","10fe070003010100", "00", ""}, + {"x,,hda:3", "31.12.2099","10fe0700031f0c63", "00", ""}, + {"x,,hda:3", "", "10fe070003200c63", "00", "rw"}, {"x,,bti", "21:04:58", "10fe070003580421", "00", ""}, {"x,,bti", "00:00:00", "10fe070003000000", "00", ""}, {"x,,bti", "23:59:59", "10fe070003595923", "00", ""},