annotate src/simulator.asm @ 627:bf5fee575701

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