Mercurial > public > mk2
comparison code_part1/OSTC_code_asm_part1/divemode.asm @ 627:8d2dc109ecfc
NEW: Gaslist highlights "better gas" in divemode
author | heinrichsweikamp |
---|---|
date | Sat, 11 Aug 2012 16:55:14 +0200 |
parents | bab5a9fc1b10 |
children | 6526a5b058b7 |
comparison
equal
deleted
inserted
replaced
626:bab5a9fc1b10 | 627:8d2dc109ecfc |
---|---|
1062 return ; done | 1062 return ; done |
1063 | 1063 |
1064 ;============================================================================= | 1064 ;============================================================================= |
1065 ; Compare all enabled gas in list, to see if a better one is available. | 1065 ; Compare all enabled gas in list, to see if a better one is available. |
1066 ; | 1066 ; |
1067 ; Output: better_gas_available | 1067 ; Output: better_gas_available, better_gas_number |
1068 ; | 1068 ; |
1069 check_gas_change: ; Checks if a better gas should be selected (by user) | 1069 check_gas_change: ; Checks if a better gas should be selected (by user) |
1070 bcf better_gas_available ;=1: A better gas is available and a gas change is advised in divemode | 1070 bcf better_gas_available ;=1: A better gas is available and a gas change is advised in divemode |
1071 | 1071 |
1072 SAFE_2BYTE_COPY rel_pressure,xA | 1072 SAFE_2BYTE_COPY rel_pressure,xA |
1088 cpfsgt EEDATA ; Change depth>minimum_change_depth? | 1088 cpfsgt EEDATA ; Change depth>minimum_change_depth? |
1089 bra check_gas_change2 ; No, Change depth not deep enough, skip! | 1089 bra check_gas_change2 ; No, Change depth not deep enough, skip! |
1090 movf xC+0,W ; load depth in m into WREG | 1090 movf xC+0,W ; load depth in m into WREG |
1091 cpfsgt EEDATA ; gas_change_depth < current depth? | 1091 cpfsgt EEDATA ; gas_change_depth < current depth? |
1092 bra check_gas_change2 ; No, check next gas | 1092 bra check_gas_change2 ; No, check next gas |
1093 movlw .1 | |
1094 movwf better_gas_number ; number (1-5) of the "better gas" in divemode, =0: no better gas available | |
1093 movlw better_gas_window | 1095 movlw better_gas_window |
1094 subwf EEDATA,W ; Change depth-better_gas_window | 1096 subwf EEDATA,W ; Change depth-better_gas_window |
1095 cpfslt xC+0 ; current depth<Change depth-better_gas_window? | 1097 cpfslt xC+0 ; current depth<Change depth-better_gas_window? |
1096 bsf better_gas_available ;=1: A better gas is available and a gas change is advised in divemode | 1098 bsf better_gas_available ;=1: A better gas is available and a gas change is advised in divemode |
1097 | 1099 |
1108 cpfsgt EEDATA ; Change depth>minimum_change_depth? | 1110 cpfsgt EEDATA ; Change depth>minimum_change_depth? |
1109 bra check_gas_change3 ; No, Change depth not deep enough, skip! | 1111 bra check_gas_change3 ; No, Change depth not deep enough, skip! |
1110 movf xC+0,W ; load depth in m into WREG | 1112 movf xC+0,W ; load depth in m into WREG |
1111 cpfsgt EEDATA ; gas_change_depth < current depth? | 1113 cpfsgt EEDATA ; gas_change_depth < current depth? |
1112 bra check_gas_change3 ; No, check next gas | 1114 bra check_gas_change3 ; No, check next gas |
1115 movlw .2 | |
1116 movwf better_gas_number ; number (1-5) of the "better gas" in divemode, =0: no better gas available | |
1113 movlw better_gas_window | 1117 movlw better_gas_window |
1114 subwf EEDATA,W ; Change depth-better_gas_window | 1118 subwf EEDATA,W ; Change depth-better_gas_window |
1115 cpfslt xC+0 ; current depth<Change depth-better_gas_window? | 1119 cpfslt xC+0 ; current depth<Change depth-better_gas_window? |
1116 bsf better_gas_available ;=1: A better gas is available and a gas change is advised in divemode | 1120 bsf better_gas_available ;=1: A better gas is available and a gas change is advised in divemode |
1117 | 1121 |
1128 cpfsgt EEDATA ; Change depth>minimum_change_depth? | 1132 cpfsgt EEDATA ; Change depth>minimum_change_depth? |
1129 bra check_gas_change4 ; No, Change depth not deep enough, skip! | 1133 bra check_gas_change4 ; No, Change depth not deep enough, skip! |
1130 movf xC+0,W ; load depth in m into WREG | 1134 movf xC+0,W ; load depth in m into WREG |
1131 cpfsgt EEDATA ; gas_change_depth < current depth? | 1135 cpfsgt EEDATA ; gas_change_depth < current depth? |
1132 bra check_gas_change4 ; No, check next gas | 1136 bra check_gas_change4 ; No, check next gas |
1137 movlw .3 | |
1138 movwf better_gas_number ; number (1-5) of the "better gas" in divemode, =0: no better gas available | |
1133 movlw better_gas_window | 1139 movlw better_gas_window |
1134 subwf EEDATA,W ; Change depth-better_gas_window | 1140 subwf EEDATA,W ; Change depth-better_gas_window |
1135 cpfslt xC+0 ; current depth<Change depth-better_gas_window? | 1141 cpfslt xC+0 ; current depth<Change depth-better_gas_window? |
1136 bsf better_gas_available ;=1: A better gas is available and a gas change is advised in divemode | 1142 bsf better_gas_available ;=1: A better gas is available and a gas change is advised in divemode |
1137 | 1143 |
1148 cpfsgt EEDATA ; Change depth>minimum_change_depth? | 1154 cpfsgt EEDATA ; Change depth>minimum_change_depth? |
1149 bra check_gas_change5 ; No, Change depth not deep enough, skip! | 1155 bra check_gas_change5 ; No, Change depth not deep enough, skip! |
1150 movf xC+0,W ; load depth in m into WREG | 1156 movf xC+0,W ; load depth in m into WREG |
1151 cpfsgt EEDATA ; gas_change_depth < current depth? | 1157 cpfsgt EEDATA ; gas_change_depth < current depth? |
1152 bra check_gas_change5 ; No, check next gas | 1158 bra check_gas_change5 ; No, check next gas |
1159 movlw .4 | |
1160 movwf better_gas_number ; number (1-5) of the "better gas" in divemode, =0: no better gas available | |
1153 movlw better_gas_window | 1161 movlw better_gas_window |
1154 subwf EEDATA,W ; Change depth-better_gas_window | 1162 subwf EEDATA,W ; Change depth-better_gas_window |
1155 cpfslt xC+0 ; current depth<Change depth-better_gas_window? | 1163 cpfslt xC+0 ; current depth<Change depth-better_gas_window? |
1156 bsf better_gas_available ;=1: A better gas is available and a gas change is advised in divemode | 1164 bsf better_gas_available ;=1: A better gas is available and a gas change is advised in divemode |
1157 | 1165 |
1168 cpfsgt EEDATA ; Change depth>minimum_change_depth? | 1176 cpfsgt EEDATA ; Change depth>minimum_change_depth? |
1169 bra check_gas_change6 ; No, Change depth not deep enough, skip! | 1177 bra check_gas_change6 ; No, Change depth not deep enough, skip! |
1170 movf xC+0,W ; load depth in m into WREG | 1178 movf xC+0,W ; load depth in m into WREG |
1171 cpfsgt EEDATA ; gas_change_depth < current depth? | 1179 cpfsgt EEDATA ; gas_change_depth < current depth? |
1172 bra check_gas_change6 ; No, check next gas | 1180 bra check_gas_change6 ; No, check next gas |
1181 movlw .5 | |
1182 movwf better_gas_number ; number (1-5) of the "better gas" in divemode, =0: no better gas available | |
1173 movlw better_gas_window | 1183 movlw better_gas_window |
1174 subwf EEDATA,W ; Change depth-better_gas_window | 1184 subwf EEDATA,W ; Change depth-better_gas_window |
1175 cpfslt xC+0 ; current depth<Change depth-better_gas_window? | 1185 cpfslt xC+0 ; current depth<Change depth-better_gas_window? |
1176 bsf better_gas_available ;=1: A better gas is available and a gas change is advised in divemode | 1186 bsf better_gas_available ;=1: A better gas is available and a gas change is advised in divemode |
1177 | 1187 |
1178 check_gas_change6: | 1188 check_gas_change6: |
1189 btfss better_gas_available ; Is a better gas available | |
1190 clrf better_gas_number ; No, clear better gas register | |
1191 | |
1179 btfsc is_bailout ;=1: CC mode, but bailout active! | 1192 btfsc is_bailout ;=1: CC mode, but bailout active! |
1180 bra check_gas_change7 ; In bailout, blink better gas (if required) | 1193 bra check_gas_change7 ; In bailout, blink better gas (if required) |
1181 | 1194 |
1182 btfsc FLAG_const_ppO2_mode ; in ppO2 mode? | 1195 btfsc FLAG_const_ppO2_mode ; in ppO2 mode? |
1183 bcf better_gas_available ; Yes, do not blink better gas | 1196 bcf better_gas_available ; Yes, do not blink better gas |
1900 | 1913 |
1901 bcf timeout_display | 1914 bcf timeout_display |
1902 bcf menu3_active | 1915 bcf menu3_active |
1903 clrf divesecs | 1916 clrf divesecs |
1904 clrf samplesecs | 1917 clrf samplesecs |
1918 clrf better_gas_number ; number (1-5) of the "better gas" in divemode, =0: no better gas available | |
1905 clrf apnoe_timeout_counter ; timeout in minutes | 1919 clrf apnoe_timeout_counter ; timeout in minutes |
1906 clrf timeout_counter ; takes care of the timeout (Low byte) | 1920 clrf timeout_counter ; takes care of the timeout (Low byte) |
1907 clrf timeout_counter2 ; takes care of the timeout (High byte) | 1921 clrf timeout_counter2 ; takes care of the timeout (High byte) |
1908 clrf AlarmType ; Clear all alarms | 1922 clrf AlarmType ; Clear all alarms |
1909 bcf event_occured ; clear flag | 1923 bcf event_occured ; clear flag |