Mercurial > public > hwos_code
comparison src/logbook.asm @ 99:87cc1adfe4da
show event "bailout" in the internal logbook
author | heinrichsweikamp |
---|---|
date | Fri, 02 May 2014 14:13:35 +0200 |
parents | 24b3fd59e61f |
children | f3062a611eef |
comparison
equal
deleted
inserted
replaced
98:24b3fd59e61f | 99:87cc1adfe4da |
---|---|
70 ; Profile display | 70 ; Profile display |
71 #DEFINE profile_height_pixels .157 ; Amount of pixels height for profile display | 71 #DEFINE profile_height_pixels .157 ; Amount of pixels height for profile display |
72 #DEFINE profile_width_pixels .156 ; Amount of pixels width for profile display | 72 #DEFINE profile_width_pixels .156 ; Amount of pixels width for profile display |
73 #DEFINE profile_left .1 ; Left border | 73 #DEFINE profile_left .1 ; Left border |
74 #DEFINE profile_top .65 ; Top border | 74 #DEFINE profile_top .65 ; Top border |
75 | |
76 ; "Bailout" | |
77 #DEFINE logbook_bailout_column .124 | |
78 #DEFINE logbook_bailout_row .207 | |
75 | 79 |
76 ; Dive number | 80 ; Dive number |
77 #DEFINE logbook_divenumer_column .1 | 81 #DEFINE logbook_divenumer_column .1 |
78 #DEFINE logbook_divenumer_row .1 | 82 #DEFINE logbook_divenumer_row .1 |
79 ; Date and Time | 83 ; Date and Time |
361 movlw logbook_row_number+.1 ; Next page? | 365 movlw logbook_row_number+.1 ; Next page? |
362 cpfseq menupos | 366 cpfseq menupos |
363 bra display_profile ; No, show details/profile | 367 bra display_profile ; No, show details/profile |
364 goto next_logbook2 ; Next page! | 368 goto next_logbook2 ; Next page! |
365 | 369 |
366 display_profile: | 370 display_profile: |
371 bcf is_bailout | |
372 bcf gas6_changed ; Clear event flags | |
367 call speed_fastest | 373 call speed_fastest |
368 movff menupos,logbook_menupos_temp; store current cursor position | 374 movff menupos,logbook_menupos_temp; store current cursor position |
369 bsf return_from_profileview ; tweak search routine to exit after found | 375 bsf return_from_profileview ; tweak search routine to exit after found |
370 | 376 |
371 movf logbook_page_number,W ; Number of page | 377 movf logbook_page_number,W ; Number of page |
912 ; Done. | 918 ; Done. |
913 | 919 |
914 display_profile_no_profile: ; No profile available for this dive! | 920 display_profile_no_profile: ; No profile available for this dive! |
915 | 921 |
916 profile_display_loop_done: | 922 profile_display_loop_done: |
923 btfss is_bailout ; Bailout during the dive? | |
924 bra profile_display_loop_done_nobail ; No | |
925 ; Yes, show "Bailout" | |
926 movlw color_pink | |
927 call TFT_set_color | |
928 WIN_TINY logbook_bailout_column,logbook_bailout_row | |
929 STRCPY_TEXT_PRINT tDiveBailout ; Bailout | |
930 profile_display_loop_done_nobail: | |
931 btfss gas6_changed ; Gas6 | |
932 bra profile_display_loop_done_nogas6 ; No | |
933 ; Yes, show "Gas 6!" | |
934 movlw color_pink | |
935 call TFT_set_color | |
936 WIN_TINY logbook_bailout_column,logbook_bailout_row-.15 | |
937 STRCPY_TEXT tGas ; Gas | |
938 STRCAT_PRINT " 6!" | |
939 | |
940 profile_display_loop_done_nogas6: | |
917 decf divesecs,F ;-1 | 941 decf divesecs,F ;-1 |
918 read_int_eeprom .2 | 942 read_int_eeprom .2 |
919 movf EEDATA,W | 943 movf EEDATA,W |
920 bcf STATUS,C | 944 bcf STATUS,C |
921 subfwb divesecs,W ; max. dives (low value) - divesecs | 945 subfwb divesecs,W ; max. dives (low value) - divesecs |
1072 dcfsnz active_gas,F | 1096 dcfsnz active_gas,F |
1073 movlw color_yellow ; Color for Gas 4 | 1097 movlw color_yellow ; Color for Gas 4 |
1074 dcfsnz active_gas,F | 1098 dcfsnz active_gas,F |
1075 movlw color_cyan ; Color for Gas 5 | 1099 movlw color_cyan ; Color for Gas 5 |
1076 dcfsnz active_gas,F | 1100 dcfsnz active_gas,F |
1077 movlw color_cyan ; Color for Gas 6 | 1101 movlw color_pink ; Color for Gas 6 |
1078 goto TFT_set_color ; Set Color... | 1102 goto TFT_set_color ; Set Color... |
1079 | 1103 |
1080 ;============================================================================= | 1104 ;============================================================================= |
1081 ; Draw a vertical line between xC+1 and xC+0, at current X position. | 1105 ; Draw a vertical line between xC+1 and xC+0, at current X position. |
1082 ; | 1106 ; |
1227 movf timeout_counter2,W ; number of additional bytes to ignore (0-127) | 1251 movf timeout_counter2,W ; number of additional bytes to ignore (0-127) |
1228 call incf_ext_flash_address0_0x20; increases bytes in ext_flash_address:3 with 0x200000 bank switching | 1252 call incf_ext_flash_address0_0x20; increases bytes in ext_flash_address:3 with 0x200000 bank switching |
1229 return | 1253 return |
1230 | 1254 |
1231 profile_view_get_depth_new2: | 1255 profile_view_get_depth_new2: |
1232 call ext_flash_byte_read_plus_0x20 ; Read Event byte | 1256 clrf EventByte |
1257 clrf EventByte2 ; Clear EventBytes | |
1258 call ext_flash_byte_read_plus_0x20 ; Read Event byte | |
1233 movff temp1,EventByte ; store EventByte | 1259 movff temp1,EventByte ; store EventByte |
1234 decf timeout_counter2,F ; reduce counter | 1260 decf timeout_counter2,F ; reduce counter |
1235 | 1261 |
1236 btfss EventByte,7 ; Another Event byte? | 1262 btfss EventByte,7 ; Another Event byte? |
1237 bra profile_no_second_eventbyte ; No | 1263 bra profile_no_second_eventbyte ; No |
1240 decf timeout_counter2,F ; reduce counter | 1266 decf timeout_counter2,F ; reduce counter |
1241 bcf EventByte,7 ; Clear flag | 1267 bcf EventByte,7 ; Clear flag |
1242 | 1268 |
1243 profile_no_second_eventbyte: | 1269 profile_no_second_eventbyte: |
1244 ; Check Event flags in the EventByte | 1270 ; Check Event flags in the EventByte |
1271 btfsc EventByte2,0 ; Bailout? | |
1272 bra logbook_event2 ; Yes! | |
1245 btfsc EventByte,4 ; Manual Gas Changed? | 1273 btfsc EventByte,4 ; Manual Gas Changed? |
1246 bra logbook_event1 ; Yes! | 1274 bra logbook_event1 ; Yes! |
1275 btfsc EventByte,6 ; Setpoint Change? | |
1276 bra logbook_event3 ; Yes! | |
1247 btfss EventByte,5 ; Stored Gas Changed? | 1277 btfss EventByte,5 ; Stored Gas Changed? |
1248 return ; No, return | 1278 return ; No, return |
1249 ; Stored Gas changed! | 1279 ; Stored Gas changed! |
1250 call ext_flash_byte_read_plus_0x20 ; Read Gas# | 1280 call ext_flash_byte_read_plus_0x20 ; Read Gas# |
1251 decf timeout_counter2,F ; reduce counter | 1281 decf timeout_counter2,F ; reduce counter |
1252 movff temp1,average_depth_hold_total+3 | 1282 movff temp1,average_depth_hold_total+3 |
1253 rcall profile_display_color ; Change profile color according to gas number | 1283 rcall profile_display_color ; Change profile color according to gas number |
1254 return | 1284 return |
1255 | 1285 |
1256 logbook_event1: | 1286 logbook_event1: ; Gas6 changed |
1287 bsf gas6_changed | |
1257 movlw 6 ; Just color backup to 6 | 1288 movlw 6 ; Just color backup to 6 |
1258 movwf average_depth_hold_total+3 | 1289 movwf average_depth_hold_total+3 |
1259 rcall profile_display_color ; Back to normal profile color. | 1290 rcall profile_display_color ; Back to normal profile color. |
1260 return ;(The two bytes indicating the manual gas change will be ignored in the standard "ignore loop" above...) | 1291 return ;(The two bytes indicating the manual gas change will be ignored in the standard "ignore loop" above...) |
1292 | |
1293 logbook_event2: ; Bailout | |
1294 bsf is_bailout ; Set flag | |
1295 movff average_depth_hold_total+3,total_divetime_seconds+0 ; Backup last gas color in case we return to CCR | |
1296 movlw 6 ; Use Gas6 color | |
1297 movwf average_depth_hold_total+3 | |
1298 rcall profile_display_color ; Back to normal profile color. | |
1299 return ;(The two bytes indicating the bailout gas selected will be ignored in the standard "ignore loop" above...) | |
1300 | |
1301 logbook_event3: ; Setpoint change | |
1302 btfss is_bailout ; Are we in bailout? | |
1303 return ; No, return | |
1304 ; We were in bailout before, restore profile color | |
1305 movff total_divetime_seconds+0,average_depth_hold_total+3 ; Restore color | |
1306 rcall profile_display_color ; Back to normal profile color. | |
1307 return | |
1261 | 1308 |
1262 exit_profileview: | 1309 exit_profileview: |
1263 call speed_fastest | 1310 call speed_fastest |
1264 bcf sleepmode | 1311 bcf sleepmode |
1265 clrf timeout_counter2 ; restore all registers to build same page again | 1312 clrf timeout_counter2 ; restore all registers to build same page again |
1541 WIN_TINY log2_salinity_column,log2_salinity_row | 1588 WIN_TINY log2_salinity_column,log2_salinity_row |
1542 STRCPY_TEXT tDvSalinity | 1589 STRCPY_TEXT tDvSalinity |
1543 bsf leftbind | 1590 bsf leftbind |
1544 call ext_flash_byte_read_plus ; read salinity | 1591 call ext_flash_byte_read_plus ; read salinity |
1545 movff temp1,lo | 1592 movff temp1,lo |
1593 movff temp1,total_divetime_seconds+1 ; backup for average depth display | |
1546 output_8 | 1594 output_8 |
1547 STRCAT_PRINT "%" | 1595 STRCAT_PRINT "%" |
1548 | 1596 |
1549 ; CNS | 1597 ; CNS |
1550 LOG_POINT_TO log_cns_start | 1598 LOG_POINT_TO log_cns_start |
1569 STRCPY_TEXT tAVR | 1617 STRCPY_TEXT tAVR |
1570 call ext_flash_byte_read_plus ; read avr low | 1618 call ext_flash_byte_read_plus ; read avr low |
1571 movff temp1,lo | 1619 movff temp1,lo |
1572 call ext_flash_byte_read_plus ; read avr high | 1620 call ext_flash_byte_read_plus ; read avr high |
1573 movff temp1,hi | 1621 movff temp1,hi |
1622 | |
1623 movf total_divetime_seconds+1,W ; salinity for this dive | |
1624 call adjust_depth_with_salinity_log ; computes salinity setting (FROM WREG!) into lo:hi [mbar] | |
1625 | |
1574 output_16dp .3 | 1626 output_16dp .3 |
1575 STRCAT_PRINT "m" | 1627 STRCAT_PRINT "m" |
1576 | 1628 |
1577 ; Deco model | 1629 ; Deco model |
1578 LOG_POINT_TO log_decomodel | 1630 LOG_POINT_TO log_decomodel |