relax max entities checking (#2629)

This commit is contained in:
Martin 2021-10-25 21:53:47 +02:00 committed by GitHub
parent 49b17c5a2d
commit 81c11ba1f7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -139,7 +139,9 @@ void Modbus::send(uint8_t address, uint8_t function_code, uint16_t start_address
uint8_t payload_len, const uint8_t *payload) { uint8_t payload_len, const uint8_t *payload) {
static const size_t MAX_VALUES = 128; static const size_t MAX_VALUES = 128;
if (number_of_entities > MAX_VALUES) { // Only check max number of registers for standard function codes
// Some devices use non standard codes like 0x43
if (number_of_entities > MAX_VALUES && function_code <= 0x10) {
ESP_LOGE(TAG, "send too many values %d max=%zu", number_of_entities, MAX_VALUES); ESP_LOGE(TAG, "send too many values %d max=%zu", number_of_entities, MAX_VALUES);
return; return;
} }