Mercurial > public > hwos_code
annotate src/ghostwriter.asm @ 137:28b057aa9f75
Simplify gas change
author | heinrichsweikamp |
---|---|
date | Thu, 17 Jul 2014 14:24:51 +0200 |
parents | 4574aed5cd4c |
children | e0b758865e91 |
rev | line source |
---|---|
0 | 1 ;============================================================================= |
2 ; | |
3 ; File ghostwriter.asm | |
4 ; | |
5 ; Ghostwriter (Log profile recorder) | |
6 ; | |
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. | |
8 ;============================================================================= | |
9 ; HISTORY | |
10 ; 2011-11-27 : [mH] Creation | |
11 | |
12 #include "ostc3.inc" ; Mandatory header | |
13 #include "shared_definitions.h" ; Mailbox from/to p2_deco.c | |
14 #include "external_flash.inc" | |
15 #include "surfmode.inc" | |
133
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
16 #include "eeprom_rs232.inc" |
0 | 17 #include "strings.inc" |
18 #include "isr.inc" | |
19 #include "tft_outputs.inc" | |
20 #include "divemode.inc" | |
133
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
21 #include "rtc.inc" |
0 | 22 |
23 ghostwriter CODE | |
24 | |
25 global store_dive_data | |
26 store_dive_data: ; 5 seconds gone | |
27 bcf store_sample ; update only any 5 seconds | |
28 | |
29 ifndef __DEBUG | |
30 btfsc simulatormode_active ; Are we in simulator mode? | |
31 return ; Yes, discard everything | |
32 endif | |
33 | |
35
eca4a201d8cf
change apnea timeout, do no longer store apnea dives in logbook
heinrichsweikamp
parents:
23
diff
changeset
|
34 btfsc FLAG_apnoe_mode ; In Apnoe mode? |
eca4a201d8cf
change apnea timeout, do no longer store apnea dives in logbook
heinrichsweikamp
parents:
23
diff
changeset
|
35 return ; Yes, discard everything |
eca4a201d8cf
change apnea timeout, do no longer store apnea dives in logbook
heinrichsweikamp
parents:
23
diff
changeset
|
36 |
0 | 37 SAFE_2BYTE_COPY rel_pressure, lo |
38 movf lo,W ; store depth with every sample | |
35
eca4a201d8cf
change apnea timeout, do no longer store apnea dives in logbook
heinrichsweikamp
parents:
23
diff
changeset
|
39 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. Flash |
0 | 40 movf hi,W |
35
eca4a201d8cf
change apnea timeout, do no longer store apnea dives in logbook
heinrichsweikamp
parents:
23
diff
changeset
|
41 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. Flash |
0 | 42 |
43 ;First, find out how many bytes will append to this sample.... | |
44 clrf ProfileFlagByte ; clear number of bytes to append | |
45 | |
46 ; Check Extented informations | |
47 decfsz divisor_temperature,W ; Check divisor | |
48 bra check_extended1 | |
49 movlw infolength_temperature | |
50 addwf ProfileFlagByte,F ; add to ProfileFlagByte | |
51 check_extended1: | |
52 decfsz divisor_deco,W ; Check divisor | |
53 bra check_extended2 | |
54 movlw infolength_deco | |
55 addwf ProfileFlagByte,F ; add to ProfileFlagByte | |
56 check_extended2: | |
57 decfsz divisor_gf,W ; Check divisor | |
58 bra check_extended3 | |
59 movlw infolength_gf | |
60 addwf ProfileFlagByte,F ; add to ProfileFlagByte | |
61 check_extended3: | |
62 decfsz divisor_ppo2_sensors,W ; Check divisor | |
63 bra check_extended4 | |
64 movlw infolength_ppo2_sensors | |
65 addwf ProfileFlagByte,F ; add to ProfileFlagByte | |
66 check_extended4: | |
67 decfsz divisor_decoplan,W ; Check divisor | |
68 bra check_extended5 | |
69 movlw infolength_decoplan | |
70 addwf ProfileFlagByte,F ; add to ProfileFlagByte | |
71 check_extended5: | |
72 decfsz divisor_cns,W ; Check divisor | |
73 bra check_extended6 | |
74 movlw infolength_cns | |
75 addwf ProfileFlagByte,F ; add to ProfileFlagByte | |
76 check_extended6: | |
77 decfsz divisor_tank,W ; Check divisor | |
78 bra check_extended7 | |
79 movlw infolength_tank | |
80 addwf ProfileFlagByte,F ; add to ProfileFlagByte | |
81 check_extended7: | |
82 | |
83 ; Second, check global event flag | |
84 btfss event_occured ; Check global event flag | |
85 bra store_dive_data3 ; No Event | |
99
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
86 |
0 | 87 incf ProfileFlagByte,F ; add one byte (The EventByte) |
88 | |
89 clrf EventByte ; reset EventByte | |
98 | 90 clrf EventByte2 ; reset EventByte2 |
0 | 91 |
92 movf AlarmType,W ; Type of Alarm Bit 0-3 | |
93 addwf EventByte,F ; Copy to EventByte Bit 0-3 | |
94 clrf AlarmType ; Reset AlarmType | |
95 | |
96 ; Third, check events and add aditional bytes | |
97 btfss gas6_changed ; Check flag | |
98 bra check_event2 | |
99 movlw d'2' ; Information length | |
100 addwf ProfileFlagByte,F ; add to ProfileFlagByte | |
101 bsf EventByte,4 ; Also set Flag in EventByte! | |
102 check_event2: | |
103 btfss stored_gas_changed ; Check flag | |
104 bra check_event3 | |
105 movlw d'1' ; Information length | |
106 addwf ProfileFlagByte,F ; add to ProfileFlagByte | |
107 bsf EventByte,5 ; Also set Flag in EventByte! | |
108 check_event3: | |
109 btfss setpoint_changed ; Check flag | |
110 bra check_event4 | |
111 movlw d'1' ; Information length | |
112 addwf ProfileFlagByte,F ; add to ProfileFlagByte | |
113 bsf EventByte,6 ; Also set Flag in EventByte! | |
114 check_event4: | |
98 | 115 btfss bailoutgas_event ; =1: bailout was selected or a gaschange during bailout |
116 bra check_event5 | |
117 movlw d'2' ; Information length | |
118 addwf ProfileFlagByte,F ; add to ProfileFlagByte | |
119 bsf EventByte2,0 ; set flag in EventByte2! | |
120 bsf EventByte,7 ; =1: Another Eventbyte is available | |
121 | |
122 check_event5: | |
0 | 123 ; more events? |
124 | |
125 store_dive_data3: | |
98 | 126 btfsc EventByte,7 ; =1: Another Eventbyte is available |
127 incf ProfileFlagByte,F ; add one byte (The EventByte2) | |
128 | |
129 btfsc event_occured ; Check global event flag | |
130 bsf ProfileFlagByte,7 ; Set EventByte Flag in ProfileFlagByte | |
131 | |
132 movf ProfileFlagByte,W ; finally, write ProfileFlagByte! | |
133 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. Flash | |
134 | |
135 btfss event_occured ; Check global event flag (again) | |
136 bra store_dive_data4 ; No Event | |
137 | |
138 ; Store the EventByte(s) + additional bytes now | |
139 movf EventByte,W | |
99
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
140 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. Flash |
0 | 141 |
98 | 142 movf EventByte2,W ; Write second event byte... |
143 btfsc EventByte,7 ; =1: Another Eventbyte is available | |
144 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. Flash | |
0 | 145 |
99
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
146 btfss gas6_changed ; Check flag |
0 | 147 bra store_dive_data3b |
148 movff char_I_O2_ratio,WREG | |
99
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
149 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. Flash |
0 | 150 movff char_I_He_ratio,WREG |
99
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
151 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. Flash |
0 | 152 bcf gas6_changed ; Clear this event |
153 store_dive_data3b: | |
154 btfss stored_gas_changed ; Check flag | |
155 bra store_dive_data3c | |
156 movf active_gas,W ; Store active gas | |
157 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. Flash | |
158 bcf stored_gas_changed ; Clear this event | |
159 store_dive_data3c: | |
160 btfss setpoint_changed ; Check flag | |
161 bra store_dive_data3d | |
162 movff char_I_const_ppO2,WREG | |
163 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. Flash | |
164 bcf setpoint_changed ; Clear this event | |
165 store_dive_data3d: | |
98 | 166 btfss bailoutgas_event ; Check flag |
167 bra store_dive_data3e | |
168 movff char_I_O2_ratio,WREG | |
169 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. Flash | |
170 movff char_I_He_ratio,WREG | |
171 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. Flash | |
172 bcf bailoutgas_event ; Clear this event | |
173 store_dive_data3e: | |
0 | 174 |
175 store_dive_data4: | |
176 | |
177 ; Store extended informations | |
178 decfsz divisor_temperature,F ; Check divisor | |
179 bra store_extended1 | |
180 rcall store_dive_temperature | |
181 store_extended1: | |
182 decfsz divisor_deco,F ; Check divisor | |
183 bra store_extended2 | |
184 rcall store_dive_decodata | |
185 store_extended2: | |
186 decfsz divisor_gf,F ; Check divisor | |
187 bra store_extended3 | |
188 rcall store_dive_gf | |
189 store_extended3: | |
190 decfsz divisor_ppo2_sensors,F ; Check divisor | |
191 bra store_extended4 | |
192 rcall store_dive_ppO2_sensors | |
193 store_extended4: | |
194 decfsz divisor_decoplan,F ; Check divisor | |
195 bra store_extended5 | |
196 rcall store_dive_decoplan | |
197 store_extended5: | |
198 decfsz divisor_cns,F ; Check divisor | |
199 bra store_extended6 | |
200 rcall store_dive_cns | |
201 store_extended6: | |
202 decfsz divisor_tank,F ; Check divisor | |
203 bra store_extended7 | |
204 rcall store_dive_tank | |
205 store_extended7: | |
206 | |
207 ; The next block is required to take care of "store never" | |
208 btfsc divisor_temperature,7 ; Test highest Bit (Register must have been zero before the "decfsz" command!) | |
209 clrf divisor_temperature ; And clear register again, so it will never reach zero... | |
210 btfsc divisor_deco,7 | |
211 clrf divisor_deco | |
212 btfsc divisor_gf,7 | |
213 clrf divisor_gf | |
214 btfsc divisor_ppo2_sensors,7 | |
215 clrf divisor_ppo2_sensors | |
216 btfsc divisor_decoplan,7 | |
217 clrf divisor_decoplan | |
218 btfsc divisor_cns,7 | |
219 clrf divisor_cns | |
220 btfsc divisor_tank,7 | |
221 clrf divisor_tank | |
222 | |
223 store_dive_data5: | |
224 bcf event_occured ; Clear the global event flag | |
98 | 225 bcf event2_occured ; Clear the global event2 flag |
99
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
226 clrf EventByte ; reset EventByte |
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
227 clrf EventByte2 ; reset EventByte2 |
0 | 228 return ; Done. (Sample with all informations written to external flash) |
229 | |
230 store_dive_cns: | |
231 movff int_O_CNS_fraction+0,WREG | |
232 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. Flash | |
233 movff int_O_CNS_fraction+1,WREG | |
234 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. Flash | |
235 movlw div_cns | |
236 movwf divisor_cns ; Reload divisor from CF | |
237 return | |
238 | |
239 store_dive_tank: | |
240 movlw div_tank | |
241 movwf divisor_tank ; Reload divisor from CF | |
242 return | |
243 | |
244 store_dive_decoplan: | |
245 ; Store the decoplan | |
246 lfsr FSR1,char_O_deco_time_for_log+.0 | |
247 movlw .15 | |
248 movwf lo | |
249 store_dive_decoplan_loop: | |
250 movf POSTINC1,W | |
251 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. Flash | |
252 decfsz lo,F | |
253 bra store_dive_decoplan_loop | |
254 movlw div_decoplan | |
255 movwf divisor_decoplan ; Reload divisor from CF | |
256 return | |
257 | |
258 store_dive_ppO2_sensors: | |
259 movf o2_ppo2_sensor1,W ; Sensor1 ppO2 (in 0.01bar steps) | |
260 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. Flash | |
261 SAFE_2BYTE_COPY o2_mv_sensor1,lo ; o2_mv_sensor may be modifified via ISR during the two writes here... | |
262 movf lo,W ; in 0.1mV steps | |
263 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. Flash | |
264 movf hi,W ; in 0.1mV steps | |
265 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. Flash | |
266 | |
267 movf o2_ppo2_sensor2,W ; Sensor2 ppO2 (in 0.01bar steps) | |
268 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. Flash | |
269 SAFE_2BYTE_COPY o2_mv_sensor2,lo ; o2_mv_sensor may be modifified via ISR during the two writes here... | |
270 movf lo,W ; in 0.1mV steps | |
271 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. Flash | |
272 movf hi,W ; in 0.1mV steps | |
273 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. Flash | |
274 | |
275 movf o2_ppo2_sensor3,W ; Sensor3 ppO2 (in 0.01bar steps) | |
276 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. Flash | |
277 SAFE_2BYTE_COPY o2_mv_sensor3,lo ; o2_mv_sensor may be modifified via ISR during the two writes here... | |
278 movf lo,W ; in 0.1mV steps | |
279 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. Flash | |
280 movf hi,W ; in 0.1mV steps | |
281 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. Flash | |
282 | |
283 movlw div_ppo2_sensors | |
284 movwf divisor_ppo2_sensors ; Reload divisor | |
285 return | |
286 | |
287 store_dive_gf: | |
288 movff char_O_gradient_factor,WREG ; gradient factor absolute | |
289 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. Flash | |
290 movlw div_gf | |
291 movwf divisor_gf ; Reload divisor | |
292 return | |
293 | |
294 store_dive_decodata: | |
295 movf decodata+0,W ; =0:no stop dive, if in deco mode: ceiling in m | |
296 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. Flash | |
297 movf decodata+1,W ; no stop time of length of first stop | |
298 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. Flash | |
299 movlw div_deco | |
300 movwf divisor_deco ; Reload divisor | |
301 return | |
302 | |
303 store_dive_temperature: | |
304 SAFE_2BYTE_COPY temperature,lo | |
305 movf lo,W ; append temperature to current sample! | |
306 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. Flash | |
307 movf hi,W | |
308 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. Flash | |
309 movlw div_temperature | |
310 movwf divisor_temperature ; Reload divisor | |
311 return | |
312 | |
313 ghostwrite_byte_header: | |
314 goto write_byte_ext_flash_plus_header ; (This call will also delete the 4kB TOC entry first) | |
315 ; returns... | |
316 | |
317 ghostwrite_byte_profile: | |
318 goto write_byte_ext_flash_plus ; writes byte and increases address with banking at 0x200000 | |
319 ; returns... | |
320 | |
321 global ghostwriter_end_dive | |
322 ghostwriter_end_dive: | |
323 movff ext_flash_address+0,ext_flash_log_pointer+0 | |
324 movff ext_flash_address+1,ext_flash_log_pointer+1 | |
325 movff ext_flash_address+2,ext_flash_log_pointer+2 ; Save end-of-profile pointer to store in header | |
326 | |
39
e4e91fe8b09d
remember last customview in dive and surface mode
mh@mh-THINK.fritz.box
parents:
35
diff
changeset
|
327 movff menupos3,customview_divemode ; store last customview |
e4e91fe8b09d
remember last customview in dive and surface mode
mh@mh-THINK.fritz.box
parents:
35
diff
changeset
|
328 |
0 | 329 btfss realdive ; dive longer then one minute |
330 goto ghostwriter_end_dive_common ; No, discard everything | |
331 | |
332 ; In DEBUG compile, keep all simulated dives in logbook, Desat time, nofly, etc... | |
333 ifndef __DEBUG | |
334 btfsc simulatormode_active ; Are we in simulator mode? | |
335 goto ghostwriter_end_dive_common ; Yes, discard everything | |
336 endif | |
337 | |
35
eca4a201d8cf
change apnea timeout, do no longer store apnea dives in logbook
heinrichsweikamp
parents:
23
diff
changeset
|
338 btfsc FLAG_apnoe_mode ; In Apnoe mode? |
eca4a201d8cf
change apnea timeout, do no longer store apnea dives in logbook
heinrichsweikamp
parents:
23
diff
changeset
|
339 goto ghostwriter_end_dive_common ; Yes, discard everything |
eca4a201d8cf
change apnea timeout, do no longer store apnea dives in logbook
heinrichsweikamp
parents:
23
diff
changeset
|
340 |
eca4a201d8cf
change apnea timeout, do no longer store apnea dives in logbook
heinrichsweikamp
parents:
23
diff
changeset
|
341 ; Dive finished (and longer then one minute) |
0 | 342 |
343 btfsc FLAG_apnoe_mode ; Calc max. depth (again) for very short apnoe dives | |
344 call apnoe_calc_maxdepth | |
345 | |
346 ; calculate desaturation time | |
347 movff last_surfpressure_30min+0,int_I_pres_surface+0 ; Pass surface to desat routine ! | |
348 movff last_surfpressure_30min+1,int_I_pres_surface+1 | |
349 | |
350 call deco_calc_desaturation_time ; calculate desaturation time | |
351 movlb b'00000001' ; select ram bank 1 | |
352 movff int_O_desaturation_time+0, desaturation_time+0 | |
353 movff int_O_desaturation_time+1, desaturation_time+1 ; Buffer | |
354 call calc_deko_surfmode | |
355 rcall calculate_noflytime ; Calc NoFly time | |
356 | |
357 ; store header and ... | |
358 movlw 0xFD ; .... End-of-Profile Bytes | |
359 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. Flash | |
360 movlw 0xFD | |
361 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. Flash | |
362 movff ext_flash_address+0,ext_flash_log_pointer+0 | |
363 movff ext_flash_address+1,ext_flash_log_pointer+1 | |
364 movff ext_flash_address+2,ext_flash_log_pointer+2 ; Save end-of-profile pointer to store in header | |
365 | |
366 ; Set to first address again to store dive length ext_flash_dive_counter:3 | |
367 clrf EEADRH ; Make sure to select eeprom bank 0 | |
368 read_int_eeprom .4 | |
369 movff EEDATA,ext_flash_address+0 | |
370 read_int_eeprom .5 | |
371 movff EEDATA,ext_flash_address+1 | |
372 read_int_eeprom .6 | |
373 movff EEDATA,ext_flash_address+2 | |
374 | |
375 incf_ext_flash_address_0x20 d'6' ; Skip internal "0xFA 0xFA #Divenumber:2 0xFA 0xFA" Header | |
376 ; Store dive length | |
377 movf ext_flash_dive_counter+0,W | |
6 | 378 call write_byte_ext_flash_plus_nocnt ; WREG -> Profile in ext. flash (No ext_flash_dive_counter:3 increase) |
0 | 379 movf ext_flash_dive_counter+1,W |
6 | 380 call write_byte_ext_flash_plus_nocnt ; WREG -> Profile in ext. flash (No ext_flash_dive_counter:3 increase) |
0 | 381 movf ext_flash_dive_counter+2,W |
6 | 382 call write_byte_ext_flash_plus_nocnt ; WREG -> Profile in ext. flash (No ext_flash_dive_counter:3 increase) |
0 | 383 |
384 ; profile recording done. | |
385 | |
386 ; Load total number of dives | |
387 read_int_eeprom .2 | |
388 movff EEDATA,lo | |
389 read_int_eeprom .3 | |
390 movff EEDATA,hi | |
391 ; +1 increase total dive counter | |
392 incf lo,F | |
393 movlw d'0' | |
394 addwfc hi,F | |
395 ; Store new number in EEPROM | |
396 movff lo,EEDATA | |
397 write_int_eeprom .2 | |
398 movff hi,EEDATA | |
399 write_int_eeprom .3 | |
400 | |
401 decf lo,F ; -1 | |
402 ; Set ext_flash_address:3 to TOC entry of this dive | |
403 ; 1st: 200000h-200FFFh -> lo=0 | |
404 ; 2nd: 201000h-201FFFh -> lo=1 | |
405 ; 3rd: 202000h-202FFFh -> lo=2 | |
406 ; 255: 2FF000h-2FFFFFh -> lo=255 | |
407 | |
408 clrf ext_flash_address+0 | |
409 clrf ext_flash_address+1 | |
410 movlw 0x20 | |
411 movwf ext_flash_address+2 | |
412 movlw .16 | |
413 mulwf lo ; lo*16 = offset to 0x2000 (up:hi) | |
414 movf PRODL,W | |
415 addwf ext_flash_address+1,F | |
416 movf PRODH,W | |
417 addwfc ext_flash_address+2,F | |
418 | |
419 ; Now, write header | |
420 | |
421 movlw 0xFA ; Header start | |
422 rcall ghostwrite_byte_header ; (This call will also delete the 4kB TOC entry first) | |
423 movlw 0xFA | |
424 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
425 | |
426 ; store pointer to begin of diveprofile | |
427 read_int_eeprom .4 | |
428 movf EEDATA,W | |
429 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
430 read_int_eeprom .5 | |
431 movf EEDATA,W | |
432 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
433 read_int_eeprom .6 | |
434 movf EEDATA,W | |
435 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
436 | |
437 ; store pointer to end of diveprofile | |
438 movf ext_flash_log_pointer+0,W | |
439 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
440 movf ext_flash_log_pointer+1,W | |
441 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
442 movf ext_flash_log_pointer+2,W | |
443 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
444 | |
445 ; write rest of header | |
446 movlw logbook_profile_version ; Defined in ostc3.inc | |
447 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
448 | |
449 ; Store dive length | |
450 movf ext_flash_dive_counter+0,W | |
451 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
452 movf ext_flash_dive_counter+1,W | |
453 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
454 movf ext_flash_dive_counter+2,W | |
455 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
456 | |
457 movf year,W ; Date | |
458 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
459 movf month,W | |
460 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
461 movf day,W | |
462 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
463 movf hours,W ; End of dive time | |
464 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
465 movf mins,W | |
466 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
467 | |
468 btfss FLAG_apnoe_mode ; Store apnoe max or normal max (Which is only max from the last descent) | |
469 bra end_dive1 ; Store normal depth | |
470 | |
471 movff apnoe_max_pressure+0,lo | |
472 movff apnoe_max_pressure+1,hi | |
473 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] | |
474 movff lo,apnoe_max_pressure+0 | |
475 movff hi,apnoe_max_pressure+1 | |
476 | |
477 movf apnoe_max_pressure+0,W ; Max. depth | |
478 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
479 movf apnoe_max_pressure+1,W | |
480 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
481 bra end_dive2 ; skip normal max. depth | |
482 | |
483 end_dive1: | |
484 movff max_pressure+0,lo | |
485 movff max_pressure+1,hi | |
486 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] | |
487 movff lo,max_pressure+0 | |
488 movff hi,max_pressure+1 | |
489 | |
490 movff max_pressure+0,WREG ; Max. depth | |
491 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
492 movff max_pressure+1,WREG | |
493 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
494 | |
495 end_dive2: | |
496 movf divemins+0,W ; divetime minutes | |
497 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
498 movf divemins+1,W | |
499 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
500 movf divesecs,W ; divetime seconds | |
501 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
502 movff minimum_temperature+0,WREG ; minimum temperature | |
503 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
504 movff minimum_temperature+1,WREG | |
505 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
506 movff last_surfpressure_30min+0,WREG ; airpressure before dive | |
507 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
508 movff last_surfpressure_30min+1,WREG | |
509 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
510 movff int_O_desaturation_time+0,WREG ; desaturation time in minutes | |
511 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
512 movff int_O_desaturation_time+1,WREG | |
513 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
514 | |
515 btfss FLAG_ccr_mode ; In CCR mode... | |
516 bra end_dive_oc_gaslist ; No, write OC gases | |
517 ; Write Diluents... | |
518 movff opt_dil_O2_ratio+0,WREG | |
519 rcall ghostwrite_byte_header ; %O2 | |
520 movff opt_dil_He_ratio+0,WREG | |
521 rcall ghostwrite_byte_header ; %He | |
522 movff char_I_dil_change+0,WREG | |
523 rcall ghostwrite_byte_header ; Configured change depth in m | |
524 movff opt_dil_type+0,WREG | |
525 rcall ghostwrite_byte_header ; 0=Disabled, 1=First, 2=Normal | |
526 | |
527 movff opt_dil_O2_ratio+1,WREG | |
528 rcall ghostwrite_byte_header ; %O2 | |
529 movff opt_dil_He_ratio+1,WREG | |
530 rcall ghostwrite_byte_header ; %He | |
531 movff char_I_dil_change+1,WREG | |
532 rcall ghostwrite_byte_header ; Configured change depth in m | |
533 movff opt_dil_type+1,WREG | |
534 rcall ghostwrite_byte_header ; 0=Disabled, 1=First, 2=Normal | |
535 | |
536 movff opt_dil_O2_ratio+2,WREG | |
537 rcall ghostwrite_byte_header ; %O2 | |
538 movff opt_dil_He_ratio+2,WREG | |
539 rcall ghostwrite_byte_header ; %He | |
540 movff char_I_dil_change+2,WREG | |
541 rcall ghostwrite_byte_header ; Configured change depth in m | |
542 movff opt_dil_type+2,WREG | |
543 rcall ghostwrite_byte_header ; 0=Disabled, 1=First, 2=Normal | |
544 | |
545 movff opt_dil_O2_ratio+3,WREG | |
546 rcall ghostwrite_byte_header ; %O2 | |
547 movff opt_dil_He_ratio+3,WREG | |
548 rcall ghostwrite_byte_header ; %He | |
549 movff char_I_dil_change+3,WREG | |
550 rcall ghostwrite_byte_header ; Configured change depth in m | |
551 movff opt_dil_type+3,WREG | |
552 rcall ghostwrite_byte_header ; 0=Disabled, 1=First, 2=Normal | |
553 | |
554 movff opt_dil_O2_ratio+4,WREG | |
555 rcall ghostwrite_byte_header ; %O2 | |
556 movff opt_dil_He_ratio+4,WREG | |
557 rcall ghostwrite_byte_header ; %He | |
558 movff char_I_dil_change+4,WREG | |
559 rcall ghostwrite_byte_header ; Configured change depth in m | |
560 movff opt_dil_type+4,WREG | |
561 rcall ghostwrite_byte_header ; 0=Disabled, 1=First, 2=Normal | |
562 bra end_dive_oc_cc_common | |
563 | |
564 end_dive_oc_gaslist: ; OC Gases... | |
565 movff opt_gas_O2_ratio+0,WREG | |
566 rcall ghostwrite_byte_header ; %O2 | |
567 movff opt_gas_He_ratio+0,WREG | |
568 rcall ghostwrite_byte_header ; %He | |
97
53a99a2dc6a1
CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents:
39
diff
changeset
|
569 movff opt_OC_bail_gas_change+0,WREG |
0 | 570 rcall ghostwrite_byte_header ; Configured change depth in m |
571 movff opt_gas_type+0,WREG | |
572 rcall ghostwrite_byte_header ; 0=Disabled, 1=First, 2= Travel, 3= Deco | |
573 | |
574 movff opt_gas_O2_ratio+1,WREG | |
575 rcall ghostwrite_byte_header ; %O2 | |
576 movff opt_gas_He_ratio+1,WREG | |
577 rcall ghostwrite_byte_header ; %He | |
97
53a99a2dc6a1
CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents:
39
diff
changeset
|
578 movff opt_OC_bail_gas_change+1,WREG |
0 | 579 rcall ghostwrite_byte_header ; Configured change depth in m |
580 movff opt_gas_type+1,WREG | |
581 rcall ghostwrite_byte_header ; 0=Disabled, 1=First, 2= Travel, 3= Deco | |
582 | |
583 movff opt_gas_O2_ratio+2,WREG | |
584 rcall ghostwrite_byte_header ; %O2 | |
585 movff opt_gas_He_ratio+2,WREG | |
586 rcall ghostwrite_byte_header ; %He | |
97
53a99a2dc6a1
CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents:
39
diff
changeset
|
587 movff opt_OC_bail_gas_change+2,WREG |
0 | 588 rcall ghostwrite_byte_header ; Configured change depth in m |
589 movff opt_gas_type+2,WREG | |
590 rcall ghostwrite_byte_header ; 0=Disabled, 1=First, 2= Travel, 3= Deco | |
591 | |
592 movff opt_gas_O2_ratio+3,WREG | |
593 rcall ghostwrite_byte_header ; %O2 | |
594 movff opt_gas_He_ratio+3,WREG | |
595 rcall ghostwrite_byte_header ; %He | |
97
53a99a2dc6a1
CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents:
39
diff
changeset
|
596 movff opt_OC_bail_gas_change+3,WREG |
0 | 597 rcall ghostwrite_byte_header ; Configured change depth in m |
598 movff opt_gas_type+3,WREG | |
599 rcall ghostwrite_byte_header ; 0=Disabled, 1=First, 2= Travel, 3= Deco | |
600 | |
601 movff opt_gas_O2_ratio+4,WREG | |
602 rcall ghostwrite_byte_header ; %O2 | |
603 movff opt_gas_He_ratio+4,WREG | |
604 rcall ghostwrite_byte_header ; %He | |
97
53a99a2dc6a1
CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents:
39
diff
changeset
|
605 movff opt_OC_bail_gas_change+4,WREG |
0 | 606 rcall ghostwrite_byte_header ; Configured change depth in m |
607 movff opt_gas_type+4,WREG | |
608 rcall ghostwrite_byte_header ; 0=Disabled, 1=First, 2= Travel, 3= Deco | |
609 ; bra end_dive_oc_cc_common | |
610 | |
611 end_dive_oc_cc_common: | |
612 movlw softwareversion_x ; Firmware version | |
613 rcall ghostwrite_byte_header | |
614 movlw softwareversion_y | |
615 rcall ghostwrite_byte_header | |
616 movf batt_voltage+0,W ; Battery voltage | |
617 rcall ghostwrite_byte_header | |
618 movf batt_voltage+1,W | |
619 rcall ghostwrite_byte_header | |
620 | |
23
e402813343b6
new option to switch samplingrate between 10s and 2s
heinrichsweikamp
parents:
6
diff
changeset
|
621 movf samplingrate,W ; Sampling rate |
e402813343b6
new option to switch samplingrate between 10s and 2s
heinrichsweikamp
parents:
6
diff
changeset
|
622 btfsc FLAG_apnoe_mode ; Apnoe mode? |
e402813343b6
new option to switch samplingrate between 10s and 2s
heinrichsweikamp
parents:
6
diff
changeset
|
623 movlw samplingrate_apnoe ; Apnoe sampling rate |
0 | 624 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash |
625 | |
626 ; CNS at gebinning of dive | |
627 movff CNS_start+0,WREG | |
628 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
629 movff CNS_start+1,WREG | |
630 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
631 ; Gradient factor | |
632 movff GF_start,WREG | |
633 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
634 movff char_O_relative_gradient_GF,WREG | |
635 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
5 | 636 |
637 ; Logbook offset | |
638 call do_logoffset_common_read; Read into lo:hi | |
639 movf lo,W | |
0 | 640 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash |
5 | 641 movf hi,W |
0 | 642 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash |
5 | 643 |
644 ; Spare at Byte 60 | |
0 | 645 movlw 0xFF |
646 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
647 ; Store 5 Setpoints | |
648 movff char_I_setpoint_cbar+0,WREG | |
649 rcall ghostwrite_byte_header ; Setpoint in cbar | |
650 movff char_I_setpoint_change+0,WREG | |
651 rcall ghostwrite_byte_header ; Change depth | |
652 movff char_I_setpoint_cbar+1,WREG | |
653 rcall ghostwrite_byte_header ; Setpoint in cbar | |
654 movff char_I_setpoint_change+1,WREG | |
655 rcall ghostwrite_byte_header ; Change depth | |
656 movff char_I_setpoint_cbar+2,WREG | |
657 rcall ghostwrite_byte_header ; Setpoint in cbar | |
658 movff char_I_setpoint_change+2,WREG | |
659 rcall ghostwrite_byte_header ; Change depth | |
660 movff char_I_setpoint_cbar+3,WREG | |
661 rcall ghostwrite_byte_header ; Setpoint in cbar | |
662 movff char_I_setpoint_change+3,WREG | |
663 rcall ghostwrite_byte_header ; Change depth | |
664 movff char_I_setpoint_cbar+4,WREG | |
665 rcall ghostwrite_byte_header ; Setpoint in cbar | |
666 movff char_I_setpoint_change+4,WREG | |
667 rcall ghostwrite_byte_header ; Change depth | |
668 | |
669 movff opt_salinity,WREG ; Salinity (0-5%) | |
670 rcall ghostwrite_byte_header ; Store Salinity to Dive | |
671 | |
672 movff int_O_CNS_fraction+0,WREG ; copy into bank1 | |
673 rcall ghostwrite_byte_header; Stores CNS% | |
674 movff int_O_CNS_fraction+1,WREG ; copy into bank1 | |
675 rcall ghostwrite_byte_header; Stores CNS% | |
676 | |
677 movff avr_rel_pressure_total+0,WREG ; Average Depth | |
678 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
679 movff avr_rel_pressure_total+1,WREG ; Average Depth | |
680 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
681 | |
682 movff total_divetime_seconds+0,WREG ; Total dive time (Regardless of start_dive_threshold) | |
683 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
684 movff total_divetime_seconds+1,WREG ; Total dive time (Regardless of start_dive_threshold) | |
685 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
686 | |
687 movff char_I_GF_Low_percentage,WREG ; GF_lo | |
688 movff char_I_deco_model,lo | |
689 decfsz lo,F ; jump over next line if char_I_deco_model == 1 | |
690 movff char_I_saturation_multiplier,WREG ; Saturation Multiplier | |
691 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
692 | |
693 movff char_I_GF_High_percentage,WREG ; GF_hi | |
694 movff char_I_deco_model,lo | |
695 decfsz lo,F ; jump over next line if char_I_deco_model == 1 | |
696 movff char_I_desaturation_multiplier,WREG ; Desaturation Multiplier | |
697 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
698 | |
699 movff char_I_deco_model,WREG ; 0 = ZH-L16, 1 = ZH-L16-GF | |
700 rcall ghostwrite_byte_header; writes byte and increases address (no banking) | |
701 | |
702 read_int_eeprom .2 | |
703 movf EEDATA,W | |
704 rcall ghostwrite_byte_header ; Total dive counter, low | |
705 read_int_eeprom .3 | |
706 movf EEDATA,W | |
707 rcall ghostwrite_byte_header ; Total dive counter, high | |
708 | |
709 movff opt_dive_mode,WREG | |
710 rcall ghostwrite_byte_header ; 0=OC, 1=CC, 2=Gauge, 3=Apnea | |
711 | |
712 ; Store all tissue data available | |
713 movlw .16 | |
714 movwf lo | |
715 lfsr FSR1,char_O_tissue_N2_saturation+0 | |
716 end_dive_store_tissues_N2: | |
717 movf POSTINC1,W | |
718 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
719 decfsz lo,F | |
720 bra end_dive_store_tissues_N2 ; No | |
721 | |
722 movlw .64 | |
723 movwf lo | |
724 lfsr FSR1,0x700;pres_tissue_N2+0 ; 16*4Byte Float = 64Bytes | |
725 end_dive_store_tissues_N2_2: | |
726 movf POSTINC1,W | |
727 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
728 decfsz lo,F | |
729 bra end_dive_store_tissues_N2_2 ; No | |
730 | |
731 movlw .16 | |
732 movwf lo | |
733 lfsr FSR1,char_O_tissue_He_saturation+0 | |
734 end_dive_store_tissues_He: | |
735 movf POSTINC1,W | |
736 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
737 decfsz lo,F | |
738 bra end_dive_store_tissues_He ; No | |
739 | |
740 movlw .64 | |
741 movwf lo | |
742 lfsr FSR1,0x740;pres_tissue_He+0 ; 16*4Byte Float = 64Bytes | |
743 end_dive_store_tissues_He_2: | |
744 movf POSTINC1,W | |
745 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
746 decfsz lo,F | |
747 bra end_dive_store_tissues_He_2 ; No | |
748 | |
749 ; Some deco stuff | |
750 movff char_I_depth_last_deco,WREG ; last stop [m] | |
751 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
752 movff char_I_deco_distance,WREG ; assumed distance to shown stop | |
753 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
754 | |
755 ; Last HUD data | |
756 movff hud_battery_mv+0,WREG ; Last HUD battery value | |
757 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
758 movff hud_battery_mv+1,WREG ; Last HUD battery value | |
759 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
760 movff hud_status_byte,WREG ; Last HUD status | |
761 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
762 | |
763 ; Battery gauge registers [nAs] | |
764 movff battery_gauge+0,WREG ; Battery gauge register | |
765 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
766 movff battery_gauge+1,WREG ; Battery gauge register | |
767 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
768 movff battery_gauge+2,WREG ; Battery gauge register | |
769 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
770 movff battery_gauge+3,WREG ; Battery gauge register | |
771 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
772 movff battery_gauge+4,WREG ; Battery gauge register | |
773 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
774 movff battery_gauge+5,WREG ; Battery gauge register | |
775 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
776 | |
777 ; Header stop | |
778 movlw 0xFB | |
779 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
780 movlw 0xFB | |
781 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
782 | |
783 call divemode_store_statistics ; Store/update statistics for this unit | |
784 | |
785 clrf surface_interval+0 | |
786 clrf surface_interval+1 ; Clear surface interval timer | |
787 | |
788 ghostwriter_end_dive_common: | |
789 ; Update ext_flash_log_pointer into EEPROM | |
790 clrf EEADRH | |
791 movff ext_flash_log_pointer+0,EEDATA | |
792 write_int_eeprom .4 | |
793 movff ext_flash_log_pointer+1,EEDATA | |
794 write_int_eeprom .5 | |
795 movff ext_flash_log_pointer+2,EEDATA | |
796 write_int_eeprom .6 | |
797 | |
798 bcf simulatormode_active ; if we were in simulator mode | |
799 | |
800 ; In DEBUG compile, keep all simulated dives in logbook, Desat time, nofly, etc... | |
801 ifndef __DEBUG | |
802 extern deco_pull_tissues_from_vault | |
803 btfsc restore_deco_data ; Restore decodata? | |
804 call deco_pull_tissues_from_vault | |
805 banksel common ; Bank1 | |
806 endif | |
807 call update_battery_registers ; update battery registers into EEPROM | |
808 goto surfloop ; and return to surfaceloop | |
809 | |
810 global ghostwriter_short_header | |
811 ghostwriter_short_header: ; Write short header with divenumber into profile memory | |
812 | |
813 ; load pointer for profile storing into RAM (Updated in EEPROM after the dive) | |
814 clrf EEADRH ; Make sure to select eeprom bank 0 | |
815 read_int_eeprom .4 | |
816 movff EEDATA,ext_flash_address+0 | |
817 read_int_eeprom .5 | |
818 movff EEDATA,ext_flash_address+1 | |
819 read_int_eeprom .6 | |
820 movff EEDATA,ext_flash_address+2 | |
821 | |
822 ; Clear dive length counter | |
823 clrf ext_flash_dive_counter+0 | |
824 clrf ext_flash_dive_counter+1 | |
825 clrf ext_flash_dive_counter+2 | |
826 | |
827 ; Write short header with divenumber into profile memory | |
828 movlw 0xFA | |
829 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. flash | |
830 movlw 0xFA | |
831 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. flash | |
832 ; Load total number of dives (low byte only) | |
833 read_int_eeprom .2 | |
834 incf EEDATA,W ;+1 | |
835 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. flash | |
836 read_int_eeprom .3 | |
837 movf EEDATA,W | |
838 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. flash | |
839 movlw 0xFA | |
840 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. flash | |
841 movlw 0xFA | |
842 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. flash | |
843 ; Keep room for dive length ext_flash_dive_counter:3 (Stored at the end of the dive) | |
844 incf_ext_flash_address_0x20 d'3' ; Skip Bytes in external flash (faster) | |
845 | |
23
e402813343b6
new option to switch samplingrate between 10s and 2s
heinrichsweikamp
parents:
6
diff
changeset
|
846 movf samplingrate,W ; Sampling rate |
0 | 847 btfsc FLAG_apnoe_mode ; Apnoe mode? |
848 movlw samplingrate_apnoe ; Apnoe sampling rate | |
849 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. flash | |
850 | |
851 movlw .7 ; Number of divisors | |
852 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. flash | |
853 | |
854 movlw .0 ; Type | |
855 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. flash | |
856 movlw infolength_temperature | |
857 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. flash | |
858 movlw div_temperature ; Divisor temperature | |
859 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. flash | |
860 | |
861 movlw .1 ; Type | |
862 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. flash | |
863 movlw infolength_deco | |
864 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. flash | |
865 movlw div_deco ; Divisor decodata | |
866 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. flash | |
867 | |
868 movlw .2 ; Type | |
869 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. flash | |
870 movlw infolength_gf | |
871 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. flash | |
872 movlw div_gf ; Divisor gf | |
873 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. flash | |
874 | |
875 movlw .3 ; Type | |
876 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. flash | |
877 movlw infolength_ppo2_sensors | |
878 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. flash | |
879 movlw div_ppo2_sensors ; Divisor ppO2 | |
107
dc44aa645549
BUGFIX: wrong ppo2 recording parameter in short header
heinrichsweikamp
parents:
99
diff
changeset
|
880 btfss FLAG_ccr_mode ; =1: CCR mode (Fixed ppO2 or Sensor) active |
dc44aa645549
BUGFIX: wrong ppo2 recording parameter in short header
heinrichsweikamp
parents:
99
diff
changeset
|
881 movlw .0 ; No ppO2 data in OC mode |
0 | 882 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. flash |
883 | |
884 movlw .4 ; Type | |
885 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. flash | |
886 movlw infolength_decoplan | |
887 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. flash | |
888 movlw div_decoplan ; Divisor debug | |
889 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. flash | |
890 | |
891 movlw .5 ; Type | |
892 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. flash | |
893 movlw infolength_cns | |
894 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. flash | |
895 movlw div_cns ; Divisor CNS | |
896 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. flash | |
897 | |
898 movlw .6 ; Type | |
899 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. flash | |
900 movlw infolength_tank | |
901 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. flash | |
902 movlw div_tank ; Divisor Tank | |
903 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. flash | |
904 | |
905 return | |
906 | |
907 calculate_noflytime: | |
908 ; calculate nofly time | |
909 movff int_O_desaturation_time+0,xA+0 | |
910 movff int_O_desaturation_time+1,xA+1 | |
911 | |
912 btfsc xA+1,7 ; Is desat time negative ? | |
913 bra calculate_noflytime_3 ; Then surely not valid ! | |
914 | |
915 tstfsz xA+0 ; Desat=0? | |
916 bra calculate_noflytime2 | |
917 tstfsz xA+1 ; Desat=0? | |
918 bra calculate_noflytime2 | |
919 | |
920 calculate_noflytime_3: | |
921 ; Desaturation time = zero | |
922 clrf nofly_time+0 ; Clear nofly time | |
923 clrf nofly_time+1 ; Clear nofly time | |
924 return | |
925 | |
926 calculate_noflytime2: | |
927 movff xA+0,int_I_temp+0 | |
928 movff xA+1,int_I_temp+1 | |
929 movlw no_fly_time_ratio ; nofly_time_ratio | |
930 movff WREG,char_I_temp | |
931 call deco_calc_percentage | |
932 movlb b'00000001' ; select ram bank 1 | |
933 movff int_I_temp+0,xA+0 | |
934 movff int_I_temp+1,xA+1 | |
935 tstfsz xA+0 ; Desat=0? | |
936 bra calculate_noflytime_2_final | |
937 tstfsz xA+1 ; Desat=0? | |
938 bra calculate_noflytime_2_final | |
939 bra calculate_noflytime_3 | |
940 | |
941 calculate_noflytime_2_final: | |
942 movff xA+0,nofly_time+0 | |
943 movff xA+1,nofly_time+1 | |
944 return | |
945 | |
946 | |
947 divemode_store_statistics: ; Store/update statistics for this unit | |
133
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
948 rcall vault_decodata_into_eeprom ; update deco data |
0 | 949 rcall do_logoffset_common_read ; Existing logbook offset into lo:hi |
950 | |
951 tstfsz lo ; lo=0? | |
952 bra change_logbook_offset1 ; No, adjust offset | |
953 tstfsz hi ; hi=0? | |
954 bra change_logbook_offset1 ; No, adjust offset | |
955 bra change_logbook_offset2 ; lo=0 and hi=0 -> skip Offset routine | |
956 change_logbook_offset1: | |
957 movlw d'1' | |
958 addwf lo | |
959 movlw d'0' | |
960 addwfc hi | |
961 rcall do_logoffset_common_write ; lo:hi -> EEPROM | |
962 change_logbook_offset2: | |
963 ; Add more here... | |
964 return | |
965 | |
966 global do_logoffset_common_write | |
967 do_logoffset_common_write: | |
968 movff lo,EEDATA | |
969 write_int_eeprom 0x0D | |
970 movff hi,EEDATA | |
971 write_int_eeprom 0x0E | |
972 return | |
973 | |
974 global do_logoffset_common_read | |
975 do_logoffset_common_read: | |
976 clrf EEADRH | |
977 read_int_eeprom 0x0D | |
978 movff EEDATA,lo | |
979 read_int_eeprom 0x0E | |
980 movff EEDATA,hi ; Existing logbook offset into lo:hi | |
981 return | |
982 | |
983 | |
984 global update_battery_registers | |
985 update_battery_registers: | |
986 ; save battery_gauge:6 into EEPROM 0x07-0x0C | |
987 clrf EEADRH | |
988 movff battery_gauge+0,EEDATA | |
989 write_int_eeprom 0x07 | |
990 movff battery_gauge+1,EEDATA | |
991 write_int_eeprom 0x08 | |
992 movff battery_gauge+2,EEDATA | |
993 write_int_eeprom 0x09 | |
994 movff battery_gauge+3,EEDATA | |
995 write_int_eeprom 0x0A | |
996 movff battery_gauge+4,EEDATA | |
997 write_int_eeprom 0x0B | |
998 movff battery_gauge+5,EEDATA | |
999 write_int_eeprom 0x0C | |
1000 return | |
1001 | |
1002 | |
133
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1003 global vault_decodata_into_eeprom |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1004 vault_decodata_into_eeprom: |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1005 ; Vault in EEPROM 512...1023 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1006 ; Write 0xAA at 512 to indicate valid data in vault |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1007 ; Store last time/date |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1008 ; Store 0x700 to 0x780 (pres_tissue_N2 and pres_tissue_He) |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1009 movlw LOW .512 ; =0 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1010 movwf EEADR |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1011 movlw HIGH .512 ; =2 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1012 movwf EEADRH |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1013 movlw 0xAA |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1014 movwf EEDATA |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1015 write_int_eeprom .0 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1016 ; Store date/time |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1017 movff year,EEDATA |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1018 write_int_eeprom .1 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1019 movff month,EEDATA |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1020 write_int_eeprom .2 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1021 movff day,EEDATA |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1022 write_int_eeprom .3 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1023 movff hours,EEDATA |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1024 write_int_eeprom .4 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1025 movff mins,EEDATA |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1026 write_int_eeprom .5 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1027 movff secs,EEDATA |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1028 write_int_eeprom .6 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1029 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1030 movff int_O_CNS_fraction+0,EEDATA |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1031 write_int_eeprom .7 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1032 movff int_O_CNS_fraction+1,EEDATA |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1033 write_int_eeprom .8 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1034 movff desaturation_time+0,EEDATA |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1035 write_int_eeprom .9 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1036 movff desaturation_time+1,EEDATA |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1037 write_int_eeprom .10 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1038 movff surface_interval+0,EEDATA |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1039 write_int_eeprom .11 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1040 movff surface_interval+1,EEDATA |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1041 write_int_eeprom .12 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1042 movff char_O_gradient_factor,EEDATA |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1043 write_int_eeprom .13 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1044 movff nofly_time+0,EEDATA |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1045 write_int_eeprom .14 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1046 movff nofly_time+1,EEDATA |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1047 write_int_eeprom .15 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1048 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1049 ; Tissue data from 16 to 144 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1050 movlw .16 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1051 movwf EEADR |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1052 movlw .128 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1053 movwf lo |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1054 lfsr FSR1,0x700;pres_tissue_N2+0 ; 32*4Byte Float = 128Bytes |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1055 vault_decodata_into_eeprom2: |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1056 movff POSTINC1,EEDATA |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1057 call write_eeprom ; EEDATA into EEPROM@EEADR |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1058 incf EEADR,F |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1059 decfsz lo,F ; All done? |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1060 bra vault_decodata_into_eeprom2 ; No |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1061 clrf EEADRH |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1062 return |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1063 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1064 global restore_decodata_from_eeprom |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1065 restore_decodata_from_eeprom: |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1066 movlw LOW .512 ; =0 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1067 movwf EEADR |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1068 movlw HIGH .512 ; =2 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1069 movwf EEADRH |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1070 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1071 ; Restore date/time |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1072 read_int_eeprom .1 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1073 movff EEDATA,year |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1074 read_int_eeprom .2 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1075 movff EEDATA,month |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1076 read_int_eeprom .3 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1077 movff EEDATA,day |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1078 read_int_eeprom .4 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1079 movff EEDATA,hours |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1080 read_int_eeprom .5 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1081 movff EEDATA,mins |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1082 read_int_eeprom .6 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1083 movff EEDATA,secs |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1084 call rtc_set_rtc |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1085 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1086 read_int_eeprom .7 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1087 movff EEDATA,int_O_CNS_fraction+0 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1088 read_int_eeprom .8 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1089 movff EEDATA,int_O_CNS_fraction+1 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1090 read_int_eeprom .9 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1091 movff EEDATA,desaturation_time+0 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1092 read_int_eeprom .10 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1093 movff EEDATA,desaturation_time+1 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1094 read_int_eeprom .11 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1095 movff EEDATA,surface_interval+0 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1096 read_int_eeprom .12 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1097 movff EEDATA,surface_interval+1 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1098 read_int_eeprom .13 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1099 movff EEDATA,char_O_gradient_factor |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1100 read_int_eeprom .14 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1101 movff EEDATA,nofly_time+0 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1102 read_int_eeprom .15 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1103 movff EEDATA,nofly_time+1 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1104 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1105 ; Tissue data from 16 to 144 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1106 movlw .16 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1107 movwf EEADR |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1108 movlw .128 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1109 movwf lo |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1110 lfsr FSR1,0x700;pres_tissue_N2+0 ; 32*4Byte Float = 128Bytes |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1111 restore_decodata_from_eeprom2: |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1112 call read_eeprom ; EEPROM@EEADR into EEDATA |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1113 movff EEDATA,POSTINC1 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1114 incf EEADR,F |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1115 decfsz lo,F ; All done? |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1116 bra restore_decodata_from_eeprom2 ; No |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1117 clrf EEADRH |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1118 return |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1119 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1120 |
0 | 1121 END |