AllWize / mbus-payload

MBUS application layer payload encoder and decoder
GNU Lesser General Public License v3.0
30 stars 3 forks source link

add DIFE handling #5

Open Zeppelin500 opened 9 months ago

Zeppelin500 commented 9 months ago

The code snipped prevent the libary to come out of step if a DIFE is used. DIFE fields are NOT analyzed, but now you can read out the whole telegram without a failure and get some usefull data. Tested with a Engelmann Sensostar U, which use some DIFE.

// handle DIFE to prevent stumble if a DIFE is used
bool dife = ((dif & 0x80) == 0x80); //check if the first bit of DIF marked as "DIFE is following" 
while(dife) {
   index++;
   dife = false;
   dife = ((buffer[index-1] & 0x80) == 0x80); //check if after the DIFE another DIFE is following 
      } 
    //  End of DIFE handling

One another question: Why the time points are commented out?

  //{ MBUS_CODE::TIME_POINT_DATE         , 0x6C     , 1,   0},
  //{ MBUS_CODE::TIME_POINT_DATETIME     , 0x6D     , 1,   0},
ShubhamKharche9892 commented 2 weeks ago

{ MBUS_CODE::TIME_POINT_DATE , 0x6C , 1, 0}, { MBUS_CODE::TIME_POINT_DATETIME , 0x6D , 1, 0}, what basis u choose based value 0x6c

Zeppelin500 commented 2 weeks ago

Describe what you want to do and read the M-Bus documentation. I do not understand your question. I think the library is no longer supported by the author. If you want to decode, use the MBusinoLib. It is a greatly expanded fork of this library and should now support almost all devices. https://github.com/Zeppelin500/MBusinoLib You can play with the Wokwi example and change the telegram to your own telegram.

PS: https://m-bus.com/assets/downloads/MBDOC48.PDF See Chapter 8.4.3 and following. Attention to the small "n"s for exponent.