restricted incoming mfct to correct range. Specifiation allows 3*5 bit => any mfct must be smaller than 32767.

pull/1091/head
Andreas Horrer 2024-01-18 20:58:55 +01:00
rodzic f9c3fa4d64
commit 0cd75bec8e
1 zmienionych plików z 3 dodań i 3 usunięć

Wyświetl plik

@ -96,9 +96,9 @@ bool DriverInfo::detect(uint16_t mfct, uchar type, uchar version)
for (auto &dd : detect_)
{
if (dd.mfct == 0 && dd.type == 0 && dd.version == 0) continue; // Ignore drivers with no detection.
if (dd.mfct == mfct && dd.type == type && dd.version == version) return true;
//some meters send mfct where the first character ist lower case, therefor % ( 32 * 1024 ) to convert mfct to upper case
if (dd.mfct == mfct % ( 32 * 1024 ) && dd.type == type && dd.version == version) return true;
//some meters send mfct where the first character ist lower case, which results in mfct which are bigger
//than 32767, therefore restrict mfct to correct range
if (dd.mfct == (mfct & 0x7fff) && dd.type == type && dd.version == version) return true;
}
return false;
}