Mercurial > public > hwos_code
comparison src/comm.asm @ 97:53a99a2dc6a1
CHANGE: Always compute bailout plan based on all active gases
CHANGE: Re-select last diluent when returning from bailout to OC
author | heinrichsweikamp |
---|---|
date | Mon, 28 Apr 2014 16:26:31 +0200 |
parents | 7ca1105751c7 |
children | d39493c786a2 |
comparison
equal
deleted
inserted
replaced
96:a4bff632e97b | 97:53a99a2dc6a1 |
---|---|
21 #include "surfmode.inc" | 21 #include "surfmode.inc" |
22 #include "rtc.inc" | 22 #include "rtc.inc" |
23 #include "adc_lightsensor.inc" | 23 #include "adc_lightsensor.inc" |
24 | 24 |
25 extern testloop,new_battery_menu,restart,option_reset_all | 25 extern testloop,new_battery_menu,restart,option_reset_all |
26 extern char_I_deco_gas_change, char_I_dil_change, char_I_setpoint_cbar, char_I_setpoint_change | 26 extern char_I_dil_change, char_I_setpoint_cbar, char_I_setpoint_change |
27 extern char_I_deco_model, char_I_extra_time, char_I_saturation_multiplier, char_I_desaturation_multiplier | 27 extern char_I_deco_model, char_I_extra_time, char_I_saturation_multiplier, char_I_desaturation_multiplier |
28 extern option_check_all, gaslist_cleanup_list, get_first_gas_to_WREG, get_first_dil_to_WREG | 28 extern option_check_all, gaslist_cleanup_list, get_first_gas_to_WREG, get_first_dil_to_WREG |
29 | 29 |
30 #DEFINE timeout_comm_pre_mode .120 ; Pre-loop | 30 #DEFINE timeout_comm_pre_mode .120 ; Pre-loop |
31 #DEFINE timeout_comm_mode .120 ; Download mode | 31 #DEFINE timeout_comm_mode .120 ; Download mode |
938 rcall comm_read_setting_wait ; Wait for UART | 938 rcall comm_read_setting_wait ; Wait for UART |
939 movff opt_gas_He_ratio+0, TXREG1 | 939 movff opt_gas_He_ratio+0, TXREG1 |
940 rcall comm_read_setting_wait ; Wait for UART | 940 rcall comm_read_setting_wait ; Wait for UART |
941 movff opt_gas_type+0, TXREG1 | 941 movff opt_gas_type+0, TXREG1 |
942 rcall comm_read_setting_wait ; Wait for UART | 942 rcall comm_read_setting_wait ; Wait for UART |
943 movff char_I_deco_gas_change+0,TXREG1 | 943 movff opt_OC_bail_gas_change+0,TXREG1 |
944 bra comm_download_mode0 ; Done. Loop with timeout reset | 944 bra comm_download_mode0 ; Done. Loop with timeout reset |
945 comm_read_gas2: | 945 comm_read_gas2: |
946 movff opt_gas_O2_ratio+1, TXREG1 | 946 movff opt_gas_O2_ratio+1, TXREG1 |
947 rcall comm_read_setting_wait ; Wait for UART | 947 rcall comm_read_setting_wait ; Wait for UART |
948 movff opt_gas_He_ratio+1, TXREG1 | 948 movff opt_gas_He_ratio+1, TXREG1 |
949 rcall comm_read_setting_wait ; Wait for UART | 949 rcall comm_read_setting_wait ; Wait for UART |
950 movff opt_gas_type+1, TXREG1 | 950 movff opt_gas_type+1, TXREG1 |
951 rcall comm_read_setting_wait ; Wait for UART | 951 rcall comm_read_setting_wait ; Wait for UART |
952 movff char_I_deco_gas_change+1,TXREG1 | 952 movff opt_OC_bail_gas_change+1,TXREG1 |
953 bra comm_download_mode0 ; Done. Loop with timeout reset | 953 bra comm_download_mode0 ; Done. Loop with timeout reset |
954 comm_read_gas3: | 954 comm_read_gas3: |
955 movff opt_gas_O2_ratio+2, TXREG1 | 955 movff opt_gas_O2_ratio+2, TXREG1 |
956 rcall comm_read_setting_wait ; Wait for UART | 956 rcall comm_read_setting_wait ; Wait for UART |
957 movff opt_gas_He_ratio+2, TXREG1 | 957 movff opt_gas_He_ratio+2, TXREG1 |
958 rcall comm_read_setting_wait ; Wait for UART | 958 rcall comm_read_setting_wait ; Wait for UART |
959 movff opt_gas_type+2, TXREG1 | 959 movff opt_gas_type+2, TXREG1 |
960 rcall comm_read_setting_wait ; Wait for UART | 960 rcall comm_read_setting_wait ; Wait for UART |
961 movff char_I_deco_gas_change+2,TXREG1 | 961 movff opt_OC_bail_gas_change+2,TXREG1 |
962 bra comm_download_mode0 ; Done. Loop with timeout reset | 962 bra comm_download_mode0 ; Done. Loop with timeout reset |
963 comm_read_gas4: | 963 comm_read_gas4: |
964 movff opt_gas_O2_ratio+3, TXREG1 | 964 movff opt_gas_O2_ratio+3, TXREG1 |
965 rcall comm_read_setting_wait ; Wait for UART | 965 rcall comm_read_setting_wait ; Wait for UART |
966 movff opt_gas_He_ratio+3, TXREG1 | 966 movff opt_gas_He_ratio+3, TXREG1 |
967 rcall comm_read_setting_wait ; Wait for UART | 967 rcall comm_read_setting_wait ; Wait for UART |
968 movff opt_gas_type+3, TXREG1 | 968 movff opt_gas_type+3, TXREG1 |
969 rcall comm_read_setting_wait ; Wait for UART | 969 rcall comm_read_setting_wait ; Wait for UART |
970 movff char_I_deco_gas_change+3,TXREG1 | 970 movff opt_OC_bail_gas_change+3,TXREG1 |
971 bra comm_download_mode0 ; Done. Loop with timeout reset | 971 bra comm_download_mode0 ; Done. Loop with timeout reset |
972 comm_read_gas5: | 972 comm_read_gas5: |
973 movff opt_gas_O2_ratio+4, TXREG1 | 973 movff opt_gas_O2_ratio+4, TXREG1 |
974 rcall comm_read_setting_wait ; Wait for UART | 974 rcall comm_read_setting_wait ; Wait for UART |
975 movff opt_gas_He_ratio+4, TXREG1 | 975 movff opt_gas_He_ratio+4, TXREG1 |
976 rcall comm_read_setting_wait ; Wait for UART | 976 rcall comm_read_setting_wait ; Wait for UART |
977 movff opt_gas_type+4, TXREG1 | 977 movff opt_gas_type+4, TXREG1 |
978 rcall comm_read_setting_wait ; Wait for UART | 978 rcall comm_read_setting_wait ; Wait for UART |
979 movff char_I_deco_gas_change+4,TXREG1 | 979 movff opt_OC_bail_gas_change+4,TXREG1 |
980 bra comm_download_mode0 ; Done. Loop with timeout reset | 980 bra comm_download_mode0 ; Done. Loop with timeout reset |
981 | 981 |
982 comm_read_dil1: | 982 comm_read_dil1: |
983 movff opt_dil_O2_ratio+0, TXREG1 | 983 movff opt_dil_O2_ratio+0, TXREG1 |
984 rcall comm_read_setting_wait ; Wait for UART | 984 rcall comm_read_setting_wait ; Wait for UART |
1286 call rs232_get_byte | 1286 call rs232_get_byte |
1287 movff RCREG1,opt_gas_He_ratio+0 | 1287 movff RCREG1,opt_gas_He_ratio+0 |
1288 call rs232_get_byte | 1288 call rs232_get_byte |
1289 movff RCREG1,opt_gas_type+0 | 1289 movff RCREG1,opt_gas_type+0 |
1290 call rs232_get_byte | 1290 call rs232_get_byte |
1291 movff RCREG1,char_I_deco_gas_change+0 | 1291 movff RCREG1,opt_OC_bail_gas_change+0 |
1292 bra comm_write_abort ; Done. Loop with timeout reset | 1292 bra comm_write_abort ; Done. Loop with timeout reset |
1293 comm_write_gas2: | 1293 comm_write_gas2: |
1294 call rs232_get_byte | 1294 call rs232_get_byte |
1295 movff RCREG1,opt_gas_O2_ratio+1 | 1295 movff RCREG1,opt_gas_O2_ratio+1 |
1296 call rs232_get_byte | 1296 call rs232_get_byte |
1297 movff RCREG1,opt_gas_He_ratio+1 | 1297 movff RCREG1,opt_gas_He_ratio+1 |
1298 call rs232_get_byte | 1298 call rs232_get_byte |
1299 movff RCREG1,opt_gas_type+1 | 1299 movff RCREG1,opt_gas_type+1 |
1300 call rs232_get_byte | 1300 call rs232_get_byte |
1301 movff RCREG1,char_I_deco_gas_change+1 | 1301 movff RCREG1,opt_OC_bail_gas_change+1 |
1302 bra comm_write_abort ; Done. Loop with timeout reset | 1302 bra comm_write_abort ; Done. Loop with timeout reset |
1303 comm_write_gas3: | 1303 comm_write_gas3: |
1304 call rs232_get_byte | 1304 call rs232_get_byte |
1305 movff RCREG1,opt_gas_O2_ratio+2 | 1305 movff RCREG1,opt_gas_O2_ratio+2 |
1306 call rs232_get_byte | 1306 call rs232_get_byte |
1307 movff RCREG1,opt_gas_He_ratio+2 | 1307 movff RCREG1,opt_gas_He_ratio+2 |
1308 call rs232_get_byte | 1308 call rs232_get_byte |
1309 movff RCREG1,opt_gas_type+2 | 1309 movff RCREG1,opt_gas_type+2 |
1310 call rs232_get_byte | 1310 call rs232_get_byte |
1311 movff RCREG1,char_I_deco_gas_change+2 | 1311 movff RCREG1,opt_OC_bail_gas_change+2 |
1312 bra comm_write_abort ; Done. Loop with timeout reset | 1312 bra comm_write_abort ; Done. Loop with timeout reset |
1313 comm_write_gas4: | 1313 comm_write_gas4: |
1314 call rs232_get_byte | 1314 call rs232_get_byte |
1315 movff RCREG1,opt_gas_O2_ratio+3 | 1315 movff RCREG1,opt_gas_O2_ratio+3 |
1316 call rs232_get_byte | 1316 call rs232_get_byte |
1317 movff RCREG1,opt_gas_He_ratio+3 | 1317 movff RCREG1,opt_gas_He_ratio+3 |
1318 call rs232_get_byte | 1318 call rs232_get_byte |
1319 movff RCREG1,opt_gas_type+3 | 1319 movff RCREG1,opt_gas_type+3 |
1320 call rs232_get_byte | 1320 call rs232_get_byte |
1321 movff RCREG1,char_I_deco_gas_change+3 | 1321 movff RCREG1,opt_OC_bail_gas_change+3 |
1322 bra comm_write_abort ; Done. Loop with timeout reset | 1322 bra comm_write_abort ; Done. Loop with timeout reset |
1323 comm_write_gas5: | 1323 comm_write_gas5: |
1324 call rs232_get_byte | 1324 call rs232_get_byte |
1325 movff RCREG1,opt_gas_O2_ratio+4 | 1325 movff RCREG1,opt_gas_O2_ratio+4 |
1326 call rs232_get_byte | 1326 call rs232_get_byte |
1327 movff RCREG1,opt_gas_He_ratio+4 | 1327 movff RCREG1,opt_gas_He_ratio+4 |
1328 call rs232_get_byte | 1328 call rs232_get_byte |
1329 movff RCREG1,opt_gas_type+4 | 1329 movff RCREG1,opt_gas_type+4 |
1330 call rs232_get_byte | 1330 call rs232_get_byte |
1331 movff RCREG1,char_I_deco_gas_change+4 | 1331 movff RCREG1,opt_OC_bail_gas_change+4 |
1332 bra comm_write_abort ; Done. Loop with timeout reset | 1332 bra comm_write_abort ; Done. Loop with timeout reset |
1333 | 1333 |
1334 comm_write_dil1: | 1334 comm_write_dil1: |
1335 call rs232_get_byte | 1335 call rs232_get_byte |
1336 movff RCREG1,opt_dil_O2_ratio+0 | 1336 movff RCREG1,opt_dil_O2_ratio+0 |