comparison src/ghostwriter.asm @ 98:24b3fd59e61f

add event "bailout" in profile
author heinrichsweikamp
date Thu, 01 May 2014 21:16:31 +0200
parents 53a99a2dc6a1
children 87cc1adfe4da
comparison
equal deleted inserted replaced
97:53a99a2dc6a1 98:24b3fd59e61f
83 btfss event_occured ; Check global event flag 83 btfss event_occured ; Check global event flag
84 bra store_dive_data3 ; No Event 84 bra store_dive_data3 ; No Event
85 incf ProfileFlagByte,F ; add one byte (The EventByte) 85 incf ProfileFlagByte,F ; add one byte (The EventByte)
86 86
87 clrf EventByte ; reset EventByte 87 clrf EventByte ; reset EventByte
88 clrf EventByte2 ; reset EventByte2
88 89
89 movf AlarmType,W ; Type of Alarm Bit 0-3 90 movf AlarmType,W ; Type of Alarm Bit 0-3
90 addwf EventByte,F ; Copy to EventByte Bit 0-3 91 addwf EventByte,F ; Copy to EventByte Bit 0-3
91 clrf AlarmType ; Reset AlarmType 92 clrf AlarmType ; Reset AlarmType
92 93
107 bra check_event4 108 bra check_event4
108 movlw d'1' ; Information length 109 movlw d'1' ; Information length
109 addwf ProfileFlagByte,F ; add to ProfileFlagByte 110 addwf ProfileFlagByte,F ; add to ProfileFlagByte
110 bsf EventByte,6 ; Also set Flag in EventByte! 111 bsf EventByte,6 ; Also set Flag in EventByte!
111 check_event4: 112 check_event4:
113 btfss bailoutgas_event ; =1: bailout was selected or a gaschange during bailout
114 bra check_event5
115 movlw d'2' ; Information length
116 addwf ProfileFlagByte,F ; add to ProfileFlagByte
117 bsf EventByte2,0 ; set flag in EventByte2!
118 bsf EventByte,7 ; =1: Another Eventbyte is available
119
120 check_event5:
112 ; more events? 121 ; more events?
113 bsf ProfileFlagByte,7 ; Set EventByte Flag in ProfileFlagByte
114 122
115 store_dive_data3: 123 store_dive_data3:
116 movf ProfileFlagByte,W ; finally, write ProfileFlagByte! 124 btfsc EventByte,7 ; =1: Another Eventbyte is available
117 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. Flash 125 incf ProfileFlagByte,F ; add one byte (The EventByte2)
118 126
119 btfss event_occured ; Check global event flag (again) 127 btfsc event_occured ; Check global event flag
120 bra store_dive_data4 ; No Event 128 bsf ProfileFlagByte,7 ; Set EventByte Flag in ProfileFlagByte
121 129
122 ; Store the EventByte + additional bytes now 130 movf ProfileFlagByte,W ; finally, write ProfileFlagByte!
131 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. Flash
132
133 btfss event_occured ; Check global event flag (again)
134 bra store_dive_data4 ; No Event
135
136 ; Store the EventByte(s) + additional bytes now
123 movf EventByte,W 137 movf EventByte,W
124 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. Flash 138 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. Flash
139
140 movf EventByte2,W ; Write second event byte...
141 btfsc EventByte,7 ; =1: Another Eventbyte is available
142 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. Flash
125 143
126 btfss gas6_changed ; Check flag 144 btfss gas6_changed ; Check flag
127 bra store_dive_data3b 145 bra store_dive_data3b
128 movff char_I_O2_ratio,WREG 146 movff char_I_O2_ratio,WREG
129 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. Flash 147 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. Flash
141 bra store_dive_data3d 159 bra store_dive_data3d
142 movff char_I_const_ppO2,WREG 160 movff char_I_const_ppO2,WREG
143 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. Flash 161 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. Flash
144 bcf setpoint_changed ; Clear this event 162 bcf setpoint_changed ; Clear this event
145 store_dive_data3d: 163 store_dive_data3d:
164 btfss bailoutgas_event ; Check flag
165 bra store_dive_data3e
166 movff char_I_O2_ratio,WREG
167 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. Flash
168 movff char_I_He_ratio,WREG
169 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. Flash
170 bcf bailoutgas_event ; Clear this event
171 store_dive_data3e:
146 172
147 store_dive_data4: 173 store_dive_data4:
148 174
149 ; Store extended informations 175 ; Store extended informations
150 decfsz divisor_temperature,F ; Check divisor 176 decfsz divisor_temperature,F ; Check divisor
192 btfsc divisor_tank,7 218 btfsc divisor_tank,7
193 clrf divisor_tank 219 clrf divisor_tank
194 220
195 store_dive_data5: 221 store_dive_data5:
196 bcf event_occured ; Clear the global event flag 222 bcf event_occured ; Clear the global event flag
223 bcf event2_occured ; Clear the global event2 flag
197 return ; Done. (Sample with all informations written to external flash) 224 return ; Done. (Sample with all informations written to external flash)
198 225
199 store_dive_cns: 226 store_dive_cns:
200 movff int_O_CNS_fraction+0,WREG 227 movff int_O_CNS_fraction+0,WREG
201 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. Flash 228 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. Flash