@@ -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 );
@@ -236,7 +236,9 @@ void lteppp_disconnect(void) {
236
236
237
237
void lteppp_send_at_command (lte_task_cmd_data_t * cmd , lte_task_rsp_data_t * rsp ) {
238
238
xQueueSend (xCmdQueue , (void * )cmd , (TickType_t )portMAX_DELAY );
239
- xQueueReceive (xRxQueue , rsp , (TickType_t )portMAX_DELAY );
239
+
240
+ if (!cmd -> expect_continuation )
241
+ xQueueReceive (xRxQueue , rsp , (TickType_t )portMAX_DELAY );
240
242
}
241
243
242
244
bool lteppp_wait_at_rsp (const char * expected_rsp , uint32_t timeout , bool from_mp , void * data_rem ) {
@@ -529,8 +531,10 @@ static void TASK_LTE (void *pvParameters) {
529
531
xSemaphoreGive (xLTESem );
530
532
state = lteppp_get_state ();
531
533
if (xQueueReceive (xCmdQueue , lteppp_trx_buffer , 0 )) {
532
- lteppp_send_at_cmd_exp (lte_task_cmd -> data , lte_task_cmd -> timeout , NULL , & (lte_task_rsp -> data_remaining ), lte_task_cmd -> dataLen );
533
- xQueueSend (xRxQueue , (void * )lte_task_rsp , (TickType_t )portMAX_DELAY );
534
+ bool expect_continuation = lte_task_cmd -> expect_continuation ;
535
+ 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 );
536
+ if (!expect_continuation )
537
+ xQueueSend (xRxQueue , (void * )lte_task_rsp , (TickType_t )portMAX_DE
8000
LAY );
534
538
}
535
539
else if (state == E_LTE_PPP && lte_uart_break_evt )
536
540
{
@@ -616,7 +620,7 @@ static void TASK_UART_EVT (void *pvParameters)
616
620
}
617
621
618
622
619
- static bool lteppp_send_at_cmd_exp (const char * cmd , uint32_t timeout , const char * expected_rsp , void * data_rem , size_t len ) {
623
+ 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 ) {
620
624
621
625
if (strstr (cmd , "Pycom_Dummy" ) != NULL )
622
626
{
@@ -657,22 +661,34 @@ static bool lteppp_send_at_cmd_exp (const char *cmd, uint32_t timeout, const cha
657
661
}
658
662
#endif
659
663
// flush the rx buffer first
660
- uart_flush (LTE_UART_ID );
664
+ if (!expect_continuation || (len >= 2 && cmd [0 ] == 'A' && cmd [1 ] == 'T' )) // starts with AT
665
+ {
666
+ uart_flush (LTE_UART_ID );
667
+ }
661
668
// uart_read_bytes(LTE_UART_ID, (uint8_t *)tmp_buf, sizeof(tmp_buf), 5 / portTICK_RATE_MS);
662
669
// then send the command
663
670
uart_write_bytes (LTE_UART_ID , cmd , cmd_len );
664
- if (strcmp (cmd , "+++" )) {
665
- uart_write_bytes (LTE_UART_ID , "\r" , 1 );
671
+
672
+ if (expect_continuation )
673
+ {
674
+ return true;
666
675
}
667
- uart_wait_tx_done (LTE_UART_ID , LTE_TRX_WAIT_MS (cmd_len ) / portTICK_RATE_MS );
668
- vTaskDelay (2 / portTICK_RATE_MS );
676
+ else {
677
+ if (strcmp (cmd , "+++" ))
678
+ {
679
+ uart_write_bytes (LTE_UART_ID , "\r" , 1 );
680
+ }
669
681
670
- return lteppp_wait_at_rsp (expected_rsp , timeout , false, data_rem );
682
+ uart_wait_tx_done (LTE_UART_ID , LTE_TRX_WAIT_MS (cmd_len ) / portTICK_RATE_MS );
683
+ vTaskDelay (2 / portTICK_RATE_MS );
684
+
685
+ return lteppp_wait_at_rsp (expected_rsp , timeout , false, data_rem );
686
+ }
671
687
}
672
688
}
673
689
674
690
static bool lteppp_send_at_cmd (const char * cmd , uint32_t timeout ) {
675
- return lteppp_send_at_cmd_exp (cmd , timeout , LTE_OK_RSP , NULL , strlen (cmd ) );
691
+ return lteppp_send_at_cmd_exp (cmd , timeout , LTE_OK_RSP , NULL , strlen (cmd ), false );
676
692
}
677
693
678
694
static bool lteppp_check_sim_present (void ) {
0 commit comments