puuu / ESPiLight

ESPiLight - pilight 433.92 MHz protocols library for Arduino
GNU General Public License v3.0
109 stars 41 forks source link

MAXPULSESTREAMLENGTH limited to 255 #66

Open toi-go opened 1 year ago

toi-go commented 1 year ago

There are protocols which require a MAXPULSESTREAMLENGTH bigger than 255 - for example: Tfa2017: `#define MIN_RAW_LENGTH 200

define MAX_RAW_LENGTH 400`

Unfortunately, it is not as easy as simply changing the define in ESPiLight.h: #define MAXPULSESTREAMLENGTH 512

Because there are several variables/members which have type uint8_t - they overflow if a value bigger than 255 is assigned to them, for example: ESPiLight::minrawlen ESPiLight::maxrawlen

protocol_t::minrawlen protocol_t::maxrawlen

Effectively, prorocols requiring pulsestreams longer than 255 won't ever get pulsestreams longer than 255. They might even never get pulsestreams shorter than 255 as ESPiLight::maxrawlen's calculated value is wrong due to the overflow.