diff --git a/cc3200/mods/modwlan.h b/cc3200/mods/modwlan.h index 897c1bfb0c..b856c2d65c 100644 --- a/cc3200/mods/modwlan.h +++ b/cc3200/mods/modwlan.h @@ -33,7 +33,7 @@ #define SIMPLELINK_SPAWN_TASK_PRIORITY 3 #define SIMPLELINK_TASK_STACK_SIZE 2048 #define SL_STOP_TIMEOUT 35 -#define SL_STOP_TIMEOUT_LONG 255 +#define SL_STOP_TIMEOUT_LONG 205 /****************************************************************************** DEFINE TYPES diff --git a/cc3200/mods/pybsleep.c b/cc3200/mods/pybsleep.c index b074d539bd..d93c09fa49 100644 --- a/cc3200/mods/pybsleep.c +++ b/cc3200/mods/pybsleep.c @@ -226,6 +226,10 @@ void pybsleep_configure_timer_wakeup (uint pwrmode) { pybsleep_wake_cb.timer_wake_pwrmode = pwrmode; } +pybsleep_reset_cause_t pybsleep_get_reset_cause (void) { + return pybsleep_reset_cause; +} + /****************************************************************************** DEFINE PRIVATE FUNCTIONS ******************************************************************************/ diff --git a/cc3200/mods/pybsleep.h b/cc3200/mods/pybsleep.h index 7835153784..08dc4ce4bb 100644 --- a/cc3200/mods/pybsleep.h +++ b/cc3200/mods/pybsleep.h @@ -72,5 +72,6 @@ void pybsleep_set_wlan_lpds_callback (mp_obj_t cb_obj); void pybsleep_set_gpio_lpds_callback (mp_obj_t cb_obj); void pybsleep_set_timer_lpds_callback (mp_obj_t cb_obj); void pybsleep_configure_timer_wakeup (uint pwrmode); +pybsleep_reset_cause_t pybsleep_get_reset_cause (void); #endif /* PYBSLEEP_H_ */ diff --git a/cc3200/mptask.c b/cc3200/mptask.c index 91ca696d09..2d28df8ccf 100644 --- a/cc3200/mptask.c +++ b/cc3200/mptask.c @@ -144,15 +144,13 @@ soft_reset: mperror_enable_heartbeat(); - if (MAP_PRCMSysResetCauseGet() != PRCM_HIB_EXIT) { - // only if not comming out of hibernate + if (pybsleep_get_reset_cause() < PYB_SLP_HIB_RESET) { + // only if not comming out of hibernate or a soft reset mptask_enter_ap_mode(); - // don't check for safeboot when comming out of hibernate #ifndef DEBUG safeboot = PRCMIsSafeBootRequested(); #endif - } - else { + } else { // when waking up from hibernate we just want // to enable simplelink and leave it as is wlan_first_start(); @@ -218,7 +216,7 @@ soft_reset: // Main script is finished, so now go into REPL mode. // The REPL mode can change, or it can request a soft reset. - for (;;) { + for ( ; ; ) { if (pyexec_mode_kind == PYEXEC_MODE_RAW_REPL) { if (pyexec_raw_repl() != 0) { break;