Set default IR receive tolerance (25%) if set to zero

This commit is contained in:
Hristo Kapanakov 2022-01-21 18:56:19 +02:00
parent 29723d5e9b
commit f9b0947d67
2 changed files with 2 additions and 0 deletions

View File

@ -198,6 +198,7 @@ void IrReceiveUpdateThreshold(void)
void IrReceiveUpdateTolerance(void)
{
if (irrecv != nullptr) {
if (Settings->param[P_IR_TOLERANCE] == 0) { Settings->param[P_IR_TOLERANCE] = IR_RCV_TOLERANCE; }
if (Settings->param[P_IR_TOLERANCE] > 100) { Settings->param[P_IR_TOLERANCE] = 100; }
irrecv->setTolerance(Settings->param[P_IR_TOLERANCE]);
}

View File

@ -196,6 +196,7 @@ void IrReceiveUpdateThreshold(void)
void IrReceiveUpdateTolerance(void)
{
if (irrecv != nullptr) {
if (Settings->param[P_IR_TOLERANCE] == 0) { Settings->param[P_IR_TOLERANCE] = IR_RCV_TOLERANCE; }
if (Settings->param[P_IR_TOLERANCE] > 100) { Settings->param[P_IR_TOLERANCE] = 100; }
irrecv->setTolerance(Settings->param[P_IR_TOLERANCE]);
}