kopia lustrzana https://github.com/SP8EBC/ParaTNC
few improvements in powersaving
rodzic
790b611e2b
commit
a34cbc961e
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<launchConfiguration type="ilg.gnumcueclipse.debug.gdbjtag.openocd.launchConfigurationType">
|
||||
<stringAttribute key="ilg.gnumcueclipse.debug.gdbjtag.PERIPHERALS" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <peripherals> <peripheral name="GPIOB"/> <peripheral name="TIM4"/> <peripheral name="DMA1"/> <peripheral name="GPIOC"/> </peripherals> "/>
|
||||
<stringAttribute key="ilg.gnumcueclipse.debug.gdbjtag.PERIPHERALS" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <peripherals> <peripheral name="GPIOB"/> <peripheral name="TIM4"/> <peripheral name="DMA1"/> <peripheral name="GPIOC"/> <peripheral name="I2C1"/> </peripherals> "/>
|
||||
<booleanAttribute key="ilg.gnumcueclipse.debug.gdbjtag.openocd.doContinue" value="true"/>
|
||||
<booleanAttribute key="ilg.gnumcueclipse.debug.gdbjtag.openocd.doDebugInRam" value="false"/>
|
||||
<booleanAttribute key="ilg.gnumcueclipse.debug.gdbjtag.openocd.doFirstReset" value="true"/>
|
||||
|
|
42
src/main.c
42
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) {
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue