mirror of
https://github.com/anklimov/lighthub
synced 2026-04-29 12:05:09 +00:00
MultiAC pre-release
This commit is contained in:
@@ -17,7 +17,8 @@
|
|||||||
|
|
||||||
-DRESTART_LAN_ON_MQTT_ERRORS
|
-DRESTART_LAN_ON_MQTT_ERRORS
|
||||||
-D CORS=\"*\"
|
-D CORS=\"*\"
|
||||||
-D REDIRECTION_URL=\"http://lazyhome.ru/pwa\"
|
#-D REDIRECTION_URL=\"http://lazyhome.ru/pwa\"
|
||||||
|
-D REDIRECTION_URL=lazyhome.ru/pwa
|
||||||
-DOTA_PORT=80
|
-DOTA_PORT=80
|
||||||
|
|
||||||
#oct22 - violation in Publish/OnMQTTConnect while publish homie info
|
#oct22 - violation in Publish/OnMQTTConnect while publish homie info
|
||||||
|
|||||||
@@ -189,7 +189,8 @@ int out_Multivent::Poll(short cause)
|
|||||||
int set = getIntFromJson(i,"set");
|
int set = getIntFromJson(i,"set");
|
||||||
int val = getIntFromJson(i,"val");
|
int val = getIntFromJson(i,"val");
|
||||||
|
|
||||||
int execCmd = 0;
|
int execCmd = 0;
|
||||||
|
bool weakMode=false; // kind of modes when we activating PID only if AC in active mode
|
||||||
switch (cmd)
|
switch (cmd)
|
||||||
{
|
{
|
||||||
case CMD_HEATCOOL:
|
case CMD_HEATCOOL:
|
||||||
@@ -200,10 +201,12 @@ int out_Multivent::Poll(short cause)
|
|||||||
break;
|
break;
|
||||||
case CMD_FAN:
|
case CMD_FAN:
|
||||||
ventRequested = true;
|
ventRequested = true;
|
||||||
|
weakMode = true;
|
||||||
execCmd = cmd;
|
execCmd = cmd;
|
||||||
break;
|
break;
|
||||||
case CMD_AUTO:
|
case CMD_AUTO:
|
||||||
autoRequested = true;
|
autoRequested = true;
|
||||||
|
weakMode = true;
|
||||||
execCmd = cmd;
|
execCmd = cmd;
|
||||||
break;
|
break;
|
||||||
case CMD_COOL:
|
case CMD_COOL:
|
||||||
@@ -216,30 +219,32 @@ int out_Multivent::Poll(short cause)
|
|||||||
bool passiveMode = getIntFromJson(i,"@pasv",0);
|
bool passiveMode = getIntFromJson(i,"@pasv",0);
|
||||||
|
|
||||||
aJsonObject * pidObj = aJson.getObjectItem(i, "pid");
|
aJsonObject * pidObj = aJson.getObjectItem(i, "pid");
|
||||||
if (pidObj && pidObj->valueint)
|
aJsonObject * poObj = aJson.getObjectItem(i,"po");
|
||||||
|
|
||||||
|
if (pidObj && pidObj->valueint && poObj && poObj->type == aJson_Float)
|
||||||
{
|
{
|
||||||
PID * p = (PID *) pidObj->valueint;
|
PID * p = (PID *) pidObj->valueint;
|
||||||
if ((execCmd == CMD_HEAT || execCmd == CMD_COOL) && p->GetMode() == AUTOMATIC) pidActive = true;
|
if ((execCmd == CMD_HEAT || execCmd == CMD_COOL) && p->GetMode() == AUTOMATIC) pidActive = true;
|
||||||
|
switch (actualMode)
|
||||||
switch (actualMode)
|
|
||||||
{ //if air hot or cold - uses temp PID and block control by /fan
|
{ //if air hot or cold - uses temp PID and block control by /fan
|
||||||
case CMD_HEAT:
|
case CMD_HEAT:
|
||||||
p->SetMode(AUTOMATIC);
|
if (weakMode || passiveMode) p->SetMode(AUTOMATIC);
|
||||||
p->SetControllerDirection(DIRECT);
|
p->SetControllerDirection(DIRECT);
|
||||||
break;
|
break;
|
||||||
case CMD_COOL:
|
case CMD_COOL:
|
||||||
p->SetMode(AUTOMATIC);
|
if (weakMode || passiveMode) p->SetMode(AUTOMATIC);
|
||||||
p->SetControllerDirection(REVERSE);
|
p->SetControllerDirection(REVERSE);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (passiveMode || execCmd == CMD_AUTO || execCmd ==CMD_OFF) p->SetMode(MANUAL);
|
if ((passiveMode || weakMode || execCmd ==CMD_OFF) && p->GetMode() == AUTOMATIC)
|
||||||
}
|
{
|
||||||
|
p->SetMode(MANUAL);
|
||||||
|
debugSerial<<F("VENT: PID set to MANUAL due no HEAT/COOL. zone:")<<i->name<<endl;
|
||||||
|
fanCtrl(itemCmd().Percents255(0).setSuffix(S_FAN),i->name,true,true);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (p->Compute())
|
if (p->Compute())
|
||||||
{
|
{
|
||||||
|
|
||||||
aJsonObject * poObj = aJson.getObjectItem(i,"po");
|
|
||||||
if (poObj && poObj->type == aJson_Float)
|
|
||||||
{
|
{
|
||||||
debugSerial<<F("VENT: ")
|
debugSerial<<F("VENT: ")
|
||||||
<<item->itemArr->name<<"/"<<i->name
|
<<item->itemArr->name<<"/"<<i->name
|
||||||
@@ -288,9 +293,16 @@ int out_Multivent::Poll(short cause)
|
|||||||
((PID *) pidObj->valueint)->SetMode(MANUAL);
|
((PID *) pidObj->valueint)->SetMode(MANUAL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else //PID not computed - maybe not in time, but we can use PID output as indicator of balance and boost if needed
|
||||||
|
{
|
||||||
|
if (p->GetMode() == AUTOMATIC)
|
||||||
|
{
|
||||||
|
if (execCmd == CMD_HEAT) balance+=poObj->valuefloat;
|
||||||
|
else if (execCmd == CMD_COOL) balance-=poObj->valuefloat;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -578,9 +590,15 @@ while (i)
|
|||||||
else if (cmd.getCmd() == CMD_AUTO)
|
else if (cmd.getCmd() == CMD_AUTO)
|
||||||
{
|
{
|
||||||
setPassiveMode(i,true); //Setup flag
|
setPassiveMode(i,true); //Setup flag
|
||||||
|
passiveMode = true;
|
||||||
cmd.Cmd(CMD_OFF);
|
cmd.Cmd(CMD_OFF);
|
||||||
cmd.setSuffix(S_CMD);
|
cmd.setSuffix(S_CMD);
|
||||||
}
|
}
|
||||||
|
else if (cmd.getCmd() == CMD_OFF)
|
||||||
|
{
|
||||||
|
setPassiveMode(i,false);
|
||||||
|
passiveMode = false;
|
||||||
|
}
|
||||||
|
|
||||||
if (!cmd.isCommand()) break; // if have command in FAN suffix - continue processing
|
if (!cmd.isCommand()) break; // if have command in FAN suffix - continue processing
|
||||||
debugSerial<<"VENT: cmd in FAN suffix, process as command. cmd="<<cmd.getCmd()<<endl;
|
debugSerial<<"VENT: cmd in FAN suffix, process as command. cmd="<<cmd.getCmd()<<endl;
|
||||||
@@ -614,8 +632,10 @@ while (i)
|
|||||||
debugSerial<<"VENT: Turning OFF. saving cmd:"<<cmdObj->valueint<<endl;
|
debugSerial<<"VENT: Turning OFF. saving cmd:"<<cmdObj->valueint<<endl;
|
||||||
sendFlags |= FLAG_COMMAND;
|
sendFlags |= FLAG_COMMAND;
|
||||||
//sendFlags |= FLAG_PARAMETERS; //experimental 30/03/26
|
//sendFlags |= FLAG_PARAMETERS; //experimental 30/03/26
|
||||||
//if (!passiveMode) sendFlags |= FLAG_PARAMETERS;
|
//
|
||||||
//else cmd.Cmd(CMD_AUTO);
|
if (!passiveMode) sendFlags |= FLAG_PARAMETERS;
|
||||||
|
// else cmd.Cmd(CMD_AUTO);
|
||||||
|
|
||||||
cmdObj->valueint = CMD_OFF;
|
cmdObj->valueint = CMD_OFF;
|
||||||
enablePid(pidObj,false);
|
enablePid(pidObj,false);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -637,6 +637,8 @@ extra_scripts = extra_script.py
|
|||||||
|
|
||||||
;;;; WEMOS D1 ;;;;;
|
;;;; WEMOS D1 ;;;;;
|
||||||
board = d1_mini
|
board = d1_mini
|
||||||
|
board_build.ldscript = eagle.flash.4m1m.ld
|
||||||
|
|
||||||
; change microcontroller
|
; change microcontroller
|
||||||
board_build.mcu = esp8266
|
board_build.mcu = esp8266
|
||||||
; change MCU frequency
|
; change MCU frequency
|
||||||
|
|||||||
Reference in New Issue
Block a user