comparison code_part1/OSTC_code_asm_part1/divemode_menu.asm @ 219:b6dd54b3567c

NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
author heinrichsweikamp
date Tue, 01 Mar 2011 10:01:17 +0100
parents e26f49674956
children 448478ceccea
comparison
equal deleted inserted replaced
218:f4b79292e31f 219:b6dd54b3567c
105 movlw d'6' ; number of available gases+1, ; number of menu options+1 105 movlw d'6' ; number of available gases+1, ; number of menu options+1
106 btfsc display_set_gas ; Are we in the "Gaslist" menu? 106 btfsc display_set_gas ; Are we in the "Gaslist" menu?
107 movlw d'7' ; Yes, Number of entries for this menu+1 = 7 107 movlw d'7' ; Yes, Number of entries for this menu+1 = 7
108 btfsc display_set_setpoint ; In SetPoint Menu? 108 btfsc display_set_setpoint ; In SetPoint Menu?
109 movlw d'5' ; Number of entries for this menu+1 = 5 109 movlw d'5' ; Number of entries for this menu+1 = 5
110 btfsc display_set_active ; De/Activate gases underwater menu is visible?
111 movlw d'7' ; Number of entries for this menu+1 = 7
112 btfsc display_set_xgas ; Are we in the Gas6 menu?
113 movlw d'7' ; Number of entries for this menu+1 = 7
110 cpfseq menupos ; =limit? 114 cpfseq menupos ; =limit?
111 bra test_switches_divemode_menu1; No! 115 bra test_switches_divemode_menu1; No!
112 movlw d'1' ; Yes, reset to position 1! 116 movlw d'1' ; Yes, reset to position 1!
113 movwf menupos 117 movwf menupos
114 118
115 test_switches_divemode_menu1: 119 test_switches_divemode_menu1:
116 ; Finally, check if menuposition 3 should be skipped (No customview with function displayed) 120 ; Finally, check if menuposition 3 should be skipped (No customview with function displayed)
117 121
118 btfsc display_set_gas ; Are we in the "Gaslist" or "SetPoint" menu? 122 btfsc display_set_gas ; Are we in the "Gaslist", "SetPoint" or De/Activate gases menu?
119 bra test_switches_divemode_menu1a ; Skip test for sub menus 123 bra test_switches_divemode_menu1a ; Skip test for sub menus
120 btfsc display_set_xgas ; Are we in the "Gaslist" or "SetPoint" menu? 124 btfsc display_set_xgas ; Are we in the "Gaslist", "SetPoint" or De/Activate gases menu?
121 bra test_switches_divemode_menu1a ; Skip test for sub menus 125 bra test_switches_divemode_menu1a ; Skip test for sub menus
126 btfsc display_set_active ; Are we in the "Gaslist", "SetPoint" or De/Activate gases menu?
127 bra test_switches_divemode_menu1a ; Skip test for sub menus
122 128
123 movlw d'3' 129 movlw d'3'
124 cpfseq menupos ; At position 3? 130 cpfseq menupos ; At position 3?
125 bra test_switches_divemode_menu1a; No 131 bra test_switches_divemode_menu1a ; No
126 btfss menu3_active ; Menu position 3 has functionality? 132 btfss menu3_active ; Menu position 3 has functionality?
127 incf menupos,F ; No, +1, skip to menuos=4 133 incf menupos,F ; No, +1, skip to menuos=4
128 134
129 test_switches_divemode_menu1a: 135 test_switches_divemode_menu1a:
130 call PLED_divemenu_cursor ; update cursor 136 call PLED_divemenu_cursor ; update cursor
131 return 137 return
132 138
143 btfsc display_see_deco ; Is the Decoplan displayed? 149 btfsc display_see_deco ; Is the Decoplan displayed?
144 bra divemenu_see_decoplan2 ; Yes, exit menu on right button press 150 bra divemenu_see_decoplan2 ; Yes, exit menu on right button press
145 151
146 btfsc display_set_xgas ; Are we in the "Set Gas" menu? 152 btfsc display_set_xgas ; Are we in the "Set Gas" menu?
147 bra divemenu_set_xgas2 ; Yes, so configure gas or set menu and exit menu 153 bra divemenu_set_xgas2 ; Yes, so configure gas or set menu and exit menu
154
155 btfsc display_set_active ; Are we in the "De/Activate gases menu?" menu?
156 bra divemenu_de_activate2 ; Yes, so toggle active flag
148 157
149 btfsc display_set_simulator ; Are we in the Divemode Simulator menu? 158 btfsc display_set_simulator ; Are we in the Divemode Simulator menu?
150 goto divemode_menu_simulator2 ; Yes, so adjust depth or set and exit 159 goto divemode_menu_simulator2 ; Yes, so adjust depth or set and exit
151 160
152 ; Options for Menu 1 161 ; Options for Menu 1
209 call PLED_temp_divemode ; Displays temperature 218 call PLED_temp_divemode ; Displays temperature
210 call PLED_depth ; Displays new depth... 219 call PLED_depth ; Displays new depth...
211 call PLED_max_pressure ; ...and max. depth 220 call PLED_max_pressure ; ...and max. depth
212 221
213 bra timeout_divemenu2 ; quit menu! 222 bra timeout_divemenu2 ; quit menu!
223
224 divemenu_de_activate:
225 bsf display_set_active ; Set display flag
226 bcf display_set_xgas ; Clear Flag
227 call PLED_clear_divemode_menu ; Clear Menu
228
229 call PLED_de_activelist ; show (de)active gaslist
230
231 movlw d'1'
232 movwf menupos ; reset cursor
233 call PLED_divemenu_cursor ; update cursor
234 return
235
236 divemenu_de_activate2: ; Toggle active flag
237 dcfsnz menupos,F
238 bra divemenu_de_activate2_exit ; Exit, Quit, Abort
239 dcfsnz menupos,F
240 bra divemenu_de_activate2_g1 ; Toggle Gas1
241 dcfsnz menupos,F
242 bra divemenu_de_activate2_g2 ; Toggle Gas2
243 dcfsnz menupos,F
244 bra divemenu_de_activate2_g3 ; Toggle Gas3
245 dcfsnz menupos,F
246 bra divemenu_de_activate2_g4 ; Toggle Gas4
247 dcfsnz menupos,F
248 bra divemenu_de_activate2_g5 ; Toggle Gas5
249 return ; should never be here
250
251 divemenu_de_activate2_exit:
252 bra timeout_divemenu2 ; quit underwater menu!
253
254 divemenu_de_activate2_g1:
255 read_int_eeprom d'27' ; read flag register
256 btg EEDATA,.0 ; Toggle flag
257 write_int_eeprom d'27' ; write flag register
258 movlw d'2'
259 movwf menupos ; reset cursor
260 call PLED_de_activelist ; show (de)active gaslist
261 return
262
263 divemenu_de_activate2_g2:
264 read_int_eeprom d'27' ; read flag register
265 btg EEDATA,.1 ; Toggle flag
266 write_int_eeprom d'27' ; write flag register
267 movlw d'3'
268 movwf menupos ; reset cursor
269 call PLED_de_activelist ; show (de)active gaslist
270 return
271
272 divemenu_de_activate2_g3:
273 read_int_eeprom d'27' ; read flag register
274 btg EEDATA,.2 ; Toggle flag
275 write_int_eeprom d'27' ; write flag register
276 movlw d'4'
277 movwf menupos ; reset cursor
278 call PLED_de_activelist ; show (de)active gaslist
279 return
280
281 divemenu_de_activate2_g4:
282 read_int_eeprom d'27' ; read flag register
283 btg EEDATA,.3 ; Toggle flag
284 write_int_eeprom d'27' ; write flag register
285 movlw d'5'
286 movwf menupos ; reset cursor
287 call PLED_de_activelist ; show (de)active gaslist
288 return
289
290 divemenu_de_activate2_g5:
291 read_int_eeprom d'27' ; read flag register
292 btg EEDATA,.4 ; Toggle flag
293 write_int_eeprom d'27' ; write flag register
294 movlw d'6'
295 movwf menupos ; reset cursor
296 call PLED_de_activelist ; show (de)active gaslist
297 return
214 298
215 divemode_set_xgas: ; Set the extra gas... 299 divemode_set_xgas: ; Set the extra gas...
216 bsf display_set_xgas ; Set Flag 300 bsf display_set_xgas ; Set Flag
217 bcf display_set_gas ; Clear Flag 301 bcf display_set_gas ; Clear Flag
218 call PLED_clear_divemode_menu ; Clear Menu 302 call PLED_clear_divemode_menu ; Clear Menu
360 bra divemenu_set_xgas2_o2minus ; Adjust O2- 444 bra divemenu_set_xgas2_o2minus ; Adjust O2-
361 dcfsnz menupos,F 445 dcfsnz menupos,F
362 bra divemenu_set_xgas2_heplus ; Adjust He+ 446 bra divemenu_set_xgas2_heplus ; Adjust He+
363 dcfsnz menupos,F 447 dcfsnz menupos,F
364 bra divemenu_set_xgas2_heminus ; Adjust He- 448 bra divemenu_set_xgas2_heminus ; Adjust He-
365 return 449 dcfsnz menupos,F
450 bra divemenu_de_activate ; Goto (De)active gases underwater list
451 return ; should never be here
366 452
367 divemenu_set_xgas2_heminus: 453 divemenu_set_xgas2_heminus:
368 read_int_eeprom d'25' ; He value 454 read_int_eeprom d'25' ; He value
369 movff EEDATA,lo 455 movff EEDATA,lo
370 decf lo,F ; decrease He 456 decf lo,F ; decrease He
609 bcf display_see_deco ; clear all display flags 695 bcf display_see_deco ; clear all display flags
610 bcf display_set_gas 696 bcf display_set_gas
611 bcf display_set_xgas 697 bcf display_set_xgas
612 bcf display_set_setpoint 698 bcf display_set_setpoint
613 bcf display_set_simulator 699 bcf display_set_simulator
700 bcf display_set_active
614 bcf switch_left ; and debounce switches 701 bcf switch_left ; and debounce switches
615 bcf switch_right 702 bcf switch_right
616 return 703 return
617 704
618 ; Re-Draw current page of decoplan (may have more stops) 705 ; Re-Draw current page of decoplan (may have more stops)