mirror of
https://github.com/oliverschmidt/contiki.git
synced 2024-10-09 04:54:56 +00:00
Prevent calculations if tick is zero
This commit is contained in:
parent
aacbcd904f
commit
0cb80b0605
@ -123,6 +123,7 @@ PROCESS_THREAD(weather_meter_int_process, ev, data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(ev == PROCESS_EVENT_TIMER) {
|
if(ev == PROCESS_EVENT_TIMER) {
|
||||||
|
if(weather_sensors.anemometer.ticks) {
|
||||||
|
|
||||||
/* Disable to make the calculations in an interrupt-safe context */
|
/* Disable to make the calculations in an interrupt-safe context */
|
||||||
GPIO_DISABLE_INTERRUPT(ANEMOMETER_SENSOR_PORT_BASE,
|
GPIO_DISABLE_INTERRUPT(ANEMOMETER_SENSOR_PORT_BASE,
|
||||||
@ -147,6 +148,7 @@ PROCESS_THREAD(weather_meter_int_process, ev, data)
|
|||||||
etimer_restart(&et);
|
etimer_restart(&et);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
PROCESS_END();
|
PROCESS_END();
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
@ -236,6 +238,8 @@ configure(int type, int value)
|
|||||||
weather_sensors.rain_gauge.int_en = 0;
|
weather_sensors.rain_gauge.int_en = 0;
|
||||||
weather_sensors.anemometer.ticks = 0;
|
weather_sensors.anemometer.ticks = 0;
|
||||||
weather_sensors.rain_gauge.ticks = 0;
|
weather_sensors.rain_gauge.ticks = 0;
|
||||||
|
weather_sensors.anemometer.value = 0;
|
||||||
|
weather_sensors.rain_gauge.value = 0;
|
||||||
|
|
||||||
if(!value) {
|
if(!value) {
|
||||||
anemometer_int_callback = NULL;
|
anemometer_int_callback = NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user