Skip to content

Commit 7e9f7c5

Browse files
Carsten KoesterCarsten Koester
authored andcommitted
fix(espnow): Support version 2 packet size
1 parent f122366 commit 7e9f7c5

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

libraries/ESP_NOW/src/ESP32_NOW.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -239,15 +239,15 @@ int ESP_NOW_Class::getEncryptedPeerCount() {
239239
}
240240

241241
int ESP_NOW_Class::availableForWrite() {
242-
return ESP_NOW_MAX_DATA_LEN;
242+
return ESP_NOW_MAX_DATA_LEN_V2;
243243
}
244244

245245
size_t ESP_NOW_Class::write(const uint8_t *data, size_t len) {
246246
if (!_esp_now_has_begun) {
247247
return 0;
248248
}
249-
if (len > ESP_NOW_MAX_DATA_LEN) {
250-
len = ESP_NOW_MAX_DATA_LEN;
249+
if (len > ESP_NOW_MAX_DATA_LEN_V2) {
250+
len = ESP_NOW_MAX_DATA_LEN_V2;
251251
}
252252
esp_err_t result = esp_now_send(NULL, data, len);
253253
if (result == ESP_OK) {
@@ -386,8 +386,8 @@ size_t ESP_NOW_Peer::send(const uint8_t *data, int len) {
386386
log_e("Peer not added.");
387387
return 0;
388388
}
389-
if (len > ESP_NOW_MAX_DATA_LEN) {
390-
len = ESP_NOW_MAX_DATA_LEN;
389+
if (len > ESP_NOW_MAX_DATA_LEN_V2) {
390+
len = ESP_NOW_MAX_DATA_LEN_V2;
391391
}
392392
esp_err_t result = esp_now_send(mac, data, len);
393393
if (result == ESP_OK) {

libraries/ESP_NOW/src/ESP32_NOW_Serial.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ void ESP_NOW_Serial_Class::onReceive(const uint8_t *data, size_t len, bool broad
164164

165165
//Print
166166
int ESP_NOW_Serial_Class::availableForWrite() {
167-
//return ESP_NOW_MAX_DATA_LEN;
167+
//return ESP_NOW_MAX_DATA_LEN_V2;
168168
if (tx_ring_buf == NULL) {
169169
return 0;
170170
}
@@ -189,7 +189,7 @@ bool ESP_NOW_Serial_Class::checkForTxData() {
189189
//do we have something that failed the last time?
190190
resend_count = 0;
191191
if (queued_buff == NULL) {
192-
queued_buff = (uint8_t *)xRingbufferReceiveUpTo(tx_ring_buf, &queued_size, 0, ESP_NOW_MAX_DATA_LEN);
192+
queued_buff = (uint8_t *)xRingbufferReceiveUpTo(tx_ring_buf, &queued_size, 0, ESP_NOW_MAX_DATA_LEN_V2);
193193
} else {
194194
log_d(MACSTR " : PREVIOUS", MAC2STR(addr()));
195195
}

0 commit comments

Comments
 (0)