1
0
Fork 0

evaluate non-dim from millivolts

This commit is contained in:
Kevin Matz 2023-03-30 19:16:54 -04:00
parent 8979dd4699
commit b6e9425083
1 changed files with 13 additions and 4 deletions

View File

@ -62,13 +62,22 @@ struct Receiver
* @param mV
* @param cur If incorporating hysteresis, the current state of the switch.
* @return
*
* \cite ANALOG It is suggested that receiving devices that switch between "off" and "on,"
* such as relay packs, should consider incorporating hysteresis in switching between "off" and
* "on." For example a switch "on" point of 60% and a switch "off" point of 40% may be selected.
*/
bool state(const int16_t mV, const bool cur = false) const
{
uint8_t l = level(mV);
if (cur)
return !(l < 102); // ~40%
return l > 153; // ~60%
/**
* \cite ANALOG In this case a device in the "off" state would not switch on until the
* control voltage exceeds 6 volts. A device in the "on" state would not switch off until
* the control voltage drops below 4 volts.
*/
if (!cur)
return mV > 6000; // 6V
return !(mV < 4000); // 4V
}
};