Merge branch 'arendst:development' into development

This commit is contained in:
mikep1998 2021-05-17 10:29:03 -07:00
commit 1705d3fdcb
5 changed files with 50 additions and 28 deletions

View File

@ -12,7 +12,7 @@ build_flags = ${common.build_flags}
[core_stage]
; *** Esp8266 core for Arduino version stage
platform_packages = framework-arduinoespressif8266 @ https://github.com/esp8266/Arduino.git
platform_packages = framework-arduinoespressif8266 @ https://github.com/esp8266/Arduino/releases/download/3.0.0/esp8266-3.0.0.zip
; *** Use Xtensa build chain 10.2. GNU23 from https://github.com/earlephilhower/esp-quick-toolchain
tasmota/toolchain-xtensa @ 5.100200.210303
build_unflags = ${esp_defaults.build_unflags}

View File

@ -0,0 +1,22 @@
:H,ST7789,240,320,16,SPI,1,22,19,23,21,5,18,25,40
:S,2,1,3,0,80,30
:I
01,A0
11,A0
3A,81,55
36,81,00
21,80
13,80
29,A0
:o,28
:O,29
:A,2A,2B,2C
:B,60,1
:R,36
:0,C0,00,00,00
:1,A0,00,00,01
:2,00,00,00,02
:3,60,00,00,03
:i,20,21
:TI1,38,0,4
#

View File

@ -535,6 +535,24 @@ char* Trim(char* p)
return p;
}
String HexToString(uint8_t* data, uint32_t length) {
if (!data || !length) { return ""; }
uint32_t len = (length < 16) ? length : 16;
char hex_data[32];
ToHex_P((const unsigned char*)data, len, hex_data, sizeof(hex_data));
String result = hex_data;
result += F(" [");
for (uint32_t i = 0; i < len; i++) {
result += (isprint(data[i])) ? (char)data[i] : ' ';
}
result += F("]");
if (length > len) {
result += F(" ...");
}
return result;
}
String UrlEncode(const String& text) {
const char hex[] = "0123456789ABCDEF";
@ -567,25 +585,6 @@ String UrlEncode(const String& text) {
return encoded;
}
/*
char* RemoveAllSpaces(char* p)
{
// remove any white space from the base64
char *cursor = p;
uint32_t offset = 0;
while (1) {
*cursor = *(cursor + offset);
if ((' ' == *cursor) || ('\t' == *cursor) || ('\n' == *cursor)) { // if space found, remove this char until end of string
offset++;
} else {
if (0 == *cursor) { break; }
cursor++;
}
}
return p;
}
*/
char* NoAlNumToUnderscore(char* dest, const char* source)
{
char* write = dest;
@ -2405,9 +2404,6 @@ void AddLogSpi(bool hardware, uint32_t clk, uint32_t mosi, uint32_t miso) {
}
}
/*********************************************************************************************\
* Uncompress static PROGMEM strings
\*********************************************************************************************/

View File

@ -241,7 +241,7 @@ void CommandHandler(char* topicBuf, char* dataBuf, uint32_t data_len)
}
AddLog_P(LOG_LEVEL_DEBUG, PSTR("CMD: " D_GROUP " %d, " D_INDEX " %d, " D_COMMAND " \"%s\", " D_DATA " \"%s\""),
grpflg, index, type, (binary_data) ? PSTR("Binary") : dataBuf);
grpflg, index, type, (binary_data) ? HexToString((uint8_t*)dataBuf, data_len).c_str() : dataBuf);
if (type != nullptr) {
Response_P(PSTR("{\"" D_JSON_COMMAND "\":\"" D_JSON_ERROR "\"}"));
@ -642,10 +642,6 @@ void CmndStatus(void)
}
#endif
#ifdef USE_SCRIPT_STATUS
if (bitRead(Settings.rule_enabled, 0)) { Run_Scripter(">U", 2, TasmotaGlobal.mqtt_data); }
#endif
ResponseClear();
}

View File

@ -8410,7 +8410,15 @@ bool Xdrv10(uint8_t function)
break;
case FUNC_RULES_PROCESS:
if (bitRead(Settings.rule_enabled, 0)) {
#ifdef USE_SCRIPT_STATUS
if (!strncmp_P(TasmotaGlobal.mqtt_data, PSTR("{\"Status"), 8)) {
Run_Scripter(">U", 2, TasmotaGlobal.mqtt_data);
} else {
Run_Scripter(">E", 2, TasmotaGlobal.mqtt_data);
}
#else
Run_Scripter(">E", 2, TasmotaGlobal.mqtt_data);
#endif
result = glob_script_mem.event_handeled;
}
break;