comparison src/divemode.asm @ 113:f3062a611eef

Merge
author heinrichsweikamp
date Mon, 23 Jun 2014 16:14:33 +0200
parents c61b7a4e317c
children 35b9da423de6
comparison
equal deleted inserted replaced
112:a24581f0b372 113:f3062a611eef
21 #include "customview.inc" 21 #include "customview.inc"
22 #include "start.inc" 22 #include "start.inc"
23 #include "adc_lightsensor.inc" 23 #include "adc_lightsensor.inc"
24 #include "ghostwriter.inc" 24 #include "ghostwriter.inc"
25 #include "i2c.inc" 25 #include "i2c.inc"
26 #include "calibrate.inc"
26 27
27 gui CODE 28 gui CODE
28 29
29 global diveloop 30 global diveloop
30 diveloop: 31 diveloop:
98 btfsc toggle_gf ; =1: Toggle GF/aGF 99 btfsc toggle_gf ; =1: Toggle GF/aGF
99 rcall divemodemode_togglegf ; Toggle aGF/GF 100 rcall divemodemode_togglegf ; Toggle aGF/GF
100 101
101 ; btfsc FLAG_ccr_mode ; In CCR mode 102 ; btfsc FLAG_ccr_mode ; In CCR mode
102 ; call TFT_active_gas_divemode ; Update Setpoint every second 103 ; call TFT_active_gas_divemode ; Update Setpoint every second
104
105 call compute_ppo2 ; compute mv_sensorX and ppo2_sensorX arrays
103 106
104 bcf onesecupdate ; one seconds update done 107 bcf onesecupdate ; one seconds update done
105 108
106 diveloop_loop3: 109 diveloop_loop3:
107 rcall test_switches_divemode ; Check switches in divemode 110 rcall test_switches_divemode ; Check switches in divemode
246 movwf xA+1 ; P_amb in millibar (1000 = 1.00 bar). 249 movwf xA+1 ; P_amb in millibar (1000 = 1.00 bar).
247 bra set_actual_ppo2_common 250 bra set_actual_ppo2_common
248 set_actual_ppo2_dive: 251 set_actual_ppo2_dive:
249 SAFE_2BYTE_COPY amb_pressure, xA ; P_amb in millibar (1000 = 1.00 bar). 252 SAFE_2BYTE_COPY amb_pressure, xA ; P_amb in millibar (1000 = 1.00 bar).
250 set_actual_ppo2_common: 253 set_actual_ppo2_common:
251 movlw d'10' 254 movlw d'10'
252 movwf xB+0 255 movwf xB+0
253 clrf xB+1 256 clrf xB+1
254 call div16x16 ; xC=p_amb/10 (100 = 1.00 bar). 257 call div16x16 ; xC=p_amb/10 (100 = 1.00 bar).
255 movff xC+0,xA+0 258 movff xC+0,xA+0
256 movff xC+1,xA+1 259 movff xC+1,xA+1
365 ; sum up sensor values (in xA:2) and active sensors in (xB:2) 368 ; sum up sensor values (in xA:2) and active sensors in (xB:2)
366 clrf xB+0 369 clrf xB+0
367 clrf xB+1 370 clrf xB+1
368 clrf xA+0 371 clrf xA+0
369 clrf xA+1 372 clrf xA+1
370 btfss hud_status_byte,3 ; Sensor1 active? 373 btfss sensor1_active ; Sensor1 active?
371 bra divemode_setup_sensor_values2 ; No 374 bra divemode_setup_sensor_values2 ; No
372 movf o2_ppo2_sensor1,W 375 movf o2_ppo2_sensor1,W
373 addwf xA+0 376 addwf xA+0
374 movlw .0 377 movlw .0
375 addwfc xA+1 ; Add into xA:2 378 addwfc xA+1 ; Add into xA:2
376 incf xB+0,F ; Add a sensor 379 incf xB+0,F ; Add a sensor
377 divemode_setup_sensor_values2: 380 divemode_setup_sensor_values2:
378 btfss hud_status_byte,4 ; Sensor2 active? 381 btfss sensor2_active ; Sensor2 active?
379 bra divemode_setup_sensor_values3 ; No 382 bra divemode_setup_sensor_values3 ; No
380 movf o2_ppo2_sensor2,W 383 movf o2_ppo2_sensor2,W
381 addwf xA+0 384 addwf xA+0
382 movlw .0 385 movlw .0
383 addwfc xA+1 ; Add into xA:2 386 addwfc xA+1 ; Add into xA:2
384 incf xB+0,F ; Add a sensor 387 incf xB+0,F ; Add a sensor
385 divemode_setup_sensor_values3: 388 divemode_setup_sensor_values3:
386 btfss hud_status_byte,5 ; Sensor3 active? 389 btfss sensor3_active ; Sensor3 active?
387 bra divemode_setup_sensor_values4 ; No 390 bra divemode_setup_sensor_values4 ; No
388 movf o2_ppo2_sensor3,W 391 movf o2_ppo2_sensor3,W
389 addwf xA+0 392 addwf xA+0
390 movlw .0 393 movlw .0
391 addwfc xA+1 ; Add into xA:2 394 addwfc xA+1 ; Add into xA:2