annotate src/simulator.asm @ 588:bf0c76e9b01b

Sync safety stop countdown output
author heinrichsweikamp
date Sat, 10 Mar 2018 15:39:33 +0100 (2018-03-10)
parents b455b31ce022
children e1f0f5e3d4e4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
heinrichsweikamp
parents:
diff changeset
1 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
2 ;
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
3 ; File simulator.asm REFACTORED VERSION V2.98
0
heinrichsweikamp
parents:
diff changeset
4 ;
heinrichsweikamp
parents:
diff changeset
5 ; Decoplan interface to C model code.
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,...
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
17 #include "wait.inc" ; speed_*
0
heinrichsweikamp
parents:
diff changeset
18 #include "start.inc"
heinrichsweikamp
parents:
diff changeset
19 #include "divemode.inc"
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"
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
24 #include "isr.inc"
0
heinrichsweikamp
parents:
diff changeset
25
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
26 gui CODE
0
heinrichsweikamp
parents:
diff changeset
27
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
28 extern deco_clear_tissue
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
29 extern deco_push_tissues_to_vault
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
30 extern deco_calc_dive_interval
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
31 extern deco_calc_hauptroutine
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
32 extern deco_pull_tissues_from_vault
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
33 extern TFT_display_decotype_surface1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
34 extern get_first_dil_to_WREG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
35 extern get_first_gas_to_WREG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
36 extern setup_dil_registers
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
37 extern setup_gas_registers
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
38 extern deco_setup_cc_diluents
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
39 extern deco_setup_oc_gases
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
40 extern log_screendump_and_onesecond
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
41 extern logbook_preloop_tasks
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
42 extern do_return_demo_planner
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
43
0
heinrichsweikamp
parents:
diff changeset
44
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
45 ;---- Private local variables -------------------------------------------------
0
heinrichsweikamp
parents:
diff changeset
46
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
47 CBLOCK local1 ; max size is 16 Byte !!!
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
48 decoplan_index ; within each page
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
49 decoplan_gindex ; global index
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
50 decoplan_last ; Depth of last stop (CF#29)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
51 decoplan_flags ; Various private flags.
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
52 decoplan_page ; page number
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
53 decoplan_warnings ; deco engine warnings
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
54 gas_counter ; counter for looping through the gases
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
55 row_pos ; used for positioning of graphic elements
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
56 ENDC ; used: 8 byte, remaining: 8 byte
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
57
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
58 ;---- Defines ----------------------------------------------------------------
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
59
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
60 #define decoplan_last_ceiling_shown decoplan_flags,0
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
61 #define decoplan_abort decoplan_flags,1
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
62
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
63 ;---- Demo deco planner ------------------------------------------------------
0
heinrichsweikamp
parents:
diff changeset
64
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
65 global do_demo_planner
0
heinrichsweikamp
parents:
diff changeset
66 do_demo_planner:
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
67 btfsc FLAG_gauge_mode ; =1: In Gauge mode
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
68 goto do_return_demo_planner
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
69 btfsc FLAG_apnoe_mode ; =1: In Apnea mode
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
70 goto do_return_demo_planner
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
71 bcf decoplan_abort ; initialize (clear) abort flag
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
72 bcf is_bailout ; clear bailout condition (may have remained set from last invocation)
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
73 rcall deco_planer
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
74 btfss decoplan_abort ; skip recall deco_show_plan if calculations were aborted
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
75 rcall deco_show_plan
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
76 goto do_return_demo_planner
0
heinrichsweikamp
parents:
diff changeset
77
heinrichsweikamp
parents:
diff changeset
78
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
79 global deco_setup
0
heinrichsweikamp
parents:
diff changeset
80 deco_setup:
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
81 btfsc FLAG_ccr_mode
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
82 bra deco_setup_cc
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
83 btfsc FLAG_pscr_mode
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
84 bra deco_setup_cc
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
85 deco_setup_oc:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
86 call get_first_gas_to_WREG ; gets first gas (1-5) into WREG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
87 call setup_gas_registers ; with WREG=Gas 1-5
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
88 call deco_setup_oc_gases ; setup OC/Bailout Gases and configure for OC deco calculation
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
89 bra deco_setup_cont
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
90 deco_setup_cc:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
91 call get_first_dil_to_WREG ; gets first gas (1-5) into WREG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
92 call setup_dil_registers ; with WREG=Gas 1-5
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
93 call deco_setup_cc_diluents ; setup CCR/pSCR diluents and configure for CCR/pSCR deco calculation
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
94 deco_setup_cont:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
95 ; use ambient conditions for simulation
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
96 SAFE_2BYTE_COPY last_surfpressure_30min, int_I_pres_surface ; copy surface pressure to deco routine
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
97
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
98 movlw deco_distance
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
99 movff WREG,char_I_deco_distance
0
heinrichsweikamp
parents:
diff changeset
100
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
101 movff opt_last_stop,char_I_depth_last_deco
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
102 movff opt_GF_low,char_I_GF_Low_percentage
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
103 movff opt_GF_high,char_I_GF_High_percentage
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
104
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
105 ; overwrite GF if aGF is wanted
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
106 bsf use_agf
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
107 TSTOSS opt_sim_use_aGF
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
108 bcf use_agf
0
heinrichsweikamp
parents:
diff changeset
109
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
110 btfsc use_agf ; =1: Use aGF
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
111 movff opt_aGF_low,char_I_GF_Low_percentage
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
112 btfsc use_agf ; =1: Use aGF
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
113 movff opt_aGF_high,char_I_GF_High_percentage
0
heinrichsweikamp
parents:
diff changeset
114
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
115 bcf is_bailout
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
116
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
117 ; setup char_I_const_ppO2 for CC modes
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
118 clrf WREG
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
119 btfsc FLAG_pscr_mode
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
120 movff WREG,char_I_const_ppO2 ; configure pSCR computations to calculated ppO2
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
121 btfss FLAG_ccr_mode
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
122 return ; done if not in CCR mode
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
123 movff opt_sim_setpoint_number,WREG ; configure CCR computations to selected setpoint
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
124 decf WREG,W ; 1-5 -> 0-4
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
125 lfsr FSR1,char_I_setpoint_cbar ; load base address of setpoint list
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
126 movff PLUSW1,char_I_const_ppO2 ; setup setpoint
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
127 return
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
128
0
heinrichsweikamp
parents:
diff changeset
129 ;=============================================================================
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
130 ; Launch deco planning
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
131 ;
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
132 global deco_planer
0
heinrichsweikamp
parents:
diff changeset
133 deco_planer:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
134 call speed_fastest ; Quick !
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
135 call deco_push_tissues_to_vault ; C-code: back-up state of the real tissues
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
136 banksel common
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
137 rcall deco_setup ; Setup all model parameters.
0
heinrichsweikamp
parents:
diff changeset
138
heinrichsweikamp
parents:
diff changeset
139 ;---- Specific settings ------------------------------------------------------
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
140
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
141 ; configure the deco engine for normal plan, CNS & gas volume calculation and no delayed ascent
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
142 movff char_O_deco_status,WREG ; bank-safe copy
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
143 bcf WREG,DECO_PLAN_FLAG ; normal plan mode,
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
144 bsf WREG,DECO_CNS_FLAG ; enable CNS calculation (CNS at end of dive),
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
145 bsf WREG,DECO_VOLUME_FLAG ; enable gas volume calculation, and
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
146 bcf WREG,DECO_ASCENT_FLAG ; disable delayed ascent calculation
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
147 movff WREG,char_O_deco_status ; bank-safe copy back
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
148
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
149 ; configure the deco engine for total-dive gas volume calculation
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
150 movff char_O_main_status,WREG ; bank-safe copy
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
151 bsf WREG,DECO_BOTTOM_FLAG ; set bottom flag
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
152 movff WREG,char_O_main_status ; bank-safe copy back
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
153
295
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 294
diff changeset
154 deco_planer_redo:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
155 ; show deco calculation is in progress
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
156 call TFT_ClearScreen
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
157 WIN_COLOR color_greenish
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
158 TEXT_SMALL .20,.40, tCalculating
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
159 WIN_COLOR color_lightblue
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
160 WIN_SMALL .1,.215
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
161 STRCPY_TEXT_PRINT tAbort
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
162
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
163 ; configure the deco engine for restart:
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
164 movff char_O_deco_status,WREG ; bank-safe copy
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
165 bsf WREG,DECO_STATUS_0_FLAG ; configure init ...
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
166 bsf WREG,DECO_STATUS_1_FLAG ; ... state,
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
167 movff WREG,char_O_deco_status ; bank-safe copy back
0
heinrichsweikamp
parents:
diff changeset
168
heinrichsweikamp
parents:
diff changeset
169 ;---- Add delay at surface, if needed ----------------------------------------
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
170 banksel char_I_dive_interval
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
171 tstfsz char_I_dive_interval
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
172 call deco_calc_dive_interval
0
heinrichsweikamp
parents:
diff changeset
173
heinrichsweikamp
parents:
diff changeset
174 ;---- Dive loop --------------------------------------------------------------
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
175 ; Compute dive ambient conditions
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
176 banksel char_I_bottom_depth
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
177 movf char_I_bottom_depth,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
178 mullw .100
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
179 movlw LOW(.1000)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
180 addwf PRODL,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
181 movwf int_I_pres_respiration+0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
182 movlw HIGH(.1000)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
183 addwfc PRODH,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
184 movwf int_I_pres_respiration+1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
185 banksel common
0
heinrichsweikamp
parents:
diff changeset
186
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
187 movff char_I_bottom_time,char_I_sim_advance_time
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
188
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
189 clrf TMR5L
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
190 clrf TMR5H ; 30,51757813µs/bit in TMR5L:TMR5H
0
heinrichsweikamp
parents:
diff changeset
191
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
192 call deco_calc_hauptroutine ; C-code: initialization + complete bottom time part
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
193 banksel common
0
heinrichsweikamp
parents:
diff changeset
194
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
195 ;---- BAILOUT: Switch to OC gases for ascent cycles --------------------------
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
196 btfss is_bailout ; Doing a bailout deco plan ?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
197 bra deco_planer_finishing ; NO - keep gases
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
198 ; YES - switch to OC gas
111
c61b7a4e317c Bugfix: CNS in planner
heinrichsweikamp
parents: 97
diff changeset
199
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
200 ; reconfigure the deco engine for delayed ascent mode
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
201 movff char_O_deco_status,lo ; bank-safe copy
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
202 bsf lo,DECO_ASCENT_FLAG ; set flag for delayed ascent calculation
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
203 movff lo,char_O_deco_status ; bank-safe copy back
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
204
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
205 ; configure the deco engine for delayed ascent part gas volume calculation
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
206 movff char_O_main_status,WREG ; bank-safe copy
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
207 bcf WREG,DECO_BOTTOM_FLAG ; set bottom flag
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
208 movff WREG,char_O_main_status ; bank-safe copy back
0
heinrichsweikamp
parents:
diff changeset
209
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
210 ; reconfigure gas settings to OC gases
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
211 call get_first_gas_to_WREG ; get first gas (1-5) into WREG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
212 call setup_gas_registers ; With WREG=Gas 1-5 (or 6, not applicable here)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
213 call deco_setup_oc_gases ; With WREG=Gas 1-5 (or 6, not applicable here)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
214
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
215 ; set the gas change override flag to allow gas changes before deco stops as done in alternative plan
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
216 movff char_O_main_status,lo ; bank-safe copy
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
217 bsf lo,DECO_GASCHANGE_OVRD ; set flag for gas change override
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
218 movff lo,char_O_main_status ; bank-safe copy back
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
219
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
220 ;---- Wait until status reaches zero -------------------------------------------
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
221 deco_planer_finishing:
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
222 call deco_calc_hauptroutine ; C-code: Simulate more dive time to trigger the deco calculations
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
223 banksel common
0
heinrichsweikamp
parents:
diff changeset
224
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
225 btfss switch_left ; check if left button was pressed
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
226 bra deco_planer_finishing_1 ; NO - continue calculations
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
227 bsf decoplan_abort ; YES - set abort flag so that deco_show_plan will not be called
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
228 bra deco_planer_finishing_2 ; do some clean-up and return
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
229 deco_planer_finishing_1:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
230 movff char_O_deco_status,lo ; working copy of char_O_deco_status in bank common
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
231 movlw DECO_STATUS_MASK ; bit mask for deco status bit set
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
232 andwf lo,W ; mask out bits showing state of computation
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
233 tstfsz WREG ; check if a compute cycle is finished (bits 1 and 0 == 0)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
234 bra deco_planer_finishing ; NO - needs more computation cycles
295
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 294
diff changeset
235
296
af13a18a233b Slight more efficient bail deco, Test with 2 bail tanks.
jDG
parents: 295
diff changeset
236 ;---- Done: add CNS from decoplan, and restore tissues
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
237 deco_planer_finishing_2:
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
238 movff char_O_deco_warnings,decoplan_warnings ; copy warnings
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
239
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
240 call deco_pull_tissues_from_vault ; C-code: restore status of the real tissues
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
241 banksel common ; back to bank 1
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
242
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
243 movlw b'00111000' ; 1:8 Prescaler -> 65,536ms@16MHz
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
244 movwf T3CON
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
245 goto speed_normal ; (and return)
0
heinrichsweikamp
parents:
diff changeset
246
heinrichsweikamp
parents:
diff changeset
247 ;-----------------------------------------------------------------------------
heinrichsweikamp
parents:
diff changeset
248 ; Draw a stop of the deco plan (simulator or dive).
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
249 ; Inputs: lo = depth
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
250 ; hi = minutes
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
251 ; win_top = line to draw on screen.
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
252 ;
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
253 ; Trashed: hi, lo,
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
254 ; win_height, win_leftx2, win_width, win_color*,
0
heinrichsweikamp
parents:
diff changeset
255 ; WREG, PROD, TBLPTR TABLAT.
heinrichsweikamp
parents:
diff changeset
256 ;
heinrichsweikamp
parents:
diff changeset
257 deco_plan_show_stop:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
258 ;---- Print depth ----------------------------------------------------
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
259 lfsr FSR2,char_O_deco_gas ; needed to be initialized here every time because...
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
260 movf decoplan_gindex,W ; ...FSR2 is also used for string operations
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
261 movff PLUSW2,WREG ; get current gas and copy it to WREG for color-coding
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
262 call TFT_color_code_gas ; set output color dependent on gas (1-5)
0
heinrichsweikamp
parents:
diff changeset
263
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
264 lfsr FSR2,buffer
0
heinrichsweikamp
parents:
diff changeset
265
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
266 TSTOSS opt_units ; 0=Meters, 1=Feets
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
267 bra deco_plan_show_nstd_stop_metric
0
heinrichsweikamp
parents:
diff changeset
268
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
269 WIN_LEFT .85
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
270 movf lo,W ; lo = m
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
271 mullw .100 ; PRODL:PRODH = mbar
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
272 movff PRODL,lo
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
273 movff PRODH,hi
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
274 ; Convert with 334feet/100m to have 10ft, 20ft, 30ft stops...
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
275 movff lo,xA+0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
276 movff hi,xA+1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
277 movlw LOW d'334' ; 334feet/100m
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
278 movwf xB+0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
279 movlw HIGH d'334'
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
280 movwf xB+1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
281 call mult16x16 ; xA*xB=xC (lo:hi * 328)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
282 movlw d'50' ; round up
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
283 addwf xC+0,F
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
284 movlw .0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
285 addwfc xC+1,F
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
286 addwfc xC+2,F
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
287 addwfc xC+3,F
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
288 movlw d'100'
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
289 movwf xB+0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
290 clrf xB+1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
291 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
292 movff xC+0,lo
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
293 movff xC+1,hi ; restore lo and hi with updated value
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
294 bsf leftbind
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
295 bsf ignore_digit4 ; Only full feet
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
296 output_16
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
297 bcf leftbind
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
298 STRCAT_PRINT "ft "
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
299 bra deco_plan_show_nstd_stop_common
0
heinrichsweikamp
parents:
diff changeset
300
heinrichsweikamp
parents:
diff changeset
301 deco_plan_show_nstd_stop_metric:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
302 WIN_LEFT .90
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
303 bsf leftbind
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
304 output_8 ; outputs into Postinc2!
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
305 bcf leftbind
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
306 STRCAT_PRINT "m "
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
307
0
heinrichsweikamp
parents:
diff changeset
308 deco_plan_show_nstd_stop_common:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
309 ;---- Print duration -------------------------------------------------
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
310 WIN_LEFT .135
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
311 lfsr FSR2,buffer
0
heinrichsweikamp
parents:
diff changeset
312
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
313 movf lo,W ; Swap hi & lo
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
314 movff hi,lo
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
315 movwf hi
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
316
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
317 output_8 ; Allow up to 240'
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
318 clrf WREG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
319 movff WREG,buffer+.3 ; limit to 2 chars
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
320 STRCAT_PRINT ""
0
heinrichsweikamp
parents:
diff changeset
321
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
322 movf lo,W ; Swap back hi & lo
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
323 movff hi,lo
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
324 movwf hi
0
heinrichsweikamp
parents:
diff changeset
325
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
326 ;---------------------------------------------------------------------
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
327 ; Draw the bar graph used for deco stops (deco plan in simulator or dive).
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
328 incf win_top,F
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
329 movlw .19
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
330 movwf win_height
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
331 movlw .118
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
332 movwf win_leftx2 ; column left (0-159)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
333 movlw .16
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
334 movwf win_width+0 ; column max width.
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
335 clrf win_width+1
0
heinrichsweikamp
parents:
diff changeset
336
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
337 ; Draw used area (hi = minutes):
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
338 movlw .16 ; Limit length (16min)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
339 cpfslt hi
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
340 movwf hi
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
341 movff hi,win_bargraph ; Active width, the rest is cleared.
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
342 call TFT_box
0
heinrichsweikamp
parents:
diff changeset
343
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
344 ; Restore win_top
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
345 call TFT_standard_color
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
346 decf win_top,F ; Restore win_top
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
347 return
0
heinrichsweikamp
parents:
diff changeset
348
heinrichsweikamp
parents:
diff changeset
349 ;-----------------------------------------------------------------------------
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
350 ; Clear unused area below last stop
0
heinrichsweikamp
parents:
diff changeset
351 ; Inputs: win_top : last used area...
heinrichsweikamp
parents:
diff changeset
352 deco_plan_show_clear_bottom:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
353 movf win_top,W ; Get back from bank0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
354 sublw .239 ; No: bottom row in planning
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
355 movwf win_height
0
heinrichsweikamp
parents:
diff changeset
356
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
357 WIN_LEFT .85 ; Full dive menu width
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
358 movlw .159-.85+.1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
359 movwf win_width+0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
360 clrf win_width+1
0
heinrichsweikamp
parents:
diff changeset
361
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
362 clrf win_color1 ; Fill with black
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
363 clrf win_color2
0
heinrichsweikamp
parents:
diff changeset
364
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
365 goto TFT_box ; and return
0
heinrichsweikamp
parents:
diff changeset
366
heinrichsweikamp
parents:
diff changeset
367 ;-----------------------------------------------------------------------------
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
368 ; Display the deco plan (simulator).
0
heinrichsweikamp
parents:
diff changeset
369 ; Inputs: char_O_deco_table (array of stop times, in minutes)
heinrichsweikamp
parents:
diff changeset
370 ; decoplan_page = page number.
heinrichsweikamp
parents:
diff changeset
371 ;
heinrichsweikamp
parents:
diff changeset
372 deco_show_plan_page:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
373 bcf win_invert ; Reset invert flag
0
heinrichsweikamp
parents:
diff changeset
374
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
375 ;---- Is there deco stops ? ------------------------------------------
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
376 movff char_O_first_deco_depth,WREG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
377 iorwf WREG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
378 bnz deco_plan_show_1
0
heinrichsweikamp
parents:
diff changeset
379
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
380 ;---- No Deco --------------------------------------------------------
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
381 call TFT_standard_color
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
382 TEXT_SMALL .80, .0, tNoDeco
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
383 bsf decoplan_last_ceiling_shown
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
384 return
0
heinrichsweikamp
parents:
diff changeset
385
heinrichsweikamp
parents:
diff changeset
386 deco_plan_show_1:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
387 lfsr FSR0,char_O_deco_depth ; Initialize indexed addressing.
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
388 lfsr FSR1,char_O_deco_time
0
heinrichsweikamp
parents:
diff changeset
389
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
390 clrf decoplan_index ; Start with index = 0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
391 clrf win_top ; and row = 0
0
heinrichsweikamp
parents:
diff changeset
392
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
393 ; Read stop parameters, indexed by decoplan_index and decoplan_page
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
394 movf decoplan_page,W ; decoplan_gindex = 6*decoplan_page + decoplan_index
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
395 mullw .8 ; 8 lines/page in deco plan
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
396 movf decoplan_index,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
397 addwf PRODL,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
398 movwf decoplan_gindex ; --> decoplan_gindex
0
heinrichsweikamp
parents:
diff changeset
399
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
400 bcf decoplan_last_ceiling_shown ; Not finished yet...
0
heinrichsweikamp
parents:
diff changeset
401
heinrichsweikamp
parents:
diff changeset
402 deco_plan_show_2:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
403 btfsc decoplan_gindex,5 ; Reached table length (32) ?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
404 bra deco_plan_show_99 ; YES: finished...
0
heinrichsweikamp
parents:
diff changeset
405
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
406 ; Read stop parameters, indexed by decoplan_index
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
407 movf decoplan_gindex,W ; index
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
408 movff PLUSW0,lo ; char_O_deco_depth[gindex]
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
409 movff PLUSW1,hi ; char_O_deco_time [gindex]
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
410 movf lo,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
411 bz deco_plan_show_99 ; depth == 0 : finished.
0
heinrichsweikamp
parents:
diff changeset
412
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
413 ; Display the stop line
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
414 rcall deco_plan_show_stop
0
heinrichsweikamp
parents:
diff changeset
415
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
416 ; Next
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
417 movlw .24
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
418 addwf win_top,F ; row: += 24
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
419 incf decoplan_index,F ; local index += 1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
420 incf decoplan_gindex,F ; global index += 1
0
heinrichsweikamp
parents:
diff changeset
421
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
422 ; Max number of lines/page reached ?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
423 movlw .8 ; 8 lines/page in deco plan
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
424 cpfseq decoplan_index
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
425 bra deco_plan_show_2 ; NO: loop
0
heinrichsweikamp
parents:
diff changeset
426
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
427 ; Check if next stop is end-of-list ?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
428 movf decoplan_gindex,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
429 movf PLUSW0,W ; char_O_deco_depth[gindex]
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
430 bz deco_plan_show_99 ; End of list...
0
heinrichsweikamp
parents:
diff changeset
431
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
432 ; Display the message "more..."
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
433 rcall deco_plan_show_clear_bottom ; Clear from next line
0
heinrichsweikamp
parents:
diff changeset
434
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
435 call TFT_standard_color
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
436 TEXT_SMALL .88, .220, tMore
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
437 return
0
heinrichsweikamp
parents:
diff changeset
438
heinrichsweikamp
parents:
diff changeset
439 deco_plan_show_99:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
440 bsf decoplan_last_ceiling_shown ; Nothing more in table to display.
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
441 rcall deco_plan_show_clear_bottom ; Clear from next line
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
442 return
0
heinrichsweikamp
parents:
diff changeset
443
heinrichsweikamp
parents:
diff changeset
444 ;-----------------------------------------------------------------------------
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
445 ; Loop to show all pages of the deco plan (surface mode)
0
heinrichsweikamp
parents:
diff changeset
446
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
447 global deco_show_plan
0
heinrichsweikamp
parents:
diff changeset
448 deco_show_plan:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
449 clrf decoplan_page
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
450 call TFT_ClearScreen
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
451 WIN_COLOR color_greenish
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
452 btfsc is_bailout
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
453 bra deco_show_plan_bail_title
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
454 TEXT_SMALL .1,.1, tDivePlan
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
455 bra deco_show_plan2
462
1eeafeeb9287 CHANGE: Indicate "Bailout" for bailout deco plan in internal deco planer
heinrichsweikamp
parents: 432
diff changeset
456 deco_show_plan_bail_title:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
457 TEXT_SMALL .1,.1, tDiveBailout
462
1eeafeeb9287 CHANGE: Indicate "Bailout" for bailout deco plan in internal deco planer
heinrichsweikamp
parents: 432
diff changeset
458 deco_show_plan2:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
459 call TFT_standard_color
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
460 ;---- Display Plan Parameters
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
461 WIN_SMALL .0,.25
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
462 STRCPY "Int:"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
463 movff char_I_dive_interval,lo
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
464 bsf leftbind
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
465 output_8
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
466 bcf leftbind
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
467 STRCAT_PRINT "'"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
468 WIN_SMALL .0,.50
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
469 STRCPY_TEXT tBtTm_short
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
470 movff char_I_bottom_time,lo
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
471 bsf leftbind
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
472 output_8
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
473 bcf leftbind
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
474 STRCAT_PRINT "'"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
475 WIN_SMALL .0,.75
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
476 STRCPY_TEXT tDepth
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
477 PUTC ":"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
478 movff char_I_bottom_depth,lo
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
479 bsf leftbind
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
480 output_8
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
481 bcf leftbind
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
482 STRCAT_PRINT "m"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
483 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
484
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
485 ;---- Check for Stop Table Overflow
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
486 btfss decoplan_warnings,stoptable_overflow ; check if we have a overflow warning
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
487 bra deco_show_plan2a ; NO - skip
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
488 ;---- Display Overflow warning
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
489 call TFT_warnings_color ; YES - show overflow warning
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
490 STRCAT_PRINT "incomplete" ; max 10 characters
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
491 bra deco_show_plan_m1 ; skip displaying sat/dsat factors
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
492
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
493 deco_show_plan2a:
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
494 ;---- Check for IBCD Warning
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
495 btfss decoplan_warnings,IBCD_warning_lock ; check if we have a locked IBCD warning
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
496 bra deco_show_plan2b ; NO - skip
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
497 ;---- Display IBCD warning
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
498 call TFT_attention_color ; YES - show IBCD warning
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
499 STRCAT_PRINT "IBCD!" ; max 10 characters
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
500 bra deco_show_plan_m1 ; skip displaying sat/dsat factors
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
501
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
502 deco_show_plan2b:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
503 ;---- Display Sat/Desat Factors --> omitted if there were warnings
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
504 STRCAT_PRINT "SD:"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
505 WIN_SMALL .25,.105
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
506 movff char_I_saturation_multiplier,lo
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
507 output_8
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
508 STRCAT "/"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
509 movff char_I_desaturation_multiplier,lo
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
510 output_8
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
511 STRCAT_PRINT ""
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
512
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
513 deco_show_plan_m1:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
514 call TFT_standard_color ; clean-up from warnings
0
heinrichsweikamp
parents:
diff changeset
515
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
516 ;---- Get Model
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
517 movff char_I_deco_model,WREG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
518 iorwf WREG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
519 bz deco_show_plan_m2
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
520
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
521 ;---- Display GF low/high values
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
522 WIN_SMALL .0,.130
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
523 STRCAT_PRINT "GF:"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
524 WIN_SMALL .25,.130
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
525 movff char_I_GF_Low_percentage,lo
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
526 output_99x
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
527 STRCAT "/"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
528 movff char_I_GF_High_percentage,lo
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
529 output_99x
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
530 STRCAT_PRINT ""
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
531
208
53771bd3d567 NEW: Show plan parameters in decoplan result page
heinrichsweikamp
parents: 197
diff changeset
532 deco_show_plan_m2:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
533 ;---- Display Deco Mode
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
534 WIN_SMALL .0,.155
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
535 lfsr FSR2,buffer
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
536 movff opt_dive_mode,lo ; 0=OC, 1=CC, 2=Gauge, 3=Apnea, 4=PSCR
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
537 call TFT_display_decotype_surface1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
538 btfss FLAG_ccr_mode ; current dive mode = CCR ?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
539 bra deco_show_plan2c ; NO - branch
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
540 WIN_SMALL .25,.155
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
541 STRCPY "SP:" ; output setpoint used for calculation
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
542 movff opt_sim_setpoint_number,lo
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
543 bsf leftbind
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
544 output_8
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
545 bcf leftbind
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
546 STRCAT_PRINT ""
0
heinrichsweikamp
parents:
diff changeset
547
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
548 deco_show_plan2c:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
549 ;---- Display TTS result
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
550 WIN_SMALL .0,.180
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
551 STRCPY_TEXT tTTS
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
552 STRCAT ": "
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
553 movff int_O_ascenttime+0,lo
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
554 movff int_O_ascenttime+1,hi
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
555 bsf leftbind
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
556 output_16
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
557 bcf leftbind
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
558 STRCAT_PRINT "'"
0
heinrichsweikamp
parents:
diff changeset
559
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
560 ;---- Display CNS result
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
561 WIN_TOP .205
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
562 STRCPY_TEXT tCNS2 ; "CNS:"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
563 movff int_O_CNS_fraction+0,lo
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
564 movff int_O_CNS_fraction+1,hi
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
565 call TFT_color_code_cns ; Color-code CNS output
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
566 bsf leftbind
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
567 output_16_3 ; limit to 999 and display only (0-999)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
568 bcf leftbind
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
569 STRCAT "%\x92" ; "->"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
570 movff int_O_normal_CNS_fraction+0,lo
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
571 movff int_O_normal_CNS_fraction+1,hi
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
572 call TFT_color_code_cns ; Color-code CNS output
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
573 bsf leftbind
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
574 output_16_3 ; limit to 999 and display only (0-999)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
575 bcf leftbind
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
576 STRCAT_PRINT "%"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
577 call TFT_standard_color
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
578
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
579 ;---- Loop through pages
0
heinrichsweikamp
parents:
diff changeset
580 deco_show_plan_1:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
581 ; Clear the complete stop result column:
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
582 WIN_BOX_BLACK .0, .239, .80, .159 ; top, bottom, left, right
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
583
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
584 rcall deco_show_plan_page
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
585 incf decoplan_page,F
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
586 call logbook_preloop_tasks
0
heinrichsweikamp
parents:
diff changeset
587 deco_show_plan_2:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
588 btfsc switch_right
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
589 bra deco_show_plan_3
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
590 btfsc switch_left
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
591 return ; Return to simulator menu
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
592 call log_screendump_and_onesecond ; Check if we need to make a screen shot and check for new second
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
593 btfsc sleepmode ; Timeout?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
594 goto restart
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
595 bra deco_show_plan_2
0
heinrichsweikamp
parents:
diff changeset
596
heinrichsweikamp
parents:
diff changeset
597 deco_show_plan_3:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
598 btfss decoplan_last_ceiling_shown
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
599 bra deco_show_plan_1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
600 ; All stops shown
295
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 294
diff changeset
601
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
602 ;---- In CCR and pSCR mode, compute a BAILOUT deco plan -----------------------
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
603 movff char_O_deco_status,WREG ; get deco calculation status
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
604 btfss WREG,DECO_MODE_LOOP_FLAG ; check if in CCR or pSCR mode
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
605 bra simulator_show_decoplan5_0 ; NO - normal OC mode: just display
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
606 bsf is_bailout ; YES - redo 2nd deco-plan in bailout mode
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
607 rcall deco_planer_redo ; redo plan computation
295
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 294
diff changeset
608
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
609 btfss decoplan_abort ; shall we abort?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
610 bra deco_show_plan ; NO - display bailout stops
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
611 return ; YES
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
612
295
7027d735ac62 NEW CCR decoplan: 2nd pass to display bailout stops and gas volumes
jDG
parents: 294
diff changeset
613
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
614 ;---- In OC+BAIL modes, show the gas usage special page -----------------------
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
615 simulator_show_decoplan5_0:
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
616 ; Clear the complete stop result column:
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
617 WIN_BOX_BLACK .0, .239, .80, .159 ; top, bottom, left, right
284
d1117b99fd99 preperations to compute gas consumtion in simulator
heinrichsweikamp
parents: 275
diff changeset
618
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
619 movlw .25
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
620 movwf row_pos ; Row for gas list is .25+.25
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
621 clrf gas_counter ; Gas counter
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
622 lfsr FSR0,int_O_gas_volumes ; Initialize indexed addressing.
284
d1117b99fd99 preperations to compute gas consumtion in simulator
heinrichsweikamp
parents: 275
diff changeset
623
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
624 WIN_LEFT .80 ; Set column
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
625 call TFT_standard_color
284
d1117b99fd99 preperations to compute gas consumtion in simulator
heinrichsweikamp
parents: 275
diff changeset
626
d1117b99fd99 preperations to compute gas consumtion in simulator
heinrichsweikamp
parents: 275
diff changeset
627 simulator_show_decoplan5_loop:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
628 movff gas_counter,PRODL ; Copy to PRODL first
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
629 incf gas_counter,F ; Increment gas #
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
630
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
631 movff gas_counter,WREG ; copy current gas to WREG for color-coding
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
632 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
633
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
634 lfsr FSR2,buffer
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
635 bsf short_gas_decriptions
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
636 bsf divemode ; Tweak "customview_show_mix:"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
637 call gaslist_strcat_gas ; Input: PRODL : gas number (0..4), Output: "Nxlo", "Txlo/hi", "Air" or "O2" into Postinc2
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
638 bcf divemode ; Tweak "customview_show_mix:"
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
639
284
d1117b99fd99 preperations to compute gas consumtion in simulator
heinrichsweikamp
parents: 275
diff changeset
640 movlw .25
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
641 addwf row_pos,F ; Increase row position
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
642 movff row_pos,win_top ; Set Row
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
643
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
644 movff POSTINC0,lo ; Read (16bit) result, low first,
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
645 movff POSTINC0,hi ; then high.
284
d1117b99fd99 preperations to compute gas consumtion in simulator
heinrichsweikamp
parents: 275
diff changeset
646
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
647 movf lo,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
648 andwf hi,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
649 incf WREG ; > 65535?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
650 bnz simulator_show_decoplan5_1 ; NO
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
651 STRCAT_PRINT ">65500" ; YES
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
652 bra simulator_show_decoplan5_2
284
d1117b99fd99 preperations to compute gas consumtion in simulator
heinrichsweikamp
parents: 275
diff changeset
653
d1117b99fd99 preperations to compute gas consumtion in simulator
heinrichsweikamp
parents: 275
diff changeset
654 simulator_show_decoplan5_1:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
655 PUTC ":"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
656 bsf leftbind
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
657 output_16 ; No decimal anymore.
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
658 bcf leftbind
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
659 STRCAT_PRINT ""
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
660
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
661 ; Loop for all 5 gas
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
662 simulator_show_decoplan5_2:
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
663 movlw d'5' ; list all five gases
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
664 cpfseq gas_counter ; All gases shown?
284
d1117b99fd99 preperations to compute gas consumtion in simulator
heinrichsweikamp
parents: 275
diff changeset
665 bra simulator_show_decoplan5_loop ; No
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
666
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
667 WIN_COLOR color_greenish
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
668
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
669 movlw .30
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
670 addwf row_pos,F ; Increase row position
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
671 movff row_pos,win_top ; Set Row
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
672 STRCPY_TEXT_PRINT tBarLiter ; "Bar Liter"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
673
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
674 WIN_SMALL .80,.25
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
675 STRCPY_TEXT tGasUsage ; "Gas Usage"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
676 STRCAT_PRINT ":"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
677
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
678 call TFT_standard_color
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
679 call logbook_preloop_tasks
284
d1117b99fd99 preperations to compute gas consumtion in simulator
heinrichsweikamp
parents: 275
diff changeset
680
d1117b99fd99 preperations to compute gas consumtion in simulator
heinrichsweikamp
parents: 275
diff changeset
681 simulator_show_decoplan5_3:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
682 btfss switch_right
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
683 bra simulator_show_decoplan5_3a
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
684 bcf switch_right
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
685 clrf decoplan_page
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
686 bra deco_show_plan_1 ; toggle between stops plan and gas usage
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
687 simulator_show_decoplan5_3a:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
688 btfss switch_left
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
689 bra simulator_show_decoplan5_4
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
690 bcf is_bailout ; Back to normal
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
691 bcf ccr_diluent_setup ; init for OC/Bailout
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
692 return ; Return to simulator menu
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
693
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
694 simulator_show_decoplan5_4:
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
695 call log_screendump_and_onesecond ; Check if we need to make a screen shot and check for new second
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
696 btfsc sleepmode ; Timeout?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
697 goto restart
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
698 bra simulator_show_decoplan5_3
0
heinrichsweikamp
parents:
diff changeset
699
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
700 END