mirror of
https://github.com/Koenkk/Z-Stack-firmware.git
synced 2024-11-22 10:05:11 +01:00
Z-Stack_Home_1.2 20211115/20211116
This commit is contained in:
parent
eb674e838c
commit
cf267a08b7
@ -1,3 +1,10 @@
|
||||
# 20211115/20211116
|
||||
- Fix joining not working when joining is only permitted on specific router
|
||||
- Forward message to host even when profileID does not match
|
||||
- Turn on/off leds when joining is enabled/disabled
|
||||
- Fix CC2530 crashing when sending large messages via UART
|
||||
- Fix Xiaomi E1 devices not (fully) working
|
||||
|
||||
# 20201127/20201128
|
||||
- Fix join failing after some uptime
|
||||
- Support PGC410EU
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,23 +1,66 @@
|
||||
From 79b43ef6bb5d3ab40e60c26f1419ba6143559d48 Mon Sep 17 00:00:00 2001
|
||||
From fc5c41b902bc7171f8be1b89dcf79bc85d0ad91e Mon Sep 17 00:00:00 2001
|
||||
From: Koen Kanters <koenkanters94@gmail.com>
|
||||
Date: Tue, 28 Jul 2020 19:39:55 +0200
|
||||
Subject: [PATCH 1/1] Own changes
|
||||
|
||||
---
|
||||
Components/hal/include/hal_led.h | 1 +
|
||||
Components/hal/target/CC2530USB/hal_led.c | 6 +
|
||||
.../hal/target/CC2530ZNP/hal_board_cfg.h | 6 +-
|
||||
Components/hal/target/CC2530ZNP/hal_led.c | 6 +
|
||||
Components/mt/MT_SYS.c | 16 +++
|
||||
Components/mt/MT_UTIL.c | 2 +
|
||||
Components/mt/MT_ZDO.c | 8 ++
|
||||
Components/mt/revision_info.h | 1 +
|
||||
Components/stack/af/AF.c | 26 +++-
|
||||
Components/stack/zdo/ZDApp.c | 10 +-
|
||||
Components/stack/zdo/ZDSecMgr.c | 17 +++
|
||||
Components/stack/zdo/ZDObject.c | 14 ++
|
||||
Components/stack/zdo/ZDSecMgr.c | 21 +++
|
||||
Projects/zstack/ZMain/TI2530ZNP/OnBoard.c | 9 ++
|
||||
.../zstack/ZNP/CC253x/Source/preinclude.h | 123 ++++++++++++++++++
|
||||
Projects/zstack/ZMain/TI2530ZNP/OnBoard.h | 4 +-
|
||||
.../zstack/ZNP/CC253x/Source/preinclude.h | 126 ++++++++++++++++++
|
||||
Projects/zstack/ZNP/Source/znp.cfg | 4 +-
|
||||
Projects/zstack/ZNP/Source/znp_app.c | 22 +++-
|
||||
10 files changed, 223 insertions(+), 11 deletions(-)
|
||||
Projects/zstack/ZNP/Source/znp_app.c | 22 ++-
|
||||
17 files changed, 269 insertions(+), 13 deletions(-)
|
||||
create mode 100644 Components/mt/revision_info.h
|
||||
create mode 100644 Projects/zstack/ZNP/CC253x/Source/preinclude.h
|
||||
|
||||
diff --git a/Components/hal/include/hal_led.h b/Components/hal/include/hal_led.h
|
||||
index 217b8bf..ff0ce2f 100644
|
||||
--- a/Components/hal/include/hal_led.h
|
||||
+++ b/Components/hal/include/hal_led.h
|
||||
@@ -71,6 +71,7 @@ extern "C"
|
||||
#define HAL_LED_MODE_BLINK 0x02
|
||||
#define HAL_LED_MODE_FLASH 0x04
|
||||
#define HAL_LED_MODE_TOGGLE 0x08
|
||||
+#define HAL_LED_MODE_DISABLE 0x10
|
||||
|
||||
/* Defaults */
|
||||
#define HAL_LED_DEFAULT_MAX_LEDS 4
|
||||
diff --git a/Components/hal/target/CC2530USB/hal_led.c b/Components/hal/target/CC2530USB/hal_led.c
|
||||
index 2471fb7..4c14e58 100644
|
||||
--- a/Components/hal/target/CC2530USB/hal_led.c
|
||||
+++ b/Components/hal/target/CC2530USB/hal_led.c
|
||||
@@ -81,6 +81,7 @@ typedef struct
|
||||
|
||||
|
||||
static uint8 HalLedState; // LED state at last set/clr/blink update
|
||||
+static bool LedsDisabled;
|
||||
|
||||
#if HAL_LED == TRUE
|
||||
static uint8 HalSleepLedState; // LED state at last set/clr/blink update
|
||||
@@ -136,6 +137,11 @@ void HalLedInit (void)
|
||||
***************************************************************************************************/
|
||||
uint8 HalLedSet (uint8 leds, uint8 mode)
|
||||
{
|
||||
+ if (LedsDisabled == true) return ( HalLedState );
|
||||
+ if (mode == HAL_LED_MODE_DISABLE) {
|
||||
+ LedsDisabled = true;
|
||||
+ mode = HAL_LED_MODE_OFF;
|
||||
+ }
|
||||
|
||||
#if (defined (BLINK_LEDS)) && (HAL_LED == TRUE)
|
||||
uint8 led;
|
||||
diff --git a/Components/hal/target/CC2530ZNP/hal_board_cfg.h b/Components/hal/target/CC2530ZNP/hal_board_cfg.h
|
||||
index 0459c86..1e40362 100644
|
||||
--- a/Components/hal/target/CC2530ZNP/hal_board_cfg.h
|
||||
@ -49,6 +92,30 @@ index 0459c86..1e40362 100644
|
||||
|
||||
#ifdef HAL_ENABLE_WIFI_COEX_PINS
|
||||
#define HAL_BOARD_ENABLE_WIFI_COEX_PINS() st \
|
||||
diff --git a/Components/hal/target/CC2530ZNP/hal_led.c b/Components/hal/target/CC2530ZNP/hal_led.c
|
||||
index 2471fb7..4c14e58 100644
|
||||
--- a/Components/hal/target/CC2530ZNP/hal_led.c
|
||||
+++ b/Components/hal/target/CC2530ZNP/hal_led.c
|
||||
@@ -81,6 +81,7 @@ typedef struct
|
||||
|
||||
|
||||
static uint8 HalLedState; // LED state at last set/clr/blink update
|
||||
+static bool LedsDisabled;
|
||||
|
||||
#if HAL_LED == TRUE
|
||||
static uint8 HalSleepLedState; // LED state at last set/clr/blink update
|
||||
@@ -136,6 +137,11 @@ void HalLedInit (void)
|
||||
***************************************************************************************************/
|
||||
uint8 HalLedSet (uint8 leds, uint8 mode)
|
||||
{
|
||||
+ if (LedsDisabled == true) return ( HalLedState );
|
||||
+ if (mode == HAL_LED_MODE_DISABLE) {
|
||||
+ LedsDisabled = true;
|
||||
+ mode = HAL_LED_MODE_OFF;
|
||||
+ }
|
||||
|
||||
#if (defined (BLINK_LEDS)) && (HAL_LED == TRUE)
|
||||
uint8 led;
|
||||
diff --git a/Components/mt/MT_SYS.c b/Components/mt/MT_SYS.c
|
||||
index 35aae57..1f8ee82 100644
|
||||
--- a/Components/mt/MT_SYS.c
|
||||
@ -83,15 +150,62 @@ index 35aae57..1f8ee82 100644
|
||||
}
|
||||
#endif
|
||||
|
||||
diff --git a/Components/mt/MT_UTIL.c b/Components/mt/MT_UTIL.c
|
||||
index bc5ba4a..338ed3b 100644
|
||||
--- a/Components/mt/MT_UTIL.c
|
||||
+++ b/Components/mt/MT_UTIL.c
|
||||
@@ -935,6 +935,8 @@ static void MT_UtilLedControl(uint8 *pBuf)
|
||||
Mode = HAL_LED_MODE_FLASH;
|
||||
else if ( iMode == 4 )
|
||||
Mode = HAL_LED_MODE_TOGGLE;
|
||||
+ else if ( iMode == 5 )
|
||||
+ Mode = HAL_LED_MODE_DISABLE;
|
||||
else
|
||||
Led = 0;
|
||||
|
||||
diff --git a/Components/mt/MT_ZDO.c b/Components/mt/MT_ZDO.c
|
||||
index d43d7c0..db8d264 100644
|
||||
--- a/Components/mt/MT_ZDO.c
|
||||
+++ b/Components/mt/MT_ZDO.c
|
||||
@@ -54,6 +54,7 @@
|
||||
#include "ZDApp.h"
|
||||
#include "OnBoard.h"
|
||||
#include "aps_groups.h"
|
||||
+#include "hal_led.h"
|
||||
|
||||
#if defined ( MT_ZDO_EXTENSIONS )
|
||||
#include "rtg.h"
|
||||
@@ -1626,6 +1627,11 @@ static void MT_ZdoMgmtPermitJoinRequest(uint8 *pBuf)
|
||||
ignoreIndication = TRUE;
|
||||
retValue = (uint8)ZDP_MgmtPermitJoinReq( &destAddr, duration, tcSignificance, 0);
|
||||
ignoreIndication = FALSE;
|
||||
+
|
||||
+ // If joining is enabled via a router, ZDO_ProcessMgmtPermitJoinReq is never triggered thus
|
||||
+ // ZDSecMgrPermitJoining is never called. Joining via a router would always fail now since
|
||||
+ // ZDSecMgrPermitJoiningEnabled in zd_sec_mgr.c stays FALSE
|
||||
+ ZDSecMgrPermitJoining(duration);
|
||||
|
||||
MT_BuildAndSendZToolResponse(((uint8)MT_RPC_CMD_SRSP | (uint8)MT_RPC_SYS_ZDO), cmdId, 1, &retValue);
|
||||
}
|
||||
@@ -1812,6 +1818,8 @@ static void MT_ZdoStartupFromApp(uint8 *pBuf)
|
||||
|
||||
retValue = ZDOInitDevice(100);
|
||||
|
||||
+ HalLedSet(HAL_LED_3, HAL_LED_MODE_OFF);
|
||||
+
|
||||
if (MT_RPC_CMD_SREQ == (cmd0 & MT_RPC_CMD_TYPE_MASK))
|
||||
{
|
||||
MT_BuildAndSendZToolResponse(((uint8)MT_RPC_CMD_SRSP|(uint8)MT_RPC_SYS_ZDO), cmd1,1, &retValue);
|
||||
diff --git a/Components/mt/revision_info.h b/Components/mt/revision_info.h
|
||||
new file mode 100644
|
||||
index 0000000..f9343d6
|
||||
index 0000000..eb5b07c
|
||||
--- /dev/null
|
||||
+++ b/Components/mt/revision_info.h
|
||||
@@ -0,0 +1 @@
|
||||
+#define CODE_REVISION_NUMBER 20201128
|
||||
+#define CODE_REVISION_NUMBER 20211115
|
||||
\ No newline at end of file
|
||||
diff --git a/Components/stack/af/AF.c b/Components/stack/af/AF.c
|
||||
index c6183b6..128b194 100644
|
||||
index c6183b6..dbcda1e 100644
|
||||
--- a/Components/stack/af/AF.c
|
||||
+++ b/Components/stack/af/AF.c
|
||||
@@ -372,10 +372,18 @@ void afIncomingData( aps_FrameFormat_t *aff, zAddrType_t *SrcAddress, uint16 Src
|
||||
@ -136,8 +250,8 @@ index c6183b6..128b194 100644
|
||||
((epDesc->endPoint == ZDO_EP) && (aff->ProfileID == ZDO_PROFILE_ID)) ||
|
||||
- ((epDesc->endPoint != ZDO_EP) && ( aff->ProfileID == ZDO_WILDCARD_PROFILE_ID )) )
|
||||
+ ((epDesc->endPoint != ZDO_EP) && ( aff->ProfileID == ZDO_WILDCARD_PROFILE_ID )) ||
|
||||
+ // Fix below is to support PGC410EU: https://github.com/Koenkk/zigbee2mqtt/issues/4055
|
||||
+ ((epDesc->endPoint == 2) && ( aff->ProfileID == 0xFC01 )) )
|
||||
+ // Forward messages to endpoint even with profileID mismatches
|
||||
+ ((aff->ProfileID >= 0x100) && (aff->ProfileID <= 0xFC01)) )
|
||||
{
|
||||
// Save original endpoint
|
||||
uint8 endpoint = aff->DstEndPoint;
|
||||
@ -169,8 +283,33 @@ index 242be04..cfad5e9 100644
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
diff --git a/Components/stack/zdo/ZDObject.c b/Components/stack/zdo/ZDObject.c
|
||||
index 24bc9c3..bb4d3cb 100644
|
||||
--- a/Components/stack/zdo/ZDObject.c
|
||||
+++ b/Components/stack/zdo/ZDObject.c
|
||||
@@ -644,6 +644,20 @@ void ZDO_ProcessNodeDescReq( zdoIncomingMsg_t *inMsg )
|
||||
|
||||
if ( desc != NULL )
|
||||
{
|
||||
+ uint8 extAddr[Z_EXTADDR_LEN];
|
||||
+ // Respond with Xiaomi manufacturer code when ieeAddr is withing Xiaomi address space
|
||||
+ // Otherwise some devices don't work
|
||||
+ // https://github.com/Koenkk/zigbee2mqtt/issues/9274
|
||||
+ if (APSME_LookupExtAddr(inMsg->srcAddr.addr.shortAddr, extAddr) == TRUE &&
|
||||
+ ((extAddr[7] == 0x04 && extAddr[6] == 0xcf && extAddr[5] == 0x8c) ||
|
||||
+ (extAddr[7] == 0x54 && extAddr[6] == 0xef && extAddr[5] == 0x44))) {
|
||||
+ desc->ManufacturerCode[0] = 0x5f;
|
||||
+ desc->ManufacturerCode[1] = 0x11;
|
||||
+ } else {
|
||||
+ desc->ManufacturerCode[0] = 0x0;
|
||||
+ desc->ManufacturerCode[1] = 0x0;
|
||||
+ }
|
||||
+
|
||||
ZDP_NodeDescMsg( inMsg, aoi, desc );
|
||||
}
|
||||
else
|
||||
diff --git a/Components/stack/zdo/ZDSecMgr.c b/Components/stack/zdo/ZDSecMgr.c
|
||||
index 2eacc11..a910a06 100644
|
||||
index 2eacc11..0c8a07c 100644
|
||||
--- a/Components/stack/zdo/ZDSecMgr.c
|
||||
+++ b/Components/stack/zdo/ZDSecMgr.c
|
||||
@@ -42,6 +42,8 @@ extern "C"
|
||||
@ -182,7 +321,15 @@ index 2eacc11..a910a06 100644
|
||||
/******************************************************************************
|
||||
* INCLUDES
|
||||
*/
|
||||
@@ -1114,14 +1116,22 @@ ZStatus_t ZDSecMgrDeviceJoin( ZDSecMgrDevice_t* device )
|
||||
@@ -58,6 +60,7 @@ extern "C"
|
||||
#include "APSMEDE.h"
|
||||
#include "ZDConfig.h"
|
||||
#include "ZDSecMgr.h"
|
||||
+#include "hal_led.h"
|
||||
|
||||
/******************************************************************************
|
||||
* CONSTANTS
|
||||
@@ -1114,14 +1117,22 @@ ZStatus_t ZDSecMgrDeviceJoin( ZDSecMgrDevice_t* device )
|
||||
ZStatus_t status = ZSuccess;
|
||||
uint16 ami;
|
||||
|
||||
@ -205,7 +352,7 @@ index 2eacc11..a910a06 100644
|
||||
// Add the device to the address manager
|
||||
ZDSecMgrAddrStore( device->nwkAddr, device->extAddr, &ami );
|
||||
|
||||
@@ -1129,18 +1139,25 @@ ZStatus_t ZDSecMgrDeviceJoin( ZDSecMgrDevice_t* device )
|
||||
@@ -1129,18 +1140,25 @@ ZStatus_t ZDSecMgrDeviceJoin( ZDSecMgrDevice_t* device )
|
||||
if ( ( device->devStatus & DEV_SEC_INIT_STATUS ) &&
|
||||
( device->secure == FALSE ) )
|
||||
{
|
||||
@ -231,6 +378,23 @@ index 2eacc11..a910a06 100644
|
||||
// not allowed or transport key failed, remove the device
|
||||
ZDSecMgrDeviceRemove( device );
|
||||
}
|
||||
@@ -1504,6 +1522,8 @@ uint8 ZDSecMgrPermitJoining( uint8 duration )
|
||||
ZDSecMgrPermitJoiningEnabled = FALSE;
|
||||
}
|
||||
|
||||
+ HalLedSet(HAL_LED_3, ZDSecMgrPermitJoiningEnabled ? HAL_LED_MODE_ON : HAL_LED_MODE_OFF);
|
||||
+
|
||||
accept = TRUE;
|
||||
|
||||
return accept;
|
||||
@@ -1522,6 +1542,7 @@ void ZDSecMgrPermitJoiningTimeout( void )
|
||||
{
|
||||
if ( ZDSecMgrPermitJoiningTimed == TRUE )
|
||||
{
|
||||
+ HalLedSet(HAL_LED_3, HAL_LED_MODE_OFF);
|
||||
ZDSecMgrPermitJoiningEnabled = FALSE;
|
||||
ZDSecMgrPermitJoiningTimed = FALSE;
|
||||
}
|
||||
diff --git a/Projects/zstack/ZMain/TI2530ZNP/OnBoard.c b/Projects/zstack/ZMain/TI2530ZNP/OnBoard.c
|
||||
index 7c6c77e..8265ff1 100644
|
||||
--- a/Projects/zstack/ZMain/TI2530ZNP/OnBoard.c
|
||||
@ -253,12 +417,27 @@ index 7c6c77e..8265ff1 100644
|
||||
znpCfg0 = ZNP_CFG0_32K_OSC;
|
||||
#else
|
||||
znpCfg1 = P2_0;
|
||||
diff --git a/Projects/zstack/ZMain/TI2530ZNP/OnBoard.h b/Projects/zstack/ZMain/TI2530ZNP/OnBoard.h
|
||||
index 9d035de..c850a66 100644
|
||||
--- a/Projects/zstack/ZMain/TI2530ZNP/OnBoard.h
|
||||
+++ b/Projects/zstack/ZMain/TI2530ZNP/OnBoard.h
|
||||
@@ -185,8 +185,8 @@ extern uint8 znpCfg1;
|
||||
#endif
|
||||
// SOC defines the ideal sizes in the individual _hal_uart_dma/isr.c modules.
|
||||
#define HAL_UART_FLOW_THRESHOLD 0
|
||||
-#define HAL_UART_RX_BUF_SIZE 0
|
||||
-#define HAL_UART_TX_BUF_SIZE 0
|
||||
+#define HAL_UART_RX_BUF_SIZE 1024
|
||||
+#define HAL_UART_TX_BUF_SIZE 1024
|
||||
#define HAL_UART_IDLE_TIMEOUT 0
|
||||
|
||||
// Restart system from absolute beginning
|
||||
diff --git a/Projects/zstack/ZNP/CC253x/Source/preinclude.h b/Projects/zstack/ZNP/CC253x/Source/preinclude.h
|
||||
new file mode 100644
|
||||
index 0000000..5ab4fd5
|
||||
index 0000000..356bce2
|
||||
--- /dev/null
|
||||
+++ b/Projects/zstack/ZNP/CC253x/Source/preinclude.h
|
||||
@@ -0,0 +1,123 @@
|
||||
@@ -0,0 +1,126 @@
|
||||
+// Shared accross all firmwares
|
||||
+#define ASSERT_RESET
|
||||
+
|
||||
@ -330,55 +509,58 @@ index 0000000..5ab4fd5
|
||||
+ #define CC2531ZNP
|
||||
+ #if defined SOURCE_ROUTING
|
||||
+ #define NWK_MAX_DEVICE_LIST 5
|
||||
+ #define MAXMEMHEAP 3309
|
||||
+ #define MAXMEMHEAP 3307
|
||||
+ #else
|
||||
+ #define NWK_MAX_DEVICE_LIST 20
|
||||
+ #define MAXMEMHEAP 3285
|
||||
+ #define MAXMEMHEAP 3283
|
||||
+ #endif
|
||||
+
|
||||
+// CC2530
|
||||
+#elif defined FIRMWARE_CC2530
|
||||
+ #define HAL_UART_DMA_RX_MAX 128
|
||||
+ #define ENABLE_MT_SYS_RESET_SHUTDOWN
|
||||
+ #define ZTOOL_P1
|
||||
+ #define CC2530_MK
|
||||
+
|
||||
+ #if defined SOURCE_ROUTING
|
||||
+ #define HAL_UART_DMA_RX_MAX 128
|
||||
+ #define NWK_MAX_DEVICE_LIST 5
|
||||
+ #define MAXMEMHEAP 3189
|
||||
+ #else
|
||||
+ #define HAL_UART_DMA_RX_MAX 220
|
||||
+ #define NWK_MAX_DEVICE_LIST 16
|
||||
+ #define MAXMEMHEAP 3277
|
||||
+ #define MAXMEMHEAP 2909
|
||||
+ #endif
|
||||
+
|
||||
+// CC2530 + CC2591
|
||||
+#elif defined FIRMWARE_CC2530_CC2591
|
||||
+ #define ENABLE_MT_SYS_RESET_SHUTDOWN
|
||||
+ #define ZTOOL_P1
|
||||
+ #define HAL_UART_DMA_RX_MAX 128
|
||||
+ #define HAL_PA_LNA
|
||||
+
|
||||
+ #if defined SOURCE_ROUTING
|
||||
+ #define HAL_UART_DMA_RX_MAX 128
|
||||
+ #define NWK_MAX_DEVICE_LIST 5
|
||||
+ #define MAXMEMHEAP 3187
|
||||
+ #else
|
||||
+ #define HAL_UART_DMA_RX_MAX 220
|
||||
+ #define NWK_MAX_DEVICE_LIST 16
|
||||
+ #define MAXMEMHEAP 3275
|
||||
+ #define MAXMEMHEAP 2907
|
||||
+ #endif
|
||||
+
|
||||
+// CC2530 + CC2592
|
||||
+#elif defined FIRMWARE_CC2530_CC2592
|
||||
+ #define ENABLE_MT_SYS_RESET_SHUTDOWN
|
||||
+ #define ZTOOL_P1
|
||||
+ #define HAL_UART_DMA_RX_MAX 128
|
||||
+ #define HAL_PA_LNA_CC2592
|
||||
+
|
||||
+ #if defined SOURCE_ROUTING
|
||||
+ #define HAL_UART_DMA_RX_MAX 128
|
||||
+ #define NWK_MAX_DEVICE_LIST 5
|
||||
+ #define MAXMEMHEAP 3187
|
||||
+ #else
|
||||
+ #define HAL_UART_DMA_RX_MAX 220
|
||||
+ #define NWK_MAX_DEVICE_LIST 16
|
||||
+ #define MAXMEMHEAP 3275
|
||||
+ #define MAXMEMHEAP 2907
|
||||
+ #endif
|
||||
+
|
||||
+#endif
|
||||
|
Loading…
Reference in New Issue
Block a user