8000 esp32/ltepp: bug fix in ppp suspension · pycom/pycom-micropython-sigfox@bf11cc0 · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Sep 16, 2024. It is now read-only.

Commit bf11cc0

Browse files
author
iwahdan88
committed
esp32/ltepp: bug fix in ppp suspension
1 parent 60d929c commit bf11cc0

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

esp32/lte/lteppp.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ static void TASK_LTE (void *pvParameters) {
428428
uart_get_buffered_data_len(LTE_UART_ID, & E69F rx_len);
429429
if (rx_len > 0) {
430430
// try to read up to the size of the buffer
431-
rx_len = uart_read_bytes(LTE_UART_ID, (uint8_t *)lteppp_trx_buffer, sizeof(lteppp_trx_buffer),
431+
rx_len = uart_read_bytes(LTE_UART_ID, (uint8_t *)lteppp_trx_buffer, sizeof(lteppp_trx_buffer),
432432
LTE_TRX_WAIT_MS(sizeof(lteppp_trx_buffer)) / portTICK_RATE_MS);
433433
if (rx_len > 0) {
434434
pppos_input_tcpip(lteppp_pcb, (uint8_t *)lteppp_trx_buffer, rx_len);
@@ -494,13 +494,17 @@ static uint32_t lteppp_output_callback(ppp_pcb *pcb, u8_t *data, u32_t len, void
494494
}
495495
else
496496
{
497-
memcpy(&(lteppp_queue_buffer[top]), (const char*)data, len);
498-
top += len;
499-
if(top > LTE_UART_BUFFER_SIZE)
497+
uint32_t temp = top + len;
498+
if(temp > LTE_UART_BUFFER_SIZE)
500499
{
501-
top = LTE_UART_BUFFER_SIZE -1;
500+
return 0;
501+
}
502+
else
503+
{
504+
memcpy(&(lteppp_queue_buffer[top]), (const char*)data, len);
505+
top += len;
506+
return len;
502507
}
503-
return len;
504508
}
505509
return tx_bytes;
506510
}

0 commit comments

Comments
 (0)
0