Mercurial > public > mk2
comparison code_part1/OSTC_code_asm_part1/divemode.asm @ 407:47b1135cbff3
BUGFIX: SetPoint recording for logbook
BUGFIX: Divetime seconds synced with stopwatch start
author | heinrichsweikamp |
---|---|
date | Thu, 07 Jul 2011 20:17:01 +0200 |
parents | 2534277be060 |
children | 3e0192f6c241 |
comparison
equal
deleted
inserted
replaced
406:2534277be060 | 407:47b1135cbff3 |
---|---|
48 ; Startup Tasks for deco modes | 48 ; Startup Tasks for deco modes |
49 call PLED_display_ndl_mask ; display "no stop" if not in gauge or apnoe mode | 49 call PLED_display_ndl_mask ; display "no stop" if not in gauge or apnoe mode |
50 | 50 |
51 btfsc FLAG_const_ppO2_mode ; only in const_ppO2_mode | 51 btfsc FLAG_const_ppO2_mode ; only in const_ppO2_mode |
52 bsf setpoint_changed ; Add a setpoint change to the first depth sample in CC mode | 52 bsf setpoint_changed ; Add a setpoint change to the first depth sample in CC mode |
53 btfsc FLAG_const_ppO2_mode ; only in const_ppO2_mode | |
54 bsf event_occured ; set global event flag | |
53 | 55 |
54 diveloop_loop: ; The diveloop starts here | 56 diveloop_loop: ; The diveloop starts here |
55 btfss onesecupdate ; tasks any new second | 57 btfss onesecupdate ; tasks any new second |
56 bra diveloop_loop3 | 58 bra diveloop_loop3 |
57 | 59 |
1420 clrf surface_interval+1 ; Clear surface interval timer | 1422 clrf surface_interval+1 ; Clear surface interval timer |
1421 | 1423 |
1422 end_dive_common: | 1424 end_dive_common: |
1423 bcf simulatormode_active ; if we were in simulator mode | 1425 bcf simulatormode_active ; if we were in simulator mode |
1424 | 1426 |
1425 btfsc restore_deco_data ; Restore decodata? | 1427 ; In DEBUG compile, keep all simulated dives in logbook, Desat time, nofly, etc... |
1426 call simulator_restore_tissue_data ; Yes! | 1428 ifndef __DEBUG |
1429 btfsc restore_deco_data ; Restore decodata? | |
1430 call simulator_restore_tissue_data ; Yes! | |
1431 endif | |
1427 | 1432 |
1428 goto surfloop ; and return to surfaceloop | 1433 goto surfloop ; and return to surfaceloop |
1429 | 1434 |
1430 timeout_divemode: | 1435 timeout_divemode: |
1431 btfss realdive ; Dive longer then one minute | 1436 btfss realdive ; Dive longer then one minute |
1551 | 1556 |
1552 set_dive_modes: | 1557 set_dive_modes: |
1553 btfsc high_altitude_mode ; In high altitude (Fly) mode? | 1558 btfsc high_altitude_mode ; In high altitude (Fly) mode? |
1554 bra set_dive_modes3 ; Yes | 1559 bra set_dive_modes3 ; Yes |
1555 | 1560 |
1556 bcf divemode2 ; Stop time | 1561 ; bcf divemode2 ; Stop time |
1557 | 1562 |
1558 GETCUSTOM8 .0 ; loads dive_threshold in WREG | 1563 GETCUSTOM8 .0 ; loads dive_threshold in WREG |
1559 movwf sub_a+0 ; dive_treshold is in cm | 1564 movwf sub_a+0 ; dive_treshold is in cm |
1560 clrf sub_a+1 | 1565 clrf sub_a+1 |
1561 SAFE_2BYTE_COPY rel_pressure, sub_b | 1566 SAFE_2BYTE_COPY rel_pressure, sub_b |
1570 bsf divemode ; (Re-)Set divemode flag | 1575 bsf divemode ; (Re-)Set divemode flag |
1571 bsf divemode2 ; displayed divetime is running | 1576 bsf divemode2 ; displayed divetime is running |
1572 return | 1577 return |
1573 | 1578 |
1574 set_dive_modes2: | 1579 set_dive_modes2: |
1575 btfss realdive ; dive longer then one minute? | 1580 bcf divemode2 ; Stop time |
1576 bcf divemode ; no -> this was no real dive | 1581 btfss realdive ; dive longer then one minute? |
1582 bcf divemode ; no -> this was no real dive | |
1577 return | 1583 return |
1578 | 1584 |
1579 set_dive_modes3: | 1585 set_dive_modes3: |
1580 movlw HIGH d'1075' ; hard-wired 1075mbar threshold | 1586 movlw HIGH d'1075' ; hard-wired 1075mbar threshold |
1581 movwf sub_a+1 | 1587 movwf sub_a+1 |
1713 ; | 1719 ; |
1714 diveloop_boot: | 1720 diveloop_boot: |
1715 ostc_debug 'Q' ; Sends debug-information to screen if debugmode active | 1721 ostc_debug 'Q' ; Sends debug-information to screen if debugmode active |
1716 clrf max_pressure+0 ; clear some variables | 1722 clrf max_pressure+0 ; clear some variables |
1717 clrf max_pressure+1 | 1723 clrf max_pressure+1 |
1718 | |
1719 clrf avr_rel_pressure+0 | 1724 clrf avr_rel_pressure+0 |
1720 clrf avr_rel_pressure+1 | 1725 clrf avr_rel_pressure+1 |
1721 | |
1722 clrf EEADRH ; Make sure to select eeprom bank 0 | |
1723 call PLED_brightness_low | |
1724 read_int_eeprom d'90' ; Brightness offset? (Dim>0, Normal = 0) | |
1725 movlw d'0' | |
1726 cpfsgt EEDATA | |
1727 call PLED_brightness_full | |
1728 | 1726 |
1729 movlw d'1' | 1727 movlw d'1' |
1730 movwf apnoe_max_pressure+0 | 1728 movwf apnoe_max_pressure+0 |
1731 clrf apnoe_max_pressure+1 | 1729 clrf apnoe_max_pressure+1 |
1732 clrf apnoe_surface_mins | 1730 clrf apnoe_surface_mins |
1735 clrf apnoe_secs | 1733 clrf apnoe_secs |
1736 clrf divemins+0 | 1734 clrf divemins+0 |
1737 clrf divemins+1 | 1735 clrf divemins+1 |
1738 clrf total_divetime_seconds+0 | 1736 clrf total_divetime_seconds+0 |
1739 clrf total_divetime_seconds+1 | 1737 clrf total_divetime_seconds+1 |
1738 bsf divemode2 ; displayed divetime is running (Divetime starts HERE) | |
1739 | |
1740 clrf EEADRH ; Make sure to select eeprom bank 0 | |
1741 call PLED_brightness_low | |
1742 read_int_eeprom d'90' ; Brightness offset? (Dim>0, Normal = 0) | |
1743 movlw d'0' | |
1744 cpfsgt EEDATA | |
1745 call PLED_brightness_full | |
1746 | |
1740 clrf menupos3 | 1747 clrf menupos3 |
1741 bcf menu3_active | 1748 bcf menu3_active |
1742 clrf divesecs | 1749 clrf divesecs |
1743 clrf samplesecs | 1750 clrf samplesecs |
1744 clrf apnoe_timeout_counter ; timeout in minutes | 1751 clrf apnoe_timeout_counter ; timeout in minutes |