comparison src/divemode.asm @ 352:5c6da9fa5cb0

add setpoint change to first sample in CCR mode
author heinrichsweikamp
date Tue, 28 Jul 2015 13:23:09 +0200
parents 692903c50788
children e99bb91f6f92
comparison
equal deleted inserted replaced
351:de8c45fb2ab9 352:5c6da9fa5cb0
1292 decf lo,W ; -1 -> WREG 1292 decf lo,W ; -1 -> WREG
1293 cpfsgt xC+0 ; Compare with depth 1293 cpfsgt xC+0 ; Compare with depth
1294 bra check_dive_autosp3 ; lower depth, do not switch 1294 bra check_dive_autosp3 ; lower depth, do not switch
1295 ; auto switch to SP2 1295 ; auto switch to SP2
1296 movff char_I_setpoint_cbar+1, char_I_const_ppO2 ; Use SetPoint 1296 movff char_I_setpoint_cbar+1, char_I_const_ppO2 ; Use SetPoint
1297 bsf setpoint_changed ; Set flag (For profile) 1297 rcall xmit_sp_set_flag
1298 bsf event_occured ; Set global event byte
1299 bsf sp2_switched ; Set flag 1298 bsf sp2_switched ; Set flag
1300 check_dive_autosp3: 1299 check_dive_autosp3:
1301 ; Check SP3 1300 ; Check SP3
1302 btfsc sp3_switched ;=1: This setpoint has been autoselected already 1301 btfsc sp3_switched ;=1: This setpoint has been autoselected already
1303 bra check_dive_autosp4 ; Skip check 1302 bra check_dive_autosp4 ; Skip check
1308 decf lo,W ; -1 -> WREG 1307 decf lo,W ; -1 -> WREG
1309 cpfsgt xC+0 ; Compare with depth 1308 cpfsgt xC+0 ; Compare with depth
1310 bra check_dive_autosp4 ; lower depth, do not switch 1309 bra check_dive_autosp4 ; lower depth, do not switch
1311 ; auto switch to SP3 1310 ; auto switch to SP3
1312 movff char_I_setpoint_cbar+2, char_I_const_ppO2 ; Use SetPoint 1311 movff char_I_setpoint_cbar+2, char_I_const_ppO2 ; Use SetPoint
1313 bsf setpoint_changed ; Set flag (For profile) 1312 rcall xmit_sp_set_flag
1314 bsf event_occured ; Set global event byte
1315 bsf sp3_switched ; Set flag 1313 bsf sp3_switched ; Set flag
1316 check_dive_autosp4: 1314 check_dive_autosp4:
1317 ; Check SP4 1315 ; Check SP4
1318 btfsc sp4_switched ;=1: This setpoint has been autoselected already 1316 btfsc sp4_switched ;=1: This setpoint has been autoselected already
1319 bra check_dive_autosp5 ; Skip check 1317 bra check_dive_autosp5 ; Skip check
1324 decf lo,W ; -1 -> WREG 1322 decf lo,W ; -1 -> WREG
1325 cpfsgt xC+0 ; Compare with depth 1323 cpfsgt xC+0 ; Compare with depth
1326 bra check_dive_autosp5 ; lower depth, do not switch 1324 bra check_dive_autosp5 ; lower depth, do not switch
1327 ; auto switch to SP4 1325 ; auto switch to SP4
1328 movff char_I_setpoint_cbar+3, char_I_const_ppO2 ; Use SetPoint 1326 movff char_I_setpoint_cbar+3, char_I_const_ppO2 ; Use SetPoint
1329 bsf setpoint_changed ; Set flag (For profile) 1327 rcall xmit_sp_set_flag
1330 bsf event_occured ; Set global event byte
1331 bsf sp4_switched ; Set flag 1328 bsf sp4_switched ; Set flag
1332 check_dive_autosp5: 1329 check_dive_autosp5:
1333 ; Check SP5 1330 ; Check SP5
1334 btfsc sp5_switched ;=1: This setpoint has been autoselected already 1331 btfsc sp5_switched ;=1: This setpoint has been autoselected already
1335 bra check_dive_autosp6 ; Skip check 1332 bra check_dive_autosp6 ; Skip check
1340 decf lo,W ; -1 -> WREG 1337 decf lo,W ; -1 -> WREG
1341 cpfsgt xC+0 ; Compare with depth 1338 cpfsgt xC+0 ; Compare with depth
1342 bra check_dive_autosp6 ; lower depth, do not switch 1339 bra check_dive_autosp6 ; lower depth, do not switch
1343 ; auto switch to SP5 1340 ; auto switch to SP5
1344 movff char_I_setpoint_cbar+4, char_I_const_ppO2 ; Use SetPoint 1341 movff char_I_setpoint_cbar+4, char_I_const_ppO2 ; Use SetPoint
1342 rcall xmit_sp_set_flag
1343 bsf sp5_switched ; Set flag
1344 check_dive_autosp6:
1345 return
1346
1347 xmit_sp_set_flag:
1348 movff char_I_const_ppO2,WREG
1349 call transmit_setpoint ; Transmit current setpoint from WREG (in cbar) to external electronics
1345 bsf setpoint_changed ; Set flag (For profile) 1350 bsf setpoint_changed ; Set flag (For profile)
1346 bsf event_occured ; Set global event byte 1351 bsf event_occured ; Set global event byte
1347 bsf sp5_switched ; Set flag
1348 check_dive_autosp6:
1349 return 1352 return
1350 1353
1351 ;============================================================================= 1354 ;=============================================================================
1352 ; Setup everything to enter divemode. 1355 ; Setup everything to enter divemode.
1353 ; 1356 ;
1372 rcall divemode_setup_sensor_values ; setup sensor values 1375 rcall divemode_setup_sensor_values ; setup sensor values
1373 1376
1374 ; Setup first SP for Fixed or Auto mode 1377 ; Setup first SP for Fixed or Auto mode
1375 TSTOSS opt_ccr_mode ; =0: Fixed SP, =1: Sensor 1378 TSTOSS opt_ccr_mode ; =0: Fixed SP, =1: Sensor
1376 movff char_I_setpoint_cbar+0,char_I_const_ppO2 ; Setup fixed Setpoint (Always start with SP1) 1379 movff char_I_setpoint_cbar+0,char_I_const_ppO2 ; Setup fixed Setpoint (Always start with SP1)
1380 movff char_I_const_ppO2,WREG
1381 call transmit_setpoint ; Transmit current setpoint from WREG (in cbar) to external electronics
1382 bsf setpoint_changed ; Set flag (For profile)
1377 bcf sp2_switched ; =1: This setpoint has been autoselected already 1383 bcf sp2_switched ; =1: This setpoint has been autoselected already
1378 bcf sp3_switched ; =1: This setpoint has been autoselected already 1384 bcf sp3_switched ; =1: This setpoint has been autoselected already
1379 bcf sp4_switched ; =1: This setpoint has been autoselected already 1385 bcf sp4_switched ; =1: This setpoint has been autoselected already
1380 bcf sp5_switched ; =1: This setpoint has been autoselected already 1386 bcf sp5_switched ; =1: This setpoint has been autoselected already
1381 1387