Mercurial > public > hwos_code
comparison src/divemode.asm @ 549:7c408bfaf2e8
2.26 stable RC1
BUGFIX: O2 Sensor readings were not updated in fixed setpoint mode
CHANGE: Minor logbook layout fix
author | heinrichsweikamp |
---|---|
date | Mon, 25 Sep 2017 19:02:42 +0200 |
parents | 49be7b31b4db |
children | a5d2e6083b1d |
comparison
equal
deleted
inserted
replaced
548:abf3cbd5815e | 549:7c408bfaf2e8 |
---|---|
408 movlw .2 ; Restart countdown. | 408 movlw .2 ; Restart countdown. |
409 movwf apnoe_mins | 409 movwf apnoe_mins |
410 return ; done. | 410 return ; done. |
411 | 411 |
412 calc_deko_divemode_sensor: ; External sensor stuff | 412 calc_deko_divemode_sensor: ; External sensor stuff |
413 call compute_ppo2 ; computes o2_ppo2_sensorX from mV-Readings | |
414 call check_sensors ; analyses mv-Readings to set up use- and voting-Flags | |
415 call divemode_setup_sensor_values ; computes sensor_setpoint from o2_pp02_sensorX and Flags | |
416 | |
413 movff opt_ccr_mode,WREG ; =0: Fixed SP, =1: Sensor, =2: Auto SP | 417 movff opt_ccr_mode,WREG ; =0: Fixed SP, =1: Sensor, =2: Auto SP |
414 sublw .1 ; opt_ccr_mode = 1 (Sensor)? | 418 sublw .1 ; opt_ccr_mode = 1 (Sensor)? |
415 bnz calc_deko_divemode_sensor_done ; No, return | 419 bnz calc_deko_divemode_sensor_done ; No, return |
416 | 420 |
417 call compute_ppo2 ; computes o2_ppo2_sensorX from mV-Readings | |
418 call check_sensors ; analyses mv-Readings to set up use- and voting-Flags | |
419 call divemode_setup_sensor_values ; computes sensor_setpoint from o2_pp02_sensorX and Flags | |
420 movff sensor_setpoint,char_I_const_ppO2; Copy sensor result to C-code | 421 movff sensor_setpoint,char_I_const_ppO2; Copy sensor result to C-code |
421 | 422 |
422 TSTOSS opt_sensor_fallback ; =1: Fallback to SP1 when sensor is lost | 423 TSTOSS opt_sensor_fallback ; =1: Fallback to SP1 when sensor is lost |
423 return ; Never fallback | 424 return ; Never fallback |
424 | 425 |
1467 return | 1468 return |
1468 | 1469 |
1469 dive_boot_cc: | 1470 dive_boot_cc: |
1470 bcf is_bailout ; =1: Bailout | 1471 bcf is_bailout ; =1: Bailout |
1471 bcf setpoint_fallback ; =1: Fallback to SP1 due to external O2 sensor failure | 1472 bcf setpoint_fallback ; =1: Fallback to SP1 due to external O2 sensor failure |
1472 bcf blinking_setpoint ; Reset blinking SP flag | 1473 bcf blinking_setpoint ; Reset blinking SP flag |
1473 ; Noch testen mH | 1474 ; load default setpoint |
1474 ; call compute_ppo2 ; compute mv_sensorX and ppo2_sensorX arrays | 1475 movff char_I_setpoint_cbar+0,char_I_const_ppO2 ; Always start with SP1 |
1475 ; bsf voting_logic_sensor1 | |
1476 ; bsf voting_logic_sensor2 | |
1477 ; bsf voting_logic_sensor3 | |
1478 ; call divemode_setup_sensor_values ; setup sensor values | |
1479 | |
1480 ; Setup first SP for Fixed or Auto mode (Skipped here, because value is overwritten in sensor mode immediately anyway) | |
1481 ; movff opt_ccr_mode,WREG ; =0: Fixed SP, =1: Sensor, =2: Auto SP | |
1482 ; sublw .1 ; opt_ccr_mode = 1 (Sensor)? | |
1483 ; bnz dive_boot_cc2 ; No, Skip | |
1484 movff char_I_setpoint_cbar+0,char_I_const_ppO2 ; No, setup fixed Setpoint (Always start with SP1) | |
1485 movff char_I_const_ppO2,WREG | 1476 movff char_I_const_ppO2,WREG |
1477 | |
1478 call transmit_setpoint ; Transmit current setpoint from WREG (in cbar) to external electronics | |
1479 | |
1480 ; check if in sensor mode | |
1481 movff opt_ccr_mode,WREG ; =0: Fixed SP, =1: Sensor, =2: Auto SP | |
1482 sublw .1 ; opt_ccr_mode = 1 (Sensor)? | |
1483 bnz dive_boot_cc2 ; No, Skip | |
1484 | |
1485 ; get initial setpoint from all sensors in use | |
1486 call compute_ppo2 ; compute mv_sensorX and ppo2_sensorX arrays | |
1487 bsf voting_logic_sensor1 ; voting logic not used while computing initial setpoint | |
1488 bsf voting_logic_sensor2 | |
1489 bsf voting_logic_sensor3 | |
1490 call divemode_setup_sensor_values ; setup sensor values | |
1491 tstfsz sensor_setpoint ; if no sensor is in use, sensor_setpoint will be zero | |
1492 movff sensor_setpoint,char_I_const_ppO2; overwrite default only if we have a valid sensor_setpoint | |
1493 | |
1486 dive_boot_cc2: | 1494 dive_boot_cc2: |
1487 call transmit_setpoint ; Transmit current setpoint from WREG (in cbar) to external electronics | |
1488 bsf setpoint_changed ; Set flag (For profile) | 1495 bsf setpoint_changed ; Set flag (For profile) |
1489 bcf sp2_switched ; =1: This setpoint has been autoselected already | 1496 bcf sp2_switched ; =1: This setpoint has been autoselected already |
1490 bcf sp3_switched ; =1: This setpoint has been autoselected already | 1497 bcf sp3_switched ; =1: This setpoint has been autoselected already |
1491 bcf sp4_switched ; =1: This setpoint has been autoselected already | 1498 bcf sp4_switched ; =1: This setpoint has been autoselected already |
1492 bcf sp5_switched ; =1: This setpoint has been autoselected already | 1499 bcf sp5_switched ; =1: This setpoint has been autoselected already |