comparison code_part1/OSTC_code_asm_part1/divemode.asm @ 572:80a1d2d5a9ee

timeout display when deco stops are violated
author heinrichsweikamp
date Fri, 20 Apr 2012 21:32:03 +0200
parents 9e20de11fb78
children e3ffc6d62a63
comparison
equal deleted inserted replaced
571:7f5419d4157d 572:80a1d2d5a9ee
1398 1398
1399 bcf divemode 1399 bcf divemode
1400 incf timeout_counter,F 1400 incf timeout_counter,F
1401 movlw d'0' 1401 movlw d'0'
1402 addwfc timeout_counter2,F ; timeout is 15bits 1402 addwfc timeout_counter2,F ; timeout is 15bits
1403 GETCUSTOM15 d'2' ; diveloop_timeout 1403
1404 GETCUSTOM15 d'2' ; diveloop_timeout -> lo:hi
1405
1406 btfss dekostop_active ; Is a deco stop displayed?
1407 bra timeout_divemode1 ; No, use normal CF02 timeout
1408
1409 ; Yes, use 10minutes counter
1410 movlw LOW .600
1411 movwf lo
1412 movlw HIGH .600
1413 movwf hi
1414
1415 timeout_divemode1:
1404 movff lo,sub_a+0 1416 movff lo,sub_a+0
1405 movff hi,sub_a+1 1417 movff hi,sub_a+1
1406 movff timeout_counter, sub_b+0 1418 movff timeout_counter, sub_b+0
1407 movff timeout_counter2, sub_b+1 1419 movff timeout_counter2, sub_b+1
1408 call sub16 ; sub_c = sub_a - sub_b 1420 call sub16 ; sub_c = sub_a - sub_b
1521 1533
1522 btfss neg_flag 1534 btfss neg_flag
1523 bra set_dive_modes2 ; too shallow (rel_pressure<dive_threshold) 1535 bra set_dive_modes2 ; too shallow (rel_pressure<dive_threshold)
1524 1536
1525 btfsc realdive ; Dive longer than one minute? 1537 btfsc realdive ; Dive longer than one minute?
1526 clrf timeout_counter ; Yes, reset timout counter 1538 clrf timeout_counter ; Yes, reset timout counter (Low Byte)
1539 btfsc realdive ; Dive longer than one minute?
1540 clrf timeout_counter2 ; Yes, reset timout counter (High Byte)
1527 1541
1528 set_dive_modes_common: 1542 set_dive_modes_common:
1529 bsf divemode ; (Re-)Set divemode flag 1543 bsf divemode ; (Re-)Set divemode flag
1530 bsf divemode2 ; displayed divetime is running 1544 bsf divemode2 ; displayed divetime is running
1531 btfsc timeout_display ; Was the timeout displayed? 1545 btfsc timeout_display ; Was the timeout displayed?
1537 btfss realdive ; dive longer then one minute? 1551 btfss realdive ; dive longer then one minute?
1538 bcf divemode ; no -> this was no real dive 1552 bcf divemode ; no -> this was no real dive
1539 1553
1540 btfss divemode ; Are we still diving? 1554 btfss divemode ; Are we still diving?
1541 return ; No, return 1555 return ; No, return
1542
1543 ; Yes, show divemode timeout 1556 ; Yes, show divemode timeout
1557
1558 btfsc menubit ; Divemode menu active?
1559 return ; Yes, return
1560 btfsc FLAG_apnoe_mode ; In Apnoe mode?
1561 return ; Yes, return
1562 btfsc gauge_mode ; In Gauge mode?
1563 return ; Yes, return
1564
1565
1544 btfss dekostop_active ; Is a deco stop displayed? 1566 btfss dekostop_active ; Is a deco stop displayed?
1545 call PLED_divemode_timeout ; No, show the divemode timeout here... 1567 call PLED_divemode_timeout ; No, show the divemode timeout here...
1568 btfsc dekostop_active ; Is a deco stop displayed?
1569 call PLED_divemode_timeout2 ; Yes, show red warning divemode counter
1546 return 1570 return
1547 1571
1548 set_dive_modes3: ; High-altitude mode 1572 set_dive_modes3: ; High-altitude mode
1549 btfsc realdive ; dive longer then one minute? 1573 btfsc realdive ; dive longer then one minute?
1550 bra set_dive_modes0 ; Yes -> this is a real dive -> Use CF00 threshold for ascend 1574 bra set_dive_modes0 ; Yes -> this is a real dive -> Use CF00 threshold for ascend