annotate src/gaslist.asm @ 608:d866684249bd

work on 2.99 stable
author heinrichsweikamp
date Mon, 07 Jan 2019 21:13:43 +0100
parents ca4556fb60b9
children c40025d8e750
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
heinrichsweikamp
parents:
diff changeset
1 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
2 ;
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
3 ; File gaslist.asm REFACTORED VERSION V2.99e
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"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
14 #include "math.inc" ; div16x16 for MOD calculations
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"
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
20
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
21 IFDEF _rx_functions
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
22 #include "rx_ops.inc"
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
23 ENDIF
0
heinrichsweikamp
parents:
diff changeset
24
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
25 extern convert_mbar_to_feet
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
26 extern customview_show_mix
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
27 extern tSetup_GasDepth
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
28 extern tGasDisabled
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
29 extern tDilDisabled
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
30 extern tLiter
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
31 extern tbar10
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
32 extern tbar
0
heinrichsweikamp
parents:
diff changeset
33
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
34 gaslist CODE
0
heinrichsweikamp
parents:
diff changeset
35
heinrichsweikamp
parents:
diff changeset
36 ;=============================================================================
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
37 ; Helper Functions for divemenu_tree.asm
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
38 ;
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
39 ; They need to be put in a different file than
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
40 ; where the MENU_DYNAMIC macros uses them.
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
41
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
42 global do_toggle_gf_label
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
43 do_toggle_gf_label:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
44 movff char_I_deco_model,WREG ; 0 = ZH-L16, 1 = ZH-L16-GF
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
45 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
46 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
47 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
48 decfsz WREG,W ; aGF enabled?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
49 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
50 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
51 do_toggle_gf_label_1:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
52 call TFT_disabled_color
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
53 do_toggle_gf_label_2:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
54 STRCAT_TEXT tDivemenu_ToggleGF
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
55 return
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
56
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
57
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
58 IFDEF _cave_mode
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
59 global do_turn_dive_label
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
60 do_turn_dive_label:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
61 btfss FLAG_cave_mode ; in cave mode?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
62 call TFT_disabled_color ; NO - print in disabled color
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
63 btfsc FLAG_dive_turned ; dive already turned?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
64 call TFT_attention_color ; YES - print in attention color
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
65 STRCAT_TEXT tDivemenu_TurnDive ; output label
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
66 return
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
67 ENDIF
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
68
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
69
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
70 global do_toggle_max_pres_diff_label
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
71 do_toggle_max_pres_diff_label:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
72 movff opt_TR_mode,WREG ; get TR mode
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
73 xorlw .2 ; compare with 2 (ind.double)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
74 tstfsz WREG ; equal?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
75 call TFT_disabled_color ; NO - print in disabled color
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
76 STRCAT_TEXT tTrMaxDeltaP ; output label
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
77 movff char_I_max_pres_diff,lo
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
78 output_99
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
79 STRCAT_TEXT tbar ; " bar"
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
80 return
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
81
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
82 global gaslist_copy_dil_to_oc
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
83 gaslist_copy_dil_to_oc:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
84 ;
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
85 ; Memory Map:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
86 ; -----------------------------------------
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
87 ; opt_gas_O2_ratio res 5
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
88 ; opt_dil_O2_ratio res 5
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
89 ; opt_gas_He_ratio res 5
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
90 ; opt_dil_He_ratio res 5
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
91 ; opt_gas_type res 5
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
92 ; opt_dil_type res 5
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
93 ; opt_gas_change res 5
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
94 ; opt_dil_change res 5
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
95 ;
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
96 ; char_I_tank_size res 10
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
97 ; char_I_tank_pres_fill res 10
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
98 ;
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
99 bcf aux_flag ; clear aux_flag by default
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
100 movf gaslist_gas,W ; copy current gas or diluent number to WREG
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
101 btfss FLAG_diluent_setup ; in CCR menus?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
102 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
103 addlw -.5 ; YES - subtract offset between diluents and gases
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
104 movwf gaslist_gas ; - let gaslist_gas point to the corresponding OC gas
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
105 bsf aux_flag ; - remember we came from a CCR menu
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
106 bcf FLAG_diluent_setup ; - pretend we came from an OC gas menu
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
107 gaslist_copy_dil_to_oc_1:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
108 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
109 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
110 movff PLUSW0,PLUSW1 ; copy O2 ratio
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
111 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
112 movff PLUSW0,PLUSW1 ; copy He ratio
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
113 addlw .10 ; add offset from He ratios to types
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
114 movff PLUSW0,PLUSW1 ; copy type
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
115 addlw .10 ; add offset from type to change depth
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
116 movff PLUSW0,PLUSW1 ; copy change depth
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
117 addlw -.30 ; wind back to initial gas number
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
118 lfsr FSR0,char_I_tank_size+5 ; load base address of diluents settings, shared variables
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
119 lfsr FSR1,char_I_tank_size+0 ; load base address of gas settings, shared variables
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
120 movff PLUSW0,PLUSW1 ; copy tank size
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
121 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
122 movff PLUSW0,PLUSW1 ; copy pressure budget
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
123 call gaslist_cleanup_list ; make sure that there will be just one first gas
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
124 btfss aux_flag ; did we came from a CCR menu?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
125 return ; NO - done
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
126 bsf FLAG_diluent_setup ; YES - restore proper origin again
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
127 movlw .5 ; - offset between OC gases and diluents
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
128 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
129 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
130 WAITMS .200 ; - pause for 200 ms
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
131 return ; - done
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
132
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
133
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
134 ;=============================================================================
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
135 ; Append gas description to current string
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
136 ;
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
137 ; Input: PRODL : gas number (0..4)
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
138 ; FSR2 : Current string position
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
139 ; Output: Text appended into buffer pointed by FSR2
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
140
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
141 global gaslist_strcat_gas
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
142 global gaslist_strcat_gas_WREG
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
143 gaslist_strcat_gas: ; entry point with gas/dil in PRODL (0-4) and FLAG_diluent_setup
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
144 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
145 movlw .5 ; offset between gases and diluents
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
146 btfsc FLAG_diluent_setup ; in CCR menus?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
147 addwf gaslist_gas,F ; YES - add the offset
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
148 movf gaslist_gas,W ; copy to WREG
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
149 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
150 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
151 movff PLUSW1,lo ; read O2 ratio
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
152 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
153 movff PLUSW1,hi ; read He ratio
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
154 goto customview_show_mix ; put "Nxlo", "Txlo/hi", "Air" or "O2" into Postinc2, and RETURN
0
heinrichsweikamp
parents:
diff changeset
155
heinrichsweikamp
parents:
diff changeset
156 ;=============================================================================
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
157 ; Append current mix to current string (for divemode)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
158 ;
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
159 ; Input: FSR2 : Current string position
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
160 ; Output: Text appended into buffer pointed by FSR2
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
161
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
162 global gaslist_strcat_gas6
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
163 gaslist_strcat_gas6: ; show current O2/He mix
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
164 STRCAT_TEXT tGas
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
165 STRCAT ": "
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
166 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
167 call TFT_color_code_gaslist ; color-code according to O2 ratio and depth
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
168 movff gas6_O2_ratio,lo ; customview_show_mix needs O2 ratio in lo
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
169 movff gas6_He_ratio,hi ; ... and He ratio in hi
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
170 goto customview_show_mix ; put "Nxlo", "Txlo/hi", "Air" or "O2" into Postinc2, and return
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
171 ;=============================================================================
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
172 ; Helper functions for menu_tree
0
heinrichsweikamp
parents:
diff changeset
173
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
174 global gaslist_GasDepth
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
175 gaslist_GasDepth:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
176 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
177 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
178 tstfsz PLUSW1 ; change depth = 0 ?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
179 bra gaslist_GasDepth_1 ; NO
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
180 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
181 tstfsz PLUSW1 ; - type = disabled ?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
182 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
183 gaslist_GasDepth_1:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
184 STRCAT_TEXT tSetup_GasDepth
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
185 return
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
186
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
187 global gaslist_show_type
0
heinrichsweikamp
parents:
diff changeset
188 gaslist_show_type:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
189 movf gaslist_gas,W
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
190 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
191 movff PLUSW1,lo ; read gas type
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
192 STRCAT_TEXT tType
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
193 lfsr FSR1,tGasDisabled ; load base address of gas type labels
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
194 btfsc FLAG_diluent_setup ; in CCR setup?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
195 lfsr FSR1,tDilDisabled ; YES - load base address of diluent type labels
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
196 movff lo,WREG ; 0-3
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
197 rlncf WREG ; x2
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
198 addwf FSR1L,F ; adjust address pointer to required text
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
199 movlw .0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
200 addwfc FSR1H,F
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
201 call strcat_text ; copy label text
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
202 return
0
heinrichsweikamp
parents:
diff changeset
203
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
204
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
205 global gaslist_toggle_type
0
heinrichsweikamp
parents:
diff changeset
206 gaslist_toggle_type:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
207 movf gaslist_gas,W
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
208 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
209 movff PLUSW1,lo ; read gas type
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
210 incf lo,F ; increment type
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
211 btfsc FLAG_diluent_setup ; in CCR setup?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
212 bra gaslist_toggle_type2 ; YES - diluents
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
213 btfsc lo,2 ; NO - gases, type index > 3 ?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
214 clrf lo ; YES - clear to zero
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
215 movff lo,PLUSW1 ; - copy back result
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
216 return
0
heinrichsweikamp
parents:
diff changeset
217 gaslist_toggle_type2:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
218 movlw .3
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
219 cpfslt lo ; index > 2 ?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
220 clrf lo ; YES - clear to zero
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
221 movf gaslist_gas,W ; restore gaslist_gas in WREG
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
222 movff lo,PLUSW1 ; copy back result
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
223 return
0
heinrichsweikamp
parents:
diff changeset
224
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
225
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
226 global gaslist_strcat_setpoint
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
227 global gaslist_strcat_setpoint_0
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
228 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
229 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
230 gaslist_strcat_setpoint_0: ; entry point with setpoint index in gaslist_gas
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
231 bsf leftbind
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
232 btfsc short_gas_decriptions ; shall use short versions of gaslist_strcat_setpoint?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
233 bra gaslist_strcat_setpoint2 ; YES - use short version
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
234 STRCAT_TEXT tSP ; "SP"
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
235 incf gaslist_gas,W ; (0-4) -> (1-5) into WREG
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
236 movwf lo
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
237 output_8 ; print SP number
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
238 bcf leftbind
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
239 PUTC ":"
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
240 gaslist_strcat_setpoint2: ; short version
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
241 btfsc divemode
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
242 bra gaslist_strcat_setpoint4 ; no "*" in divemode
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
243 movf gaslist_gas,W ; (0-4) into WREG
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
244 bnz gaslist_strcat_setpoint3 ; SP index = 0 ?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
245 PUTC "*" ; YES - print *
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
246 bra gaslist_strcat_setpoint4 ; - continue with cbar value
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
247 gaslist_strcat_setpoint3: ; NO
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
248 PUTC " " ; - print a space
0
heinrichsweikamp
parents:
diff changeset
249 gaslist_strcat_setpoint4:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
250 movf gaslist_gas,W ; (0-4) into WREG
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
251 lfsr FSR1,char_I_setpoint_cbar ; load base address of setpoint cbar values
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
252 movf PLUSW1,W ; read cbar value
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
253 movwf lo
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
254 clrf hi
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
255 bsf leftbind
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
256 output_16dp d'3' ; print as X.XX
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
257 btfsc divemode ; in divemode?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
258 bra gaslist_strcat_setpoint5 ; YES - skip text in divemode
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
259 STRCAT_TEXT tbar ; NO - print "bar"
0
heinrichsweikamp
parents:
diff changeset
260 gaslist_strcat_setpoint5:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
261 PUTC " " ; print a space
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
262 movf gaslist_gas,W ; (0-4) into WREG
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
263 lfsr FSR1,char_I_setpoint_change ; load base address of switch depths
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
264 movff PLUSW1,lo ; read switch depth into lo
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
265 bra gaslist_strcat_depth ; print depth in meters or ft
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
266
0
heinrichsweikamp
parents:
diff changeset
267
heinrichsweikamp
parents:
diff changeset
268 ;----------------------------------------------------------------------------
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
269 ; Append gas description to current string
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
270 ;
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
271 ; 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
272 ; including fancy color-coding
0
heinrichsweikamp
parents:
diff changeset
273 ;
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
274 ; Input: PRODL gas number (0..4)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
275 ; FSR2 current string position
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
276 ; Output: text appended to buffer pointed by FSR2
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
277 ;
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
278 ; NOTE: used in the menu-tree for the MENU_CALLBACK entry
0
heinrichsweikamp
parents:
diff changeset
279
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
280 global gaslist_strcat_gas_cd
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
281 global gaslist_gastitle
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
282 gaslist_strcat_gas_cd: ; entry point with gas in PRODL (0-4) and usage of FLAG_diluent_setup
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
283 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
284 movlw .5 ; offset between gases and diluents
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
285 btfsc FLAG_diluent_setup ; in diluent menus?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
286 addwf gaslist_gas,F ; YES - add the offset
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
287 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
288 bcf win_invert ; clear flag for inverted output by default
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
289 btfsc short_gas_decriptions ; shall use short versions of gaslist_strcat_gas_cd?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
290 bra gaslist_gastitle1 ; YES - use short version
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
291 incf gaslist_gas,W ; (0-9) -> (1-10) into WREG
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
292 movwf lo
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
293 movlw .6 ; diluents start with 6
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
294 cpfslt lo ; gas number < 6 ?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
295 bra gaslist_gastitle_dil ; NO - it's a diluent
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
296 STRCAT_TEXT tGas ; YES - it's a gas
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
297 bra gaslist_gastitle0
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
298 gaslist_gastitle_dil:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
299 STRCAT_TEXT tDil
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
300 movlw .5 ; offset between gases and diluents
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
301 subwf lo,F ; subtract offset from diluent number (6-10) -> (1-5)
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
302 gaslist_gastitle0:
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
303 bsf leftbind
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
304 output_8 ; print gas/dil number (1-5)
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
305 bcf leftbind
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
306 PUTC ":"
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
307 gaslist_gastitle1: ; short version of gaslist_strcat_gas_cd
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
308 btfsc divemode ; in divemode?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
309 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
310
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
311 IFDEF _rx_functions
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
312 btfss FLAG_tr_enabled ; NO - TR functions enabled?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
313 bra gaslist_gastitle2 ; NO - continue with gas type
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
314 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
315 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
316 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
317 tstfsz PLUSW1 ; - transmitter ID low byte <> 0 ?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
318 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
319 incf WREG,W ; - increment index
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
320 tstfsz PLUSW1 ; - transmitter ID high byte <> 0 ?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
321 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
322 ENDIF
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
323
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
324 gaslist_gastitle2:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
325 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
326 gaslist_gastitle3:
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
327 call TFT_standard_color
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
328 btfsc divemode ; in divemode?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
329 rcall gaslist_strcat_gas_better ; YES - check if this is a "better gas"
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
330 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
331 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
332 movf PLUSW1,W ; read gas/dil type into WREG
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
333 bnz gaslist_gastitle4 ; type = disabled? NO - keep color
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
334 call TFT_disabled_color ; YES - switch color to disabled
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
335 bra gaslist_gastitle5 ; - skip ppO2 check for disabled gases
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
336 gaslist_gastitle4:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
337 btfss divemode ; in divemode?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
338 bra gaslist_gastitle5 ; NO - no ppO2 check if not in divemode
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
339 lfsr FSR1,opt_gas_O2_ratio ; YES - load base address of opt_gas_O2_ratio
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
340 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
341 movff PLUSW1,hi ; - read O2 ratio into hi
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
342 call TFT_color_code_gaslist ; - set color according to ppO2 limits
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
343 gaslist_gastitle5:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
344 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
345 rcall gaslist_strcat_gas_WREG ; print gas composition
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
346 btfss divemode ; in divemode?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
347 bra gaslist_gastitle6 ; NO - continue printing a space
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
348 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
349 bra gaslist_gastitle7 ; - continue with change depth
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
350 gaslist_gastitle6:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
351 PUTC " " ; print a space
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
352 gaslist_gastitle7:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
353 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
354 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
355 movff PLUSW1,lo ; read change depth into lo
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
356 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
357 TSTOSS opt_units ; check depth units
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
358 bra gaslist_strcat_depth_metric ; 0 - use Meters
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
359 gaslist_strcat_depth_imperial: ; 1 - use Feet
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
360 movf lo,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
361 mullw .100 ; convert meters to mbar
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
362 movff PRODL,lo
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
363 movff PRODH,hi
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
364 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
365 ;bsf leftbind
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
366 output_16_3 ; limit to 999 and display only 0-999
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
367 STRCAT_TEXT tFeets ; append "ft" REMARK: still one char to long for space available in divemode menu!
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
368 return
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
369 gaslist_strcat_depth_metric:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
370 PUTC " " ; print a space
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
371 output_99
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
372 STRCAT_TEXT tMeters ; "m"
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
373 return
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
374
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
375 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
376 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
377 return ; NO - return
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
378 movf best_gas_number,W ; get best gas number into WREG
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
379 btfsc FLAG_diluent_setup ; in CCR (pSCR) menus?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
380 movf best_dil_number,W ; YES - overwrite with best diluent number
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
381 tstfsz WREG ; is a best gas/dil available?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
382 bra gaslist_strcat_gas_better1 ; YES - proceed
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
383 return ; NO - return
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
384 gaslist_strcat_gas_better1:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
385 decf WREG,W ; (1-5) -> (0-4)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
386 btfsc FLAG_diluent_setup ; in diluent menus?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
387 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
388 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
389 return ; not equal - return
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
390 bsf win_invert ; equal - invert
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
391 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
392 goto TFT_set_color ; - activate color and return
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
393
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
394 gaslist_strcat_gas_type:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
395 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
396 movf gaslist_gas,W ; load index to WREG (0-4 for gases, 5-9 for diluents)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
397 decf PLUSW1,W ; read gas/dil type into WREG and...
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
398 ; ...decrement by 1 (-1 for disabled, 0 for first, 1 for travel/normal, 2 for deco)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
399 bnz gaslist_strcat_gas_type_1 ; type = first? NO - continue with checking for deco gas
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
400 PUTC "*" ; YES - print "*" for first
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
401 return ; - done
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
402 gaslist_strcat_gas_type_1:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
403 decf WREG,W ; decrement gas type (-2 for disabled, -1 for first, 0 for travel/normal, 1 for deco)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
404 decf WREG,W ; decrement gas type (-3 for disabled, -2 for first, -1 for travel/normal, 0 for deco)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
405 bnz gaslist_strcat_gas_type_2 ; type = deco? NO - neither first nor deco
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
406 PUTC "=" ; YES - print "=" for a deco gas
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
407 return ; - done
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
408 gaslist_strcat_gas_type_2:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
409 PUTC " " ; neither first nor deco, print a space
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
410 return
0
heinrichsweikamp
parents:
diff changeset
411
heinrichsweikamp
parents:
diff changeset
412 ;----------------------------------------------------------------------------
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
413 ; 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
414 ;
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
415 ; Input: gaslist_gas last edited gas/dil (0-9)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
416
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
417 global gaslist_cleanup_list
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
418 gaslist_cleanup_list:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
419 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
420 movlw .5 ; offset between gases and diluents
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
421 btfsc FLAG_diluent_setup ; in CCR-Menu?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
422 subwf gaslist_gas,F ; YES - subtract offset from gaslist_gas: (5-9) -> (0-4)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
423 gaslist_cleanup_list0:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
424 bcf ignore_last_edited_gas
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
425 gaslist_cleanup_list1:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
426 clrf lo ; counter for number of "firsts" found
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
427 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
428 movwf hi
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
429 gaslist_cleanup_list2: ; loop body
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
430 decf hi,W ; WREG = current gas/dil (0-4)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
431 btfsc FLAG_diluent_setup ; in CCR-Menu?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
432 addlw .5 ; YES - add offset from gases to diluents -> (5-9)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
433 movff PLUSW1,WREG ; read type into WREG
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
434 decfsz WREG ; is type = first (ex type code 1)?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
435 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
436 incf lo,F ; YES - increment number of "firsts" found
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
437 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
438 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
439 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
440 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
441 gaslist_cleanup_list2b:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
442 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
443 gaslist_cleanup_list3:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
444 decfsz hi,F ; decrement loop counter
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
445 bra gaslist_cleanup_list2 ; loop counter became 0 ? NO - loop
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
446 tstfsz lo ; YES - any first gas/dil at all?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
447 bra gaslist_cleanup_list4 ; YES - at least one first gas/dil existing
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
448 btfsc FLAG_diluent_setup ; NO - in CCR-Menu?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
449 lfsr FSR1,opt_dil_type ; YES - load base address of opt_gas_type
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
450 movlw .1 ; - load coding for first gas
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
451 movwf INDF1 ; - make gas/dil 1 the first gas
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
452 return ; - done
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
453 gaslist_cleanup_list4:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
454 movlw .1
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
455 cpfsgt lo ; more then one "first gas" found?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
456 return ; NO - done
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
457 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
458 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
459 bra gaslist_cleanup_list4b ; NO - disable it
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
460 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
461 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
462 gaslist_cleanup_list4b:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
463 btfsc FLAG_diluent_setup ; in CCR-Menu?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
464 addlw .5 ; YES - adjust offset
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
465 clrf PLUSW1 ; disable gas
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
466 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
467 return
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
468
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
469 ;----------------------------------------------------------------------------
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
470 ; Tank Settings
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
471 ;
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
472 ; Inputs: char_I_tank_size size of the tank, using unit text tLiter ("l")
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
473 ; char_I_tank_pres_fill fill pressure in multiples of 10 bar, using unit text tbar10 ("0 bar")
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
474
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
475 global gaslist_tank_size_pres
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
476 gaslist_tank_size_pres: ; dynamic title: xx l, xx0 bar
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
477 lfsr FSR1,char_I_tank_size ; load base address of char_I_tank_size
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
478 movf gaslist_gas,W ; load index (0-9)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
479 movff PLUSW1,lo ; read char_I_tank_size[WREG] into lo
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
480 lfsr FSR1,char_I_tank_pres_fill ; load base address of char_I_tank_pres_fill
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
481 movff PLUSW1,hi ; read char_I_tank_pres_fill[WREG] into hi
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
482 STRCAT " " ; print 5 leading spaces for alignment
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
483 output_8 ; print tank size
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
484 STRCAT_TEXT tLiter ; print unit (" l")
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
485 movff hi,lo ; copy fill pressure into lo
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
486 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
487 STRCAT_TEXT tbar10 ; print unit ("0 bar")
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
488 return
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
489
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
490 global gaslist_tank_size
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
491 gaslist_tank_size: ; adjust char_I_tank_size between min_tank_size and max_tank_size
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
492 lfsr FSR1,char_I_tank_size ; load base address of char_I_tank_size
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
493 movf gaslist_gas,W ; load index (0-9)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
494 movff PLUSW1,lo ; read char_I_tank_size[WREG] into lo
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
495 incf lo,F ; increment tank size by 1 liter
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
496 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
497 cpfsgt lo ; tank size <= max value?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
498 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
499 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
500 movwf lo ; - and write to lo
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
501 gaslist_tank_size_1:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
502 movf gaslist_gas,W ; re-load index
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
503 movff lo,PLUSW1 ; write back tank size to char_I_tank_size[WREG]
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
504 return
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
505
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
506 global gaslist_tank_pres
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
507 gaslist_tank_pres: ; adjust char_I_tank_pres_fill between 5(0) and 29(0) bar
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
508 lfsr FSR1,char_I_tank_pres_fill ; load base address of char_I_tank_pres_fill
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
509 movf gaslist_gas,W ; load index (0-9)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
510 movff PLUSW1,lo ; read char_I_tank_pres_fill[WREG] into lo
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
511 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
512 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
513 cpfsgt lo ; press <= max value?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
514 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
515 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
516 movwf lo ; - and write to lo
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
517 gaslist_tank_pres_1:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
518 movf gaslist_gas,W ; re-load index
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
519 movff lo,PLUSW1 ; write back tank size to char_I_tank_pres_fill[WREG]
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
520 return
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
521
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
522 ;----------------------------------------------------------------------------
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
523 ; Transmitter functions
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
524
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
525 IFDEF _rx_functions
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
526
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
527 global gaslist_tank_id_pres
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
528 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
529 ; 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
530 STRCAT " ID: " ; print header
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
531 ; get ID ;
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
532 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
533 movf gaslist_gas,W ; load index (0-9)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
534 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
535 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
536 incf WREG,W ; increment index
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
537 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
538 ; check if a transmitter is paired to this tank
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
539 tstfsz hi ; high byte of ID <> 0 ?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
540 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
541 tstfsz lo ; low byte of ID <> 0 ?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
542 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
543 ; no transmitter paired
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
544 STRCAT "----" ;
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
545 bcf menu_update_tank_pres ; stop imprinting of tank pressure updates
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
546 return
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
547 gaslist_tank_id_pres_1:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
548 ; show ID
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
549 movf hi,W ; copy high byte of ID to WREG
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
550 output_hex ; print it
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
551 movf lo,W ; copy low byte of ID to WREG
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
552 output_hex ; print it
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
553 bsf menu_update_tank_pres ; start imprinting of tank pressure updates
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
554 return
0
heinrichsweikamp
parents:
diff changeset
555
heinrichsweikamp
parents:
diff changeset
556
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
557 global gaslist_tank_pairing
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
558 gaslist_tank_pairing:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
559 incf pairing_slot,F ; goto next RX data slot
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
560 btfsc pairing_slot,3 ; slot = 8?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
561 bra gaslist_tank_pairing_none ; YES - offer unpairing
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
562 movf pairing_slot,W ; NO - copy slot to WREG
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
563 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
564 tstfsz hi ; transmitter found (probe on high byte)?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
565 bra gaslist_tank_pairing_common ; YES - select this transmitter
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
566 tstfsz hi ; transmitter found (probe on low byte)?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
567 bra gaslist_tank_pairing_common ; YES - select this transmitter
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
568 bra gaslist_tank_pairing ; NO - try next slot
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
569 gaslist_tank_pairing_common:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
570 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
571 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
572 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
573 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
574 incf WREG,W ; increment index
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
575 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
576 return ; done
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
577 gaslist_tank_pairing_none:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
578 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
579 clrf hi ; adjust "no transmitter" ID
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
580 clrf lo ; adjust "no transmitter" ID
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
581 bra gaslist_tank_pairing_common ; continue with common part
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
582
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
583 ENDIF
0
heinrichsweikamp
parents:
diff changeset
584
heinrichsweikamp
parents:
diff changeset
585 ;----------------------------------------------------------------------------
heinrichsweikamp
parents:
diff changeset
586 ; Increment/Decrement O2 ratio
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
587
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
588 global gaslist_pO2
0
heinrichsweikamp
parents:
diff changeset
589 gaslist_pO2:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
590 movf gaslist_gas,W ; load index (0-9)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
591 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
592 movff PLUSW1,hi ; read He ratio into hi
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
593 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
594 movff PLUSW1,lo ; read O2 ratio into lo
0
heinrichsweikamp
parents:
diff changeset
595
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
596 incf lo,F ; O2++
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
597 movf hi,W ; get He ratio into WREG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
598 addwf lo,W ; add O2 ratio to WREG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
599 movwf up ; move sum He + O2 to up
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
600 movlw .101 ;
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
601 cpfslt up ; O2 + He < 101?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
602 decf lo,F ; O2-- (revoke ++)
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
603 movf gaslist_gas,W ; re-load index
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
604 movff lo,PLUSW1 ; write back O2 ratio to opt_gas_O2_ratio[WREG]
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
605 return
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
606
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
607 global gaslist_mO2
0
heinrichsweikamp
parents:
diff changeset
608 gaslist_mO2:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
609 movf gaslist_gas,W ; load index (0-9)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
610 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
611 movff PLUSW1,lo ; read O2 ratio into lo
0
heinrichsweikamp
parents:
diff changeset
612
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
613 decf lo,F ; O2--
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
614 movlw gaslist_min_o2 ; get minimum allowed O2 ratio
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
615 cpfslt lo ; current O2 ratio below allowed minimum?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
616 bra gaslist_mO2_1 ; NO
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
617 movwf lo ; YES - copy minimum O2 ratio to lo
0
heinrichsweikamp
parents:
diff changeset
618 gaslist_mO2_1:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
619 movf gaslist_gas,W ; re-load index
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
620 movff lo,PLUSW1 ; write back O2 ratio to opt_gas_O2_ratio[WREG]
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
621 return
0
heinrichsweikamp
parents:
diff changeset
622
heinrichsweikamp
parents:
diff changeset
623 ;----------------------------------------------------------------------------
heinrichsweikamp
parents:
diff changeset
624 ; Increment/Decrement He ratio
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
625
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
626 global gaslist_pHe
0
heinrichsweikamp
parents:
diff changeset
627 gaslist_pHe:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
628 movf gaslist_gas,W ; load index (0-9)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
629 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
630 movff PLUSW1,lo ; read O2 ratio into lo
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
631 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
632 movff PLUSW1,hi ; read He ratio into hi
0
heinrichsweikamp
parents:
diff changeset
633
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
634 incf hi,F ; He++
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
635 movf hi,W ; get He ratio into WREG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
636 addwf lo,W ; add O2 ratio to WREG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
637 movwf up ; move sum He + O2 to up
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
638 movlw .101 ;
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
639 cpfslt up ; O2 + He < 101?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
640 decf hi,F ; He-- (revoke ++)
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
641 movf gaslist_gas,W ; re-load index
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
642 movff hi,PLUSW1 ; write back He ratio to opt_gas_He_ratio[WREG]
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
643 return
0
heinrichsweikamp
parents:
diff changeset
644
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
645 global gaslist_mHe
0
heinrichsweikamp
parents:
diff changeset
646 gaslist_mHe:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
647 movf gaslist_gas,W ; load index (0-9)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
648 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
649 movff PLUSW1,hi ; read He ratio into hi
0
heinrichsweikamp
parents:
diff changeset
650
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
651 decf hi,F ; He--
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
652 bnn gaslist_mHe_1 ; He ratio negative?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
653 clrf hi ; YES - set He ratio to 0
0
heinrichsweikamp
parents:
diff changeset
654 gaslist_mHe_1:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
655 movf gaslist_gas,W ; re-load index
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
656 movff hi,PLUSW1 ; write back He ratio to opt_gas_He_ratio[WREG]
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
657 return
0
heinrichsweikamp
parents:
diff changeset
658
heinrichsweikamp
parents:
diff changeset
659 ;----------------------------------------------------------------------------
heinrichsweikamp
parents:
diff changeset
660 ; Increment/Decrement switch depth
heinrichsweikamp
parents:
diff changeset
661
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
662 global gaslist_pDepth
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
663 gaslist_pDepth:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
664 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
665 movf gaslist_gas,W ; load index (0-4)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
666 movff PLUSW1,lo ; read switch depth into lo
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
667 incf lo,F ; increment switch depth
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
668 movlw gaslist_max_change_depth ; get max change depth
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
669 cpfsgt lo ; above max change depth?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
670 bra gaslist_pDepth_1 ; NO
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
671 movwf lo ; YES - revert to max change depth
0
heinrichsweikamp
parents:
diff changeset
672 gaslist_pDepth_1:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
673 movf gaslist_gas,W ; re-load index
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
674 movff lo,PLUSW1 ; write back switch depth
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
675 return
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
676
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
677 global gaslist_mDepth
0
heinrichsweikamp
parents:
diff changeset
678 gaslist_mDepth:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
679 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
680 movf gaslist_gas,W ; load index (0-4)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
681 movff PLUSW1,lo ; read switch depth into lo
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
682 decf lo,F ; decrement switch depth
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
683 btfsc STATUS,N ; did depth became negative?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
684 clrf lo ; YES - reset to zero
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
685 movff lo,PLUSW1 ; write back switch depth
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
686 return
0
heinrichsweikamp
parents:
diff changeset
687
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
688 global gaslist_spplus
0
heinrichsweikamp
parents:
diff changeset
689 gaslist_spplus:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
690 movf gaslist_gas,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
691 lfsr FSR1,char_I_setpoint_cbar
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
692 movff PLUSW1,lo ; read setpoint
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
693 movlw gaslist_sp_stepsize
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
694 addwf lo,F
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
695 movlw gaslist_sp_max
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
696 cpfsgt lo
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
697 bra gaslist_spplus2
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
698 movlw gaslist_sp_min
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
699 movwf lo
0
heinrichsweikamp
parents:
diff changeset
700 gaslist_spplus2:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
701 movf gaslist_gas,W
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
702 movff lo,PLUSW1 ; write back setpoint
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
703 return
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
704
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
705 global gaslist_spdepthplus
0
heinrichsweikamp
parents:
diff changeset
706 gaslist_spdepthplus:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
707 movf gaslist_gas,W ; get setpoint number (0-4)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
708 bz gaslist_spdepthplus2 ; setpoint number = 0? YES - force depth to always be 0m
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
709 lfsr FSR1,char_I_setpoint_change ; load base address of char_I_setpoint_change
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
710 movff PLUSW1,lo ; read setpoint depth into lo
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
711 incf lo,F ; increment depth
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
712 movlw gaslist_max_change_depth ; get max. depth
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
713 cpfsgt lo ; switch depth > max. depth?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
714 bra gaslist_spdepthplus_1 ; NO
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
715 movwf lo ; YES - copy to lo
0
heinrichsweikamp
parents:
diff changeset
716 gaslist_spdepthplus_1:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
717 movf gaslist_gas,W ; re-load index
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
718 movff lo,PLUSW1 ; write back setpoint depth
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
719 return
0
heinrichsweikamp
parents:
diff changeset
720
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
721 global gaslist_spdepthminus
0
heinrichsweikamp
parents:
diff changeset
722 gaslist_spdepthminus:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
723 movf gaslist_gas,W ; get setpoint number (0-4)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
724 bz gaslist_spdepthminus2 ; setpoint number = 0? YES - force depth to always be 0m
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
725 lfsr FSR1,char_I_setpoint_change ; load base address of char_I_setpoint_change
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
726 movff PLUSW1,lo ; read setpoint depth into lo
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
727 decf lo,F ; decrement switch depth
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
728 btfsc STATUS,N ; did depth became negative?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
729 clrf lo ; YES - reset to zero
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
730 movff lo,PLUSW1 ; write back setpoint depth
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
731 return
0
heinrichsweikamp
parents:
diff changeset
732
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
733 gaslist_spdepthplus2:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
734 gaslist_spdepthminus2:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
735 movlw .0
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
736 movff WREG,char_I_setpoint_change+0 ; hard reset to 0m
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
737 return
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
738
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
739
0
heinrichsweikamp
parents:
diff changeset
740 ;----------------------------------------------------------------------------
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
741 ; Compute MOD from char_I_ppO2_max/char_I_ppO2_max_deco and current O2 ratio
0
heinrichsweikamp
parents:
diff changeset
742 ;
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
743 ; Input: gaslist_gas = current gas index.
0
heinrichsweikamp
parents:
diff changeset
744 ; opt_gas_O2_ratio[gaslist_gas] = current O2 ratio
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
745 ; Output: WREG = MOD [m]
0
heinrichsweikamp
parents:
diff changeset
746 ;
heinrichsweikamp
parents:
diff changeset
747 gaslist_calc_mod:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
748 movf gaslist_gas,W ; load index (0...9)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
749 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
750 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
751 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
752 movff PLUSW1,xA+0 ; read gas/dil type into xA+0 (used as temp here)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
753 movff char_I_ppO2_max_deco,xB+1 ; get max ppO2 for deco into xB+1 (used as temp here)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
754 movlw .3 ; type code for deco gases
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
755 cpfseq xA+0 ; is it a deco gas?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
756 movff char_I_ppO2_max,xB+1 ; NO - overwrite ppO2 max with none-deco max
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
757 movf xB+1,W ; copy resulting ppO2 max into WREG
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
758 clrf xB+1 ; clear xB+1 for div16x16 operation
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
759 mullw .10 ; multiply ppO2 max value with 10
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
760 movff PRODL,xA+0 ; copy result to xA
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
761 movff PRODH,xA+1
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
762 call div16x16 ; xC = xA / xB with xA as remainder
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
763 movf xC+0,W ; copy result to WREG
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
764 addlw -.10 ; subtract 10 cbar
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
765 return ; return with final result in WREG
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
766
0
heinrichsweikamp
parents:
diff changeset
767 ;----------------------------------------------------------------------------
154
afa31c815f24 NEW: Show ppO2 for change depth during gas setup
heinrichsweikamp
parents: 97
diff changeset
768
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
769 global gaslist_ppo2
154
afa31c815f24 NEW: Show ppO2 for change depth during gas setup
heinrichsweikamp
parents: 97
diff changeset
770 gaslist_ppo2:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
771 STRCAT_TEXT tppO2 ; ppO2:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
772 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
773 movf gaslist_gas,W ; load index (0-9)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
774 movf PLUSW1,W ; read change depth into WREG
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
775 mullw .10 ; PROD = depth in mbar/10 (100 = 1.00 bar)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
776 movlw .100 ; add 1 bar
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
777 addwf PRODL,F
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
778 movlw .0
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
779 addwfc PRODH,F
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
780 movff PRODL,xA+0 ; copy result to xA
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
781 movff PRODH,xA+1
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
782 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
783 movf gaslist_gas,W ; load index (0-9)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
784 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
785 clrf xB+1 ; clear xB+1
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
786 call mult16x16 ; calculate char_I_O2_ratio * (p_amb/10)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
787 movff xC+0,xA+0 ; copy result to xA
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
788 movff xC+1,xA+1
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
789 movlw d'100' ; load 100 to xB
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
790 movwf xB+0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
791 clrf xB+1
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
792 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
793 ; check for very high ppO2
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
794 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
795 bra gaslist_ppo2_1 ; YES - display a fixed max value
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
796 movff xC+0,lo ; copy result to lo, hi
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
797 movff xC+1,hi
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
798 bcf ignore_digit4
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
799 bsf leftbind
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
800 output_16dp d'3' ; print ppO2 as x.xx
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
801 STRCAT_TEXT tbar ; print "bar"
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
802 return
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
803 gaslist_ppo2_1:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
804 STRCAT ">6.6"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
805 return
154
afa31c815f24 NEW: Show ppO2 for change depth during gas setup
heinrichsweikamp
parents: 97
diff changeset
806
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
807 global gaslist_MOD_END
0
heinrichsweikamp
parents:
diff changeset
808 gaslist_MOD_END:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
809 STRCAT_TEXT tMOD ; print "MOD:"
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
810 rcall gaslist_calc_mod ; compute MOD into WREG
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
811 movwf lo ; copy result to lo
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
812 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
813 PUTC "/" ; print "/"
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
814 STRCAT_TEXT tEND ; print "END:"
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
815 rcall gaslist_calc_mod ; compute MOD into WREG
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
816 addlw .10 ; compute MOD = MOD + 10m
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
817 movwf xB+0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
818 clrf xB+1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
819 movlw d'100'
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
820 movwf xA+0
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
821 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
822 movf gaslist_gas,W ; load index (0...9)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
823 movf PLUSW1,W ; read He ration into WREG
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
824 subwf xA+0,F ; xA+0 = 100 - He ratio in %
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
825 clrf xA+1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
826 call mult16x16 ; xA*xB=xC
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
827 movff xC+0,xA+0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
828 movff xC+1,xA+1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
829 movlw d'100'
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
830 movwf xB+0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
831 clrf xB+1
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
832 call div16x16 ; xC = xA / xB with xA as remainder
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
833 ; ; 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
834 movlw d'10' ; subtract 10 m
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
835 subwf xC+0,F ; ...
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
836 movff xC+0,lo ; copy result to lo
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
837 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
838
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
839
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
840 global gaslist_reset_mod_title
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
841 gaslist_reset_mod_title:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
842 STRCAT_TEXT tDepthReset
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
843 rcall gaslist_calc_mod ; compute MOD into WREG
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
844 movwf lo ; copy result to lo
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
845 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
846 movf gaslist_gas,W ; load index (0-9)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
847 movf PLUSW1,W ; read change depth into WREG
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
848 cpfslt lo ; change depth > MOD ?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
849 bra gaslist_strcat_depth ; NO - return
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
850 call TFT_warnings_color ; YES - use red color
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
851 bra gaslist_strcat_depth ; - return
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
852
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
853
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
854 global gaslist_reset_mod
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
855 gaslist_reset_mod:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
856 rcall gaslist_calc_mod ; compute MOD into WREG
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
857 movwf lo ; copy result to lo
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
858 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
859 movf gaslist_gas,W ; load index (0-9)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
860 movff lo,PLUSW1 ; write back new change depth
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
861 return
0
heinrichsweikamp
parents:
diff changeset
862
heinrichsweikamp
parents:
diff changeset
863 ;----------------------------------------------------------------------------
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 560
diff changeset
864 END