File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -485,6 +485,8 @@ static void mgos_pppos_dispatch_once(struct mgos_pppos_data *pd) {
485485 mg_strfree (& pd -> iccid );
486486 pd -> pppcb = NULL ;
487487 memset (& pd -> pppif , 0 , sizeof (pd -> pppif ));
488+ pd -> cmd_error_state = PPPOS_IDLE ;
489+ pd -> cmd_success_state = PPPOS_IDLE ;
488490 pd -> net_status = MGOS_NET_EV_DISCONNECTED ;
489491 pd -> net_status_last_reported = MGOS_NET_EV_DISCONNECTED ;
490492 if (pd -> cfg -> dtr_gpio >= 0 ) {
@@ -849,7 +851,14 @@ bool mgos_pppos_disconnect(int if_instance) {
849851 pd -> pppcb = NULL ;
850852 pppapi_close (pppcb , 0 /* no_carrier */ );
851853 }
852- mgos_pppos_set_state (pd , PPPOS_IDLE );
854+ pd -> cmd_error_state = PPPOS_IDLE ;
855+ pd -> cmd_success_state = PPPOS_IDLE ;
856+ // If we are not running a user command, go to IDLE immediately,
857+ // otherwise finish the command sequence.
858+ if (pd -> state == PPPOS_INIT || pd -> state == PPPOS_START_PPP ||
859+ pd -> state == PPPOS_RUN ) {
860+ mgos_pppos_set_state (pd , PPPOS_IDLE );
861+ }
853862 mgos_pppos_dispatch (pd );
854863 return true;
855864 }
You can’t perform that action at this time.
0 commit comments