1 | #ifndef STANDBY_H |
---|
2 | #define STANDBY_H |
---|
3 | |
---|
4 | void screenstandby() |
---|
5 | { |
---|
6 | int rcret = 0, voltoff = 1; |
---|
7 | struct skin* standbyscreen = getscreen("standby"); |
---|
8 | char* loctime = NULL, *tmpstr = NULL; |
---|
9 | time_t lastrun = 0; |
---|
10 | struct dvbdev* dvbnode = dvbdev; |
---|
11 | |
---|
12 | rcret = servicestop(status.aktservice, 1, 0); |
---|
13 | if(rcret == 1) |
---|
14 | { |
---|
15 | status.standby = 0; |
---|
16 | return; |
---|
17 | } |
---|
18 | |
---|
19 | //check if all tuner unlocked, if yes set all volt off |
---|
20 | if(getconfigint("standbytuneroff", NULL) == 1) |
---|
21 | { |
---|
22 | while(dvbnode != NULL) |
---|
23 | { |
---|
24 | if(dvbnode->type == FRONTENDDEV && dvbnode->feinfo->type == FE_QPSK && dvbnode->felock > 0) |
---|
25 | voltoff = 0; |
---|
26 | dvbnode = dvbnode->next; |
---|
27 | } |
---|
28 | if(voltoff == 1) |
---|
29 | { |
---|
30 | dvbnode = dvbdev; |
---|
31 | while(dvbnode != NULL) |
---|
32 | { |
---|
33 | if(dvbnode->type == FRONTENDDEV && dvbnode->feinfo->type == FE_QPSK && dvbnode->felock == 0) |
---|
34 | fesetvoltage(dvbnode, SEC_VOLTAGE_OFF, 15); |
---|
35 | dvbnode = dvbnode->next; |
---|
36 | } |
---|
37 | } |
---|
38 | } |
---|
39 | else |
---|
40 | voltoff = 0; |
---|
41 | |
---|
42 | subtitlepause(1); |
---|
43 | // clearfb(skinfb); |
---|
44 | // blitfb(0); |
---|
45 | setfbtransparent(0); |
---|
46 | setvfdbrightness(getconfigint("vfdstandbybrightness", NULL)); |
---|
47 | setoverclockfreq(0); |
---|
48 | |
---|
49 | if(checkbox("ATEVIO7000") == 1) |
---|
50 | { |
---|
51 | if(getconfig("at7000frontsleep", NULL) != NULL) |
---|
52 | tmpstr = ostrcat("fp_control -P ",getconfig("at7000frontsleep", NULL), 0, 0); |
---|
53 | else |
---|
54 | tmpstr = ostrcat("fp_control -P ", "0", 0, 0); |
---|
55 | system(tmpstr); |
---|
56 | free(tmpstr); tmpstr=NULL; |
---|
57 | } |
---|
58 | if(checkbox("UFS922") == 1 || checkbox("ATEMIO-NEMESIS") == 1) |
---|
59 | setfanspeed(-2, 0); |
---|
60 | |
---|
61 | status.protecttime = 0; |
---|
62 | status.rcstandby = standbyscreen; |
---|
63 | |
---|
64 | setcecstandby(1); |
---|
65 | system("vdstandby -a"); |
---|
66 | while(1) |
---|
67 | { |
---|
68 | rcret = waitrc(standbyscreen, 10000, 0); |
---|
69 | |
---|
70 | if(rcret == getrcconfigint("rcpower", NULL)) break; |
---|
71 | |
---|
72 | //check for epg update |
---|
73 | loctime = gettime(NULL, "%H:%M"); |
---|
74 | if(lastrun + 300 < time(NULL) && ostrcmp(loctime, getconfig("epg_refreshtime", NULL)) == 0) |
---|
75 | { |
---|
76 | voltoff = 1; //is not a real voltoff, but after standby this makes a new channel tuning |
---|
77 | //start epg scanlist |
---|
78 | lastrun = time(NULL); |
---|
79 | if(status.epgscanlistthread == NULL) |
---|
80 | status.epgscanlistthread = addtimer(&epgscanlistthread, START, 1000, 1, NULL, NULL, NULL); |
---|
81 | } |
---|
82 | free(loctime); loctime = 0; |
---|
83 | } |
---|
84 | |
---|
85 | if(status.epgscanlistthread != NULL) |
---|
86 | { |
---|
87 | int i = 0; |
---|
88 | status.epgscanlistthread->aktion = STOP; |
---|
89 | while(status.epgscanlistthread != NULL) |
---|
90 | { |
---|
91 | usleep(100000); |
---|
92 | i++; if(i > 50) break; |
---|
93 | } |
---|
94 | } |
---|
95 | if(checkbox("UFS922") == 1 || checkbox("ATEMIO-NEMESIS") == 1) |
---|
96 | setfanspeed(-1, 0); |
---|
97 | |
---|
98 | setcecstandby(0); |
---|
99 | system("vdstandby -d"); |
---|
100 | |
---|
101 | setoverclockfreq(1); |
---|
102 | setosdtransparent(getskinconfigint("osdtransparent", NULL)); |
---|
103 | setvfdbrightness(getconfigint("vfdbrightness", NULL)); |
---|
104 | |
---|
105 | if(checkbox("ATEVIO7000") == 1) |
---|
106 | { |
---|
107 | if(getconfig("at7000frontrun", NULL) != NULL) |
---|
108 | tmpstr = ostrcat("fp_control -P ",getconfig("at7000frontrun", NULL), 0, 0); |
---|
109 | else |
---|
110 | tmpstr = ostrcat("fp_control -P ", "15", 0, 0); |
---|
111 | system(tmpstr); |
---|
112 | free(tmpstr); tmpstr=NULL; |
---|
113 | } |
---|
114 | |
---|
115 | //set waittime for unicable new |
---|
116 | status.firstunicablewait = 0; |
---|
117 | status.standby = 0; |
---|
118 | status.startmode = 1; |
---|
119 | status.rcstandby = NULL; |
---|
120 | |
---|
121 | if(status.aktservice->channel != NULL) |
---|
122 | { |
---|
123 | tmpstr = ostrcat(status.aktservice->channellist, NULL, 0, 0); |
---|
124 | if(voltoff == 1) |
---|
125 | servicecheckret(servicestart(status.aktservice->channel, tmpstr, NULL, 5), 0); |
---|
126 | else |
---|
127 | servicecheckret(servicestart(status.aktservice->channel, tmpstr, NULL, 3), 0); |
---|
128 | } |
---|
129 | else |
---|
130 | { |
---|
131 | tmpstr = ostrcat(status.lastservice->channellist, NULL, 0, 0); |
---|
132 | if(voltoff == 1) |
---|
133 | servicecheckret(servicestart(status.lastservice->channel, tmpstr, NULL, 4), 0); |
---|
134 | else |
---|
135 | servicecheckret(servicestart(status.lastservice->channel, tmpstr, NULL, 0), 0); |
---|
136 | } |
---|
137 | free(tmpstr); tmpstr = NULL; |
---|
138 | |
---|
139 | subtitlepause(0); |
---|
140 | } |
---|
141 | |
---|
142 | #endif |
---|