annotate src/surfmode.asm @ 598:e1f0f5e3d4e4

BUGFIX: Internal deco planner did not display results in imperial units
author heinrichsweikamp
date Mon, 30 Jul 2018 19:45:53 +0200
parents e81cf407261a
children ca4556fb60b9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
heinrichsweikamp
parents:
diff changeset
1 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
2 ;
587
e81cf407261a V2.97 SP1
heinrichsweikamp
parents: 582
diff changeset
3 ; File surfmode.asm REFACTORED VERSION V2.97 SP1
0
heinrichsweikamp
parents:
diff changeset
4 ;
heinrichsweikamp
parents:
diff changeset
5 ; Surfacemode
heinrichsweikamp
parents:
diff changeset
6 ;
heinrichsweikamp
parents:
diff changeset
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
heinrichsweikamp
parents:
diff changeset
8 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
9 ; HISTORY
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
10 ; 2011-08-07 : [mH] moving from OSTC code
0
heinrichsweikamp
parents:
diff changeset
11
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
12 #include "hwos.inc" ; Mandatory header
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
13 #include "shared_definitions.h" ; Mailbox from/to p2_deco.c
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
14 #include "start.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
15 #include "tft.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
16 #include "tft_outputs.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
17 #include "isr.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
18 #include "adc_lightsensor.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
19 #include "menu_processor.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
20 #include "strings.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
21 #include "sleepmode.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
22 #include "wait.inc" ; speed_*
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
23 #include "external_flash.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
24 #include "customview.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
25 #include "divemode.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
26 #include "mcp.inc" ; RX
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
27 #include "i2c.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
28 #include "comm.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
29 #include "eeprom_rs232.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
30 #include "calibrate.inc"
0
heinrichsweikamp
parents:
diff changeset
31
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
32 extern do_main_menu
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
33 extern color_image
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
34
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
35
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
36 ;---- Private local variables -------------------------------------------------
213
3b5df65d53fc layout changes
heinrichsweikamp
parents: 205
diff changeset
37
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
38 CBLOCK local1 ; max size is 16 Byte !!!
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
39 ; currently not used
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
40 ENDC ; used: 0 byte, remaining: 16 byte
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
41
0
heinrichsweikamp
parents:
diff changeset
42
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
43 #DEFINE menu_pos_row .215
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
44 #DEFINE menu_pos_column .1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
45 #DEFINE view_row .215
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
46 #DEFINE view_column .124
0
heinrichsweikamp
parents:
diff changeset
47
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
48 gui CODE
0
heinrichsweikamp
parents:
diff changeset
49
heinrichsweikamp
parents:
diff changeset
50 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
51 ; Boot tasks for all modes
heinrichsweikamp
parents:
diff changeset
52 global surfloop
heinrichsweikamp
parents:
diff changeset
53 surfloop:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
54 call speed_normal
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
55 bcf no_sensor_int ; Normal pressure mode
0
heinrichsweikamp
parents:
diff changeset
56
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
57 bcf LEDr
245
416723c8ccd8 use single-byte hardware flag (again)
heinrichsweikamp
parents: 235
diff changeset
58
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
59 clrf CCP1CON ; stop PWM
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
60 bcf PORTC,2 ; Pull PWM output to GND
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
61 call TFT_boot ; Initialize TFT (includes clear screen)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
62 bcf restore_deco_data
0
heinrichsweikamp
parents:
diff changeset
63
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
64 WIN_TOP .50
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
65 WIN_LEFT .10
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
66 movlw LOW 0x1E000
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
67 movwf TBLPTRL
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
68 movlw HIGH 0x1E000
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
69 movwf TBLPTRH
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
70 movlw UPPER 0x1E000
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
71 movwf TBLPTRU
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
72 call color_image ; Show logo
0
heinrichsweikamp
parents:
diff changeset
73
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
74 WIN_TOP .100
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
75 WIN_LEFT .34
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
76 extern ostc_logo_block
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
77 movlw LOW ostc_logo_block
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
78 movwf TBLPTRL
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
79 movlw HIGH ostc_logo_block ; &0xFFFF
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
80 movwf TBLPTRH
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
81 movlw UPPER ostc_logo_block
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
82 movwf TBLPTRU
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
83 call color_image
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
84 call TFT_Display_FadeIn ; Show splash
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
85 call TFT_serial ; Show serial and firmware version
0
heinrichsweikamp
parents:
diff changeset
86
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
87 ;---- Do any useful initializes that takes time -------------------------
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
88 call restart_set_modes_and_flags ; Sets deco mode flags
0
heinrichsweikamp
parents:
diff changeset
89 bcf pressure_refresh
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
90 call I2C_init_compass
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
91 call I2C_init_accelerometer
0
heinrichsweikamp
parents:
diff changeset
92 clrf ext_flash_address+0
heinrichsweikamp
parents:
diff changeset
93 clrf ext_flash_address+1
heinrichsweikamp
parents:
diff changeset
94 clrf ext_flash_address+2
heinrichsweikamp
parents:
diff changeset
95
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
96 movlw surface_sp ; in cbar
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
97 call transmit_setpoint ; Transmit current setpoint from WREG (in cbar) to external electronics
221
90923a081ae7 minor: configure buttons during splash screen
heinrichsweikamp
parents: 213
diff changeset
98
0
heinrichsweikamp
parents:
diff changeset
99 clrf timeout_counter2
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
100 ; clrf timeout_counter3 ; not used / required [rl]
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
101 bcf menubit ; clear menu flag
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
102 bcf premenu
0
heinrichsweikamp
parents:
diff changeset
103 clrf last_pressure+0
heinrichsweikamp
parents:
diff changeset
104 clrf last_pressure+1
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
105 bcf is_bailout ; =1: Bailout
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
106 bcf ccr_diluent_setup ; Use OC gases for gaslist routine
0
heinrichsweikamp
parents:
diff changeset
107
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
108 bcf simulatormode_active ; Quit simulator mode (if active)
0
heinrichsweikamp
parents:
diff changeset
109
heinrichsweikamp
parents:
diff changeset
110 ;---- Fade to standard surface view --------------------------------------
heinrichsweikamp
parents:
diff changeset
111 ; Wait 1 second
heinrichsweikamp
parents:
diff changeset
112 bcf onesecupdate
heinrichsweikamp
parents:
diff changeset
113 btfss onesecupdate
heinrichsweikamp
parents:
diff changeset
114 bra $-2
heinrichsweikamp
parents:
diff changeset
115 ; Wait 1 second
heinrichsweikamp
parents:
diff changeset
116 bcf onesecupdate
heinrichsweikamp
parents:
diff changeset
117 btfss onesecupdate
heinrichsweikamp
parents:
diff changeset
118 bra $-2
heinrichsweikamp
parents:
diff changeset
119
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
120 call TFT_Display_FadeOut ; Go to black screen
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
121 call TFT_ClearScreen ; Then change everything
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
122 WIN_TOP .0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
123 WIN_LEFT .0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
124 WIN_FONT FT_SMALL
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
125 bcf win_invert ; Reset invert flag
0
heinrichsweikamp
parents:
diff changeset
126
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
127 WIN_COLOR color_lightblue
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
128 WIN_SMALL menu_pos_column,menu_pos_row
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
129 STRCPY_TEXT_PRINT tMenu ;"<Menu"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
130 WIN_SMALL view_column,view_row
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
131 STRCPY_TEXT_PRINT tView ;"View>"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
132 call TFT_standard_color
0
heinrichsweikamp
parents:
diff changeset
133
48
7c7d7644ca37 Time and Date in normal (Not tiny) font
heinrichsweikamp
parents: 39
diff changeset
134 ; Logo
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
135 WIN_TOP .0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
136 WIN_LEFT .70
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
137 movlw LOW ostc_logo_block
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
138 movwf TBLPTRL
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
139 movlw HIGH ostc_logo_block ; &0xFFFF
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
140 movwf TBLPTRH
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
141 movlw UPPER ostc_logo_block
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
142 movwf TBLPTRU
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
143 call color_image
0
heinrichsweikamp
parents:
diff changeset
144
158
683321c09cfa nicer boot into surfacemode
heinrichsweikamp
parents: 145
diff changeset
145 call TFT_clock ; display time
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
146 call update_surfloop60
158
683321c09cfa nicer boot into surfacemode
heinrichsweikamp
parents: 145
diff changeset
147 call get_battery_voltage ; get battery voltage
683321c09cfa nicer boot into surfacemode
heinrichsweikamp
parents: 145
diff changeset
148 call TFT_update_batt_voltage ; display battery voltage
683321c09cfa nicer boot into surfacemode
heinrichsweikamp
parents: 145
diff changeset
149 call TFT_update_surf_press ; display surface pressure
683321c09cfa nicer boot into surfacemode
heinrichsweikamp
parents: 145
diff changeset
150 call TFT_temp_surfmode ; Displays temperature
683321c09cfa nicer boot into surfacemode
heinrichsweikamp
parents: 145
diff changeset
151 call TFT_display_decotype_surface
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 535
diff changeset
152 call calc_deko_divemode_sensor
234
57155164faad Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents: 233
diff changeset
153
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
154 movff opt_dive_mode,lo ; 0=OC, 1=CC, 2=Gauge, 3=Apnea, 4=PSCR
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
155 tstfsz lo
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
156 bra surfloop_no_oc ; Not OC
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
157 call TFT_show_OC_startgas_surface; Show first gas and "OSTC2-like" active gases
232
fe9d88fee09f show start gas in OC mode permanently
mh@mh-THINK
parents: 230
diff changeset
158 surfloop_no_oc:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
159 movff customview_surfmode,menupos3; Reload last customview
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
160 call surf_customview_mask ; Update #menupos3 view
0
heinrichsweikamp
parents:
diff changeset
161
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
162 call TFT_Display_FadeIn ; Display resulting surface screen.
0
heinrichsweikamp
parents:
diff changeset
163
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 535
diff changeset
164 bcf switch_left
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 535
diff changeset
165 bcf switch_right
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
166
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
167 ;---- Late initializations -----------------------------------------------
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
168 movff last_surfpressure_30min+0,int_I_pres_respiration+0 ; copy surface air pressure to deco routine
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
169 movff last_surfpressure_30min+1,int_I_pres_respiration+1 ; 30min old values
0
heinrichsweikamp
parents:
diff changeset
170 movff last_surfpressure_30min+0,int_I_pres_surface+0 ; copy surface air pressure to deco routine
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
171 movff last_surfpressure_30min+1,int_I_pres_surface+1 ; 30min old values
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
172 movff last_surfpressure_30min+0,last_surfpressure+0 ; Use 30min old airpressure
0
heinrichsweikamp
parents:
diff changeset
173 movff last_surfpressure_30min+1,last_surfpressure+1 ; Use 30min old airpressure
heinrichsweikamp
parents:
diff changeset
174
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 535
diff changeset
175 movff opt_GF_low,char_I_GF_Low_percentage
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 535
diff changeset
176 movff opt_GF_high,char_I_GF_High_percentage
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
177
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
178 ; Startup tasks for all modes
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
179 ; Desaturation time needs:
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
180 ; int_I_pres_surface
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
181 ; char_I_desaturation_multiplier
0
heinrichsweikamp
parents:
diff changeset
182 call deco_calc_desaturation_time ; calculate desaturation time
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 535
diff changeset
183 banksel common
0
heinrichsweikamp
parents:
diff changeset
184
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
185 btfsc enable_screen_dumps ; =1: Ignore vin_usb, wait for "l" command (Screen dump)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
186 call enable_rs232 ; Also sets to speed_normal ...
0
heinrichsweikamp
parents:
diff changeset
187
heinrichsweikamp
parents:
diff changeset
188 surfloop_loop:
heinrichsweikamp
parents:
diff changeset
189 btfss onesecupdate ; do every second tasks?
heinrichsweikamp
parents:
diff changeset
190 bra surfloop_loop2 ; no, loop
heinrichsweikamp
parents:
diff changeset
191
heinrichsweikamp
parents:
diff changeset
192 ; One Second tasks for all modes
heinrichsweikamp
parents:
diff changeset
193 call speed_normal
487
heinrichsweikamp
parents: 485
diff changeset
194 ;call TFT_debug_output
0
heinrichsweikamp
parents:
diff changeset
195 call TFT_clock ; update clock
heinrichsweikamp
parents:
diff changeset
196 call timeout_surfmode ; check timeout
heinrichsweikamp
parents:
diff changeset
197 call get_battery_voltage ; get battery voltage
heinrichsweikamp
parents:
diff changeset
198 call TFT_update_batt_voltage ; display battery voltage
heinrichsweikamp
parents:
diff changeset
199 call set_dive_modes ; tests if depth>threshold
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
200 btfss secs,0 ; Every two seconds...
0
heinrichsweikamp
parents:
diff changeset
201 call TFT_temp_surfmode ; Displays temperature
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
202 btfss secs,0 ; Every two seconds...
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
203 call surfmode_check_for_warnings ; ... check for warnings (and display/update) them
0
heinrichsweikamp
parents:
diff changeset
204 bcf onesecupdate ; every second tasks done
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
205
0
heinrichsweikamp
parents:
diff changeset
206 surfloop_loop2:
heinrichsweikamp
parents:
diff changeset
207 ; Tasks approx. every 50ms for all modes
heinrichsweikamp
parents:
diff changeset
208 call test_switches_surfmode ; check switches
487
heinrichsweikamp
parents: 485
diff changeset
209 call TFT_debug_output
0
heinrichsweikamp
parents:
diff changeset
210
heinrichsweikamp
parents:
diff changeset
211 ; One minute tasks for all modes
heinrichsweikamp
parents:
diff changeset
212 btfsc oneminupdate ; do every minute tasks
heinrichsweikamp
parents:
diff changeset
213 call update_surfloop60 ; yes, e.g. update time and date
heinrichsweikamp
parents:
diff changeset
214
heinrichsweikamp
parents:
diff changeset
215 ; Mode tasks
230
f6548e8f06f5 Bugfix: Check for divemode before checking for menu
mh@mh-THINK
parents: 226
diff changeset
216 btfsc divemode ; Divemode active?
f6548e8f06f5 Bugfix: Check for divemode before checking for menu
mh@mh-THINK
parents: 226
diff changeset
217 goto diveloop ; Yes, switch into Divemode!
f6548e8f06f5 Bugfix: Check for divemode before checking for menu
mh@mh-THINK
parents: 226
diff changeset
218
0
heinrichsweikamp
parents:
diff changeset
219 btfsc menubit ; Menu?
heinrichsweikamp
parents:
diff changeset
220 goto do_main_menu ; Menu!
heinrichsweikamp
parents:
diff changeset
221
heinrichsweikamp
parents:
diff changeset
222 btfsc pressure_refresh ; new pressure available?
heinrichsweikamp
parents:
diff changeset
223 call TFT_update_surf_press ; display surface pressure
heinrichsweikamp
parents:
diff changeset
224 bcf pressure_refresh ; until new pressure is available
heinrichsweikamp
parents:
diff changeset
225
188
ebc28381f17d NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents: 187
diff changeset
226 ; Updates every 1/4 second
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
227 btfss quarter_second_update
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
228 bra surfloop_loop2b
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
229
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
230 bcf quarter_second_update
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
231
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
232 ; Update Sensors
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
233 call calc_deko_divemode_sensor
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
234
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
235 btfsc FLAG_ccr_mode ; In CCR mode?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
236 bra surfloop_loop2a1 ; Yes.
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
237 btfss FLAG_pscr_mode ; In PSCR mode?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
238 bra surfloop_loop2a ; No, skip
188
ebc28381f17d NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents: 187
diff changeset
239
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
240 surfloop_loop2a1:
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
241 movff opt_ccr_mode,WREG ; =0: Fixed SP, =1: Sensor, =2: Auto SP
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
242 sublw .1 ; opt_ccr_mode = 1 (Sensor)?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
243 bnz surfloop_loop2a ; No, skip
476
7c10557c248e no sensors in surface mode if the computer has no sensor inputs
heinrichsweikamp
parents: 382
diff changeset
244
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
245 call TFT_surface_sensor ; ...update sensor data in surface mode
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
246 call TFT_sensor_surface_warning ; Show a warning arrow-down behind sensor readings when sensor is end-of-life
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
247 movlw .9
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
248 cpfseq menupos3 ; in Sensor mV surface custom view?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
249 bra surfloop_loop2a ; No
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
250 extern TFT_sensor_mV
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
251 call TFT_sensor_mV ; Yes, update mV readings (Each 1/4 second and not each second as in customview.asm)
188
ebc28381f17d NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents: 187
diff changeset
252
476
7c10557c248e no sensors in surface mode if the computer has no sensor inputs
heinrichsweikamp
parents: 382
diff changeset
253 surfloop_loop2a:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
254 movlw .6
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
255 cpfseq menupos3 ; in compass view?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
256 bra surfloop_loop2b ; No
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
257 extern TFT_surface_compass_heading
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
258 call TFT_surface_compass_heading ; Yes, update compass heading value
0
heinrichsweikamp
parents:
diff changeset
259
476
7c10557c248e no sensors in surface mode if the computer has no sensor inputs
heinrichsweikamp
parents: 382
diff changeset
260 surfloop_loop2b:
0
heinrichsweikamp
parents:
diff changeset
261 btfsc toggle_customview ; Next view?
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
262 call surf_customview_toggle ; Yes, show next customview (and delete this flag)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
263
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
264 btfsc enable_screen_dumps ; =1: Ignore vin_usb, wait for "l" command (Screen dump)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
265 bra surfloop_loop3
0
heinrichsweikamp
parents:
diff changeset
266
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
267 ;btfsc vusb_in ; USB plugged in?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
268 ;call comm_mode ; Start COMM mode
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
269
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
270 bra surfloop_loop4
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
271
0
heinrichsweikamp
parents:
diff changeset
272 surfloop_loop3:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
273 btfss vusb_in ; USB (still) plugged in?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
274 bcf enable_screen_dumps ; No, clear flag
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
275 call rs232_get_byte
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
276 btfsc rs232_receive_overflow
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
277 bra surfloop_loop4
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
278 movlw "l"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
279 cpfseq RCREG1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
280 bra surfloop_loop4
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
281 call TFT_dump_screen ; Dump the screen contents
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
282
0
heinrichsweikamp
parents:
diff changeset
283 surfloop_loop4:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
284 btfss sleepmode ; shall we go into sleepmode?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
285 bra surfloop_loop ; NO - loop in surfacemode
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
286 movff menupos3,customview_surfmode; YES - save last customview
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
287 goto sleeploop ; switch into sleepmode
0
heinrichsweikamp
parents:
diff changeset
288
heinrichsweikamp
parents:
diff changeset
289
heinrichsweikamp
parents:
diff changeset
290 update_surfloop60:
heinrichsweikamp
parents:
diff changeset
291 ; One minute tasks for all modes
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
292 call TFT_date ; Update date
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
293
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
294 call deco_calc_dive_interval_1min; calculate deco in surface mode. int_I_pres_surface gets updated by
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
295 call deco_calc_desaturation_time ; TFT_update_surf_press when amb_pressure has changed by >= 10 mbar
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 535
diff changeset
296 banksel common
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
297
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 535
diff changeset
298 ; update tissue diagram if it is on display
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
299 movlw .5 ; number of tissue custom view
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
300 cpfseq menupos3 ; is this the current customview?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
301 bra update_surfloop60_1 ; NO
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
302 call TFT_standard_color ; YES - set standard color
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
303 call TFT_surface_tissues ; show tissue diagram
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
304
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 535
diff changeset
305 update_surfloop60_1:
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 535
diff changeset
306 ; update last dive info if it is on display
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
307 movlw .8 ; number of the last dive info customview
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
308 cpfseq menupos3 ; is this the current customview?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
309 bra update_surfloop60_2 ; NO
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
310 call TFT_standard_color ; YES - set standard color
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
311 call TFT_surface_lastdive ; show last dive infos
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
312
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 535
diff changeset
313 update_surfloop60_2:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
314 bcf oneminupdate
0
heinrichsweikamp
parents:
diff changeset
315 return
heinrichsweikamp
parents:
diff changeset
316
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
317 extern check_cns_violation,check_warn_battery,check_and_store_gf_violation
0
heinrichsweikamp
parents:
diff changeset
318 surfmode_check_for_warnings:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
319 bcf warning_active ; Clear flag
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
320 clrf warning_counter ; Clear counter
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 535
diff changeset
321
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
322 ; Warnings for all modes
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
323 call check_warn_battery ; Check if the battery level should be displayed/warned
0
heinrichsweikamp
parents:
diff changeset
324
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
325 btfsc FLAG_apnoe_mode ; Done for Apnoe or Gauge mode
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
326 bra surfmode_check_for_warnings2
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
327 btfsc FLAG_gauge_mode ; Done for Apnoe or Gauge mode
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
328 bra surfmode_check_for_warnings2
0
heinrichsweikamp
parents:
diff changeset
329
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
330 ; Warnings only in deco modes
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
331 rcall surfmode_check_for_desat ; Check if desat time should be shown
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
332 rcall surfmode_check_for_nofly ; Check if nofly time should be shown
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
333 call check_cns_violation ; Check CNS value and display it, if required
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
334 call check_and_store_gf_violation; Check GF value and display it, if required
0
heinrichsweikamp
parents:
diff changeset
335
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
336 movff char_O_deco_warnings,WREG ; bank-safe copy for deco warnings
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
337 btfsc WREG,mbubble_warning_lock ; do we have a microbubbles warning?
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 535
diff changeset
338 extern warn_mbubbles
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
339 call warn_mbubbles ; YES
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 535
diff changeset
340
0
heinrichsweikamp
parents:
diff changeset
341 surfmode_check_for_warnings2:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
342 ; Setup warning_page number
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
343 incf warning_page,F
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
344 bcf STATUS,C
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
345 rlcf warning_page,W ; *2
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
346 cpfsgt warning_counter ; > warning_counter
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
347 clrf warning_page ; No, clear
0
heinrichsweikamp
parents:
diff changeset
348
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
349 ; Clear both rows of warnings if there is nothing to show at all
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
350 tstfsz warning_counter ; any warnings?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
351 bra surfmode_check_for_warnings3; YES - look if second row needs to be cleared
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
352 call TFT_clear_warning_text ; NO - clear complete warnings area
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
353 return
0
heinrichsweikamp
parents:
diff changeset
354
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
355 surfmode_check_for_warnings3:
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
356 ; Clear 2nd row of warnings if there is nothing to show (on this page)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
357 btfss second_row_warning ; =1: The second row contains a warning
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
358 call TFT_clear_warning_text_2nd_row ; No, clear this row
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
359 return ; Done.
0
heinrichsweikamp
parents:
diff changeset
360
heinrichsweikamp
parents:
diff changeset
361 surfmode_check_for_desat:
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 535
diff changeset
362 banksel int_O_desaturation_time
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
363 movf int_O_desaturation_time+0,W ; is nofly-time null ?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
364 iorwf int_O_desaturation_time+1,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
365 banksel common
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
366 bnz surfmode_check_for_desat_1 ; NO
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
367 return
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
368 surfmode_check_for_desat_1: ; YES
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
369 incf warning_counter,F ; increase counter
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
370 call TFT_desaturation_time ; show desaturation time
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
371 return
0
heinrichsweikamp
parents:
diff changeset
372
heinrichsweikamp
parents:
diff changeset
373 surfmode_check_for_nofly:
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 535
diff changeset
374 banksel int_O_nofly_time
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
375 movf int_O_nofly_time+0,W ; is nofly-time null ?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
376 iorwf int_O_nofly_time+1,W
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 535
diff changeset
377 banksel common
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
378 bnz surfmode_check_for_nofly_1 ; No...
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
379 return
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
380 surfmode_check_for_nofly_1: ; YES
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
381 incf warning_counter,F ; increase counter
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
382 call TFT_nofly_time ; show nofly-time
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
383 return
0
heinrichsweikamp
parents:
diff changeset
384
heinrichsweikamp
parents:
diff changeset
385
heinrichsweikamp
parents:
diff changeset
386 ;=============================================================================
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 535
diff changeset
387
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
388 test_switches_surfmode: ; checks switches in surfacemode
0
heinrichsweikamp
parents:
diff changeset
389 btfsc switch_right
heinrichsweikamp
parents:
diff changeset
390 bra test_switches_surfmode2
heinrichsweikamp
parents:
diff changeset
391 btfsc switch_left
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
392 bra test_switches_surfmode3
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
393 ; No button pressed
0
heinrichsweikamp
parents:
diff changeset
394 return
heinrichsweikamp
parents:
diff changeset
395
heinrichsweikamp
parents:
diff changeset
396 test_switches_surfmode3:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
397 movlw .6
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
398 cpfseq menupos3 ; in compass view?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
399 bra test_switches_surfmode3a ; No
382
6f3530eb48f9 allow compass bearing on surface
heinrichsweikamp
parents: 375
diff changeset
400
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
401 btfsc premenu ; already shown "Bearing"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
402 bra test_switches_surfmode3b ; Yes, remove it
382
6f3530eb48f9 allow compass bearing on surface
heinrichsweikamp
parents: 375
diff changeset
403
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
404 extern TFT_surf_set_bearing
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
405 call TFT_surf_set_bearing ; Yes.
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
406 bcf switch_left
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
407 return
382
6f3530eb48f9 allow compass bearing on surface
heinrichsweikamp
parents: 375
diff changeset
408
6f3530eb48f9 allow compass bearing on surface
heinrichsweikamp
parents: 375
diff changeset
409 test_switches_surfmode3a:
0
heinrichsweikamp
parents:
diff changeset
410 bcf switch_left
587
e81cf407261a V2.97 SP1
heinrichsweikamp
parents: 582
diff changeset
411 bcf compass_bearing_set ; clear bearing on entering menu
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 535
diff changeset
412 bsf menubit ; Enter Menu!
0
heinrichsweikamp
parents:
diff changeset
413 return
heinrichsweikamp
parents:
diff changeset
414
382
6f3530eb48f9 allow compass bearing on surface
heinrichsweikamp
parents: 375
diff changeset
415 test_switches_surfmode3b:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
416 ; Clear "Heading?"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
417 WIN_BOX_BLACK .158,.190, .15, .99 ; top, bottom, left, right
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
418 bcf premenu
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
419 bcf switch_left
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
420 return
382
6f3530eb48f9 allow compass bearing on surface
heinrichsweikamp
parents: 375
diff changeset
421
0
heinrichsweikamp
parents:
diff changeset
422 test_switches_surfmode2:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
423 movlw .6
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
424 cpfseq menupos3 ; in compass view?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
425 bra test_switches_surfmode2a ; No
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
426 btfss premenu ; "Heading?" shown?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
427 bra test_switches_surfmode2a ; No
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
428 ; Set new heading
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
429 bcf premenu
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
430 bsf compass_bearing_set
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
431 movff compass_heading_shown+0,compass_bearing+0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
432 movff compass_heading_shown+1,compass_bearing+1
382
6f3530eb48f9 allow compass bearing on surface
heinrichsweikamp
parents: 375
diff changeset
433 bcf switch_right
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
434 return
382
6f3530eb48f9 allow compass bearing on surface
heinrichsweikamp
parents: 375
diff changeset
435
6f3530eb48f9 allow compass bearing on surface
heinrichsweikamp
parents: 375
diff changeset
436 test_switches_surfmode2a:
0
heinrichsweikamp
parents:
diff changeset
437 bcf switch_right
heinrichsweikamp
parents:
diff changeset
438 bsf toggle_customview
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
439 bcf premenu
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
440 clrf timeout_counter2 ; and reset timeout
0
heinrichsweikamp
parents:
diff changeset
441 return
heinrichsweikamp
parents:
diff changeset
442
heinrichsweikamp
parents:
diff changeset
443 global timeout_surfmode
heinrichsweikamp
parents:
diff changeset
444 timeout_surfmode:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
445 movlw timeout_surfacemode ; [s] Default timeout
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
446 btfsc menu_show_sensors2 ; In the "Calibrate" menu?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
447 movlw timeout_calibrate_menu ; [s] CCR Calibrate Menu timeout
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
448 btfsc menubit ; in Menu?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
449 bra timeout_testmode ; No, done.
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
450 ; Must be in surface mode
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
451 btfss FLAG_ccr_mode ; =1: CCR mode (Fixed ppO2 or Sensor) active
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
452 bra timeout_testmode ; No, not CCR
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
453 movlw timeout_ccr_surface ; [s] CCR Surface mode timeout
188
ebc28381f17d NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents: 187
diff changeset
454
0
heinrichsweikamp
parents:
diff changeset
455 global timeout_testmode
heinrichsweikamp
parents:
diff changeset
456 timeout_testmode:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
457 incf timeout_counter2,F ; increase timeout counter
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
458 cpfsgt timeout_counter2 ; Compare with timeout limit
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
459 return ; return, no timeout
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
460 bsf sleepmode ; Set Flag
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
461 return ; Return
0
heinrichsweikamp
parents:
diff changeset
462
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
463 END