comparison src/logbook.asm @ 167:05f2100d2eb8

logbook
author heinrichsweikamp
date Sun, 28 Sep 2014 22:27:39 +0200
parents 4d71549dcf6c
children 1784ab9362ca
comparison
equal deleted inserted replaced
166:30ebaf72170d 167:05f2100d2eb8
1284 movff temp1,logbook_ceiling 1284 movff temp1,logbook_ceiling
1285 movff divisor_deco,count_deco ; Restart counter. 1285 movff divisor_deco,count_deco ; Restart counter.
1286 1286
1287 ;---- Read GF, if any AND divisor=0 AND bytes available ------------------ 1287 ;---- Read GF, if any AND divisor=0 AND bytes available ------------------
1288 profile_view_get_depth_no_deco: 1288 profile_view_get_depth_no_deco:
1289 movf timeout_counter2,W ; No more extra bytes ?
1290 btfsc STATUS,Z
1291 return ; No: done.
1292
1293 ; Then skip remaining bytes... 1289 ; Then skip remaining bytes...
1294 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)
1295 call incf_ext_flash_address0_0x20; increases bytes in ext_flash_address:3 with 0x200000 bank switching 1291 tstfsz timeout_counter2 ; Anything to skip?
1292 call incf_ext_flash_address0_0x20; Yes, increases bytes in ext_flash_address:3 with 0x200000 bank switching
1296 return 1293 return
1297 1294
1298 profile_view_get_depth_new2: 1295 profile_view_get_depth_new2:
1299 clrf EventByte 1296 clrf EventByte
1300 clrf EventByte2 ; Clear EventBytes 1297 clrf EventByte2 ; Clear EventBytes
1309 decf timeout_counter2,F ; reduce counter 1306 decf timeout_counter2,F ; reduce counter
1310 bcf EventByte,7 ; Clear flag 1307 bcf EventByte,7 ; Clear flag
1311 1308
1312 profile_no_second_eventbyte: 1309 profile_no_second_eventbyte:
1313 ; Check Event flags in the EventByte 1310 ; Check Event flags in the EventByte
1311 btfsc EventByte,4 ; Manual Gas Changed?
1312 rcall logbook_event1 ; Yes!
1313 btfsc EventByte,5 ; Stored Gas Changed?
1314 rcall logbook_event4 ; Yes!
1315 btfsc EventByte,6 ; Setpoint Change?
1316 rcall logbook_event3 ; Yes!
1314 btfsc EventByte2,0 ; Bailout? 1317 btfsc EventByte2,0 ; Bailout?
1315 bra logbook_event2 ; Yes! 1318 rcall logbook_event2 ; Yes!
1316 btfsc EventByte,4 ; Manual Gas Changed?
1317 bra logbook_event1 ; Yes!
1318 btfsc EventByte,6 ; Setpoint Change?
1319 bra logbook_event3 ; Yes!
1320 btfsc EventByte,5 ; Stored Gas Changed?
1321 bra logbook_event4 ; Yes!
1322 return 1319 return
1323 1320
1324 logbook_event4: ; Stored Gas changed! 1321 logbook_event4: ; Stored Gas changed!
1325 call ext_flash_byte_read_plus_0x20 ; Read Gas# 1322 call ext_flash_byte_read_plus_0x20 ; Read Gas#
1326 decf timeout_counter2,F ; reduce counter 1323 decf timeout_counter2,F ; reduce counter
1331 logbook_event1: ; Gas6 changed 1328 logbook_event1: ; Gas6 changed
1332 bsf gas6_changed 1329 bsf gas6_changed
1333 movlw 6 ; Just color backup to 6 1330 movlw 6 ; Just color backup to 6
1334 movwf average_depth_hold_total+3 1331 movwf average_depth_hold_total+3
1335 rcall profile_display_color ; Back to normal profile color. 1332 rcall profile_display_color ; Back to normal profile color.
1336 return ;(The two bytes indicating the manual gas change will be ignored in the standard "ignore loop" above...) 1333 incf_ext_flash_address_0x20 .2 ; Skip two bytes
1334 decf timeout_counter2,F ; reduce counter
1335 decf timeout_counter2,F ; reduce counter
1336 return
1337 1337
1338 logbook_event2: ; Bailout 1338 logbook_event2: ; Bailout
1339 bsf is_bailout ; Set flag 1339 bsf is_bailout ; Set flag
1340 movff average_depth_hold_total+3,total_divetime_seconds+0 ; Backup last gas color in case we return to CCR 1340 movff average_depth_hold_total+3,total_divetime_seconds+0 ; Backup last gas color in case we return to CCR
1341 movlw 6 ; Use Gas6 color 1341 movlw 6 ; Use Gas6 color
1342 movwf average_depth_hold_total+3 1342 movwf average_depth_hold_total+3
1343 rcall profile_display_color ; Back to normal profile color. 1343 rcall profile_display_color ; Back to normal profile color.
1344 return ;(The two bytes indicating the bailout gas selected will be ignored in the standard "ignore loop" above...) 1344 incf_ext_flash_address_0x20 .2 ; Skip two bytes
1345 decf timeout_counter2,F ; reduce counter
1346 decf timeout_counter2,F ; reduce counter
1347 return
1345 1348
1346 logbook_event3: ; Setpoint change 1349 logbook_event3: ; Setpoint change
1350 incf_ext_flash_address_0x20 .1 ; Skip one byte
1351 decf timeout_counter2,F ; reduce counter
1347 btfss is_bailout ; Are we in bailout? 1352 btfss is_bailout ; Are we in bailout?
1348 return ; No, return 1353 return ; No, return
1349 ; We were in bailout before, restore profile color 1354 ; We were in bailout before, restore profile color
1350 movff total_divetime_seconds+0,average_depth_hold_total+3 ; Restore color 1355 movff total_divetime_seconds+0,average_depth_hold_total+3 ; Restore color
1351 rcall profile_display_color ; Back to normal profile color. 1356 rcall profile_display_color ; Back to normal profile color.