Mercurial > public > mk2
annotate code_part1/OSTC_code_asm_part1/menu_ppO2.asm @ 410:c6f9eb123b85
remove of red ambient pressure (High altitude mode)
author | heinrichsweikamp |
---|---|
date | Mon, 11 Jul 2011 16:04:35 +0200 |
parents | ab962c4b19d6 |
children | 6e57b5bb98ce |
rev | line source |
---|---|
0 | 1 |
2 ; OSTC - diving computer code | |
3 ; Copyright (C) 2008 HeinrichsWeikamp GbR | |
4 | |
5 ; This program is free software: you can redistribute it and/or modify | |
6 ; it under the terms of the GNU General Public License as published by | |
7 ; the Free Software Foundation, either version 3 of the License, or | |
8 ; (at your option) any later version. | |
9 | |
10 ; This program is distributed in the hope that it will be useful, | |
11 ; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 ; GNU General Public License for more details. | |
14 | |
15 ; You should have received a copy of the GNU General Public License | |
16 ; along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | |
18 | |
19 ; Constant ppO2 Setup menu | |
20 ; written by: Matthias Heinrichs, info@heinrichsweikamp.com | |
21 ; written: 08/04/04 | |
22 ; last updated: 080904 | |
23 ; known bugs: | |
24 ; ToDo: | |
25 | |
26 menu_const_ppO2: | |
27 movlw d'1' | |
28 movwf menupos | |
29 | |
30 bcf menubit4 | |
31 bcf cursor | |
32 bcf sleepmode | |
33 clrf decodata+0 ; Here: # of SP | |
34 bcf first_FA ; Here: =1: -, =0: + | |
35 bcf second_FA ; Here: =1: 1, =0: 10 steps | |
36 | |
37 menu_const_ppO20: | |
38 call PLED_ClearScreen | |
39 call PLED_topline_box | |
40 | |
41 WIN_INVERT .1 ; Init new Wordprocessor | |
42 DISPLAYTEXT .111 ; Constant ppO2 Setup | |
43 WIN_INVERT .0 ; Init new Wordprocessor | |
44 | |
45 | |
46 menu_const_ppO21: | |
47 clrf timeout_counter2 | |
48 bcf menubit2 | |
49 bcf menubit3 | |
50 | |
51 WIN_LEFT .20 | |
52 WIN_TOP .35 | |
53 lfsr FSR2,letter | |
54 OUTPUTTEXT .112 ; SP# | |
55 movff decodata+0,lo | |
56 incf lo,F | |
57 bsf leftbind | |
58 output_99 | |
123 | 59 STRCAT " (" |
0 | 60 |
61 OUTPUTTEXT d'192' ; Dil. | |
123 | 62 PUTC ' ' |
0 | 63 |
64 read_int_eeprom d'33' ; Read byte (stored in EEDATA) | |
65 movff EEDATA,active_gas ; Read start gas (1-5) | |
66 | |
67 decf active_gas,W ; Gas 0-4 | |
68 mullw d'4' | |
69 movf PRODL,W | |
70 addlw d'6' ; = address for O2 ratio | |
71 movwf EEADR | |
72 call read_eeprom ; Read O2 ratio | |
73 movff EEDATA, lo ; O2 ratio | |
74 | |
75 | |
76 bsf leftbind | |
77 output_99 | |
78 | |
123 | 79 PUTC '/' |
0 | 80 |
81 decf active_gas,W ; Gas 0-4 | |
82 mullw d'4' | |
83 movf PRODL,W | |
84 addlw d'7' ; = address for He ratio | |
85 movwf EEADR | |
86 call read_eeprom ; Read He ratio | |
87 movff EEDATA,lo ; And copy into hold register | |
88 | |
89 bsf leftbind | |
90 output_99 | |
123 | 91 STRCAT_PRINT ")" |
0 | 92 |
93 | |
94 WIN_LEFT .20 | |
95 WIN_TOP .65 | |
96 | |
97 lfsr FSR2,letter | |
98 OUTPUTTEXT .97 ; "Current: " | |
99 movf decodata+0,W | |
100 addlw d'36' ; offset in eeprom | |
101 movwf EEADR | |
102 call read_eeprom ; ppO2 value | |
103 movff EEDATA,lo | |
104 clrf hi | |
105 bsf leftbind | |
106 output_16dp d'3' | |
107 bcf leftbind | |
398
ab962c4b19d6
Fixing issue 50, correct "Bar" to "bar" in texts and comments
heinrichsweikamp
parents:
123
diff
changeset
|
108 STRCAT_PRINT "bar " |
0 | 109 |
110 WIN_LEFT .20 | |
111 WIN_TOP .95 | |
112 | |
113 lfsr FSR2,letter | |
114 OUTPUTTEXT d'190' ; ppO2 + | |
115 call word_processor | |
116 | |
117 WIN_LEFT .20 | |
118 WIN_TOP .125 | |
119 | |
120 lfsr FSR2,letter | |
121 OUTPUTTEXT d'191' ; ppO2 - | |
122 call word_processor | |
123 | |
124 WIN_LEFT .20 | |
125 WIN_TOP .155 | |
126 | |
127 lfsr FSR2,letter | |
128 OUTPUTTEXT .89 ; "Default: " | |
123 | 129 STRCAT_PRINT "1.00" |
0 | 130 |
131 DISPLAYTEXT .11 ; Exit | |
132 call wait_switches ; Waits until switches are released, resets flag if button stays pressed! | |
133 call PLED_menu_cursor | |
134 | |
135 menu_const_ppO2_loop: | |
136 call check_switches_logbook | |
137 | |
138 btfsc menubit3 | |
139 bra menu_const_ppO22 ; move cursor | |
140 | |
141 btfsc menubit2 | |
142 bra do_menu_const_ppO2 ; call submenu | |
143 | |
144 btfsc divemode | |
145 goto restart ; dive started! | |
146 | |
147 btfsc onesecupdate | |
148 call timeout_surfmode | |
149 | |
150 btfsc onesecupdate | |
151 call set_dive_modes | |
152 | |
153 bcf onesecupdate ; 1 sec. functions done | |
154 | |
155 btfsc sleepmode | |
156 bra exit_menu_const_ppO2 | |
157 | |
158 bra menu_const_ppO2_loop | |
159 | |
160 menu_const_ppO22: | |
161 incf menupos,F | |
162 | |
163 movlw d'2' | |
164 cpfseq menupos ; =2? | |
165 bra menu_const_ppO22a ; No | |
166 incf menupos,F ; Skip pos. 2 | |
167 | |
168 menu_const_ppO22a: | |
169 movlw d'7' | |
170 cpfseq menupos ; =7? | |
171 bra menu_const_ppO23 ; No | |
172 movlw d'1' | |
173 movwf menupos | |
174 | |
175 menu_const_ppO23: | |
176 clrf timeout_counter2 | |
177 call PLED_menu_cursor | |
178 | |
179 ; debounce switches | |
180 call wait_switches ; Waits until switches are released, resets flag if button stays pressed! | |
181 bcf menubit3 ; clear flag | |
182 bra menu_const_ppO2_loop | |
183 | |
184 do_menu_const_ppO2: | |
185 dcfsnz menupos,F | |
186 bra next_ppO2 | |
187 dcfsnz menupos,F | |
188 bra change_ppo2_plus | |
189 dcfsnz menupos,F | |
190 bra change_ppo2_plus | |
191 dcfsnz menupos,F | |
192 bra change_ppo2_minus | |
193 dcfsnz menupos,F | |
194 bra change_ppo2_reset | |
195 exit_menu_const_ppO2: ; exit... | |
196 movlw d'2' | |
197 movwf menupos | |
198 goto more_menu2 | |
199 | |
200 change_ppo2_plus: | |
201 movf decodata+0,W ; read current value | |
202 addlw d'36' ; offset in memory | |
203 movwf EEADR | |
204 call read_eeprom ; Low-value | |
205 movff EEDATA,lo | |
206 | |
207 incf lo,F ; increase depth | |
208 movlw d'251' | |
209 cpfseq lo | |
210 bra change_ppo2_plus2 | |
211 movlw d'250' | |
212 movwf lo | |
213 change_ppo2_plus2: | |
214 movff lo,EEDATA ; write result | |
215 call write_eeprom ; save result in EEPROM | |
216 movlw d'3' | |
217 movwf menupos | |
218 bra menu_const_ppO21 | |
219 | |
220 change_ppo2_minus: | |
221 movf decodata+0,W ; read current value | |
222 addlw d'36' ; offset in memory | |
223 movwf EEADR | |
224 call read_eeprom ; Low-value | |
225 movff EEDATA,lo | |
226 | |
227 decf lo,F ; decrease depth | |
228 movlw d'255' | |
229 cpfseq lo | |
230 bra change_ppo2_minus2 | |
231 movlw d'0' | |
232 movwf lo | |
233 | |
234 change_ppo2_minus2: | |
235 movff lo,EEDATA ; write result | |
236 call write_eeprom ; save result in EEPROM | |
237 | |
238 movlw d'4' | |
239 movwf menupos | |
240 bra menu_const_ppO21 | |
241 | |
242 change_ppo2_reset: ; reset to 1.00Bar | |
243 movf decodata+0,W ; read current value | |
244 addlw d'36' ; offset in memory | |
245 movwf EEADR | |
246 movlw d'100' | |
247 movwf EEDATA | |
248 call write_eeprom ; save result in EEPROM | |
249 movlw d'5' | |
250 movwf menupos | |
251 bra menu_const_ppO21 | |
252 | |
253 next_ppO2: | |
254 incf decodata+0,F | |
255 movlw d'3' | |
256 cpfseq decodata+0 ; =3? | |
257 bra next_ppO22 | |
258 clrf decodata+0 ; yes, so reset to zero | |
259 next_ppO22: | |
260 movlw d'1' | |
261 movwf menupos | |
262 bra menu_const_ppO21 |