Add detection and warning of longer telegrams broken by bad cul firmware.

pull/526/head
Fredrik Öhrström 2022-04-28 16:20:30 +02:00
rodzic 0d33fc5879
commit bf4ac2c0cc
4 zmienionych plików z 28 dodań i 7 usunięć

Wyświetl plik

@ -1,4 +1,6 @@
Add detection of bad CUL firmware.
Using :mbus as suffix to the meter driver now works to poll a meter of mbus instead of
listening to wmbus telegrams.

Wyświetl plik

@ -483,7 +483,9 @@ With the latest rtlwmbus you can listen to s1, c1 and t1 at
the same time.
The cul dongle can listen to either s1, c1 or t1, but only
one at a time.
one at a time. Note that the cul dongle is limited to shorter telegrams.
There is a firmware fix that allows somewhat longer, but still
not full length telegrams. Read the wiki to find this firmware.
The rc1180 dongle can listen only to t1.

Wyświetl plik

@ -52,6 +52,7 @@ bool isHexStringFlex(const std::string &txt, bool *invalid);
// Strict strings contain only hexadecimal digits.
bool isHexStringStrict(const char* txt, bool *invalid);
bool isHexStringStrict(const std::string &txt, bool *invalid);
int char2int(char input);
bool hex2bin(const char* src, std::vector<uchar> *target);
bool hex2bin(std::string &src, std::vector<uchar> *target);
bool hex2bin(std::vector<uchar> &src, std::vector<uchar> *target);

Wyświetl plik

@ -155,8 +155,8 @@ void WMBusCUL::deviceSetLinkModes(LinkModeSet lms)
} else if (lms.has(LinkMode::T1)) {
msg[2] = 't';
}
msg[3] = 0xa;
msg[4] = 0xd;
msg[3] = 0xd;
msg[4] = 0xa;
verbose("(cul) set link mode %c\n", msg[2]);
sent_command_ = string(&msg[0], &msg[3]);
@ -188,8 +188,8 @@ void WMBusCUL::deviceSetLinkModes(LinkModeSet lms)
msg[0] = 'X';
msg[1] = '2'; // 6
msg[2] = '1'; // 7
msg[3] = 0xa;
msg[4] = 0xd;
msg[3] = 0xd;
msg[4] = 0xa;
sent = serial()->send(msg);
@ -327,8 +327,16 @@ FrameStatus WMBusCUL::checkCULFrame(vector<uchar> &data,
vector<uchar> hex;
// If reception is started with X01, then there are no RSSI bytes.
// If started with X21, then there are two RSSI bytes (4 hex digits at the end).
// Now we always start with X01.
// Now we always start with X21.
hex.insert(hex.end(), data.begin()+2, data.begin()+eolp-eof_len-4); // Remove CRLF, RSSI and LQI
if (hex.size() % 2 == 1)
{
warning("(cul) Warning! Your cul firmware has a bug that prevents longer telegrams from being received.!\n");
warning("(cul) Please read: https://github.com/weetmuts/wmbusmeters/issues/390\n");
warning("(cul) and: https://weetmuts.github.io/wmbusmeterswiki/nanoCUL.html\n");
}
payload.clear();
bool ok = hex2bin(hex, &payload);
if (!ok)
@ -355,8 +363,16 @@ FrameStatus WMBusCUL::checkCULFrame(vector<uchar> &data,
vector<uchar> hex;
// If reception is started with X01, then there are no RSSI bytes.
// If started with X21, then there are two RSSI bytes (4 hex digits at the end).
// Now we always start with X01.
// Now we always start with X21.
hex.insert(hex.end(), data.begin()+1, data.begin()+eolp-eof_len-4); // Remove CRLF, RSSI and LQI
if (hex.size() % 2 == 1)
{
warning("(cul) Warning! Your cul firmware has a bug that prevents longer telegrams from being received.!\n");
warning("(cul) Please read: https://github.com/weetmuts/wmbusmeters/issues/390\n");
warning("(cul) and: https://weetmuts.github.io/wmbusmeterswiki/nanoCUL.html\n");
}
payload.clear();
bool ok = hex2bin(hex, &payload);
if (!ok)