mirror of
https://github.com/arendst/Tasmota.git
synced 2025-04-24 23:07:17 +00:00
Merge pull request #7728 from s-hadinger/zigbee_persist_fix
Fix wrong encoding of Zigbee persistent data
This commit is contained in:
commit
48c02960d4
@ -7,6 +7,7 @@
|
||||
### 8.1.0.7 20200210
|
||||
|
||||
- Add new DHT driver. The old driver can still be used using define USE_DHT_OLD (#7468)
|
||||
- Fix wrong encoding of Zigbee persistent data
|
||||
|
||||
### 8.1.0.6 20200205
|
||||
|
||||
|
@ -138,7 +138,7 @@ private:
|
||||
static bool findInVector(const std::vector<T> & vecOfElements, const T & element);
|
||||
|
||||
template < typename T>
|
||||
static int32_t findEndpointInVector(const std::vector<T> & vecOfElements, const T & element);
|
||||
static int32_t findEndpointInVector(const std::vector<T> & vecOfElements, uint8_t element);
|
||||
|
||||
// find the first endpoint match for a cluster
|
||||
static int32_t findClusterEndpoint(const std::vector<uint32_t> & vecOfElements, uint16_t element);
|
||||
@ -180,12 +180,12 @@ bool Z_Devices::findInVector(const std::vector<T> & vecOfElements, const T & e
|
||||
}
|
||||
|
||||
template < typename T>
|
||||
int32_t Z_Devices::findEndpointInVector(const std::vector<T> & vecOfElements, const T & element) {
|
||||
int32_t Z_Devices::findEndpointInVector(const std::vector<T> & vecOfElements, uint8_t element) {
|
||||
// Find given element in vector
|
||||
|
||||
int32_t found = 0;
|
||||
for (auto &elem : vecOfElements) {
|
||||
if ((elem >> 16) & 0xFF == element) { return found; }
|
||||
if ( ((elem >> 16) & 0xFF) == element) { return found; }
|
||||
found++;
|
||||
}
|
||||
|
||||
@ -427,7 +427,7 @@ void Z_Devices::addEndoint(uint16_t shortaddr, uint8_t endpoint) {
|
||||
Z_Device &device = getShortAddr(shortaddr);
|
||||
if (&device == nullptr) { return; } // don't crash if not found
|
||||
_updateLastSeen(device);
|
||||
if (findEndpointInVector(device.endpoints, ep_profile) < 0) {
|
||||
if (findEndpointInVector(device.endpoints, endpoint) < 0) {
|
||||
device.endpoints.push_back(ep_profile);
|
||||
dirty();
|
||||
}
|
||||
@ -439,7 +439,7 @@ void Z_Devices::addEndointProfile(uint16_t shortaddr, uint8_t endpoint, uint16_t
|
||||
Z_Device &device = getShortAddr(shortaddr);
|
||||
if (&device == nullptr) { return; } // don't crash if not found
|
||||
_updateLastSeen(device);
|
||||
int32_t found = findEndpointInVector(device.endpoints, ep_profile);
|
||||
int32_t found = findEndpointInVector(device.endpoints, endpoint);
|
||||
if (found < 0) {
|
||||
device.endpoints.push_back(ep_profile);
|
||||
dirty();
|
||||
|
@ -31,7 +31,7 @@
|
||||
//
|
||||
// [Array of devices]
|
||||
// [Offset = 2]
|
||||
// uint8 - length of revice record
|
||||
// uint8 - length of device record
|
||||
// uint16 - short address
|
||||
// uint64 - long IEEE address
|
||||
// uint8 - number of endpoints
|
||||
@ -43,6 +43,7 @@
|
||||
//
|
||||
// str - ModelID (null terminated C string, 32 chars max)
|
||||
// str - Manuf (null terminated C string, 32 chars max)
|
||||
// str - FriendlyName (null terminated C string, 32 chars max)
|
||||
// reserved for extensions
|
||||
|
||||
// Memory footprint
|
||||
|
Loading…
x
Reference in New Issue
Block a user