From 0489d3fc9adde30a248f65266c3f9b9703f63f28 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Mon, 21 Dec 2020 15:01:04 +0100 Subject: [PATCH] Add backported fixes --- CHANGELOG.md | 3 ++ RELEASENOTES.md | 10 +++--- tasmota/language/it_IT.h | 21 ++++++------ tasmota/xdrv_10_scripter.ino | 63 +++++++++++++++++++++++------------- tasmota/xdrv_27_shutter.ino | 13 +++----- 5 files changed, 66 insertions(+), 44 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 821b80c9dd5c..fb84e1dff63a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ All notable changes to this project will be documented in this file. ## [9.2.0] 20201221 ### Fixed Backported +- Shutter stop issue (#10170) +- Scripter script_sub_command (#10181) +- Scripter JSON variable above 32 chars (#10193) - Shelly Dimmer power on state (#10154, #10182) - Wemo emulation for single devices (#10165, #10194) - ESP32 LoadStoreError when using ``#define USER_TEMPLATE`` (#9506) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 9e3431715164..5b542e491c42 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -113,12 +113,14 @@ The attached binaries can also be downloaded from http://ota.tasmota.com/tasmota - ESP32 Analog input div10 rule trigger [#10149](https://github.com/arendst/Tasmota/issues/10149) ### Fixed Backported -- Shelly Dimmer power on state (#10154, #10182) -- Wemo emulation for single devices (#10165, #10194) -- ESP32 LoadStoreError when using ``#define USER_TEMPLATE`` (#9506) +- Shutter stop issue [#10170](https://github.com/arendst/Tasmota/issues/10170) +- Scripter script_sub_command [#10181](https://github.com/arendst/Tasmota/issues/10181) +- Scripter JSON variable above 32 chars [#10193](https://github.com/arendst/Tasmota/issues/10193) +- Shelly Dimmer power on state [#10182](https://github.com/arendst/Tasmota/issues/10182) +- Wemo emulation for single devices [#10194](https://github.com/arendst/Tasmota/issues/10194) +- ESP32 LoadStoreError when using ``#define USER_TEMPLATE`` [#9506](https://github.com/arendst/Tasmota/issues/9506) - Compile error when ``#ifdef USE_IR_RECEIVE`` is disabled regression from 9.1.0.2 ### Removed - Version compatibility check - PN532 define USE_PN532_CAUSE_EVENTS replaced by generic rule trigger `on pn532#uid=` - diff --git a/tasmota/language/it_IT.h b/tasmota/language/it_IT.h index 74e5504d2918..aa5ede53c450 100644 --- a/tasmota/language/it_IT.h +++ b/tasmota/language/it_IT.h @@ -1,7 +1,7 @@ /* it-IT.h - localization for Italian - Italy for Tasmota - Copyright (C) 2020 Gennaro Tortone - some mods by Antonio Fragola - Updated by bovirus - rev. 20.11.2020 + Copyright (C) 2020 Gennaro Tortone - some mods by Antonio Fragola - Updated by bovirus - rev. 21.12.2020 This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -433,7 +433,7 @@ #define D_TIMER_TIME "Ora" #define D_TIMER_DAYS "Giorni" #define D_TIMER_REPEAT "Ripeti" -#define D_TIMER_OUTPUT "Output" +#define D_TIMER_OUTPUT "Uscita" #define D_TIMER_ACTION "Azione" // xdrv_10_knx.ino @@ -475,8 +475,8 @@ #define D_PCF8574_PARAMETERS "Parametri PCF8574" #define D_INVERT_PORTS "Inverti porte" #define D_DEVICE "Dispositivo" -#define D_DEVICE_INPUT "Input" -#define D_DEVICE_OUTPUT "Output" +#define D_DEVICE_INPUT "Ingresso" +#define D_DEVICE_OUTPUT "Uscita" // xsns_05_ds18b20.ino #define D_SENSOR_BUSY "Sensore occupato" @@ -560,7 +560,8 @@ // tasmota_template.h - keep them as short as possible to be able to fit them in GUI drop down box #define D_SENSOR_NONE "Nessuno" -#define D_SENSOR_USER "User" +#define D_SENSOR_USER "Utente" +#define D_SENSOR_OPTION "Opzioni" #define D_SENSOR_DHT11 "DHT11" #define D_SENSOR_AM2301 "AM2301" #define D_SENSOR_SI7021 "SI7021" @@ -646,6 +647,8 @@ #define D_SENSOR_SM16716_CLK "SM16716 - CLK" #define D_SENSOR_SM16716_DAT "SM16716 - DAT" #define D_SENSOR_SM16716_POWER "SM16716 - PWR" +#define D_SENSOR_P9813_CLK "P9813 - CLK" +#define D_SENSOR_P9813_DAT "P9813 - DAT" #define D_SENSOR_MY92X1_DI "MY92x1 - DI" #define D_SENSOR_MY92X1_DCKI "MY92x1 - DCKI" #define D_SENSOR_ARIRFRCV "IR ALux - RCV" @@ -671,8 +674,8 @@ #define D_SENSOR_A4988_STP "A4988 - STP" #define D_SENSOR_A4988_ENA "A4988 - ENA" #define D_SENSOR_A4988_MS1 "A4988 - MS1" -#define D_SENSOR_OUTPUT_HI "Output - Hi" -#define D_SENSOR_OUTPUT_LO "Output - Lo" +#define D_SENSOR_OUTPUT_HI "Uscita - Hi" +#define D_SENSOR_OUTPUT_LO "Uscita - Lo" #define D_SENSOR_AS608_TX "AS608 - TX" #define D_SENSOR_AS608_RX "AS608 - RX" #define D_SENSOR_DDS2382_TX "DDS238-2 - TX" @@ -703,7 +706,7 @@ #define D_SENSOR_TELEINFO_RX "TInfo - RX" #define D_SENSOR_TELEINFO_ENABLE "TInfo - Abilita" #define D_SENSOR_LMT01_PULSE "LMT01 - Impulso" -#define D_SENSOR_ADC_INPUT "ADC - Input" +#define D_SENSOR_ADC_INPUT "ADC - Ingresso" #define D_SENSOR_ADC_TEMP "ADC - Temperatura" #define D_SENSOR_ADC_LIGHT "ADC - Luce" #define D_SENSOR_ADC_BUTTON "ADC - Pulsante" @@ -900,4 +903,4 @@ #define D_FP_PASSVERIFY "Password verificata" // 0x21 Verify the fingerprint passed #define D_FP_UNKNOWNERROR "Errore" // Any other error -#endif // _LANGUAGE_IT_IT_H_ +#endif // _LANGUAGE_IT_IT_H_ \ No newline at end of file diff --git a/tasmota/xdrv_10_scripter.ino b/tasmota/xdrv_10_scripter.ino index d2049af81ca4..1c87af7a6d88 100755 --- a/tasmota/xdrv_10_scripter.ino +++ b/tasmota/xdrv_10_scripter.ino @@ -67,8 +67,8 @@ keywords if then else endif, or, and are better readable for beginners (others m #define MAX_SARRAY_NUM 32 -uint32_t EncodeLightId(uint8_t relay_id); -uint32_t DecodeLightId(uint32_t hue_id); +//uint32_t EncodeLightId(uint8_t relay_id); +//uint32_t DecodeLightId(uint32_t hue_id); #ifdef USE_UNISHOX_COMPRESSION #define USE_SCRIPT_COMPRESSION @@ -1584,7 +1584,7 @@ float fvar; char *isvar(char *lp, uint8_t *vtype, struct T_INDEX *tind, float *fp, char *sp, JsonParserObject *jo) { uint16_t count,len = 0; uint8_t nres = 0; - char vname[32]; + char vname[64]; float fvar = 0; tind->index = 0; tind->bits.data = 0; @@ -1713,7 +1713,7 @@ char *isvar(char *lp, uint8_t *vtype, struct T_INDEX *tind, float *fp, char *sp, if (jo) { // look for json input - char jvname[32]; + char jvname[64]; strcpy(jvname, vname); const char* str_value; uint8_t aindex; @@ -1919,6 +1919,19 @@ chknext: fvar = xPortGetCoreID(); goto exit; } +#ifdef USE_M5STACK_CORE2 + if (!strncmp(vname, "c2ps(", 5)) { + lp = GetNumericArgument(lp + 5, OPER_EQU, &fvar, 0); + while (*lp==' ') lp++; + float fvar1; + lp = GetNumericArgument(lp, OPER_EQU, &fvar1, 0); + fvar = core2_setaxppin(fvar, fvar1); + lp++; + len=0; + goto exit; + } +#endif // USE_M5STACK_CORE2 + #ifdef USE_SCRIPT_TASK if (!strncmp(vname, "ct(", 3)) { lp = GetNumericArgument(lp + 3, OPER_EQU, &fvar, 0); @@ -2667,7 +2680,7 @@ chknext: len++; goto exit; } -#if defined(ESP32) && (defined(USE_I2S_AUDIO) || defined(USE_TTGO_WATCH)) +#if defined(ESP32) && (defined(USE_I2S_AUDIO) || defined(USE_TTGO_WATCH) || defined(USE_M5STACK_CORE2)) if (!strncmp(vname, "pl(", 3)) { char path[SCRIPT_MAXSSIZE]; lp = GetStringArgument(lp + 3, OPER_EQU, path, 0); @@ -2860,7 +2873,7 @@ chknext: len = 0; goto strexit; } -#if defined(ESP32) && (defined(USE_I2S_AUDIO) || defined(USE_TTGO_WATCH)) +#if defined(ESP32) && (defined(USE_I2S_AUDIO) || defined(USE_TTGO_WATCH) || defined(USE_M5STACK_CORE2)) if (!strncmp(vname, "say(", 4)) { char text[SCRIPT_MAXSSIZE]; lp = GetStringArgument(lp + 4, OPER_EQU, text, 0); @@ -3161,7 +3174,7 @@ chknext: goto exit; } #endif // USE_TTGO_WATCH -#if defined(USE_TTGO_WATCH) && defined(USE_FT5206) +#if defined(USE_FT5206) if (!strncmp(vname, "wtch(", 5)) { lp = GetNumericArgument(lp + 5, OPER_EQU, &fvar, 0); fvar = Touch_Status(fvar); @@ -5833,24 +5846,26 @@ bool Script_SubCmd(void) { if (!bitRead(Settings.rule_enabled, 0)) return false; if (tasm_cmd_activ) return false; + //AddLog_P(LOG_LEVEL_INFO,PSTR(">> %s, %s, %d, %d "),XdrvMailbox.topic, XdrvMailbox.data, XdrvMailbox.payload, XdrvMailbox.index); char command[CMDSZ]; strlcpy(command, XdrvMailbox.topic, CMDSZ); - uint32_t pl = XdrvMailbox.payload; - char pld[64]; - strlcpy(pld, XdrvMailbox.data, sizeof(pld)); + if (XdrvMailbox.index > 1) { + char ind[2]; + ind[0] = XdrvMailbox.index | 0x30; + ind[1] = 0; + strcat(command, ind); + } + + int32_t pl = XdrvMailbox.payload; char cmdbuff[128]; char *cp = cmdbuff; *cp++ = '#'; - strcpy(cp, XdrvMailbox.topic); - uint8_t tlen = strlen(XdrvMailbox.topic); + strcpy(cp, command); + uint8_t tlen = strlen(command); cp += tlen; - if (XdrvMailbox.index > 0) { - *cp++ = XdrvMailbox.index | 0x30; - tlen++; - } - if ((XdrvMailbox.payload>0) || (XdrvMailbox.data_len>0)) { + if (XdrvMailbox.data_len>0) { *cp++ = '('; strncpy(cp, XdrvMailbox.data,XdrvMailbox.data_len); cp += XdrvMailbox.data_len; @@ -5860,12 +5875,16 @@ bool Script_SubCmd(void) { //toLog(cmdbuff); uint32_t res = Run_Scripter(cmdbuff, tlen + 1, 0); //AddLog_P(LOG_LEVEL_INFO,">>%d",res); - if (res) return false; + if (res) { + return false; + } else { - if (pl>=0) { - Response_P(S_JSON_COMMAND_NVALUE, command, pl); + cp=XdrvMailbox.data; + while (*cp==' ') cp++; + if (isdigit(*cp) || *cp=='-') { + Response_P(S_JSON_COMMAND_NVALUE, command, XdrvMailbox.payload); } else { - Response_P(S_JSON_COMMAND_SVALUE, command, pld); + Response_P(S_JSON_COMMAND_SVALUE, command, XdrvMailbox.data); } } return true; @@ -7550,7 +7569,7 @@ bool Xdrv10(uint8_t function) // fs on SD card #ifdef ESP32 if (PinUsed(GPIO_SPI_MOSI) && PinUsed(GPIO_SPI_MISO) && PinUsed(GPIO_SPI_CLK)) { - SPI.begin(Pin(GPIO_SPI_CLK),Pin(GPIO_SPI_MISO),Pin(GPIO_SPI_MOSI), -1); + SPI.begin(Pin(GPIO_SPI_CLK), Pin(GPIO_SPI_MISO), Pin(GPIO_SPI_MOSI), -1); } #endif // ESP32 fsp = &SD; diff --git a/tasmota/xdrv_27_shutter.ino b/tasmota/xdrv_27_shutter.ino index 63c44b3c1457..735277e3232b 100644 --- a/tasmota/xdrv_27_shutter.ino +++ b/tasmota/xdrv_27_shutter.ino @@ -984,15 +984,10 @@ void CmndShutterStop(void) if (Shutter[i].direction != 0) { AddLog_P(LOG_LEVEL_DEBUG, PSTR("SHT: Stop moving %d: dir: %d"), XdrvMailbox.index, Shutter[i].direction); - - int32_t temp_realpos = ShutterCalculatePosition(i); - XdrvMailbox.payload = ShutterRealToPercentPosition(temp_realpos, i)-Shutter[i].direction; - TasmotaGlobal.last_source = SRC_WEBGUI; - CmndShutterPosition(); - } else { - if (XdrvMailbox.command) - ResponseCmndDone(); - } + Shutter[i].target_position = Shutter[i].real_position; + } + if (XdrvMailbox.command) + ResponseCmndDone(); } else { if (XdrvMailbox.command) ResponseCmndIdxChar("Locked");