Subversion Repositories FlightCtrl

Rev

Rev 1919 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1917 holgerb 1
#include "libfc.h"
2
#include "printf_P.h"
3
#include "main.h"
4
#include "spi.h"
5
#include "capacity.h"
6
 
7
#define HoTT_printfxy(x,y,format, args...)  { LIBFC_HoTT_SetPos(y * 21 + x); _printf_P(&LIBFC_HoTT_Putchar, PSTR(format) , ## args);}
8
#define HoTT_printf(format, args...)        {  _printf_P(&LIBFC_HoTT_Putchar, PSTR(format) , ## args);}
9
 
10
#define HoTT_printfxy_INV(x,y,format, args...)  { LIBFC_HoTT_SetPos(y * 21 + x); _printf_P(&LIBFC_HoTT_Putchar_INV, PSTR(format) , ## args);}
11
#define HoTT_printf_INV(format, args...)        {  _printf_P(&LIBFC_HoTT_Putchar_INV, PSTR(format) , ## args);}
12
 
13
 
14
void Hott_ClearLine(unsigned char line)
15
{
16
 HoTT_printfxy(0,line,"                     ");
17
}
18
 
19
void HoTT_Menu(void)
20
{
21
 static unsigned char what;
22
 switch(what++)
23
  {
24
        case 0:  HoTT_printfxy(0,0,"%2i.%1iV   ",UBat/10, UBat%10);
25
                        HoTT_printfxy(8,0,"%4imAh %2i:%02i",Capacity.UsedCapacity,FlugSekunden/60,FlugSekunden%60);
26
                        break;
27
        case 1:  
28
                        HoTT_printfxy(0,1,"Dir:%3d%c",(int)(ErsatzKompass / GIER_GRAD_FAKTOR), 0x60);
29
                        if(Parameter_GlobalConfig & CFG_HOEHENREGELUNG)
30
                                HoTT_printfxy_INV(10,1,"Alt:%4im %c", (int16_t)(HoehenWert/100),VarioCharacter)
31
            else HoTT_printfxy(10,1,"Alt: ----    ", (int16_t)(HoehenWert/100),VarioCharacter);
32
            break;
33
        case 2:
34
                        HoTT_printfxy(0,2,"I=%3i.%1iA %4iW ",Capacity.ActualCurrent/10, Capacity.ActualCurrent%10,Capacity.ActualPower);
35
                        break;
36
        case 3:
37
                        if(NaviDataOkay)
38
                        {
39
                          HoTT_printfxy(0,3,"Home:%3dm %3d%c", GPSInfo.HomeDistance/10, GPSInfo.HomeBearing, 0x60);
40
            }
41
                        else
42
                        {
43
                         Hott_ClearLine(3);
44
                        }
45
                        break;
46
        case 4:  
47
                        if(NaviDataOkay)
48
                        {
49
                                HoTT_printfxy(0,4,"GPS:%2um/s Sat:%d ",GPSInfo.Speed,GPSInfo.NumOfSats);
50
                                switch (GPSInfo.SatFix)
51
                                {
52
                                        case SATFIX_3D:
53
                                                HoTT_printfxy(16,4,"  3D ");
54
                                                break;
55
 
56
                                        case SATFIX_2D:
57
                                        case SATFIX_NONE:
58
                                        default:
59
                                                HoTT_printfxy(16,4,"NoFix");
60
                                                break;
61
                                }      
62
                                if(GPSInfo.Flags & FLAG_DIFFSOLN)
63
                                {
64
                                        HoTT_printfxy(16,4,"DGPS ");
65
                                }
66
                        }
67
                        else
68
                        {                    //012345678901234567890
69
                                HoTT_printfxy(0,4,"No NaviCtrl!         ");
70
                        }
71
                        break;
72
        case 5:
73
                        HoTT_printfxy(0,5,"%3i %3i %3i %3i%cC ", Motor[0].Temperature, Motor[1].Temperature, Motor[2].Temperature, Motor[3].Temperature,0x60);
74
                        break;
75
        case 6:
76
                    if(RequiredMotors == 4) Hott_ClearLine(6);
77
                                else
78
                                if(RequiredMotors == 6)  HoTT_printfxy(0,6,"%3i %3i%cC         ", Motor[4].Temperature, Motor[5].Temperature,0x60)
79
                                else
80
                                if(RequiredMotors > 6)   HoTT_printfxy(0,6,"%3i %3i %3i %3i%cC ", Motor[4].Temperature, Motor[5].Temperature, Motor[6].Temperature, Motor[7].Temperature,0x6D);
81
//HoTT_printfxy(0,6,"%2x:%c %2x:%c %c",Poti3,Poti3,Poti3+1,Poti3+1, 'A'+128);
82
                        break;
83
        case 7: if(NC_ErrorCode) HoTT_printfxy(0,7,"ERROR: %2d ",NC_ErrorCode)
84
                        else HoTT_printfxy(0,7," www.MikroKopter.de ");
85
                        break;
86
        case 8:
87
        case 9:
88
        case 10:
89
        case 11:
90
        case 12:
91
        case 13:
92
        case 14:
93
        case 15:
94
        case 16:  break;
95
 
96
/*
97
012345678901234567890
98
+++++++++++++++++++++
99
13,8V 1234mAh 12:30    0
100
Dir:180° Alt: 123m +   1
101
GPS: 10Sat DGPS PH CF  2
102
Home: 280° 123m        3
103
I=23A P=123W Max=123   4
104
BL1-4: 11 22 33 44°C   5
105
BL5-8: 55 66 77 88°C   6
106
No Error               7
107
+++++++++++++++++++++
108
*/
109
   default:  what = 0;
110
                        break;
111
  }
112
}
113
 
114
 
115
 
116
 
117