comparison code_part1/OSTC_code_asm_part1/divemode.asm @ 239:3ed240d60341

High altitude (Plane/Fly) mode added
author heinrichsweikamp
date Mon, 21 Mar 2011 13:31:38 +0100
parents 55178aa1f972
children 4ef3bcbc7091
comparison
equal deleted inserted replaced
238:9581e48a914f 239:3ed240d60341
1407 movff temperature+0,mintemp+0 1407 movff temperature+0,mintemp+0
1408 movff temperature+1,mintemp+1 1408 movff temperature+1,mintemp+1
1409 return 1409 return
1410 1410
1411 set_dive_modes: 1411 set_dive_modes:
1412 btfsc high_altitude_mode ; In high altitude (Fly) mode?
1413 bra set_dive_modes3 ; Yes
1414
1412 bcf divemode2 ; Stop time 1415 bcf divemode2 ; Stop time
1413 1416
1414 GETCUSTOM8 .0 ; loads dive_threshold in WREG 1417 GETCUSTOM8 .0 ; loads dive_threshold in WREG
1415 movwf sub_a+0 ; dive_treshold is in cm 1418 movwf sub_a+0 ; dive_treshold is in cm
1416 clrf sub_a+1 1419 clrf sub_a+1
1417
1418 movff rel_pressure+0,sub_b+0 1420 movff rel_pressure+0,sub_b+0
1419 movff rel_pressure+1,sub_b+1 1421 movff rel_pressure+1,sub_b+1
1420 1422 call sub16 ; sub_c = sub_a - sub_b
1421 call sub16 ; sub_c = sub_a - sub_b
1422 1423
1423 btfss neg_flag 1424 btfss neg_flag
1424 bra set_dive_modes2 ; too shallow (rel_pressure<dive_threshold) 1425 bra set_dive_modes2 ; too shallow (rel_pressure<dive_threshold)
1425 1426
1426 btfsc realdive ; Dive longer than one minute? 1427 btfsc realdive ; Dive longer than one minute?
1427 clrf timeout_counter 1428 clrf timeout_counter ; Yes, reset timout counter
1428 1429
1429 bsf divemode 1430 bsf divemode ; (Re-)Set divemode flag
1430 bsf divemode2 ; displayed divetime is running 1431 bsf divemode2 ; displayed divetime is running
1431 return 1432 return
1432 1433
1433 set_dive_modes2: 1434 set_dive_modes2:
1434 btfss realdive ; dive longer then one minute? 1435 btfss realdive ; dive longer then one minute?
1435 bcf divemode ; no -> this was no real dive 1436 bcf divemode ; no -> this was no real dive
1437 return
1438
1439 set_dive_modes3:
1440 movlw HIGH d'1075' ; hard-wired 1075mBar threshold
1441 movwf sub_a+1
1442 movlw LOW d'1075' ; hard-wired 1075mBar threshold
1443 movwf sub_a+0
1444 movff rel_pressure+0,sub_b+0
1445 movff rel_pressure+1,sub_b+1
1446 call sub16 ; sub_c = sub_a - sub_b
1447
1448 btfss neg_flag
1449 bra set_dive_modes2 ; too shallow (rel_pressure<dive_threshold)
1450
1451 bsf divemode ; (Re-)Set divemode flag
1452 bsf divemode2 ; displayed divetime is running
1436 return 1453 return
1437 1454
1438 set_powersafe: 1455 set_powersafe:
1439 btfsc low_battery_state ; battery warning alread active? 1456 btfsc low_battery_state ; battery warning alread active?
1440 bra set_powersafe2 ; Yes, but is it still required? 1457 bra set_powersafe2 ; Yes, but is it still required?