forked from solene/obsdfreqd
obsdfreqd: reduce temperature polling frequency
This commit is contained in:
parent
4c92e41641
commit
1537362ac3
12
main.c
12
main.c
|
@ -130,6 +130,8 @@ int main(int argc, char *argv[]) {
|
||||||
float temp;
|
float temp;
|
||||||
size_t len, len_cpu;
|
size_t len, len_cpu;
|
||||||
|
|
||||||
|
int temp_check = 0;
|
||||||
|
|
||||||
// battery defaults
|
// battery defaults
|
||||||
hard_min_freq = batt_min= 0;
|
hard_min_freq = batt_min= 0;
|
||||||
hard_max_freq = batt_max= 100;
|
hard_max_freq = batt_max= 100;
|
||||||
|
@ -246,9 +248,15 @@ int main(int argc, char *argv[]) {
|
||||||
switch_wall();
|
switch_wall();
|
||||||
}
|
}
|
||||||
|
|
||||||
// manage temperature
|
/* manage temperature */
|
||||||
if(temp_max > 0) {
|
if(temp_max > 0) {
|
||||||
temp = get_temp();
|
|
||||||
|
/* temp sensor is updated every 5 seconds
|
||||||
|
* wait every 5 seconds to update it */
|
||||||
|
if(temp_check++ > 5000/timefreq/5) {
|
||||||
|
temp_check = 0;
|
||||||
|
temp = get_temp();
|
||||||
|
}
|
||||||
if(temp > temp_max) {
|
if(temp > temp_max) {
|
||||||
if(max > hard_min_freq)
|
if(max > hard_min_freq)
|
||||||
max--;
|
max--;
|
||||||
|
|
Loading…
Reference in New Issue