@@ -92,7 +92,7 @@ static bool lte_uart_break_evt = false;
92
92
******************************************************************************/
93
93
static void TASK_LTE (void * pvParameters );
94
94
static void TASK_UART_EVT (void * pvParameters );
95
- static bool lteppp_send_at_cmd_exp (const char * cmd , uint32_t timeout , const char * expected_rsp , void * data_rem , size_t len );
95
+ static bool lteppp_send_at_cmd_exp (const char * cmd , uint32_t timeout , const char * expected_rsp , void * data_rem , size_t len , bool expect_continuation );
96
96
static bool lteppp_send_at_cmd (const char * cmd , uint32_t timeout );
97
97
static bool lteppp_check_sim_present (void );
98
98
static void lteppp_status_cb (ppp_pcb * pcb , int err_code , void * ctx );
@@ -233,7 +233,9 @@ void lteppp_disconnect(void) {
233
233
234
234
void lteppp_send_at_command (lte_task_cmd_data_t * cmd , lte_task_rsp_data_t * rsp ) {
235
235
xQueueSend (xCmdQueue , (void * )cmd , (TickType_t )portMAX_DELAY );
236
- xQueueReceive (xRxQueue , rsp , (TickType_t )portMAX_DELAY );
236
+
237
+ if (!cmd -> expect_continuation )
238
+ xQueueReceive (xRxQueue , rsp , (TickType_t )portMAX_DELAY );
237
239
}
238
240
239
241
bool lteppp_wait_at_rsp (const char * expected_rsp , uint32_t timeout , bool from_mp , void * data_rem ) {
@@ -526,8 +528,9 @@ static void TASK_LTE (void *pvParameters) {
526
528
xSemaphoreGive (xLTESem );
527
529
state = lteppp_get_state ();
528
530
if (xQueueReceive (xCmdQueue , lteppp_trx_buffer , 0 )) {
529
- lteppp_send_at_cmd_exp (lte_task_cmd -> data , lte_task_cmd -> timeout , NULL , & (lte_task_rsp -> data_remaining ), lte_task_cmd -> dataLen );
530
- xQueueSend (xRxQueue , (void * )lte_task_rsp , (TickType_t )portMAX_DELAY );
531
+ lteppp_send_at_cmd_exp (lte_task_cmd -> data , lte_task_cmd -> timeout , NULL , & (lte_task_rsp -> data_remaining ), lte_task_cmd -> dataLen , lte_task_cmd -> expect_continuation );
532
+ if (!lte_task_cmd -> expect_continuation )
533
+ xQueueSend (xRxQueue , (void * )lte_task_rsp , (TickType_t )portMAX_DELAY );
531
534
}
532
535
else if (state == E_LTE_PPP && lte_uart_break_evt )
533
536
{
@@ -613,7 +616,7 @@ static void TASK_UART_EVT (void *pvParameters)
613
616
}
614
617
615
618
616
- static bool lteppp_send_at_cmd_exp (const char * cmd , uint32_t timeout , const char * expected_rsp , void * data_rem , size_t len ) {
619
+ static bool lteppp_send_at_cmd_exp (const char * cmd , uint32_t timeout , const char * expected_rsp , void * data_rem , size_t len , bool expect_continuation ) {
617
620
618
621
if (strstr (cmd , "Pycom_Dummy" ) != NULL )
619
622
{
@@ -654,22 +657,30 @@ static bool lteppp_send_at_cmd_exp (const char *cmd, uint32_t timeout, const cha
654
657
}
655
658
#endif
656
659
// flush the rx buffer first
657
- uart_flush (LTE_UART_ID );
660
+ if (!expect_continuation ||
661
+ (len >= 2 && cmd [0 ] == 'A' && cmd [1 ] == 'T' )) // starts with AT
662
+ uart_flush (LTE_UART_ID );
658
663
// uart_read_bytes(LTE_UART_ID, (uint8_t *)tmp_buf, sizeof(tmp_buf), 5 / portTICK_RATE_MS);
659
664
// then send the command
660
665
uart_write_bytes (LTE_UART_ID , cmd , cmd_len );
661
- if (strcmp (cmd , "+++" )) {
662
- uart_write_bytes (LTE_UART_ID , "\r" , 1 );
663
- }
664
- uart_wait_tx_done (LTE_UART_ID , LTE_TRX_WAIT_MS (cmd_len ) / por
8000
tTICK_RATE_MS );
665
- vTaskDelay (2 / portTICK_RATE_MS );
666
666
667
- return lteppp_wait_at_rsp (expected_rsp , timeout , false, data_rem );
667
+ if (expect_continuation )
668
+ return true;
669
+ else {
670
+ if (strcmp (cmd , "+++" )) {
671
+ uart_write_bytes (LTE_UART_ID , "\r" , 1 );
672
+ }
673
+
674
+ uart_wait_tx_done (LTE_UART_ID , LTE_TRX_WAIT_MS (cmd_len ) / portTICK_RATE_MS );
675
+ vTaskDelay (2 / portTICK_RATE_MS );
676
+
677
+ return lteppp_wait_at_rsp (expected_rsp , timeout , false, data_rem );
678
+ }
668
679
}
669
680
}
670
681
671
682
static bool lteppp_send_at_cmd (const char * cmd , uint32_t timeout ) {
672
- return lteppp_send_at_cmd_exp (cmd , timeout , LTE_OK_RSP , NULL , strlen (cmd ) );
683
+ return lteppp_send_at_cmd_exp (cmd , timeout , LTE_OK_RSP , NULL , strlen (cmd ), false );
673
684
}
674
685
675
686
static bool lteppp_check_sim_present (void ) {
0 commit comments