comparison code_part1/OSTC_code_asm_part1/menu_logbook.asm @ 794:e8af55eb83cb

BUGFIX: False Bailout and Gas 6 flags in logbook
author heinrichsweikamp
date Mon, 29 Sep 2014 12:11:17 +0200
parents b92ee354baae
children fec91971e4b9
comparison
equal deleted inserted replaced
793:55bd11e07d9f 794:e8af55eb83cb
806 profile_display_skip_loop1: ; skips readings! 806 profile_display_skip_loop1: ; skips readings!
807 dcfsnz profile_temp2+0,F 807 dcfsnz profile_temp2+0,F
808 bra profile_display_loop3 ; check 16bit.... 808 bra profile_display_loop3 ; check 16bit....
809 809
810 rcall profile_view_get_depth ; reads depth, temp and profile data 810 rcall profile_view_get_depth ; reads depth, temp and profile data
811
812 btfsc second_FD ; end-of profile reached?
813 bra profile_display_loop_done ; Yes, skip all remaining pixels
814
811 bra profile_display_skip_loop1 815 bra profile_display_skip_loop1
812 816
813 profile_display_loop3: 817 profile_display_loop3:
814 decfsz profile_temp2+1,F ; 16 bit x-scaler test 818 decfsz profile_temp2+1,F ; 16 bit x-scaler test
815 bra profile_display_skip_loop1 ; skips readings! 819 bra profile_display_skip_loop1 ; skips readings!
1237 bsf second_FD ; End found! Set Flag! Skip remaining pixels! 1241 bsf second_FD ; End found! Set Flag! Skip remaining pixels!
1238 return 1242 return
1239 1243
1240 profile_view_get_depth_new1: 1244 profile_view_get_depth_new1:
1241 btfsc event_occured ; Was there an event attached to this sample? 1245 btfsc event_occured ; Was there an event attached to this sample?
1242 rcall profile_view_get_depth_new2 ; Yes, get information about this event 1246 rcall profile_view_get_depth_events ; Yes, get information about this event(s)
1243 1247
1244 ;---- Read Tp°, if any AND divisor reached AND bytes available ----------- 1248 ;---- Read Tp°, if any AND divisor reached AND bytes available -----------
1245 movf divisor_temperature,W ; Is Tp° divisor null ? 1249 movf divisor_temperature,W ; Is Tp° divisor null ?
1246 bz profile_view_get_depth_no_tp; Yes: no Tp° curve. 1250 bz profile_view_get_depth_no_tp; Yes: no Tp° curve.
1247 decf count_temperature,F ; Decrement tp° counter 1251 decf count_temperature,F ; Decrement tp° counter
1276 1280
1277 call I2CREAD2 1281 call I2CREAD2
1278 movff SSPBUF,logbook_ceiling 1282 movff SSPBUF,logbook_ceiling
1279 decf timeout_counter2,F 1283 decf timeout_counter2,F
1280 movff divisor_deco,count_deco ; Restart counter. 1284 movff divisor_deco,count_deco ; Restart counter.
1285 call I2CREAD2 ; Skip stop length
1286 decf timeout_counter2,F
1281 1287
1282 ;---- Read GF, if any AND divisor=0 AND bytes available ------------------ 1288 ;---- Read GF, if any AND divisor=0 AND bytes available ------------------
1283 profile_view_get_depth_no_deco: 1289 profile_view_get_depth_no_deco:
1284 1290
1285 movf timeout_counter2,W ; No more extra bytes ? 1291 movf timeout_counter2,W ; No more extra bytes ?
1289 ; Then skip remaining bytes... 1295 ; Then skip remaining bytes...
1290 movf timeout_counter2,W ; number of additional bytes to ignore (0-127) 1296 movf timeout_counter2,W ; number of additional bytes to ignore (0-127)
1291 call incf_eeprom_address0 ; increases bytes in eeprom_address:2 with 0x8000 bank switching 1297 call incf_eeprom_address0 ; increases bytes in eeprom_address:2 with 0x8000 bank switching
1292 return 1298 return
1293 1299
1294 profile_view_get_depth_new2: 1300 profile_view_get_depth_events:
1295 clrf EventByte
1296 call I2CREAD2 ; Read Event byte 1301 call I2CREAD2 ; Read Event byte
1297 movff SSPBUF,EventByte ; store EventByte 1302 movff SSPBUF,EventByte ; store EventByte
1298 decf timeout_counter2,F ; reduce counter 1303 decf timeout_counter2,F ; reduce counter
1299 1304
1300 ; Check Event flags in the EventByte 1305 ; Check Event flags in the EventByte
1301 btfsc EventByte,7 ; Bailout? 1306 btfsc EventByte,7 ; Bailout?
1302 bra logbook_event2 ; Yes! 1307 rcall logbook_event2 ; Yes!
1303 btfsc EventByte,4 ; Manual Gas Changed? 1308 btfsc EventByte,4 ; Manual Gas Changed?
1304 bra logbook_event1 ; Yes! 1309 rcall logbook_event1 ; Yes!
1305 btfsc EventByte,6 ; Setpoint Change? 1310 btfsc EventByte,6 ; Setpoint Change?
1306 bra logbook_event3 ; Yes! 1311 rcall logbook_event3 ; Yes!
1307 btfss EventByte,5 ; Stored Gas Changed? 1312 btfsc EventByte,5 ; Stored Gas Changed?
1313 rcall logbook_event4 ; Yes!
1308 return ; No, return 1314 return ; No, return
1309 ; Stored Gas changed! 1315
1316 logbook_event4: ; Stored Gas changed!
1310 call I2CREAD2 ; Read Gas# 1317 call I2CREAD2 ; Read Gas#
1311 movff SSPBUF,average_depth_hold_total+3 1318 movff SSPBUF,average_depth_hold_total+3
1312 rcall profile_display_color ; Back to normal profile color. 1319 rcall profile_display_color ; Back to normal profile color.
1313
1314 decf timeout_counter2,F ; reduce counter 1320 decf timeout_counter2,F ; reduce counter
1315 return 1321 return
1316 1322
1317 logbook_event1: 1323 logbook_event1:
1318 movlw 6 ; Just color backup to 6 1324 movlw 6 ; Just color backup to 6
1319 movwf average_depth_hold_total+3 1325 movwf average_depth_hold_total+3
1320 rcall profile_display_color ; Back to normal profile color. 1326 rcall profile_display_color ; Back to normal profile color.
1321 return ;(The two bytes indicating the manual gas change will be ignored in the standard "ignore loop" above...) 1327 call I2CREAD2 ; Read O2
1328 decf timeout_counter2,F ; reduce counter
1329 call I2CREAD2 ; Read He
1330 decf timeout_counter2,F ; reduce counter
1331 return
1322 1332
1323 logbook_event2: ; Bailout 1333 logbook_event2: ; Bailout
1324 bsf is_bailout ; Set flag 1334 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 1335 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 1336 movlw 6 ; Use Gas6 color
1327 movwf average_depth_hold_total+3 1337 movwf average_depth_hold_total+3
1328 rcall profile_display_color ; Back to normal profile color. 1338 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...) 1339 call I2CREAD2 ; Read O2
1340 decf timeout_counter2,F ; reduce counter
1341 call I2CREAD2 ; Read He
1342 decf timeout_counter2,F ; reduce counter
1343 return
1330 1344
1331 logbook_event3: ; Setpoint change 1345 logbook_event3: ; Setpoint change
1332 btfss is_bailout ; Are we in bailout? 1346 btfss is_bailout ; Are we in bailout?
1333 return ; No, return 1347 return ; No, return
1334 ; We were in bailout before, restore profile color 1348 ; We were in bailout before, restore profile color
1335 movff total_divetime_seconds+0,average_depth_hold_total+3 ; Restore color 1349 movff total_divetime_seconds+0,average_depth_hold_total+3 ; Restore color
1336 rcall profile_display_color ; Back to normal profile color. 1350 rcall profile_display_color ; Back to normal profile color.
1351 call I2CREAD2 ; Read Setpoint
1352 decf timeout_counter2,F ; reduce counter
1337 return 1353 return
1338 1354
1339 exit_profileview: 1355 exit_profileview:
1340 bcf sleepmode 1356 bcf sleepmode
1341 clrf timeout_counter2 ; restore all registers to build same page again 1357 clrf timeout_counter2 ; restore all registers to build same page again