comparison src/tft_outputs.asm @ 249:94bf757690cf

ignore sensor for non-sensor hardware
author heinrichsweikamp
date Tue, 17 Mar 2015 12:16:15 +0100
parents afe73e1a0181
children 20e3bad0b0f2
comparison
equal deleted inserted replaced
248:afe73e1a0181 249:94bf757690cf
1122 call TFT_standard_color 1122 call TFT_standard_color
1123 return 1123 return
1124 1124
1125 global TFT_surface_sensor ; Update Sensor data in surface mode 1125 global TFT_surface_sensor ; Update Sensor data in surface mode
1126 TFT_surface_sensor: 1126 TFT_surface_sensor:
1127 movf hardware_flag,W
1128 sublw 0x11 ; 2 with BLE
1129 btfsc STATUS,Z
1130 return ; Ignore for 0x11
1131
1127 ; show three sensors 1132 ; show three sensors
1128 bsf leftbind 1133 bsf leftbind
1129 WIN_SMALL surf_hud_sensor1_column,surf_hud_sensor1_row 1134 WIN_SMALL surf_hud_sensor1_column,surf_hud_sensor1_row
1130 btfsc use_O2_sensor1 ; Use Sensor 1? 1135 btfsc use_O2_sensor1 ; Use Sensor 1?
1131 bra TFT_surface_sensor1 ; Yes 1136 bra TFT_surface_sensor1 ; Yes
1422 STRCPY_TEXT_PRINT tHeading ; Heading: 1427 STRCPY_TEXT_PRINT tHeading ; Heading:
1423 return 1428 return
1424 1429
1425 global TFT_dive_compass_mask 1430 global TFT_dive_compass_mask
1426 TFT_dive_compass_mask: 1431 TFT_dive_compass_mask:
1427 WIN_BOX_STD dive_compass_graph_row-.3,dive_compass_graph_row,(dive_compass_graph_left+dive_compass_graph_right)/.2-.2,(dive_compass_graph_left+dive_compass_graph_right)/.2+.2 1432 WIN_TINY dive_compass_mask_column,dive_compass_mask_row
1428 WIN_FRAME_STD dive_compass_graph_row, dive_compass_graph_row+dive_compass_graph_height,dive_compass_graph_left-.1,dive_compass_graph_right-.1 1433 call TFT_divemask_color
1429 return 1434 STRCPY_TEXT_PRINT tHeading ; Heading:
1430 1435 return
1431 ; WIN_TINY dive_compass_mask_column,dive_compass_mask_row
1432 ; call TFT_divemask_color
1433 ; STRCPY_TEXT_PRINT tHeading ; Heading:
1434 ; return
1435
1436 1436
1437 global TFT_surface_compass_heading 1437 global TFT_surface_compass_heading
1438 TFT_surface_compass_heading: 1438 TFT_surface_compass_heading:
1439 rcall compass_heading_common 1439 rcall compass_heading_common
1440 WIN_STD surf_compass_head_column,surf_compass_head_row 1440 WIN_STD surf_compass_head_column,surf_compass_head_row
1494 return 1494 return
1495 1495
1496 global TFT_dive_compass_heading 1496 global TFT_dive_compass_heading
1497 TFT_dive_compass_heading: 1497 TFT_dive_compass_heading:
1498 rcall compass_heading_common 1498 rcall compass_heading_common
1499
1500 ; Graphic output
1501 movff compass_heading_shown+0,lo
1502 movff compass_heading_shown+1,hi
1503 bcf STATUS,C
1504 rrcf hi,F
1505 rrcf lo,F ; /2 -> heading 0-179 in lo
1506
1507 ;; Debug
1508 ; WIN_TINY .0,.71
1509 ; output_8
1510 ; STRCAT_PRINT " "
1511 ;; Debug
1512
1513 ; With 60° shown, left border is heading-30° or lo - 15
1514 movlw .15
1515 subwf lo,W
1516 btfss STATUS,C ; <0?
1517 addlw .180 ; Yes, adjust value
1518 movwf lo ; lo has now left border of graphic in 0-179
1519
1520 ;; Debug
1521 ; WIN_TINY .0,.85
1522 ; output_8
1523 ; STRCAT_PRINT " "
1524 ;; Debug
1525
1526 ; Draw marks (left border of graphic is in lo)
1527 ; WIN_BOX_BLACK dive_compass_graph_row+.1,dive_compass_graph_row+dive_compass_graph_height-.1,dive_compass_graph_left,dive_compass_graph_right-.2
1528 ; WIN_FRAME_STD dive_compass_graph_row, dive_compass_graph_row+dive_compass_graph_height,dive_compass_graph_left-.1,dive_compass_graph_right-.1
1529 movlw dive_compass_graph_row+.1
1530 movff WREG,win_top
1531 movlw dive_compass_graph_height-.1
1532 movff WREG,win_height
1533
1534 ; lo is 0-179, draw first mark at full 10°
1535 incf lo,F ; +1
1536 setf hi ; =255
1537 TFT_compass_graph1:
1538 lfsr FSR2,buffer
1539 incf hi,F
1540 decf lo,F
1541 output_8
1542 movlw "0"
1543 movwf up ; Digit "0"
1544 movff buffer+2,WREG
1545 cpfseq up ; Last digit = 0?
1546 bra TFT_compass_graph1b ; No
1547 bra TFT_compass_graph1a ; Yes
1548 TFT_compass_graph1b:
1549 movlw "5"
1550 movwf up ; Digit "5"
1551 movff buffer+2,WREG
1552 cpfseq up ; Last digit = 5?
1553 bra TFT_compass_graph1 ; No
1554
1555 TFT_compass_graph1a:
1556 ; Yes setup PROD for the first mark
1557 movlw .5
1558 mulwf hi
1559 movlw dive_compass_graph_leftx2
1560 addwf PRODL,F
1561 movlw .0
1562 addwfc PRODH,F ; add left offset
1563
1564 movlw .11 ; amount of marks (-1)
1565 movwf up
1566 TFT_compass_graph2:
1567 movff PRODL,lo
1568 movff PRODH,hi ; Backup
1569 rcall TFT_compass_graph3 ; Write one mark
1570 movff lo,PRODL
1571 movff hi,PRODH ; Restore
1572 movlw .25 ; Spacing in pixels
1573 addwf PRODL,F
1574 movlw .0
1575 addwfc PRODH,F
1576 decfsz up,F
1577 bra TFT_compass_graph2
1578
1579 rcall TFT_compass_graph4 ; Write one mark without black space
1580
1581 ; Text output 1499 ; Text output
1582 WIN_STD dive_compass_head_column,dive_compass_head_row 1500 WIN_STD dive_compass_head_column,dive_compass_head_row
1583 call TFT_standard_color 1501 call TFT_standard_color
1584 rcall TFT_surface_compass_heading_com ; Show "000° N" 1502 rcall TFT_surface_compass_heading_com ; Show "000° N"
1585 1503 return ; No graphical output (yet)
1586 return ; Done.
1587
1588
1589 TFT_compass_graph3:
1590 rcall TFT_compass_graph4 ; Mark
1591 movff lo,PRODL
1592 movff hi,PRODH ; Restore
1593
1594 ; black space
1595 clrf WREG
1596 movff WREG,win_color1
1597 movff WREG,win_color2 ; Set to black
1598 movlw dive_compass_graph_width+.1
1599 addwf PRODL,F
1600 movlw .0
1601 addwfc PRODH,F
1602 movlw .20 ; Spacing in pixels
1603 movff WREG,win_width+0
1604 call TFT_box_write_16bit_win_left ; With column in PRODL:PRODH
1605 movf win_width,W
1606 bcf STATUS,C
1607 rlcf WREG
1608 movwf win_width+0
1609 movlw 0
1610 rlcf WREG
1611 movwf win_width+1
1612 call TFT_box_16bit_win_left ; Fill window
1613 return
1614
1615 TFT_compass_graph4:
1616 call TFT_divemask_color
1617 ;---- Define Window ------------------------------------------------------
1618 movlw dive_compass_graph_width
1619 movff WREG,win_width+0
1620 clrf win_width+1
1621 call TFT_box_write_16bit_win_left ; With column in PRODL:PRODH
1622 movf win_width,W
1623 bcf STATUS,C
1624 rlcf WREG
1625 movwf win_width+0
1626 movlw 0
1627 rlcf WREG
1628 movwf win_width+1
1629 call TFT_box_16bit_win_left ; Fill window
1630 return
1631
1632 1504
1633 tft_compass_cardinal: 1505 tft_compass_cardinal:
1634 btfsc hi,0 ; Heading >255°? 1506 btfsc hi,0 ; Heading >255°?
1635 bra tft_compass_cardinal2 ; Yes must be W, NW or N 1507 bra tft_compass_cardinal2 ; Yes must be W, NW or N
1636 ; No, Must be W, SW, S, SE, E, NE or N 1508 ; No, Must be W, SW, S, SE, E, NE or N