comparison code_part1/OSTC_code_asm_part1/menu_logbook.asm @ 777:b92ee354baae

show bailout in logbook, 2.91 beta release
author heinrichsweikamp
date Fri, 02 May 2014 21:40:54 +0200
parents 4452837aff37
children e8af55eb83cb
comparison
equal deleted inserted replaced
776:5760f2b689c5 777:b92ee354baae
241 movlw d'6' ; exit? 241 movlw d'6' ; exit?
242 cpfseq menupos 242 cpfseq menupos
243 bra display_profile ; No, show details/profile 243 bra display_profile ; No, show details/profile
244 goto menu 244 goto menu
245 245
246 display_profile: 246 display_profile:
247 bcf is_bailout
247 movff menupos,mintemp+1 ; store current cursor position 248 movff menupos,mintemp+1 ; store current cursor position
248 bsf return_from_profileview ; tweak search routine to exit after found 249 bsf return_from_profileview ; tweak search routine to exit after found
249 250
250 movf menupos2,W ; Number of page 251 movf menupos2,W ; Number of page
251 mullw d'5' 252 mullw d'5'
815 816
816 decfsz ignore_digits,F ; counts drawn x-pixels to zero 817 decfsz ignore_digits,F ; counts drawn x-pixels to zero
817 bra profile_display_loop ; Not ready yet 818 bra profile_display_loop ; Not ready yet
818 ; Done. 819 ; Done.
819 profile_display_loop_done: 820 profile_display_loop_done:
821 btfss is_bailout ; Bailout during the dive?
822 bra profile_display_loop_done_nobail ; No
823 ; Yes, show "Bailout"
824 movlw color_pink
825 call DISP_set_color
826 WIN_TOP .210
827 WIN_LEFT .105
828 WIN_FONT FT_SMALL
829 lfsr FSR2,letter
830 OUTPUTTEXT d'137' ; Bailout
831 call word_processor
832 profile_display_loop_done_nobail:
820 call DISP_standard_color ; Restore color 833 call DISP_standard_color ; Restore color
821 call menu_pre_loop_common ; Clear some menu flags, timeout and switches 834 call menu_pre_loop_common ; Clear some menu flags, timeout and switches
822 835
823 display_profile_loop: 836 display_profile_loop:
824 call check_switches_logbook 837 call check_switches_logbook
847 dcfsnz active_gas,F 860 dcfsnz active_gas,F
848 movlw color_yellow ; Color for Gas 4 861 movlw color_yellow ; Color for Gas 4
849 dcfsnz active_gas,F 862 dcfsnz active_gas,F
850 movlw color_violet ; Color for Gas 5 863 movlw color_violet ; Color for Gas 5
851 dcfsnz active_gas,F 864 dcfsnz active_gas,F
852 movlw color_cyan ; Color for Gas 6 865 movlw color_pink ; Color for Gas 6
853 goto DISP_set_color ; Set Color... 866 goto DISP_set_color ; Set Color...
854 867
855 ;============================================================================= 868 ;=============================================================================
856 profileview_page2: 869 profileview_page2:
857 WIN_BOX_BLACK .0, .74, .0, .159 ;top, bottom, left, right 870 WIN_BOX_BLACK .0, .74, .0, .159 ;top, bottom, left, right
1277 movf timeout_counter2,W ; number of additional bytes to ignore (0-127) 1290 movf timeout_counter2,W ; number of additional bytes to ignore (0-127)
1278 call incf_eeprom_address0 ; increases bytes in eeprom_address:2 with 0x8000 bank switching 1291 call incf_eeprom_address0 ; increases bytes in eeprom_address:2 with 0x8000 bank switching
1279 return 1292 return
1280 1293
1281 profile_view_get_depth_new2: 1294 profile_view_get_depth_new2:
1295 clrf EventByte
1282 call I2CREAD2 ; Read Event byte 1296 call I2CREAD2 ; Read Event byte
1283 movff SSPBUF,EventByte ; store EventByte 1297 movff SSPBUF,EventByte ; store EventByte
1284 decf timeout_counter2,F ; reduce counter 1298 decf timeout_counter2,F ; reduce counter
1299
1285 ; Check Event flags in the EventByte 1300 ; Check Event flags in the EventByte
1286 btfsc EventByte,4 ; Manual Gas Changed? 1301 btfsc EventByte,7 ; Bailout?
1287 bra logbook_event1 ; Yes! 1302 bra logbook_event2 ; Yes!
1288 btfss EventByte,5 ; Stored Gas Changed? 1303 btfsc EventByte,4 ; Manual Gas Changed?
1289 return ; No, return 1304 bra logbook_event1 ; Yes!
1305 btfsc EventByte,6 ; Setpoint Change?
1306 bra logbook_event3 ; Yes!
1307 btfss EventByte,5 ; Stored Gas Changed?
1308 return ; No, return
1290 ; Stored Gas changed! 1309 ; Stored Gas changed!
1291 call I2CREAD2 ; Read Gas# 1310 call I2CREAD2 ; Read Gas#
1292 movff SSPBUF,average_depth_hold_total+3 1311 movff SSPBUF,average_depth_hold_total+3
1293 rcall profile_display_color ; Back to normal profile color. 1312 rcall profile_display_color ; Back to normal profile color.
1294 1313
1298 logbook_event1: 1317 logbook_event1:
1299 movlw 6 ; Just color backup to 6 1318 movlw 6 ; Just color backup to 6
1300 movwf average_depth_hold_total+3 1319 movwf average_depth_hold_total+3
1301 rcall profile_display_color ; Back to normal profile color. 1320 rcall profile_display_color ; Back to normal profile color.
1302 return ;(The two bytes indicating the manual gas change will be ignored in the standard "ignore loop" above...) 1321 return ;(The two bytes indicating the manual gas change will be ignored in the standard "ignore loop" above...)
1322
1323 logbook_event2: ; Bailout
1324 bsf is_bailout ; Set flag
1325 movff average_depth_hold_total+3,total_divetime_seconds+0 ; Backup last gas color in case we return to CCR
1326 movlw 6 ; Use Gas6 color
1327 movwf average_depth_hold_total+3
1328 rcall profile_display_color ; Back to normal profile color.
1329 return ;(The two bytes indicating the bailout gas selected will be ignored in the standard "ignore loop" above...)
1330
1331 logbook_event3: ; Setpoint change
1332 btfss is_bailout ; Are we in bailout?
1333 return ; No, return
1334 ; We were in bailout before, restore profile color
1335 movff total_divetime_seconds+0,average_depth_hold_total+3 ; Restore color
1336 rcall profile_display_color ; Back to normal profile color.
1337 return
1303 1338
1304 exit_profileview: 1339 exit_profileview:
1305 bcf sleepmode 1340 bcf sleepmode
1306 clrf timeout_counter2 ; restore all registers to build same page again 1341 clrf timeout_counter2 ; restore all registers to build same page again
1307 movff decodata+0,eeprom_address+0 1342 movff decodata+0,eeprom_address+0