annotate src/gaslist.asm @ 632:0347acdf6d8e

changelog updates
author heinrichsweikamp
date Sat, 29 Feb 2020 16:57:45 +0100
parents 185ba2f91f59
children 4050675965ea
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
heinrichsweikamp
parents:
diff changeset
1 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
2 ;
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
3 ; File gaslist.asm combined next generation V3.08.8
0
heinrichsweikamp
parents:
diff changeset
4 ;
275
653a3ab08062 rename into hwOS
heinrichsweikamp
parents: 225
diff changeset
5 ; Managing OSTC gas list
0
heinrichsweikamp
parents:
diff changeset
6 ;
heinrichsweikamp
parents:
diff changeset
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
heinrichsweikamp
parents:
diff changeset
8 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
9 ; HISTORY
heinrichsweikamp
parents:
diff changeset
10 ; 2011-08-11 : [jDG] Creation.
heinrichsweikamp
parents:
diff changeset
11
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
12 #include "hwos.inc" ; mandatory header
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
13 #include "convert.inc"
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
14 #include "math.inc" ; div16x16 for MOD calculation
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
15 #include "strings.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
16 #include "tft.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
17 #include "tft_outputs.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
18 #include "shared_definitions.h"
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
19 #include "wait.inc"
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
20 #include "rx_ops.inc"
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
21
0
heinrichsweikamp
parents:
diff changeset
22
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
23 extern convert_meter_to_feet
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
24 extern tSetup_GasDepth
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
25 extern tGasDisabled
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
26 extern tDilDisabled
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
27 extern tLiter
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
28 extern tbar10
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
29 extern tbar
0
heinrichsweikamp
parents:
diff changeset
30
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
31 IFDEF _cave_mode
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
32 extern cavemode_waypoint_set_check
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
33 extern cavemode_waypoint_out_check
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
34 extern cavemode_waypoint_in_check
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
35 extern cavemode_turndive_check
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
36 ENDIF
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
37
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
38
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
39 gaslist CODE
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
40
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
41 ;-----------------------------------------------------------------------------
0
heinrichsweikamp
parents:
diff changeset
42
heinrichsweikamp
parents:
diff changeset
43 ;=============================================================================
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
44 ; Helper Functions for divemenu_tree.asm
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
45 ;
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
46 ; These functions need to be placed in a different
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
47 ; file than where the MENU_DYNAMIC macros use them.
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
48
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
49 ;-----------------------------------------------------------------------------
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
50
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
51 global label_do_toggle_gf
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
52 label_do_toggle_gf:
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
53 movff char_I_model,WREG ; 0 = ZH-L16, 1 = ZH-L16-GF
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
54 decfsz WREG,W ; toggle GF only in GF modes - in GF mode?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
55 bra do_toggle_gf_label_1 ; NO - print in disabled color
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
56 movff opt_enable_aGF,WREG ; =1: aGF can be selected underwater
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
57 decfsz WREG,W ; aGF enabled?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
58 bra do_toggle_gf_label_1 ; NO - print in disabled color
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
59 bra do_toggle_gf_label_2 ; YES to both - print in standard color
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
60 do_toggle_gf_label_1:
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
61 call TFT_disabled_color ; print in disabled color
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
62 do_toggle_gf_label_2:
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
63 STRCAT_TEXT tDivemenu_ToggleGF ; output label
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
64 return ; done
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
65
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
66
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
67 global label_do_gas6_or_exit
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
68 label_do_gas6_or_exit:
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
69 btfsc gas6_or_EXIT ; shall print exit?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
70 bra label_do_gas6_or_exit_1 ; YES - print exit label
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
71 STRCAT_TEXT tGas6 ; NO - print gas 6 label
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
72 return ; - done
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
73 label_do_gas6_or_exit_1:
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
74 STRCAT_TEXT tExit ; print exit label
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
75 return ; done
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
76
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
77 ;-----------------------------------------------------------------------------
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
78
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
79 IFDEF _cave_mode
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
80
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
81 global label_do_turn_dive
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
82 label_do_turn_dive:
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
83 call cavemode_turndive_check ; check if command is allowed
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
84 tstfsz WREG ; command allowed?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
85 call TFT_disabled_color ; NO - switch to disabled color
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
86 btfss cave_mode ; cave mode switched on?
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
87 bra label_do_turn_dive_1 ; NO - print turn dive label
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
88 btfss dive_turned ; YES - dive turned?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
89 bra label_do_turn_dive_1 ; NO - print turn dive label
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
90 STRCAT_TEXT tDivemenu_ContDive ; YES - print continue dive label
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
91 return ; - done
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
92 label_do_turn_dive_1:
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
93 STRCAT_TEXT tDivemenu_TurnDive ; print turn dive label
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
94 return ; done
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
95
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
96 global label_do_wp_set
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
97 label_do_wp_set:
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
98 call cavemode_waypoint_set_check ; check if command is allowed to execute
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
99 tstfsz WREG ; command allowed?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
100 call TFT_disabled_color ; NO - switch to disabled color
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
101 STRCAT_TEXT tDivemenu_wp_set ; print label
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
102 return ; done
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
103
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
104 global label_do_wp_out
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
105 label_do_wp_out:
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
106 call cavemode_waypoint_out_check ; check if command is allowed to execute
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
107 tstfsz WREG ; command allowed?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
108 call TFT_disabled_color ; NO - switch to disabled color
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
109 STRCAT_TEXT tDivemenu_wp_out ; print label
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
110 return ; done
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
111
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
112 global label_do_wp_in
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
113 label_do_wp_in:
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
114 call cavemode_waypoint_in_check ; check if command is allowed to execute
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
115 tstfsz WREG ; command allowed?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
116 call TFT_disabled_color ; NO - switch to disabled color
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
117 STRCAT_TEXT tDivemenu_wp_in ; print label
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
118 return ; done
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
119
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
120 ENDIF
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
121
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
122 ;-----------------------------------------------------------------------------
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
123
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
124 IFDEF _rx_functions
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
125
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
126 global do_toggle_max_pres_diff_label
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
127 do_toggle_max_pres_diff_label:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
128 movff opt_TR_mode,WREG ; get TR mode
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
129 xorlw .2 ; compare with 2 (ind.double)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
130 tstfsz WREG ; equal?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
131 call TFT_disabled_color ; NO - print in disabled color
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
132 STRCAT_TEXT tTrMaxDeltaP ; output label
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
133 movff char_I_max_pres_diff,lo
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
134 output_99
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
135 STRCAT_TEXT tbar ; " bar"
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
136 return
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
137
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
138 ENDIF
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
139
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
140 ;-----------------------------------------------------------------------------
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
141
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
142 IFDEF _ccr_pscr
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
143
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
144 global gaslist_copy_dil_to_oc
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
145 gaslist_copy_dil_to_oc:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
146 ;
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
147 ; Memory Map:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
148 ; -----------------------------------------
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
149 ; opt_gas_O2_ratio res 5
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
150 ; opt_dil_O2_ratio res 5
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
151 ; opt_gas_He_ratio res 5
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
152 ; opt_dil_He_ratio res 5
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
153 ; opt_gas_type res 5
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
154 ; opt_dil_type res 5
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
155 ; opt_gas_change res 5
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
156 ; opt_dil_change res 5
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
157 ;
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
158 ; char_I_gas_avail_size res 10
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
159 ; char_I_gas_avail_pres res 10
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
160 ;
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
161 bcf copying_dil ; default to copying a gas
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
162 movf gaslist_gas,W ; copy current gas or diluent number to WREG
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
163 btfss is_diluent_menu ; setting up diluents?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
164 bra gaslist_copy_dil_to_oc_1 ; NO - gaslist_gas is already pointing to an OC gas
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
165 addlw -.5 ; YES - subtract offset between diluents and gases
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
166 movwf gaslist_gas ; - let gaslist_gas point to the corresponding OC gas
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
167 bsf copying_dil ; - we are copying a diluent
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
168 bcf is_diluent_menu ; - pretend we are setting up OC gases
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
169 gaslist_copy_dil_to_oc_1:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
170 lfsr FSR0,opt_dil_O2_ratio ; load base address of diluents settings, ASM variables
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
171 lfsr FSR1,opt_gas_O2_ratio ; load base address of gas settings, ASM variables
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
172 movff PLUSW0,PLUSW1 ; copy O2 ratio
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
173 addlw .10 ; add offset from O2 ratios to He ratios
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
174 movff PLUSW0,PLUSW1 ; copy He ratio
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
175 addlw .10 ; add offset from He ratios to types
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
176 movff PLUSW0,PLUSW1 ; copy type
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
177 addlw .10 ; add offset from type to change depth
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
178 movff PLUSW0,PLUSW1 ; copy change depth
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
179 addlw -.30 ; wind back to initial gas number
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
180 lfsr FSR0,char_I_gas_avail_size+5; load base address of diluents settings, shared variables
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
181 lfsr FSR1,char_I_gas_avail_size+0; load base address of gas settings, shared variables
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
182 movff PLUSW0,PLUSW1 ; copy tank size
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
183 addlw .10 ; add offset from tank sizes to pressure budget
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
184 movff PLUSW0,PLUSW1 ; copy pressure budget
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
185 call gaslist_cleanup_list ; make sure that there will be just one first gas
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
186 btfss copying_dil ; are we copying a diluent?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
187 return ; NO - done
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
188 bsf is_diluent_menu ; YES - restore to be setting up diluents
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
189 movlw .5 ; - offset between OC gases and diluents
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
190 addwf gaslist_gas,F ; - let gaslist_gas point to the diluent again
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
191 WIN_BOX_BLACK .30,.239,.0,.159 ; - create some visual effect to show activity
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
192 WAITMS .200 ; - pause for 200 ms
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
193 return ; - done
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
194
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
195 ENDIF
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
196
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
197 ;=============================================================================
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
198
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
199 ;=============================================================================
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
200 ; Append gas description to current string
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
201 ;
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
202 ; Input: PRODL : gas number (0..4)
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
203 ; FSR2 : Current string position
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
204 ; Output: Text appended into buffer pointed by FSR2
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
205
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
206 global gaslist_strcat_gas
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
207 global gaslist_strcat_gas_WREG
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
208 gaslist_strcat_gas: ; entry point with gas/dil in PRODL (0-4) and flag 'is_diluent_menu' set accordingly
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
209 movff PRODL,gaslist_gas ; get current menu item (0-4)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
210 movlw .5 ; offset between gases and diluents
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
211 btfsc is_diluent_menu ; setting up diluents?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
212 addwf gaslist_gas,F ; YES - add the offset
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
213 movf gaslist_gas,W ; copy to WREG
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
214 gaslist_strcat_gas_WREG: ; entry point with gas/dil in WREG (0-9)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
215 lfsr FSR1,opt_gas_O2_ratio ; load base address of opt_gas_O2_ratio
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
216 movff PLUSW1,lo ; read O2 ratio
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
217 lfsr FSR1,opt_gas_He_ratio ; load base address of opt_gas_He_ratio
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
218 movff PLUSW1,hi ; read He ratio
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
219 goto gaslist_show_mix ; put "Nxlo", "Txlo/hi", "Air" or "O2" into Postinc2, and RETURN
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
220
0
heinrichsweikamp
parents:
diff changeset
221
heinrichsweikamp
parents:
diff changeset
222 ;=============================================================================
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
223 ; Append current mix to current string (for dive mode)
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
224 ;
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
225 ; Input: FSR2 : Current string position
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
226 ; Output: Text appended into buffer pointed by FSR2
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
227
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
228 global gaslist_strcat_gas6
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
229 gaslist_strcat_gas6: ; show current O2/He mix
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
230 STRCAT_TEXT tTakeGas ; print "take"
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
231 PUTC " " ; print one space
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
232 movff gas6_O2_ratio,hi ; TFT_color_code_gaslist needs O2 ratio in hi
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
233 call TFT_color_code_gaslist ; color-code according to O2 ratio and depth
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
234 movff gas6_O2_ratio,lo ; gaslist_show_mix needs O2 ratio in lo
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
235 IFDEF _helium
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
236 movff gas6_He_ratio,hi ; ... and He ratio in hi
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
237 ELSE
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
238 clrf hi ; ... and He ration will be zero
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
239 ENDIF
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
240 goto gaslist_show_mix ; put "Nxlo", "Txlo/hi", "Air" or "O2" into Postinc2, and return
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
241
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
242
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
243 ;=============================================================================
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
244 ; Helper functions for menu_tree
0
heinrichsweikamp
parents:
diff changeset
245
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
246 global gaslist_GasDepth
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
247 gaslist_GasDepth:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
248 movf gaslist_gas,W ; load gas/dil index into WREG (0-9)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
249 lfsr FSR1,opt_gas_change ; load base address of change depths
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
250 tstfsz PLUSW1 ; change depth = 0 ?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
251 bra gaslist_GasDepth_1 ; NO
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
252 lfsr FSR1,opt_gas_type ; YES - load base address of opt_gas_type
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
253 tstfsz PLUSW1 ; - type = disabled ?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
254 call TFT_attention_color ; NO - print in attention color (yellow)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
255 gaslist_GasDepth_1:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
256 STRCAT_TEXT tSetup_GasDepth
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
257 return
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
258
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
259
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
260 global gaslist_show_type
0
heinrichsweikamp
parents:
diff changeset
261 gaslist_show_type:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
262 movf gaslist_gas,W
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
263 lfsr FSR1,opt_gas_type ; load base address of opt_gas_type
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
264 movff PLUSW1,lo ; read gas type
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
265 STRCAT_TEXT tType
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
266 lfsr FSR1,tGasDisabled ; load base address of gas type labels
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
267 btfsc is_diluent_menu ; setting up diluents?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
268 lfsr FSR1,tDilDisabled ; YES - load base address of diluent type labels
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
269 movff lo,WREG ; 0-3
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
270 rlncf WREG ; x2
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
271 addwf FSR1L,F ; adjust address pointer to required text
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
272 movlw .0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
273 addwfc FSR1H,F
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
274 call strcat_text ; copy label text
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
275 return
0
heinrichsweikamp
parents:
diff changeset
276
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
277
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
278 global gaslist_toggle_type
0
heinrichsweikamp
parents:
diff changeset
279 gaslist_toggle_type:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
280 lfsr FSR1,opt_gas_type ; load base address of opt_gas_type
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
281 movf gaslist_gas,W ; copy gas number (0-9) to WREG
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
282 movff PLUSW1,lo ; read type value
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
283 incf lo,F ; increment type value
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
284 movlw num_gas_types ; get number of gas types by default
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
285 btfsc is_diluent_menu ; setting up diluents?
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
286 movlw num_dil_types ; YES - replace by number of diluent types
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
287 cpfslt lo ; type value valid?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
288 clrf lo ; NO - clear to zero
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
289 movf gaslist_gas,W ; restore gas number (0-9) in WREG
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
290 movff lo,PLUSW1 ; copy back result
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
291 return ; done
0
heinrichsweikamp
parents:
diff changeset
292
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
293 ;=============================================================================
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
294
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
295 IFDEF _ccr_pscr
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
296
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
297 global gaslist_strcat_setpoint
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
298 global gaslist_strcat_setpoint_0
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
299 gaslist_strcat_setpoint: ; entry point with setpoint index in PRODL
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
300 movff PRODL,gaslist_gas ; get current menu item (0-4)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
301 gaslist_strcat_setpoint_0: ; entry point with setpoint index in gaslist_gas
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
302 bsf leftbind
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
303 btfsc short_gas_descriptions ; shall use short versions of gaslist_strcat_setpoint?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
304 bra gaslist_strcat_setpoint2 ; YES - use short version
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
305 STRCAT_TEXT tSP ; "SP"
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
306 incf gaslist_gas,W ; (0-4) -> (1-5) into WREG
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
307 movwf lo
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
308 output_8 ; print SP number
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
309 bcf leftbind
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
310 PUTC ":"
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
311 gaslist_strcat_setpoint2: ; short version
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
312 btfsc divemode
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
313 bra gaslist_strcat_setpoint4 ; no "*" in dive mode
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
314 movf gaslist_gas,W ; (0-4) into WREG
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
315 bnz gaslist_strcat_setpoint3 ; SP index = 0 ?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
316 PUTC "*" ; YES - print *
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
317 bra gaslist_strcat_setpoint4 ; - continue with cbar value
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
318 gaslist_strcat_setpoint3: ; NO
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
319 PUTC " " ; - print a space
0
heinrichsweikamp
parents:
diff changeset
320 gaslist_strcat_setpoint4:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
321 movf gaslist_gas,W ; (0-4) into WREG
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
322 lfsr FSR1,opt_setpoint_cbar ; load base address of setpoint cbar values
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
323 movf PLUSW1,W ; read cbar value
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
324 movwf lo
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
325 clrf hi
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
326 bsf leftbind
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
327 output_16dp d'3' ; print as X.XX
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
328 btfsc divemode ; in dive mode?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
329 bra gaslist_strcat_setpoint5 ; YES - skip text in dive mode
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
330 STRCAT_TEXT tbar ; NO - print "bar"
0
heinrichsweikamp
parents:
diff changeset
331 gaslist_strcat_setpoint5:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
332 PUTC " " ; print a space
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
333 movf gaslist_gas,W ; (0-4) into WREG
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
334 lfsr FSR1,opt_setpoint_change ; load base address of switch depths
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
335 movff PLUSW1,lo ; read switch depth into lo
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
336 bra gaslist_strcat_depth ; print depth in meters or ft
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
337
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
338 ENDIF ; _ccr_pscr
0
heinrichsweikamp
parents:
diff changeset
339
heinrichsweikamp
parents:
diff changeset
340 ;----------------------------------------------------------------------------
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
341 ; Append gas description to current string
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
342 ;
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
343 ; Prints gas number, * if first, = if deco gas, gas composition and change depth,
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
344 ; including fancy color-coding
0
heinrichsweikamp
parents:
diff changeset
345 ;
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
346 ; Input: PRODL gas number (0..4)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
347 ; FSR2 current string position
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
348 ; Output: text appended to buffer pointed by FSR2
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
349 ;
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
350 ; NOTE: used in the menu-tree for the MENU_CALLBACK entry
0
heinrichsweikamp
parents:
diff changeset
351
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
352 global gaslist_strcat_gas_cd
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
353 gaslist_strcat_gas_cd: ; entry point with gas in PRODL (0-4) and flag 'is_diluent_menu' set accordingly
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
354 movff PRODL,gaslist_gas ; get current menu item (0-4)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
355 movlw .5 ; offset between gases and diluents
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
356 btfsc is_diluent_menu ; dealing with diluents?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
357 addwf gaslist_gas,F ; YES - add the offset
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
358 ;bra gaslist_gastitle ; continue with gaslist_gastitle function
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
359
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
360 global gaslist_gastitle
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
361 gaslist_gastitle: ; entry point with gas/dil in gaslist_gas (0-4 for gases, 5-9 for diluents)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
362 bcf win_invert ; clear flag for inverted output by default
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
363 btfsc short_gas_descriptions ; shall use short versions of gaslist_strcat_gas_cd?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
364 bra gaslist_gastitle1 ; YES - use short version
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
365 incf gaslist_gas,W ; (0-9) -> (1-10) into WREG
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
366 movwf lo ; copy gas index to lo
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
367 movlw .6 ; diluents start with 6
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
368 cpfslt lo ; gas number < 6 ?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
369 bra gaslist_gastitle_dil ; NO - it's a diluent
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
370 STRCAT_TEXT tGas ; YES - it's a gas
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
371 bra gaslist_gastitle0 ; - continue
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
372 gaslist_gastitle_dil:
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
373 STRCAT_TEXT tDil ; it's a diluent
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
374 movlw .5 ; offset between gases and diluents
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
375 subwf lo,F ; subtract offset from diluent number (6-10) -> (1-5) again
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
376 gaslist_gastitle0:
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
377 bsf leftbind
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
378 output_8 ; print gas/dil number (1-5)
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
379 bcf leftbind
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
380 PUTC ":"
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
381 gaslist_gastitle1: ; short version of gaslist_strcat_gas_cd
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
382 btfsc divemode ; in dive mode?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
383 bra gaslist_gastitle3 ; YES - no "*" and "=" in front of gas composition, no highlighting for transmitters paired
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
384
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
385 IFDEF _rx_functions
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
386 btfss tr_functions_activated ; NO - TR functions activated?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
387 bra gaslist_gastitle2 ; NO - continue with gas type
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
388 lfsr FSR1,opt_transmitter_id_1 ; YES - load base address of transmitter ID table
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
389 movf gaslist_gas,W ; - (0-4 for OC/Bailout, 5-9 for Diluents)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
390 rlncf WREG,W ; - index x2 because IDs are 2 byte
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
391 tstfsz PLUSW1 ; - transmitter ID low byte <> 0 ?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
392 bsf win_invert ; YES - flag transmitter paired by inverting output
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
393 incf WREG,W ; - increment index
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
394 tstfsz PLUSW1 ; - transmitter ID high byte <> 0 ?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
395 bsf win_invert ; YES - flag transmitter paired by inverting output
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
396 ENDIF
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
397
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
398 gaslist_gastitle2:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
399 rcall gaslist_strcat_gas_type ; print "*" for first gas/dil, "=" for a deco gas or " " else
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
400 gaslist_gastitle3:
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
401 call TFT_standard_color
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
402 btfsc divemode ; in dive mode?
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
403 rcall gaslist_strcat_gas_better ; YES - check if this is a "better gas", if yes switch to green and inverted output
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
404 lfsr FSR1,opt_gas_type ; load base address of gas types
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
405 movf gaslist_gas,W ; load index into WREG (0-4 for gases, 5-9 for diluents)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
406 movf PLUSW1,W ; read gas/dil type into WREG
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
407 btfsc WREG,gas_lost ; gas/dil lost?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
408 bra gaslist_gastitle3a ; YES - switch to disabled color
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
409 btfsc WREG,gas_staged ; gas/dil staged?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
410 bra gaslist_gastitle3a ; YES - switch to disabled color
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
411 bnz gaslist_gastitle4 ; type = disabled ?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
412 gaslist_gastitle3a:
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
413 call TFT_disabled_color ; YES - switch to disabled color
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
414 bra gaslist_gastitle5 ; - skip ppO2 check for disabled gases
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
415 gaslist_gastitle4:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
416 btfss divemode ; in dive mode?
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
417 bra gaslist_gastitle5 ; NO - no color-coding if not in dive mode
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
418 btfss color_code_gases ; YES - shall color-code the gases by ppO2 and current depth?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
419 bra gaslist_gastitle5 ; NO - skip color-coding
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
420 lfsr FSR1,opt_gas_O2_ratio ; YES - load base address of opt_gas_O2_ratio
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
421 movf gaslist_gas,W ; - load index into WREG (0-4 for gases, 5-9 for diluents)
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
422 movff PLUSW1,hi ; - read O2 ratio into hi
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
423 call TFT_color_code_gaslist ; - set color according to ppO2 limits
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
424 gaslist_gastitle5:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
425 movf gaslist_gas,W ; copy gas/dil index to WREG (0-9)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
426 rcall gaslist_strcat_gas_WREG ; print gas composition
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
427 btfss divemode ; in dive mode?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
428 bra gaslist_gastitle6 ; NO - continue printing a space
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
429 rcall gaslist_strcat_gas_type ; YES - print "*" for first gas/dil, "=" for a deco gas, or a space else
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
430 bra gaslist_gastitle7 ; - continue with change depth
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
431 gaslist_gastitle6:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
432 PUTC " " ; print a space
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
433 gaslist_gastitle7:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
434 lfsr FSR1,opt_gas_change ; load base address of change depths
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
435 movf gaslist_gas,W ; load gas/dil index into WREG (0-9)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
436 movff PLUSW1,lo ; read change depth into lo
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
437 gaslist_strcat_depth: ; entry point for general printing of depths with value in meters in lo
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
438 TSTOSS opt_units ; check depth units
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
439 bra gaslist_strcat_depth_metric ; 0 - use Meters
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
440 gaslist_strcat_depth_imperial: ; 1 - use Feet
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
441 call convert_meter_to_feet ; convert value in lo from [m] to [feet]
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
442 output_16_3 ; limit to 999 and display only 0-999
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
443 STRCAT_TEXT tFeets ; append "ft" REMARK: still one char to long for space available in dive mode menu!
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
444 return
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
445 gaslist_strcat_depth_metric:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
446 ; PUTC " " ; print a space
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
447 ; output_99
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
448 output_8
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
449 STRCAT_TEXT tMeters ; "m"
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
450 return
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
451
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
452
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
453 ; check for better gas
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
454 ;
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
455 gaslist_strcat_gas_better: ; color-code output if this is the best gas/diluent
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
456 btfss better_gas_hint ; shall better gas hints be given?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
457 return ; NO - return
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
458 movf best_gas_number,W ; get best gas number into WREG
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
459 IFDEF _ccr_pscr
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
460 btfsc is_diluent_menu ; setting up diluents?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
461 movf best_dil_number,W ; YES - overwrite with best diluent number
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
462 ENDIF
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
463 tstfsz WREG ; is a best gas/dil available?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
464 bra gaslist_strcat_gas_better1 ; YES - proceed
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
465 return ; NO - return
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
466 gaslist_strcat_gas_better1:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
467 decf WREG,W ; (1-5) -> (0-4)
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
468 btfsc is_diluent_menu ; setting up diluents?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
469 addlw .5 ; YES - add offset between gases and diluents (0-4) -> (5-9)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
470 cpfseq gaslist_gas ; compare with given gas/dil (0-4 for OC bailout gases, 5-9 for diluents)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
471 return ; not equal - return
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
472 bsf win_invert ; equal - invert
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
473 movlw color_green ; - select green color (gas is something "good")
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
474 goto TFT_set_color ; - activate color and return
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
475
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
476
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
477 gaslist_strcat_gas_type:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
478 lfsr FSR1,opt_gas_type ; load base address of gas types
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
479 movf gaslist_gas,W ; load index to WREG (0-4 for gases, 5-9 for diluents)
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
480 movf PLUSW1,W ; get gas/dil type into WREG
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
481 btfsc WREG,gas_lost ; gas set as lost?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
482 bra gaslist_strcat_gas_type_4 ; YES - print lost marking
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
483 IFDEF _cave_mode
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
484 btfsc WREG,gas_staged ; gas set as staged?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
485 bra gaslist_strcat_gas_type_5 ; YES - print staged marking
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
486 ENDIF
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
487 decf WREG,W ; decrement gas type (-1 for disabled, 0 for first, 1 for work/normal, 2 for deco)
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
488 bnz gaslist_strcat_gas_type_1 ; type = first? NO - continue with checking for work and deco gas
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
489 PUTC "*" ; YES - print "*" for first
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
490 return ; - done
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
491 gaslist_strcat_gas_type_1:
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
492 decf WREG,W ; decrement gas type (-2 for disabled, -1 for first, 0 for work/normal, 1 for deco)
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
493 bnz gaslist_strcat_gas_type_2 ; type = work? NO - continue with checking for deco gas
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
494 PUTC "\xb8" ; YES - print down-arrow for a work gas
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
495 return ; - done
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
496 gaslist_strcat_gas_type_2:
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
497 decf WREG,W ; decrement gas type (-3 for disabled, -2 for first, -1 for work/normal, 0 for deco)
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
498 bnz gaslist_strcat_gas_type_3 ; type = deco? NO - neither first nor deco
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
499 PUTC "=" ; YES - print "=" for a deco gas
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
500 return ; - done
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
501 gaslist_strcat_gas_type_3:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
502 PUTC " " ; neither first nor deco, print a space
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
503 return ; done
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
504 gaslist_strcat_gas_type_4:
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
505 PUTC "x" ; print lost marking
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
506 return ; done
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
507 IFDEF _cave_mode
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
508 gaslist_strcat_gas_type_5:
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
509 PUTC "S" ; print staged marking
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
510 return ; done
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 628
diff changeset
511 ENDIF
0
heinrichsweikamp
parents:
diff changeset
512
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
513
0
heinrichsweikamp
parents:
diff changeset
514 ;----------------------------------------------------------------------------
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
515 ; Housekeeping for the gas/dil settings, e.g. making sure there is one FIRST only
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
516 ;
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
517 ; Input: gaslist_gas last edited gas/dil (0-9)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
518
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
519 global gaslist_cleanup_list
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
520 gaslist_cleanup_list:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
521 lfsr FSR1,opt_gas_type ; load base address of opt_gas_type
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
522 IFDEF _ccr_pscr
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
523 movlw .5 ; offset between gases and diluents
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
524 btfsc is_diluent_menu ; setting up diluents?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
525 subwf gaslist_gas,F ; YES - subtract offset from gaslist_gas: (5-9) -> (0-4)
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
526 ENDIF
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
527 gaslist_cleanup_list0:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
528 bcf ignore_last_edited_gas
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
529 gaslist_cleanup_list1:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
530 clrf lo ; counter for number of "firsts" found
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
531 movlw .5 ; initialize hi as loop counter for checking 5 gases/diluents
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
532 movwf hi
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
533 gaslist_cleanup_list2: ; loop body
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
534 decf hi,W ; WREG = current gas/dil (0-4)
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
535 IFDEF _ccr_pscr
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
536 btfsc is_diluent_menu ; setting up diluents?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
537 addlw .5 ; YES - add offset from gases to diluents -> (5-9)
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
538 ENDIF
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
539 movff PLUSW1,WREG ; read type into WREG
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
540 decfsz WREG ; is type = first (ex type code 1)?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
541 bra gaslist_cleanup_list3 ; NO - done with this gas/dil
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
542 incf lo,F ; YES - increment number of "firsts" found
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
543 btfss ignore_last_edited_gas ; - shall we ignore the last edited gas/dil?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
544 bra gaslist_cleanup_list2b ; NO - continue remembering the "last first" gas/dil (do a shortcut)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
545 decf hi,W ; YES - get the current gas/dil as (0-4)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
546 cpfseq gaslist_gas ; - is this the last edited gas/dil?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
547 gaslist_cleanup_list2b:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
548 movff hi,up ; (NO) - remember the last "first gas" found
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
549 gaslist_cleanup_list3:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
550 decfsz hi,F ; decrement loop counter, did loop counter became 0?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
551 bra gaslist_cleanup_list2 ; NO - loop
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
552 tstfsz lo ; YES - any first gas/dil at all?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
553 bra gaslist_cleanup_list4 ; YES - at least one first gas/dil existing
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
554 IFDEF _ccr_pscr
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
555 btfsc is_diluent_menu ; NO - setting up diluents?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
556 lfsr FSR1,opt_dil_type ; YES - load base address of opt_gas_type
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
557 ENDIF
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
558 movlw .1 ; - load coding for first gas
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
559 movwf INDF1 ; - make gas/dil 1 the first gas
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
560 return ; - done
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
561 gaslist_cleanup_list4:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
562 movlw .1 ; total number of Firsts that should exist is 1
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
563 cpfsgt lo ; more then one "first gas" found?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
564 return ; NO - done
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
565 decf up,W ; YES - WREG = last found "first gas" - 1 (0-4)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
566 cpfseq gaslist_gas ; - is this the last edited gas/dil?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
567 bra gaslist_cleanup_list4b ; NO - disable it
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
568 bsf ignore_last_edited_gas ; YES - do not disable last edited gas, search again but ignore the last edited gas
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
569 bra gaslist_cleanup_list1 ; - loop until only one "first" is left over
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
570 gaslist_cleanup_list4b:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
571 IFDEF _ccr_pscr
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
572 btfsc is_diluent_menu ; setting up diluents?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
573 addlw .5 ; YES - adjust offset
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
574 ENDIF
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
575 clrf PLUSW1 ; disable gas
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
576 bra gaslist_cleanup_list0 ; redo from start until only one "first" is left over
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
577 return
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
578
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
579
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
580 ;----------------------------------------------------------------------------
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
581 ; Tank Settings
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
582 ;
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
583 ; Input: char_I_gas_avail_size size of the tank in liters
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
584 ; char_I_gas_avail_pres available pressure in multiples of 10 bar
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
585
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
586 global gaslist_tank_size_pres
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
587 gaslist_tank_size_pres: ; dynamic title: xx l, xx0 bar
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
588 lfsr FSR1,char_I_gas_avail_size ; load base address of char_I_gas_avail_size
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
589 movf gaslist_gas,W ; load index (0-9)
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
590 movff PLUSW1,lo ; read char_I_gas_avail_size[WREG] into lo
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
591 lfsr FSR1,char_I_gas_avail_pres ; load base address of char_I_gas_avail_pres
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
592 movff PLUSW1,hi ; read char_I_gas_avail_pres[WREG] into hi
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
593 STRCAT " " ; print 5 leading spaces for alignment
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
594 output_8 ; print tank size
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
595 STRCAT_TEXT tLiter ; print unit (" l")
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
596 movff hi,lo ; copy fill pressure into lo
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
597 output_8 ; print fill pressure (it is stored in multiples of 10 bar)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
598 STRCAT_TEXT tbar10 ; print unit ("0 bar")
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
599 return
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
600
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
601
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
602 global gaslist_tank_size
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
603 gaslist_tank_size: ; adjust char_I_gas_avail_size between min_tank_size and max_tank_size
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
604 lfsr FSR1,char_I_gas_avail_size ; load base address of char_I_gas_avail_size
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
605 movf gaslist_gas,W ; load index (0-9)
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
606 movff PLUSW1,lo ; read char_I_gas_avail_size[WREG] into lo
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
607 incf lo,F ; increment tank size by 1 liter
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
608 movlw max_tank_size ; load max. allowed value into WREG
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
609 cpfsgt lo ; tank size <= max value?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
610 bra gaslist_tank_size_1 ; YES - new value can be used
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
611 movlw min_tank_size ; NO - wrap-around to min value
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
612 movwf lo ; - and write to lo
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
613 gaslist_tank_size_1:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
614 movf gaslist_gas,W ; re-load index
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
615 movff lo,PLUSW1 ; write back tank size to char_I_gas_avail_size[WREG]
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
616 return
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
617
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
618
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
619 global gaslist_tank_pres
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
620 gaslist_tank_pres: ; adjust char_I_gas_avail_pres between 5(0) and 29(0) bar
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
621 lfsr FSR1,char_I_gas_avail_pres ; load base address of char_I_gas_avail_pres
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
622 movf gaslist_gas,W ; load index (0-9)
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
623 movff PLUSW1,lo ; read char_I_gas_avail_pres[WREG] into lo
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
624 incf lo,F ; increment fill press by by 1(0) bar
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
625 movlw max_fill_press ; load max. allowed value into WREG
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
626 cpfsgt lo ; press <= max value?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
627 bra gaslist_tank_pres_1 ; YES - new value can be used
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
628 movlw min_fill_press ; NO - wrap-around to min value
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
629 movwf lo ; - and write to lo
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
630 gaslist_tank_pres_1:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
631 movf gaslist_gas,W ; re-load index
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
632 movff lo,PLUSW1 ; write back tank size to char_I_gas_avail_pres[WREG]
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
633 return
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
634
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
635
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
636 ;=============================================================================
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
637
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
638 IFDEF _rx_functions
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
639
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
640 ; Transmitter functions - ID
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
641 ;
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
642 global gaslist_tank_id_pres
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
643 gaslist_tank_id_pres: ; dynamic title: shows ID and pressure from transmitter with ID opt_transmitter_id[gaslist_gas]
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
644 ; When changing layout, adapt output position TFT_menu_tank_pres!
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
645 STRCAT " ID: " ; print header
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
646 ; get ID ;
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
647 lfsr FSR1,opt_transmitter_id_1 ; load base address of opt_transmitter_id
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
648 movf gaslist_gas,W ; load index (0-9)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
649 rlncf WREG,W ; multiply by 2 because IDs are 2 byte in size
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
650 movff PLUSW1,lo ; copy opt_transmitter_id+0[gaslist_gas] to lo
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
651 incf WREG,W ; increment index
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
652 movff PLUSW1,hi ; copy opt_transmitter_id+1[gaslist_gas] to hi
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
653 ; check if a transmitter is paired to this tank
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
654 tstfsz hi ; high byte of ID <> 0 ?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
655 bra gaslist_tank_id_pres_1 ; YES - a transmitter is paired to the tank
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
656 tstfsz lo ; low byte of ID <> 0 ?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
657 bra gaslist_tank_id_pres_1 ; YES - a transmitter is paired to the tank
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
658 STRCAT "----" ; NO - no transmitter paired
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
659 bcf imprint_xmitter_pres ; - stop imprinting of transmitter pressure data
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
660 return ; - done
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
661 gaslist_tank_id_pres_1: ; YES - show ID
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
662 movf hi,W ; - copy high byte of ID to WREG
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
663 output_hex ; - print it
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
664 movf lo,W ; - copy low byte of ID to WREG
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
665 output_hex ; - print it
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
666 bsf imprint_xmitter_pres ; - start imprinting of transmitter pressure data
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
667 return ; - done
0
heinrichsweikamp
parents:
diff changeset
668
heinrichsweikamp
parents:
diff changeset
669
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
670 ; Transmitter functions - Pairing
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
671 ;
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
672 global gaslist_tank_pairing
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
673 gaslist_tank_pairing:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
674 incf pairing_slot,F ; goto next RX data slot
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
675 btfsc pairing_slot,3 ; slot = 8?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
676 bra gaslist_tank_pairing_none ; YES - offer unpairing
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
677 movf pairing_slot,W ; NO - copy slot to WREG
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
678 call get_transmitter_id_by_slot ; WREG = slot (0-7) -> hi:lo = transmitter ID
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
679 tstfsz hi ; transmitter found (probe on high byte)?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
680 bra gaslist_tank_pairing_common ; YES - select this transmitter
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
681 tstfsz hi ; transmitter found (probe on low byte)?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
682 bra gaslist_tank_pairing_common ; YES - select this transmitter
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
683 bra gaslist_tank_pairing ; NO - try next slot
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
684 gaslist_tank_pairing_common:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
685 lfsr FSR1,opt_transmitter_id_1 ; load base address of opt_transmitter_id
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
686 movf gaslist_gas,W ; load index into WREG (0-9)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
687 rlncf WREG,W ; multiply by 2 because IDs are 2 byte in size
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
688 movff lo,PLUSW1 ; copy lo to opt_transmitter_id+0[gaslist_gas]
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
689 incf WREG,W ; increment index
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
690 movff hi,PLUSW1 ; copy hi to opt_transmitter_id+1[gaslist_gas]
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
691 return ; done
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
692 gaslist_tank_pairing_none:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
693 setf pairing_slot ; prime slot number with 255 aka -1
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
694 clrf hi ; adjust "no transmitter" ID
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
695 clrf lo ; adjust "no transmitter" ID
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
696 bra gaslist_tank_pairing_common ; continue with common part
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
697
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
698 ENDIF
0
heinrichsweikamp
parents:
diff changeset
699
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
700 ;=============================================================================
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
701
0
heinrichsweikamp
parents:
diff changeset
702 ;----------------------------------------------------------------------------
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
703 ; Helper Functions for Menu Operations
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
704
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
705
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
706 ; Increment O2 ratio
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
707 ;
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
708 global gaslist_pO2
0
heinrichsweikamp
parents:
diff changeset
709 gaslist_pO2:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
710 movf gaslist_gas,W ; load index (0-9)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
711 lfsr FSR1,opt_gas_He_ratio ; load base address of opt_gas_He_ratio
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
712 movff PLUSW1,hi ; read He ratio into hi
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
713 lfsr FSR1,opt_gas_O2_ratio ; load base address of opt_gas_O2_ratio
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
714 movff PLUSW1,lo ; read O2 ratio into lo
0
heinrichsweikamp
parents:
diff changeset
715
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
716 incf lo,F ; O2++
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
717 movf hi,W ; get He ratio into WREG
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
718 addwf lo,W ; add O2 ratio to WREG
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
719 movwf up ; move sum He + O2 to up
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
720 movlw .101 ;
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
721 cpfslt up ; O2 + He < 101?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
722 decf lo,F ; O2-- (revoke ++)
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
723 movf gaslist_gas,W ; re-load index
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
724 movff lo,PLUSW1 ; write back O2 ratio to opt_gas_O2_ratio[WREG]
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
725 return
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
726
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
727
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
728 ; Decrement O2 ratio
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
729 ;
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
730 global gaslist_mO2
0
heinrichsweikamp
parents:
diff changeset
731 gaslist_mO2:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
732 movf gaslist_gas,W ; load index (0-9)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
733 lfsr FSR1,opt_gas_O2_ratio ; load base address of opt_gas_O2_ratio
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
734 movff PLUSW1,lo ; read O2 ratio into lo
0
heinrichsweikamp
parents:
diff changeset
735
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
736 decf lo,F ; O2--
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
737 movlw gaslist_min_o2 ; get minimum allowed O2 ratio
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
738 cpfslt lo ; current O2 ratio below allowed minimum?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
739 bra gaslist_mO2_1 ; NO
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
740 movwf lo ; YES - copy minimum O2 ratio to lo
0
heinrichsweikamp
parents:
diff changeset
741 gaslist_mO2_1:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
742 movf gaslist_gas,W ; re-load index
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
743 movff lo,PLUSW1 ; write back O2 ratio to opt_gas_O2_ratio[WREG]
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
744 return
0
heinrichsweikamp
parents:
diff changeset
745
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
746 ;=============================================================================
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
747
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
748 IFDEF _helium
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
749
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
750 ; Increment He ratio
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
751 ;
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
752 global gaslist_pHe
0
heinrichsweikamp
parents:
diff changeset
753 gaslist_pHe:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
754 movf gaslist_gas,W ; load index (0-9)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
755 lfsr FSR1,opt_gas_O2_ratio ; load base address of opt_gas_O2_ratio
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
756 movff PLUSW1,lo ; read O2 ratio into lo
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
757 lfsr FSR1,opt_gas_He_ratio ; load base address of opt_gas_He_ratio
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
758 movff PLUSW1,hi ; read He ratio into hi
0
heinrichsweikamp
parents:
diff changeset
759
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
760 incf hi,F ; He++
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
761 movf hi,W ; get He ratio into WREG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
762 addwf lo,W ; add O2 ratio to WREG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
763 movwf up ; move sum He + O2 to up
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
764 movlw .101 ;
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
765 cpfslt up ; O2 + He < 101?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
766 decf hi,F ; He-- (revoke ++)
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
767 movf gaslist_gas,W ; re-load index
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
768 movff hi,PLUSW1 ; write back He ratio to opt_gas_He_ratio[WREG]
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
769 return
0
heinrichsweikamp
parents:
diff changeset
770
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
771 ; Decrement He ratio
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
772 ;
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
773 global gaslist_mHe
0
heinrichsweikamp
parents:
diff changeset
774 gaslist_mHe:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
775 movf gaslist_gas,W ; load index (0-9)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
776 lfsr FSR1,opt_gas_He_ratio ; load base address of opt_gas_He_ratio
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
777 movff PLUSW1,hi ; read He ratio into hi
0
heinrichsweikamp
parents:
diff changeset
778
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
779 decf hi,F ; He--
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
780 bnn gaslist_mHe_1 ; He ratio negative?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
781 clrf hi ; YES - set He ratio to 0
0
heinrichsweikamp
parents:
diff changeset
782 gaslist_mHe_1:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
783 movf gaslist_gas,W ; re-load index
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
784 movff hi,PLUSW1 ; write back He ratio to opt_gas_He_ratio[WREG]
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
785 return
0
heinrichsweikamp
parents:
diff changeset
786
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
787 ENDIF ; _helium
0
heinrichsweikamp
parents:
diff changeset
788
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
789 ;=============================================================================
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
790
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
791 ; Increment switch depth
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
792 ;
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
793 global gaslist_pDepth
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
794 gaslist_pDepth:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
795 lfsr FSR1,opt_gas_change ; load base address of opt_gas_change
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
796 movf gaslist_gas,W ; load index (0-4)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
797 movff PLUSW1,lo ; read switch depth into lo
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
798 incf lo,F ; increment switch depth
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
799 movlw gaslist_max_change_depth ; get max change depth
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
800 cpfsgt lo ; above max change depth?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
801 bra gaslist_pDepth_1 ; NO
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
802 movwf lo ; YES - revert to max change depth
0
heinrichsweikamp
parents:
diff changeset
803 gaslist_pDepth_1:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
804 movf gaslist_gas,W ; re-load index
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
805 movff lo,PLUSW1 ; write back switch depth
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
806 return
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
807
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
808
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
809 ; Decrement switch depth
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
810 ;
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
811 global gaslist_mDepth
0
heinrichsweikamp
parents:
diff changeset
812 gaslist_mDepth:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
813 lfsr FSR1,opt_gas_change ; load base address of opt_gas_change
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
814 movf gaslist_gas,W ; load index (0-4)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
815 movff PLUSW1,lo ; read switch depth into lo
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
816 decf lo,F ; decrement switch depth
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
817 btfsc STATUS,N ; did depth became negative?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
818 clrf lo ; YES - reset to zero
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
819 movff lo,PLUSW1 ; write back switch depth
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
820 return
0
heinrichsweikamp
parents:
diff changeset
821
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
822 ;=============================================================================
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
823
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
824 IFDEF _ccr_pscr
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
825
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
826 ; Increment setpoint
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
827 ;
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
828 global gaslist_spplus
0
heinrichsweikamp
parents:
diff changeset
829 gaslist_spplus:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
830 movf gaslist_gas,W
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
831 lfsr FSR1,opt_setpoint_cbar
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
832 movff PLUSW1,lo ; read setpoint
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
833 movlw gaslist_sp_stepsize
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
834 addwf lo,F
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
835 movlw gaslist_sp_max
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
836 cpfsgt lo
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
837 bra gaslist_spplus2
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
838 movlw gaslist_sp_min
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
839 movwf lo
0
heinrichsweikamp
parents:
diff changeset
840 gaslist_spplus2:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
841 movf gaslist_gas,W
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
842 movff lo,PLUSW1 ; write back setpoint
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
843 return
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
844
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
845
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
846 ; Increment setpoint switch depth
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
847 ;
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
848 global gaslist_spdepthplus
0
heinrichsweikamp
parents:
diff changeset
849 gaslist_spdepthplus:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
850 movf gaslist_gas,W ; get setpoint number (0-4)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
851 bz gaslist_spdepthplus2 ; setpoint number = 0? YES - force depth to always be 0m
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
852 lfsr FSR1,opt_setpoint_change ; load base address of opt_setpoint_change
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
853 movff PLUSW1,lo ; read setpoint depth into lo
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
854 incf lo,F ; increment depth
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
855 movlw gaslist_max_change_depth ; get max. depth
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
856 cpfsgt lo ; switch depth > max. depth?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
857 bra gaslist_spdepthplus_1 ; NO
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
858 movwf lo ; YES - copy to lo
0
heinrichsweikamp
parents:
diff changeset
859 gaslist_spdepthplus_1:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
860 movf gaslist_gas,W ; re-load index
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
861 movff lo,PLUSW1 ; write back setpoint depth
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
862 return
0
heinrichsweikamp
parents:
diff changeset
863
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
864
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
865 ; Decrement set point switch depth
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
866 ;
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
867 global gaslist_spdepthminus
0
heinrichsweikamp
parents:
diff changeset
868 gaslist_spdepthminus:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
869 movf gaslist_gas,W ; get setpoint number (0-4)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
870 bz gaslist_spdepthminus2 ; setpoint number = 0? YES - force depth to always be 0m
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
871 lfsr FSR1,opt_setpoint_change ; load base address of opt_setpoint_change
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
872 movff PLUSW1,lo ; read setpoint depth into lo
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
873 decf lo,F ; decrement switch depth
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
874 btfsc STATUS,N ; did depth became negative?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
875 clrf lo ; YES - reset to zero
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
876 movff lo,PLUSW1 ; write back setpoint depth
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
877 return
0
heinrichsweikamp
parents:
diff changeset
878
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
879
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
880 ; helper for increment/decrement setpoint switch depth
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
881 ;
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
882 gaslist_spdepthplus2:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
883 gaslist_spdepthminus2:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
884 movlw .0
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
885 movff WREG,opt_setpoint_change+0; hard reset to 0m
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
886 return
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
887
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
888 ENDIF ; _ccr_pscr
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
889
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
890 ;=============================================================================
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
891
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
892
0
heinrichsweikamp
parents:
diff changeset
893 ;----------------------------------------------------------------------------
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
894 ; Compute MOD from O2 ratio and char_I_ppO2_max_work / char_I_ppO2_max_deco
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
895 ; Compute MOD from O2 ratio and char_I_ppO2_max_deco
0
heinrichsweikamp
parents:
diff changeset
896 ;
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
897 ; Input: gaslist_gas = current gas index.
0
heinrichsweikamp
parents:
diff changeset
898 ; opt_gas_O2_ratio[gaslist_gas] = current O2 ratio
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
899 ; Output: WREG = MOD [m]
0
heinrichsweikamp
parents:
diff changeset
900 ;
heinrichsweikamp
parents:
diff changeset
901 gaslist_calc_mod:
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
902 lfsr FSR1,opt_gas_type ; load base address of opt_gas_type
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
903 movf gaslist_gas,W ; load index (0...9)
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
904 movff PLUSW1,xA+0 ; read gas/dil type into xA+0 (used as temp here)
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
905 movff char_I_ppO2_max_work,xB+1 ; get max ppO2 for deco into xB+1 (used as temp here)
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
906 movlw .3 ; type code for deco gases
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
907 cpfslt xA+0 ; is it a deco gas?
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
908 gaslist_calc_mod_deco:
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
909 movff char_I_ppO2_max_deco,xB+1 ; YES - overwrite/get ppO2 max with/for work
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
910 lfsr FSR1,opt_gas_O2_ratio ; load base address of opt_gas_O2_ratio
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
911 movf gaslist_gas,W ; load index (0...9)
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
912 movff PLUSW1,xB+0 ; read O2 ratio into xB+0
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
913 movf xB+1,W ; copy ppO2 max into WREG
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
914 clrf xB+1 ; clear xB+1 for div16x16 operation
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
915 mullw .10 ; multiply ppO2 max value with 10
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
916 MOVII PROD,xA ; copy result to xA
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
917 call div16x16 ; xC = xA / xB with xA as remainder
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
918 movf xC+0,W ; copy low byte of the result to WREG
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
919 addlw -.10 ; subtract 10 cbar
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
920 return ; return with final result [in meters] in WREG
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
921
0
heinrichsweikamp
parents:
diff changeset
922 ;----------------------------------------------------------------------------
154
afa31c815f24 NEW: Show ppO2 for change depth during gas setup
heinrichsweikamp
parents: 97
diff changeset
923
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
924 ; print ppO2 as x.xx for gas/diluent in gaslist_gas (0-9)
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
925 ;
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
926 global gaslist_ppo2
154
afa31c815f24 NEW: Show ppO2 for change depth during gas setup
heinrichsweikamp
parents: 97
diff changeset
927 gaslist_ppo2:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
928 STRCAT_TEXT tppO2 ; ppO2:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
929 lfsr FSR1,opt_gas_change ; load base address of opt_gas_change
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
930 movf gaslist_gas,W ; load index (0-9)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
931 movf PLUSW1,W ; read change depth into WREG
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
932 mullw .10 ; PROD = depth in mbar/10 (100 = 1.00 bar)
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
933 ADDLI .100,PROD ; add 1 bar
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
934 MOVII PROD,xA ; copy result to xA
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
935 lfsr FSR1,opt_gas_O2_ratio ; load base address of opt_gas_O2_ratio
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
936 movf gaslist_gas,W ; load index (0-9)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
937 movff PLUSW1,xB+0 ; read O2 ratio into xB+0
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
938 clrf xB+1 ; clear xB+1
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
939 call mult16x16 ; calculate char_I_O2_ratio * (p_amb/10)
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
940 MOVII xC,xA ; copy result to xA
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
941 movlw d'100' ; load 100 to xB
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
942 movwf xB+0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
943 clrf xB+1
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
944 call div16x16 ; xC = xA / xB = (char_I_O2_ratio * p_amb/10)/100
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
945 ; check for very high ppO2
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
946 tstfsz xC+2 ; xC+2 remains from mult16x16, xC+2 > 0 (-> ppO2 is > 6.55 bar) ?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
947 bra gaslist_ppo2_1 ; YES - display a fixed max value
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
948 MOVII xC,mpr ; copy result to hi:lo
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
949 bcf ignore_digit4
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
950 bsf leftbind
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
951 output_16dp d'3' ; print ppO2 as x.xx
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
952 STRCAT_TEXT tbar ; print "bar"
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
953 return
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
954 gaslist_ppo2_1:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
955 STRCAT ">6.6"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
956 return
154
afa31c815f24 NEW: Show ppO2 for change depth during gas setup
heinrichsweikamp
parents: 97
diff changeset
957
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
958
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
959 ; print MOD and END for gas in gaslist_gas (0-9)
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
960 ;
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
961 global gaslist_MOD_END
0
heinrichsweikamp
parents:
diff changeset
962 gaslist_MOD_END:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
963 STRCAT_TEXT tMOD ; print "MOD:"
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
964 rcall gaslist_calc_mod ; compute MOD into WREG
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
965 movwf lo ; copy result to lo
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
966 call gaslist_strcat_depth ; print depth in meters or feet as configured
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
967 PUTC "/" ; print "/"
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
968 STRCAT_TEXT tEND ; print "END:"
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
969 rcall gaslist_calc_mod ; compute MOD into WREG
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
970 addlw .10 ; compute MOD = MOD + 10m
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
971 movwf xB+0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
972 clrf xB+1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
973 movlw d'100'
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
974 movwf xA+0
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
975 lfsr FSR1,opt_gas_He_ratio ; load base address of opt_gas_He_ratio
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
976 movf gaslist_gas,W ; load index (0...9)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
977 movf PLUSW1,W ; read He ration into WREG
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
978 subwf xA+0,F ; xA+0 = 100 - He ratio in %
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
979 clrf xA+1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
980 call mult16x16 ; xA*xB=xC
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
981 MOVII xC,xA
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
982 movlw d'100'
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
983 movwf xB+0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
984 clrf xB+1
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
985 call div16x16 ; xC = xA / xB with xA as remainder
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
986 ; ; xC:2 = ((MOD+10) * 100 - HE Value in %) / 100
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
987 movlw d'10' ; subtract 10 m
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
988 subwf xC+0,F ; ...
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
989 movff xC+0,lo ; copy result to lo
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
990 bra gaslist_strcat_depth ; print depth in meters or feet as configured and return
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
991
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
992
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
993 ; print change depth of gas in gaslist_gas (0-9), use warning color if > MOD
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
994 ;
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
995 global gaslist_reset_mod_title
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
996 gaslist_reset_mod_title:
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
997 STRCAT_TEXT tDepthReset ; print "Reset to MOD:"
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
998 PUTC " " ; add a space char
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
999 lfsr FSR1,opt_gas_change ; load base address of opt_gas_change
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1000 movf gaslist_gas,W ; load index (0-9)
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
1001 movff PLUSW1,hi ; read change depth into hi
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
1002 rcall gaslist_calc_mod ; compute MOD for ppO2 max work/deco dependent on gas type into WREG
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
1003 movwf lo ; copy (true) MOD to lo
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
1004 movf hi,W ; copy change depth to WREG
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1005 cpfslt lo ; change depth > MOD ?
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
1006 bra gaslist_strcat_depth ; NO - print MOD from value in lo
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
1007 call TFT_attention_color ; YES - use attention color
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
1008 rcall gaslist_calc_mod_deco ; - compute MOD for ppO2 max deco into WREG
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
1009 movwf up ; - copy result to up
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
1010 movf hi,W ; - copy change depth to WREG again
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
1011 cpfslt up ; - change depth > MOD deco ?
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
1012 bra gaslist_strcat_depth ; NO - print MOD from value in lo, keeping attention color
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
1013 call TFT_warning_color ; YES - switch to warning color
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
1014 bra gaslist_strcat_depth ; - print MOD from value in lo
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1015
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1016
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
1017 ; set change depth of gas in gaslist_gas (0-9) to its MOD
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
1018 ;
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1019 global gaslist_reset_mod
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1020 gaslist_reset_mod:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1021 rcall gaslist_calc_mod ; compute MOD into WREG
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1022 movwf lo ; copy result to lo
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1023 lfsr FSR1,opt_gas_change ; load base address of opt_gas_change
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1024 movf gaslist_gas,W ; load index (0-9)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
1025 movff lo,PLUSW1 ; write back new change depth
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
1026 return
0
heinrichsweikamp
parents:
diff changeset
1027
heinrichsweikamp
parents:
diff changeset
1028 ;----------------------------------------------------------------------------
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
1029 ; put "Nxlo", "Txlo/hi", "Air" or "O2" into postinc2
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
1030 ;
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
1031 ; Includes capability to show trimix gases to be able to properly decode data
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
1032 ; from logbook in case trimix dives are stored on an OSTC running the sport FW.
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
1033
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
1034 global gaslist_show_mix
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
1035 gaslist_show_mix:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
1036 tstfsz hi ; He=0?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
1037 bra gaslist_show_mix5 ; NO - show a TX
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
1038 movlw .21
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
1039 cpfseq lo ; Air?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
1040 bra gaslist_show_mix2 ; NO
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
1041 STRCAT_TEXT tSelectAir ; YES - show "Air"
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
1042 bra gaslist_show_mix4b
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
1043 gaslist_show_mix2:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
1044 movlw .100
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
1045 cpfseq lo ; O2?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
1046 bra gaslist_show_mix3 ; NO
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
1047 STRCAT_TEXT tSelectO2 ; YES - show "O2"
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
1048 bra gaslist_show_mix4b
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
1049 gaslist_show_mix3:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
1050 movlw .21
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
1051 cpfslt lo ; < Nx21?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
1052 bra gaslist_show_mix4 ; NO
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
1053 STRCAT_TEXT tGasErr ; YES - show "Err"
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
1054 output_99 ; O2 ratio is still in "lo"
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
1055 bra gaslist_show_mix4c
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
1056 gaslist_show_mix4:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
1057 STRCAT_TEXT tSelectNx ; show "Nx"
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
1058 output_99 ; O2 ratio is still in "lo"
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
1059 gaslist_show_mix4b:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
1060 STRCAT " "
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
1061 gaslist_show_mix4c:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
1062 btfsc divemode ; in dive mode?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
1063 return ; YES
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
1064 STRCAT " "
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
1065 return
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
1066 gaslist_show_mix5:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
1067 btfsc divemode
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
1068 bra gaslist_show_mix6
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
1069 STRCAT_TEXT tSelectTx ; show "Tx"
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
1070 gaslist_show_mix6:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
1071 output_99 ; O2 ratio is still in "lo"
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
1072 PUTC "/"
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
1073 movff hi,lo
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
1074 output_99 ; He ratio
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
1075 return
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
1076
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
1077 ;-----------------------------------------------------------------------------
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
1078
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
1079 END