some delay after power button is pressed for gsm modem

master
Mateusz Lubecki 2024-10-21 20:49:49 +02:00
rodzic 6ca9151cae
commit b476eccf69
6 zmienionych plików z 20 dodań i 22 usunięć

Wyświetl plik

@ -1529,7 +1529,7 @@ int main(int argc, char* argv[]){
// this sleep is used by @link{pwr_save_after_stop2_rtc_wakeup_it} to
// go to the intermediate sleep in L4 powersave mode, when xxx seconds
// long sleep is divided into 'PWR_SAVE_STOP2_CYCLE_LENGHT_SEC' to
// serwice IWDG in between
// service IWDG in between
system_clock_configure_auto_wakeup_l4(PWR_SAVE_STOP2_CYCLE_LENGHT_SEC);
pwr_save_enter_stop2();

Wyświetl plik

@ -257,16 +257,6 @@ void pwr_save_enter_stop2(void) {
*/
void pwr_save_after_stop2_rtc_wakeup_it(void) {
// if yes set curent state
rte_main_woken_up = RTE_MAIN_WOKEN_UP_AFTER_LAST_SLEEP;
// // check if this is an intermediate wakeup from STOP2
// pwr_save_check_stop2_cycles();
//
// system_clock_configure_l4();
//
// pwr_save_exit_after_last_stop2_cycle();
// reload internal watchdog
main_reload_internal_wdg();
@ -277,11 +267,6 @@ void pwr_save_after_stop2_rtc_wakeup_it(void) {
if (pwr_save_number_of_sleep_cycles > 0) {
backup_reg_set_monitor(15);
// // go back to sleep
// // configure how long micro should sleep
// system_clock_configure_auto_wakeup_l4(PWR_SAVE_STOP2_CYCLE_LENGHT_SEC);
//
// pwr_save_enter_stop2();
rte_main_woken_up = RTE_MAIN_GO_TO_INTERMEDIATE_SLEEP;
}
else {

Wyświetl plik

@ -30,5 +30,6 @@ void max31865_pool(void);
int32_t max31865_get_pt100_result();
int32_t max31865_get_result(uint32_t RTDnominal);
max31865_qf_t max31865_get_qf(void);
void max31865_set_state_after_wkup(void);
#endif /* INCLUDE_DRIVERS_MAX31865_H_ */

Wyświetl plik

@ -12,6 +12,7 @@ typedef enum gsm_sim800_state_t {
SIM800_UNKNOWN,
SIM800_POWERED_OFF,
SIM800_POWERING_ON,
SIM800_WAITING_FOR_POWERUP,
SIM800_NOT_YET_COMM,
SIM800_HANDSHAKING,
SIM800_INITIALIZING,

Wyświetl plik

@ -501,3 +501,10 @@ int32_t max31865_get_result(uint32_t RTDnominal) {
max31865_qf_t max31865_get_qf(void) {
return max31865_quality_factor;
}
void max31865_set_state_after_wkup(void) {
max31865_current_state = MAX_SHUTDOWN;
max31865_shutdown_ticks = MAX31865_INTERVAL - 1;
}

Wyświetl plik

@ -363,16 +363,20 @@ void gsm_sim800_initialization_pool(srl_context_t * srl_context, gsm_sim800_stat
else if (*state == SIM800_POWERING_ON) {
gsm_sim800_press_pwr_button();
*state = SIM800_WAITING_FOR_POWERUP;
}
else if (*state == SIM800_WAITING_FOR_POWERUP) {
// depress power button
gsm_sim800_depress_pwr_button();
// give GSM module some time for its bootup to complete
*state = SIM800_NOT_YET_COMM;
}
else if (*state == SIM800_NOT_YET_COMM) {
// depress power button
gsm_sim800_depress_pwr_button();
// configure rx timeout
srl_switch_timeout(srl_context, 1, 0);
// configure rx timeout - give some more time
srl_switch_timeout(srl_context, 1, 3000u);
// send handshake
srl_send_data(srl_context, (const uint8_t*) AUTOBAUD_STRING, SRL_MODE_ZERO, strlen(AUTOBAUD_STRING), SRL_INTERNAL);