diff --git a/apps/arduino/arduino-process.c b/apps/arduino/arduino-process.c index d1b21dd09..6b190ac2a 100644 --- a/apps/arduino/arduino-process.c +++ b/apps/arduino/arduino-process.c @@ -57,7 +57,7 @@ #include "hw-arduino.h" #include "contiki.h" -#define DEBUG 1 +#define DEBUG 0 #if DEBUG #include #define PRINTF(...) printf(__VA_ARGS__) @@ -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,6 +132,7 @@ PROCESS_THREAD(arduino_sketch, ev, data) /* Also call the separate response example handler. */ res_separate.resume(); + mcu_sleep_on(); } #endif /* PLATFORM_HAS_BUTTON */ diff --git a/examples/osd/triggerbaord/project-conf.h b/examples/osd/triggerbaord/project-conf.h index d2a76eadf..510c66786 100644 --- a/examples/osd/triggerbaord/project-conf.h +++ b/examples/osd/triggerbaord/project-conf.h @@ -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 diff --git a/examples/osd/triggerbaord/sketch.pde b/examples/osd/triggerbaord/sketch.pde index d294e6fe2..73aeb00f7 100644 --- a/examples/osd/triggerbaord/sketch.pde +++ b/examples/osd/triggerbaord/sketch.pde @@ -46,12 +46,10 @@ void setup (void) rest_activate_resource(&res_event, "s/button"); // rest_activate_resource (&res_battery, "p/server"); - NETSTACK_MAC.off(1); +// NETSTACK_MAC.off(1); } void loop (void) { - mcu_sleep_off(); - - mcu_sleep_on(); + }