annotate code_part1/OSTC_code_asm_part1/divemode_menu.asm @ 115:50a06adabc67

First gas is active, Gauge mode display
author heinrichsweikamp
date Fri, 24 Dec 2010 15:40:27 +0100
parents 9500f431248a
children f24137eb85de
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1 ; OSTC - diving computer code
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
2 ; Copyright (C) 2008 HeinrichsWeikamp GbR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
3
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
4 ; This program is free software: you can redistribute it and/or modify
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
5 ; it under the terms of the GNU General Public License as published by
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
6 ; the Free Software Foundation, either version 3 of the License, or
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
7 ; (at your option) any later version.
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
8
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
9 ; This program is distributed in the hope that it will be useful,
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
10 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
11 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
12 ; GNU General Public License for more details.
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
13
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
14 ; You should have received a copy of the GNU General Public License
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
15 ; along with this program. If not, see <http://www.gnu.org/licenses/>.
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
16
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
17
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
18 ; Underwater Menu (Set Gas, Decoplan, etc.)
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
19 ; written by: Matthias Heinrichs, info@heinrichsweikamp.com
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
20 ; written: 11/11/05
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
21 ; last updated: 090305
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
22 ; known bugs:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
23 ; ToDo:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
24
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
25
112
9500f431248a 1.74beta rc2
heinrichsweikamp
parents: 111
diff changeset
26 test_switches_divemode: ; checks switches in divemode
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
27 btfsc switch_left
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
28 bra test_switches_divemode2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
29
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
30 btfss switch_right
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
31 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
32
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
33 bcf switch_left ; Left button pressed!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
34 bcf switch_right
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
35
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
36 bcf select_bailoutgas ; Clear Flag for Bailout list
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
37 bsf premenu ; Set Flag for premenu
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
38 bcf menubit
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
39 clrf timeout_counter3 ; timeout_divemenu
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
40
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
41 btfsc FLAG_apnoe_mode ; In Apnoe mode?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
42 bra test_switches_divemode1 ; Yes!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
43
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
44 test_switches_divemode0:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
45 WIN_INVERT .1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
46 DISPLAYTEXT .4 ;Menu?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
47 WIN_INVERT .0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
48 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
49
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
50 test_switches_divemode1:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
51 DISPLAYTEXT .141 ;Quit?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
52 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
53
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
54 test_switches_divemode2:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
55 bcf switch_left ; Also reactivate left button if there was a right press without prior left press
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
56 bcf switch_right ; enable right button again
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
57
98
6f8e3a08011e 1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents: 87
diff changeset
58 btfsc premenu
6f8e3a08011e 1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents: 87
diff changeset
59 bra test_switches_divemode2_2
109
6e635bf5b7a7 fixed double-effect of ENTER button in divemode
heinrichsweikamp
parents: 107
diff changeset
60 btfsc menubit
6e635bf5b7a7 fixed double-effect of ENTER button in divemode
heinrichsweikamp
parents: 107
diff changeset
61 bra test_switches_divemode2_2 ; Not in Premenu or Menu...
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
62
112
9500f431248a 1.74beta rc2
heinrichsweikamp
parents: 111
diff changeset
63 bsf toggle_customview ; Toggle customview (Cleared in customview.asm)
9500f431248a 1.74beta rc2
heinrichsweikamp
parents: 111
diff changeset
64
9500f431248a 1.74beta rc2
heinrichsweikamp
parents: 111
diff changeset
65 btfsc standalone_simulator ; Standalone Simualtor active?
9500f431248a 1.74beta rc2
heinrichsweikamp
parents: 111
diff changeset
66 bra divemode_menu_simulator ; Yes, Show simulator menu!
9500f431248a 1.74beta rc2
heinrichsweikamp
parents: 111
diff changeset
67 return
98
6f8e3a08011e 1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents: 87
diff changeset
68
6f8e3a08011e 1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents: 87
diff changeset
69 test_switches_divemode2_2:
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
70 btfss FLAG_apnoe_mode ; In Apnoe mode?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
71 bra test_switches_divemode2a; No!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
72
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
73 ; Yes, so quit Apnoe mode at once...
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
74 bcf divemode ; Clear Divemode flag...
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
75 bcf premenu ; clear premenu flag
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
76 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
77
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
78 test_switches_divemode2a:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
79 bsf menubit ; Enter Divemode-Menu!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
80 bcf premenu ; clear premenu flag
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
81 call PLED_clear_divemode_menu ; Clear dive mode menu area
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
82 call PLED_divemode_menu_mask_first ; Write Divemode menu1 mask
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
83 bcf display_set_simulator ; Clear Simulator-Menu flag
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
84 movlw d'1'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
85 movwf menupos ; reset cursor in divemode menu
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
86 call PLED_divemenu_cursor ; show cursor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
87 bcf switch_right
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
88 bcf switch_left ; Left button pressed!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
89 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
90
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
91 test_switches_divemode_menu:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
92 btfsc switch_left
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
93 bra test_switches_divemode_menu3
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
94 btfss switch_right
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
95 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
96
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
97 btfsc display_see_deco ; Is the Decoplan displayed?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
98 bra divemenu_see_decoplan2 ; Yes, exit menu on left button press
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
99
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
100 bcf switch_right ; Left button pressed
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
101 clrf timeout_counter3 ; timout_divemenu!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
102 incf menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
103
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
104 ; Following routine configures the number of menu entries for the different modes
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
105 movlw d'6' ; number of available gases+1, ; number of menu options+1
98
6f8e3a08011e 1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents: 87
diff changeset
106 btfsc display_set_gas ; Are we in the "Gaslist" menu?
6f8e3a08011e 1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents: 87
diff changeset
107 movlw d'7' ; Yes, Number of entries for this menu+1 = 7
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
108 btfsc display_set_setpoint ; In SetPoint Menu?
98
6f8e3a08011e 1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents: 87
diff changeset
109 movlw d'5' ; Number of entries for this menu+1 = 5
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
110 cpfseq menupos ; =limit?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
111 bra test_switches_divemode_menu1; No!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
112 movlw d'1' ; Yes, reset to position 1!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
113 movwf menupos
98
6f8e3a08011e 1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents: 87
diff changeset
114
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
115 test_switches_divemode_menu1:
98
6f8e3a08011e 1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents: 87
diff changeset
116 ; Finally, check if menuposition 3 should be skipped (No customview with function displayed)
6f8e3a08011e 1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents: 87
diff changeset
117
6f8e3a08011e 1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents: 87
diff changeset
118 btfsc display_set_gas ; Are we in the "Gaslist" or "SetPoint" menu?
6f8e3a08011e 1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents: 87
diff changeset
119 bra test_switches_divemode_menu1a ; Skip test for sub menus
6f8e3a08011e 1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents: 87
diff changeset
120 btfsc display_set_xgas ; Are we in the "Gaslist" or "SetPoint" menu?
6f8e3a08011e 1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents: 87
diff changeset
121 bra test_switches_divemode_menu1a ; Skip test for sub menus
6f8e3a08011e 1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents: 87
diff changeset
122
6f8e3a08011e 1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents: 87
diff changeset
123 movlw d'3'
6f8e3a08011e 1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents: 87
diff changeset
124 cpfseq menupos ; At position 3?
6f8e3a08011e 1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents: 87
diff changeset
125 bra test_switches_divemode_menu1a; No
6f8e3a08011e 1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents: 87
diff changeset
126 btfss menu3_active ; Menu position 3 has functionality?
6f8e3a08011e 1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents: 87
diff changeset
127 incf menupos,F ; No, +1, skip to menuos=4
6f8e3a08011e 1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents: 87
diff changeset
128
6f8e3a08011e 1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents: 87
diff changeset
129 test_switches_divemode_menu1a:
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
130 call PLED_divemenu_cursor ; update cursor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
131 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
132
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
133 test_switches_divemode_menu3:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
134 bcf switch_left
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
135 bcf switch_right
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
136 bsf menubit ; Enter Divemode-Menu!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
137 bcf premenu ; clear premenu flag
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
138 clrf timeout_counter3
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
139
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
140 btfsc display_set_gas ; Are we in the "Gaslist" or "SetPoint" menu?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
141 bra divemenu_set_gas2 ; Yes, so set gas and exit menu
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
142
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
143 btfsc display_see_deco ; Is the Decoplan displayed?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
144 bra divemenu_see_decoplan2 ; Yes, exit menu on right button press
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
145
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
146 btfsc display_set_xgas ; Are we in the "Set Gas" menu?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
147 bra divemenu_set_xgas2 ; Yes, so configure gas or set menu and exit menu
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
148
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
149 btfsc display_set_simulator ; Are we in the Divemode Simulator menu?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
150 goto divemode_menu_simulator2 ; Yes, so adjust depth or set and exit
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
151
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
152 ; Options for Menu 1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
153 dcfsnz menupos,F
73
2227459e8ef2 Exchanged Decoplan and Gaslist in dive mode menu
heinrichsweikamp
parents: 71
diff changeset
154 bra divemenu_set_gas ; Set gas sub-menu
2227459e8ef2 Exchanged Decoplan and Gaslist in dive mode menu
heinrichsweikamp
parents: 71
diff changeset
155 dcfsnz menupos,F
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
156 bra divemenu_see_decoplan ; display the full decoplan
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
157 dcfsnz menupos,F
98
6f8e3a08011e 1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents: 87
diff changeset
158 bra divemode_menu3 ; Customview-function
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
159 dcfsnz menupos,F
98
6f8e3a08011e 1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents: 87
diff changeset
160 bra divemode_toggle_brightness ; Toggle OLED-Brightness
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
161 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
162 bra timeout_divemenu2 ; Quit divemode menu
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
163 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
164
98
6f8e3a08011e 1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents: 87
diff changeset
165 divemode_menu3:
6f8e3a08011e 1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents: 87
diff changeset
166 movff menupos3,temp1 ; copy
6f8e3a08011e 1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents: 87
diff changeset
167 dcfsnz temp1,F
6f8e3a08011e 1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents: 87
diff changeset
168 bra toggle_stopwatch ; Toggle Stopwatch/Average register
6f8e3a08011e 1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents: 87
diff changeset
169 dcfsnz temp1,F
6f8e3a08011e 1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents: 87
diff changeset
170 bra set_marker ; Set Marker
6f8e3a08011e 1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents: 87
diff changeset
171 dcfsnz temp1,F
6f8e3a08011e 1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents: 87
diff changeset
172 bra divemode_menu3_nothing ; clock...
6f8e3a08011e 1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents: 87
diff changeset
173 dcfsnz temp1,F
6f8e3a08011e 1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents: 87
diff changeset
174 bra divemode_menu3_nothing ; leading tissue...
6f8e3a08011e 1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents: 87
diff changeset
175
6f8e3a08011e 1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents: 87
diff changeset
176 divemode_menu3_nothing:
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
177 bra timeout_divemenu2 ; Quit divemode menu
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
178 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
179
98
6f8e3a08011e 1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents: 87
diff changeset
180 set_marker:
6f8e3a08011e 1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents: 87
diff changeset
181 movlw d'6' ; Type of Alarm (Manual Marker)
6f8e3a08011e 1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents: 87
diff changeset
182 movwf AlarmType ; Copy to Alarm Register
6f8e3a08011e 1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents: 87
diff changeset
183 bsf event_occured ; Set Event Flag
6f8e3a08011e 1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents: 87
diff changeset
184 bra timeout_divemenu2 ; quit menu!
6f8e3a08011e 1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents: 87
diff changeset
185
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
186 toggle_stopwatch:
111
ed7826c740a0 1.74beta rc1
heinrichsweikamp
parents: 109
diff changeset
187 bsf reset_average_depth ; Average Depth will be resetted in divemode.asm
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
188 bra timeout_divemenu2 ; quit menu!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
189
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
190 divemode_toggle_brightness:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
191 read_int_eeprom d'90' ; Brightness offset? (Dim>0, Normal = 0)
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
192 tstfsz EEDATA ; Was dimmed?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
193 bra divemode_toggle_brightness1 ; Yes...
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
194
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
195 call PLED_brightness_low
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
196 movlw d'1'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
197 movwf EEDATA ; Copy to EEDATA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
198 write_int_eeprom d'90' ; Brightness offset? (Dim=1, Normal = 0)
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
199 bra divemode_toggle_brightness3
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
200
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
201 divemode_toggle_brightness1:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
202 call PLED_brightness_full
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
203 movlw d'0'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
204 movwf EEDATA ; Copy to EEDATA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
205 write_int_eeprom d'90' ; Brightness offset? (Dim=1, Normal = 0)
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
206
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
207 divemode_toggle_brightness3:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
208 ; Now, redraw all outputs (All modes)
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
209 call PLED_active_gas_divemode ; Display gas, if required
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
210 call PLED_temp_divemode ; Displays temperature
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
211 call PLED_depth ; Displays new depth...
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
212 call PLED_max_pressure ; ...and max. depth
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
213
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
214 bra timeout_divemenu2 ; quit menu!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
215
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
216 divemode_set_xgas: ; Set the extra gas...
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
217 bsf display_set_xgas ; Set Flag
98
6f8e3a08011e 1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents: 87
diff changeset
218 bcf display_set_gas ; Clear Flag
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
219 call PLED_clear_divemode_menu ; Clear Menu
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
220
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
221 movff char_I_O2_ratio, EEDATA ; Reset Gas6 to current gas
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
222 write_int_eeprom d'24'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
223 movff char_I_He_ratio, EEDATA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
224 write_int_eeprom d'25'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
225
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
226 call PLED_divemode_set_xgas ; Show mask
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
227
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
228 movlw d'1'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
229 movwf menupos ; reset cursor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
230 call PLED_divemenu_cursor ; update cursor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
231 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
232
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
233 divemode_menu_simulator:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
234 bsf menubit ; Enter Divemode-Menu!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
235 bcf premenu ; clear premenu flag
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
236 bcf switch_right
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
237 bcf switch_left ; Left button pressed!
104
2a2606e9db5f some fixes with the onboard simulator
heinrichsweikamp
parents: 99
diff changeset
238 bsf display_set_simulator ; Set Flag
2a2606e9db5f some fixes with the onboard simulator
heinrichsweikamp
parents: 99
diff changeset
239 bsf menu3_active ; So "+1" is accessible at all times
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
240 call PLED_clear_divemode_menu ; Clear Menu
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
241 call PLED_divemode_simulator_mask; Show mask
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
242 movlw d'1'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
243 movwf menupos ; reset cursor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
244 call PLED_divemenu_cursor ; update cursor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
245 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
246
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
247 divemode_menu_simulator2:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
248 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
249 bra timeout_divemenu2 ; quit underwater menu!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
250 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
251 bra divemode_menu_simulator_p1 ; Adjust +1m
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
252 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
253 bra divemode_menu_simulator_m1 ; Adjust -1m
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
254 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
255 bra divemode_menu_simulator_p10 ; Adjust +10m
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
256 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
257 bra divemode_menu_simulator_m10 ; Adjust -10m
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
258 bra timeout_divemenu2 ; quit underwater menu!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
259
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
260 divemode_menu_simulator_common:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
261 call PLED_divemode_simulator_mask ; Redraw Simualtor mask
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
262
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
263 ; Check limits (140m and 0m)
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
264 movlw LOW d'15000'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
265 movwf sub_a+0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
266 movlw HIGH d'15000'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
267 movwf sub_a+1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
268 movff sim_pressure+0,sub_b+0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
269 movff sim_pressure+1,sub_b+1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
270 call sub16 ; sub_c = sub_a - sub_b
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
271 btfss neg_flag
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
272 bra divemode_menu_simulator_common2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
273 ; Too deep, limit to 140m
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
274 movlw LOW d'15000'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
275 movwf sim_pressure+0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
276 movlw HIGH d'15000'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
277 movwf sim_pressure+1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
278 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
279
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
280 divemode_menu_simulator_common2:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
281 movlw LOW d'1000'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
282 movwf sub_a+0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
283 movlw HIGH d'1000'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
284 movwf sub_a+1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
285 movff sim_pressure+0,sub_b+0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
286 movff sim_pressure+1,sub_b+1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
287 call sub16 ; sub_c = sub_a - sub_b
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
288 btfsc neg_flag
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
289 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
290 ; Too shallow, limit to 1m
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
291 movlw LOW d'1000'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
292 movwf sim_pressure+0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
293 movlw HIGH d'1000'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
294 movwf sim_pressure+1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
295 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
296
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
297 divemode_menu_simulator_m10:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
298 movlw LOW d'1000'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
299 subwf sim_pressure+0,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
300 movlw HIGH d'1000'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
301 subwfb sim_pressure+1,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
302 movlw d'5'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
303 movwf menupos ; reset cursor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
304 bra divemode_menu_simulator_common
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
305
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
306 divemode_menu_simulator_p10:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
307 movlw LOW d'1000'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
308 addwf sim_pressure+0,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
309 movlw HIGH d'1000'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
310 addwfc sim_pressure+1,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
311 movlw d'4'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
312 movwf menupos ; reset cursor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
313 bra divemode_menu_simulator_common
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
314
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
315 divemode_menu_simulator_p1:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
316 movlw d'100'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
317 addwf sim_pressure+0,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
318 movlw d'0'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
319 addwfc sim_pressure+1,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
320 movlw d'2'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
321 movwf menupos ; reset cursor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
322 bra divemode_menu_simulator_common
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
323
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
324 divemode_menu_simulator_m1:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
325 movlw d'100'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
326 subwf sim_pressure+0,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
327 movlw d'0'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
328 subwfb sim_pressure+1,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
329 movlw d'3'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
330 movwf menupos ; reset cursor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
331 bra divemode_menu_simulator_common
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
332
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
333 divemenu_see_decoplan:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
334 bsf display_see_deco ; set flag
64
e8756eba54ee 1.71beta - more deco
heinrichsweikamp
parents: 30
diff changeset
335 call PLED_clear_divemode_menu ; Clear Menu
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
336
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
337 read_int_eeprom d'34'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
338 movlw d'3'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
339 cpfsgt EEDATA ; in multi-gf mode? Z16 GF OC=4 and Z16 GF CC=5
68
d0b677e1e9a5 new decoplan (GF mode) debuged
heinrichsweikamp
parents: 66
diff changeset
340 bra divemenu_see_decoplan1 ; No, standard ZH-L16
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
341
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
342 bsf multi_gf_display ; Yes, display the multi-gf table screen
64
e8756eba54ee 1.71beta - more deco
heinrichsweikamp
parents: 30
diff changeset
343 bcf last_ceiling_gf_shown ; Clear flag
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
344
64
e8756eba54ee 1.71beta - more deco
heinrichsweikamp
parents: 30
diff changeset
345 call PLED_decoplan_gf_page1 ; Display the new screen
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
346 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
347
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
348 divemenu_see_decoplan1:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
349
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
350 movff char_O_deco_status,deco_status ;
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
351 tstfsz deco_status ; deco_status=0 if decompression calculation done
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
352 return ; calculation not yet finished!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
353
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
354 call PLED_decoplan ; display the Decoplan
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
355 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
356
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
357 divemenu_see_decoplan2:
64
e8756eba54ee 1.71beta - more deco
heinrichsweikamp
parents: 30
diff changeset
358 btfsc multi_gf_display ; Next Page in Multi-GF Screen?
e8756eba54ee 1.71beta - more deco
heinrichsweikamp
parents: 30
diff changeset
359 bra divemenu_see_decoplan2_nextgf ; Yes!
e8756eba54ee 1.71beta - more deco
heinrichsweikamp
parents: 30
diff changeset
360 ; No, remove outputs!
e8756eba54ee 1.71beta - more deco
heinrichsweikamp
parents: 30
diff changeset
361 divemenu_see_decoplan2_0:
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
362 bcf display_see_deco ; clear flag
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
363 bra timeout_divemenu2 ; quit menu!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
364
64
e8756eba54ee 1.71beta - more deco
heinrichsweikamp
parents: 30
diff changeset
365 divemenu_see_decoplan2_nextgf:
e8756eba54ee 1.71beta - more deco
heinrichsweikamp
parents: 30
diff changeset
366 incf temp8,F
e8756eba54ee 1.71beta - more deco
heinrichsweikamp
parents: 30
diff changeset
367 btfsc last_ceiling_gf_shown ; last ceiling shown?
e8756eba54ee 1.71beta - more deco
heinrichsweikamp
parents: 30
diff changeset
368 bra divemenu_see_decoplan2_0 ; All done, clear and return
e8756eba54ee 1.71beta - more deco
heinrichsweikamp
parents: 30
diff changeset
369
e8756eba54ee 1.71beta - more deco
heinrichsweikamp
parents: 30
diff changeset
370 clrf timeout_counter3 ; Clear timeout Divemode menu
68
d0b677e1e9a5 new decoplan (GF mode) debuged
heinrichsweikamp
parents: 66
diff changeset
371 bra timeout_divemenu3x ; Display next page
64
e8756eba54ee 1.71beta - more deco
heinrichsweikamp
parents: 30
diff changeset
372
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
373 divemenu_set_xgas2:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
374 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
375 bra divemenu_set_xgas2_exit ; Use the gas6 configured and exit
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
376 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
377 bra divemenu_set_xgas2_o2plus ; Adjust O2+
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
378 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
379 bra divemenu_set_xgas2_o2minus ; Adjust O2-
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
380 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
381 bra divemenu_set_xgas2_heplus ; Adjust He+
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
382 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
383 bra divemenu_set_xgas2_heminus ; Adjust He-
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
384 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
385
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
386 divemenu_set_xgas2_heminus:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
387 read_int_eeprom d'25' ; He value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
388 movff EEDATA,lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
389 decf lo,F ; decrease He
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
390 movlw d'255'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
391 cpfseq lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
392 bra divemenu_set_xgas2_heminus2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
393 incf lo,F ; limit to min=0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
394 divemenu_set_xgas2_heminus2:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
395 movff lo, EEDATA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
396 write_int_eeprom d'25' ; He Value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
397
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
398 call PLED_divemode_set_xgas ; Redraw menu
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
399 movlw d'5'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
400 movwf menupos ; reset cursor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
401 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
402
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
403 divemenu_set_xgas2_heplus:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
404 read_int_eeprom d'25' ; He value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
405 movff EEDATA,lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
406 incf lo,F ; increase He
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
407 movlw d'101'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
408 cpfseq lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
409 bra divemenu_set_xgas2_heplus2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
410 movlw d'4' ; O2 Limit
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
411 movwf lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
412 divemenu_set_xgas2_heplus2: ; test if O2+He>100...
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
413 read_int_eeprom d'24' ; O2 value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
414 movf EEDATA,W
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
415 addwf lo,W ; add He value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
416 movwf hi ; store in temp
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
417 movlw d'101'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
418 cpfseq hi ; O2 and He > 100?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
419 bra divemenu_set_xgas2_heplus3 ; No!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
420 decf lo,F ; reduce He again = unchanged after operation
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
421 divemenu_set_xgas2_heplus3: ; save current value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
422 movff lo, EEDATA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
423 write_int_eeprom d'25' ; He Value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
424
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
425 call PLED_divemode_set_xgas ; Redraw menu
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
426 movlw d'4'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
427 movwf menupos ; reset cursor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
428 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
429
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
430 divemenu_set_xgas2_o2minus:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
431 read_int_eeprom d'24' ; O2 value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
432 movff EEDATA,lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
433 decf lo,F ; decrease O2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
434 movlw d'3' ; Limit-1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
435 cpfseq lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
436 bra divemenu_set_xgas2_o2minus2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
437 incf lo,F ; limit to min=9
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
438 divemenu_set_xgas2_o2minus2:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
439 movff lo, EEDATA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
440 write_int_eeprom d'24' ; O2 Value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
441
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
442 call PLED_divemode_set_xgas ; Redraw menu
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
443 movlw d'3'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
444 movwf menupos ; reset cursor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
445 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
446
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
447 divemenu_set_xgas2_o2plus:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
448 read_int_eeprom d'24' ; O2 value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
449 movff EEDATA,lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
450 incf lo,F ; increase O2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
451 movlw d'101'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
452 cpfseq lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
453 bra divemenu_set_xgas2_o2plus2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
454 movlw d'5' ; O2 limit
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
455 movwf lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
456 divemenu_set_xgas2_o2plus2: ; test if O2+He>100...
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
457 read_int_eeprom d'25' ; He value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
458 movf EEDATA,W
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
459 addwf lo,W ; add O2 value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
460 movwf hi ; store in temp
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
461 movlw d'101'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
462 cpfseq hi ; O2 and He > 100?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
463 bra divemenu_set_xgas2_o2plus3 ; No!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
464 decf lo,F ; reduce O2 again = unchanged after operation
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
465 divemenu_set_xgas2_o2plus3: ; save current value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
466 movff lo, EEDATA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
467 write_int_eeprom d'24' ; O2 Value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
468
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
469 call PLED_divemode_set_xgas ; Redraw menu
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
470 movlw d'2'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
471 movwf menupos ; reset cursor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
472 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
473
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
474 divemenu_set_xgas2_exit:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
475 read_int_eeprom d'25' ; Read He ratio
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
476 movff EEDATA,char_I_He_ratio ; And copy into hold register
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
477
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
478 read_int_eeprom d'24' ; Read O2 ratio
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
479 movff EEDATA, char_I_O2_ratio ; O2 ratio
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
480 movff char_I_He_ratio, wait_temp ; copy into bank1 register
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
481 bsf STATUS,C ;
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
482 movlw d'100' ; 100%
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
483 subfwb wait_temp,W ; minus He
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
484 subfwb EEDATA,F ; minus O2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
485 movff EEDATA, char_I_N2_ratio ; = N2!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
486 bsf manual_gas_changed ; set event flag
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
487 bsf event_occured ; set global event flag
99
39d325b2a5f9 FIX bad warning for 15bits CF values
JeanDo
parents: 98
diff changeset
488 bsf is_bailout ;=1: CC mode, but bailout active!
98
6f8e3a08011e 1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents: 87
diff changeset
489 clrf lo ; clear Setpoint, PLED_const_ppO2_value now displayes "Bail"
6f8e3a08011e 1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents: 87
diff changeset
490 movff lo,char_I_const_ppO2
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
491 bra timeout_divemenu2 ; quit underwater menu!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
492
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
493 divemenu_set_gas:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
494 btfsc FLAG_const_ppO2_mode ; in ppO2 mode?
17
68825abc35f7 1.55beta rc1
heinrichsweikamp
parents: 4
diff changeset
495 bra divemenu_set_setpoint ; Yes, display SetPoint list
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
496
98
6f8e3a08011e 1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents: 87
diff changeset
497 divemenu_set_gas_2:
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
498 bsf display_set_gas ; set flag
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
499 call PLED_clear_divemode_menu ; Clear Menu
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
500 call PLED_gas_list ; Display all 5 gases
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
501 movlw d'1'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
502 movwf menupos ; reset cursor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
503 call PLED_divemenu_cursor ; update cursor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
504 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
505
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
506 divemenu_set_setpoint:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
507 bsf display_set_setpoint ; set flag
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
508 bsf display_set_gas ; set flag
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
509
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
510 call PLED_clear_divemode_menu ; Clear Menu
98
6f8e3a08011e 1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents: 87
diff changeset
511 call PLED_splist_start ; Display SetPoints
6f8e3a08011e 1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents: 87
diff changeset
512 DISPLAYTEXT d'137' ; Bailout (as a sub-menu)
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
513 movlw d'1'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
514 movwf menupos ; reset cursor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
515 call PLED_divemenu_cursor ; update cursor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
516 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
517
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
518
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
519 divemenu_set_gas2:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
520 btfsc select_bailoutgas ; Are we in the Bailout list?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
521 bra divemenu_set_gas2a ; Yes, choose gas
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
522
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
523 btfss FLAG_const_ppO2_mode ; are we in ppO2 mode?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
524 bra divemenu_set_gas2a ; no, choose gas
98
6f8e3a08011e 1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents: 87
diff changeset
525 ; Yes, so select SP 1-3
3
3cf8af30b36e v1.51 beta
heinrichsweikamp
parents: 0
diff changeset
526 bcf is_bailout ;=1: CC mode, but bailout active!
98
6f8e3a08011e 1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents: 87
diff changeset
527 call PLED_show_ppO2_clear ; Clear ppO2 value
3
3cf8af30b36e v1.51 beta
heinrichsweikamp
parents: 0
diff changeset
528
98
6f8e3a08011e 1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents: 87
diff changeset
529 divemenu_set_gas1:
6f8e3a08011e 1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents: 87
diff changeset
530 movlw d'4'
6f8e3a08011e 1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents: 87
diff changeset
531 cpfseq menupos ; At the "Bailout" position?
6f8e3a08011e 1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents: 87
diff changeset
532 bra divemenu_set_gas1b ; No, select SetPoint 1-3
6f8e3a08011e 1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents: 87
diff changeset
533 bsf select_bailoutgas ; Set Flag
6f8e3a08011e 1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents: 87
diff changeset
534 bcf display_set_setpoint ; Clear Flag
6f8e3a08011e 1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents: 87
diff changeset
535 bra divemenu_set_gas_2 ; Configure the extra gas / Select Bailout
6f8e3a08011e 1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents: 87
diff changeset
536
6f8e3a08011e 1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents: 87
diff changeset
537 divemenu_set_gas1b:
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
538 movlw d'35' ; offset in memory
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
539 addwf menupos,W ; add SP number 0-2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
540 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
541 call read_eeprom ; Read SetPoint
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
542 movff EEDATA, char_I_const_ppO2 ; Use SetPoint
4
2b5c52ae3923 1.52 beta rc
heinrichsweikamp
parents: 3
diff changeset
543 movff EEDATA, ppO2_setpoint_store ; Store also in this byte...
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
544
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
545 divemenu_set_gas1a:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
546 bcf display_set_setpoint ; Clear Display Flag
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
547 bsf stored_gas_changed ; set event flag
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
548 bsf event_occured ; set global event flag
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
549 bra timeout_divemenu2 ; quit menu!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
550
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
551 divemenu_set_gas2a:
98
6f8e3a08011e 1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents: 87
diff changeset
552 movlw d'6'
6f8e3a08011e 1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents: 87
diff changeset
553 cpfseq menupos ; At the "Gas 6.." position?
6f8e3a08011e 1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents: 87
diff changeset
554 bra divemenu_set_gas2b ; No, select Gas1-5 (Stored in Menupos)
6f8e3a08011e 1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents: 87
diff changeset
555 bra divemode_set_xgas ; Configure the extra gas
6f8e3a08011e 1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents: 87
diff changeset
556 divemenu_set_gas2b:
3
3cf8af30b36e v1.51 beta
heinrichsweikamp
parents: 0
diff changeset
557 bsf is_bailout ;=1: CC mode, but bailout active!
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
558 clrf lo ; clear Setpoint, PLED_const_ppO2_value now displayes "Bail"
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
559 movff lo,char_I_const_ppO2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
560
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
561 bcf display_set_gas ; clear flag
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
562 movff menupos,active_gas ; copy into active gas register
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
563 decf menupos,W ; # of selected gas (0-4)
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
564 mullw d'4' ; times 4...
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
565 movf PRODL,W ;
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
566 addlw d'7' ; +7 = address for He ratio
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
567 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
568 call read_eeprom ; Read He ratio
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
569 movff EEDATA,char_I_He_ratio ; And copy into hold register
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
570
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
571 decf menupos,W ; # of selected gas (0-4)
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
572 mullw d'4' ; times 4...
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
573 movf PRODL,W ;
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
574 addlw d'6' ; +6 = address for O2 ratio
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
575 movwf EEADR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
576 call read_eeprom ; Read O2 ratio
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
577 movff EEDATA, char_I_O2_ratio ; O2 ratio
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
578 movff char_I_He_ratio, wait_temp ; copy into bank1 register
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
579 bsf STATUS,C ;
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
580 movlw d'100' ; 100%
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
581 subfwb wait_temp,W ; minus He
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
582 subfwb EEDATA,F ; minus O2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
583 movff EEDATA, char_I_N2_ratio ; = N2!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
584 bsf stored_gas_changed ; set event flag
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
585 bsf event_occured ; set global event flag
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
586 bra timeout_divemenu2 ; quit menu!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
587
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
588 timeout_divemenu:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
589 btfss menubit ; is the Dive mode menu displayed?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
590 return ; No
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
591
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
592
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
593 btfsc display_set_simulator ; Is the Simulator Mask active?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
594 bra timeout_divemenu6 ; Yes, update Simulator mask
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
595
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
596 btfss display_see_deco ; Is the decoplan active?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
597 bra timeout_divemenu1 ; No, skip updating the decoplan
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
598
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
599 btfsc multi_gf_display ; display the multi-gf table screen?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
600 bra timeout_divemenu3 ; Yes...
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
601
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
602 movff char_O_deco_status,deco_status ;
66
6aee3a07f370 1.71beta in work...
heinrichsweikamp
parents: 64
diff changeset
603 tstfsz deco_status ; deco_status=0 if decompression calculation done
6aee3a07f370 1.71beta in work...
heinrichsweikamp
parents: 64
diff changeset
604 bra timeout_divemenu1 ; No, skip updating the decoplan
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
605
66
6aee3a07f370 1.71beta in work...
heinrichsweikamp
parents: 64
diff changeset
606 call PLED_decoplan ; update the Decoplan
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
607
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
608 timeout_divemenu1:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
609 incf timeout_counter3,F ; increase timeout_counter3
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
610 GETCUSTOM8 d'10' ; loads timeout_divemenu into WREG
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
611 cpfsgt timeout_counter3 ; ... longer then timeout_divemenu
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
612 return ; No!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
613 timeout_divemenu2: ; quit divemode menu
115
50a06adabc67 First gas is active, Gauge mode display
heinrichsweikamp
parents: 112
diff changeset
614 ; btfss multi_gf_display ; Was the Multi-GF Table displayed?
50a06adabc67 First gas is active, Gauge mode display
heinrichsweikamp
parents: 112
diff changeset
615 ; bra timeout_divemenu2a ; No, normal OLED rebuild
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
616
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
617 ; Restore some outputs
66
6aee3a07f370 1.71beta in work...
heinrichsweikamp
parents: 64
diff changeset
618 clrf temp8 ; Page 0-1 of deco list
115
50a06adabc67 First gas is active, Gauge mode display
heinrichsweikamp
parents: 112
diff changeset
619
50a06adabc67 First gas is active, Gauge mode display
heinrichsweikamp
parents: 112
diff changeset
620 btfsc FLAG_apnoe_mode ; Ignore in Apnoe mode
50a06adabc67 First gas is active, Gauge mode display
heinrichsweikamp
parents: 112
diff changeset
621 bra timeout_divemenu2a ; skip!
50a06adabc67 First gas is active, Gauge mode display
heinrichsweikamp
parents: 112
diff changeset
622 btfsc gauge_mode ; Ignore in Gauge mode
50a06adabc67 First gas is active, Gauge mode display
heinrichsweikamp
parents: 112
diff changeset
623 bra timeout_divemenu2a ; skip!
50a06adabc67 First gas is active, Gauge mode display
heinrichsweikamp
parents: 112
diff changeset
624
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
625 btfsc dekostop_active
66
6aee3a07f370 1.71beta in work...
heinrichsweikamp
parents: 64
diff changeset
626 call PLED_display_deko_mask ; clear nostop time, display decodata
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
627 btfss dekostop_active
66
6aee3a07f370 1.71beta in work...
heinrichsweikamp
parents: 64
diff changeset
628 call PLED_display_ndl_mask ; Clear deco data, display nostop time
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
629
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
630 timeout_divemenu2a:
66
6aee3a07f370 1.71beta in work...
heinrichsweikamp
parents: 64
diff changeset
631 bcf multi_gf_display ; Do not display the multi-gf table screen
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
632 bcf menubit
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
633 bcf premenu ; Yes, clear flags and menu, display dive time and mask again
66
6aee3a07f370 1.71beta in work...
heinrichsweikamp
parents: 64
diff changeset
634 call PLED_active_gas_divemode; Display gas, if required
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
635 call PLED_clear_divemode_menu; Clear dive mode menu
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
636 call PLED_divemode_mask ; Display mask
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
637 call PLED_divemins ; Display (new) divetime!
98
6f8e3a08011e 1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents: 87
diff changeset
638 call customview_mask ; Redraw current customview mask
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
639 clrf timeout_counter3 ; Also clear timeout
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
640 bcf display_see_deco ; clear all display flags
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
641 bcf display_set_gas
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
642 bcf display_set_xgas
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
643 bcf display_set_setpoint
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
644 bcf display_set_simulator
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
645 bcf switch_left ; and debounce switches
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
646 bcf switch_right
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
647 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
648
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
649 timeout_divemenu3:
64
e8756eba54ee 1.71beta - more deco
heinrichsweikamp
parents: 30
diff changeset
650 movff char_O_deco_status,deco_status ;
e8756eba54ee 1.71beta - more deco
heinrichsweikamp
parents: 30
diff changeset
651 tstfsz deco_status ; deco_status=0 if decompression calculation done
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
652 bra timeout_divemenu1 ; No, skip updating the decoplan
68
d0b677e1e9a5 new decoplan (GF mode) debuged
heinrichsweikamp
parents: 66
diff changeset
653 timeout_divemenu3x:
64
e8756eba54ee 1.71beta - more deco
heinrichsweikamp
parents: 30
diff changeset
654 call PLED_decoplan_gf_page_current ; Re-Draw Current page of GF Decoplan
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
655 bra timeout_divemenu1 ; Check timeout
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
656
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
657 timeout_divemenu6:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
658 ; Update Simulator Mask
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
659 call PLED_divemode_simulator_mask; Show mask
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
660 call PLED_divemenu_cursor ; update cursor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
661 bra timeout_divemenu1 ; Check timeout