Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1702 | - | 1 | /******* STARTUP PANEL *******/ |
2 | |||
3 | void startPanels(){ |
||
4 | osd.clear(); |
||
5 | panLogo(10,5); |
||
6 | } |
||
7 | |||
8 | /******* PANELS - POSITION *******/ |
||
9 | |||
10 | void writePanels(){ |
||
11 | //osd.clear(); |
||
12 | int offset = 2; |
||
13 | #ifdef isPAL |
||
14 | offset = 0; |
||
15 | #endif |
||
16 | //Top = no offset in NTSC |
||
17 | panHome(2,1); //1x2 |
||
18 | panBattery(22,1); //7x1 |
||
19 | //Bottom = need offset in NTSC |
||
20 | panCenter(13,8-offset); //4x2 |
||
21 | panGPS(2,12-offset); //12x3 |
||
22 | panCompass(16,12-offset); //13x3 |
||
23 | //osd.control(1); |
||
24 | } |
||
25 | |||
26 | /******* PANELS - DEFINITION *******/ |
||
27 | |||
28 | //------------------ Panel: Home --------------------------------------------------- |
||
29 | |||
30 | void panHome(int first_col, int first_line){ |
||
31 | osd.setPanel(first_col, first_line); |
||
32 | osd.openPanel(); |
||
33 | osd.printf("%c%5.0f%c|%c%5.0f%c|%c%5.0f%c",0x1f,hom_dis,0x8d,0x85,alt,0x8d,0x86,vel,0x88); |
||
34 | osd.closePanel(); |
||
35 | } |
||
36 | |||
37 | //------------------ Panel: Center ------------------------------------------------- |
||
38 | |||
39 | void panCenter(int first_col, int first_line){ |
||
40 | osd.setPanel(first_col, first_line); |
||
41 | osd.openPanel(); |
||
42 | osd.printf("%c%c%c%c|%c%c%c%c",0x05,0x03,0x04,0x05,0x15,0x13,0x14,0x15); |
||
43 | osd.closePanel(); |
||
44 | } |
||
45 | |||
46 | //------------------ Panel: Battery ------------------------------------------------ |
||
47 | |||
48 | void panBattery(int first_col, int first_line){ |
||
49 | char buf_bat[6] = {0xb4,0xb5,0xb6,0xb7,0xb8,0xb9}; //dead, critic, 25%, 50%, 75%, 100% |
||
50 | float critic = bat_cel * 3.0; |
||
51 | float full = bat_cel * 3.7; |
||
52 | float level = round((bat_val - critic) * (5 - 0) / (full - critic) + 0); |
||
53 | level = constrain(level, 0, 5); |
||
54 | if(bat_val < 0) bat_val = 0; |
||
55 | osd.setPanel(first_col, first_line); |
||
56 | osd.openPanel(); |
||
57 | osd.printf("%4.1f%c%c", bat_val, 0x76, buf_bat[(int)level]); |
||
58 | osd.closePanel(); |
||
59 | } |
||
60 | |||
61 | //------------------ Panel: Startup ArduCam OSD LOGO ------------------------------- |
||
62 | |||
63 | void panLogo(int first_col, int first_line){ |
||
64 | char buf_logo[][12] = { //11 Null terminated |
||
65 | {0x20,0x20,0x20,0x20,0xba,0xbb,0xbc,0xbd,0xbe}, |
||
66 | {0x20,0x20,0x20,0x20,0xca,0xcb,0xcc,0xcd,0xce}, |
||
67 | {"ArduCam OSD"} |
||
68 | }; |
||
69 | osd.setPanel(first_col, first_line); |
||
70 | osd.openPanel(); |
||
71 | osd.printf("%s|%s|%s", buf_logo[0], buf_logo[1], buf_logo[2]); |
||
72 | osd.closePanel(); |
||
73 | } |
||
74 | |||
75 | //------------------ Panel: GPS --------------------------------------------------- |
||
76 | |||
77 | void panGPS(int first_col, int first_line){ |
||
78 | char buf_lock[3] = {0x10,0x11}; |
||
79 | osd.setPanel(first_col, first_line); |
||
80 | osd.openPanel(); |
||
81 | switch (gps_lock){ |
||
82 | case 0: |
||
83 | osd.printf("%c%c%2.0f %c|%c%s|%c%s", 0x0f, 0xe3,(float)num_sat, buf_lock[0], 0x83, " ---- ", 0x84, " ---- "); |
||
84 | break; |
||
85 | case 1: |
||
86 | osd.printf("%c%c%2.0f %c|%c%11.6f|%c%11.6f", 0x0f, 0xe3,(float)num_sat, buf_lock[1], 0x83, lat, 0x84, lon); |
||
87 | break; |
||
88 | } |
||
89 | osd.closePanel(); |
||
90 | } |
||
91 | |||
92 | //------------------ Panel: Compass ----------------------------------------------- |
||
93 | |||
94 | void panCompass(int first_col, int first_line){ |
||
95 | char buf_Rule[36] = {0xc2,0xc0,0xc0,0xc1,0xc0,0xc0,0xc1,0xc0,0xc0, |
||
96 | 0xc4,0xc0,0xc0,0xc1,0xc0,0xc0,0xc1,0xc0,0xc0, |
||
97 | 0xc3,0xc0,0xc0,0xc1,0xc0,0xc0,0xc1,0xc0,0xc0, |
||
98 | 0xc5,0xc0,0xc0,0xc1,0xc0,0xc0,0xc1,0xc0,0xc0}; |
||
99 | char buf_mark[14] = {0x20,0xc0,0xc0,0xc0,0xc0,0xc0,0xc7,0xc0,0xc0,0xc0,0xc0,0xc0,0x20,'\0'}; |
||
100 | char buf_show[12]; |
||
101 | buf_show[11] = '\0'; |
||
102 | int start; |
||
103 | start = round((head * 18)/180); |
||
104 | start -= 5; |
||
105 | if(start < 0) start += 36; |
||
106 | for(int x=0; x <= 10; x++){ |
||
107 | buf_show[x] = buf_Rule[start]; |
||
108 | if(++start > 35) start = 0; |
||
109 | } |
||
110 | osd.setPanel(first_col, first_line); |
||
111 | osd.openPanel(); |
||
112 | osd.printf(" %c%c%4.0f%c|%s|%c%s%c", 0xc8, 0xc9, head, 0xb0, buf_mark, 0xd0, buf_show, 0xd1); |
||
113 | osd.closePanel(); |
||
114 | } |