Added Stop function to GPIO input #1 (eg CO sensor with Ext Thermostat

This commit is contained in:
Ray Jones 2019-08-27 20:35:21 +10:00
parent 08a39a26f7
commit c79522233c
3 changed files with 35 additions and 22 deletions

View file

@ -96,6 +96,7 @@ CGPIOSetupScreen::show()
case CGPIOin1::Start: msgText = "Start"; break;
case CGPIOin1::Run: msgText = "Run "; break;
case CGPIOin1::StartStop: msgText = animated ? "Start" : "Stop "; break;
case CGPIOin1::Stop: msgText = "Stop "; break;
}
if(msgText)
_printMenuText(Column1, Line3, msgText, _rowSel == 4);
@ -369,23 +370,11 @@ CGPIOSetupScreen::_adjust(int dir)
WRAPLIMITS(tVal, 0, 1);
_GPIOparams.algMode = (CGPIOalg::Modes)tVal;
break;
case 6: // outputs mode
tVal = _GPIOparams.out1Mode;
case 2:
tVal = _GPIOparams.in2Mode;
tVal += dir;
WRAPLIMITS(tVal, 0, 2);
_GPIOparams.out1Mode = (CGPIOout1::Modes)tVal;
break;
case 5: // outputs mode
tVal = _GPIOparams.out2Mode;
tVal += dir;
WRAPLIMITS(tVal, 0, 1);
_GPIOparams.out2Mode = (CGPIOout2::Modes)tVal;
break;
case 4:
tVal = _GPIOparams.in1Mode;
tVal += dir;
WRAPLIMITS(tVal, 0, 3);
_GPIOparams.in1Mode = (CGPIOin1::Modes)tVal;
_GPIOparams.in2Mode = (CGPIOin2::Modes)tVal;
break;
case 3:
switch(_ExtHold) {
@ -401,11 +390,23 @@ CGPIOSetupScreen::_adjust(int dir)
default: _ExtHold = 0; break;
}
break;
case 2:
tVal = _GPIOparams.in2Mode;
case 4:
tVal = _GPIOparams.in1Mode;
tVal += dir;
WRAPLIMITS(tVal, 0, 4);
_GPIOparams.in1Mode = (CGPIOin1::Modes)tVal;
break;
case 5: // outputs mode
tVal = _GPIOparams.out2Mode;
tVal += dir;
WRAPLIMITS(tVal, 0, 1);
_GPIOparams.out2Mode = (CGPIOout2::Modes)tVal;
break;
case 6: // outputs mode
tVal = _GPIOparams.out1Mode;
tVal += dir;
WRAPLIMITS(tVal, 0, 2);
_GPIOparams.in2Mode = (CGPIOin2::Modes)tVal;
_GPIOparams.out1Mode = (CGPIOout1::Modes)tVal;
break;
}
}

View file

@ -35,7 +35,8 @@ const char* GPIOin1Names[] = {
"Disabled",
"Mom On",
"Hold On",
"Mom On/Off"
"Mom On/Off",
"Mom Off"
};
const char* GPIOin2Names[] = {
"Disabled",
@ -85,6 +86,7 @@ CGPIOin1::manage(bool active)
case Start: _doStart(active); break;
case Run: _doRun(active); break;
case StartStop: _doStartStop(active); break;
case Stop: _doStop(active); break;
}
_prevActive = active;
}
@ -124,6 +126,14 @@ CGPIOin1::_doStartStop(bool active)
}
}
void
CGPIOin1::_doStop(bool active)
{
if(active) {
requestOff();
}
}
CGPIOin2::CGPIOin2()
{
_Mode = Disabled;

View file

@ -39,9 +39,10 @@ class CGPIOin1 {
public:
enum Modes {
Disabled,
Start, // input 1 closure, heater starts; input2 closure, heater stops
Run, // hold input 1 closure, heater runs; input 1 open, heater stops
StartStop // alternate input 1 closures start or stop the heater
Start, // input 1 closure starts heater
Run, // hold input 1 closed, heater runs; open, heater stops
StartStop, // alternate input 1 closures start or stop the heater
Stop // input 1 closure stops heater
};
CGPIOin1();
void setMode(Modes mode) { _Mode = mode; };
@ -54,6 +55,7 @@ private:
void _doStart(bool active);
void _doRun(bool active);
void _doStartStop(bool active);
void _doStop(bool active);
};
class CGPIOin2 {