mode added to uart actions
This commit is contained in:
parent
bdc953feff
commit
0d2784f3b4
|
@ -42,14 +42,16 @@ const char help_03[] PROGMEM = "\tpower show power state\n"
|
||||||
const char help_04[] PROGMEM = "\tpower on switch power on\n";
|
const char help_04[] PROGMEM = "\tpower on switch power on\n";
|
||||||
const char help_05[] PROGMEM = "\tpower off switch power off\n";
|
const char help_05[] PROGMEM = "\tpower off switch power off\n";
|
||||||
const char help_06[] PROGMEM = "\tfan show fan speed\n";
|
const char help_06[] PROGMEM = "\tfan show fan speed\n";
|
||||||
const char help_07[] PROGMEM = "\tch X Y show channel [1-2].[1-5] brightness\n";
|
const char help_07[] PROGMEM = "\tmode show current mode\n";
|
||||||
const char help_08[] PROGMEM = "\tch X Y Z set channel [1-2].[1-5] brightness [0-255]\n";
|
const char help_08[] PROGMEM = "\tmode N select mode\n";
|
||||||
const char help_09[] PROGMEM = "\tir learn power learn the IR command to power on/off\n";
|
const char help_09[] PROGMEM = "\tch X Y show channel [1-2].[1-5] brightness\n";
|
||||||
const char help_10[] PROGMEM = "\tir learn mode learn the IR command to change between modes\n";
|
const char help_10[] PROGMEM = "\tch X Y Z set channel [1-2].[1-5] brightness [0-255]\n";
|
||||||
const char help_11[] PROGMEM = "\tir learn brightness up learn the IR command to increase brightness\n";
|
const char help_11[] PROGMEM = "\tir learn power learn the IR command to power on/off\n";
|
||||||
const char help_12[] PROGMEM = "\tir learn brightness down learn the IR command to decrease brightness\n";
|
const char help_12[] PROGMEM = "\tir learn mode learn the IR command to change between modes\n";
|
||||||
const char help_13[] PROGMEM = "\tir learn channel next learn the IR command to select next channel\n";
|
const char help_13[] PROGMEM = "\tir learn brightness up learn the IR command to increase brightness\n";
|
||||||
const char help_14[] PROGMEM = "\tir learn channel previous learn the IR command to select previous channel\n";
|
const char help_14[] PROGMEM = "\tir learn brightness down learn the IR command to decrease brightness\n";
|
||||||
|
const char help_15[] PROGMEM = "\tir learn channel next learn the IR command to select next channel\n";
|
||||||
|
const char help_16[] PROGMEM = "\tir learn channel previous learn the IR command to select previous channel\n";
|
||||||
PGM_P const help_table[] PROGMEM = {
|
PGM_P const help_table[] PROGMEM = {
|
||||||
help_00,
|
help_00,
|
||||||
help_01,
|
help_01,
|
||||||
|
@ -66,6 +68,8 @@ PGM_P const help_table[] PROGMEM = {
|
||||||
help_12,
|
help_12,
|
||||||
help_13,
|
help_13,
|
||||||
help_14,
|
help_14,
|
||||||
|
help_15,
|
||||||
|
help_16
|
||||||
};
|
};
|
||||||
|
|
||||||
volatile uint8_t* PORTS[CHANNELS_1+CHANNELS_2] = {&PORTC,&PORTC,&PORTC,&PORTC,&PORTC,&PORTD,&PORTD,&PORTD,&PORTD,&PORTD};
|
volatile uint8_t* PORTS[CHANNELS_1+CHANNELS_2] = {&PORTC,&PORTC,&PORTC,&PORTC,&PORTC,&PORTD,&PORTD,&PORTD,&PORTD,&PORTD};
|
||||||
|
@ -456,6 +460,32 @@ void uart_action(char* str)
|
||||||
} else {
|
} else {
|
||||||
printf("fan is off (or not detected)\n");
|
printf("fan is off (or not detected)\n");
|
||||||
}
|
}
|
||||||
|
reset_settings();
|
||||||
|
/* reset using watchdog */
|
||||||
|
do {
|
||||||
|
wdt_enable(WDTO_15MS);
|
||||||
|
for(;;) {}
|
||||||
|
} while(0);
|
||||||
|
} else if (0==strcmp(word,"mode")) {
|
||||||
|
word = strtok(NULL,delimiter);
|
||||||
|
if (!word) {
|
||||||
|
printf("%u/%u\n",mode+1,MODES);
|
||||||
|
} else {
|
||||||
|
/* expecting one digit mode N */
|
||||||
|
if (strlen(word)!=1) {
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
/* expecting mode 1-MODES */
|
||||||
|
if (word[0]<'1') {
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
uint8_t mode_temp = word[0]-'1';
|
||||||
|
if (mode_temp>MODES) {
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
mode = mode_temp;
|
||||||
|
channel_flag = true;
|
||||||
|
}
|
||||||
} else if (0==strcmp(word,"ir")) {
|
} else if (0==strcmp(word,"ir")) {
|
||||||
word = strtok(NULL,delimiter);
|
word = strtok(NULL,delimiter);
|
||||||
if (0==strcmp(word,"learn")) {
|
if (0==strcmp(word,"learn")) {
|
||||||
|
|
Loading…
Reference in New Issue