Fix ThermostatSetpoint base offset. Some thermstats assume the setpoints

start counting from index 0 and others index 1 so XML configuration is
needed to show the difference.
This commit is contained in:
glsatz@gmail.com 2011-12-17 07:25:05 +00:00
parent 0cd2338b65
commit a0c010c280

View file

@ -257,13 +257,12 @@ bool ThermostatSetpoint::HandleMsg
// Parse the data for the supported setpoints // Parse the data for the supported setpoints
for( uint32 i=1; i<_length-1; ++i ) for( uint32 i=1; i<_length-1; ++i )
{ {
int32 bit = m_setPointBase; for( int32 bit=0; bit<8; ++bit )
for( ; bit<8; ++bit )
{ {
if( ( _data[i] & (1<<bit) ) != 0 ) if( ( _data[i] & (1<<bit) ) != 0 )
{ {
// Add supported setpoint // Add supported setpoint
int32 index = (int32)((i-1)<<3) + bit; int32 index = (int32)((i-1)<<3) + bit + m_setPointBase;
if( index < ThermostatSetpoint_Count ) if( index < ThermostatSetpoint_Count )
{ {
node->CreateValueDecimal( ValueID::ValueGenre_User, GetCommandClassId(), _instance, index, c_setpointName[index], "C", false, false, "0.0" ); node->CreateValueDecimal( ValueID::ValueGenre_User, GetCommandClassId(), _instance, index, c_setpointName[index], "C", false, false, "0.0" );