diff --git a/IR_Decoder.h b/IR_Decoder.h index ac130a2..c69f2a6 100644 --- a/IR_Decoder.h +++ b/IR_Decoder.h @@ -73,7 +73,7 @@ public: uint8_t _msgType = 0; uint16_t _addrFrom = 0; uint16_t _addrTo = 0; - uint8_t* _data = nullptr; + uint8_t _data[bytePerPack]; uint8_t _dataRawSize = 0; uint16_t _crcPackVal = 0; uint16_t _crcCalcVal = 0; @@ -85,9 +85,7 @@ public: _dataRawSize = len; _err = err; _bitPeriod = rTime; - if (_data != nullptr) { delete _data; _data = nullptr; } - _data = new uint8_t[len]; - for (uint8_t i = 0; i < len; i++) { _data[i] = ptr[i]; } + for (uint8_t i = 0; i < len && len