mirror of https://github.com/arendst/Tasmota.git
commit
d7d750c928
|
@ -213,7 +213,7 @@ char * copyStr(const char * str) {
|
|||
}
|
||||
|
||||
const char ext_invalid_mem[] PROGMEM = "<--INVALID-->";
|
||||
const uint32_t min_valid_ptr = 0x3FF00000; // addresses below this line are invalid
|
||||
const uint32_t min_valid_ptr = 0x3F000000; // addresses below this line are invalid
|
||||
|
||||
int32_t ext_vsnprintf_P(char * buf, size_t buf_len, const char * fmt_P, va_list va) {
|
||||
va_list va_cpy;
|
||||
|
|
|
@ -75,6 +75,7 @@ extern "C" {
|
|||
int32_t top = be_top(vm); // Get the number of arguments
|
||||
if (top == 2 && be_isstring(vm, 2)) { // only 1 argument of type string accepted
|
||||
const char * command = be_tostring(vm, 2);
|
||||
be_pop(vm, 2); // clear the stack before calling, because of re-entrant call to Berry in a Rule
|
||||
ExecuteCommand(command, SRC_BERRY);
|
||||
be_pushstring(vm, TasmotaGlobal.mqtt_data);
|
||||
be_return(vm); // Return
|
||||
|
@ -294,7 +295,7 @@ extern "C" {
|
|||
|
||||
if (data_present) {
|
||||
// see ResponseLightState()
|
||||
map_insert_bool(vm, "power", bitRead(TasmotaGlobal.power, light_num));
|
||||
map_insert_bool(vm, "power", bitRead(TasmotaGlobal.power, light_num + Light.device - 1));
|
||||
map_insert_int(vm, "bri", bri);
|
||||
|
||||
if (subtype >= LST_RGB) {
|
||||
|
@ -364,9 +365,9 @@ extern "C" {
|
|||
// power
|
||||
if (map_find(vm, "power")) {
|
||||
bool power = be_tobool(vm, -1);
|
||||
bool current_power = bitRead(TasmotaGlobal.power, idx);
|
||||
bool current_power = bitRead(TasmotaGlobal.power, idx + Light.device - 1);
|
||||
if (power != current_power) { // only send command if needed
|
||||
ExecuteCommandPower(Light.device + idx, (power) ? POWER_ON : POWER_OFF, SRC_BERRY);
|
||||
ExecuteCommandPower(idx + Light.device, (power) ? POWER_ON : POWER_OFF, SRC_BERRY);
|
||||
}
|
||||
}
|
||||
be_pop(vm, 1);
|
||||
|
|
Loading…
Reference in New Issue