comparison src/sleepmode.asm @ 631:185ba2f91f59

3.09 beta 1 release
author heinrichsweikamp
date Fri, 28 Feb 2020 15:45:07 +0100
parents 237931377539
children 4050675965ea
comparison
equal deleted inserted replaced
630:4cd81bdbf15c 631:185ba2f91f59
1 ;============================================================================= 1 ;=============================================================================
2 ; 2 ;
3 ; File sleepmode.asm combined next generation V3.06.1 3 ; File sleepmode.asm combined next generation V3.08.8
4 ; 4 ;
5 ; Sleep Mode 5 ; Sleep Mode
6 ; 6 ;
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. 7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
8 ;============================================================================== 8 ;==============================================================================
24 #include "mcp.inc" 24 #include "mcp.inc"
25 #include "wait.inc" 25 #include "wait.inc"
26 #include "tft_outputs.inc" 26 #include "tft_outputs.inc"
27 27
28 28
29 extern vault_decodata_into_eeprom 29 extern eeprom_deco_data_write
30 extern option_check_and_store_all
30 extern power_up_switches ; from hwos.asm 31 extern power_up_switches ; from hwos.asm
31 32
32 33
33 ;---- Private local Variables ------------------------------------------------- 34 ;---- Private local Variables -------------------------------------------------
34 35
79 80
80 clrf ADCON0 ; power-down ADC module 81 clrf ADCON0 ; power-down ADC module
81 call disable_rs232 ; power-down USB 82 call disable_rs232 ; power-down USB
82 call I2C_sleep_compass ; power-down compass 83 call I2C_sleep_compass ; power-down compass
83 84
84 call vault_decodata_into_eeprom ; store deco data 85 call eeprom_deco_data_write ; update deco data in EEPROM
86 call eeprom_battery_gauge_write ; update battery gauge in EEPROM
87
88 btfsc options_changed ; do the options need to be stored to EEPROM ?
89 call option_check_and_store_all ; YES - check and store all option values in EEPROM
90 bcf options_changed ; clear flag
91
85 call ext_flash_enable_protection ; enable write protection on external flash 92 call ext_flash_enable_protection ; enable write protection on external flash
86 call update_battery_registers ; update battery registers into EEPROM
87 93
88 clrf sm_timer_10sec ; clear 10 seconds timer 94 clrf sm_timer_10sec ; clear 10 seconds timer
89 clrf sm_timer_10min ; clear 10 minutes timer 95 clrf sm_timer_10min ; clear 10 minutes timer
90 clrf sm_10min_counter ; clear 10mins counter 96 clrf sm_10min_counter ; clear 10mins counter
91 clrf sm_flags ; clear all local flags 97 clrf sm_flags ; clear all local flags
92 98
93 call TFT_Display_FadeOut ; power-down backlight 99 call TFT_Display_FadeOut ; power-down backlight
94 call TFT_DisplayOff ; power-down display 100 call TFT_DisplayOff ; power-down display
95 101
96 sleeploop_loop: 102 sleeploop_loop:
97 btfsc trigger_full_second ; one second in sleep? 103 btfsc trigger_full_second ; one second in sleep?
98 rcall one_sec_sleep ; YES - check switches, pressure sensor, etc. 104 rcall one_sec_sleep ; YES - check switches, pressure sensor, etc.
99 105
100 btfss sleepmode ; shall terminate sleep mode? 106 btfss sleepmode ; shall terminate sleep mode?
291 297
292 298
293 one_hour_sleep: 299 one_hour_sleep:
294 ; tasks every hour in sleep mode mode 300 ; tasks every hour in sleep mode mode
295 bcf trigger_full_hour ; clear one hour flag 301 bcf trigger_full_hour ; clear one hour flag
296 call update_battery_registers ; update battery registers into EEPROM 302 call eeprom_deco_data_write ; update deco data into EEPROM
297 call vault_decodata_into_eeprom ; update tissue pressures into EEPROM 303 call eeprom_battery_gauge_write ; update battery gauge into EEPROM
298 return ; done 304 return ; done
299 305
300 306
301 init_avg_switches: 307 init_avg_switches:
302 ; pause 4 seconds using CPU sleep mode to conserve on battery 308 ; pause 4 seconds using CPU sleep mode to conserve on battery