1 | #ifndef FANCONTROL_H |
---|
2 | #define FANCONTROL_H |
---|
3 | |
---|
4 | int getspeedWert(char* speedWert) |
---|
5 | { |
---|
6 | int speed = 0; |
---|
7 | |
---|
8 | if (speedWert != NULL) |
---|
9 | { |
---|
10 | if(ostrcmp(speedWert, "115") == 0) |
---|
11 | speed = 0; |
---|
12 | else if(ostrcmp(speedWert, "130") == 0) |
---|
13 | speed = 25; |
---|
14 | else if(ostrcmp(speedWert, "145") == 0) |
---|
15 | speed = 50; |
---|
16 | else if(ostrcmp(speedWert, "155") == 0) |
---|
17 | speed = 75; |
---|
18 | else if(ostrcmp(speedWert, "170") == 0) |
---|
19 | speed = 100; |
---|
20 | } |
---|
21 | else |
---|
22 | speed = 100; |
---|
23 | return speed; |
---|
24 | } |
---|
25 | |
---|
26 | void screensettings_fancontrol() |
---|
27 | { |
---|
28 | int rcret = 0; |
---|
29 | int speed = 0; |
---|
30 | int type = 0; |
---|
31 | char* speedWert = NULL; |
---|
32 | |
---|
33 | struct skin* fancontrol = getscreen("settings_fancontrol"); |
---|
34 | struct skin* fanprogress = getscreennode(fancontrol, "fanprogress"); |
---|
35 | struct skin* titletext = getscreennode(fancontrol, "titletext"); |
---|
36 | struct skin* b3 = getscreennode(fancontrol, "b3"); |
---|
37 | |
---|
38 | speedWert = getconfig("fanspeed", NULL); |
---|
39 | speed = getspeedWert(speedWert); |
---|
40 | |
---|
41 | type = 1; //speed normal |
---|
42 | changetext(titletext, "FanControl-normal"); |
---|
43 | fanprogress->progresssize = speed; |
---|
44 | drawscreen(fancontrol, 0, 0); |
---|
45 | |
---|
46 | while(1) |
---|
47 | { |
---|
48 | rcret = waitrc(fancontrol, 0, 0); |
---|
49 | |
---|
50 | if(rcret == getrcconfigint("rcexit", NULL)) |
---|
51 | { |
---|
52 | setfanspeed(-1, 0); |
---|
53 | break; |
---|
54 | } |
---|
55 | if(rcret == getrcconfigint("rcok", NULL)) |
---|
56 | { |
---|
57 | setfanspeed(speed, type); |
---|
58 | break; |
---|
59 | } |
---|
60 | if(rcret == getrcconfigint("rcred", NULL)){ |
---|
61 | if(type == 1) |
---|
62 | { |
---|
63 | type = 2; |
---|
64 | changetext(titletext, _("FanControl-standby")); |
---|
65 | changetext(b3, _("normal")); |
---|
66 | speed = getspeedWert(getconfig("fanspeedstandby", NULL)); |
---|
67 | } |
---|
68 | else |
---|
69 | { |
---|
70 | type = 1; |
---|
71 | changetext(titletext, _("FanControl-normal")); |
---|
72 | changetext(b3, _("standby")); |
---|
73 | speed = getspeedWert(getconfig("fanspeed", NULL)); |
---|
74 | } |
---|
75 | fanprogress->progresssize = speed; |
---|
76 | drawscreen(fancontrol, 0, 0); |
---|
77 | } |
---|
78 | if(rcret == getrcconfigint("rcleft", NULL)) |
---|
79 | { |
---|
80 | if(speed > 0) |
---|
81 | speed = speed - 25; |
---|
82 | fanprogress->progresssize = speed; |
---|
83 | setfanspeed(speed, 0); |
---|
84 | drawscreen(fancontrol, 0, 0); |
---|
85 | } |
---|
86 | if(rcret == getrcconfigint("rcright", NULL)) |
---|
87 | { |
---|
88 | if(speed < 100) |
---|
89 | speed = speed + 25; |
---|
90 | fanprogress->progresssize = speed; |
---|
91 | setfanspeed(speed, 0); |
---|
92 | drawscreen(fancontrol, 0, 0); |
---|
93 | } |
---|
94 | } |
---|
95 | clearscreen(fancontrol); |
---|
96 | } |
---|
97 | |
---|
98 | #ifdef MIPSEL |
---|
99 | void screensettings_fancontrol2() |
---|
100 | { |
---|
101 | int rcret = 0; |
---|
102 | |
---|
103 | struct skin* tmp = NULL; |
---|
104 | struct skin* fancontrol = getscreen("settings_fancontrol2"); |
---|
105 | struct skin* fanon = getscreennode(fancontrol, "fanon"); |
---|
106 | struct skin* listbox = getscreennode(fancontrol, "listbox"); |
---|
107 | |
---|
108 | addchoicebox(fanon, "3", _("auto")); |
---|
109 | addchoicebox(fanon, "2", _("on")); |
---|
110 | addchoicebox(fanon, "1", _("off")); |
---|
111 | setchoiceboxselection(fanon, getconfig("fanmode", NULL)); |
---|
112 | |
---|
113 | addscreenrc(fancontrol, listbox); |
---|
114 | tmp = listbox->select; |
---|
115 | drawscreen(fancontrol, 0, 0); |
---|
116 | |
---|
117 | while(1) |
---|
118 | { |
---|
119 | addscreenrc(fancontrol, tmp); |
---|
120 | rcret = waitrc(fancontrol, 0, 0); |
---|
121 | tmp = listbox->select; |
---|
122 | |
---|
123 | if(rcret == getrcconfigint("rcexit", NULL)) |
---|
124 | { |
---|
125 | break; |
---|
126 | } |
---|
127 | if(rcret == getrcconfigint("rcok", NULL)) |
---|
128 | { |
---|
129 | addconfig("fanmode", fanon->ret); |
---|
130 | break; |
---|
131 | } |
---|
132 | if((rcret == getrcconfigint("rcleft", NULL) || rcret == getrcconfigint("rcright", NULL)) && listbox->select != NULL && ostrcmp(listbox->select->name, "fanon") == 0) |
---|
133 | writesys("/proc/stb/fp/fan", fanon->ret, 1); |
---|
134 | } |
---|
135 | writesys("/proc/stb/fp/fan", getconfig("fanmode", NULL), 1); |
---|
136 | clearscreen(fancontrol); |
---|
137 | } |
---|
138 | #endif |
---|
139 | |
---|
140 | #endif |
---|