From 302a84007ec298e7d9a120d8a642697762dd6bd8 Mon Sep 17 00:00:00 2001 From: Gregg Date: Fri, 27 Nov 2020 19:59:09 -0600 Subject: [PATCH] Update RFControl.cpp Added new tests for out-of-range conditions --- src/extras/RFControl.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/extras/RFControl.cpp b/src/extras/RFControl.cpp index 1c6d453..bfb195d 100644 --- a/src/extras/RFControl.cpp +++ b/src/extras/RFControl.cpp @@ -55,8 +55,12 @@ void RFControl::add(uint16_t onTime, uint16_t offTime){ Serial.print("\n*** ERROR: Can't add more than 511 pulses to RF Control Module\n\n"); } else - if(offTime>32767 || onTime>32767){ - Serial.print("\n*** ERROR: Request to add RF Control pulse with ON or OFF time exceeds 32767 maximum allowed number of ticks\n\n"); + if(offTime>32767 || offTime<1 || onTime>32767 || onTime<1){ + Serial.print("\n*** ERROR: Request to add RF Control pulse with onTime="); + Serial.print(onTime); + Serial.print(" and offTime="); + Serial.print(offTime); + Serial.print(" is out of allowable range: 1-32767\n\n"); } else { pRMT[pCount++]=(offTime<<16)+onTime+(1<<15); // load pulse information into RMT memory and increment pointer