comparison code_part1/OSTC_code_asm_part1/divemode.asm @ 408:3e0192f6c241

NEW: End-of-Dive countdown displayed after surfacing
author heinrichsweikamp
date Thu, 07 Jul 2011 21:22:05 +0200
parents 47b1135cbff3
children 46c1818ab589
comparison
equal deleted inserted replaced
407:47b1135cbff3 408:3e0192f6c241
1556 1556
1557 set_dive_modes: 1557 set_dive_modes:
1558 btfsc high_altitude_mode ; In high altitude (Fly) mode? 1558 btfsc high_altitude_mode ; In high altitude (Fly) mode?
1559 bra set_dive_modes3 ; Yes 1559 bra set_dive_modes3 ; Yes
1560 1560
1561 ; bcf divemode2 ; Stop time
1562
1563 GETCUSTOM8 .0 ; loads dive_threshold in WREG 1561 GETCUSTOM8 .0 ; loads dive_threshold in WREG
1564 movwf sub_a+0 ; dive_treshold is in cm 1562 movwf sub_a+0 ; dive_treshold is in cm
1565 clrf sub_a+1 1563 clrf sub_a+1
1566 SAFE_2BYTE_COPY rel_pressure, sub_b 1564 SAFE_2BYTE_COPY rel_pressure, sub_b
1567 call sub16 ; sub_c = sub_a - sub_b 1565 call sub16 ; sub_c = sub_a - sub_b
1570 bra set_dive_modes2 ; too shallow (rel_pressure<dive_threshold) 1568 bra set_dive_modes2 ; too shallow (rel_pressure<dive_threshold)
1571 1569
1572 btfsc realdive ; Dive longer than one minute? 1570 btfsc realdive ; Dive longer than one minute?
1573 clrf timeout_counter ; Yes, reset timout counter 1571 clrf timeout_counter ; Yes, reset timout counter
1574 1572
1573 set_dive_modes_common:
1575 bsf divemode ; (Re-)Set divemode flag 1574 bsf divemode ; (Re-)Set divemode flag
1576 bsf divemode2 ; displayed divetime is running 1575 bsf divemode2 ; displayed divetime is running
1576 btfsc timeout_display ; Was the timeout displayed?
1577 call PLED_divemode_timeout_clear ; Yes, Clear (once)
1577 return 1578 return
1578 1579
1579 set_dive_modes2: 1580 set_dive_modes2:
1580 bcf divemode2 ; Stop time 1581 bcf divemode2 ; Stop time
1581 btfss realdive ; dive longer then one minute? 1582 btfss realdive ; dive longer then one minute?
1582 bcf divemode ; no -> this was no real dive 1583 bcf divemode ; no -> this was no real dive
1584
1585 btfss divemode ; Are we still diving?
1586 return ; No, return
1587
1588 ; Yes, show divemode timeout
1589 btfss dekostop_active ; Is a deco stop displayed?
1590 call PLED_divemode_timeout ; No, show the divemode timeout here...
1583 return 1591 return
1584 1592
1585 set_dive_modes3: 1593 set_dive_modes3:
1586 movlw HIGH d'1075' ; hard-wired 1075mbar threshold 1594 movlw HIGH d'1075' ; hard-wired 1075mbar threshold
1587 movwf sub_a+1 1595 movwf sub_a+1
1591 call sub16 ; sub_c = sub_a - sub_b 1599 call sub16 ; sub_c = sub_a - sub_b
1592 1600
1593 btfss neg_flag 1601 btfss neg_flag
1594 bra set_dive_modes2 ; too shallow (rel_pressure<dive_threshold) 1602 bra set_dive_modes2 ; too shallow (rel_pressure<dive_threshold)
1595 1603
1596 bsf divemode ; (Re-)Set divemode flag 1604 bra set_dive_modes_common
1597 bsf divemode2 ; displayed divetime is running 1605
1598 return
1599
1600 set_powersafe: 1606 set_powersafe:
1601 btfsc low_battery_state ; battery warning alread active? 1607 btfsc low_battery_state ; battery warning alread active?
1602 bra set_powersafe2 ; Yes, but is it still required? 1608 bra set_powersafe2 ; Yes, but is it still required?
1603 ; battery voltage in mV (value*256+Lowbyte=actual treshold) 1609 ; battery voltage in mV (value*256+Lowbyte=actual treshold)
1604 movlw d'12' ; 3,328V 1610 movlw d'12' ; 3,328V
1742 read_int_eeprom d'90' ; Brightness offset? (Dim>0, Normal = 0) 1748 read_int_eeprom d'90' ; Brightness offset? (Dim>0, Normal = 0)
1743 movlw d'0' 1749 movlw d'0'
1744 cpfsgt EEDATA 1750 cpfsgt EEDATA
1745 call PLED_brightness_full 1751 call PLED_brightness_full
1746 1752
1753 bcf timeout_display
1747 clrf menupos3 1754 clrf menupos3
1748 bcf menu3_active 1755 bcf menu3_active
1749 clrf divesecs 1756 clrf divesecs
1750 clrf samplesecs 1757 clrf samplesecs
1751 clrf apnoe_timeout_counter ; timeout in minutes 1758 clrf apnoe_timeout_counter ; timeout in minutes