Mercurial > public > hwos_code
comparison src/isr.asm @ 629:237931377539
3.07 stable release
author | heinrichsweikamp |
---|---|
date | Fri, 29 Nov 2019 18:48:11 +0100 |
parents | cd58f7fc86db |
children | 185ba2f91f59 |
comparison
equal
deleted
inserted
replaced
628:cd58f7fc86db | 629:237931377539 |
---|---|
1 ;============================================================================= | 1 ;============================================================================= |
2 ; | 2 ; |
3 ; File isr.asm combined next generation V3.03.7 | 3 ; File isr.asm combined next generation V3.06.2 |
4 ; | 4 ; |
5 ; INTERUPT subroutines | 5 ; INTERUPT subroutines |
6 ; | 6 ; |
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. | 7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. |
8 ;============================================================================= | 8 ;============================================================================= |
37 ; Interrupt Dispatcher | 37 ; Interrupt Dispatcher |
38 ; | 38 ; |
39 HighInt: | 39 HighInt: |
40 ; initialize interrupt code | 40 ; initialize interrupt code |
41 banksel isr_backup ; default bank for all ISR code is bank ISR data | 41 banksel isr_backup ; default bank for all ISR code is bank ISR data |
42 rcall isr_registers_backup ; back-up registers | 42 movff PRODL,PROD_backup+0 ; back-up PRODL |
43 movff PRODH,PROD_backup+1 ; back-up PRODH | |
43 ; serve buttons | 44 ; serve buttons |
44 btfsc PIR1,TMR1IF ; timer 1 interrupt (button hold-down timer)? | 45 btfsc PIR1,TMR1IF ; timer 1 interrupt (button hold-down timer)? |
45 rcall timer1int ; YES - reset timer | 46 rcall timer1int ; YES - reset timer |
46 btfsc INTCON,INT0IF ; right button activity? | 47 btfsc INTCON,INT0IF ; right button activity? |
47 rcall isr_switch_right ; YES - check right switch | 48 rcall isr_switch_right ; YES - check right switch |
52 ; serve IR/S8 link timer | 53 ; serve IR/S8 link timer |
53 btfsc PIR3,RC2IF ; UART 2 interrupt? | 54 btfsc PIR3,RC2IF ; UART 2 interrupt? |
54 rcall isr_uart2 ; YES - get a byte from the IR/S8 link | 55 rcall isr_uart2 ; YES - get a byte from the IR/S8 link |
55 btfsc PIR2,TMR3IF ; timer 3 interrupt? | 56 btfsc PIR2,TMR3IF ; timer 3 interrupt? |
56 rcall isr_timer3 ; YES - check bytes received from IR/S8 link for being a valid telegram | 57 rcall isr_timer3 ; YES - check bytes received from IR/S8 link for being a valid telegram |
57 ELSE | 58 ELSE |
58 bcf PIR3,RC2IF ; Clear UART 2 interrupt? | 59 bcf PIR3,RC2IF ; clear UART 2 interrupt |
59 bcf PIR2,TMR3IF ; Clear timer 3 interrupt? | 60 bcf PIR2,TMR3IF ; clear timer 3 interrupt |
61 ; fill-up to keep code size identical to _external_sensor variant, see "Attention" below | |
62 nop | |
63 nop | |
60 ENDIF | 64 ENDIF |
61 | 65 |
62 ; serve pressure and temperature sensor | 66 ; serve pressure and temperature sensor |
63 btfsc PIR5,TMR7IF ; timer 7 interrupt? | 67 btfsc PIR5,TMR7IF ; timer 7 interrupt? |
64 rcall isr_tmr7 ; YES - do every 62.5 ms tasks: read sensors, set CPU speed | 68 rcall isr_tmr7 ; YES - do every 62.5 ms tasks: read sensors, set CPU speed |
66 ; serve real-time clock (RTCC) | 70 ; serve real-time clock (RTCC) |
67 btfsc PIR3,RTCCIF ; real-time-clock interrupt? | 71 btfsc PIR3,RTCCIF ; real-time-clock interrupt? |
68 rcall isr_rtcc ; YES - do every 1/2 s tasks: read RTC, trigger timed tasks, adjust CPU speed, gauge battery, etc. | 72 rcall isr_rtcc ; YES - do every 1/2 s tasks: read RTC, trigger timed tasks, adjust CPU speed, gauge battery, etc. |
69 | 73 |
70 ; clean up and exit | 74 ; clean up and exit |
71 rcall isr_registers_restore ; restore registers | 75 movff PROD_backup+0,PRODL ; restore PRODL |
76 movff PROD_backup+1,PRODH ; restore PRODH | |
72 bsf trigger_isr_updates ; signal that the ISR had kicked in | 77 bsf trigger_isr_updates ; signal that the ISR had kicked in |
73 retfie FAST ; return from interrupt restoring BSR, STATUS and WREG | 78 retfie FAST ; return from interrupt restoring BSR, STATUS and WREG |
74 | 79 |
75 | 80 |
76 ;============================================================================= | 81 ;============================================================================= |
84 btfsc speed_is_fastest ; NO - speed 'fastest' requested? | 89 btfsc speed_is_fastest ; NO - speed 'fastest' requested? |
85 bra isr_set_speed_to_fastest ; YES - set fastest speed | 90 bra isr_set_speed_to_fastest ; YES - set fastest speed |
86 ;bra isr_set_speed_to_normal ; NO - default to normal speed | 91 ;bra isr_set_speed_to_normal ; NO - default to normal speed |
87 | 92 |
88 isr_set_speed_to_normal: | 93 isr_set_speed_to_normal: |
89 movlw b'00000000' ; coding for x4 PLL disabled | 94 clrf OSCTUNE ; switch off x4 PLL |
90 movwf OSCTUNE ; switch off x4 PLL | |
91 movlw b'01110010' ; select 16 MHz | 95 movlw b'01110010' ; select 16 MHz |
92 movwf OSCCON ; set prescaler | 96 movwf OSCCON ; set prescaler |
93 movlw T2CON_NORMAL ; PWM1 dimming factor for speed 'normal' | 97 movlw T2CON_NORMAL ; PWM1 dimming factor for speed 'normal' |
94 movwf T2CON ; adjust PWM1 for LED dimming | |
95 bra isr_adjust_speed_exit | 98 bra isr_adjust_speed_exit |
96 | 99 |
97 isr_set_speed_to_eco: | 100 isr_set_speed_to_eco: |
98 movlw b'00000000' ; coding for x4 PLL disabled | 101 clrf OSCTUNE ; switch off x4 PLL |
99 movwf OSCTUNE ; switch off x4 PLL | |
100 movlw b'00110010' ; select 1 MHz | 102 movlw b'00110010' ; select 1 MHz |
101 movwf OSCCON ; set prescaler | 103 movwf OSCCON ; set prescaler |
102 movlw T2CON_ECO ; PWM1 dimming factor for speed 'eco' | 104 movlw T2CON_ECO ; PWM1 dimming factor for speed 'eco' |
103 movwf T2CON ; adjust PWM1 for LED dimming | |
104 bra isr_adjust_speed_exit | 105 bra isr_adjust_speed_exit |
105 | 106 |
106 isr_set_speed_to_fastest: | 107 isr_set_speed_to_fastest: |
107 movlw b'01110010' ; select 16 MHz by default | 108 movlw b'01110010' ; select 16 MHz by default |
108 btfsc lv_core ; on OSTC with low voltage core? | 109 btfsc lv_core ; on OSTC with low voltage core? |
109 movlw b'01100010' ; YES - reduce to 8 MHz | 110 movlw b'01100010' ; YES - reduce to 8 MHz |
110 movwf OSCCON ; set prescaler | 111 movwf OSCCON ; set prescaler |
111 movlw b'01000000' ; coding for x4 PLL enable | 112 bsf OSCTUNE,6 ; switch on x4 PLL -> 64 MHz on high voltage core, 32 MHz on low voltage core |
112 movwf OSCTUNE ; switch on x4 PLL -> 64 MHz on high voltage core, 32 MHz on low voltage core | |
113 movlw T2CON_FASTEST ; PWM1 dimming factor for speed 'fastest' | 113 movlw T2CON_FASTEST ; PWM1 dimming factor for speed 'fastest' |
114 ;bra isr_adjust_speed_exit | |
115 | |
116 isr_adjust_speed_exit: | |
114 movwf T2CON ; adjust PWM1 for LED dimming | 117 movwf T2CON ; adjust PWM1 for LED dimming |
115 ;bra isr_adjust_speed_exit | |
116 | |
117 isr_adjust_speed_exit: | |
118 btfss OSCCON,HFIOFS ; PLL stabilized? | 118 btfss OSCCON,HFIOFS ; PLL stabilized? |
119 bra isr_adjust_speed_exit ; NO - loop to give it some more time | 119 bra isr_adjust_speed_exit ; NO - loop to give it some more time |
120 return ; YES - done | 120 return ; YES - done |
121 | 121 |
122 ; Attention: fill-up the gap between the end of this section | 122 ; Attention: fill-up the gap between the end of this section |
123 ; and the next section which starts at 0x00080 !! | 123 ; and the next section which starts at 0x00080 !! |
124 nop | 124 ;nop |
125 | 125 |
126 block_0_code_end: ; marker to find end of code in block 0 in linker report file | 126 block_0_code_end: ; marker to find end of code in block 0 in linker report file |
127 | 127 |
128 ;============================================================================= | 128 ;============================================================================= |
129 ; jump vector for the bootloader, placed at an appointed position here | 129 ; jump vector for the bootloader, placed at an appointed position here |
130 ; | 130 ; |
131 isr_restore CODE 0x00080 ; restore first flash page from EEPROM | 131 isr_restore CODE 0x00080 ; restore first flash page from EEPROM |
132 restore_flash_0x00080: | 132 restore_flash_0x00080: |
133 goto restore_flash | 133 goto restore_flash |
134 | |
135 | |
136 ;============================================================================= | |
137 ; back-up and restore registers | |
138 ; | |
139 isr_registers_backup: | |
140 MOVII PRODL,PROD_backup ; back-up PRODH:PRODL | |
141 return | |
142 | |
143 isr_registers_restore: | |
144 MOVII PROD_backup,PRODL ; restore PRODH:PRODL | |
145 return | |
146 | |
147 | 134 |
148 ;============================================================================= | 135 ;============================================================================= |
149 ; routines for handling digital-attached external sensors | 136 ; routines for handling digital-attached external sensors |
150 ; | 137 ; |
151 IFDEF _external_sensor | 138 IFDEF _external_sensor |
402 rrcf pressure_abs_avg+0 | 389 rrcf pressure_abs_avg+0 |
403 bcf STATUS,C ; clear carry bit | 390 bcf STATUS,C ; clear carry bit |
404 rrcf pressure_abs_avg+1 ; divide by 2, again | 391 rrcf pressure_abs_avg+1 ; divide by 2, again |
405 rrcf pressure_abs_avg+0 | 392 rrcf pressure_abs_avg+0 |
406 | 393 |
407 ; copy into result register | 394 ; copy into result register and set update flag |
408 MOVII pressure_abs_avg,pressure_abs | 395 MOVII pressure_abs_avg,pressure_abs |
396 ; bsf trigger_pres_update ; signal a pressure update | |
409 | 397 |
410 ; build average for temperature | 398 ; build average for temperature |
411 bcf STATUS,C ; clear carry bit by default | 399 bcf STATUS,C ; clear carry bit by default |
412 btfsc temperature_avg+1,7 ; sign bit set? | 400 btfsc temperature_avg+1,7 ; sign bit set? |
413 bsf STATUS,C ; YES - copy sign bit to carry bit | 401 bsf STATUS,C ; YES - copy sign bit to carry bit |
432 isr_sensor_state2_2: | 420 isr_sensor_state2_2: |
433 MOVII temperature_cur,temperature_last ; store current temperature as last temperature for next round | 421 MOVII temperature_cur,temperature_last ; store current temperature as last temperature for next round |
434 bsf trigger_temp_changed ; set flag for temperature change | 422 bsf trigger_temp_changed ; set flag for temperature change |
435 | 423 |
436 isr_sensor_state2_3: | 424 isr_sensor_state2_3: |
437 ; reset state counter and set update flag | 425 ; reset state counter |
438 clrf sensor_state_counter ; reset state counter | 426 clrf sensor_state_counter ; reset state counter |
439 ; bsf trigger_pres_update ; signal a pressure update | |
440 btfss reset_max_pressure ; shall clear the max pressure? | 427 btfss reset_max_pressure ; shall clear the max pressure? |
441 bra isr_sensor_state2_3a ; NO - continue with checking for pressure change | 428 bra isr_sensor_state2_3a ; NO - continue with checking for pressure change |
442 bcf reset_max_pressure ; YES - clear request flag | 429 bcf reset_max_pressure ; YES - clear request flag |
443 CLRI pressure_rel_max ; - clear max. pressure | 430 CLRI pressure_rel_max ; - clear max. pressure |
444 | 431 |
603 movf rtc_year,W | 590 movf rtc_year,W |
604 rcall isr_rtcc_convert_BCD_DEC ; convert to decimal with result in WREG | 591 rcall isr_rtcc_convert_BCD_DEC ; convert to decimal with result in WREG |
605 movwf rtc_year | 592 movwf rtc_year |
606 | 593 |
607 isr_rtcc_2: | 594 isr_rtcc_2: |
608 ; get ambient light level and set max_CCPR1L | 595 ; every full second - get ambient light level and set max_CCPR1L |
609 call get_ambient_level ; get ambient light level and set max_CCPR1L | 596 call get_ambient_level ; get ambient light level and set max_CCPR1L |
610 banksel isr_backup ; back to ISR default bank (for safety only) | 597 banksel isr_backup ; back to ISR default bank (for safety only) |
611 | 598 |
612 rcall isr_battery_gauge ; calculate the current charge consumption and add it to the battery gauge | 599 rcall isr_battery_gauge ; calculate the current charge consumption and add it to the battery gauge |
613 rcall isr_update_uptime ; increment overall OSTC uptime | 600 rcall isr_update_uptime ; increment overall OSTC uptime |
614 rcall isr_update_timeout ; process the timeout timer | 601 rcall isr_update_timeout ; process the timeout timer |
615 | 602 |
616 btfsc divemode ; in dive mode? | 603 btfsc divemode ; in dive mode? |
617 rcall isr_divemode_1sec ; YES - do the every second dive mode tasks | 604 rcall isr_divemode_1sec ; YES - do the every second dive mode tasks |
618 | 605 |
606 ; increment surface interval counted in seconds | |
619 btfsc divemode ; in dive mode? | 607 btfsc divemode ; in dive mode? |
620 btfsc simulatormode ; YES - in simulator mode? | 608 btfsc simulatormode ; YES - in simulator mode? |
621 rcall isr_update_lastdive_time ; NO - YES - increment the last dive time | 609 rcall inc_surface_interval_secs ; NO - YES - increment the surface interval (seconds timer) |
610 | |
611 ; reset the surface interval timers if requested | |
612 btfsc reset_surface_interval ; shall reset both surface interval timers? | |
613 call clr_surface_interval ; YES | |
622 | 614 |
623 ; reset the timebase if requested | 615 ; reset the timebase if requested |
624 btfss reset_timebase ; shall reset the timebase? | 616 btfss reset_timebase ; shall reset the timebase? |
625 bra isr_rtcc_3 ; NO | 617 bra isr_rtcc_3 ; NO |
626 bcf reset_timebase ; YES - clear request flag | 618 bcf reset_timebase ; YES - clear request flag |
644 movlw .59 ; max. for seconds timer | 636 movlw .59 ; max. for seconds timer |
645 cpfsgt timebase_secs ; seconds timer > max.? | 637 cpfsgt timebase_secs ; seconds timer > max.? |
646 return ; NO - done | 638 return ; NO - done |
647 | 639 |
648 ; new full minute | 640 ; new full minute |
649 clrf timebase_secs ; YES - reset timer | 641 clrf timebase_secs ; reset timer |
650 bsf trigger_full_minute ; - set flag for a new minute has begun | 642 bsf trigger_full_minute ; set flag for a new minute has begun |
651 | 643 |
652 btfsc divemode ; - in dive mode? | 644 ; increment surface interval counted in minutes |
653 btfsc simulatormode ; YES - in simulator mode? | 645 btfsc divemode ; in dive mode? |
654 rcall inc_surface_interval ; NO - YES - increment surface interval | 646 btfsc simulatormode ; YES - in simulator mode? |
655 | 647 rcall inc_surface_interval_mins ; NO - YES - increment surface interval (minutes timer) |
656 btfss simulatormode ; - in simulator mode? | 648 |
657 bra isr_rtcc_4 ; NO | 649 btfss simulatormode ; in simulator mode? |
658 infsnz simulator_time,F ; YES - increment real runtime of the simulator, did wrap around (became zero)? | 650 bra isr_rtcc_4 ; NO |
659 setf simulator_time ; YES - disallow wrap-around, keep at 255 instead | 651 infsnz simulator_time,F ; YES - increment real runtime of the simulator, did wrap around (became zero)? |
652 setf simulator_time ; YES - disallow wrap-around, keep at 255 instead | |
660 | 653 |
661 isr_rtcc_4: | 654 isr_rtcc_4: |
662 incf timebase_mins,F ; - increment minutes timer | 655 incf timebase_mins,F ; increment minutes timer |
663 movlw .59 ; - max. for minutes timer | 656 movlw .59 ; max. for minutes timer |
664 cpfsgt timebase_mins ; - minutes timer > max.? | 657 cpfsgt timebase_mins ; minutes timer > max.? |
665 return ; NO - done | 658 return ; NO - done |
666 | 659 |
667 ; new full hour | 660 ; new full hour |
668 clrf timebase_mins ; YES - reset timer | 661 clrf timebase_mins ; YES - reset timer |
669 bsf trigger_full_hour ; - set flag for a new hour has begun | 662 bsf trigger_full_hour ; - set flag for a new hour has begun |
670 return ; - done | 663 return ; - done |
671 | 664 |
672 | 665 |
673 ; increment overall OSTC uptime | 666 ; increment overall OSTC uptime |
674 isr_update_uptime: | 667 isr_update_uptime: |
675 incf uptime+0,F | 668 incf uptime+0,F |
677 addwfc uptime+1,F | 670 addwfc uptime+1,F |
678 addwfc uptime+2,F | 671 addwfc uptime+2,F |
679 addwfc uptime+3,F | 672 addwfc uptime+3,F |
680 return | 673 return |
681 | 674 |
682 ; increment time since last dive, called every second when not in dive mode (or when in simulator mode) | |
683 isr_update_lastdive_time: | |
684 incf lastdive_time+0,F | |
685 clrf WREG | |
686 addwfc lastdive_time+1,F | |
687 addwfc lastdive_time+2,F | |
688 addwfc lastdive_time+3,F | |
689 return | |
690 | 675 |
691 ; process the timeout timer | 676 ; process the timeout timer |
692 isr_update_timeout: | 677 isr_update_timeout: |
693 btfsc reset_timeout ; shall reset the timeout? | 678 btfsc reset_timeout ; shall reset the timeout? |
694 bra isr_update_timeout_1 ; YES | 679 bra isr_update_timeout_1 ; YES |
784 return ; - done | 769 return ; - done |
785 | 770 |
786 isr_divemode_1sec_2: | 771 isr_divemode_1sec_2: |
787 INCI total_divetime_secs ; increase total dive time (regardless of start_dive_threshold) | 772 INCI total_divetime_secs ; increase total dive time (regardless of start_dive_threshold) |
788 btfss count_divetime ; shall the dive time be counted (regarding start_dive_threshold)? | 773 btfss count_divetime ; shall the dive time be counted (regarding start_dive_threshold)? |
789 bra isr_divemode_1sec_4 ; NO (too shallow / apnoe at surface) | 774 bra isr_divemode_1sec_4 ; NO - too shallow / apnoe at surface |
790 incf counted_divetime_secs,F ; YES - increase dive time (displayed dive time) | 775 incf counted_divetime_secs,F ; YES - increase dive time (displayed dive time) |
791 movlw d'59' ; - 60 seconds make a minute | 776 movlw d'59' ; - 60 seconds make a minute |
792 cpfsgt counted_divetime_secs ; - next full minute reached? | 777 cpfsgt counted_divetime_secs ; - next full minute reached? |
793 bra isr_divemode_1sec_3 ; NO - done | 778 bra isr_divemode_1sec_3 ; NO - continue |
794 clrf counted_divetime_secs ; YES - reset seconds to 0 | 779 clrf counted_divetime_secs ; YES - reset seconds to 0 |
795 INCI counted_divetime_mins ; - increase dive minutes | 780 INCI counted_divetime_mins ; - increase dive minutes |
796 bsf divetime_longer_1min ; - set flag for dive time exceeding 1 minute | 781 bsf divetime_longer_1min ; - set flag for dive time exceeding 1 minute |
797 ;bra isr_divemode_1sec_3 ; - done | 782 ;bra isr_divemode_1sec_3 ; - continue |
798 | 783 |
799 isr_divemode_1sec_3: ; submerged | 784 isr_divemode_1sec_3: ; submerged |
800 btfss FLAG_apnoe_mode ; in apnoe mode? | 785 btfss FLAG_apnoe_mode ; in apnoe mode? |
801 return ; NO - done | 786 return ; NO - done |
802 btfss apnoe_at_surface ; - been at surface before? | 787 btfss apnoe_at_surface ; - been at surface before? |
829 clrf apnoe_surface_secs ; YES - reset seconds to 0 | 814 clrf apnoe_surface_secs ; YES - reset seconds to 0 |
830 incf apnoe_surface_mins,F ; - increment surface time, minutes | 815 incf apnoe_surface_mins,F ; - increment surface time, minutes |
831 return ; - done | 816 return ; - done |
832 | 817 |
833 | 818 |
834 | |
835 | |
836 | |
837 | |
838 isr_divemode_1sec_3_dive: | |
839 | |
840 | |
841 ;============================================================================= | 819 ;============================================================================= |
842 ; BCD to Binary conversion | 820 ; BCD to Binary conversion |
843 ; Input WREG = value in BCD | 821 ; Input WREG = value in BCD |
844 ; Output WREG = value in binary | 822 ; Output WREG = value in binary |
845 ; | 823 ; |
930 movwf TMR1H ; write value to timer, high byte | 908 movwf TMR1H ; write value to timer, high byte |
931 return ; return from timer1int with timer1 kept running | 909 return ; return from timer1int with timer1 kept running |
932 | 910 |
933 | 911 |
934 ;============================================================================= | 912 ;============================================================================= |
935 ; Increment surface interval (counted in minutes) while still in desaturation | 913 ; Increment surface interval (counted in minutes and in seconds) |
936 ; | 914 ; |
937 ; int_O_desaturation_time is only computed while in start, surface mode, | 915 ; int_O_desaturation_time is only computed while in start, surface mode, |
938 ; menue_tree or ghostwriter. So the ISR may clock surface_interval past | 916 ; menue_tree or ghostwriter. So the ISR may clock surface_interval_mins |
939 ; the actual surface interval time. But TFT_surface_lastdive will check | 917 ; past the actual surface interval time. But TFT_surface_lastdive will |
940 ; int_O_desaturation_time and in case int_O_desaturation_time is zero it | 918 ; check int_O_desaturation_time and in case int_O_desaturation_time is |
941 ; will not show surface_interval but lastdive_time instead. Thus the glitch | 919 ; zero it will not show surface_interval_mins but surface_interval_secs instead. |
942 ; will remain invisible. | 920 ; Thus the glitch will remain invisible. |
943 ; | 921 ; |
944 inc_surface_interval: ; called every minute when not in dive mode (in banksel common context) | 922 |
945 btfsc reset_surface_interval ; shall reset the surface interval timer? | 923 inc_surface_interval_secs: ; called every second when not in dive mode |
946 bra inc_surface_interval_1 ; YES | 924 incf surface_interval_secs+0,F ; increment the lowest byte |
947 movff int_O_desaturation_time+0,isr_lo ; NO - check desaturation time | 925 clrf WREG ; clear WREG |
948 movff int_O_desaturation_time+1,WREG | 926 addwfc surface_interval_secs+1,F ; add carry from byte before, if it did wrap-around |
949 iorwf isr_lo,W ; - inclusive-or low & high byte, desaturation time = 0 ? | 927 addwfc surface_interval_secs+2,F ; add carry from byte before, if it did wrap-around |
950 bz inc_surface_interval_1 ; YES - reset surface interval timer | 928 addwfc surface_interval_secs+3,F ; add carry from byte before, if it did wrap-around |
951 INCI surface_interval ; NO - increment surface interval | |
952 return ; - done | |
953 inc_surface_interval_1: | |
954 bcf reset_surface_interval ; reset request flag | |
955 CLRI surface_interval ; reset surface interval timer | |
956 return ; done | 929 return ; done |
957 | 930 |
931 inc_surface_interval_mins: ; called every minute when not in dive mode | |
932 movff int_O_desaturation_time+0,isr_lo ; get desaturation time, low byte | |
933 movff int_O_desaturation_time+1,WREG ; get desaturation time, high byte | |
934 iorwf isr_lo,W ; inclusive-or low & high byte, desaturation time = 0 ? | |
935 bz clr_surface_interval_mins ; YES - reset surface interval minutes counter | |
936 INCI surface_interval_mins ; NO - increment surface interval | |
937 return ; - done | |
938 | |
939 clr_surface_interval: | |
940 bcf reset_surface_interval ; reset request flag | |
941 ; clear the surface interval counted in seconds | |
942 clrf surface_interval_secs+0 ; reset surface interval (seconds), lowest byte | |
943 clrf surface_interval_secs+1 ; ... | |
944 clrf surface_interval_secs+2 ; ... | |
945 clrf surface_interval_secs+3 ; reset surface interval (seconds), highest byte | |
946 clr_surface_interval_mins: | |
947 ; clear the surface interval counted in minutes | |
948 movff opt_diveTimeout,surface_interval_mins+0 ; set surface interval (minutes), low byte, to dive timeout offset | |
949 clrf surface_interval_mins+1 ; reset surface interval (minutes), high byte | |
950 | |
951 return ; done | |
952 | |
958 ;============================================================================= | 953 ;============================================================================= |
959 | 954 |
960 END | 955 END |