comparison code_part1/OSTC_code_asm_part1/menu_ppO2.asm @ 639:2ab9e9a8a189

New CCR Setup Menu (In work)
author heinrichsweikamp
date Thu, 20 Sep 2012 10:06:19 +0200
parents ab2686087bce
children 50ba6255f53e
comparison
equal deleted inserted replaced
638:1d53f10b51ac 639:2ab9e9a8a189
17 17
18 18
19 ; Constant ppO2 Setup menu 19 ; Constant ppO2 Setup menu
20 ; written by: Matthias Heinrichs, info@heinrichsweikamp.com 20 ; written by: Matthias Heinrichs, info@heinrichsweikamp.com
21 ; written: 08/04/04 21 ; written: 08/04/04
22 ; last updated: 080904 22 ; last updated: 120920
23 ; known bugs: 23 ; known bugs:
24 ; ToDo: 24 ; ToDo:
25 ;
26 ; New in 2.52 Diluents stored seperately in EEPROM Bank1
27 ; EEPROM BANK1 Byte96-97:
28 ; Diluent 1 (%O2,%He)
29 ; EEPROM BANK1 Byte98-99:
30 ; Diluent 2 (%O2,%He)
31 ; EEPROM BANK1 Byte100-101:
32 ; Diluent 3 (%O2,%He)
33 ; EEPROM BANK1 Byte102-103:
34 ; Diluent 4 (%O2,%He)
35 ; EEPROM BANK1 Byte104-105:
36 ; Diluent 5 (%O2,%He)
37
25 38
26 menu_const_ppO2: 39 menu_const_ppO2:
40 movlw d'1'
41 movwf menupos
42 menu_const_ppO2_return:
43 call PLED_ClearScreen
44 call PLED_ccr_setup_menu_mask
45 call refresh_cursor
46 call menu_pre_loop_common
47
48 menu_const_ppO2_preloop:
49 call check_switches_menu
50 movlw d'3'
51 cpfseq menupos
52 bra menu_const_ppO2_preloop2 ; Returns
53 movlw d'6'
54 movwf menupos
55 call PLED_menu_cursor
56
57 menu_const_ppO2_preloop2:
58 btfsc menubit2
59 bra do_ccr_pre_menu ; call submenu
60 btfss menubit
61 goto restart ; exit menu, restart
62 btfsc onesecupdate
63 call menu_check_dive_and_timeout ; "Goto restart" or sets sleepmode flag
64 bcf onesecupdate ; End of one second tasks
65 btfsc sleepmode
66 goto restart
67 bra menu_const_ppO2_preloop
68
69 do_ccr_pre_menu:
70 dcfsnz menupos,F
71 goto menu_diluentsetup
72 dcfsnz menupos,F
73 goto menu_const_ppO2_setpoints
74 dcfsnz menupos,F
75 goto exit_menu_const_ppO2 ; exit...
76 dcfsnz menupos,F
77 goto exit_menu_const_ppO2 ; exit...
78 dcfsnz menupos,F
79 goto exit_menu_const_ppO2 ; exit...
80 exit_menu_const_ppO2: ; exit...
81 movlw d'2'
82 movwf menupos
83 goto more_menu2
84
85 menu_diluentsetup:
86 movlw d'1'
87 movwf menupos
88
89 menu_diluentsetup_prelist:
90 call PLED_ClearScreen
91 call menu_pre_loop_common ; Clear some menu flags, timeout and switches
92 call PLED_topline_box
93 WIN_INVERT .1 ; Init new Wordprocessor
94 DISPLAYTEXT .106 ; Gas List
95 WIN_INVERT .0 ; Init new Wordprocessor
96 clrf decodata+0 ; Here: # of gas 0-4
97 clrf divemins+0 ; Here: # of Gas * 4
98 movlw d'5'
99 movwf waitms_temp ; here: stores row for gas list
100 movlw d'94'
101 movwf wait_temp ; here: stores eeprom address for gas list
102 movlw .1
103 movwf EEADRH
104
105 menu_diluentsetup_list:
106 WIN_LEFT .20
107 movlw d'2'
108 addwf wait_temp,F ; Increase eeprom address for gas list
109 movlw d'30'
110 addwf waitms_temp,F ; Increase row
111 movf waitms_temp,W ; Load row into WREG
112 movff WREG,win_top
113 lfsr FSR2,letter
114 PUTC TXT_GAS_C
115 movff decodata+0,lo
116 incf lo,F
117 bsf leftbind
118 output_99
119 PUTC ':'
120
121 menu_diluentsetup_Tx:
122 call word_processor
123
124 WIN_LEFT .48
125 movf waitms_temp,W ; Load row into WREG
126 movff WREG,win_top
127 lfsr FSR2,letter
128
129 movff wait_temp, EEADR ; Gas %He - Set address in internal EEPROM
130 incf EEADR,F ; Gas %He - Set address in internal EEPROM
131 call read_eeprom ; Read He value from EEPROM
132 movff EEDATA,lo ; Move EEDATA -> lo
133 movf lo,f ; Move lo -> f
134 movlw d'0' ; Move 0 -> WREG
135 cpfsgt lo ; He > 0?
136 bra menu_diluentsetup_Nx ; NO check o2
137
138 ; YES Write TX 15/55
139 call gassetup_write_Tx
140 movff wait_temp, EEADR ; Gas %O2 - Set address in internal EEPROM
141 call read_eeprom ; O2 value
142 movff EEDATA,lo
143 output_8
144 PUTC '/'
145 incf EEADR,F ; Gas #hi: %He - Set address in internal EEPROM
146 call read_eeprom ; He value
147 movff EEDATA,lo
148 output_8
149 bra menu_diluentsetup_list0
150
151 ; New v1.44se
152 menu_diluentsetup_Nx:
153 movff wait_temp, EEADR ; Gas %O2 - Set address in internal EEPROM
154 call read_eeprom ; Read O2 value from EEPROM
155 movff EEDATA,lo ; Move EEDATA -> lo
156 movf lo,f ; Move lo -> f
157 movlw d'21' ; Move 21 -> WREG
158 cpfsgt lo ; o2 > 21%
159 bra menu_diluentsetup_Air ; NO AIR
160 movlw d'100' ; Move 100 -> WREG
161 cpfslt lo ; o2 < 100%
162 bra menu_diluentsetup_O2 ; NO write O2
163
164 ; YES Write NX 32
165 call gassetup_write_Nx
166 output_8
167 bra menu_diluentsetup_list0
168
169 menu_diluentsetup_O2:
170 STRCAT TXT_O2_3
171 output_8
172 bra menu_diluentsetup_list0
173
174 menu_diluentsetup_Air:
175 cpfseq lo ; o2 = 21%
176 call menu_gassetup_Err
177
178 STRCAT TXT_AIR4
179 output_8
180 bra menu_diluentsetup_list0
181
182 menu_diluentsetup_Err:
183 STRCAT TXT_ERR4
184 output_8
185
186 menu_diluentsetup_list0:
187 call word_processor
188
189 incf decodata+0,F
190 movlw d'5'
191 cpfseq decodata+0
192 goto menu_diluentsetup_list
193
194 DISPLAYTEXT .11 ; Exit
195 call wait_switches ; Waits until switches are released, resets flag if button stays pressed!
196 call PLED_menu_cursor
197
198 menu_diluentsetup_loop:
199 call check_switches_logbook
200
201 btfsc menubit3
202 bra menu_diluentsetup_list2 ; move cursor
203
204 btfsc menubit2
205 bra do_diluentsetup_list ; call gas-specific submenu
206
207 btfsc onesecupdate
208 call menu_check_dive_and_timeout ; "Goto restart" or sets sleepmode flag
209
210 bcf onesecupdate ; 1 sec. functions done
211
212 btfsc sleepmode
213 bra menu_const_ppO2
214
215 bra menu_diluentsetup_loop
216
217 menu_diluentsetup_list2:
218 incf menupos,F
219 movlw d'7'
220 cpfseq menupos ; =7?
221 bra menu_diluentsetup_list3 ; No
222 movlw d'1'
223 movwf menupos
224
225 menu_diluentsetup_list3:
226 clrf timeout_counter2
227 call PLED_menu_cursor
228
229 call wait_switches ; Waits until switches are released, resets flag if button stays pressed!
230
231 bcf menubit3 ; clear flag
232 bra menu_diluentsetup_loop
233
234
235 do_diluentsetup_list:
236 dcfsnz menupos,F
237 bra diluent_list_edit_gas1
238 dcfsnz menupos,F
239 bra diluent_list_edit_gas1
240 dcfsnz menupos,F
241 bra diluent_list_edit_gas1
242 dcfsnz menupos,F
243 bra diluent_list_edit_gas1
244 dcfsnz menupos,F
245 bra diluent_list_edit_gas1
246 bra menu_const_ppO2 ; Exit List
247
248 diluent_list_edit_gas1:
249 diluent_list_edit_gas2:
250 diluent_list_edit_gas3:
251 diluent_list_edit_gas4:
252 diluent_list_edit_gas5:
253 bra menu_const_ppO2 ; Exit List
254
255 ; ***
256
257
258
259
260
261
262
263 menu_const_ppO2_setpoints: ; Setpoint menu
27 movlw d'1' 264 movlw d'1'
28 movwf menupos 265 movwf menupos
29 266
30 bcf menubit4 267 bcf menubit4
31 clrf decodata+0 ; Here: # of SP 268 clrf decodata+0 ; Here: # of SP
175 bra change_ppo2_plus 412 bra change_ppo2_plus
176 dcfsnz menupos,F 413 dcfsnz menupos,F
177 bra change_ppo2_minus 414 bra change_ppo2_minus
178 dcfsnz menupos,F 415 dcfsnz menupos,F
179 bra change_ppo2_reset 416 bra change_ppo2_reset
180 exit_menu_const_ppO2: ; exit...
181 movlw d'2' 417 movlw d'2'
182 movwf menupos 418 movwf menupos
183 goto more_menu2 419 bra menu_const_ppO2_return
184 420
185 change_ppo2_plus: 421 change_ppo2_plus:
186 movf decodata+0,W ; read current value 422 movf decodata+0,W ; read current value
187 addlw d'36' ; offset in memory 423 addlw d'36' ; offset in memory
188 movwf EEADR 424 movwf EEADR