comparison src/compass_ops.asm @ 432:929feb0da4f5

hunting a bug in the logbook (Day 2)
author heinrichsweikamp
date Wed, 22 Jun 2016 12:36:15 +0200
parents 4b93354b7738
children d36f9fca10ae
comparison
equal deleted inserted replaced
431:9500b2d3e32b 432:929feb0da4f5
464 bra TFT_surface_compass_heading_com3 464 bra TFT_surface_compass_heading_com3
465 465
466 TFT_surface_compass_heading_com2: 466 TFT_surface_compass_heading_com2:
467 banksel compass_heading_shown 467 banksel compass_heading_shown
468 movlw d'1' 468 movlw d'1'
469 subwf compass_heading_shown+0,F 469 subwf compass_heading_shown+0,F
470 movlw d'0' 470 movlw d'0'
471 subwfb compass_heading_shown+1,F ; -1 471 subwfb compass_heading_shown+1,F ; -1
472 472
473 TFT_surface_compass_heading_com3: 473 TFT_surface_compass_heading_com3:
474 banksel common 474 banksel common
475 movff compass_heading_shown+0,lo 475 movff compass_heading_shown+0,lo
476 movff compass_heading_shown+1,hi 476 movff compass_heading_shown+1,hi
868 rcall TFT_dive_compass_clr_ruler 868 rcall TFT_dive_compass_clr_ruler
869 TFT_dive_compass_ruler_loop_zz: 869 TFT_dive_compass_ruler_loop_zz:
870 ; 3. Draw the markers @ RM 870 ; 3. Draw the markers @ RM
871 ; we receive RM in lo and DD in hi 871 ; we receive RM in lo and DD in hi
872 movlw dm_custom_compass_tick_top_top 872 movlw dm_custom_compass_tick_top_top
873 movff WREG,win_top 873 movwf win_top
874 movlw dm_custom_compass_tick_height 874 movlw dm_custom_compass_tick_height
875 movff WREG,win_height 875 movwf win_height
876 movlw d'2' 876 movlw d'2'
877 movff WREG,win_width 877 movwf win_width+0
878 movff WREG,win_bargraph 878 clrf win_width+1
879 movwf win_bargraph
879 movff lo,win_leftx2 ; 0..159 880 movff lo,win_leftx2 ; 0..159
880 call TFT_standard_color 881 call TFT_standard_color
881 call TFT_box 882 call TFT_box
882 movlw dm_custom_compass_tick_bot_top 883 movlw dm_custom_compass_tick_bot_top
883 movff WREG,win_top 884 movwf win_top
884 movlw dm_custom_compass_tick_height 885 movlw dm_custom_compass_tick_height
885 movff WREG,win_height 886 movwf win_height
886 call TFT_standard_color ; color in WREG is trashed, must be set again! 887 call TFT_standard_color ; color in WREG is trashed, must be set again!
887 call TFT_box 888 call TFT_box
888 ; 4. If D<82 and RM>79: means we put something over the center line 889 ; 4. If D<82 and RM>79: means we put something over the center line
889 ; redraw the center line 890 ; redraw the center line
890 movlw d'82' 891 movlw d'82'
1250 movlw d'2' 1251 movlw d'2'
1251 addwf lo,0 1252 addwf lo,0
1252 ; rcall TFT_dive_compass_mk_print_3 1253 ; rcall TFT_dive_compass_mk_print_3
1253 ; return 1254 ; return
1254 TFT_dive_compass_mk_print_3: 1255 TFT_dive_compass_mk_print_3:
1255 movff WREG,win_leftx2 1256 movwf win_leftx2
1256 movlw dm_custom_compass_label_row 1257 movlw dm_custom_compass_label_row
1257 movff WREG,win_top 1258 movwf win_top
1258 movlw dm_custom_compass_label_height-.2 1259 movlw dm_custom_compass_label_height-.2
1259 movff WREG,win_height 1260 movwf win_height
1260 bra TFT_dive_compass_mk_print_4 1261 bra TFT_dive_compass_mk_print_4
1261 TFT_dive_compass_mk_print_dot: 1262 TFT_dive_compass_mk_print_dot:
1262 movff WREG,win_leftx2 1263 movwf win_leftx2
1263 movlw dm_custom_compass_label_row + .9 1264 movlw dm_custom_compass_label_row + .9
1264 movff WREG,win_top 1265 movwf win_top
1265 movlw d'4' 1266 movlw d'4'
1266 movff WREG,win_height 1267 movwf win_height
1267 TFT_dive_compass_mk_print_4: 1268 TFT_dive_compass_mk_print_4:
1268 banksel win_leftx2
1269 movlw .158 1269 movlw .158
1270 cpfslt win_leftx2 1270 cpfslt win_leftx2
1271 bra TFT_dive_compass_mk_print_5 1271 bra TFT_dive_compass_mk_print_5
1272 movlw d'2' 1272 movlw d'2'
1273 movwf win_width 1273 movwf win_width+0
1274 clrf win_width+1
1274 movwf win_bargraph 1275 movwf win_bargraph
1275 banksel common
1276 movlw color_green 1276 movlw color_green
1277 btfss print_compass_label 1277 btfss print_compass_label
1278 movlw color_red 1278 movlw color_red
1279 call TFT_set_color 1279 call TFT_set_color
1280 call TFT_box 1280 call TFT_box
1308 ; we receive RM in lo and DD in hi 1308 ; we receive RM in lo and DD in hi
1309 ; calculate width = RM-D 1309 ; calculate width = RM-D
1310 movff hi,WREG 1310 movff hi,WREG
1311 subwf lo,W 1311 subwf lo,W
1312 bz TFT_dive_compass_clear3 ; Do nothing if there is nothing to do 1312 bz TFT_dive_compass_clear3 ; Do nothing if there is nothing to do
1313 movff WREG,win_width ; RM-DD 1313 movwf win_width+0 ; RM-DD
1314 movff WREG,win_bargraph 1314 movwf win_bargraph
1315 banksel win_width 1315 clrf win_width+1
1316 movlw .1 1316 movlw .1
1317 cpfsgt win_width 1317 cpfsgt win_width+0
1318 bra TFT_dive_compass_clear3 ; Do not clear a single pixel (or less) 1318 bra TFT_dive_compass_clear3 ; Do not clear a single pixel (or less)
1319 banksel common
1320 movff hi,win_leftx2 1319 movff hi,win_leftx2
1321 ;TFT_dive_compass_clear1:
1322 ; movff win_leftx2,tft_temp1 ; Copy
1323 ; ; check right border
1324 ; movff win_width,WREG
1325 ; addwf tft_temp1,F
1326 ; movlw .159
1327 ; cpfsgt tft_temp1 ; >159?
1328 ; bra TFT_dive_compass_clear2 ; no
1329 ; banksel win_width
1330 ; decf win_width,F ; -1
1331 ; banksel common
1332 ; bra TFT_dive_compass_clear1
1333 ;TFT_dive_compass_clear2:
1334 movlw color_black 1320 movlw color_black
1335 call TFT_set_color 1321 call TFT_set_color
1336 call TFT_box 1322 call TFT_box
1337 TFT_dive_compass_clear3: 1323 TFT_dive_compass_clear3:
1338 banksel common
1339 return 1324 return
1340 1325
1341 tft_compass_cardinal: 1326 tft_compass_cardinal:
1342 btfsc hi,0 ; Heading >255°? 1327 btfsc hi,0 ; Heading >255°?
1343 bra tft_compass_cardinal2 ; Yes must be W, NW or N 1328 bra tft_compass_cardinal2 ; Yes must be W, NW or N