few improvements in powersaving

pull/7/head
Mateusz Lubecki 2021-09-22 23:48:19 +02:00
rodzic 790b611e2b
commit a34cbc961e
3 zmienionych plików z 44 dodań i 12 usunięć

Wyświetl plik

@ -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="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#10;&lt;peripherals&gt;&#10; &lt;peripheral name=&quot;GPIOB&quot;/&gt;&#10; &lt;peripheral name=&quot;TIM4&quot;/&gt;&#10; &lt;peripheral name=&quot;DMA1&quot;/&gt;&#10; &lt;peripheral name=&quot;GPIOC&quot;/&gt;&#10;&lt;/peripherals&gt;&#10;"/>
<stringAttribute key="ilg.gnumcueclipse.debug.gdbjtag.PERIPHERALS" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#10;&lt;peripherals&gt;&#10; &lt;peripheral name=&quot;GPIOB&quot;/&gt;&#10; &lt;peripheral name=&quot;TIM4&quot;/&gt;&#10; &lt;peripheral name=&quot;DMA1&quot;/&gt;&#10; &lt;peripheral name=&quot;GPIOC&quot;/&gt;&#10; &lt;peripheral name=&quot;I2C1&quot;/&gt;&#10;&lt;/peripherals&gt;&#10;"/>
<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"/>

Wyświetl plik

@ -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) {

Wyświetl plik

@ -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();
}