Skip to content

Commit

Permalink
Extend CMD_OnOff enum
Browse files Browse the repository at this point in the history
  • Loading branch information
couin3 committed Apr 11, 2020
1 parent 97ed556 commit 3c638c2
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 36 deletions.
20 changes: 17 additions & 3 deletions RFLink/4_Display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ void display_SWITCHc(const char *input)
}

// CMD=ON => Command (ON/OFF/ALLON/ALLOFF) Additional for Milight: DISCO+/DISCO-/MODE0 - MODE8
void display_CMD(boolean all, boolean on)
void display_CMD(boolean all, byte on)
{
sprintf_P(dbuffer, PSTR("%S"), F(";CMD="));
strcat(pbuffer, dbuffer);
Expand All @@ -102,10 +102,24 @@ void display_CMD(boolean all, boolean on)
strcat(pbuffer, dbuffer);
}

if (on == CMD_On)
switch (on)
{
case CMD_On:
sprintf_P(dbuffer, PSTR("%S"), F("ON"));
else
break;
case CMD_Off:
sprintf_P(dbuffer, PSTR("%S"), F("OFF"));
break;
case CMD_Bright:
sprintf_P(dbuffer, PSTR("%S"), F("BRIGHT"));
break;
case CMD_Dim:
sprintf_P(dbuffer, PSTR("%S"), F("DIM"));
break;
case CMD_Unknown:
default:
sprintf_P(dbuffer, PSTR("%S"), F("UNKNOWN"));
}
strcat(pbuffer, dbuffer);
}

Expand Down
4 changes: 2 additions & 2 deletions RFLink/4_Display.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ void display_IDc(const char *);
void display_SWITCH(byte);
void display_SWITCHc(const char *);
enum CMD_Group {CMD_Single, CMD_All};
enum CMD_OnOff {CMD_Off, CMD_On};
void display_CMD(boolean, boolean);
enum CMD_OnOff {CMD_Off, CMD_On, CMD_Bright, CMD_Dim, CMD_Unknown};
void display_CMD(boolean, byte);
void display_SET_LEVEL(byte);
void display_TEMP(unsigned int);
enum HUM_Type {HUM_HEX, HUM_BCD};
Expand Down
13 changes: 3 additions & 10 deletions RFLink/Plugins/Plugin_009.c
Original file line number Diff line number Diff line change
Expand Up @@ -271,17 +271,10 @@ boolean Plugin_009(byte function, char *string)
display_CMD(((command >> 3) & B01), (command & B01)); // #ALL #ON
break;
case 0x02:
display_CMD(CMD_Single, CMD_Bright); // #All #ON
break;
case 0x03:
display_Name(PSTR(";CMD="));
switch (command)
{
case 0x02:
display_Name(PSTR("BRIGHT"));
break;
case 0x03:
display_Name(PSTR("DIM"));
break;
}
display_CMD(CMD_Single, CMD_Dim); // #All #ON
break;
}
display_Footer();
Expand Down
2 changes: 1 addition & 1 deletion RFLink/Plugins/Plugin_012.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ boolean Plugin_012(byte function, char *string)
display_CMD(CMD_Single, (command & B01)); // #ALL #ON
break;
default:
display_Name(PSTR(";CMD=UNKOWN"));
display_CMD(CMD_Single, CMD_Unknown);
}
display_Footer();
// ----------------------------------
Expand Down
13 changes: 3 additions & 10 deletions RFLink/Plugins/Plugin_013.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,17 +194,10 @@ boolean Plugin_013(byte function, char *string)
display_CMD(((command >> 3) & B01), (command & B01)); // #All #ON
break;
case 0x02:
display_CMD(CMD_Single, CMD_Bright); // #All #ON
break;
case 0x03:
display_Name(PSTR(";CMD="));
switch (command)
{
case 0x02:
display_Name(PSTR("BRIGHT"));
break;
case 0x03:
display_Name(PSTR("DIM"));
break;
}
display_CMD(CMD_Single, CMD_Dim); // #All #ON
break;
}
display_Footer();
Expand Down
13 changes: 3 additions & 10 deletions RFLink/Plugins/Plugin_014.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,17 +158,10 @@ boolean Plugin_014(byte function, char *string)
display_CMD(((command >> 3) & B01), (command & B01)); // #ALL #ON
break;
case 0x02:
display_CMD(CMD_Single, CMD_Bright); // #All #ON
break;
case 0x03:
display_Name(PSTR(";CMD="));
switch (command)
{
case 0x02:
display_Name(PSTR("BRIGHT"));
break;
case 0x03:
display_Name(PSTR("DIM"));
break;
}
display_CMD(CMD_Single, CMD_Dim); // #All #ON
break;
default:
display_SET_LEVEL(level);
Expand Down

0 comments on commit 3c638c2

Please sign in to comment.