diff --git a/doc/eclipse_debugger_launch/ParaMETEO-STM32L476RG.launch b/doc/eclipse_debugger_launch/ParaMETEO-STM32L476RG.launch index 825de83..983b8e5 100644 --- a/doc/eclipse_debugger_launch/ParaMETEO-STM32L476RG.launch +++ b/doc/eclipse_debugger_launch/ParaMETEO-STM32L476RG.launch @@ -1,6 +1,6 @@ - + diff --git a/src/main.c b/src/main.c index 6f4cc68..9a548c2 100644 --- a/src/main.c +++ b/src/main.c @@ -815,6 +815,32 @@ int main(int argc, char* argv[]){ led_control_led1_upper(false); led_control_led2_bottom(false); +#if defined(PARAMETEO) + pwr_save_switch_mode_to_c0(); + + // sleep a little bit and wait for everything to power up completely + delay_fixed(1000); + + led_control_led1_upper(true); + led_control_led2_bottom(false); + + delay_fixed(1000); + + led_control_led1_upper(false); + led_control_led2_bottom(true); + + delay_fixed(1000); + + led_control_led1_upper(true); + led_control_led2_bottom(true); + + delay_fixed(1000); + + led_control_led1_upper(false); + led_control_led2_bottom(false); + +#endif + // configuting system timers TimerConfig(); @@ -830,12 +856,9 @@ int main(int argc, char* argv[]){ io_ext_watchdog_service(); -#if defined(PARAMETEO) - pwr_save_switch_mode_to_c0(); -#endif - - if (main_config_data_basic-> beacon_at_bootup == 1) - beacon_send_own(); + if (main_config_data_basic-> beacon_at_bootup == 1) { + beacon_send_own(); + } // Infinite loop while (1) @@ -853,11 +876,6 @@ int main(int argc, char* argv[]){ #if defined(PARATNC_HWREV_A) || defined(PARATNC_HWREV_B) || defined(PARATNC_HWREV_C) // read the state of a button input if (GPIO_ReadInputDataBit(GPIOA, GPIO_Pin_0)) { -#endif -#ifdef STM32L471xx - // read the state of a button input - if (LL_GPIO_IsInputPinSet(GPIOA, LL_GPIO_PIN_0)) { -#endif // if modem is not busy on transmitting something and the button is not // inhibited @@ -887,6 +905,8 @@ int main(int argc, char* argv[]){ else { button_inhibit = 0; } +#endif + // if new packet has been received from radio channel if(ax25_new_msg_rx_flag == 1) { diff --git a/src/pwr_save.c b/src/pwr_save.c index 2aac057..1d05eed 100644 --- a/src/pwr_save.c +++ b/src/pwr_save.c @@ -13,6 +13,7 @@ #include "pwr_switch.h" #include "io.h" +#include "LedConfig.h" #include "packet_tx_handler.h" #include "wx_handler.h" #include "main.h" @@ -407,6 +408,13 @@ void pwr_save_switch_mode_to_l6(uint16_t sleep_time) { system_clock_configure_auto_wakeup_l4(sleep_time); + // save how long the micro will sleep - required for handling wakeup event + pwr_save_sleep_time_in_seconds = sleep_time; + + // turn off leds to save power + led_control_led1_upper(false); + led_control_led2_bottom(false); + pwr_save_enter_stop2(); @@ -445,6 +453,10 @@ void pwr_save_switch_mode_to_l7(uint16_t sleep_time) { // save how long the micro will sleep - required for handling wakeup event pwr_save_sleep_time_in_seconds = sleep_time; + // turn off leds to save power + led_control_led1_upper(false); + led_control_led2_bottom(false); + pwr_save_enter_stop2(); }