1640 unit->PID_cool->Input = unit->PID_heat->Input = usetemp; |
1640 unit->PID_cool->Input = unit->PID_heat->Input = usetemp; |
1641 unit->PID_cool->Mode = unit->PID_heat->Mode = PID_MODE_AUTO; |
1641 unit->PID_cool->Mode = unit->PID_heat->Mode = PID_MODE_AUTO; |
1642 } |
1642 } |
1643 |
1643 |
1644 /* |
1644 /* |
1645 * PID controller compute |
1645 * PID controller compute, simulate 100 mSec loops. |
1646 */ |
1646 */ |
1647 UpdatePID(unit->PID_heat); |
1647 for (int i = 0; i < 10; i++) { |
1648 UpdatePID(unit->PID_cool); |
1648 UpdatePID(unit->PID_heat); |
|
1649 UpdatePID(unit->PID_cool); |
|
1650 } |
1649 |
1651 |
1650 /* |
1652 /* |
1651 * Logging |
1653 * Logging |
1652 */ |
1654 */ |
1653 if (unit->heater_address) { |
1655 if (unit->heater_address) { |
1867 if (unit->mqtt_flag) { |
1869 if (unit->mqtt_flag) { |
1868 if (unit->mqtt_flag & MQTT_FLAG_BIRTH) { |
1870 if (unit->mqtt_flag & MQTT_FLAG_BIRTH) { |
1869 publishDBirth(unit); |
1871 publishDBirth(unit); |
1870 unit->mqtt_flag &= ~MQTT_FLAG_BIRTH; |
1872 unit->mqtt_flag &= ~MQTT_FLAG_BIRTH; |
1871 } else { |
1873 } else { |
1872 // if (unit->mode != UNITMODE_OFF) { |
1874 publishDData(unit); |
1873 publishDData(unit); |
|
1874 // } |
|
1875 unit->mqtt_flag &= ~MQTT_FLAG_DATA; |
1875 unit->mqtt_flag &= ~MQTT_FLAG_DATA; |
1876 } |
1876 } |
1877 if (unit->mqtt_flag & MQTT_FLAG_DEATH) { |
1877 if (unit->mqtt_flag & MQTT_FLAG_DEATH) { |
1878 publishDDeath(unit); |
1878 publishDDeath(unit); |
1879 unit->mqtt_flag &= ~MQTT_FLAG_DEATH; |
1879 unit->mqtt_flag &= ~MQTT_FLAG_DEATH; |