Possible bug in SendInformationEvent()
waaslandwolf opened this issue · comments
waaslandwolf commented
The current implementation of SendInformationEvent() in my Hasselt/Paris-based firmware is:
void SendInformationEvent( unsigned char idx, unsigned char eventClass, unsigned char eventTypeId)
{
vscp_omsg.priority = VSCP_PRIORITY_MEDIUM;
vscp_omsg.flags = VSCP_VALID_MSG + 3;
vscp_omsg.vscp_class = eventClass;
vscp_omsg.vscp_type = eventTypeId;
vscp_omsg.data[ 0 ] = idx; //index
vscp_omsg.data[ 1 ] = readEEPROM( VSCP_EEPROM_END + EEPROM_ZONE ); //zone
vscp_omsg.data[ 2 ] = readEEPROM( VSCP_EEPROM_END + idx ); //subzone
vscp_sendEvent(); // Send data
}
omsg.data[2] should be the subzone as per the protocol specification. In the case of my MDF the subzone register is indeed located at VSCP_EEPROM_END + idx, but in case the register order in the MDF changes this will no longer be the case.
Wouldn't it be better to use this instead?
vscp_omsg.data[ 2 ] = readEEPROM( VSCP_EEPROM_END + EEPROM_SUBZONE );