comparison code_part1/OSTC_code_asm_part1/divemode.asm @ 342:06299199dfb9

Fix bad max depth value (fix sub16 to avoid trashing sub_b).
author JeanDo
date Fri, 20 May 2011 01:34:59 +0200
parents 2144f19fa1eb
children 797e2ac42d24
comparison
equal deleted inserted replaced
341:2144f19fa1eb 342:06299199dfb9
1434 call set_max_depth ; update max. depth if required 1434 call set_max_depth ; update max. depth if required
1435 1435
1436 btfsc divemode 1436 btfsc divemode
1437 call set_min_temp ; store min. temp if required 1437 call set_min_temp ; store min. temp if required
1438 1438
1439 bcf temp_changed ; Display temperature? 1439 bcf temp_changed ; Display temperature?
1440 SAFE_2BYTE_COPY temperature,lo 1440 SAFE_2BYTE_COPY temperature,lo
1441 movf lo,W 1441 movf lo,W
1442 cpfseq last_temperature+0 1442 cpfseq last_temperature+0
1443 bsf temp_changed ; Yes 1443 bsf temp_changed ; Yes
1444 movf hi,W 1444 movf hi,W
1445 cpfseq last_temperature+1 1445 cpfseq last_temperature+1
1446 bsf temp_changed ; Yes 1446 bsf temp_changed ; Yes
1447 btfsc temp_changed 1447 btfsc temp_changed
1448 call PLED_temp_divemode ; Displays temperature 1448 call PLED_temp_divemode ; Displays temperature
1449 1449
1450 bcf pres_changed ; Display new depth? 1450 bcf pres_changed ; Display new depth?
1451 SAFE_2BYTE_COPY amb_pressure, lo 1451 SAFE_2BYTE_COPY amb_pressure, lo
1452 movf lo,W 1452 movf lo,W
1453 cpfseq last_pressure+0 1453 cpfseq last_pressure+0
1510 GETCUSTOM8 .0 ; loads dive_threshold in WREG 1510 GETCUSTOM8 .0 ; loads dive_threshold in WREG
1511 movwf sub_a+0 ; dive_treshold is in cm 1511 movwf sub_a+0 ; dive_treshold is in cm
1512 clrf sub_a+1 1512 clrf sub_a+1
1513 SAFE_2BYTE_COPY rel_pressure, sub_b 1513 SAFE_2BYTE_COPY rel_pressure, sub_b
1514 call sub16 ; sub_c = sub_a - sub_b 1514 call sub16 ; sub_c = sub_a - sub_b
1515 1515
1516 btfss neg_flag 1516 btfss neg_flag
1517 bra set_dive_modes2 ; too shallow (rel_pressure<dive_threshold) 1517 bra set_dive_modes2 ; too shallow (rel_pressure<dive_threshold)
1518 1518
1519 btfsc realdive ; Dive longer than one minute? 1519 btfsc realdive ; Dive longer than one minute?
1520 clrf timeout_counter ; Yes, reset timout counter 1520 clrf timeout_counter ; Yes, reset timout counter