remove s command from shell, add if typing disable mcusleep
This commit is contained in:
parent
927c0b8eac
commit
25d38eba2c
|
@ -59,7 +59,7 @@
|
|||
#include "project-conf.h"
|
||||
|
||||
|
||||
#define DEBUG 1
|
||||
#define DEBUG 0
|
||||
#if DEBUG
|
||||
#include <stdio.h>
|
||||
#define PRINTF(...) printf(__VA_ARGS__)
|
||||
|
@ -88,23 +88,23 @@ void
|
|||
mcu_sleep_init(void)
|
||||
{
|
||||
mcusleepcycleval=mcusleepcycle;
|
||||
mcu_sleep_disable();
|
||||
mcu_sleep_disable(); // if a shell is active we can type
|
||||
}
|
||||
void
|
||||
mcu_sleep_disable(void)
|
||||
{
|
||||
mcusleep=0;
|
||||
mcusleep=2;
|
||||
mcu_sleep_off();
|
||||
}
|
||||
void
|
||||
mcu_sleep_enable(void)
|
||||
{
|
||||
mcusleep=1;
|
||||
mcusleep=0;
|
||||
}
|
||||
void
|
||||
mcu_sleep_on(void)
|
||||
{
|
||||
if(mcusleep){
|
||||
if(mcusleep == 0){
|
||||
mcusleepcycle= mcusleepcycleval;
|
||||
}
|
||||
}
|
||||
|
@ -127,13 +127,12 @@ PROCESS(arduino_sketch, "Arduino Sketch Wrapper");
|
|||
#ifndef LOOP_INTERVAL
|
||||
#define LOOP_INTERVAL (1 * CLOCK_SECOND)
|
||||
#endif
|
||||
#define START_MCUSLEEP (5 * CLOCK_SECOND)
|
||||
#define START_MCUSLEEP (10 * CLOCK_SECOND)
|
||||
|
||||
PROCESS_THREAD(arduino_sketch, ev, data)
|
||||
{
|
||||
static struct etimer loop_periodic_timer;
|
||||
static struct etimer start_mcusleep_timer;
|
||||
static int a=0;
|
||||
|
||||
PROCESS_BEGIN();
|
||||
adc_init ();
|
||||
|
@ -153,10 +152,17 @@ PROCESS_THREAD(arduino_sketch, ev, data)
|
|||
mcu_sleep_on();
|
||||
}
|
||||
#endif /* PLATFORM_HAS_BUTTON */
|
||||
if(etimer_expired(&start_mcusleep_timer) && a == 0) {
|
||||
PRINTF("mcusleep_timer %d",a);
|
||||
mcu_sleep_enable();
|
||||
a++;
|
||||
if(etimer_expired(&start_mcusleep_timer)) {
|
||||
PRINTF("mcusleep_timer %d\n",mcusleep);
|
||||
if(mcusleep == 1){
|
||||
PRINTF("mcu sleep on\n");
|
||||
mcu_sleep_enable();
|
||||
mcu_sleep_on();
|
||||
}
|
||||
if (mcusleep > 0) {
|
||||
mcusleep--;
|
||||
}
|
||||
etimer_reset(&start_mcusleep_timer);
|
||||
}
|
||||
|
||||
if(etimer_expired(&loop_periodic_timer)) {
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "arduino-process.h"
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
PROCESS(serial_shell_process, "Contiki serial shell");
|
||||
|
@ -59,7 +59,7 @@ shell_default_output(const char *text1, int len1, const char *text2, int len2)
|
|||
{
|
||||
int i;
|
||||
|
||||
mcu_sleep_off();
|
||||
mcu_sleep_disable();
|
||||
if(text1 == NULL) {
|
||||
text1 = "";
|
||||
len1 = 0;
|
||||
|
@ -78,7 +78,6 @@ shell_default_output(const char *text1, int len1, const char *text2, int len2)
|
|||
printf("%c", text2[i]);
|
||||
}
|
||||
printf("\r\n");
|
||||
mcu_sleep_on();
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
|
@ -92,6 +91,7 @@ void
|
|||
shell_exit(void)
|
||||
{
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
PROCESS_THREAD(serial_shell_process, ev, data)
|
||||
{
|
||||
|
@ -101,9 +101,8 @@ PROCESS_THREAD(serial_shell_process, ev, data)
|
|||
|
||||
while(1) {
|
||||
PROCESS_WAIT_EVENT_UNTIL(ev == serial_line_event_message && data != NULL);
|
||||
mcu_sleep_off();
|
||||
mcu_sleep_disable();
|
||||
shell_input(data, strlen(data));
|
||||
mcu_sleep_on();
|
||||
}
|
||||
|
||||
PROCESS_END();
|
||||
|
|
|
@ -255,6 +255,6 @@ shell_merkur_init(void)
|
|||
shell_register_command(&panid_command);
|
||||
shell_register_command(&macconf_command);
|
||||
shell_register_command(&saverfparam_command);
|
||||
shell_register_command(&s_command);
|
||||
// shell_register_command(&s_command);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
|
Loading…
Reference in a new issue