comparison code_part1/OSTC_code_asm_part1/divemode.asm @ 111:ed7826c740a0

1.74beta rc1
author heinrichsweikamp
date Wed, 22 Dec 2010 09:37:24 +0100
parents 966ebf905514
children 50a06adabc67
comparison
equal deleted inserted replaced
110:8aa8acada0fd 111:ed7826c740a0
1469 bra set_powersafe1 ; Still to low 1469 bra set_powersafe1 ; Still to low
1470 bcf low_battery_state ; clear flag for battery warning mode 1470 bcf low_battery_state ; clear flag for battery warning mode
1471 return 1471 return
1472 1472
1473 calc_average_depth: 1473 calc_average_depth:
1474 bcf lock_stopwatch_reset ; Un-Lock the stopwatch reset option 1474 btfsc reset_average_depth ; Reset the Avewrage depth?
1475 rcall reset_average1 ; Reset the resettable average depth
1476
1475 ; 1. Add new 2xdepth to the Sum of depths registers 1477 ; 1. Add new 2xdepth to the Sum of depths registers
1476 movff rel_pressure+0,b0_lo 1478 movff rel_pressure+0,b0_lo
1477 movff rel_pressure+1,b0_hi 1479 movff rel_pressure+1,b0_hi
1478 1480
1479 movf b0_lo,w 1481 movf b0_lo,w
1504 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder 1506 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder
1505 movff xC+0,avr_rel_pressure+0 1507 movff xC+0,avr_rel_pressure+0
1506 movff xC+1,avr_rel_pressure+1 1508 movff xC+1,avr_rel_pressure+1
1507 return 1509 return
1508 1510
1509 1511 reset_average1:
1510 diveloop_boot:
1511 ostc_debug 'Q' ; Sends debug-information to screen if debugmode active
1512 clrf max_pressure+0 ; clear some variables
1513 clrf max_pressure+1
1514
1515 clrf avr_rel_pressure+0
1516 clrf avr_rel_pressure+1
1517
1518 call PLED_brightness_low
1519 read_int_eeprom d'90' ; Brightness offset? (Dim>0, Normal = 0)
1520 movlw d'0'
1521 cpfsgt EEDATA
1522 call PLED_brightness_full
1523
1524 clrf average_depth_hold+0 1512 clrf average_depth_hold+0
1525 clrf average_depth_hold+1 1513 clrf average_depth_hold+1
1526 clrf average_depth_hold+2 1514 clrf average_depth_hold+2
1527 clrf average_depth_hold+3 ; Clear average depth register 1515 clrf average_depth_hold+3 ; Clear average depth register
1528 movlw d'2' 1516 movlw d'2'
1529 movwf average_divesecs+0 1517 movwf average_divesecs+0
1530 clrf average_divesecs+1 1518 clrf average_divesecs+1
1519 bcf reset_average_depth ; Clear flag
1520 return
1521
1522 diveloop_boot:
1523 ostc_debug 'Q' ; Sends debug-information to screen if debugmode active
1524 clrf max_pressure+0 ; clear some variables
1525 clrf max_pressure+1
1526
1527 clrf avr_rel_pressure+0
1528 clrf avr_rel_pressure+1
1529
1530 call PLED_brightness_low
1531 read_int_eeprom d'90' ; Brightness offset? (Dim>0, Normal = 0)
1532 movlw d'0'
1533 cpfsgt EEDATA
1534 call PLED_brightness_full
1531 1535
1532 movlw d'1' 1536 movlw d'1'
1533 movwf apnoe_max_pressure+0 1537 movwf apnoe_max_pressure+0
1534 clrf apnoe_max_pressure+1 1538 clrf apnoe_max_pressure+1
1535 clrf apnoe_surface_mins 1539 clrf apnoe_surface_mins
1545 clrf apnoe_timeout_counter ; timeout in minutes 1549 clrf apnoe_timeout_counter ; timeout in minutes
1546 clrf timeout_counter ; takes care of the timeout 1550 clrf timeout_counter ; takes care of the timeout
1547 clrf timeout_counter2 ; Here: counts to six, then store deco data and temperature 1551 clrf timeout_counter2 ; Here: counts to six, then store deco data and temperature
1548 clrf AlarmType ; Clear all alarms 1552 clrf AlarmType ; Clear all alarms
1549 bcf event_occured ; clear flag 1553 bcf event_occured ; clear flag
1550 bcf lock_stopwatch_reset ; clear flag 1554 rcall reset_average1 ; Reset the resettable average depth
1551 bcf depth_greater_100m ; clear flag 1555 bcf depth_greater_100m ; clear flag
1552 setf last_diluent ; to be displayed after first calculation (range: 0 to 100 [%]) 1556 setf last_diluent ; to be displayed after first calculation (range: 0 to 100 [%])
1553 bcf dekostop_active 1557 bcf dekostop_active
1554 bcf is_bailout ;=1: CC mode, but bailout active! 1558 bcf is_bailout ;=1: CC mode, but bailout active!
1555 bcf better_gas_available ;=1: A better gas is available and a gas change is advised in divemode 1559 bcf better_gas_available ;=1: A better gas is available and a gas change is advised in divemode
1581 bra set_no_forced_stops 1585 bra set_no_forced_stops
1582 lfsr FSR0,0x290 ; clear int_O_calc_tissue_call_counter (DEBUG) 1586 lfsr FSR0,0x290 ; clear int_O_calc_tissue_call_counter (DEBUG)
1583 clrf POSTINC0 1587 clrf POSTINC0
1584 clrf POSTINC0 1588 clrf POSTINC0
1585 1589
1586 ; Start with active Stopwatch? 1590 ;; Start with active Stopwatch?
1587 bsf stopwatch_active 1591 ; bsf stopwatch_active
1588 GETCUSTOM8 d'41' ; =1: Start with active Stopwatch 1592 ; GETCUSTOM8 d'41' ; =1: Start with active Stopwatch
1589 movwf lo 1593 ; movwf lo
1590 movlw d'1' 1594 ; movlw d'1'
1591 cpfseq lo ; CF41=1? 1595 ; cpfseq lo ; CF41=1?
1592 bcf stopwatch_active ; No! 1596 ; bcf stopwatch_active ; No!
1593 1597
1594 ; Init profile recording parameters 1598 ; Init profile recording parameters
1595 GETCUSTOM8 d'20' ; sample rate 1599 GETCUSTOM8 d'20' ; sample rate
1596 movwf samplesecs_value ; to avoid EEPROM access in the ISR 1600 movwf samplesecs_value ; to avoid EEPROM access in the ISR
1597 GETCUSTOM8 d'21' 1601 GETCUSTOM8 d'21'