annotate src/simulator.asm @ 628:cd58f7fc86db

3.05 stable work
author heinrichsweikamp
date Thu, 19 Sep 2019 12:01:29 +0200
parents c40025d8e750
children 185ba2f91f59
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
heinrichsweikamp
parents:
diff changeset
1 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
2 ;
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
3 ; File simulator.asm combined next generation V3.04.3
0
heinrichsweikamp
parents:
diff changeset
4 ;
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
5 ; Deco Calculator
0
heinrichsweikamp
parents:
diff changeset
6 ;
heinrichsweikamp
parents:
diff changeset
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
heinrichsweikamp
parents:
diff changeset
8 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
9 ; HISTORY
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
10 ; 2011-07-09 : [jDG] Creation...
0
heinrichsweikamp
parents:
diff changeset
11
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
12 #include "hwos.inc" ; Mandatory include
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
13 #include "convert.inc" ; output_*
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
14 #include "shared_definitions.h" ; Mailbox from/to p2_deco.c
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
15 #include "strings.inc" ; STRCPY,...
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
16 #include "tft.inc" ; WIN_LEFT,...
0
heinrichsweikamp
parents:
diff changeset
17 #include "start.inc"
heinrichsweikamp
parents:
diff changeset
18 #include "divemode.inc"
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
19 #include "sleepmode.inc"
0
heinrichsweikamp
parents:
diff changeset
20 #include "math.inc"
heinrichsweikamp
parents:
diff changeset
21 #include "eeprom_rs232.inc"
50
ec4d8503ec45 NEW: user-selectable color schemes
heinrichsweikamp
parents: 46
diff changeset
22 #include "tft_outputs.inc"
298
2fe34fc0e2ae new submenu for gas consumption, show actual mix instead of GAS1-GAS5 in deco planner
heinrichsweikamp
parents: 296
diff changeset
23 #include "gaslist.inc"
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
24 #include "surfmode.inc"
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
25 #include "wait.inc"
0
heinrichsweikamp
parents:
diff changeset
26
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
27
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
28 extern deco_push_tissues_to_vault
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
29 extern deco_calc_dive_interval
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
30 extern deco_calc_hauptroutine
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
31 extern deco_pull_tissues_from_vault
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
32 extern TFT_decotype_logbook
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
33 extern do_return_demo_planner
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 598
diff changeset
34 extern dive_boot_oc_bail
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 598
diff changeset
35 extern dive_boot_oc
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
36
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
37 IFDEF _ccr_pscr
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 598
diff changeset
38 extern dive_boot_cc
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
39 ENDIF
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
40
0
heinrichsweikamp
parents:
diff changeset
41
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
42 ;---- Private local Variables -------------------------------------------------
0
heinrichsweikamp
parents:
diff changeset
43
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
44 CBLOCK local3 ; max size is 16 Byte !!!
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
45 decoplan_index ; within each page
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
46 decoplan_gindex ; global index
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
47 decoplan_last ; depth of last stop
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
48 decoplan_flags ; private flags
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
49 decoplan_page ; page number
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
50 decoplan_warnings ; deco engine warnings
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
51 gas_index ; counter for looping through the gases
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
52 output_row ; used for positioning of the results output
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
53 real_CNS ; real CNS value from before simulated dive
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
54 ENDC ; used: 8 byte, remaining: 8 byte
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
55
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
56
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
57 ;---- Private local Flags ----------------------------------------------------
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
58
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
59 #define decoplan_abort decoplan_flags,0 ; =1: deco calculations were aborted
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
60 #define decoplan_last_stop_shown decoplan_flags,1 ; =1: last deco stop is shown
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
61 #define decoplan_pressures_shown decoplan_flags,2 ; =1: show gas volumes in bar as per tank sizes
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
62 #define decoplan_overflow decoplan_flags,3 ; =1: result > 999
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
63 #define decoplan_toggleflag decoplan_flags,4 ; used to show calculation progress
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
64 ; decoplan_flags,5 ; --- unused
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
65 ; decoplan_flags,6 ; --- unused
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
66 ; decoplan_flags,7 ; --- unused
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
67
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 598
diff changeset
68
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
69 simulator CODE
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 598
diff changeset
70
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
71 ;-----------------------------------------------------------------------------
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 598
diff changeset
72
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
73 ;=============================================================================
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
74 ; Deco Calculator Main Function
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
75 ;
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
76 global do_demo_planner
0
heinrichsweikamp
parents:
diff changeset
77 do_demo_planner:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 598
diff changeset
78 btfsc FLAG_gauge_mode ; in gauge mode?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 598
diff changeset
79 bra do_demo_planner_exit ; YES - abort
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
80 btfsc FLAG_apnoe_mode ; in apnea mode?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 598
diff changeset
81 bra do_demo_planner_exit ; YES - abort
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
82
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
83 clrf decoplan_flags ; clear all local flags
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
84 bsf simulatormode ; activate simulator mode
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
85 bsf reset_timebase ; request ISR to reset the timebase
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
86 ; btfsc reset_timebase ; has the ISR confirmed reset of the timebase?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
87 ; bra $-2 ; NO - not yet, loop waiting for the ISR
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
88 call deco_push_tissues_to_vault ; back-up the state of the real tissues (C-code)
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
89 banksel common ; back to bank common
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
90
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
91 MOVII int_O_CNS_current,real_CNS ; memorize real CNS value from before simulated dive
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
92
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
93 rcall deco_calculate ; calculate deco plan
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
94
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
95 btfss decoplan_abort ; was the deco plan calculation aborted?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
96 rcall deco_results ; NO - show results
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
97
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
98 movff simulator_time,char_I_dive_interval ; get the deco calculator runtime
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
99 call deco_pull_tissues_from_vault ; restore the status of the real tissues (C-code)
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
100 call deco_calc_dive_interval ; catch up with tissue desaturation (C-code)
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
101 call deco_calc_desaturation_time ; calculate desaturation and no-fly/no-altitude time after catch-up (C-code)
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
102 banksel common ; back to bank common
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
103
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
104 bcf switch_left ; clear left button event (may be left over from abort/exit)
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
105 bcf simulatormode ; terminate simulator mode
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
106 bsf reset_timebase ; request ISR to reset the timebase
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
107 ; btfsc reset_timebase ; has the ISR confirmed reset of timebase?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
108 ; bra $-2 ; NO - not yet, loop waiting for the ISR
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
109
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
110 btfsc divemode ; shall go into dive mode?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
111 goto restart ; YES - goto restart which will dispatch further on to dive mode
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
112
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
113 btfss trigger_timeout ; timeout on any button press?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
114 bra do_demo_planner_exit ; NO - take normal exit into surface menu
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
115 bcf trigger_timeout ; YES - clear timeout flag
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
116 bcf restart_fast ; - set next restart to be done slow, i.e. with logos
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
117 goto sleeploop ; - goto sleep mode
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
118
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 598
diff changeset
119 do_demo_planner_exit:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
120 goto do_return_demo_planner ; return to simulator menu
0
heinrichsweikamp
parents:
diff changeset
121
heinrichsweikamp
parents:
diff changeset
122
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
123 ;=============================================================================
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
124 ; Calculate the Deco Plan
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
125 ;
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
126 deco_calculate:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
127 call request_speed_fastest ; request CPU speed change to fastest speed
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
128 call TFT_ClearScreen ; clear screen to show that calculator is starting up
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
129
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
130 ; initialization of the deco engine
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
131 btfsc update_surface_pressure ; is there a pending surface pressure update?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
132 bra $-2 ; YES - loop waiting for the ISR to kick in
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
133
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
134 ; set absolute pressure at selected depth
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
135 movff char_I_bottom_depth,WREG ; get selected depth in meters
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
136 movwf depth_meter ; set depth for check_gas_best code
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
137 mullw .100 ; multiply depth with 100 to get relative pressure in mbar
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
138 movff int_I_pres_surface+0,WREG ; low byte - get surface pressure to WREG
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
139 addwf PRODL,W ; - add relative pressure
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
140 movff WREG,int_I_pres_respiration+0 ; - store as absolute pressure at depth
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
141 movff int_I_pres_surface+1,WREG ; high byte - get surface pressure to WREG
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
142 addwfc PRODH,W ; - add relative pressure
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
143 movff WREG,int_I_pres_respiration+1 ; - store as absolute pressure at depth
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
144
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
145 ; compute absolute pressure / 10, will be used by check_gas_best
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
146 MOVII int_I_pres_respiration,xA ; get absolute pressure at depth
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
147 MOVLI .10,xB ; divide by 10
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
148 call div16x16 ; xC = xA / xB = absolute pressure / 10
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
149 MOVII xC,pressure_abs_10 ; store result for later use
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
150
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
151 ; set up gas / diluent to be used on bottom segment
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
152 clrf WREG ; reset the deco info vector / deco flag so that ...
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
153 movff WREG,char_O_deco_info ; ... check_gas_best will not pick any deco gases
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
154 IFDEF _ccr_pscr
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
155 clrf active_dil ; invalidate active diluent
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
156 ENDIF
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
157 clrf active_gas ; invalidate active gas
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
158 call check_gas_best ; determine best diluent and/or gas
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
159
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
160 IFDEF _ccr_pscr
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
161 btfsc FLAG_oc_mode ; in OC mode?
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
162 bra deco_calculate_0_oc ; YES - set up OC mode
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
163 ;bra deco_calculate_0_loop ; NO - set up CCR/pSCR mode
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
164
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
165 deco_calculate_0_loop:
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
166 movf best_dil_number,W ; get best diluent into WREG
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
167 bz deco_calculate_0_error ; any usable diluent found? if NO do error handling
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
168 call setup_dil_registers ; set-up of diluent parameters for currently breathed diluent
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
169 call deco_setup_cc_diluents ; set-up of diluent list for deco calculations
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
170 bra deco_calculate_0_com ; continue with common part
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
171 ENDIF
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
172
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
173 deco_calculate_0_oc:
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
174 movf best_gas_number,W ; get best gas into WREG
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
175 bz deco_calculate_0_error ; any usable gas found? if NO do error handling
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
176 call setup_gas_registers ; set-up of gas parameters of currently breathed gas
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
177 call deco_setup_oc_gases ; set-up of gas list for deco calculations
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
178 bra deco_calculate_0_com ; continue with common part
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
179
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
180 deco_calculate_0_error:
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
181 call request_speed_normal ; request switch back to normal speed
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
182 WIN_COLOR color_red ; select color for error message
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
183 TEXT_SMALL .0, .80, tNoBottomGas1 ; print error message, line 1
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
184 TEXT_SMALL .0, .105, tNoBottomGas2 ; print error message, line 2
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
185 bsf decoplan_abort ; set abort flag
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
186 call wait_1s ; wait up to a full second
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
187 call wait_1s ; wait a full second
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
188 call wait_1s ; wait another full second
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
189 bcf switch_left ; clear potential button event
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
190 return ; return to deco calculator main function
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
191
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
192 deco_calculate_0_com:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
193 ; set deco stop settings
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
194 movff opt_last_stop,char_I_depth_last_deco ; write last stop depth to deco engine
0
heinrichsweikamp
parents:
diff changeset
195
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
196 ; set GF factors
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
197 movff opt_GF_low, char_I_GF_Low_percentage ; load normal GF factors by default
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
198 movff opt_GF_high,char_I_GF_High_percentage ; ...
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
199 TSTOSS opt_sim_use_aGF ; shall use alternative GF factors in simulation?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
200 bra deco_calculate_1 ; NO - keep normal GF factors
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
201 movff opt_aGF_low ,char_I_GF_Low_percentage ; YES - overwrite with alternative GF factors
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
202 movff opt_aGF_high,char_I_GF_High_percentage ; - ...
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
203
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
204 deco_calculate_1:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
205
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
206 IFDEF _ccr_pscr
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
207 ; set char_I_const_ppO2 for pSCR/CCR mode
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
208 clrf WREG ; load coding for pSCR calculated ppO2
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
209 btfsc FLAG_pscr_mode ; in pSCR mode?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
210 movff WREG,char_I_const_ppO2 ; YES - configure pSCR computations to calculated ppO2
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
211 btfss FLAG_ccr_mode ; in CCR mode?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
212 bra deco_calculate_2 ; NO - skip next
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
213 movff opt_sim_setpoint_number,WREG ; YES - get selected setpoint
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
214 decf WREG,W ; - 1-5 -> 0-4
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
215 lfsr FSR1,opt_setpoint_cbar ; - load base address of setpoint list
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
216 movff PLUSW1,char_I_const_ppO2 ; - configure setpoint value
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
217 ENDIF
0
heinrichsweikamp
parents:
diff changeset
218
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
219 deco_calculate_2:
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
220
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
221 ; configure the deco engine - char_O_main_status
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
222 movff char_O_main_status,hi ; get the configuration set by dive_boot_oc / dive_boot_cc
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
223 bsf hi,DECO_VOLUME_FLAG ; enable gas volume calculation
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
224 bsf hi,DECO_BOTTOM_FLAG ; include bottom segment into gas needs
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
225 bcf hi,DECO_CAVE_MODE ; cave mode not supported in deco calculator
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
226 bcf hi,DECO_Z_FACTOR_FLAG ; disable Z factors by default
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
227 TSTOSC opt_ZfactorUse ; shall use Z factors?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
228 bsf hi,DECO_Z_FACTOR_FLAG ; YES - enable Z factors
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
229 bcf hi,DECO_EXTENDED_STOPS ; disable extended stops by default
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
230 TSTOSC opt_extended_stops ; shall make extended stops?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
231 bsf hi,DECO_EXTENDED_STOPS ; YES - activate extended stops
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
232 bcf hi,DECO_TR_FUNCTIONS ; execution of TR functions is not needed in deco calculator mode
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
233 movff hi,char_O_main_status ; bank-safe copy to deco engine control
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
234
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
235 ; configure the deco engine - char_O_deco_status
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
236 movff char_O_deco_status,lo ; get the configuration set by dive_boot_oc / dive_boot_cc
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
237 bcf lo,DECO_START_NORM ; clear flag for normal plan mode
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
238 bcf lo,DECO_START_ALT ; clear flag for alternative plan mode
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
239 bsf lo,DECO_INITIALIZE ; set flag for once-per-dive initialization
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
240 bsf lo,DECO_CALCULATOR_MODE ; signal that the deco engine is run from the deco calculator
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
241 bcf lo,DECO_BAILOUT_FLAG ; no gas switches before first deco stop
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
242 bcf lo,DECO_ASCENT_FLAG ; no delayed ascent
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
243 movff lo,char_O_deco_status ; bank-safe copy to deco engine control
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
244
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
245 deco_calculate_redo:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
246
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
247 call request_speed_fastest ; request CPU speed change to fastest speed (again, if in redo)
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
248
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
249 ; show that the deco calculation is in progress
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
250 call TFT_ClearScreen ; clear screen from last results
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
251 WIN_COLOR color_lightblue ; select color for abort label
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
252 TEXT_SMALL .1,.215, tAbort ; print abort label
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
253 WIN_COLOR color_white ; select color for title and progress outputs
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
254 TEXT_SMALL .0, .40, tCalculating ; print "Calculating..."
0
heinrichsweikamp
parents:
diff changeset
255
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
256 ; calculate the surface interval
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
257 TSTOSS opt_surface_interval ; surface interval > 0 ?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
258 bra deco_calculate_bottom ; NO - continue with bottom segment
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
259 TEXT_SMALL .20,.75, tCalcSurfInter ; YES - print what we are doing
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
260 movff opt_surface_interval,char_I_dive_interval ; - copy surface interval to deco engine
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
261 call deco_calc_dive_interval ; - calculate surface interval (C-code)
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
262 banksel common ; - back to bank common
0
heinrichsweikamp
parents:
diff changeset
263
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
264 ; calculate the bottom segment
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
265 deco_calculate_bottom:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
266 ; advance tissues by selected bottom time,
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
267 ; char_I_sim_advance_time is cleared by deco engine after execution
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
268 movff char_I_bottom_time,char_I_sim_advance_time
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
269
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
270 TEXT_SMALL .20,.100,tCalcBotSeg ; print what we are doing
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
271
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
272 ; invoke the deco engine once to condition the real tissues
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
273 ; to their pressure state at the end of the bottom segment
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
274 call deco_calc_hauptroutine ; (C-code)
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 598
diff changeset
275 banksel common
0
heinrichsweikamp
parents:
diff changeset
276
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
277 IFDEF _ccr_pscr
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
278 ; conditional switch to bailout mode
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
279 btfss bailout_mode ; shall calculate a bailout plan?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
280 bra deco_calculate_ascent ; NO - skip next
111
c61b7a4e317c Bugfix: CNS in planner
heinrichsweikamp
parents: 97
diff changeset
281
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
282 call dive_boot_oc ; YES - switch to OC mode, configure OC gases and switch to gas set as 'First'
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
283 movff char_O_main_status,hi ; - bank-safe copy from deco engine control (main status)
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
284 bcf hi,DECO_BOTTOM_FLAG ; - exclude bottom segment from gas needs, i.e. calculate ascent needs only
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
285 movff hi,char_O_main_status ; - bank-safe copy back to deco engine control
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
286 movff char_O_deco_status,lo ; - bank-safe copy from deco engine control (deco status)
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
287 bsf lo,DECO_BAILOUT_FLAG ; - allow gas switches before first deco stop
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
288 bsf lo,DECO_ASCENT_FLAG ; - allow delayed ascent
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
289 movff lo,char_O_deco_status ; - bank-safe copy back to deco engine control
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 598
diff changeset
290
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
291 TEXT_SMALL .20,.125, tCalcBailout ; - print what we are doing
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
292 ENDIF
0
heinrichsweikamp
parents:
diff changeset
293
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
294 ; calculate ascent
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
295 deco_calculate_ascent:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
296 movff char_O_deco_status,lo ; bank-safe copy from deco engine control
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
297 bsf lo,DECO_START_NORM ; start calculation of a normal plan
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
298 movff lo,char_O_deco_status ; bank-safe copy back to deco engine control
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
299 TEXT_SMALL .20,.150, tCalcAscent ; print what we are doing
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
300 deco_calculate_loop:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
301 btfsc switch_left ; was the left button pressed?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
302 bra deco_calculate_abort ; YES - set abort flag, do some clean-up and return
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
303 call deco_calc_hauptroutine ; NO - invoke the deco engine so that it can do the deco calculation (C-code)
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
304 banksel common ; - back to bank common
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
305 movff char_O_depth_sim,lo ; - get the depth reached (in meters)
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
306 WIN_SMALL .75,.150 ; - set output position
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
307 output_8 ; - print depth reached (in meters)
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
308 STRCAT " m" ; - print unit (meters)
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
309 btg decoplan_toggleflag ; - toggle the toggle flag
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
310 btfsc decoplan_toggleflag ; - toggle flag set?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
311 bra deco_calculate_loop_1 ; YES - print ". "
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
312 STRCAT_PRINT " ." ; NO - print " ."
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
313 bra deco_calculate_loop_2 ;
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
314 deco_calculate_loop_1: ;
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
315 STRCAT_PRINT ". " ;
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
316 deco_calculate_loop_2: ;
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
317 movff char_O_deco_status,lo ; - get deco calculation status
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
318 btfss lo,DECO_COMPLETED_NORM ; - deco calculation completed?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
319 bra deco_calculate_loop ; NO - loop
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
320 movff char_O_deco_warnings,decoplan_warnings; YES - copy warnings for later display
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
321 bra deco_calculate_finish ; - do some clean-up and return
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
322 deco_calculate_abort:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
323 bcf switch_left ; clear button event
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
324 bsf decoplan_abort ; set abort flag
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
325 deco_calculate_finish:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
326 goto request_speed_normal ; request switch back to normal speed and return to deco calculator main function
0
heinrichsweikamp
parents:
diff changeset
327
heinrichsweikamp
parents:
diff changeset
328
heinrichsweikamp
parents:
diff changeset
329 ;-----------------------------------------------------------------------------
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
330 ; Draw a stop of the deco plan (simulator or dive)
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
331 ; Inputs: lo = depth
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
332 ; hi = minutes
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
333 ; win_top = line to draw on screen.
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
334 ;
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
335 ; Trashed: hi, lo,
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
336 ; win_height, win_leftx2, win_width, win_color*,
0
heinrichsweikamp
parents:
diff changeset
337 ; WREG, PROD, TBLPTR TABLAT.
heinrichsweikamp
parents:
diff changeset
338 ;
heinrichsweikamp
parents:
diff changeset
339 deco_plan_show_stop:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
340 ; print depth
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
341 lfsr FSR2,char_O_deco_gas ; needed to be initialized here every time because...
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
342 movf decoplan_gindex,W ; ...FSR2 is also used for string operations
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
343 movff PLUSW2,WREG ; get current gas and copy it to WREG for color-coding
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
344 call TFT_color_code_gas ; set output color dependent on gas (1-5)
0
heinrichsweikamp
parents:
diff changeset
345
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
346 lfsr FSR2,buffer ; set up output buffer
0
heinrichsweikamp
parents:
diff changeset
347
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
348 TSTOSS opt_units ; 0=Meter, 1=Feet
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
349 bra deco_plan_show_nstd_stop_metric ; 0 - do metric
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
350 ; 1 - do imperial
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
351 movff hi,ul ; back-up hi (minutes)
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 598
diff changeset
352 WIN_LEFT .80
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
353 call convert_meter_to_feet ; convert value in lo from meters to feet
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
354 output_16_3 ; limit output to 0...999
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 598
diff changeset
355 STRCAT_PRINT "ft"
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
356 movff ul,hi ; restore hi (minutes)
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
357 bra deco_plan_show_nstd_stop_common
0
heinrichsweikamp
parents:
diff changeset
358
heinrichsweikamp
parents:
diff changeset
359 deco_plan_show_nstd_stop_metric:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 598
diff changeset
360 WIN_LEFT .85
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
361 output_8 ; outputs into postinc2
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 598
diff changeset
362 STRCAT_PRINT "m"
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
363
0
heinrichsweikamp
parents:
diff changeset
364 deco_plan_show_nstd_stop_common:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
365
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
366 ; print duration
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
367 WIN_LEFT .135
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
368 lfsr FSR2,buffer
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
369 movff hi,lo
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
370 output_99dd ; stop entries are 99 minutes at max., prints double dots if duration is zero
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 598
diff changeset
371 STRCAT_PRINT "'"
0
heinrichsweikamp
parents:
diff changeset
372
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
373 ; draw the bar graph used for deco stops (lo = minutes)
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
374 incf win_top,F
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
375 movlw .19
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
376 movwf win_height
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
377 movlw .118
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
378 movwf win_leftx2 ; column left (0-159)
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
379 MOVLI .16,win_width ; column max width
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
380 incf lo,W ; add 1 for a minimum visible active bargraph area
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
381 movwf win_bargraph ; set width of the active bargraph area
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
382 call TFT_box ; draw bargraph
0
heinrichsweikamp
parents:
diff changeset
383
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
384 ; restore win_top
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
385 call TFT_standard_color
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
386 decf win_top,F ; restore win_top
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
387 return
0
heinrichsweikamp
parents:
diff changeset
388
heinrichsweikamp
parents:
diff changeset
389
heinrichsweikamp
parents:
diff changeset
390 ;-----------------------------------------------------------------------------
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
391 ; Display the deco plan (simulator)
0
heinrichsweikamp
parents:
diff changeset
392 ; Inputs: char_O_deco_table (array of stop times, in minutes)
heinrichsweikamp
parents:
diff changeset
393 ; decoplan_page = page number.
heinrichsweikamp
parents:
diff changeset
394 ;
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
395 deco_results_page:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
396 bcf win_invert ; reset invert flag
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
397 WIN_COLOR color_greenish
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
398 IFDEF _ccr_pscr
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
399 btfss bailout_mode ; bailout results?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
400 bra deco_results_page_1 ; NO
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
401 TEXT_SMALL .80,.1, tDiveBailout ; YES
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
402 bra deco_results_page_2
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
403 ENDIF
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
404 deco_results_page_1:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
405 TEXT_SMALL .80,.1, tDivePlan
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
406 deco_results_page_2:
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
407 movff char_O_deco_info,WREG ; get the deco info vector
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
408 btfsc WREG,deco_stops ; are there deco stops?
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
409 bra deco_plan_show_1 ; YES
0
heinrichsweikamp
parents:
diff changeset
410
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
411 ;---- no deco --------------------------------------------------------
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
412 call TFT_standard_color
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
413 TEXT_SMALL .80, .25, tNoDeco
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 598
diff changeset
414
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 598
diff changeset
415 ; output of remaining NDL time
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
416 WIN_SMALL .80, .50 ; same line as bottom time
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
417 PUTC "+"
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
418 movff char_O_NDL_norm,lo ; get NDL time in normal plan
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
419 bsf leftbind
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 598
diff changeset
420 output_8
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
421 bcf leftbind
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 598
diff changeset
422 PUTC "'"
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 598
diff changeset
423 PUTC " "
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
424 STRCAT_TEXT_PRINT tNDLleft ; "NDL"
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 598
diff changeset
425
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
426 bsf decoplan_last_stop_shown
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
427 return
0
heinrichsweikamp
parents:
diff changeset
428
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
429 ;---- deco stops ---------------------------------------------------------
0
heinrichsweikamp
parents:
diff changeset
430 deco_plan_show_1:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
431 lfsr FSR0,char_O_deco_depth ; initialize indexed addressing
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
432 lfsr FSR1,char_O_deco_time
0
heinrichsweikamp
parents:
diff changeset
433
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
434 clrf decoplan_index ; start with index = 0
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 598
diff changeset
435 movlw .24
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
436 movwf win_top ; and row = 0 at position 24
0
heinrichsweikamp
parents:
diff changeset
437
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
438 ; read stop parameters, indexed by decoplan_index and decoplan_page
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
439 movf decoplan_page,W ; decoplan_gindex = 6*decoplan_page + decoplan_index
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
440 mullw .8 ; 8 lines/page in deco plan
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
441 movf decoplan_index,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
442 addwf PRODL,W
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
443 movwf decoplan_gindex ; --> decoplan_gindex
0
heinrichsweikamp
parents:
diff changeset
444
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
445 bcf decoplan_last_stop_shown ; not done yet...
0
heinrichsweikamp
parents:
diff changeset
446
heinrichsweikamp
parents:
diff changeset
447 deco_plan_show_2:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
448 btfsc decoplan_gindex,5 ; reached table length (32) ?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
449 bra deco_plan_show_99 ; YES - done
0
heinrichsweikamp
parents:
diff changeset
450
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
451 ; read stop parameters, indexed by decoplan_index
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
452 movf decoplan_gindex,W ; index
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
453 movff PLUSW0,lo ; char_O_deco_depth[decoplan_gindex]
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
454 movff PLUSW1,hi ; char_O_deco_time [decoplan_gindex]
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
455 movf lo,W
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
456 bz deco_plan_show_99 ; depth == 0 -> done
0
heinrichsweikamp
parents:
diff changeset
457
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
458 ; display the stop line
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
459 rcall deco_plan_show_stop
0
heinrichsweikamp
parents:
diff changeset
460
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
461 ; next
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
462 movlw .24
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
463 addwf win_top,F ; row: += 24
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
464 incf decoplan_index,F ; local index += 1
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
465 incf decoplan_gindex,F ; global index += 1
0
heinrichsweikamp
parents:
diff changeset
466
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
467 ; max number of lines/page reached?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
468 movlw .8 ; 8 lines/page in deco plan
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
469 cpfseq decoplan_index
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
470 bra deco_plan_show_2 ; NO - loop
0
heinrichsweikamp
parents:
diff changeset
471
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
472 ; check if next stop is end-of-list?
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
473 movf decoplan_gindex,W
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
474 movf PLUSW0,W ; char_O_deco_depth[decoplan_gindex]
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
475 bz deco_plan_show_99 ; end of list
0
heinrichsweikamp
parents:
diff changeset
476
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
477 call TFT_standard_color
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
478 WIN_SMALL .135,.212
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
479 STRCAT_PRINT ">>>"
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
480 return
0
heinrichsweikamp
parents:
diff changeset
481
heinrichsweikamp
parents:
diff changeset
482 deco_plan_show_99:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
483 bsf decoplan_last_stop_shown ; nothing more in table to display
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
484 call TFT_standard_color
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
485 return
0
heinrichsweikamp
parents:
diff changeset
486
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
487 ;=============================================================================
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
488 ; Show Deco Calculation Results
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
489 ;
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
490 deco_results:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
491 call TFT_ClearScreen
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
492 call TFT_standard_color
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
493
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
494 ; print interval
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
495 WIN_SMALL .0,.25
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
496 STRCPY "Int. :"
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
497 movff opt_surface_interval,lo
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
498 output_8
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
499 STRCAT_PRINT "'"
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
500
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
501 ; print bottom time
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
502 WIN_SMALL .0,.50
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
503 STRCPY_TEXT tBtTm_short
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
504 movff char_I_bottom_time,lo
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
505 output_8
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
506 STRCAT_PRINT "'"
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
507
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
508 ; print bottom depth
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
509 WIN_SMALL .0,.75
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
510 STRCPY_TEXT tDepth
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
511 PUTC ":"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
512 movff char_I_bottom_depth,lo
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
513 output_8
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
514 STRCAT_PRINT "m"
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
515
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
516 ; print warnings or sat/dsat factors
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
517 WIN_SMALL .0,.105
208
53771bd3d567 NEW: Show plan parameters in decoplan result page
heinrichsweikamp
parents: 197
diff changeset
518
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
519 ; check for stop table overflow
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
520 btfss decoplan_warnings,deco_plan_incomplete ; check if deco plan is incomplete
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
521 bra deco_results_0a ; NO - skip
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
522
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
523 ; display overflow warning
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
524 call TFT_warning_color ; YES - show overflow warning
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
525 STRCAT_PRINT "incomplete" ; max 10 characters
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
526 bra deco_results_m1 ; skip displaying sat/dsat factors
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
527
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
528 deco_results_0a:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
529
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
530 IFDEF _helium
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
531 ; check for IBCD warning
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
532 btfss decoplan_warnings,IBCD_warning_lock ; check if we have a locked IBCD warning
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
533 bra deco_results_2b ; NO - skip
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
534
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
535 ; display IBCD warning
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
536 call TFT_attention_color ; YES - show IBCD warning
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
537 STRCAT_PRINT "IBCD!" ; max 10 characters
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
538 bra deco_results_m1 ; skip displaying sat/dsat factors
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
539 ENDIF
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
540
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
541 deco_results_2b:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
542
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
543 ; display Sat/Desat factors --> omitted if there were warnings
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
544 STRCAT_PRINT "SD:"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
545 WIN_SMALL .25,.105
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
546 movff char_I_saturation_multiplier,lo
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
547 output_8
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 598
diff changeset
548 STRCAT "/"
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
549 movff char_I_desaturation_multiplier,lo
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
550 output_8
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
551 STRCAT_PRINT ""
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
552
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
553 deco_results_m1:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
554
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
555 call TFT_standard_color ; clean-up from warnings
0
heinrichsweikamp
parents:
diff changeset
556
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
557 ; get model
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
558 movff char_I_deco_model,WREG ; 0: straight Buhlmann, 1: with GF
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
559 iorwf WREG ; GF factors in use?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
560 bz deco_results_m2 ; NO
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
561
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
562 ; display GF low/high factors
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
563 WIN_SMALL .0,.130
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
564 STRCAT_PRINT "GF:"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
565 WIN_SMALL .25,.130
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
566 movff char_I_GF_Low_percentage,lo
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 598
diff changeset
567 output_8
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
568 STRCAT "/"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
569 movff char_I_GF_High_percentage,lo
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 598
diff changeset
570 output_8
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
571 STRCAT_PRINT ""
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
572
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
573 deco_results_m2:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
574
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
575 ; display deco mode
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
576 WIN_SMALL .0,.155
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
577 lfsr FSR2,buffer
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
578 movff opt_dive_mode,lo ; 0=OC, 1=CC, 2=Gauge, 3=Apnea, 4=pSCR
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
579 call TFT_decotype_logbook
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
580
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
581 IFDEF _ccr_pscr
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
582 btfss FLAG_ccr_mode ; current dive mode = CCR ?
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
583 bra deco_results_2c ; NO - skip
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
584 WIN_SMALL .25,.155
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
585 STRCPY "SP:" ; output setpoint used for calculation
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
586 movff opt_sim_setpoint_number,lo
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
587 bsf leftbind
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
588 output_8
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
589 bcf leftbind
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
590 STRCAT_PRINT ""
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
591 ENDIF
0
heinrichsweikamp
parents:
diff changeset
592
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
593 deco_results_2c:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
594
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
595 btfss FLAG_oc_mode ; current dive mode = OC ?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
596 bra deco_results_2d ; NO - skip
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
597 TSTOSS opt_extended_stops ; YES - extended stops activated?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
598 bra deco_results_2d ; NO - skip
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
599 WIN_SMALL .18,.155 ; YES - set position
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
600 STRCAT_PRINT "ext.Stop" ; - print notice
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
601
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
602 deco_results_2d:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
603
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
604 ; display TTS result
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
605 WIN_SMALL .0,.180
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
606 STRCPY_TEXT tTTS
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
607 STRCAT ": "
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
608 MOVII int_O_TTS_norm,mpr
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
609 bsf leftbind
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
610 output_16
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
611 bcf leftbind
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
612 STRCAT_PRINT "'"
0
heinrichsweikamp
parents:
diff changeset
613
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
614 ; display CNS result
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
615 WIN_TOP .205
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
616 STRCPY_TEXT tCNS2 ; "CNS:"
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
617 MOVII real_CNS,mpr ; recall real CNS from before simulated dive
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 598
diff changeset
618 call TFT_color_code_cns ; color-code CNS output
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
619 bsf leftbind
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
620 output_16_3 ; limit to 999 and display only (0-999)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
621 bcf leftbind
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
622 STRCAT "%\x92" ; "->"
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
623 MOVII int_O_CNS_norm,mpr ; get CNS at end of simulated dive in normal plan
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 598
diff changeset
624 call TFT_color_code_cns ; color-code CNS output
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
625 bsf leftbind
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
626 output_16_3 ; limit to 999 and display only (0-999)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
627 bcf leftbind
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
628 STRCAT_PRINT "%"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
629 call TFT_standard_color
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
630
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
631 ; loop through deco plan pages
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
632 deco_results_1:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
633 clrf decoplan_page ; start from first page
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
634 bcf decoplan_pressures_shown ; when showing the gas needs, start with volumes (liter)
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
635 deco_results_1a:
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
636 WIN_BOX_BLACK .0, .239, .80, .159 ; clear the complete right part of the result column (top, bottom, left, right)
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
637 rcall deco_results_page ; show a results page
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
638 incf decoplan_page,F ; increment results page number
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
639 call reset_timeout_surfmode ; reset timeout
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
640 bcf switch_right ; clear left-over right button event
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
641 bcf switch_left ; clear left-over left button event
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
642 deco_results_2:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
643 btfsc switch_right ; right button pressed?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
644 bra deco_results_3 ; YES - show further results
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
645 btfsc switch_left ; left button pressed?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
646 return ; YES - return to deco calculator main function
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
647 call housekeeping ; NO to both - handle screen dump request, timeout and need to enter dive mode
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
648 btfsc divemode ; shall go into dive mode?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
649 bsf decoplan_abort ; YES - set abort flag
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
650 btfsc trigger_timeout ; timeout on any button press?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
651 bsf decoplan_abort ; YES - set abort flag
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
652 btfss decoplan_abort ; shall abort?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
653 bra deco_results_2 ; NO - loop
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
654 return ; YES
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
655
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
656 deco_results_3:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
657 btfss decoplan_last_stop_shown ; was the last stop shown already?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
658 bra deco_results_1a ; NO - loop
284
d1117b99fd99 preperations to compute gas consumtion in simulator
heinrichsweikamp
parents: 275
diff changeset
659
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
660 IFDEF _ccr_pscr
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
661 movff char_O_deco_status,WREG ; YES - get deco calculation status
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
662 btfss WREG,DECO_MODE_LOOP_FLAG ; - check if calculation was made for loop mode (CCR/pSCR)
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
663 bra deco_results_gas_volumes ; NO - normal OC mode or bailout mode, show gas needs
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
664 bsf bailout_mode ; YES - do a 2nd deco-plan in bailout mode
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
665 call deco_pull_tissues_from_vault ; - restore the status of the real tissues (C-code)
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
666 banksel common ; - back to bank common
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
667 rcall deco_calculate_redo ; - redo complete deco calculation
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
668 btfss decoplan_abort ; - was the calculation aborted?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
669 bra deco_results ; NO - redo display of deco stops
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
670 return ; YES - return to deco calculator main function
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
671 ENDIF
284
d1117b99fd99 preperations to compute gas consumtion in simulator
heinrichsweikamp
parents: 275
diff changeset
672
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
673 ;---- show the gas needs (OC and bailout only) ---------------------------
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
674 deco_results_gas_volumes:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
675 lfsr FSR0,int_O_gas_need_vol ; load base address of gas needs in volume
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
676
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
677 deco_results_gas_common:
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
678 WIN_BOX_BLACK .0, .239, .80, .159 ; clear the complete right part of the result column (top, bottom, left, right)
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
679 movlw .25 ; output row is 25 (fixed offset set here) + n*25 (line increment, see below)
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
680 movwf output_row ; set fixed vertical offset for output row
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 598
diff changeset
681 WIN_LEFT .80 ; set column
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
682 call TFT_standard_color
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
683 clrf gas_index ; initialize gas counter
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
684 bcf is_diluent_menu ; working on OC gases
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 598
diff changeset
685
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
686 deco_results_gas_loop:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
687 movff gas_index,PRODL ; copy gas index to PRODL (interface to gaslist_strcat_gas)
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
688 incf gas_index,F ; increment gas index
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
689
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
690 movf gas_index,W ; copy gas index to WREG for color-coding
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
691 call TFT_color_code_gas ; set output color according to gas (1-5)
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
692
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
693 lfsr FSR2,buffer ; load base address of output buffer
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
694 bsf short_gas_descriptions ; configure gaslist_strcat_gas output format
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
695 bsf divemode ; configure gaslist_strcat_gas output format
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
696 call gaslist_strcat_gas ; write "Nxlo", "Txlo/hi", "Air" or "O2" into output buffer
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
697 bcf divemode ; cleanup above
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
698
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
699 movlw .25 ; spacing between outputs
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
700 addwf output_row,F ; increase row position
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
701 movff output_row,win_top ; set row position
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
702
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
703 movff POSTINC0,lo ; read gas volume low byte
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
704 movff POSTINC0,hi ; high byte
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
705
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
706 bcf decoplan_overflow ; no overflow in gas needs by default
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
707
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
708 btfsc decoplan_pressures_shown ; results in bar?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
709 bra deco_results_gas_volumes_1 ; YES
284
d1117b99fd99 preperations to compute gas consumtion in simulator
heinrichsweikamp
parents: 275
diff changeset
710
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
711 ; output of gas needs in liter
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
712 movf lo,W ; check if hi:lo = 65535: copy low byte to WREG
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
713 andwf hi,W ; and do a bitwise AND with the high byte
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
714 incfsz WREG ; add 1, result zero now?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
715 bra deco_results_gas_volumes_2 ; NO - print volume
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
716 STRCAT_PRINT ">65500" ; YES - print ">65500"
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
717 bra deco_results_gas_volumes_3 ; - continue checking if all gases are shown
284
d1117b99fd99 preperations to compute gas consumtion in simulator
heinrichsweikamp
parents: 275
diff changeset
718
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
719 ; output of gas needs in bar
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
720 deco_results_gas_volumes_1:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
721 btfsc hi,int_high_flag ; overflow in result?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
722 bsf decoplan_overflow ; YES - remember it
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
723 bcf hi,int_high_flag ; clear flag for overflow in result
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
724 btfsc hi,int_warning_flag ; gas needs above available amount?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
725 bsf win_invert ; YES - print in inverse
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
726 bcf hi,int_warning_flag ; clear flag for gas needs above available amount
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
727 bcf hi,int_attention_flag ; clear flag for gas needs close to available amount
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
728 bcf hi,int_invalid_flag ; clear flag for invalid data
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
729 bcf hi,int_is_zero ; clear flag for zero
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
730
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
731 deco_results_gas_volumes_2:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
732 PUTC ":" ; print ":"
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
733 output_16 ; print 16 bit number
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
734 movlw '>' ; load coding of ">" sign into WREG
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
735 btfsc decoplan_overflow ; overflow in result?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
736 movff WREG,buffer+.7 ; YES - place ">" before number
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
737 STRCAT_PRINT "" ; finalize output
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
738 bcf win_invert ; back to none-inverse printing
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
739
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
740 deco_results_gas_volumes_3:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
741 movlw NUM_GAS ; 5 gases to show
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
742 cpfseq gas_index ; all gases shown?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
743 bra deco_results_gas_loop ; NO - loop
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
744
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
745 WIN_COLOR color_greenish ; set color
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
746 TEXT_SMALL .80,.01,tGasUsage ; "Gas Usage"
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
747
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
748 btfsc decoplan_pressures_shown ; results shown in bar?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
749 bra deco_results_gas_volumes_4 ; YES
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
750 TEXT_SMALL .120,.25,tLiterLong ; NO - in Liter then
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
751 bra deco_results_gas_volumes_5 ; - continue with initialization of housekeeping
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 598
diff changeset
752
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
753 deco_results_gas_volumes_4:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
754 TEXT_SMALL .120,.25,tbar ; " bar" (with leading space)
284
d1117b99fd99 preperations to compute gas consumtion in simulator
heinrichsweikamp
parents: 275
diff changeset
755
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
756 deco_results_gas_volumes_5:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
757 call TFT_standard_color ; revert to standard color
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
758 call reset_timeout_surfmode ; reset timeout
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
759 bcf switch_right ; clear left-over right button event
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
760 bcf switch_left ; clear left-over left button event
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
761 deco_results_gas_volumes_6:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
762 btfsc switch_right ; right button pressed?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
763 bra deco_results_gas_volumes_7 ; YES - show results in bar or restart with deco stops again
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
764 btfsc switch_left ; left button pressed?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
765 return ; YES - return to deco calculator main function
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
766 call housekeeping ; NO to both - handle screen dump request, timeout and need to enter dive mode
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
767 btfsc divemode ; shall go into dive mode?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
768 bsf decoplan_abort ; YES - set abort flag
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
769 btfsc trigger_timeout ; timeout on any button press?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
770 bsf decoplan_abort ; YES - set abort flag
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
771 btfss decoplan_abort ; shall abort?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
772 bra deco_results_gas_volumes_6 ; NO - loop
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
773 return ; YES
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
774
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
775 deco_results_gas_volumes_7:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
776 btfsc decoplan_pressures_shown ; results shown in bar?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
777 bra deco_results_1 ; YES - show deco stops again
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
778 bsf decoplan_pressures_shown ; NO - but now
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
779 lfsr FSR0,int_O_gas_need_pres ; - load base address of gas needs in bar
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
780 bra deco_results_gas_common ; - re-run gas needs output in pressure mode
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
781
0
heinrichsweikamp
parents:
diff changeset
782
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
783 END