source: titan/titan/possetup.h @ 15288

Last change on this file since 15288 was 14185, checked in by nit, 12 years ago

[titan] revert rotor changes

File size: 5.2 KB
Line 
1#ifndef POSSETUP_H
2#define POSSETUP_H
3
4void possearch(struct skin* possetup, struct dvbdev* dvbnode, int dir)
5{
6        int rcret = 0;
7        uint16_t snr = 0;
8
9        while(1)
10        {
11                rcret = waitrc(possetup, 500, 0);
12                if(rcret == getrcconfigint("rcok", NULL))
13                {
14                        fediseqcrotor(dvbnode, NULL, 0, 0);
15                        break;
16                }
17
18                if(dir == 0)
19                        fediseqcrotor(dvbnode, NULL, 1, 10);
20                else
21                        fediseqcrotor(dvbnode, NULL, 1, 9);
22
23                usleep(300000);
24                drawscreen(possetup, 0);
25                snr = fereadsnr(status.aktservice->fedev);
26                snr = (snr * 100) / 0xffff;
27                if(snr > 50) break;
28        }
29}
30
31void poschangebutton(int type, struct skin* b1, struct skin* b2, struct skin* b3, struct skin* b4)
32{
33        if(type == 0)
34        {
35                changetext(b1, _("move west"));
36                changetext(b2, _("search west"));
37                changetext(b3, _("search east"));
38                changetext(b4, _("move east"));
39        }
40        else if(type == 1)
41        {
42                changetext(b1, NULL);
43                changetext(b2, _("step west"));
44                changetext(b3, _("step east"));
45                changetext(b4, NULL);
46        }
47        else if(type == 2)
48        {
49                changetext(b1, _("limits off"));
50                changetext(b2, _("limit west"));
51                changetext(b3, _("limit east"));
52                changetext(b4, _("limits on"));
53        }
54        else if(type == 3)
55        {
56                changetext(b1, NULL);
57                changetext(b2, _("store position"));
58                changetext(b3, _("goto position"));
59                changetext(b4, NULL);
60        }
61        else if(type == 4)
62        {
63                changetext(b1, _("startposition"));
64                changetext(b2, NULL);
65                changetext(b3, NULL);
66                changetext(b4, NULL);
67        }
68        else
69        {
70                changetext(b1, NULL);
71                changetext(b2, NULL);
72                changetext(b3, NULL);
73                changetext(b4, NULL);
74        }
75}
76
77void screenpossetup()
78{
79        int rcret = 0, i = 0;
80        struct skin* possetup = getscreen("possetup");
81        struct skin* listbox = getscreennode(possetup, "listbox");
82        //struct skin* move = getscreennode(possetup, "move");
83        //struct skin* finemove = getscreennode(possetup, "finemove");
84        //struct skin* limit = getscreennode(possetup, "limit");
85        struct skin* storagepos = getscreennode(possetup, "storagepos");
86        //struct skin* goto0 = getscreennode(possetup, "goto0");
87        struct skin* b1 = getscreennode(possetup, "b1");
88        struct skin* b2 = getscreennode(possetup, "b2");
89        struct skin* b3 = getscreennode(possetup, "b3");
90        struct skin* b4 = getscreennode(possetup, "b4");
91        struct skin* tmp = NULL;
92        char* tmpnr = NULL;
93        //TODO: select tuner
94        struct dvbdev* dvbnode = status.aktservice->fedev;
95
96        listbox->aktline = 1;
97        listbox->aktpage = -1;
98
99        for(i = 1; i < 255; i++)
100        {
101                tmpnr = oitoa(i);
102                addchoicebox(storagepos, tmpnr, tmpnr);
103                free(tmpnr); tmpnr = NULL;
104        }
105
106        poschangebutton(0, b1, b2, b3, b4);
107
108        drawscreen(possetup, 0);
109        addscreenrc(possetup, listbox);
110
111        tmp = listbox->select;
112        while(1)
113        {
114                if(rcret != RCTIMEOUT) addscreenrc(possetup, tmp);
115                rcret = waitrc(possetup, 1000, 0);
116                if(rcret == RCTIMEOUT)
117                {
118                        drawscreen(possetup, 0);
119                        continue;
120                }
121                tmp = listbox->select;
122
123                if(listbox->select != NULL)
124                {
125                        if(ostrcmp(listbox->select->name, "move") == 0)
126                                poschangebutton(0, b1, b2, b3, b4);
127                        if(ostrcmp(listbox->select->name, "finemove") == 0)
128                                poschangebutton(1, b1, b2, b3, b4);
129                        if(ostrcmp(listbox->select->name, "limit") == 0)
130                                poschangebutton(2, b1, b2, b3, b4);
131                        if(ostrcmp(listbox->select->name, "storagepos") == 0)
132                                poschangebutton(3, b1, b2, b3, b4);
133                        if(ostrcmp(listbox->select->name, "goto0") == 0)
134                                poschangebutton(4, b1, b2, b3, b4);
135                }
136
137                if(rcret == getrcconfigint("rcexit", NULL))
138                {
139                        fediseqcrotor(dvbnode, NULL, 0, 0);
140                        break;
141                }
142                if(rcret == getrcconfigint("rcok", NULL))
143                        fediseqcrotor(dvbnode, NULL, 0, 0);
144                if(listbox->select != NULL)
145                {
146                        if(rcret == getrcconfigint("rcred", NULL))
147                        {
148                                if(ostrcmp(listbox->select->name, "move") == 0)
149                                        fediseqcrotor(dvbnode, NULL, 0, 6);
150                                if(ostrcmp(listbox->select->name, "limit") == 0)
151                                        fediseqcrotor(dvbnode, NULL, 0, 1);
152                                if(ostrcmp(listbox->select->name, "goto0") == 0)
153                                        fediseqcrotor(dvbnode, NULL, 0, 8);
154                        }
155                        if(rcret == getrcconfigint("rcgreen", NULL))
156                        {
157                                if(ostrcmp(listbox->select->name, "move") == 0)
158                                        possearch(possetup, dvbnode, 0);
159                                if(ostrcmp(listbox->select->name, "finemove") == 0)
160                                        fediseqcrotor(dvbnode, NULL, 1, 10);
161                                if(ostrcmp(listbox->select->name, "limit") == 0)
162                                        fediseqcrotor(dvbnode, NULL, 0, 4);
163                                if(ostrcmp(listbox->select->name, "storagepos") == 0)
164                                {
165                                        if(listbox->select->ret != NULL)
166                                        {
167                                                int pos = atoi(listbox->select->ret);
168                                                fediseqcrotor(dvbnode, NULL, pos, 7);
169                                        }
170                                }
171                        }
172                        if(rcret == getrcconfigint("rcyellow", NULL))
173                        {
174                                if(ostrcmp(listbox->select->name, "move") == 0)
175                                        possearch(possetup, dvbnode, 1);
176                                if(ostrcmp(listbox->select->name, "finemove") == 0)
177                                        fediseqcrotor(dvbnode, NULL, 1, 9);
178                                if(ostrcmp(listbox->select->name, "limit") == 0)
179                                        fediseqcrotor(dvbnode, NULL, 0, 3);
180                                if(ostrcmp(listbox->select->name, "storagepos") == 0)
181                                {
182                                        if(listbox->select->ret != NULL)
183                                        {
184                                                int pos = atoi(listbox->select->ret);
185                                                fediseqcrotor(dvbnode, NULL, pos, 8);
186                                        }
187                                }
188                        }
189                        if(rcret == getrcconfigint("rcblue", NULL))
190                        {
191                                if(ostrcmp(listbox->select->name, "move") == 0)
192                                        fediseqcrotor(dvbnode, NULL, 0, 5);
193                                if(ostrcmp(listbox->select->name, "limit") == 0)
194                                        fediseqcrotor(dvbnode, NULL, 0, 2);
195                        }
196                }
197
198                drawscreen(possetup, 0);
199        }
200
201        delownerrc(possetup);
202        clearscreen(possetup);
203}
204
205#endif
Note: See TracBrowser for help on using the repository browser.