Don't increment the counter when a button is pressed

This commit is contained in:
George Oikonomou 2013-12-05 18:03:48 +00:00
parent 17b2150081
commit 394aeb722d

View file

@ -119,9 +119,10 @@ PROCESS_THREAD(cc2538_demo_process, ev, data)
counter = 0; counter = 0;
broadcast_open(&bc, BROADCAST_CHANNEL, &bc_rx); broadcast_open(&bc, BROADCAST_CHANNEL, &bc_rx);
while(1) {
etimer_set(&et, CLOCK_SECOND); etimer_set(&et, CLOCK_SECOND);
while(1) {
PROCESS_YIELD(); PROCESS_YIELD();
if(ev == PROCESS_EVENT_TIMER) { if(ev == PROCESS_EVENT_TIMER) {
@ -131,6 +132,7 @@ PROCESS_THREAD(cc2538_demo_process, ev, data)
etimer_set(&et, CLOCK_SECOND); etimer_set(&et, CLOCK_SECOND);
rtimer_set(&rt, RTIMER_NOW() + LEDS_OFF_HYSTERISIS, 1, rtimer_set(&rt, RTIMER_NOW() + LEDS_OFF_HYSTERISIS, 1,
rt_callback, NULL); rt_callback, NULL);
counter++;
} else if(ev == sensors_event) { } else if(ev == sensors_event) {
if(data == &button_select_sensor) { if(data == &button_select_sensor) {
packetbuf_copyfrom(&counter, sizeof(counter)); packetbuf_copyfrom(&counter, sizeof(counter));
@ -147,7 +149,6 @@ PROCESS_THREAD(cc2538_demo_process, ev, data)
} else if(ev == serial_line_event_message) { } else if(ev == serial_line_event_message) {
leds_toggle(LEDS_SERIAL_IN); leds_toggle(LEDS_SERIAL_IN);
} }
counter++;
} }
PROCESS_END(); PROCESS_END();