mirror of https://github.com/arendst/Tasmota.git
Add optional parameter <startcolor> to command ``Scheme``
Add optional parameter <startcolor> to command ``Scheme <scheme>, <startcolor>`` to control initial start color
This commit is contained in:
parent
38b344fcea
commit
fb485dabd3
|
@ -82,3 +82,4 @@ The following binary downloads have been compiled with ESP8266/Arduino library c
|
|||
- Add web page sliders when ``SetOption37 128`` is active allowing control of white(s)
|
||||
- Add most SetOptions as defines to my_user_config.h
|
||||
- Add SoftwareSerial to CSE7766 driver allowing different GPIOs (#7563)
|
||||
- Add optional parameter <startcolor> to command ``Scheme <scheme>, <startcolor>`` to control initial start color
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
- Add Zigbee persistence and friendly names
|
||||
- Add most SetOptions as defines to my_user_config.h
|
||||
- Add SoftwareSerial to CSE7766 driver allowing different GPIOs (#7563)
|
||||
- Add optional parameter <startcolor> to command ``Scheme <scheme>, <startcolor>`` to control initial start color
|
||||
|
||||
### 8.1.0.3 20200106
|
||||
|
||||
|
|
|
@ -493,6 +493,17 @@ bool ParseIp(uint32_t* addr, const char* str)
|
|||
return (3 == i);
|
||||
}
|
||||
|
||||
uint32_t ParseParameters(uint32_t count, uint32_t *params)
|
||||
{
|
||||
char *p;
|
||||
uint32_t i = 0;
|
||||
for (char *str = strtok_r(XdrvMailbox.data, ", ", &p); str && i < count; str = strtok_r(nullptr, ", ", &p)) {
|
||||
params[i] = strtoul(str, nullptr, 0);
|
||||
i++;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
// Function to parse & check if version_str is newer than our currently installed version.
|
||||
bool NewerVersion(char* version_str)
|
||||
{
|
||||
|
|
|
@ -169,7 +169,7 @@ enum UserSelectablePins {
|
|||
GPIO_SM16716_SEL, // SM16716 SELECT
|
||||
GPIO_DI, // my92x1 PWM input
|
||||
GPIO_DCKI, // my92x1 CLK input
|
||||
GPIO_CSE7766_TX, // CSE7766 Serial interface (S31 and Pow R2)
|
||||
GPIO_CSE7766_TX, // CSE7766 Serial interface (S31 and Pow R2) - Not used anymore 20200121
|
||||
GPIO_CSE7766_RX, // CSE7766 Serial interface (S31 and Pow R2)
|
||||
GPIO_ARIRFRCV, // AriLux RF Receive input
|
||||
GPIO_TXD, // Serial interface
|
||||
|
|
|
@ -522,26 +522,19 @@ void CmndEnergyReset(void)
|
|||
}
|
||||
}
|
||||
else if ((XdrvMailbox.index > 3) && (XdrvMailbox.index <= 5)) {
|
||||
char *p;
|
||||
char *str = strtok_r(XdrvMailbox.data, ", ", &p);
|
||||
int32_t position = -1;
|
||||
uint32_t values[2];
|
||||
|
||||
while ((str != nullptr) && (position < 1)) {
|
||||
uint32_t value = strtoul(str, nullptr, 10);
|
||||
position++;
|
||||
values[position] = value *100;
|
||||
str = strtok_r(nullptr, ", ", &p);
|
||||
}
|
||||
uint32_t values[2] = { 0 };
|
||||
uint32_t position = ParseParameters(2, values);
|
||||
values[0] *= 100;
|
||||
values[1] *= 100;
|
||||
|
||||
switch (XdrvMailbox.index)
|
||||
{
|
||||
case 4:
|
||||
// Reset energy_usage.usage totals
|
||||
if (position > -1) {
|
||||
if (position > 0) {
|
||||
RtcSettings.energy_usage.usage1_kWhtotal = values[0];
|
||||
}
|
||||
if (position > 0) {
|
||||
if (position > 1) {
|
||||
RtcSettings.energy_usage.usage2_kWhtotal = values[1];
|
||||
}
|
||||
Settings.energy_usage.usage1_kWhtotal = RtcSettings.energy_usage.usage1_kWhtotal;
|
||||
|
@ -549,10 +542,10 @@ void CmndEnergyReset(void)
|
|||
break;
|
||||
case 5:
|
||||
// Reset energy_usage.return totals
|
||||
if (position > -1) {
|
||||
if (position > 0) {
|
||||
RtcSettings.energy_usage.return1_kWhtotal = values[0];
|
||||
}
|
||||
if (position > 0) {
|
||||
if (position > 1) {
|
||||
RtcSettings.energy_usage.return2_kWhtotal = values[1];
|
||||
}
|
||||
Settings.energy_usage.return1_kWhtotal = RtcSettings.energy_usage.return1_kWhtotal;
|
||||
|
|
|
@ -2311,6 +2311,10 @@ void CmndScheme(void)
|
|||
}
|
||||
}
|
||||
if ((XdrvMailbox.payload >= 0) && (XdrvMailbox.payload <= max_scheme)) {
|
||||
uint32_t parm[2];
|
||||
if (ParseParameters(2, parm) > 1) {
|
||||
Light.wheel = parm[1];
|
||||
}
|
||||
Settings.light_scheme = XdrvMailbox.payload;
|
||||
if (LS_WAKEUP == Settings.light_scheme) {
|
||||
Light.wakeup_active = 3;
|
||||
|
@ -2403,16 +2407,10 @@ void CmndDimmer(void)
|
|||
void CmndDimmerRange(void)
|
||||
{
|
||||
if (XdrvMailbox.data_len > 0) {
|
||||
char *p;
|
||||
uint8_t i = 0;
|
||||
uint16_t parm[2];
|
||||
uint32_t parm[2];
|
||||
parm[0] = Settings.dimmer_hw_min;
|
||||
parm[1] = Settings.dimmer_hw_max;
|
||||
for (char *str = strtok_r(XdrvMailbox.data, ", ", &p); str && i < 2; str = strtok_r(nullptr, ", ", &p)) {
|
||||
parm[i] = strtoul(str, nullptr, 0);
|
||||
i++;
|
||||
}
|
||||
|
||||
ParseParameters(2, parm);
|
||||
if (parm[0] < parm[1]) {
|
||||
Settings.dimmer_hw_min = parm[0];
|
||||
Settings.dimmer_hw_max = parm[1];
|
||||
|
|
|
@ -155,13 +155,8 @@ void CmndBuzzer(void)
|
|||
|
||||
if (XdrvMailbox.data_len > 0) {
|
||||
if (XdrvMailbox.payload > 0) {
|
||||
char *p;
|
||||
uint32_t i = 0;
|
||||
uint32_t parm[4] = { 0 };
|
||||
for (char *str = strtok_r(XdrvMailbox.data, ", ", &p); str && i < 4; str = strtok_r(nullptr, ", ", &p)) {
|
||||
parm[i] = strtoul(str, nullptr, 0);
|
||||
i++;
|
||||
}
|
||||
ParseParameters(4, parm);
|
||||
for (uint32_t i = 0; i < 3; i++) {
|
||||
if (parm[i] < 1) { parm[i] = 1; } // Default Count, On time, Off time
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue