Minimum ON volume for modbus dim, mask type=3 fix

This commit is contained in:
2021-05-08 11:36:18 +03:00
parent d219a594c5
commit 9ae6d9991e

View File

@@ -978,7 +978,18 @@ switch (itemType) {
#ifndef MODBUS_DISABLE #ifndef MODBUS_DISABLE
case CH_MODBUS: case CH_MODBUS:
if (toExecute) modbusDimmerSet(st); if (toExecute)
{
int vol;
if (st.getCmd()== CMD_ON && (vol=st.getPercents())<MIN_VOLUME && vol>=0)
{
st.setPercents(INIT_VOLUME);
st.saveItem(this);
SendStatus(SEND_PARAMETERS | SEND_DEFFERED);
};
modbusDimmerSet(st);
}
break; break;
case CH_VC: case CH_VC:
if (toExecute) VacomSetFan(st); if (toExecute) VacomSetFan(st);
@@ -1521,8 +1532,10 @@ int Item::modbusDimmerSet(int addr, uint16_t _reg, int _regType, int _mask, uint
break; break;
case 2: case 2:
break; break;
case 3: case 3: // Modbus relay
value++; //value++;
if (value) value = 1;
else value = 2;
case 4: //Swap high and low bytes case 4: //Swap high and low bytes
t = (value & 0xff00) >> 8; t = (value & 0xff00) >> 8;
value <<=8; value <<=8;