annotate src/simulator.asm @ 622:02d1386429a6

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