From 1353ab6f75b48e8bc35ca313057d98c86577c096 Mon Sep 17 00:00:00 2001 From: DashyFox Date: Tue, 28 Jan 2025 12:59:42 +0300 Subject: [PATCH] constexpr IR_ResponseDelay --- IR_Decoder.cpp | 2 +- IR_DecoderRaw.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/IR_Decoder.cpp b/IR_Decoder.cpp index a8d5035..b8381f5 100644 --- a/IR_Decoder.cpp +++ b/IR_Decoder.cpp @@ -97,7 +97,7 @@ void IR_Decoder::_tick() } gotRaw.set(&packInfo, id); } - if (isWaitingAcceptSend && millis() - acceptSendTimer > 75) + if (isWaitingAcceptSend && millis() - acceptSendTimer > acceptDelay) { encoder->sendAccept(addrAcceptSendTo, acceptCustomByte); isWaitingAcceptSend = false; diff --git a/IR_DecoderRaw.h b/IR_DecoderRaw.h index 90929e1..b5ad407 100644 --- a/IR_DecoderRaw.h +++ b/IR_DecoderRaw.h @@ -23,6 +23,7 @@ #define riseTimeMin (riseTime - riseTolerance) #define aroundRise(t) (riseTimeMin < t && t < riseTimeMax) #define IR_timeout (riseTimeMax * (8 + syncBits + 1)) // us // таймаут в 8 data + 3 sync + 1 +constexpr uint16_t IR_ResponseDelay = ((uint16_t)(((bitTime+riseTolerance) * (8 + syncBits + 1))*2.7735))/1000; class IR_Encoder; class IR_DecoderRaw : virtual public IR_FOX