Limit number of sensor events to avoid overflowing event queue
This commit is contained in:
parent
0e8cdd9e8e
commit
96c771250c
1 changed files with 20 additions and 12 deletions
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* @(#)$Id: sensors.c,v 1.1 2006/06/17 22:41:18 adamdunkels Exp $
|
* @(#)$Id: sensors.c,v 1.2 2006/10/06 09:18:52 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
/* exeperimental code, will be renamed to sensors.c when done */
|
/* exeperimental code, will be renamed to sensors.c when done */
|
||||||
|
|
||||||
|
@ -159,7 +159,8 @@ sensors_unselect(const struct sensors_sensor *s, const struct process *p)
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
PROCESS_THREAD(sensors_process, ev, data)
|
PROCESS_THREAD(sensors_process, ev, data)
|
||||||
{
|
{
|
||||||
int i;
|
static int i;
|
||||||
|
static int events;
|
||||||
|
|
||||||
PROCESS_BEGIN();
|
PROCESS_BEGIN();
|
||||||
|
|
||||||
|
@ -176,17 +177,24 @@ PROCESS_THREAD(sensors_process, ev, data)
|
||||||
while(1) {
|
while(1) {
|
||||||
|
|
||||||
PROCESS_WAIT_EVENT();
|
PROCESS_WAIT_EVENT();
|
||||||
|
|
||||||
for(i = 0; i < num_sensors; ++i) {
|
do {
|
||||||
if(sensors_flags[i] & FLAG_CHANGED) {
|
events = 0;
|
||||||
if(sensors_selecting_proc[i] == SELCOLL
|
for(i = 0; i < num_sensors; ++i) {
|
||||||
|| sensors_selecting_proc[i] == NULL)
|
if(sensors_flags[i] & FLAG_CHANGED) {
|
||||||
process_post(PROCESS_BROADCAST, sensors_event, sensors[i]);
|
/* if(sensors_selecting_proc[i] == SELCOLL
|
||||||
else
|
|| sensors_selecting_proc[i] == NULL)
|
||||||
process_post(sensors_selecting_proc[i], sensors_event, sensors[i]);
|
process_post(PROCESS_BROADCAST, sensors_event, sensors[i]);
|
||||||
sensors_flags[i] &= ~FLAG_CHANGED;
|
else
|
||||||
|
process_post(sensors_selecting_proc[i], sensors_event, sensors[i]);*/
|
||||||
|
if(process_post(PROCESS_BROADCAST, sensors_event, sensors[i]) == PROCESS_ERR_OK) {
|
||||||
|
PROCESS_WAIT_EVENT_UNTIL(ev == sensors_event);
|
||||||
|
}
|
||||||
|
sensors_flags[i] &= ~FLAG_CHANGED;
|
||||||
|
events++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
} while(events);
|
||||||
}
|
}
|
||||||
|
|
||||||
PROCESS_END();
|
PROCESS_END();
|
||||||
|
|
Loading…
Reference in a new issue