Subversion Repositories Projects

Rev

Rev 261 | Rev 264 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 261 Rev 262
Line 99... Line 99...
99
    /* Graph Vars */
99
    /* Graph Vars */
100
    public final static int GRAPH_COUNT=4;
100
    public final static int GRAPH_COUNT=4;
101
    public final static int[] graph_colors={0x156315,0xCC1315,0xf8ef02,0x19194d};
101
    public final static int[] graph_colors={0x156315,0xCC1315,0xf8ef02,0x19194d};
102
    public int[] graph_sources={0,1,2,3};
102
    public int[] graph_sources={0,1,2,3};
103
    public String[] graph_names={"nick int","roll int","nick acc","roll acc"};
103
    public String[] graph_names={"nick int","roll int","nick acc","roll acc"};
104
    public int[][] graph_data;
104
    //    public int[][] graph_data;
105
    public int graph_offset=0;
105
    //public int graph_offset=0;
Line 106... Line 106...
106
   
106
   
107
    //    public int lcd_char_width=0;
107
    //    public int lcd_char_width=0;
Line 108... Line 108...
108
    public int lcd_char_height=0;
108
    public int lcd_char_height=0;
Line 126... Line 126...
126
 
126
 
127
    // variable to hold the current state
127
    // variable to hold the current state
128
    public byte state=STATEID_INITIAL;
128
    public byte state=STATEID_INITIAL;
Line 129... Line 129...
129
    public byte nextstate=STATEID_INITIAL;
129
    public byte nextstate=STATEID_INITIAL;
Line 130... Line 130...
130
 
130
 
131
    int local_max=-1;
131
    //    int local_max=-1;
132
 
132
 
Line 241... Line 241...
241
 
241
 
242
 
242
 
Line 243... Line 243...
243
        if ( mk.ufo_prober.is_navi()||mk.ufo_prober.is_mk()  )
243
        if ( mk.ufo_prober.is_navi()||mk.ufo_prober.is_mk()  )
244
            tmp_menu_add(l(STRINGID_LCD),ACTIONID_LCD);
244
            tmp_menu_add(l(STRINGID_LCD),ACTIONID_LCD);
Line 245... Line 245...
245
 
245
 
246
        if ( mk.ufo_prober.is_mk()  )
246
        //      if ( mk.ufo_prober.is_mk()  )
Line 670... Line 670...
670
crit2.setSpeedAndCourseRequired(false);
670
crit2.setSpeedAndCourseRequired(false);
671
crit2.setAltitudeRequired(false);
671
crit2.setAltitudeRequired(false);
672
lp= LocationProvider.getInstance(crit2);
672
lp= LocationProvider.getInstance(crit2);
Line 673... Line 673...
673
 
673
 
-
 
674
                                */
674
                                */
675
 
675
                                if(c != null ) {
676
                                if(c != null ) {
676
                                    // Use coordinate information
677
                                    // Use coordinate information
677
                                    phone_lat= c.getLatitude();
678
                                    phone_lat= c.getLatitude();
678
                                    phone_long = c.getLongitude();
679
                                    phone_long = c.getLongitude();
Line 702... Line 703...
702
                                nextstate=STATEID_PARAM_MENU;
703
                                nextstate=STATEID_PARAM_MENU;
703
                                success_msg=l(STRINGID_PARAMRESETOK);
704
                                success_msg=l(STRINGID_PARAMRESETOK);
704
                                chg_state(STATEID_SUCCESS_MSG);
705
                                chg_state(STATEID_SUCCESS_MSG);
705
                            }
706
                            }
706
                        break;
707
                        break;
-
 
708
 
-
 
709
                        /*
707
                    case STATEID_GRAPH:
710
                    case STATEID_GRAPH:
-
 
711
 
-
 
712
                       
708
                        graph_offset--;
713
                        graph_offset--;
709
                        if (graph_offset==-graph_data[0].length)
714
                        if (graph_offset==-graph_data[0].length)
710
                            graph_offset=0;
715
                            graph_offset=0;
711
                        break;
716
                        break;
712
 
717
                        */
713
                    case STATEID_CAMMODE:
718
                    case STATEID_CAMMODE:
Line 714... Line 719...
714
                       
719
                       
715
                        try
720
                        try
716
                            {
721
                            {
Line 999... Line 1004...
999
            case SKINID_LIGHT:
1004
            case SKINID_LIGHT:
1000
                return FG_COLOR_SKIN_LIGHT;
1005
                return FG_COLOR_SKIN_LIGHT;
1001
            }
1006
            }
1002
    }
1007
    }
Line 1003... Line 1008...
1003
 
1008
 
1004
 
1009
    /*
1005
    public int check_local_max(int val)
1010
    public int check_local_max(int val)
1006
    {
1011
    {
1007
        if ( val>local_max)
1012
        if ( val>local_max)
1008
            local_max=val;
1013
            local_max=val;
1009
        else if (-val>local_max)
1014
        else if (-val>local_max)
1010
            local_max=-val;
1015
            local_max=-val;
1011
        return val;
1016
        return val;
1012
    }
1017
    }
Line 1013... Line 1018...
1013
 
1018
    */
1014
 
1019
 
Line 1645... Line 1650...
1645
                   
1650
                   
Line 1646... Line 1651...
1646
 
1651
 
1647
                case STATEID_GRAPH:
1652
                case STATEID_GRAPH:
1648
   
1653
   
1649
                    g.setClip(0,0,canvas_width,canvas_height);
1654
                    g.setClip(0,0,canvas_width,canvas_height);
1650
 
1655
                   
1651
                    g.setStrokeStyle(Graphics.DOTTED);  
1656
                    //            
1652
                    g.setColor(0xe1dddd);
1657
                    g.setColor(0xe1dddd);
-
 
1658
                    g.setFont(f2);
-
 
1659
                    // LEGEND
1653
                    g.setFont(f2);
1660
                    if (settings.graph_legend)
1654
                    // LEGEND
1661
                        {
-
 
1662
                              g.setStrokeStyle(Graphics.DOTTED);  
1655
                    if (settings.graph_legend)
1663
                              for (int d=0;d<GRAPH_COUNT;d++)
1656
                        for (int d=0;d<GRAPH_COUNT;d++)
1664
                                  {
1657
                            {/*
1665
                                     
1658
                               g.setColor(graph_colors[d]);            
1666
                                      //                               g.setColor(graph_colors[d]);             
1659
                               g.fillRect(0,y_off +spacer1/2-2 ,20,4);
1667
                                      //                               g.fillRect(0,y_off +spacer1/2-2 ,20,4);
1660
                               g.setColor(skin_fg_color());
1668
                                      //                               g.setColor(skin_fg_color());
1661
                               g.drawString(graph_names[d] + mk.debug_data.analog[graph_sources[d]],23,y_off,Graphics.TOP | Graphics.LEFT);
-
 
1662
                               y_off+=spacer1;
1669
                                      //                               g.drawString(graph_names[d] + mk.debug_data.analog[graph_sources[d]],23,y_off,Graphics.TOP | Graphics.LEFT);
1663
                               
1670
                                      //                               y_off+=spacer1; 
1664
                             */
1671
                                     
1665
                                g.setColor(graph_colors[d]);           
1672
                                      g.setColor(graph_colors[d]);             
1666
                                g.fillRect(canvas_width-20,canvas_height-spacer*(d+1)+(spacer)/2-2 ,20,4);
1673
                                      g.fillRect(canvas_width-20,canvas_height-spacer*(d+1)+(spacer)/2-2 ,20,4);
1667
                                g.setColor(skin_fg_color());
1674
                                      g.setColor(skin_fg_color());
1668
                                g.drawString(graph_names[d] /*+ mk.debug_data.analog[graph_sources[d]]*/,canvas_width-23,canvas_height-spacer*(d+1),Graphics.TOP | Graphics.RIGHT);
1675
                                      g.drawString(graph_names[d] ,canvas_width-23,canvas_height-spacer*(d+1),Graphics.TOP | Graphics.RIGHT);
-
 
1676
                                      //                            y_off+=spacer1; 
-
 
1677
                                     
-
 
1678
                                  }
Line 1669... Line 1679...
1669
                                //                          y_off+=spacer1; 
1679
 
1670
                               
1680
                              g.setStrokeStyle(Graphics.SOLID);  
Line 1671... Line 1681...
1671
                            }
1681
                        }
Line 1707... Line 1717...
1707
 
1717
 
1708
 
1718
 
Line 1709... Line -...
1709
                    for (int gr=0;gr<GRAPH_COUNT;gr++)
-
 
1710
                        {
1719
                    for (int gr=0;gr<GRAPH_COUNT;gr++)
1711
 
1720
                        {
Line 1712... Line 1721...
1712
 
1721
 
1713
                            // !!TODO checkme
-
 
1714
                            g.setColor(graph_colors[gr]);              
-
 
Line 1715... Line 1722...
1715
 
1722
                            // !!TODO checkme
Line 1716... Line 1723...
1716
                            graph_data[gr][-graph_offset]=check_local_max(mk.debug_data.analog[graph_sources[gr]]);
1723
                            g.setColor(graph_colors[gr]);              
1717
 
1724
 
1718
                           
1725
                            //                      check_local_max(mk.debug_data.analog[graph_sources[gr]]);
1719
                   
1726
                   
1720
                            line_scaler= local_max/graph_height+1;
1727
                            line_scaler= mk.debug_buff_max/graph_height+1;
1721
 
1728
 
Line 1722... Line 1729...
1722
 
1729
 
-
 
1730
                            for ( int x=0;x<canvas_width-1;x++)
1723
                            for ( int x=0;x<canvas_width;x++)
1731
                                {
-
 
1732
                                    /*int p= (((-graph_offset+x-canvas_width-5)));
-
 
1733
                                    if (p<1)
-
 
1734
                                        p+=graph_data[0].length;
-
 
1735
                                    p%=(graph_data[0].length-1);
-
 
1736
                                   
-
 
1737
                                    draw_graph_part(g,x,graph_data[gr][p]/line_scaler,graph_data[gr][p+1]/line_scaler);
-
 
1738
                                    */
-
 
1739
                                   
-
 
1740
                                       int p= (((mk.debug_buff_off+x-canvas_width)));
-
 
1741
                                    if (p<0)
-
 
1742
                                        p+=mk.debug_buff_len;
-
 
1743
                                    p%=(mk.debug_buff_len-2);
1724
                                {
1744
                                   
1725
                                    int p= (((-graph_offset+x-canvas_width-5)));
1745
 
Line -... Line 1746...
-
 
1746
                                     if (p<mk.debug_buff_lastset)
-
 
1747
 
-
 
1748
                                    draw_graph_part(g,x,mk.debug_buff[p][gr]/line_scaler,mk.debug_buff[p+1][gr]/line_scaler);
-
 
1749
 
-
 
1750
                                     //                             System.out.println("--p"+p + "gr " + gr + " l " + mk.debug_buff.length +" ls:" + mk.debug_buff_lastset );                               
-
 
1751
                                   
-
 
1752
                                }
-
 
1753
                        }
-
 
1754
 
Line 1726... Line 1755...
1726
                                    if (p<1)
1755
 
Line 1727... Line 1756...
1727
                                        p+=graph_data[0].length;
1756
                    /*
1728
                                    p%=(graph_data[0].length-1);
1757
                    int[] pixels=new int[canvas_width*canvas_height];
Line 1797... Line 1826...
1797
 
1826
 
Line 1798... Line 1827...
1798
                }
1827
                }
Line 1799... Line 1828...
1799
 
1828
 
1800
               
1829
               
1801
 
1830
 
1802
        } catch (Exception e) {}
1831
                } catch (Exception e) { System.out.println("error in paint " + e);}
Line 1817... Line 1846...
1817
        mk.connect_to(url,name);
1846
        mk.connect_to(url,name);
1818
    }
1847
    }
Line 1819... Line 1848...
1819
 
1848
 
1820
    public void draw_graph_part(Graphics g,int x,int y1,int y2)
1849
    public void draw_graph_part(Graphics g,int x,int y1,int y2)
-
 
1850
    {
-
 
1851
 
-
 
1852
        g.drawLine(x,line_middle_y-y1,x+1,line_middle_y-y2);
1821
    {
1853
        /*
1822
        if ( canvas_width>200)
1854
        if ( canvas_width>200)
1823
            {
1855
            {
1824
                g.fillRect(x,line_middle_y-y1,1,1 );
1856
                g.fillRect(x,line_middle_y-y1,1,1 );
1825
                if (y1>y2)
1857
                if (y1>y2)
1826
                    g.fillRect(x,line_middle_y-y1,1,y1-y2);
1858
                    g.fillRect(x,line_middle_y-y1,1,y1-y2);
1827
                else
1859
                else
Line 1828... Line 1860...
1828
                    g.fillRect(x,line_middle_y-y2,1,y2-y1);
1860
                g.fillRect(x,line_middle_y-y2,1,y2-y1);
1829
 
1861
 
1830
            }
1862
            }
1831
        else
1863
        else
Line 1835... Line 1867...
1835
                    g.fillRect(x,line_middle_y-y1,1,y1-y2);
1867
                    g.fillRect(x,line_middle_y-y1,1,y1-y2);
1836
                else
1868
                else
1837
                    g.fillRect(x,line_middle_y-y2,1,y2-y1);
1869
                    g.fillRect(x,line_middle_y-y2,1,y2-y1);
1838
            }
1870
            }
Line -... Line 1871...
-
 
1871
       
1839
       
1872
        */
Line 1840... Line 1873...
1840
    }
1873
    }
Line 1854... Line 1887...
1854
    public void chg_state(byte next_state)
1887
    public void chg_state(byte next_state)
1855
    {
1888
    {
1856
        settings_editor = null;
1889
        settings_editor = null;
1857
        params_editor = null;
1890
        params_editor = null;
1858
        err_img=null;
1891
        err_img=null;
1859
        graph_data=null;
1892
        //      graph_data=null;
1860
 
-
 
-
 
1893
        mk.destroy_debug_buff();
1861
        act_menu_select_bak[state]=act_menu_select;
1894
        act_menu_select_bak[state]=act_menu_select;
1862
        act_menu_select=act_menu_select_bak[next_state];
1895
        act_menu_select=act_menu_select_bak[next_state];
Line -... Line 1896...
-
 
1896
 
Line 1863... Line 1897...
1863
 
1897
       
1864
 
1898
 
1865
        /*
1899
        /*
1866
        // tasks on state exit
1900
        // tasks on state exit
Line 2087... Line 2121...
2087
                mk.user_intent=USER_INTENT_RAWDEBUG;
2121
                mk.user_intent=USER_INTENT_RAWDEBUG;
2088
                break;
2122
                break;
Line 2089... Line 2123...
2089
 
2123
 
-
 
2124
 
-
 
2125
            case STATEID_GRAPH:
-
 
2126
 
-
 
2127
 
-
 
2128
                mk.setup_debug_buff(graph_sources,this.getWidth(),settings.graph_interval);
-
 
2129
 
-
 
2130
                mk.user_intent=USER_INTENT_GRAPH;
-
 
2131
               
2090
 
2132
 
Line 2091... Line 2133...
2091
            case STATEID_GRAPH:
2133
                /*
2092
                graph_data=new int[GRAPH_COUNT][this.getWidth()*2];
2134
                graph_data=new int[GRAPH_COUNT][this.getWidth()*2];
2093
               
2135
               
-
 
2136
                for (int c=0;c<graph_data[0].length;c++)
Line 2094... Line 2137...
2094
                for (int c=0;c<graph_data[0].length;c++)
2137
                    for (int d=0;d<GRAPH_COUNT;d++)
2095
                    for (int d=0;d<GRAPH_COUNT;d++)
-
 
2096
                        graph_data[d][c]=-1;
2138
                        graph_data[d][c]=-1;
-
 
2139
               
2097
       
2140
       
Line 2098... Line 2141...
2098
       
2141
 
2099
                mk.user_intent=USER_INTENT_GRAPH;
2142
                local_max=1;