annotate src/simulator.asm @ 565:0ba88db66492

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