comparison code_part1/OSTC_code_asm_part1/simulator.asm @ 224:49c90c5d9603

Gas usage + Show after last page of decoplan. + Units in 0.1 litters (or bars), hence 16bits. + Define CF#56 and CF#57, defaults to 20.0 l/min. + Go RED if volume > 6553.5 (saturated). + Calculate gas usage at bottom of ascent (safe bet). + Fix when first gas is not Gas1. + BUGFIX gas usage: first gas is not in the sorted gaslist (in general). KNOWN BUG: wrong result if the gaslist is not sorted, or first gas do have a depth > 0.
author JeanDo
date Thu, 03 Mar 2011 15:16:23 +0100
parents 0a3ca358c684
children 2dc4a7340510
comparison
equal deleted inserted replaced
223:2a0a446fa6c0 224:49c90c5d9603
178 bsf leftbind 178 bsf leftbind
179 output_16 179 output_16
180 STRCAT_PRINT "'" 180 STRCAT_PRINT "'"
181 181
182 simulator_decoplan_notts: 182 simulator_decoplan_notts:
183 ; Print ambient pressure in DEBUG compile, because if might
184 ; be usefull to calibrate decompression algorithm.
185 #ifdef __DEBUG
183 movff int_I_pres_surface+0,lo 186 movff int_I_pres_surface+0,lo
184 movff int_I_pres_surface+1,hi 187 movff int_I_pres_surface+1,hi
185 188
186 WIN_TOP .190 ; Print Pamb used for compute 189 WIN_TOP .190
187 lfsr FSR2, letter 190 lfsr FSR2, letter
188 bsf leftbind 191 bsf leftbind
189 output_16 192 output_16
190 bcf leftbind 193 bcf leftbind
191 STRCAT_PRINT " mbar" 194 STRCAT_PRINT " mbar"
195 #endif
192 196
193 WIN_INVERT .1 ; Init new Wordprocessor 197 WIN_INVERT .1 ; Init new Wordprocessor
194 DISPLAYTEXT .188 ; Sim. Results: 198 DISPLAYTEXT .188 ; Sim. Results:
195 WIN_INVERT .0 ; Init new Wordprocessor 199 WIN_INVERT .0 ; Init new Wordprocessor
196 200
211 simulator_show_decoplan3: 215 simulator_show_decoplan3:
212 btfsc switch_right 216 btfsc switch_right
213 bra simulator_show_decoplan4 ; Quit display 217 bra simulator_show_decoplan4 ; Quit display
214 218
215 btfsc switch_left 219 btfsc switch_left
216 bra simulator_show_decoplan5 ; Quit display or new Decoplan-Page (GF Mode only) 220 bra simulator_show_decoplan5 ; Next decoplan-page.
217 221
218 btfsc sleepmode 222 btfsc sleepmode
219 goto more_menu 223 goto more_menu
220 224
221 btfsc divemode 225 btfsc divemode
230 234
231 call PLED_decoplan ; Re-Draw Current page of GF Decoplan 235 call PLED_decoplan ; Re-Draw Current page of GF Decoplan
232 bra simulator_show_decoplan1 236 bra simulator_show_decoplan1
233 237
234 simulator_show_decoplan5_0: 238 simulator_show_decoplan5_0:
239 btfss display_see_deco
240 bra simulator_show_decoplan4
235 bcf display_see_deco ; clear flag 241 bcf display_see_deco ; clear flag
236 bra simulator_show_decoplan4 ; Quit 242
243 call deco_gas_volumes
244 movlb 1
245
246 call PLED_clear_divemode_menu ; Clear right part.
247
248 movlw d'10'
249 movwf waitms_temp ; Row for gas list is .10+.25
250 clrf wait_temp ; Gas counter
251 lfsr FSR0,int_O_gas_volumes ; Initialize indexed addressing.
252
253 WIN_LEFT .90 ; Set column
254
255 simulator_show_decoplan5_loop:
256 incf wait_temp,F ; Increment gas #
257
258 movlw .25
259 addwf waitms_temp,F ; Increase row position
260 movff waitms_temp,win_top ; Set Row
261
262 movff POSTINC0,lo ; Read (16bit) result, low first,
263 movff POSTINC0,hi ; then high.
264 movf lo,W ; Null ?
265 iorwf hi,W
266 bz simulator_show_decoplan5_1 ; Skip printing.
267
268 movf lo,W ; == 65535 (saturated ?)
269 iorwf hi,W
270 incf WREG
271 bnz simulator_show_decoplan5_2
272 call PLED_warnings_color
273 STRCPY "> "
274 bra simulator_show_decoplan5_3
275
276 simulator_show_decoplan5_2:
277 call PLED_standard_color
278 STRCPY "= "
279
280 simulator_show_decoplan5_3:
281 output_16dp .4 ; 1 decimal.
282 call word_processor ; No unit: can be bars or litters.
283
284 ; Loop for all 5 gas
285 simulator_show_decoplan5_1:
286 movlw d'5' ; list all five gases
287 cpfseq wait_temp ; All gases shown?
288 bra simulator_show_decoplan5_loop ; No
289
290 WIN_TOP .2
291 WIN_LEFT .0
292 WIN_INVERT 1
293 STRCPY_PRINT "Gas usage: "
294 WIN_INVERT 0
295
296 bra simulator_show_decoplan1
237 297
238 simulator_show_decoplan4: 298 simulator_show_decoplan4:
239 movlw d'5' 299 movlw d'5'
240 movwf menupos 300 movwf menupos
241 bra menu_simulator1 301 bra menu_simulator1
245 call diveloop_boot ; configure gases, etc. 305 call diveloop_boot ; configure gases, etc.
246 306
247 bsf simulatormode_active ; normal simulator mode 307 bsf simulatormode_active ; normal simulator mode
248 bsf standalone_simulator ; Standalone Simulator active 308 bsf standalone_simulator ; Standalone Simulator active
249 309
250 movff logbook_temp1,logbook_temp3 ; store bottom time. 310 ; Save dive parameters for gas volume estimation:
311 movff logbook_temp2,char_I_bottom_depth
312 movff logbook_temp1,char_I_bottom_time
313
251 314
252 movff logbook_temp2,xA+0 ; Bottom depth. 315 movff logbook_temp2,xA+0 ; Bottom depth.
253 clrf xA+1 316 clrf xA+1
254 movlw d'100' 317 movlw d'100'
255 movwf xB+0 318 movwf xB+0
334 397
335 bcf LED_red 398 bcf LED_red
336 399
337 movlw d'5' ; Pre-Set Cursor to "Show Decoplan" 400 movlw d'5' ; Pre-Set Cursor to "Show Decoplan"
338 movwf menupos 401 movwf menupos
339 movff logbook_temp3,logbook_temp1 ; restore bottom time. 402 movff char_I_bottom_time,logbook_temp1; restore bottom time.
340 bra menu_simulator1 ; Done. 403 bra menu_simulator1 ; Done.
341
342 404
343 simulator_save_tissue_data: 405 simulator_save_tissue_data:
344 bsf restore_deco_data ; Set restore flag 406 bsf restore_deco_data ; Set restore flag
345 ostc_debug 'S' ; Sends debug-information to screen if debugmode active 407 ostc_debug 'S' ; Sends debug-information to screen if debugmode active
346 call deco_push_tissues_to_vault 408 call deco_push_tissues_to_vault