comparison src/ghostwriter.asm @ 628:cd58f7fc86db

3.05 stable work
author heinrichsweikamp
date Thu, 19 Sep 2019 12:01:29 +0200
parents c40025d8e750
children 237931377539
comparison
equal deleted inserted replaced
627:bf5fee575701 628:cd58f7fc86db
1 ;============================================================================= 1 ;=============================================================================
2 ; 2 ;
3 ; File ghostwriter.asm combined next generation V3.03.1 3 ; File ghostwriter.asm combined next generation V3.03.7
4 ; 4 ;
5 ; Ghostwriter (Log profile recorder) 5 ; Ghostwriter (Log profile recorder)
6 ; 6 ;
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. 7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
8 ;============================================================================= 8 ;=============================================================================
57 movwf divisor_decoplan 57 movwf divisor_decoplan
58 58
59 movlw div_cns 59 movlw div_cns
60 movwf divisor_cns 60 movwf divisor_cns
61 61
62 movlw div_tank 62 IFDEF _rx_functions
63 movwf divisor_tank 63 clrf WREG ; default to no tank data logging
64 btfsc tr_functions_activated ; TR functions activated?
65 movlw div_tank ; YES - get divisor for tank data
66 movwf divisor_tank ; initialize divisor
67 ENDIF
64 68
65 IFDEF _external_sensor 69 IFDEF _external_sensor
66 movlw div_ppo2_sensors 70 movlw div_ppo2_sensors
67 movwf divisor_ppo2_sensors 71 movwf divisor_ppo2_sensors
68 72
134 decfsz divisor_cns,W ; check divisor if it will become 0, dump decremented value to WREG 138 decfsz divisor_cns,W ; check divisor if it will become 0, dump decremented value to WREG
135 bra check_extended6 ; NO - skip 139 bra check_extended6 ; NO - skip
136 movlw infolength_cns ; YES - get length of extra data 140 movlw infolength_cns ; YES - get length of extra data
137 addwf ProfileFlagByte,F ; - add to ProfileFlagByte 141 addwf ProfileFlagByte,F ; - add to ProfileFlagByte
138 check_extended6: 142 check_extended6:
143 IFDEF _rx_functions
139 decfsz divisor_tank,W ; check divisor if it will become 0, dump decremented value to WREG 144 decfsz divisor_tank,W ; check divisor if it will become 0, dump decremented value to WREG
140 bra check_extended7 ; NO - skip 145 bra check_extended7 ; NO - skip
141 movlw infolength_tank ; YES - get length of extra data 146 movlw infolength_tank ; YES - get length of extra data
142 addwf ProfileFlagByte,F ; - add to ProfileFlagByte 147 addwf ProfileFlagByte,F ; - add to ProfileFlagByte
148 ENDIF
143 check_extended7: 149 check_extended7:
144 150
145 ; Second, check global event flag 151 ; Second, check global event flag
146 btfss event_occured ; check global event flag 152 btfss event_occured ; check global event flag
147 bra store_dive_data3 ; no event 153 bra store_dive_data3 ; no event
199 rcall ghostwrite_byte_profile ; WREG -> profile in ext. flash 205 rcall ghostwrite_byte_profile ; WREG -> profile in ext. flash
200 206
201 btfss event_occured ; check global event flag (again) 207 btfss event_occured ; check global event flag (again)
202 bra store_dive_data4 ; no event 208 bra store_dive_data4 ; no event
203 209
204 ; Store the EventByte(s) + additional bytes now 210 ; Store the EventByte(s) + additional bytes now
205 movf event_byte1,W 211 movf event_byte1,W
206 rcall ghostwrite_byte_profile ; WREG -> profile in ext. flash 212 rcall ghostwrite_byte_profile ; WREG -> profile in ext. flash
207 movf event_byte2,W ; write second event byte... 213 movf event_byte2,W ; write second event byte...
208 btfsc event_byte1,7 ; =1: another event byte is available 214 btfsc event_byte1,7 ; =1: another event byte is available
209 rcall ghostwrite_byte_profile ; store that information 215 rcall ghostwrite_byte_profile ; store that information
217 ELSE 223 ELSE
218 clrf WREG ; - He ratio is zero 224 clrf WREG ; - He ratio is zero
219 ENDIF 225 ENDIF
220 rcall ghostwrite_byte_profile ; - store it 226 rcall ghostwrite_byte_profile ; - store it
221 bcf event_gas_change_gas6 ; - clear event flag 227 bcf event_gas_change_gas6 ; - clear event flag
228
222 store_dive_data3b: 229 store_dive_data3b:
223 btfss event_gas_change ; did a gas change occur? 230 btfss event_gas_change ; did a gas change occur?
224 bra store_dive_data3c ; NO 231 bra store_dive_data3c ; NO
225 IFDEF _ccr_pscr 232 IFDEF _ccr_pscr
226 movf active_dil,W ; YES - store active diluent (default, may be overwritten soon) 233 movf active_dil,W ; YES - get active diluent by default
227 btfsc FLAG_oc_mode ; - in OC mode? 234 btfsc FLAG_oc_mode ; - in OC mode?
228 movf active_gas,W ; YES - get active gas 235 movf active_gas,W ; YES - replace by active gas
229 btfsc bailout_mode ; - in bailout? 236 btfsc bailout_mode ; - in bailout?
230 ENDIF 237 ENDIF
231 movf active_gas,W ; YES - get active OC = bailout gas 238 movf active_gas,W ; YES - get active OC (bailout) gas
232 rcall ghostwrite_byte_profile ; - store it 239 rcall ghostwrite_byte_profile ; - store it
233 bcf event_gas_change ; - clear event flag 240 bcf event_gas_change ; - clear event flag
241
234 store_dive_data3c: 242 store_dive_data3c:
235 IFDEF _ccr_pscr 243 IFDEF _ccr_pscr
236 btfss event_SP_change ; did a setpoint change occur? 244 btfss event_SP_change ; did a setpoint change occur?
237 bra store_dive_data3d ; NO 245 bra store_dive_data3d ; NO
238 movff char_I_const_ppO2,WREG ; YES - get setpoint 246 movff char_I_const_ppO2,WREG ; YES - get setpoint
239 rcall ghostwrite_byte_profile ; - store it 247 rcall ghostwrite_byte_profile ; - store it
240 bcf event_SP_change ; - clear event flag 248 bcf event_SP_change ; - clear event flag
241 ENDIF 249 ENDIF
250
242 store_dive_data3d: 251 store_dive_data3d:
243 IFDEF _ccr_pscr 252 IFDEF _ccr_pscr
244 btfss event_bailout ; did a gas change due to bailout occur? 253 btfss event_bailout ; did a gas change due to bailout occur?
245 bra store_dive_data4 ; NO 254 bra store_dive_data4 ; NO
246 movff char_I_O2_ratio,WREG ; YES - get O2 ratio of bailout gas 255 movff char_I_O2_ratio,WREG ; YES - get O2 ratio of bailout gas
247 rcall ghostwrite_byte_profile ; - store it 256 rcall ghostwrite_byte_profile ; - store it
248 IFDEF _helium 257 IFDEF _helium
249 movff char_I_He_ratio,WREG ; - get He ratio of bailout gas 258 movff char_I_He_ratio,WREG ; - get He ratio of bailout gas
250 ELSE 259 ELSE
251 clrf WREG ; - He ratio is zero 260 clrf WREG ; - He ratio is zero
252 ENDIF 261 ENDIF ; helium
253 rcall ghostwrite_byte_profile ; - store it 262 rcall ghostwrite_byte_profile ; - store it
254 bcf event_bailout ; - clear event flag 263 bcf event_bailout ; - clear event flag
255 ENDIF ; _ccr_pscr 264 ENDIF ; _ccr_pscr
265
256 store_dive_data4: 266 store_dive_data4:
257 ; Store extended information 267 ; Store extended information
268
258 decfsz divisor_temperature,F ; time to store a temperature sample ? 269 decfsz divisor_temperature,F ; time to store a temperature sample ?
259 bra store_extended1 ; NO - skip 270 bra store_dive_data4a ; NO - skip
260 rcall store_dive_temperature ; YES - store data 271 rcall store_dive_temperature ; YES - store data
261 store_extended1: 272 store_dive_data4a:
273 btfsc divisor_temperature,7 ; did the timer under-run?
274 clrf divisor_temperature ; YES - reset timer
275
262 decfsz divisor_deco,F ; time to store the current deco data? 276 decfsz divisor_deco,F ; time to store the current deco data?
263 bra store_extended2 ; NO - skip 277 bra store_dive_data4b ; NO - skip
264 rcall store_dive_decodata ; YES - store data 278 rcall store_dive_decodata ; YES - store data
265 store_extended2: 279 store_dive_data4b:
280 btfsc divisor_deco,7 ; did the timer under-run?
281 clrf divisor_deco ; YES - reset timer
282
266 decfsz divisor_supersat,F ; time to store the current supersaturation ? 283 decfsz divisor_supersat,F ; time to store the current supersaturation ?
267 bra store_extended3 ; NO - skip 284 bra store_dive_data4c ; NO - skip
268 rcall store_dive_supersat ; YES - store data 285 rcall store_dive_supersat ; YES - store data
269 store_extended3: 286 store_dive_data4c:
287 btfsc divisor_supersat,7 ; did the timer under-run?
288 clrf divisor_supersat ; YES - reset timer
289
270 IFDEF _external_sensor 290 IFDEF _external_sensor
271 decfsz divisor_ppo2_sensors,F ; decrement divisor, did it became 0 ? 291 decfsz divisor_ppo2_sensors,F ; decrement divisor, did it became 0 ?
272 bra store_extended4 ; NO - skip 292 bra store_dive_data4d ; NO - skip
273 rcall store_dive_ppO2_sensors ; YES - store data 293 rcall store_dive_ppO2_sensors ; YES - store data
274 ENDIF 294 store_dive_data4d:
275 store_extended4: 295 btfsc divisor_ppo2_sensors,7 ; did the timer under-run?
296 clrf divisor_ppo2_sensors ; YES - reset timer
297 ENDIF
298
276 decfsz divisor_decoplan,F ; decrement divisor, did it became 0 ? 299 decfsz divisor_decoplan,F ; decrement divisor, did it became 0 ?
277 bra store_extended5 ; NO - skip 300 bra store_dive_data4e ; NO - skip
278 rcall store_dive_decoplan ; YES - store data 301 rcall store_dive_decoplan ; YES - store data
279 store_extended5: 302 store_dive_data4e:
303 btfsc divisor_decoplan,7 ; did the timer under-run?
304 clrf divisor_decoplan ; YES - reset timer
305
280 decfsz divisor_cns,F ; decrement divisor, did it became 0 ? 306 decfsz divisor_cns,F ; decrement divisor, did it became 0 ?
281 bra store_extended6 ; NO - skip 307 bra store_dive_data4f ; NO - skip
282 rcall store_dive_cns ; YES - store data 308 rcall store_dive_cns ; YES - store data
283 store_extended6: 309 store_dive_data4f:
310 btfsc divisor_cns,7 ; did the timer under-run?
311 clrf divisor_cns ; YES - reset timer
312
313 IFDEF _rx_functions
284 decfsz divisor_tank,F ; decrement divisor, did it became 0 ? 314 decfsz divisor_tank,F ; decrement divisor, did it became 0 ?
285 bra store_extended7 ; NO - skip 315 bra store_dive_data4g ; NO - skip
286 rcall store_dive_tank ; YES - store data 316 rcall store_dive_tank ; YES - store data
287 store_extended7: 317 store_dive_data4g:
288 318 btfsc divisor_tank,7 ; did the timer under-run?
289 ; The next block is required to take care of "store never" 319 clrf divisor_tank ; YES - reset timer
290 btfsc divisor_temperature,7 ; test highest bit (register must have been zero before the "decfsz" command!) 320 ENDIF
291 clrf divisor_temperature ; and clear register again, so it will never reach zero...
292
293 btfsc divisor_deco,7
294 clrf divisor_deco
295
296 btfsc divisor_supersat,7
297 clrf divisor_supersat
298
299 IFDEF _external_sensor
300 btfsc divisor_ppo2_sensors,7
301 clrf divisor_ppo2_sensors
302 ENDIF
303
304 btfsc divisor_decoplan,7
305 clrf divisor_decoplan
306
307 btfsc divisor_cns,7
308 clrf divisor_cns
309
310 btfsc divisor_tank,7
311 clrf divisor_tank
312 321
313 store_dive_data5: 322 store_dive_data5:
314 bcf event_occured ; clear the global event flag 323 bcf event_occured ; clear the global event flag
315 clrf event_byte1 ; reset event byte 1 324 clrf event_byte1 ; reset event byte 1
316 clrf event_byte2 ; reset event byte 2 325 clrf event_byte2 ; reset event byte 2
317 return ; done (sample with all informations written to external flash) 326 return ; done (sample with all information written to external flash)
327
328
329 IFDEF _rx_functions
330 store_dive_tank:
331 movff int_O_tank_pressure+0,WREG ; get tank pressure, low byte
332 rcall ghostwrite_byte_profile ; store it
333 movff int_O_tank_pressure+1,WREG ; get tank pressure, high byte
334 rcall ghostwrite_byte_profile ; store it
335 movlw div_tank ; get sampling rate
336 movwf divisor_tank ; reload timer
337 return
338 ENDIF
318 339
319 store_dive_cns: 340 store_dive_cns:
320 movff int_O_CNS_current+0,WREG ; get current CNS, low byte 341 movff int_O_CNS_current+0,WREG ; get current CNS, low byte
321 rcall ghostwrite_byte_profile ; store it 342 rcall ghostwrite_byte_profile ; store it
322 movff int_O_CNS_current+1,WREG ; get current CNS, high byte 343 movff int_O_CNS_current+1,WREG ; get current CNS, high byte
323 bcf WREG,int_warning_flag ; clear warning flag 344 bcf WREG,int_warning_flag ; clear warning flag
324 bcf WREG,int_attention_flag ; clear attention flag 345 bcf WREG,int_attention_flag ; clear attention flag
325 rcall ghostwrite_byte_profile ; store it 346 rcall ghostwrite_byte_profile ; store it
326 movlw div_cns 347 movlw div_cns ; get sampling rate
327 movwf divisor_cns ; reload divisor from CF 348 movwf divisor_cns ; reload timer
328 return
329
330 store_dive_tank:
331 ; OSTC TR tank pressure logging
332 movlw div_tank
333 movwf divisor_tank ; reload divisor from CF
334 return 349 return
335 350
336 store_dive_decoplan: 351 store_dive_decoplan:
337 ; Store the deco plan 352 ; Store the deco plan
338 lfsr FSR1,char_O_deco_time_for_log ; load base address of deco stop times table 353 lfsr FSR1,char_O_deco_time_for_log ; load base address of deco stop times table
341 store_dive_decoplan_loop: 356 store_dive_decoplan_loop:
342 movf POSTINC1,W ; get a stop time 357 movf POSTINC1,W ; get a stop time
343 rcall ghostwrite_byte_profile ; store it 358 rcall ghostwrite_byte_profile ; store it
344 decfsz lo,F ; decrement loop counter, became zero? 359 decfsz lo,F ; decrement loop counter, became zero?
345 bra store_dive_decoplan_loop ; NO - loop 360 bra store_dive_decoplan_loop ; NO - loop
346 movlw div_decoplan ; YES - get divisor for deco plan recording 361 movlw div_decoplan ; YES - get sampling rate
347 movwf divisor_decoplan ; - reload timer 362 movwf divisor_decoplan ; - reload timer
348 return ; - done 363 return ; - done
349 364
350 ;=============================================================================
351 365
352 IFDEF _external_sensor 366 IFDEF _external_sensor
353
354 store_dive_ppO2_sensors: 367 store_dive_ppO2_sensors:
355 movff sensor1_ppO2,WREG ; get sensor 1 ppO2 (in 0.01 bar steps) 368 movff sensor1_ppO2,WREG ; get sensor 1 ppO2 (in 0.01 bar steps)
356 rcall ghostwrite_byte_profile ; store it 369 rcall ghostwrite_byte_profile ; store it
357 SMOVII sensor1_mv,mpr ; ISR-safe 2 byte copy of o2_mv_sensor to hi:lo 370 SMOVII sensor1_mv,mpr ; ISR-safe 2 byte copy of o2_mv_sensor to hi:lo
358 movf lo,W ; in 0.1 mV steps, low byte 371 movf lo,W ; in 0.1 mV steps, low byte
374 movf lo,W ; in 0.1 mV steps, low byte 387 movf lo,W ; in 0.1 mV steps, low byte
375 rcall ghostwrite_byte_profile ; store it 388 rcall ghostwrite_byte_profile ; store it
376 movf hi,W ; in 0.1 mV steps, high byte 389 movf hi,W ; in 0.1 mV steps, high byte
377 rcall ghostwrite_byte_profile ; store it 390 rcall ghostwrite_byte_profile ; store it
378 391
379 movlw div_ppo2_sensors 392 movlw div_ppo2_sensors ; get sampling rate
380 movwf divisor_ppo2_sensors ; reload timer 393 movwf divisor_ppo2_sensors ; reload timer
381 return 394 return
382 395 ENDIF
383 ENDIF 396
384
385 ;=============================================================================
386 397
387 store_dive_supersat: 398 store_dive_supersat:
388 movff int_O_lead_supersat+0,WREG ; get leading tissue's supersaturation (value is limited to 255, only lower byte is used for the value) 399 movff int_O_lead_supersat+0,WREG ; get leading tissue's supersaturation (value is limited to 255, only lower byte is used for the value)
389 rcall ghostwrite_byte_profile ; store it 400 rcall ghostwrite_byte_profile ; store it
390 movlw div_gf 401 movlw div_gf ; get sampling rate
391 movwf divisor_supersat ; reload timer 402 movwf divisor_supersat ; reload timer
392 return 403 return
393 404
394 store_dive_decodata: 405 store_dive_decodata:
395 ; Check if deco stops are necessary 406 ; Check if deco stops are necessary
407 movff char_O_deco_depth,WREG ; get depth of the first stop in meters 418 movff char_O_deco_depth,WREG ; get depth of the first stop in meters
408 rcall ghostwrite_byte_profile ; store it 419 rcall ghostwrite_byte_profile ; store it
409 movff char_O_deco_time,WREG ; get time of the first stop in minutes 420 movff char_O_deco_time,WREG ; get time of the first stop in minutes
410 rcall ghostwrite_byte_profile ; store it 421 rcall ghostwrite_byte_profile ; store it
411 store_dive_decodata_common: 422 store_dive_decodata_common:
412 movlw div_deco 423 movlw div_deco ; get sampling rate
413 movwf divisor_deco ; reload timer 424 movwf divisor_deco ; reload timer
414 return 425 return
415 426
416 store_dive_temperature: 427 store_dive_temperature:
417 SMOVII temperature_cur,mpr ; ISR-safe 2 byte copy of current temperature to hi:lo 428 SMOVII temperature_cur,mpr ; ISR-safe 2 byte copy of current temperature to hi:lo
418 movf lo,W ; get low byte 429 movf lo,W ; get low byte
419 rcall ghostwrite_byte_profile ; store it 430 rcall ghostwrite_byte_profile ; store it
420 movf hi,W ; get high byte 431 movf hi,W ; get high byte
421 rcall ghostwrite_byte_profile ; store it 432 rcall ghostwrite_byte_profile ; store it
422 movlw div_temperature 433 movlw div_temperature ; get sampling rate
423 movwf divisor_temperature ; reload timer 434 movwf divisor_temperature ; reload timer
424 return 435 return
425 436
426 ghostwrite_byte_header: 437 ghostwrite_byte_header:
427 goto write_byte_ext_flash_plus_header ; (this call will also delete the 4kB TOC entry first) 438 goto write_byte_ext_flash_plus_header ; (this call will also delete the 4kB TOC entry first)
828 ; store last stop depth 839 ; store last stop depth
829 movff char_I_depth_last_deco,WREG ; get last stop depth [m] 840 movff char_I_depth_last_deco,WREG ; get last stop depth [m]
830 rcall ghostwrite_byte_header ; store data 841 rcall ghostwrite_byte_header ; store data
831 842
832 ; store deco distance 843 ; store deco distance
833 movff char_I_deco_distance,WREG ; get assumed distance to shown stop 844 clrf WREG ; assumed deco distance - disposed, hard-coded to zero
834 rcall ghostwrite_byte_header ; store data 845 rcall ghostwrite_byte_header ; store data
835 846
836 IFDEF _external_sensor 847 IFDEF _external_sensor
837 ; store last HUD data 848 ; store last HUD data
838 SMOVTT hud_status_byte,mpr ; ISR-safe 3 byte copy of last HUD status (1 byte) and battery voltage (2 byte) 849 SMOVTT hud_status_byte,mpr ; ISR-safe 3 byte copy of last HUD status (1 byte) and battery voltage (2 byte)
988 movlw 0xFA 999 movlw 0xFA
989 rcall ghostwrite_byte_profile ; WREG -> profile in ext. flash 1000 rcall ghostwrite_byte_profile ; WREG -> profile in ext. flash
990 movlw 0xFA 1001 movlw 0xFA
991 rcall ghostwrite_byte_profile ; WREG -> profile in ext. flash 1002 rcall ghostwrite_byte_profile ; WREG -> profile in ext. flash
992 1003
993 ; Keep room for dive length ext_flash_dive_counter:3 (Stored at the end of the dive) 1004 ; Keep room for dive length ext_flash_dive_counter:3 (stored at the end of the dive)
994 ; Writing 0xFF three times here is mandatory 1005 ; Writing 0xFF three times here is mandatory
995 ; - 0xFF can be overwritten after the dive 1006 ; - 0xFF can be overwritten after the dive
996 ; - ghostwrite_byte_profile takes care of 4kB Page switching 1007 ; - ghostwrite_byte_profile takes care of 4kB page switching
997 ; - fixes an issue when we are at exactly 0xXXX000 here... 1008 ; - fixes an issue when we are at exactly 0xXXX000 here...
998 1009
999 movlw 0xFF 1010 movlw 0xFF
1000 call write_byte_ext_flash_plus_nocnt ; WREG -> profile in ext. flash (No ext_flash_dive_counter:3 increase) 1011 call write_byte_ext_flash_plus_nocnt ; WREG -> profile in ext. flash (No ext_flash_dive_counter:3 increase)
1001 movlw 0xFF 1012 movlw 0xFF
1002 call write_byte_ext_flash_plus_nocnt ; WREG -> profile in ext. flash (No ext_flash_dive_counter:3 increase) 1013 call write_byte_ext_flash_plus_nocnt ; WREG -> profile in ext. flash (No ext_flash_dive_counter:3 increase)
1003 movlw 0xFF 1014 movlw 0xFF
1004 call write_byte_ext_flash_plus_nocnt ; WREG -> profile in ext. flash (No ext_flash_dive_counter:3 increase) 1015 call write_byte_ext_flash_plus_nocnt ; WREG -> profile in ext. flash (No ext_flash_dive_counter:3 increase)
1005 1016
1006 movf sampling_rate,W ; get sampling rate 1017 ; store sizes and sampling rates of recording datasets
1007 rcall ghostwrite_byte_profile ; WREG -> profile in ext. flash 1018
1008 1019 movf sampling_rate,W ; get general sampling rate
1009 movlw .7 ; number of divisors 1020 rcall ghostwrite_byte_profile ; WREG -> profile in ext. flash
1010 rcall ghostwrite_byte_profile ; WREG -> profile in ext. flash 1021
1011 1022 movlw .7 ; get number of additional datasets
1012 movlw .0 ; type 1023 rcall ghostwrite_byte_profile ; WREG -> profile in ext. flash
1013 rcall ghostwrite_byte_profile ; WREG -> profile in ext. flash 1024
1014 movlw infolength_temperature 1025 movlw .0 ; type: temperature
1015 rcall ghostwrite_byte_profile ; WREG -> profile in ext. flash 1026 rcall ghostwrite_byte_profile ; WREG -> profile in ext. flash
1016 movlw div_temperature ; divisor temperature 1027 movlw infolength_temperature ; get size of recording data
1017 rcall ghostwrite_byte_profile ; WREG -> profile in ext. flash 1028 rcall ghostwrite_byte_profile ; WREG -> profile in ext. flash
1018 1029 movlw div_temperature ; get sampling rate
1019 movlw .1 ; Type 1030 rcall ghostwrite_byte_profile ; WREG -> profile in ext. flash
1020 rcall ghostwrite_byte_profile ; WREG -> profile in ext. flash 1031
1021 movlw infolength_deco 1032 movlw .1 ; type: +++
1022 rcall ghostwrite_byte_profile ; WREG -> profile in ext. flash 1033 rcall ghostwrite_byte_profile ; WREG -> profile in ext. flash
1023 movlw div_deco ; divisor deco data 1034 movlw infolength_deco ; get size of recording data
1024 rcall ghostwrite_byte_profile ; WREG -> profile in ext. flash 1035 rcall ghostwrite_byte_profile ; WREG -> profile in ext. flash
1025 1036 movlw div_deco ; get sampling rate
1026 movlw .2 ; type 1037 rcall ghostwrite_byte_profile ; WREG -> profile in ext. flash
1027 rcall ghostwrite_byte_profile ; WREG -> profile in ext. flash 1038
1028 movlw infolength_gf 1039 movlw .2 ; type: saturation
1029 rcall ghostwrite_byte_profile ; WREG -> profile in ext. flash 1040 rcall ghostwrite_byte_profile ; WREG -> profile in ext. flash
1030 movlw div_gf ; divisor gf 1041 movlw infolength_gf ; get size of recording data
1031 rcall ghostwrite_byte_profile ; WREG -> profile in ext. flash 1042 rcall ghostwrite_byte_profile ; WREG -> profile in ext. flash
1032 1043 movlw div_gf ; get sampling rate
1033 movlw .3 ; type 1044 rcall ghostwrite_byte_profile ; WREG -> profile in ext. flash
1034 rcall ghostwrite_byte_profile ; WREG -> profile in ext. flash 1045
1035 movlw infolength_ppo2_sensors 1046 movlw .3 ; type: ppO2 sensor data
1036 rcall ghostwrite_byte_profile ; WREG -> profile in ext. flash 1047 rcall ghostwrite_byte_profile ; WREG -> profile in ext. flash
1037 movlw div_ppo2_sensors ; divisor ppO2 1048 movlw infolength_ppo2_sensors ; get size of recording data
1038 btfss FLAG_ccr_mode ; =1: CCR mode (Fixed ppO2 or Sensor) active 1049 rcall ghostwrite_byte_profile ; WREG -> profile in ext. flash
1039 movlw .0 ; no ppO2 data in OC mode 1050 movlw .0 ; default to no ppO2 data
1040 rcall ghostwrite_byte_profile ; WREG -> profile in ext. flash 1051 btfsc FLAG_ccr_mode ; in CCR mode?
1041 1052 movlw div_ppo2_sensors ; YES - get sampling rate
1042 movlw .4 ; type 1053 btfsc FLAG_pscr_mode ; in pSCR mode?
1043 rcall ghostwrite_byte_profile ; WREG -> profile in ext. flash 1054 movlw div_ppo2_sensors ; YES - get sampling rate
1044 movlw infolength_decoplan 1055 rcall ghostwrite_byte_profile ; WREG -> profile in ext. flash
1045 rcall ghostwrite_byte_profile ; WREG -> profile in ext. flash 1056
1046 movlw div_decoplan ; divisor debug 1057 movlw .4 ; type: deco plan (stop times)
1047 rcall ghostwrite_byte_profile ; WREG -> profile in ext. flash 1058 rcall ghostwrite_byte_profile ; WREG -> profile in ext. flash
1048 1059 movlw infolength_decoplan ; get size of recording data
1049 movlw .5 ; Type 1060 rcall ghostwrite_byte_profile ; WREG -> profile in ext. flash
1050 rcall ghostwrite_byte_profile ; WREG -> profile in ext. flash 1061 movlw div_decoplan ; get sampling rate
1051 movlw infolength_cns 1062 rcall ghostwrite_byte_profile ; WREG -> profile in ext. flash
1052 rcall ghostwrite_byte_profile ; WREG -> profile in ext. flash 1063
1053 movlw div_cns ; divisor CNS 1064 movlw .5 ; type: CNS
1054 rcall ghostwrite_byte_profile ; WREG -> profile in ext. flash 1065 rcall ghostwrite_byte_profile ; WREG -> profile in ext. flash
1055 1066 movlw infolength_cns ; get size of recording data
1056 movlw .6 ; Type 1067 rcall ghostwrite_byte_profile ; WREG -> profile in ext. flash
1057 rcall ghostwrite_byte_profile ; WREG -> profile in ext. flash 1068 movlw div_cns ; get sampling rate
1058 movlw infolength_tank 1069 rcall ghostwrite_byte_profile ; WREG -> profile in ext. flash
1059 rcall ghostwrite_byte_profile ; WREG -> profile in ext. flash 1070
1060 movlw div_tank ; divisor tank 1071 movlw .6 ; type: tank pressure
1072 rcall ghostwrite_byte_profile ; WREG -> profile in ext. flash
1073 movlw infolength_tank ; get size of recording data
1074 rcall ghostwrite_byte_profile ; WREG -> profile in ext. flash
1075 movlw .0 ; default to no tank pressure data
1076 btfsc tr_functions_activated ; TR functions activated?
1077 movlw div_tank ; YES - get sampling rate
1061 rcall ghostwrite_byte_profile ; WREG -> profile in ext. flash 1078 rcall ghostwrite_byte_profile ; WREG -> profile in ext. flash
1062 1079
1063 return 1080 return
1081
1064 1082
1065 divemode_store_statistics: ; store/update statistics for this unit 1083 divemode_store_statistics: ; store/update statistics for this unit
1066 call vault_decodata_into_eeprom ; update deco data 1084 call vault_decodata_into_eeprom ; update deco data
1067 call do_logoffset_common_read ; read current logbook offset into mpr 1085 call do_logoffset_common_read ; read current logbook offset into mpr
1068 1086