Mercurial > public > hwos_code
comparison src/compass_ops.asm @ 370:67e631aa5b8c
debugging the compass screen
author | heinrichsweikamp |
---|---|
date | Tue, 18 Aug 2015 22:02:55 +0200 |
parents | 508d7fb98b34 |
children | fec5eec4c8b7 |
comparison
equal
deleted
inserted
replaced
369:ca32cf2435c6 | 370:67e631aa5b8c |
---|---|
849 cpfsgt lo,1 | 849 cpfsgt lo,1 |
850 bra TFT_dive_compass_ruler_loop_zz | 850 bra TFT_dive_compass_ruler_loop_zz |
851 rcall TFT_dive_compass_clr_ruler | 851 rcall TFT_dive_compass_clr_ruler |
852 TFT_dive_compass_ruler_loop_zz: | 852 TFT_dive_compass_ruler_loop_zz: |
853 ; 3. Draw the markers @ RM | 853 ; 3. Draw the markers @ RM |
854 rcall TFT_dive_compass_ruler_print | 854 ; we receive RM in lo and DD in hi |
855 movlw dm_custom_compass_tick_top_top | |
856 movff WREG,win_top | |
857 movlw dm_custom_compass_tick_height | |
858 movff WREG,win_height | |
859 movlw d'2' | |
860 movff WREG,win_width | |
861 movff WREG,win_bargraph | |
862 movff lo,win_leftx2 ; 0..159 | |
863 call TFT_standard_color | |
864 ; call TFT_box | |
865 movlw dm_custom_compass_tick_bot_top | |
866 movff WREG,win_top | |
867 movlw dm_custom_compass_tick_height | |
868 movff WREG,win_height | |
869 call TFT_standard_color ; color in WREG is trashed, must be set again! | |
870 ; call TFT_box | |
855 ; 4. If D<82 and RM>79: means we put something over the center line | 871 ; 4. If D<82 and RM>79: means we put something over the center line |
856 ; redraw the center line | 872 ; redraw the center line |
857 movlw d'82' | 873 movlw d'82' |
858 cpfslt hi,1 | 874 cpfslt hi,1 |
859 bra TFT_dive_compass_ruler_loop_zz2 | 875 bra TFT_dive_compass_ruler_loop_zz2 |
860 movlw d'79' | 876 movlw d'79' |
861 cpfsgt lo,1 | 877 cpfsgt lo,1 |
862 bra TFT_dive_compass_ruler_loop_zz2 | 878 bra TFT_dive_compass_ruler_loop_zz2 |
863 rcall TFT_dive_compass_cline ;enough to print cline as bearing marker is not in the ticker area | 879 ;enough to print cline as bearing marker is not in the ticker area |
880 movlw color_yellow | |
881 WIN_BOX_COLOR dm_custom_compass_tick_top_top, dm_custom_compass_tick_bot_bot,.80,.81 ; center line in yellow | |
864 TFT_dive_compass_ruler_loop_zz2: | 882 TFT_dive_compass_ruler_loop_zz2: |
865 ; 5. set D = RM + 2 : position after the 2px tick | 883 ; 5. set D = RM + 2 : position after the 2px tick |
866 movff lo,hi | 884 movff lo,hi |
867 movlw d'2' | 885 movlw d'2' |
868 addwf hi,1 | 886 addwf hi,1 |
876 ; 8. clear the rest of the tick area if D<160 | 894 ; 8. clear the rest of the tick area if D<160 |
877 movlw d'160' | 895 movlw d'160' |
878 cpfslt hi,1 | 896 cpfslt hi,1 |
879 bra TFT_dive_compass_ruler_lend2 ; D >= W | 897 bra TFT_dive_compass_ruler_lend2 ; D >= W |
880 ; 9. position left to end of display to clear the remaining area | 898 ; 9. position left to end of display to clear the remaining area |
881 movlw d'160' | 899 movlw d'159' |
882 movwf lo | 900 movwf lo |
883 ; 10. clear it | 901 ; 10. clear it |
884 rcall TFT_dive_compass_clr_ruler | 902 rcall TFT_dive_compass_clr_ruler |
885 | 903 |
886 TFT_dive_compass_ruler_lend2: | 904 TFT_dive_compass_ruler_lend2: |
1056 rcall TFT_dive_compass_c_mk ; check if label is on the center line or the marker | 1074 rcall TFT_dive_compass_c_mk ; check if label is on the center line or the marker |
1057 ; restore lo and hi for the final cleanup | 1075 ; restore lo and hi for the final cleanup |
1058 movff xLO,lo | 1076 movff xLO,lo |
1059 movff xHI,hi | 1077 movff xHI,hi |
1060 ; clear the rest of the SQ area if there are more space | 1078 ; clear the rest of the SQ area if there are more space |
1061 movlw d'160' | 1079 movlw d'159' |
1062 cpfslt hi | 1080 cpfslt hi |
1063 bra TFT_dive_compass_label_end2 ; D >= 160, no more space | 1081 bra TFT_dive_compass_label_end2 ; D >= 160, no more space |
1064 ; position left to end of display to clear the remaining area | 1082 ; position left to end of display to clear the remaining area |
1065 movlw d'160' | 1083 movlw d'158' |
1066 movff WREG,lo | 1084 movwf lo |
1067 ; clear it | 1085 ; clear it |
1068 rcall TFT_dive_compass_clr_label | 1086 rcall TFT_dive_compass_clr_label |
1069 TFT_dive_compass_label_end2: | 1087 TFT_dive_compass_label_end2: |
1070 rcall TFT_dive_compass_c_mk ; check if label is on the center line or the marker | 1088 rcall TFT_dive_compass_c_mk ; check if label is on the center line or the marker |
1071 ; do we have bearing set? | 1089 ; do we have bearing set? |
1138 movff sub_c+0,xC+0 | 1156 movff sub_c+0,xC+0 |
1139 movff sub_c+1,xC+1 | 1157 movff sub_c+1,xC+1 |
1140 | 1158 |
1141 ; 1/b. check if it's viewable ? sub_a(RP)+up(width) < sub_b(RD)+160 | 1159 ; 1/b. check if it's viewable ? sub_a(RP)+up(width) < sub_b(RD)+160 |
1142 ; if already above, no need to process the rest of the labels | 1160 ; if already above, no need to process the rest of the labels |
1143 ;movff up,WREG ; don't worry about the width, low level call prevents overload | 1161 movff up,WREG ; don't worry about the width, low level call prevents overload |
1144 movlw d'2' ; .. but still avoid thin mess on the side of the display | 1162 ; movlw d'2' ; .. but still avoid thin mess on the side of the display |
1145 addwf sub_a+0,1 | 1163 addwf sub_a+0,1 |
1146 btfsc STATUS, C | 1164 btfsc STATUS, C |
1147 incf sub_a+1 | 1165 incf sub_a+1 |
1148 | 1166 |
1149 movff xRDr+0,sub_b+0 | 1167 movff xRDr+0,sub_b+0 |
1156 movff xC+0,lo | 1174 movff xC+0,lo |
1157 | 1175 |
1158 ; 3. Clear the segment from DD(hi) to lo | 1176 ; 3. Clear the segment from DD(hi) to lo |
1159 ; don't do a clear if we are at 0 (zero) otherwise it will blink | 1177 ; don't do a clear if we are at 0 (zero) otherwise it will blink |
1160 ; ?because of the width underflow? | 1178 ; ?because of the width underflow? |
1161 movlw d'0' | 1179 movlw d'1' |
1162 cpfsgt lo | 1180 cpfsgt lo |
1163 bra TFT_dive_compass_label_proc_p | 1181 bra TFT_dive_compass_label_proc_p |
1164 rcall TFT_dive_compass_clr_label | 1182 rcall TFT_dive_compass_clr_label |
1165 TFT_dive_compass_label_proc_p: | 1183 TFT_dive_compass_label_proc_p: |
1166 ; 4. print the SQ on the screen | 1184 ; 4. print the SQ on the screen |
1183 | 1201 |
1184 TFT_dive_compass_c_mk: | 1202 TFT_dive_compass_c_mk: |
1185 ; Common task to draw center line and marker | 1203 ; Common task to draw center line and marker |
1186 ; until a proper implementation make it simple: | 1204 ; until a proper implementation make it simple: |
1187 rcall TFT_dive_compass_mk | 1205 rcall TFT_dive_compass_mk |
1188 rcall TFT_dive_compass_cline | 1206 movlw color_yellow |
1207 WIN_BOX_COLOR dm_custom_compass_tick_top_top, dm_custom_compass_tick_bot_bot,.80,.81 ; center line in yellow | |
1189 return | 1208 return |
1190 | 1209 |
1191 TFT_dive_compass_mk: | 1210 TFT_dive_compass_mk: |
1192 ; draw the bearing on the screen if visible and if we just put something over it | 1211 ; draw the bearing on the screen if visible and if we just put something over it |
1193 btfss compass_bearing_set | 1212 btfss compass_bearing_set |
1277 call TFT_set_color | 1296 call TFT_set_color |
1278 call TFT_box | 1297 call TFT_box |
1279 return | 1298 return |
1280 | 1299 |
1281 TFT_dive_compass_clr_label: | 1300 TFT_dive_compass_clr_label: |
1301 return | |
1282 movlw dm_custom_compass_label_row-.2 ; set top & height | 1302 movlw dm_custom_compass_label_row-.2 ; set top & height |
1283 movff WREG,win_top | 1303 movff WREG,win_top |
1284 movlw dm_custom_compass_label_height+.2 | 1304 movlw dm_custom_compass_label_height+.2 |
1285 movff WREG,win_height | 1305 movff WREG,win_height |
1286 rcall TFT_dive_compass_clear | 1306 rcall TFT_dive_compass_clear |
1287 return | 1307 return |
1288 | 1308 |
1289 TFT_dive_compass_clr_ruler: | 1309 TFT_dive_compass_clr_ruler: |
1310 return | |
1290 ; top tick | 1311 ; top tick |
1291 movlw dm_custom_compass_tick_top_top ; set top & height | 1312 movlw dm_custom_compass_tick_top_top ; set top & height |
1292 movff WREG,win_top | 1313 movff WREG,win_top |
1293 movlw dm_custom_compass_tick_height | 1314 movlw dm_custom_compass_tick_height |
1294 movff WREG,win_height | 1315 movff WREG,win_height |
1303 TFT_dive_compass_clear: | 1324 TFT_dive_compass_clear: |
1304 ; we receive RM in lo and DD in hi | 1325 ; we receive RM in lo and DD in hi |
1305 ; calculate width = RM-D | 1326 ; calculate width = RM-D |
1306 movff hi,WREG | 1327 movff hi,WREG |
1307 subwf lo,0 | 1328 subwf lo,0 |
1308 movff WREG,win_width ; RM-DD | 1329 bz TFT_dive_compass_clear3 ; Do nothing if there is nothing to do |
1330 movff WREG,win_width ; RM-DD | |
1309 movff WREG,win_bargraph | 1331 movff WREG,win_bargraph |
1310 ; incf hi,W ; +1 pixel to avopid clipping of chars | 1332 banksel win_width |
1311 ; movff WREG,win_leftx2 | 1333 movlw .1 |
1334 cpfsgt win_width | |
1335 bra TFT_dive_compass_clear3 ; Do not clear a single pixel (or less) | |
1336 banksel common | |
1312 movff hi,win_leftx2 | 1337 movff hi,win_leftx2 |
1338 ;TFT_dive_compass_clear1: | |
1339 ; movff win_leftx2,tft_temp1 ; Copy | |
1340 ; ; check right border | |
1341 ; movff win_width,WREG | |
1342 ; addwf tft_temp1,F | |
1343 ; movlw .159 | |
1344 ; cpfsgt tft_temp1 ; >159? | |
1345 ; bra TFT_dive_compass_clear2 ; no | |
1346 ; banksel win_width | |
1347 ; decf win_width,F ; -1 | |
1348 ; banksel common | |
1349 ; bra TFT_dive_compass_clear1 | |
1350 ;TFT_dive_compass_clear2: | |
1313 movlw color_black | 1351 movlw color_black |
1314 call TFT_set_color | 1352 call TFT_set_color |
1315 call TFT_box | 1353 call TFT_box |
1316 return | 1354 TFT_dive_compass_clear3: |
1317 | 1355 banksel common |
1318 TFT_dive_compass_ruler_print: | |
1319 ; we receive RM in lo and DD in hi | |
1320 movlw dm_custom_compass_tick_top_top | |
1321 movff WREG,win_top | |
1322 movlw dm_custom_compass_tick_height | |
1323 movff WREG,win_height | |
1324 movlw d'2' | |
1325 movff WREG,win_width | |
1326 movff WREG,win_bargraph | |
1327 movff lo,win_leftx2 ; 0..159 | |
1328 call TFT_standard_color | |
1329 call TFT_box | |
1330 movlw dm_custom_compass_tick_bot_top | |
1331 movff WREG,win_top | |
1332 movlw dm_custom_compass_tick_height | |
1333 movff WREG,win_height | |
1334 call TFT_standard_color ; color in WREG is trashed, must be set again! | |
1335 call TFT_box | |
1336 return | |
1337 | |
1338 TFT_dive_compass_cline: | |
1339 movlw color_yellow | |
1340 WIN_BOX_COLOR dm_custom_compass_tick_top_top, dm_custom_compass_tick_bot_bot,.80,.81 | |
1341 return | 1356 return |
1342 | 1357 |
1343 tft_compass_cardinal: | 1358 tft_compass_cardinal: |
1344 btfsc hi,0 ; Heading >255°? | 1359 btfsc hi,0 ; Heading >255°? |
1345 bra tft_compass_cardinal2 ; Yes must be W, NW or N | 1360 bra tft_compass_cardinal2 ; Yes must be W, NW or N |