Skip to content

Commit

Permalink
Merge branch 'development' into prerelease-12.4
Browse files Browse the repository at this point in the history
  • Loading branch information
arendst committed Feb 16, 2023
2 parents dafa28f + 8eb3879 commit fbbf8ff
Show file tree
Hide file tree
Showing 16 changed files with 582 additions and 33 deletions.
12 changes: 10 additions & 2 deletions CHANGELOG.md
Expand Up @@ -3,19 +3,27 @@ All notable changes to this project will be documented in this file.

## [Released]

## [12.4.0] 20230215
## [12.4.0] 20230216
- Release Peter

## [12.3.1.6] 20230215
## [12.3.1.6] 20230216
### Added
- ESP32 preliminary support for Matter protocol, milestone 1 (commissioning) by Stephan Hadinger
- Basic support for Shelly Pro 4PM
- Command ``DhtDelay<sensor> <high_delay>,<low_delay>`` to allow user control over high and low delay in microseconds (#17944)
- Berry `int64.fromstring()` to convert a string to an int64 (#17953)

### Breaking Changed
- TM1638 button and led support are handled as virtual switches and relays (#11031)

### Changed
- Dht driver from v6 to v7
- LVGL allow access to `lv.LAYOUT_GRID` and `lv.LAYOUT_FLEX` (#17948)
- TuyaMcu support of virtual switches

### Fixed
- ESP8266 Fix TLS SNI which would prevent AWS IoT connection (#17936)
- TuyaMcu exception 3 regression from v12.3.1.4

## [12.3.1.5] 20230208
### Added
Expand Down
5 changes: 5 additions & 0 deletions RELEASENOTES.md
Expand Up @@ -112,6 +112,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm

## Changelog v12.4.0 Peter
### Added
- Command ``DhtDelay<sensor> <high_delay>,<low_delay>`` to allow user control over high and low delay in microseconds [#17944](https://github.com/arendst/Tasmota/issues/17944)
- Support for up to 3 (ESP8266) or 8 (ESP32) phase modbus energy monitoring device using generic Energy Modbus driver
- Support for RGB displays [#17414](https://github.com/arendst/Tasmota/issues/17414)
- Support for IPv6 DNS records (AAAA) and IPv6 ``Ping`` for ESP32 and ESP8266 [#17417](https://github.com/arendst/Tasmota/issues/17417)
Expand All @@ -126,6 +127,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm
- Berry crypto add ``HKDF_HMAC_SHA256``
- Berry crypto add ``SPAKE2P_Matter`` for Matter support
- Berry add ``mdns`` advanced features and query
- Berry `int64.fromstring()` to convert a string to an int64 [#17953](https://github.com/arendst/Tasmota/issues/17953)
- ESP32 command ``EnergyCols 1..8`` to change number of GUI columns
- ESP32 command ``EnergyDisplay 1..3`` to change GUI column presentation
- ESP32 support for eigth energy phases/channels
Expand All @@ -137,13 +139,16 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm
- TM1638 button and led support are handled as virtual switches and relays [#11031](https://github.com/arendst/Tasmota/issues/11031)

### Changed
- Dht driver from v6 to v7
- ESP32 Framework (Core) from v2.0.5.3 to v2.0.6 (IPv6 support)
- Energy totals max supported value from +/-21474.83647 to +/-2147483.647 kWh
- Removed delays in TasmotaSerial and TasmotaModbus Tx enable switching
- Keep webserver enabled on command ``upload``
- Better support for virtual buttons and switches up to a total of 28
- TuyaMcu support of virtual switches
- Increase rule event buffer from 100 to 256 characters [#16943](https://github.com/arendst/Tasmota/issues/16943)
- Tasmota OTA scripts now support both unzipped and gzipped file uploads [#17378](https://github.com/arendst/Tasmota/issues/17378)
- LVGL allow access to `lv.LAYOUT_GRID` and `lv.LAYOUT_FLEX` [#17948](https://github.com/arendst/Tasmota/issues/17948)

### Fixed
- Modbus transmit enable GPIO enabled once during write buffer
Expand Down
10 changes: 10 additions & 0 deletions lib/libesp32/berry_int64/src/be_int64_class.c
Expand Up @@ -53,6 +53,15 @@ char* int64_tostring(int64_t *i64) {
}
BE_FUNC_CTYPE_DECLARE(int64_tostring, "s", ".")

int64_t* int64_fromstring(bvm *vm, const char* s) {
int64_t *i64 = (int64_t*)be_malloc(vm, sizeof(int64_t));
if (i64 == NULL) { be_raise(vm, "memory_error", "cannot allocate buffer"); }
if (s) { *i64 = atoll(s); }
else { *i64 = 0; }
return i64;
}
BE_FUNC_CTYPE_DECLARE(int64_fromstring, "int64", "@s")

int32_t int64_toint(int64_t *i64) {
return (int32_t) *i64;
}
Expand Down Expand Up @@ -190,6 +199,7 @@ class be_class_int64 (scope: global, name: int64) {
set, ctype_func(int64_set)
tostring, ctype_func(int64_tostring)
fromstring, static_ctype_func(int64_fromstring)
toint, ctype_func(int64_toint)
+, ctype_func(int64_add)
Expand Down
2 changes: 1 addition & 1 deletion lib/libesp32/berry_matter/src/embedded/Matter_Device.be
Expand Up @@ -545,7 +545,7 @@ class Matter_Device
var wifi = tasmota.wifi()
self.hostname_wifi = string.replace(wifi.find("mac"), ':', '')
mdns.add_hostname(self.hostname_wifi, wifi.find('ip6local',''), wifi.find('ip',''), wifi.find('ip6',''))
mdns.add_service("_matter", "_tcp", 5540, services, self.commissioning_instance_wifi, self.hostname_wifi)
mdns.add_service("_matterc", "_udp", 5540, services, self.commissioning_instance_wifi, self.hostname_wifi)

tasmota.log(string.format("MTR: starting mDNS on %s '%s' ptr to `%s.local`", is_eth ? "eth" : "wifi",
is_eth ? self.commissioning_instance_eth : self.commissioning_instance_wifi,
Expand Down
20 changes: 9 additions & 11 deletions lib/libesp32/berry_matter/src/solidify/solidified_Matter_Device.h
Expand Up @@ -1940,7 +1940,7 @@ be_local_closure(Matter_Device__start_mdns_announce, /* name */
0, /* has sup protos */
NULL, /* no sub protos */
1, /* has constants */
( &(const bvalue[50]) { /* constants */
( &(const bvalue[48]) { /* constants */
/* K0 */ be_nested_str_weak(mdns),
/* K1 */ be_nested_str_weak(string),
/* K2 */ be_nested_str_weak(start),
Expand Down Expand Up @@ -1986,11 +1986,9 @@ be_local_closure(Matter_Device__start_mdns_announce, /* name */
/* K42 */ be_nested_str_weak(_S),
/* K43 */ be_nested_str_weak(_V),
/* K44 */ be_nested_str_weak(_CM1),
/* K45 */ be_nested_str_weak(_matter),
/* K46 */ be_nested_str_weak(_tcp),
/* K47 */ be_nested_str_weak(MTR_X3A_X20Exception),
/* K48 */ be_nested_str_weak(_X7C),
/* K49 */ be_nested_str_weak(mdns_announce_op_discovery_all_sessions),
/* K45 */ be_nested_str_weak(MTR_X3A_X20Exception),
/* K46 */ be_nested_str_weak(_X7C),
/* K47 */ be_nested_str_weak(mdns_announce_op_discovery_all_sessions),
}),
be_str_weak(_start_mdns_announce),
&be_const_str_solidified,
Expand Down Expand Up @@ -2170,8 +2168,8 @@ be_local_closure(Matter_Device__start_mdns_announce, /* name */
0x7C2C0600, // 00AC CALL R11 3
0x7C180A00, // 00AD CALL R6 5
0x8C18051B, // 00AE GETMET R6 R2 K27
0x5820002D, // 00AF LDCONST R8 K45
0x5824002E, // 00B0 LDCONST R9 K46
0x5820001C, // 00AF LDCONST R8 K28
0x5824001D, // 00B0 LDCONST R9 K29
0x542A15A3, // 00B1 LDINT R10 5540
0x5C2C0800, // 00B2 MOVE R11 R4
0x88300123, // 00B3 GETMBR R12 R0 K35
Expand Down Expand Up @@ -2274,8 +2272,8 @@ be_local_closure(Matter_Device__start_mdns_announce, /* name */
0x60240008, // 0114 GETGBL R9 G8
0x5C280A00, // 0115 MOVE R10 R5
0x7C240200, // 0116 CALL R9 1
0x00265E09, // 0117 ADD R9 K47 R9
0x00241330, // 0118 ADD R9 R9 K48
0x00265A09, // 0117 ADD R9 K45 R9
0x0024132E, // 0118 ADD R9 R9 K46
0x60280008, // 0119 GETGBL R10 G8
0x5C2C0C00, // 011A MOVE R11 R6
0x7C280200, // 011B CALL R10 1
Expand All @@ -2284,7 +2282,7 @@ be_local_closure(Matter_Device__start_mdns_announce, /* name */
0x7C1C0600, // 011E CALL R7 3
0x70020000, // 011F JMP #0121
0xB0080000, // 0120 RAISE 2 R0 R0
0x8C140131, // 0121 GETMET R5 R0 K49
0x8C14012F, // 0121 GETMET R5 R0 K47
0x7C140200, // 0122 CALL R5 1
0x80000000, // 0123 RET 0
})
Expand Down
8 changes: 7 additions & 1 deletion lib/libesp32_lvgl/lv_binding_berry/generate/be_lvgl_module.c
Expand Up @@ -8,15 +8,19 @@

#include "lvgl.h"
#include "be_mapping.h"
#include "be_ctypes.h"
#include "lv_berry.h"
#include "lv_theme_haspmota.h"

// declare accessors for non-const ints
int32_t be_LV_LAYOUT_GRID(void) { return LV_LAYOUT_GRID; }; BE_VAR_CTYPE_DECLARE(be_LV_LAYOUT_GRID, "i");
int32_t be_LV_LAYOUT_FLEX(void) { return LV_LAYOUT_FLEX; }; BE_VAR_CTYPE_DECLARE(be_LV_LAYOUT_FLEX, "i");

extern int lv0_member(bvm *vm); // resolve virtual members
extern int lv0_load_font(bvm *vm);

extern lv_ts_calibration_t * lv_get_ts_calibration(void);


static int lv_get_hor_res(void) {
return lv_disp_get_hor_res(lv_disp_get_default());
}
Expand Down Expand Up @@ -502,6 +506,8 @@ const be_const_member_t lv0_constants[] = {
{ "LAYER_TYPE_NONE", be_cconst_int(LV_LAYER_TYPE_NONE) },
{ "LAYER_TYPE_SIMPLE", be_cconst_int(LV_LAYER_TYPE_SIMPLE) },
{ "LAYER_TYPE_TRANSFORM", be_cconst_int(LV_LAYER_TYPE_TRANSFORM) },
{ ">LAYOUT_FLEX", be_ctype(be_LV_LAYOUT_FLEX) },
{ ">LAYOUT_GRID", be_ctype(be_LV_LAYOUT_GRID) },
{ "LED_DRAW_PART_RECTANGLE", be_cconst_int(LV_LED_DRAW_PART_RECTANGLE) },
{ "LOG_LEVEL_ERROR", be_cconst_int(LV_LOG_LEVEL_ERROR) },
{ "LOG_LEVEL_INFO", be_cconst_int(LV_LOG_LEVEL_INFO) },
Expand Down
2 changes: 2 additions & 0 deletions lib/libesp32_lvgl/lv_binding_berry/mapping/lv_enum.h
Expand Up @@ -12,6 +12,8 @@ anim_path_ease_out=&lv_anim_path_ease_out
anim_path_linear=&lv_anim_path_linear
anim_path_overshoot=&lv_anim_path_overshoot
anim_path_step=&lv_anim_path_step
LV_LAYOUT_GRID=>be_LV_LAYOUT_GRID
LV_LAYOUT_FLEX=>be_LV_LAYOUT_FLEX

// ======================================================================
// Colors
Expand Down
Expand Up @@ -49,6 +49,8 @@ be_local_closure(lv_extra__anonymous_, /* name */
/*******************************************************************/


extern const bclass be_class_lv_coord_arr;

/********************************************************************
** Solidified function: init
********************************************************************/
Expand Down Expand Up @@ -217,6 +219,8 @@ be_local_class(lv_coord_arr,
be_str_weak(lv_coord_arr)
);

extern const bclass be_class_lv_point_arr;

/********************************************************************
** Solidified function: init
********************************************************************/
Expand Down Expand Up @@ -319,6 +323,8 @@ be_local_class(lv_point_arr,
be_str_weak(lv_point_arr)
);

extern const bclass be_class_lv_style_prop_arr;

/********************************************************************
** Solidified function: init
********************************************************************/
Expand Down
Expand Up @@ -4,6 +4,8 @@
\********************************************************************/
#include "be_constobj.h"

extern const bclass be_class_LVGL_glob;

/********************************************************************
** Solidified function: get_object_from_ptr
********************************************************************/
Expand Down
7 changes: 6 additions & 1 deletion lib/libesp32_lvgl/lv_binding_berry/tools/convert.py
Expand Up @@ -718,15 +718,19 @@ class be_class_lv_{subtype} (scope: global, name: lv_{subtype}, super: be_class_
#include "lvgl.h"
#include "be_mapping.h"
#include "be_ctypes.h"
#include "lv_berry.h"
#include "lv_theme_haspmota.h"
// declare accessors for non-const ints
int32_t be_LV_LAYOUT_GRID(void) { return LV_LAYOUT_GRID; }; BE_VAR_CTYPE_DECLARE(be_LV_LAYOUT_GRID, "i");
int32_t be_LV_LAYOUT_FLEX(void) { return LV_LAYOUT_FLEX; }; BE_VAR_CTYPE_DECLARE(be_LV_LAYOUT_FLEX, "i");
extern int lv0_member(bvm *vm); // resolve virtual members
extern int lv0_load_font(bvm *vm);
extern lv_ts_calibration_t * lv_get_ts_calibration(void);
static int lv_get_hor_res(void) {
return lv_disp_get_hor_res(lv_disp_get_default());
}
Expand Down Expand Up @@ -810,6 +814,7 @@ class be_class_lv_{subtype} (scope: global, name: lv_{subtype}, super: be_class_
if v[0] == '"': v_prefix = "$"; v_macro = "be_cconst_string"
if v[0] == '&': v_prefix = "&"; v_macro = "be_cconst_ptr"
if v[0] == '@': v_prefix = "@"; v_macro = "be_cconst_ptr"; v = "&" + v[1:]
if v[0] == '>': v_prefix = ">"; v_macro = "be_ctype"; v = v[1:]
print(f" {{ \"{v_prefix}{k}\", {v_macro}({v}) }},")
else:
print(f" {{ \"{k}\", be_cconst_int(LV_{k}) }},")
Expand Down
2 changes: 2 additions & 0 deletions lib/libesp32_lvgl/lv_binding_berry/tools/preprocessor.py
Expand Up @@ -213,6 +213,8 @@ def clean_source(raw):
anim_path_linear=&lv_anim_path_linear
anim_path_overshoot=&lv_anim_path_overshoot
anim_path_step=&lv_anim_path_step
LV_LAYOUT_GRID=>be_LV_LAYOUT_GRID
LV_LAYOUT_FLEX=>be_LV_LAYOUT_FLEX
// ======================================================================
// Colors
Expand Down
24 changes: 14 additions & 10 deletions tasmota/tasmota_support/support_switch_v4.ino
Expand Up @@ -74,23 +74,27 @@ void SwitchSetVirtualPinState(uint32_t index, uint32_t state) {
bitWrite(Switch.virtual_pin, index, state);
}

void SwitchSetState(uint32_t index, uint32_t state) {
// Set debounced pin state to be used by late detected switches
if (!bitRead(Switch.used, index)) {
bitSet(Switch.used, index);
AddLog(LOG_LEVEL_DEBUG, PSTR("SWT: Add vSwitch%d, State %d"), index +1, state);
}
Switch.debounced_state[index] = state;
uint8_t SwitchLastState(uint32_t index) {
// Get last state
return Switch.last_state[index];
}

uint8_t SwitchGetState(uint32_t index) {
// Get current state
return Switch.debounced_state[index];
}

uint8_t SwitchLastState(uint32_t index) {
// Get last state
return Switch.last_state[index];
void SwitchSetState(uint32_t index, uint32_t state) {
// Set debounced pin state to be used by late detected switches
if (!bitRead(Switch.used, index)) {
for (uint32_t i = 0; i <= index; i++) {
if (!bitRead(Switch.used, i)) {
bitSet(Switch.used, i);
AddLog(LOG_LEVEL_DEBUG, PSTR("SWT: Add vSwitch%d, State %d"), i +1, Switch.debounced_state[i]);
}
}
}
Switch.debounced_state[index] = state;
}

/*------------------------------------------------------------------------------------------*/
Expand Down
16 changes: 13 additions & 3 deletions tasmota/tasmota_xdrv_driver/xdrv_16_tuyamcu_v1.ino
Expand Up @@ -848,10 +848,11 @@ void TuyaProcessStatePacket(void) {
if (Tuya.buffer[dpidStart + 4]) { PowerOff = true; }
}
} else if (fnId >= TUYA_MCU_FUNC_SWT1 && fnId <= TUYA_MCU_FUNC_SWT4) {
uint32_t switch_state = SwitchGetState(fnId - TUYA_MCU_FUNC_SWT1);
AddLog(LOG_LEVEL_DEBUG, PSTR("TYA: RX Switch-%d --> MCU State: %d Current State:%d"),fnId - TUYA_MCU_FUNC_SWT1 + 1,Tuya.buffer[dpidStart + 4], switch_state);
uint32_t switch_index = fnId - TUYA_MCU_FUNC_SWT1;
uint32_t switch_state = SwitchGetState(switch_index);
AddLog(LOG_LEVEL_DEBUG, PSTR("TYA: RX Switch-%d --> MCU State: %d Current State:%d"), switch_index +1, Tuya.buffer[dpidStart + 4], switch_state);
if (switch_state != Tuya.buffer[dpidStart + 4]) {
SwitchSetState(fnId - TUYA_MCU_FUNC_SWT1, Tuya.buffer[dpidStart + 4]);
SwitchSetState(switch_index, Tuya.buffer[dpidStart + 4]);
}
}
if (PowerOff) { Tuya.ignore_dimmer_cmd_timeout = millis() + 250; }
Expand Down Expand Up @@ -1333,12 +1334,21 @@ void TuyaSerialInput(void)
ResponseAppend_P(PSTR("}}"));

if (Settings->flag3.tuya_serial_mqtt_publish) { // SetOption66 - Enable TuyaMcuReceived messages over Mqtt
/*
for (uint8_t cmdsID = 0; sizeof(TuyaExcludeCMDsFromMQTT) > cmdsID; cmdsID++){
if (TuyaExcludeCMDsFromMQTT[cmdsID] == Tuya.buffer[3]) {
isCmdToSuppress = true;
break;
}
}
*/
for (uint8_t cmdsID = 0; cmdsID < sizeof(TuyaExcludeCMDsFromMQTT); cmdsID++) {
if (pgm_read_byte(TuyaExcludeCMDsFromMQTT +cmdsID) == Tuya.buffer[3]) {
isCmdToSuppress = true;
break;
}
}

if (!(isCmdToSuppress && Settings->flag5.tuya_exclude_from_mqtt)) { // SetOption137 - (Tuya) When Set, avoid the (MQTT-) publish of defined Tuya CMDs (see TuyaExcludeCMDsFromMQTT) if SetOption66 is active
MqttPublishPrefixTopic_P(RESULT_OR_TELE, PSTR(D_JSON_TUYA_MCU_RECEIVED));
} else {
Expand Down
16 changes: 13 additions & 3 deletions tasmota/tasmota_xdrv_driver/xdrv_16_tuyamcu_v2.ino
Expand Up @@ -1639,10 +1639,11 @@ void TuyaProcessRxedDP(uint8_t dpid, uint8_t type, uint8_t *data, int dpDataLen)
if (value) { PowerOff = true; }
}
} else if (fnId >= TUYA_MCU_FUNC_SWT1 && fnId <= TUYA_MCU_FUNC_SWT4) {
uint32_t switch_state = SwitchGetState(fnId - TUYA_MCU_FUNC_SWT1);
AddLog(LOG_LEVEL_DEBUG, PSTR("T:fn%d Switch%d --> M%d T%d"),fnId, fnId - TUYA_MCU_FUNC_SWT1 + 1, value, switch_state);
uint32_t switch_index = fnId - TUYA_MCU_FUNC_SWT1;
uint32_t switch_state = SwitchGetState(switch_index);
AddLog(LOG_LEVEL_DEBUG, PSTR("T:fn%d Switch%d --> M%d T%d"), fnId, switch_index +1, value, switch_state);
if (switch_state != value) {
SwitchSetState(fnId - TUYA_MCU_FUNC_SWT1, value);
SwitchSetState(switch_index, value);
}
}
//if (PowerOff) { pTuya->ignore_dimmer_cmd_timeout = millis() + 250; }
Expand Down Expand Up @@ -2119,12 +2120,21 @@ void TuyaProcessCommand(unsigned char *buffer){

// SetOption66 - Enable TuyaMcuReceived messages over Mqtt
if (Settings->flag3.tuya_serial_mqtt_publish) {
/*
for (uint8_t cmdsID = 0; sizeof(TuyaExcludeCMDsFromMQTT) > cmdsID; cmdsID++){
if (TuyaExcludeCMDsFromMQTT[cmdsID] == cmd) {
isCmdToSuppress = true;
break;
}
}
*/
for (uint8_t cmdsID = 0; cmdsID < sizeof(TuyaExcludeCMDsFromMQTT); cmdsID++) {
if (pgm_read_byte(TuyaExcludeCMDsFromMQTT +cmdsID) == Tuya.buffer[3]) {
isCmdToSuppress = true;
break;
}
}

// SetOption137 - (Tuya) When Set, avoid the (MQTT-) publish of defined Tuya CMDs
// (see TuyaExcludeCMDsFromMQTT) if SetOption66 is active
if (!(isCmdToSuppress && Settings->flag5.tuya_exclude_from_mqtt)) {
Expand Down
2 changes: 1 addition & 1 deletion tasmota/tasmota_xsns_sensor/xsns_06_dht_v6.ino
Expand Up @@ -6,7 +6,7 @@
SPDX-License-Identifier: GPL-3.0-only
*/

#ifdef USE_DHT
#ifdef USE_DHT_V6
/*********************************************************************************************\
* DHT11, AM2301 (DHT21, DHT22, AM2302, AM2321), SI7021, THS01, MS01 - Temperature and Humidity
*
Expand Down

0 comments on commit fbbf8ff

Please sign in to comment.