comparison code_part1/OSTC_code_asm_part1/menu_logbook.asm @ 544:56da3e962e98

show start of dive in internal logbook (for dives made with logbook version 0x21 or later)
author heinrichsweikamp
date Sat, 14 Jan 2012 22:06:28 +0100
parents ab819be6193f
children cbdcbbc91877
comparison
equal deleted inserted replaced
543:0def530863c2 544:56da3e962e98
339 call I2CREAD2 ; Year 339 call I2CREAD2 ; Year
340 movff SSPBUF,convert_value_temp+2 340 movff SSPBUF,convert_value_temp+2
341 call PLED_convert_date ; converts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2 341 call PLED_convert_date ; converts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2
342 342
343 PUTC ' ' 343 PUTC ' '
344
345 btfss logbook_format_0x21 ; Dive made with new 0x21 format?
346 bra display_end_of_divetime
347
348 PUTC 0x93 ; "Start of dive" icon
349 call I2CREAD2 ; hour
350 movff SSPBUF,lo
351 call I2CREAD2 ; minute
352 movf lo,W
353 mullw .60
354 movff SSPBUF,WREG
355 addwf PRODL,F
356 movlw .0
357 addwfc PRODH,F ; PRODH:PRODL has end-of-dive time in minutes
358
359 incf_eeprom_address d'39' ; Skip Bytes in EEPROM
360 call I2CREAD2 ; Total sample time in seconds
361 movff SSPBUF,lo
362 call I2CREAD2 ; Total sample time in seconds
363 movff SSPBUF,hi
364 decf_eeprom_address d'41' ; Macro, that subtracts 8Bit from eeprom_address:2
365 call convert_time ; converts hi:lo in seconds to mins (hi) and seconds (lo)
366 clrf sub_b+1
367 movff hi,sub_b+0
368 movff PRODL,sub_a+0
369 movff PRODH,sub_a+1
370 call subU16 ; sub_c = sub_a - sub_b (with UNSIGNED values)
371 ; sub_c:2 holds entry time in minutes
372 movff sub_c+0,lo
373 movff sub_c+1,hi
374 call convert_time ; converts hi:lo in minutes to hours (hi) and minutes (lo)
375 movff lo,PRODL ; temp
376 movff hi,lo
377 output_99x ; hour
378 PUTC ':'
379 movff PRODL,lo
380 output_99x ; minute
381 bra logbook_divetime_common ; Skip end-of-divetime
382
383 display_end_of_divetime:
344 PUTC 0x94 ; "End of dive" icon 384 PUTC 0x94 ; "End of dive" icon
345 call I2CREAD2 ; hour 385 call I2CREAD2 ; hour
346 movff SSPBUF,lo 386 movff SSPBUF,lo
347 output_99x 387 output_99x
348 PUTC ':' 388 PUTC ':'
349 call I2CREAD2 ; Minute 389 call I2CREAD2 ; Minute
350 movff SSPBUF,lo 390 movff SSPBUF,lo
351 output_99x 391 output_99x
352 call word_processor ; Display 1st row of details 392
393 logbook_divetime_common:
394 call word_processor ; Display 1st row of details
353 395
354 WIN_TOP .25 396 WIN_TOP .25
355 WIN_LEFT .05 397 WIN_LEFT .05
356 lfsr FSR2,letter 398 lfsr FSR2,letter
357 call I2CREAD2 ; read max depth 399 call I2CREAD2 ; read max depth