This commit is contained in:
Harald Pichler 2016-08-12 07:50:23 +02:00
commit 70172a9eb8
2 changed files with 10 additions and 1 deletions

View file

@ -124,6 +124,7 @@ PROCESS_THREAD(arduino_sketch, ev, data)
PROCESS_WAIT_EVENT();
#if PLATFORM_HAS_BUTTON
if(ev == sensors_event && data == &button_sensor) {
mcu_sleep_off();
PRINTF("*******BUTTON*******\n");
/* Call the event_handler for this application-specific event. */
@ -131,11 +132,14 @@ PROCESS_THREAD(arduino_sketch, ev, data)
/* Also call the separate response example handler. */
res_separate.resume();
mcu_sleep_on();
}
#endif /* PLATFORM_HAS_BUTTON */
if(etimer_expired(&loop_periodic_timer)) {
loop ();
mcu_sleep_off();
loop ();
mcu_sleep_on();
etimer_reset(&loop_periodic_timer);
}
}

View file

@ -36,10 +36,15 @@
#define PLATFORM_HAS_BUTTON 1
#define PLATFORM_HAS_BATTERY 1
#define LOOP_INTERVAL (10 * CLOCK_SECOND)
/* For Debug: Dont allow MCU sleeping between channel checks */
//#undef RDC_CONF_MCU_SLEEP
//#define RDC_CONF_MCU_SLEEP 0
/* Save energy */
//#define RDC_CONF_PT_YIELD_OFF
/* Disabling RDC for demo purposes. Core updates often require more memory. */
/* For projects, optimize memory and enable RDC again. */
//#undef NETSTACK_CONF_RDC