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 clrf decodata+0 ; Here: # of SP
|
|
32 bcf first_FA ; Here: =1: -, =0: +
|
|
33 bcf second_FA ; Here: =1: 1, =0: 10 steps
|
|
34
|
|
35 menu_const_ppO20:
|
|
36 call PLED_ClearScreen
|
|
37 call PLED_topline_box
|
|
38
|
|
39 WIN_INVERT .1 ; Init new Wordprocessor
|
|
40 DISPLAYTEXT .111 ; Constant ppO2 Setup
|
|
41 WIN_INVERT .0 ; Init new Wordprocessor
|
|
42
|
|
43
|
|
44 menu_const_ppO21:
|
|
45 WIN_LEFT .20
|
|
46 WIN_TOP .35
|
|
47 lfsr FSR2,letter
|
|
48 OUTPUTTEXT .112 ; SP#
|
|
49 movff decodata+0,lo
|
|
50 incf lo,F
|
|
51 bsf leftbind
|
|
52 output_99
|
123
|
53 STRCAT " ("
|
0
|
54
|
|
55 OUTPUTTEXT d'192' ; Dil.
|
123
|
56 PUTC ' '
|
0
|
57
|
|
58 read_int_eeprom d'33' ; Read byte (stored in EEDATA)
|
|
59 movff EEDATA,active_gas ; Read start gas (1-5)
|
|
60
|
|
61 decf active_gas,W ; Gas 0-4
|
|
62 mullw d'4'
|
|
63 movf PRODL,W
|
|
64 addlw d'6' ; = address for O2 ratio
|
|
65 movwf EEADR
|
|
66 call read_eeprom ; Read O2 ratio
|
|
67 movff EEDATA, lo ; O2 ratio
|
|
68
|
|
69
|
|
70 bsf leftbind
|
|
71 output_99
|
|
72
|
123
|
73 PUTC '/'
|
0
|
74
|
|
75 decf active_gas,W ; Gas 0-4
|
|
76 mullw d'4'
|
|
77 movf PRODL,W
|
|
78 addlw d'7' ; = address for He ratio
|
|
79 movwf EEADR
|
|
80 call read_eeprom ; Read He ratio
|
|
81 movff EEDATA,lo ; And copy into hold register
|
|
82
|
|
83 bsf leftbind
|
|
84 output_99
|
123
|
85 STRCAT_PRINT ")"
|
0
|
86
|
|
87
|
|
88 WIN_LEFT .20
|
|
89 WIN_TOP .65
|
|
90
|
|
91 lfsr FSR2,letter
|
|
92 OUTPUTTEXT .97 ; "Current: "
|
|
93 movf decodata+0,W
|
|
94 addlw d'36' ; offset in eeprom
|
|
95 movwf EEADR
|
|
96 call read_eeprom ; ppO2 value
|
|
97 movff EEDATA,lo
|
|
98 clrf hi
|
|
99 bsf leftbind
|
|
100 output_16dp d'3'
|
|
101 bcf leftbind
|
445
|
102 STRCAT_PRINT TXT_BAR4
|
0
|
103
|
|
104 WIN_LEFT .20
|
|
105 WIN_TOP .95
|
|
106
|
|
107 lfsr FSR2,letter
|
|
108 OUTPUTTEXT d'190' ; ppO2 +
|
|
109 call word_processor
|
|
110
|
|
111 WIN_LEFT .20
|
|
112 WIN_TOP .125
|
|
113
|
|
114 lfsr FSR2,letter
|
|
115 OUTPUTTEXT d'191' ; ppO2 -
|
|
116 call word_processor
|
|
117
|
|
118 WIN_LEFT .20
|
|
119 WIN_TOP .155
|
|
120
|
|
121 lfsr FSR2,letter
|
|
122 OUTPUTTEXT .89 ; "Default: "
|
123
|
123 STRCAT_PRINT "1.00"
|
0
|
124
|
|
125 DISPLAYTEXT .11 ; Exit
|
|
126 call wait_switches ; Waits until switches are released, resets flag if button stays pressed!
|
576
|
127 call menu_pre_loop_common ; Clear some menu flags, timeout and switches
|
0
|
128 call PLED_menu_cursor
|
|
129
|
|
130 menu_const_ppO2_loop:
|
|
131 call check_switches_logbook
|
|
132
|
|
133 btfsc menubit3
|
575
|
134 bra menu_const_ppO22 ; move cursor
|
0
|
135
|
|
136 btfsc menubit2
|
575
|
137 bra do_menu_const_ppO2 ; call submenu
|
0
|
138
|
|
139 btfsc onesecupdate
|
575
|
140 call menu_check_dive_and_timeout ; "Goto restart" or sets sleepmode flag
|
0
|
141
|
|
142 bcf onesecupdate ; 1 sec. functions done
|
|
143
|
|
144 btfsc sleepmode
|
575
|
145 bra exit_menu_const_ppO2
|
0
|
146
|
575
|
147 bra menu_const_ppO2_loop
|
0
|
148
|
|
149 menu_const_ppO22:
|
|
150 incf menupos,F
|
|
151
|
|
152 movlw d'2'
|
|
153 cpfseq menupos ; =2?
|
|
154 bra menu_const_ppO22a ; No
|
|
155 incf menupos,F ; Skip pos. 2
|
|
156
|
|
157 menu_const_ppO22a:
|
|
158 movlw d'7'
|
|
159 cpfseq menupos ; =7?
|
|
160 bra menu_const_ppO23 ; No
|
|
161 movlw d'1'
|
|
162 movwf menupos
|
|
163
|
|
164 menu_const_ppO23:
|
576
|
165 call menu_pre_loop_common ; Clear some menu flags, timeout and switches
|
0
|
166 call PLED_menu_cursor
|
|
167 bra menu_const_ppO2_loop
|
|
168
|
|
169 do_menu_const_ppO2:
|
|
170 dcfsnz menupos,F
|
|
171 bra next_ppO2
|
|
172 dcfsnz menupos,F
|
|
173 bra change_ppo2_plus
|
|
174 dcfsnz menupos,F
|
|
175 bra change_ppo2_plus
|
|
176 dcfsnz menupos,F
|
|
177 bra change_ppo2_minus
|
|
178 dcfsnz menupos,F
|
|
179 bra change_ppo2_reset
|
|
180 exit_menu_const_ppO2: ; exit...
|
|
181 movlw d'2'
|
|
182 movwf menupos
|
|
183 goto more_menu2
|
|
184
|
|
185 change_ppo2_plus:
|
|
186 movf decodata+0,W ; read current value
|
|
187 addlw d'36' ; offset in memory
|
|
188 movwf EEADR
|
|
189 call read_eeprom ; Low-value
|
|
190 movff EEDATA,lo
|
|
191
|
|
192 incf lo,F ; increase depth
|
|
193 movlw d'251'
|
|
194 cpfseq lo
|
|
195 bra change_ppo2_plus2
|
|
196 movlw d'250'
|
|
197 movwf lo
|
|
198 change_ppo2_plus2:
|
|
199 movff lo,EEDATA ; write result
|
|
200 call write_eeprom ; save result in EEPROM
|
|
201 movlw d'3'
|
|
202 movwf menupos
|
|
203 bra menu_const_ppO21
|
|
204
|
|
205 change_ppo2_minus:
|
|
206 movf decodata+0,W ; read current value
|
|
207 addlw d'36' ; offset in memory
|
|
208 movwf EEADR
|
|
209 call read_eeprom ; Low-value
|
|
210 movff EEDATA,lo
|
|
211
|
|
212 decf lo,F ; decrease depth
|
|
213 movlw d'255'
|
|
214 cpfseq lo
|
|
215 bra change_ppo2_minus2
|
|
216 movlw d'0'
|
|
217 movwf lo
|
|
218
|
|
219 change_ppo2_minus2:
|
|
220 movff lo,EEDATA ; write result
|
|
221 call write_eeprom ; save result in EEPROM
|
|
222
|
|
223 movlw d'4'
|
|
224 movwf menupos
|
576
|
225 bra menu_const_ppO21
|
0
|
226
|
|
227 change_ppo2_reset: ; reset to 1.00Bar
|
|
228 movf decodata+0,W ; read current value
|
|
229 addlw d'36' ; offset in memory
|
|
230 movwf EEADR
|
|
231 movlw d'100'
|
|
232 movwf EEDATA
|
|
233 call write_eeprom ; save result in EEPROM
|
|
234 movlw d'5'
|
|
235 movwf menupos
|
|
236 bra menu_const_ppO21
|
|
237
|
|
238 next_ppO2:
|
|
239 incf decodata+0,F
|
|
240 movlw d'3'
|
|
241 cpfseq decodata+0 ; =3?
|
|
242 bra next_ppO22
|
|
243 clrf decodata+0 ; yes, so reset to zero
|
|
244 next_ppO22:
|
|
245 movlw d'1'
|
|
246 movwf menupos
|
576
|
247 bra menu_const_ppO21 |