comparison code_part1/OSTC_code_asm_part1/surfmode.asm @ 681:6e456a6398e0

Hardware4 support
author heinrichsweikamp
date Fri, 25 Jan 2013 18:00:49 +0100
parents c6220d340684
children 39e02673db4c
comparison
equal deleted inserted replaced
680:c6220d340684 681:6e456a6398e0
27 bcf s_unlock_after_sleep ; Lock sensor results 27 bcf s_unlock_after_sleep ; Lock sensor results
28 call restart_set_modes_and_flags ; Sets decomode flags 28 call restart_set_modes_and_flags ; Sets decomode flags
29 clrf lo 29 clrf lo
30 movff lo,char_I_const_ppO2 ; reset to standard mode, OSTC assumes Air breathing at the surface! 30 movff lo,char_I_const_ppO2 ; reset to standard mode, OSTC assumes Air breathing at the surface!
31 31
32 call PLED_brightness_full ; max. brightness 32 call DISP_brightness_full ; max. brightness
33 33
34 call I2CReset 34 call I2CReset
35 call PLED_boot 35 call DISPLAY_boot
36 call PLED_serial ; Show OSTC serial and firmware version 36 call DISP_serial ; Show OSTC serial and firmware version
37 call PLED_clock ; display time 37 call DISP_clock ; display time
38 call update_date ; display date 38 call update_date ; display date
39 call get_battery_voltage ; get battery voltage 39 call get_battery_voltage ; get battery voltage
40 movff last_surfpressure_30min+0,int_I_pres_respiration+0 ; copy surface air pressure to deco routine 40 movff last_surfpressure_30min+0,int_I_pres_respiration+0 ; copy surface air pressure to deco routine
41 movff last_surfpressure_30min+1,int_I_pres_respiration+1 ; 30min old values 41 movff last_surfpressure_30min+1,int_I_pres_respiration+1 ; 30min old values
42 movff last_surfpressure_30min+0,int_I_pres_surface+0 ; copy surface air pressure to deco routine 42 movff last_surfpressure_30min+0,int_I_pres_surface+0 ; copy surface air pressure to deco routine
51 bra surfloop1 51 bra surfloop1
52 btfsc FLAG_apnoe_mode ; Ignore in Apnoe mode 52 btfsc FLAG_apnoe_mode ; Ignore in Apnoe mode
53 bra surfloop1 53 bra surfloop1
54 54
55 ; Startup tasks for decompression modes 55 ; Startup tasks for decompression modes
56 call PLED_display_cns_surface ; Update surface CNS display (If allowed by CF15) 56 call DISP_display_cns_surface ; Update surface CNS display (If allowed by CF15)
57 call PLED_desaturation_time ; display desaturation time 57 call DISP_desaturation_time ; display desaturation time
58 call PLED_nofly_time ; display nofly time 58 call DISP_nofly_time ; display nofly time
59 59
60 call PLED_active_gas_surfmode ; Show start gas 60 call DISP_active_gas_surfmode ; Show start gas
61 61
62 surfloop1: 62 surfloop1:
63 btfss gauge_mode ; Display only in gauge mode 63 btfss gauge_mode ; Display only in gauge mode
64 bra surfloop2 64 bra surfloop2
65 DISPLAYTEXT d'103' ; Gauge mode 65 DISPLAYTEXT d'103' ; Gauge mode
90 bcf standalone_simulator ; Quit simulator mode (if active) 90 bcf standalone_simulator ; Quit simulator mode (if active)
91 WIN_TOP .0 91 WIN_TOP .0
92 WIN_LEFT .0 92 WIN_LEFT .0
93 WIN_FONT FT_SMALL 93 WIN_FONT FT_SMALL
94 WIN_INVERT .0 ; Init new Wordprocessor 94 WIN_INVERT .0 ; Init new Wordprocessor
95 call PLED_standard_color 95 call DISP_standard_color
96 96
97 bcf switch_left 97 bcf switch_left
98 bcf switch_right 98 bcf switch_right
99 call PLED_active_gas_surfmode ; Show start gas / SetPoint 99 call DISP_active_gas_surfmode ; Show start gas / SetPoint
100 call PLED_custom_text ; Displays custom text 100 call DISP_custom_text ; Displays custom text
101 clrf cf_checker_counter ; next cf to check 101 clrf cf_checker_counter ; next cf to check
102 ostc_debug 'G' ; Sends debug-information to screen if debugmode active 102 ostc_debug 'G' ; Sends debug-information to screen if debugmode active
103 103
104 ; Desaturation time needs: 104 ; Desaturation time needs:
105 ; int_I_pres_surface 105 ; int_I_pres_surface
125 125
126 bra surfloop_loop1 ; 126 bra surfloop_loop1 ;
127 127
128 surfloop_loop1: 128 surfloop_loop1:
129 ; One Second tasks for all modes 129 ; One Second tasks for all modes
130 call PLED_clock ; update clock 130 call DISP_clock ; update clock
131 call test_charger ; check if charger IC is active 131 call test_charger ; check if charger IC is active
132 call timeout_surfmode ; check timeout 132 call timeout_surfmode ; check timeout
133 call update_batt_voltage ; display battery voltage 133 call update_batt_voltage ; display battery voltage
134 call timeout_premenu ; timeout premenu 134 call timeout_premenu ; timeout premenu
135 call set_leds_surfmode ; Sets Warning and No-Fly LEDs 135 call set_leds_surfmode ; Sets Warning and No-Fly LEDs
136 call check_customfunctions ; Checks CF functions and displays warning symbol if something critical is wrong 136 call check_customfunctions ; Checks CF functions and displays warning symbol if something critical is wrong
137 call surfcustomview_second ; Do every-second tasks for the custom view area 137 call surfcustomview_second ; Do every-second tasks for the custom view area
138 138
139 ; Every 2 seconds, overwrite with GF value (if needed to display) 139 ; Every 2 seconds, overwrite with GF value (if needed to display)
140 btfsc secs,1 ; Alternating every 2sec (if needed) 140 btfsc secs,1 ; Alternating every 2sec (if needed)
141 call PLED_display_cns_surface ; Display CNS (if > CF15). 141 call DISP_display_cns_surface ; Display CNS (if > CF15).
142 btfss secs,1 142 btfss secs,1
143 call PLED_display_gf_surface ; Display GF (if > CF8). 143 call DISP_display_gf_surface ; Display GF (if > CF8).
144 144
145 btfsc enter_error_sleep ; Enter Fatal Error Routine? 145 btfsc enter_error_sleep ; Enter Fatal Error Routine?
146 call fatal_error_sleep ; Yes (In Sleepmode.asm!) 146 call fatal_error_sleep ; Yes (In Sleepmode.asm!)
147 bcf onesecupdate ; every second tasks done 147 bcf onesecupdate ; every second tasks done
148 148
157 btfss s_unlock_after_sleep ; sensor results locked? 157 btfss s_unlock_after_sleep ; sensor results locked?
158 bra surfloop_loop3 ; Yes, ignore 158 bra surfloop_loop3 ; Yes, ignore
159 159
160 ; New sensor value available 160 ; New sensor value available
161 call update_surf_press ; display surface pressure 161 call update_surf_press ; display surface pressure
162 call PLED_temp_surfmode ; Displays temperature 162 call DISP_temp_surfmode ; Displays temperature
163 call set_dive_modes ; tests if depth>threshold 163 call set_dive_modes ; tests if depth>threshold
164 call altimeter_calc 164 call altimeter_calc
165 movf menupos3,W ; Get customview status. 165 movf menupos3,W ; Get customview status.
166 bnz surfloop_loop3 ; Already used ? 166 bnz surfloop_loop3 ; Already used ?
167 call altimeter_display 167 call altimeter_display
221 bra surfloop_loop ; loop surfacemode 221 bra surfloop_loop ; loop surfacemode
222 222
223 223
224 update_surfloop60: 224 update_surfloop60:
225 ; One minute tasks for all modes 225 ; One minute tasks for all modes
226 ; call PLED_active_gas_surfmode ; Show start gas / SetPoint 226 ; call DISP_active_gas_surfmode ; Show start gas / SetPoint
227 call update_date ; and date in divemode 227 call update_date ; and date in divemode
228 call calc_deko_surfmode ; calculate desaturation every minute 228 call calc_deko_surfmode ; calculate desaturation every minute
229 call check_temp_extrema ; check for new temperature extremas 229 call check_temp_extrema ; check for new temperature extremas
230 call PLED_custom_text ; Displays custom text 230 call DISP_custom_text ; Displays custom text
231 call surfcustomview_minute ; Do every-minute tasks for the custom view area 231 call surfcustomview_minute ; Do every-minute tasks for the custom view area
232 232
233 btfsc gauge_mode ; Ignore in gauge mode 233 btfsc gauge_mode ; Ignore in gauge mode
234 bra update_surfloop60_2 234 bra update_surfloop60_2
235 btfsc FLAG_apnoe_mode ; Ignore in Apnoe mode 235 btfsc FLAG_apnoe_mode ; Ignore in Apnoe mode
236 bra update_surfloop60_2 236 bra update_surfloop60_2
237 237
238 ; One Minute tasks for deco modes 238 ; One Minute tasks for deco modes
239 call PLED_nofly_time ; display nofly time 239 call DISP_nofly_time ; display nofly time
240 call PLED_desaturation_time ; display desaturation time 240 call DISP_desaturation_time ; display desaturation time
241 btfsc premenu ; Not when "Menu?" is displayed! 241 btfsc premenu ; Not when "Menu?" is displayed!
242 bra update_surfloop60_2 242 bra update_surfloop60_2
243 243
244 update_surfloop60_2: 244 update_surfloop60_2:
245 bcf oneminupdate 245 bcf oneminupdate
446 GETCUSTOM8 d'4' ; loads premenu_timeout into WREG 446 GETCUSTOM8 d'4' ; loads premenu_timeout into WREG
447 cpfsgt timeout_counter3 ; ... longer then premenu_timeout 447 cpfsgt timeout_counter3 ; ... longer then premenu_timeout
448 return ; No! 448 return ; No!
449 bcf premenu ; Yes, so clear "Menu?" and clear pre_menu bit 449 bcf premenu ; Yes, so clear "Menu?" and clear pre_menu bit
450 450
451 call PLED_topline_box_clear ; Clears Bar at the top 451 call DISP_topline_box_clear ; Clears Bar at the top
452 452
453 btfsc gauge_mode 453 btfsc gauge_mode
454 bra timeout_premenu2 ; Skip in Gauge mode 454 bra timeout_premenu2 ; Skip in Gauge mode
455 btfsc FLAG_apnoe_mode 455 btfsc FLAG_apnoe_mode
456 bra timeout_premenu2 ; Skip in Apnoe mode 456 bra timeout_premenu2 ; Skip in Apnoe mode
457 457
458 timeout_premenu2: 458 timeout_premenu2:
459 call update_surf_press ; rewrite serial number 459 call update_surf_press ; rewrite serial number
460 call PLED_serial ; rewrite serial number 460 call DISP_serial ; rewrite serial number
461 clrf timeout_counter3 ; Also clear timeout 461 clrf timeout_counter3 ; Also clear timeout
462 bcf switch_left ; and debounce switches 462 bcf switch_left ; and debounce switches
463 bcf switch_right 463 bcf switch_right
464 return 464 return
465 465
478 bcf INTCON3,INT1IF ; Clear flag 478 bcf INTCON3,INT1IF ; Clear flag
479 return 479 return
480 480
481 test_switches_surfmode3: 481 test_switches_surfmode3:
482 bcf switch_right 482 bcf switch_right
483 call PLED_topline_box ; Write a filled bar at the top 483 call DISP_topline_box ; Write a filled bar at the top
484 WIN_INVERT .1 ; Init new Wordprocessor 484 WIN_INVERT .1 ; Init new Wordprocessor
485 DISPLAYTEXT .4 ;Menu? 485 DISPLAYTEXT .4 ;Menu?
486 WIN_INVERT .0 ; Init new Wordprocessor 486 WIN_INVERT .0 ; Init new Wordprocessor
487 bsf premenu 487 bsf premenu
488 clrf timeout_counter2 488 clrf timeout_counter2