Mercurial > public > hwos_code
annotate src/ghostwriter.asm @ 160:99ac325586ce
BUGFIX: Fast diluent (w/o dive mode menu) change did not work correctly
author | heinrichsweikamp |
---|---|
date | Mon, 08 Sep 2014 15:39:41 +0200 |
parents | fdd4e30846ae |
children | 30ebaf72170d |
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 | |
147 | 392 infsnz lo,F |
393 incf hi,F | |
0 | 394 ; Store new number in EEPROM |
395 movff lo,EEDATA | |
396 write_int_eeprom .2 | |
397 movff hi,EEDATA | |
398 write_int_eeprom .3 | |
399 | |
400 decf lo,F ; -1 | |
401 ; Set ext_flash_address:3 to TOC entry of this dive | |
402 ; 1st: 200000h-200FFFh -> lo=0 | |
403 ; 2nd: 201000h-201FFFh -> lo=1 | |
404 ; 3rd: 202000h-202FFFh -> lo=2 | |
405 ; 255: 2FF000h-2FFFFFh -> lo=255 | |
406 | |
407 clrf ext_flash_address+0 | |
408 clrf ext_flash_address+1 | |
409 movlw 0x20 | |
410 movwf ext_flash_address+2 | |
411 movlw .16 | |
412 mulwf lo ; lo*16 = offset to 0x2000 (up:hi) | |
413 movf PRODL,W | |
414 addwf ext_flash_address+1,F | |
415 movf PRODH,W | |
416 addwfc ext_flash_address+2,F | |
417 | |
418 ; Now, write header | |
419 | |
420 movlw 0xFA ; Header start | |
421 rcall ghostwrite_byte_header ; (This call will also delete the 4kB TOC entry first) | |
422 movlw 0xFA | |
423 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
424 | |
425 ; store pointer to begin of diveprofile | |
426 read_int_eeprom .4 | |
427 movf EEDATA,W | |
428 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
429 read_int_eeprom .5 | |
430 movf EEDATA,W | |
431 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
432 read_int_eeprom .6 | |
433 movf EEDATA,W | |
434 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
435 | |
436 ; store pointer to end of diveprofile | |
437 movf ext_flash_log_pointer+0,W | |
438 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
439 movf ext_flash_log_pointer+1,W | |
440 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
441 movf ext_flash_log_pointer+2,W | |
442 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
443 | |
444 ; write rest of header | |
445 movlw logbook_profile_version ; Defined in ostc3.inc | |
446 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
447 | |
448 ; Store dive length | |
449 movf ext_flash_dive_counter+0,W | |
450 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
451 movf ext_flash_dive_counter+1,W | |
452 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
453 movf ext_flash_dive_counter+2,W | |
454 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
455 | |
456 movf year,W ; Date | |
457 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
458 movf month,W | |
459 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
460 movf day,W | |
461 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
462 movf hours,W ; End of dive time | |
463 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
464 movf mins,W | |
465 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
466 | |
467 btfss FLAG_apnoe_mode ; Store apnoe max or normal max (Which is only max from the last descent) | |
468 bra end_dive1 ; Store normal depth | |
469 | |
470 movff apnoe_max_pressure+0,lo | |
471 movff apnoe_max_pressure+1,hi | |
472 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] | |
473 movff lo,apnoe_max_pressure+0 | |
474 movff hi,apnoe_max_pressure+1 | |
475 | |
476 movf apnoe_max_pressure+0,W ; Max. depth | |
477 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
478 movf apnoe_max_pressure+1,W | |
479 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
480 bra end_dive2 ; skip normal max. depth | |
481 | |
482 end_dive1: | |
483 movff max_pressure+0,lo | |
484 movff max_pressure+1,hi | |
485 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] | |
486 movff lo,max_pressure+0 | |
487 movff hi,max_pressure+1 | |
488 | |
489 movff max_pressure+0,WREG ; Max. depth | |
490 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
491 movff max_pressure+1,WREG | |
492 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
493 | |
494 end_dive2: | |
495 movf divemins+0,W ; divetime minutes | |
496 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
497 movf divemins+1,W | |
498 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
499 movf divesecs,W ; divetime seconds | |
500 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
501 movff minimum_temperature+0,WREG ; minimum temperature | |
502 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
503 movff minimum_temperature+1,WREG | |
504 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
505 movff last_surfpressure_30min+0,WREG ; airpressure before dive | |
506 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
507 movff last_surfpressure_30min+1,WREG | |
508 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
509 movff int_O_desaturation_time+0,WREG ; desaturation time in minutes | |
510 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
511 movff int_O_desaturation_time+1,WREG | |
512 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
513 | |
514 btfss FLAG_ccr_mode ; In CCR mode... | |
515 bra end_dive_oc_gaslist ; No, write OC gases | |
516 ; Write Diluents... | |
517 movff opt_dil_O2_ratio+0,WREG | |
518 rcall ghostwrite_byte_header ; %O2 | |
519 movff opt_dil_He_ratio+0,WREG | |
520 rcall ghostwrite_byte_header ; %He | |
521 movff char_I_dil_change+0,WREG | |
522 rcall ghostwrite_byte_header ; Configured change depth in m | |
523 movff opt_dil_type+0,WREG | |
524 rcall ghostwrite_byte_header ; 0=Disabled, 1=First, 2=Normal | |
525 | |
526 movff opt_dil_O2_ratio+1,WREG | |
527 rcall ghostwrite_byte_header ; %O2 | |
528 movff opt_dil_He_ratio+1,WREG | |
529 rcall ghostwrite_byte_header ; %He | |
530 movff char_I_dil_change+1,WREG | |
531 rcall ghostwrite_byte_header ; Configured change depth in m | |
532 movff opt_dil_type+1,WREG | |
533 rcall ghostwrite_byte_header ; 0=Disabled, 1=First, 2=Normal | |
534 | |
535 movff opt_dil_O2_ratio+2,WREG | |
536 rcall ghostwrite_byte_header ; %O2 | |
537 movff opt_dil_He_ratio+2,WREG | |
538 rcall ghostwrite_byte_header ; %He | |
539 movff char_I_dil_change+2,WREG | |
540 rcall ghostwrite_byte_header ; Configured change depth in m | |
541 movff opt_dil_type+2,WREG | |
542 rcall ghostwrite_byte_header ; 0=Disabled, 1=First, 2=Normal | |
543 | |
544 movff opt_dil_O2_ratio+3,WREG | |
545 rcall ghostwrite_byte_header ; %O2 | |
546 movff opt_dil_He_ratio+3,WREG | |
547 rcall ghostwrite_byte_header ; %He | |
548 movff char_I_dil_change+3,WREG | |
549 rcall ghostwrite_byte_header ; Configured change depth in m | |
550 movff opt_dil_type+3,WREG | |
551 rcall ghostwrite_byte_header ; 0=Disabled, 1=First, 2=Normal | |
552 | |
553 movff opt_dil_O2_ratio+4,WREG | |
554 rcall ghostwrite_byte_header ; %O2 | |
555 movff opt_dil_He_ratio+4,WREG | |
556 rcall ghostwrite_byte_header ; %He | |
557 movff char_I_dil_change+4,WREG | |
558 rcall ghostwrite_byte_header ; Configured change depth in m | |
559 movff opt_dil_type+4,WREG | |
560 rcall ghostwrite_byte_header ; 0=Disabled, 1=First, 2=Normal | |
561 bra end_dive_oc_cc_common | |
562 | |
563 end_dive_oc_gaslist: ; OC Gases... | |
564 movff opt_gas_O2_ratio+0,WREG | |
565 rcall ghostwrite_byte_header ; %O2 | |
566 movff opt_gas_He_ratio+0,WREG | |
567 rcall ghostwrite_byte_header ; %He | |
97
53a99a2dc6a1
CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents:
39
diff
changeset
|
568 movff opt_OC_bail_gas_change+0,WREG |
0 | 569 rcall ghostwrite_byte_header ; Configured change depth in m |
570 movff opt_gas_type+0,WREG | |
571 rcall ghostwrite_byte_header ; 0=Disabled, 1=First, 2= Travel, 3= Deco | |
572 | |
573 movff opt_gas_O2_ratio+1,WREG | |
574 rcall ghostwrite_byte_header ; %O2 | |
575 movff opt_gas_He_ratio+1,WREG | |
576 rcall ghostwrite_byte_header ; %He | |
97
53a99a2dc6a1
CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents:
39
diff
changeset
|
577 movff opt_OC_bail_gas_change+1,WREG |
0 | 578 rcall ghostwrite_byte_header ; Configured change depth in m |
579 movff opt_gas_type+1,WREG | |
580 rcall ghostwrite_byte_header ; 0=Disabled, 1=First, 2= Travel, 3= Deco | |
581 | |
582 movff opt_gas_O2_ratio+2,WREG | |
583 rcall ghostwrite_byte_header ; %O2 | |
584 movff opt_gas_He_ratio+2,WREG | |
585 rcall ghostwrite_byte_header ; %He | |
97
53a99a2dc6a1
CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents:
39
diff
changeset
|
586 movff opt_OC_bail_gas_change+2,WREG |
0 | 587 rcall ghostwrite_byte_header ; Configured change depth in m |
588 movff opt_gas_type+2,WREG | |
589 rcall ghostwrite_byte_header ; 0=Disabled, 1=First, 2= Travel, 3= Deco | |
590 | |
591 movff opt_gas_O2_ratio+3,WREG | |
592 rcall ghostwrite_byte_header ; %O2 | |
593 movff opt_gas_He_ratio+3,WREG | |
594 rcall ghostwrite_byte_header ; %He | |
97
53a99a2dc6a1
CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents:
39
diff
changeset
|
595 movff opt_OC_bail_gas_change+3,WREG |
0 | 596 rcall ghostwrite_byte_header ; Configured change depth in m |
597 movff opt_gas_type+3,WREG | |
598 rcall ghostwrite_byte_header ; 0=Disabled, 1=First, 2= Travel, 3= Deco | |
599 | |
600 movff opt_gas_O2_ratio+4,WREG | |
601 rcall ghostwrite_byte_header ; %O2 | |
602 movff opt_gas_He_ratio+4,WREG | |
603 rcall ghostwrite_byte_header ; %He | |
97
53a99a2dc6a1
CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents:
39
diff
changeset
|
604 movff opt_OC_bail_gas_change+4,WREG |
0 | 605 rcall ghostwrite_byte_header ; Configured change depth in m |
606 movff opt_gas_type+4,WREG | |
607 rcall ghostwrite_byte_header ; 0=Disabled, 1=First, 2= Travel, 3= Deco | |
608 ; bra end_dive_oc_cc_common | |
609 | |
610 end_dive_oc_cc_common: | |
611 movlw softwareversion_x ; Firmware version | |
612 rcall ghostwrite_byte_header | |
613 movlw softwareversion_y | |
614 rcall ghostwrite_byte_header | |
615 movf batt_voltage+0,W ; Battery voltage | |
616 rcall ghostwrite_byte_header | |
617 movf batt_voltage+1,W | |
618 rcall ghostwrite_byte_header | |
619 | |
23
e402813343b6
new option to switch samplingrate between 10s and 2s
heinrichsweikamp
parents:
6
diff
changeset
|
620 movf samplingrate,W ; Sampling rate |
e402813343b6
new option to switch samplingrate between 10s and 2s
heinrichsweikamp
parents:
6
diff
changeset
|
621 btfsc FLAG_apnoe_mode ; Apnoe mode? |
e402813343b6
new option to switch samplingrate between 10s and 2s
heinrichsweikamp
parents:
6
diff
changeset
|
622 movlw samplingrate_apnoe ; Apnoe sampling rate |
0 | 623 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash |
624 | |
625 ; CNS at gebinning of dive | |
626 movff CNS_start+0,WREG | |
627 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
628 movff CNS_start+1,WREG | |
629 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
630 ; Gradient factor | |
631 movff GF_start,WREG | |
632 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
633 movff char_O_relative_gradient_GF,WREG | |
634 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
5 | 635 |
636 ; Logbook offset | |
637 call do_logoffset_common_read; Read into lo:hi | |
638 movf lo,W | |
0 | 639 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash |
5 | 640 movf hi,W |
0 | 641 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash |
5 | 642 |
643 ; Spare at Byte 60 | |
0 | 644 movlw 0xFF |
645 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
646 ; Store 5 Setpoints | |
647 movff char_I_setpoint_cbar+0,WREG | |
648 rcall ghostwrite_byte_header ; Setpoint in cbar | |
649 movff char_I_setpoint_change+0,WREG | |
650 rcall ghostwrite_byte_header ; Change depth | |
651 movff char_I_setpoint_cbar+1,WREG | |
652 rcall ghostwrite_byte_header ; Setpoint in cbar | |
653 movff char_I_setpoint_change+1,WREG | |
654 rcall ghostwrite_byte_header ; Change depth | |
655 movff char_I_setpoint_cbar+2,WREG | |
656 rcall ghostwrite_byte_header ; Setpoint in cbar | |
657 movff char_I_setpoint_change+2,WREG | |
658 rcall ghostwrite_byte_header ; Change depth | |
659 movff char_I_setpoint_cbar+3,WREG | |
660 rcall ghostwrite_byte_header ; Setpoint in cbar | |
661 movff char_I_setpoint_change+3,WREG | |
662 rcall ghostwrite_byte_header ; Change depth | |
663 movff char_I_setpoint_cbar+4,WREG | |
664 rcall ghostwrite_byte_header ; Setpoint in cbar | |
665 movff char_I_setpoint_change+4,WREG | |
666 rcall ghostwrite_byte_header ; Change depth | |
667 | |
668 movff opt_salinity,WREG ; Salinity (0-5%) | |
669 rcall ghostwrite_byte_header ; Store Salinity to Dive | |
670 | |
671 movff int_O_CNS_fraction+0,WREG ; copy into bank1 | |
672 rcall ghostwrite_byte_header; Stores CNS% | |
673 movff int_O_CNS_fraction+1,WREG ; copy into bank1 | |
674 rcall ghostwrite_byte_header; Stores CNS% | |
675 | |
676 movff avr_rel_pressure_total+0,WREG ; Average Depth | |
677 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
678 movff avr_rel_pressure_total+1,WREG ; Average Depth | |
679 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
680 | |
681 movff total_divetime_seconds+0,WREG ; Total dive time (Regardless of start_dive_threshold) | |
682 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
683 movff total_divetime_seconds+1,WREG ; Total dive time (Regardless of start_dive_threshold) | |
684 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
685 | |
686 movff char_I_GF_Low_percentage,WREG ; GF_lo | |
687 movff char_I_deco_model,lo | |
688 decfsz lo,F ; jump over next line if char_I_deco_model == 1 | |
689 movff char_I_saturation_multiplier,WREG ; Saturation Multiplier | |
690 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
691 | |
692 movff char_I_GF_High_percentage,WREG ; GF_hi | |
693 movff char_I_deco_model,lo | |
694 decfsz lo,F ; jump over next line if char_I_deco_model == 1 | |
695 movff char_I_desaturation_multiplier,WREG ; Desaturation Multiplier | |
696 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
697 | |
698 movff char_I_deco_model,WREG ; 0 = ZH-L16, 1 = ZH-L16-GF | |
699 rcall ghostwrite_byte_header; writes byte and increases address (no banking) | |
700 | |
701 read_int_eeprom .2 | |
702 movf EEDATA,W | |
703 rcall ghostwrite_byte_header ; Total dive counter, low | |
704 read_int_eeprom .3 | |
705 movf EEDATA,W | |
706 rcall ghostwrite_byte_header ; Total dive counter, high | |
707 | |
708 movff opt_dive_mode,WREG | |
709 rcall ghostwrite_byte_header ; 0=OC, 1=CC, 2=Gauge, 3=Apnea | |
710 | |
711 ; Store all tissue data available | |
712 movlw .16 | |
713 movwf lo | |
714 lfsr FSR1,char_O_tissue_N2_saturation+0 | |
715 end_dive_store_tissues_N2: | |
716 movf POSTINC1,W | |
717 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
718 decfsz lo,F | |
719 bra end_dive_store_tissues_N2 ; No | |
720 | |
721 movlw .64 | |
722 movwf lo | |
723 lfsr FSR1,0x700;pres_tissue_N2+0 ; 16*4Byte Float = 64Bytes | |
724 end_dive_store_tissues_N2_2: | |
725 movf POSTINC1,W | |
726 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
727 decfsz lo,F | |
728 bra end_dive_store_tissues_N2_2 ; No | |
729 | |
730 movlw .16 | |
731 movwf lo | |
732 lfsr FSR1,char_O_tissue_He_saturation+0 | |
733 end_dive_store_tissues_He: | |
734 movf POSTINC1,W | |
735 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
736 decfsz lo,F | |
737 bra end_dive_store_tissues_He ; No | |
738 | |
739 movlw .64 | |
740 movwf lo | |
741 lfsr FSR1,0x740;pres_tissue_He+0 ; 16*4Byte Float = 64Bytes | |
742 end_dive_store_tissues_He_2: | |
743 movf POSTINC1,W | |
744 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
745 decfsz lo,F | |
746 bra end_dive_store_tissues_He_2 ; No | |
747 | |
748 ; Some deco stuff | |
749 movff char_I_depth_last_deco,WREG ; last stop [m] | |
750 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
751 movff char_I_deco_distance,WREG ; assumed distance to shown stop | |
752 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
753 | |
754 ; Last HUD data | |
755 movff hud_battery_mv+0,WREG ; Last HUD battery value | |
756 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
757 movff hud_battery_mv+1,WREG ; Last HUD battery value | |
758 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
759 movff hud_status_byte,WREG ; Last HUD status | |
760 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
761 | |
762 ; Battery gauge registers [nAs] | |
763 movff battery_gauge+0,WREG ; Battery gauge register | |
764 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
765 movff battery_gauge+1,WREG ; Battery gauge register | |
766 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
767 movff battery_gauge+2,WREG ; Battery gauge register | |
768 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
769 movff battery_gauge+3,WREG ; Battery gauge register | |
770 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
771 movff battery_gauge+4,WREG ; Battery gauge register | |
772 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
773 movff battery_gauge+5,WREG ; Battery gauge register | |
774 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
775 | |
776 ; Header stop | |
777 movlw 0xFB | |
778 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
779 movlw 0xFB | |
780 rcall ghostwrite_byte_header ; WREG -> Header in ext. flash | |
781 | |
782 call divemode_store_statistics ; Store/update statistics for this unit | |
783 | |
784 clrf surface_interval+0 | |
785 clrf surface_interval+1 ; Clear surface interval timer | |
786 | |
787 ghostwriter_end_dive_common: | |
788 ; Update ext_flash_log_pointer into EEPROM | |
789 clrf EEADRH | |
790 movff ext_flash_log_pointer+0,EEDATA | |
791 write_int_eeprom .4 | |
792 movff ext_flash_log_pointer+1,EEDATA | |
793 write_int_eeprom .5 | |
794 movff ext_flash_log_pointer+2,EEDATA | |
795 write_int_eeprom .6 | |
796 | |
797 bcf simulatormode_active ; if we were in simulator mode | |
798 | |
799 ; In DEBUG compile, keep all simulated dives in logbook, Desat time, nofly, etc... | |
800 ifndef __DEBUG | |
801 extern deco_pull_tissues_from_vault | |
802 btfsc restore_deco_data ; Restore decodata? | |
803 call deco_pull_tissues_from_vault | |
804 banksel common ; Bank1 | |
805 endif | |
806 call update_battery_registers ; update battery registers into EEPROM | |
807 goto surfloop ; and return to surfaceloop | |
808 | |
809 global ghostwriter_short_header | |
810 ghostwriter_short_header: ; Write short header with divenumber into profile memory | |
811 | |
812 ; load pointer for profile storing into RAM (Updated in EEPROM after the dive) | |
813 clrf EEADRH ; Make sure to select eeprom bank 0 | |
814 read_int_eeprom .4 | |
815 movff EEDATA,ext_flash_address+0 | |
816 read_int_eeprom .5 | |
817 movff EEDATA,ext_flash_address+1 | |
818 read_int_eeprom .6 | |
819 movff EEDATA,ext_flash_address+2 | |
820 | |
821 ; Clear dive length counter | |
822 clrf ext_flash_dive_counter+0 | |
823 clrf ext_flash_dive_counter+1 | |
824 clrf ext_flash_dive_counter+2 | |
825 | |
826 ; Write short header with divenumber into profile memory | |
827 movlw 0xFA | |
828 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. flash | |
829 movlw 0xFA | |
830 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. flash | |
831 ; Load total number of dives (low byte only) | |
832 read_int_eeprom .2 | |
833 incf EEDATA,W ;+1 | |
834 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. flash | |
835 read_int_eeprom .3 | |
836 movf EEDATA,W | |
837 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. flash | |
838 movlw 0xFA | |
839 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. flash | |
840 movlw 0xFA | |
841 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. flash | |
842 ; Keep room for dive length ext_flash_dive_counter:3 (Stored at the end of the dive) | |
843 incf_ext_flash_address_0x20 d'3' ; Skip Bytes in external flash (faster) | |
844 | |
23
e402813343b6
new option to switch samplingrate between 10s and 2s
heinrichsweikamp
parents:
6
diff
changeset
|
845 movf samplingrate,W ; Sampling rate |
0 | 846 btfsc FLAG_apnoe_mode ; Apnoe mode? |
847 movlw samplingrate_apnoe ; Apnoe sampling rate | |
848 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. flash | |
849 | |
850 movlw .7 ; Number of divisors | |
851 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. flash | |
852 | |
853 movlw .0 ; Type | |
854 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. flash | |
855 movlw infolength_temperature | |
856 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. flash | |
857 movlw div_temperature ; Divisor temperature | |
858 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. flash | |
859 | |
860 movlw .1 ; Type | |
861 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. flash | |
862 movlw infolength_deco | |
863 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. flash | |
864 movlw div_deco ; Divisor decodata | |
865 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. flash | |
866 | |
867 movlw .2 ; Type | |
868 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. flash | |
869 movlw infolength_gf | |
870 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. flash | |
871 movlw div_gf ; Divisor gf | |
872 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. flash | |
873 | |
874 movlw .3 ; Type | |
875 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. flash | |
876 movlw infolength_ppo2_sensors | |
877 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. flash | |
878 movlw div_ppo2_sensors ; Divisor ppO2 | |
107
dc44aa645549
BUGFIX: wrong ppo2 recording parameter in short header
heinrichsweikamp
parents:
99
diff
changeset
|
879 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
|
880 movlw .0 ; No ppO2 data in OC mode |
0 | 881 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. flash |
882 | |
883 movlw .4 ; Type | |
884 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. flash | |
885 movlw infolength_decoplan | |
886 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. flash | |
887 movlw div_decoplan ; Divisor debug | |
888 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. flash | |
889 | |
890 movlw .5 ; Type | |
891 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. flash | |
892 movlw infolength_cns | |
893 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. flash | |
894 movlw div_cns ; Divisor CNS | |
895 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. flash | |
896 | |
897 movlw .6 ; Type | |
898 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. flash | |
899 movlw infolength_tank | |
900 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. flash | |
901 movlw div_tank ; Divisor Tank | |
902 rcall ghostwrite_byte_profile ; WREG -> Profile in ext. flash | |
903 | |
904 return | |
905 | |
906 calculate_noflytime: | |
907 ; calculate nofly time | |
908 movff int_O_desaturation_time+0,xA+0 | |
909 movff int_O_desaturation_time+1,xA+1 | |
910 | |
911 btfsc xA+1,7 ; Is desat time negative ? | |
912 bra calculate_noflytime_3 ; Then surely not valid ! | |
913 | |
914 tstfsz xA+0 ; Desat=0? | |
915 bra calculate_noflytime2 | |
916 tstfsz xA+1 ; Desat=0? | |
917 bra calculate_noflytime2 | |
918 | |
919 calculate_noflytime_3: | |
920 ; Desaturation time = zero | |
921 clrf nofly_time+0 ; Clear nofly time | |
922 clrf nofly_time+1 ; Clear nofly time | |
923 return | |
924 | |
925 calculate_noflytime2: | |
926 movff xA+0,int_I_temp+0 | |
927 movff xA+1,int_I_temp+1 | |
928 movlw no_fly_time_ratio ; nofly_time_ratio | |
929 movff WREG,char_I_temp | |
930 call deco_calc_percentage | |
931 movlb b'00000001' ; select ram bank 1 | |
932 movff int_I_temp+0,xA+0 | |
933 movff int_I_temp+1,xA+1 | |
934 tstfsz xA+0 ; Desat=0? | |
935 bra calculate_noflytime_2_final | |
936 tstfsz xA+1 ; Desat=0? | |
937 bra calculate_noflytime_2_final | |
938 bra calculate_noflytime_3 | |
939 | |
940 calculate_noflytime_2_final: | |
941 movff xA+0,nofly_time+0 | |
942 movff xA+1,nofly_time+1 | |
943 return | |
944 | |
945 | |
946 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
|
947 rcall vault_decodata_into_eeprom ; update deco data |
0 | 948 rcall do_logoffset_common_read ; Existing logbook offset into lo:hi |
949 | |
950 tstfsz lo ; lo=0? | |
951 bra change_logbook_offset1 ; No, adjust offset | |
952 tstfsz hi ; hi=0? | |
953 bra change_logbook_offset1 ; No, adjust offset | |
954 bra change_logbook_offset2 ; lo=0 and hi=0 -> skip Offset routine | |
955 change_logbook_offset1: | |
956 movlw d'1' | |
957 addwf lo | |
958 movlw d'0' | |
959 addwfc hi | |
960 rcall do_logoffset_common_write ; lo:hi -> EEPROM | |
961 change_logbook_offset2: | |
962 ; Add more here... | |
963 return | |
964 | |
965 global do_logoffset_common_write | |
966 do_logoffset_common_write: | |
967 movff lo,EEDATA | |
968 write_int_eeprom 0x0D | |
969 movff hi,EEDATA | |
970 write_int_eeprom 0x0E | |
971 return | |
972 | |
973 global do_logoffset_common_read | |
974 do_logoffset_common_read: | |
975 clrf EEADRH | |
976 read_int_eeprom 0x0D | |
977 movff EEDATA,lo | |
978 read_int_eeprom 0x0E | |
979 movff EEDATA,hi ; Existing logbook offset into lo:hi | |
980 return | |
981 | |
982 | |
983 global update_battery_registers | |
984 update_battery_registers: | |
985 ; save battery_gauge:6 into EEPROM 0x07-0x0C | |
986 clrf EEADRH | |
987 movff battery_gauge+0,EEDATA | |
988 write_int_eeprom 0x07 | |
989 movff battery_gauge+1,EEDATA | |
990 write_int_eeprom 0x08 | |
991 movff battery_gauge+2,EEDATA | |
992 write_int_eeprom 0x09 | |
993 movff battery_gauge+3,EEDATA | |
994 write_int_eeprom 0x0A | |
995 movff battery_gauge+4,EEDATA | |
996 write_int_eeprom 0x0B | |
997 movff battery_gauge+5,EEDATA | |
998 write_int_eeprom 0x0C | |
999 return | |
1000 | |
1001 | |
133
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1002 global vault_decodata_into_eeprom |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1003 vault_decodata_into_eeprom: |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1004 ; Vault in EEPROM 512...1023 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1005 ; 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
|
1006 ; Store last time/date |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1007 ; 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
|
1008 movlw HIGH .512 ; =2 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1009 movwf EEADRH |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1010 movlw 0xAA |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1011 movwf EEDATA |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1012 write_int_eeprom .0 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1013 ; Store date/time |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1014 movff year,EEDATA |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1015 write_int_eeprom .1 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1016 movff month,EEDATA |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1017 write_int_eeprom .2 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1018 movff day,EEDATA |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1019 write_int_eeprom .3 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1020 movff hours,EEDATA |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1021 write_int_eeprom .4 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1022 movff mins,EEDATA |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1023 write_int_eeprom .5 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1024 movff secs,EEDATA |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1025 write_int_eeprom .6 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1026 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1027 movff int_O_CNS_fraction+0,EEDATA |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1028 write_int_eeprom .7 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1029 movff int_O_CNS_fraction+1,EEDATA |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1030 write_int_eeprom .8 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1031 movff desaturation_time+0,EEDATA |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1032 write_int_eeprom .9 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1033 movff desaturation_time+1,EEDATA |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1034 write_int_eeprom .10 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1035 movff surface_interval+0,EEDATA |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1036 write_int_eeprom .11 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1037 movff surface_interval+1,EEDATA |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1038 write_int_eeprom .12 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1039 movff char_O_gradient_factor,EEDATA |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1040 write_int_eeprom .13 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1041 movff nofly_time+0,EEDATA |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1042 write_int_eeprom .14 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1043 movff nofly_time+1,EEDATA |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1044 write_int_eeprom .15 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1045 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1046 ; Tissue data from 16 to 144 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1047 movlw .16 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1048 movwf EEADR |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1049 movlw .128 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1050 movwf lo |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1051 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
|
1052 vault_decodata_into_eeprom2: |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1053 movff POSTINC1,EEDATA |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1054 call write_eeprom ; EEDATA into EEPROM@EEADR |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1055 incf EEADR,F |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1056 decfsz lo,F ; All done? |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1057 bra vault_decodata_into_eeprom2 ; No |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1058 clrf EEADRH |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1059 return |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1060 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1061 global restore_decodata_from_eeprom |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1062 restore_decodata_from_eeprom: |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1063 movlw LOW .512 ; =0 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1064 movwf EEADR |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1065 movlw HIGH .512 ; =2 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1066 movwf EEADRH |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1067 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1068 ; Restore date/time |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1069 read_int_eeprom .1 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1070 movff EEDATA,year |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1071 read_int_eeprom .2 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1072 movff EEDATA,month |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1073 read_int_eeprom .3 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1074 movff EEDATA,day |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1075 read_int_eeprom .4 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1076 movff EEDATA,hours |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1077 read_int_eeprom .5 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1078 movff EEDATA,mins |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1079 read_int_eeprom .6 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1080 movff EEDATA,secs |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1081 call rtc_set_rtc |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1082 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1083 read_int_eeprom .7 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1084 movff EEDATA,int_O_CNS_fraction+0 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1085 read_int_eeprom .8 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1086 movff EEDATA,int_O_CNS_fraction+1 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1087 read_int_eeprom .9 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1088 movff EEDATA,desaturation_time+0 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1089 read_int_eeprom .10 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1090 movff EEDATA,desaturation_time+1 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1091 read_int_eeprom .11 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1092 movff EEDATA,surface_interval+0 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1093 read_int_eeprom .12 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1094 movff EEDATA,surface_interval+1 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1095 read_int_eeprom .13 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1096 movff EEDATA,char_O_gradient_factor |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1097 read_int_eeprom .14 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1098 movff EEDATA,nofly_time+0 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1099 read_int_eeprom .15 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1100 movff EEDATA,nofly_time+1 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1101 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1102 ; Tissue data from 16 to 144 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1103 movlw .16 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1104 movwf EEADR |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1105 movlw .128 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1106 movwf lo |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1107 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
|
1108 restore_decodata_from_eeprom2: |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1109 call read_eeprom ; EEPROM@EEADR into EEDATA |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1110 movff EEDATA,POSTINC1 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1111 incf EEADR,F |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1112 decfsz lo,F ; All done? |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1113 bra restore_decodata_from_eeprom2 ; No |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1114 clrf EEADRH |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1115 return |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1116 |
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
107
diff
changeset
|
1117 |
0 | 1118 END |