@@ -92,7 +92,7 @@ static bool lte_uart_break_evt = false;
9292 ******************************************************************************/
9393static void TASK_LTE (void * pvParameters );
9494static 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 );
9696static bool lteppp_send_at_cmd (const char * cmd , uint32_t timeout );
9797static bool lteppp_check_sim_present (void );
9898static void lteppp_status_cb (ppp_pcb * pcb , int err_code , void * ctx );
@@ -233,7 +233,9 @@ void lteppp_disconnect(void) {
233233
234234void lteppp_send_at_command (lte_task_cmd_data_t * cmd , lte_task_rsp_data_t * rsp ) {
235235 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 );
237239}
238240
239241bool 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) {
526528 xSemaphoreGive (xLTESem );
527529 state = lteppp_get_state ();
528530 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 );
531534 }
532535 else if (state == E_LTE_PPP && lte_uart_break_evt )
533536 {
@@ -613,7 +616,7 @@ static void TASK_UART_EVT (void *pvParameters)
613616}
614617
615618
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 ) {
617620
618621 if (strstr (cmd , "Pycom_Dummy" ) != NULL )
619622 {
@@ -654,22 +657,30 @@ static bool lteppp_send_at_cmd_exp (const char *cmd, uint32_t timeout, const cha
654657 }
655658#endif
656659 // 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 );
658663 // uart_read_bytes(LTE_UART_ID, (uint8_t *)tmp_buf, sizeof(tmp_buf), 5 / portTICK_RATE_MS);
659664 // then send the command
660665 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 ) / portTICK_RATE_MS );
665- vTaskDelay (2 / portTICK_RATE_MS );
666666
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+ }
668679 }
669680}
670681
671682static 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 );
673684}
674685
675686static bool lteppp_check_sim_present (void ) {
0 commit comments