Skip to content

Commit

Permalink
Исправлены OTA обновления для 1000000 (буфера не хватало при сильно п…
Browse files Browse the repository at this point in the history
…устых (много нулей) блоках прошивки)

Заодно починился бэкап/восстановление на той же лимонной скорости, даже не в дебаг версии.

Fix UART tx and rx queue size то MAX_PACKET_SIZE

Случайно перенесено из зигаты:
fix bindgroup command + change version
Added fields for 0x8030, 0x8031. Both responses now include source endpoint, addressmode and short address. fairecasoimeme/ZiGate#161

Proposed by @VOVAiS
Tested by @VOVAiS
Confirmed by @VOVAiS
  • Loading branch information
Alx2000y committed Nov 10, 2022
1 parent 4b40aec commit e489157
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 42 deletions.
11 changes: 8 additions & 3 deletions Source/ZigbeeNodeControlBridge/app_Znc_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ PUBLIC void APP_vProcessIncomingSerialCommands ( uint8 u8RxByte )
uint8 u8Status = 0;
uint16 u16TargetAddress;
tsZCL_Address sAddress;
uint8 au8values[4];
uint8 au8values[5];
uint8 u8Length = 0;
#ifdef FULL_FUNC_DEVICE
tsBDB_ZCLEvent sEvent;
Expand Down Expand Up @@ -884,10 +884,15 @@ PUBLIC void APP_vProcessIncomingSerialCommands ( uint8 u8RxByte )
u8SrcEp = au8LinkRxBuffer[ offset++ ];
u16Clusterid = ZNC_RTN_U16_OFFSET ( au8LinkRxBuffer , offset, offset );
u8DstAddrMode = au8LinkRxBuffer[ offset++ ];
uDstAddress.u64Addr = ZNC_RTN_U64_OFFSET ( au8LinkRxBuffer , offset, offset );

if(u8DstAddrMode == 0x1)
{
uDstAddress.u16Addr = ZNC_RTN_U16_OFFSET( au8LinkRxBuffer , offset , offset);

if(u8DstAddrMode == 0x3)
}else
if(u8DstAddrMode == 0x3)
{
uDstAddress.u64Addr = ZNC_RTN_U64_OFFSET ( au8LinkRxBuffer , offset, offset );
u8DstEp = au8LinkRxBuffer [ offset++ ] ;
}

Expand Down
66 changes: 31 additions & 35 deletions Source/ZigbeeNodeControlBridge/app_general_events_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -852,42 +852,38 @@ PUBLIC void APP_vHandleStackEvents ( ZPS_tsAfEvent* psStackEvent )
}
break;

case ZPS_ZDP_BIND_RSP_CLUSTER_ID:
ZNC_BUF_U8_UPD ( &au8LinkTxBuffer [u16Length], sApsZdpEvent.uZdpData.sUnbindRsp.u8Status, u16Length );
ZNC_BUF_U8_UPD ( &au8LinkTxBuffer [u16Length], psStackEvent->uEvent.sApsDataIndEvent.u8SrcEndpoint, u16Length );
ZNC_BUF_U8_UPD ( &au8LinkTxBuffer [u16Length], psStackEvent->uEvent.sApsDataIndEvent.u8SrcAddrMode, u16Length );
ZNC_BUF_U16_UPD ( &au8LinkTxBuffer [u16Length], psStackEvent->uEvent.sApsDataIndEvent.uSrcAddress.u16Addr, u16Length );
vSL_WriteMessage ( E_SL_MSG_BIND_RESPONSE,
u16Length,
au8LinkTxBuffer,
u8LinkQuality );
break;

case ZPS_ZDP_UNBIND_RSP_CLUSTER_ID:
ZNC_BUF_U8_UPD ( &au8LinkTxBuffer [u16Length], sApsZdpEvent.uZdpData.sUnbindRsp.u8Status, u16Length );
ZNC_BUF_U8_UPD ( &au8LinkTxBuffer [u16Length], psStackEvent->uEvent.sApsDataIndEvent.u8SrcEndpoint, u16Length );
ZNC_BUF_U8_UPD ( &au8LinkTxBuffer [u16Length], psStackEvent->uEvent.sApsDataIndEvent.u8SrcAddrMode, u16Length );
ZNC_BUF_U16_UPD ( &au8LinkTxBuffer [u16Length], psStackEvent->uEvent.sApsDataIndEvent.uSrcAddress.u16Addr, u16Length );
vSL_WriteMessage ( E_SL_MSG_UNBIND_RESPONSE,
u16Length,
au8LinkTxBuffer,
u8LinkQuality );
break;

case ZPS_ZDP_MGMT_PERMIT_JOINING_RSP_CLUSTER_ID:
ZNC_BUF_U8_UPD ( &au8LinkTxBuffer [u16Length], sApsZdpEvent.uZdpData.sPermitJoiningRsp.u8Status, u16Length );
vSL_WriteMessage ( E_SL_MSG_PERMIT_JOINING_RESPONSE,
u16Length,
au8LinkTxBuffer,
u8LinkQuality );
break;

default:
{
ZNC_BUF_U8_UPD ( &au8LinkTxBuffer [u16Length] , sApsZdpEvent.uZdpData.sUnbindRsp.u8Status, u16Length );
switch ( sApsZdpEvent.u16ClusterId )
{
case ZPS_ZDP_BIND_RSP_CLUSTER_ID:
vSL_WriteMessage ( E_SL_MSG_BIND_RESPONSE,
u16Length,
au8LinkTxBuffer,
u8LinkQuality );
break;

case ZPS_ZDP_UNBIND_RSP_CLUSTER_ID:
vSL_WriteMessage ( E_SL_MSG_UNBIND_RESPONSE,
u16Length,
au8LinkTxBuffer,
u8LinkQuality );
break;
case ZPS_ZDP_MGMT_LEAVE_RSP_CLUSTER_ID:
vSL_WriteMessage ( E_SL_MSG_MANAGEMENT_LEAVE_RESPONSE,
u16Length,
au8LinkTxBuffer,
u8LinkQuality );
break;

case ZPS_ZDP_MGMT_PERMIT_JOINING_RSP_CLUSTER_ID:
vSL_WriteMessage ( E_SL_MSG_PERMIT_JOINING_RESPONSE,
u16Length,
au8LinkTxBuffer,
u8LinkQuality );
break;
default:
break;
}
}
break;
break;
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions Source/ZigbeeNodeControlBridge/app_start.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ uint8 u8GPZCLTimerEvent;
#define MCPS_QUEUE_SIZE 20
#define ZPS_QUEUE_SIZE 2
#define APP_QUEUE_SIZE 8
#define TX_QUEUE_SIZE 150
#define RX_QUEUE_SIZE 150
#define TX_QUEUE_SIZE MAX_PACKET_SIZE
#define RX_QUEUE_SIZE MAX_PACKET_SIZE
#define BDB_QUEUE_SIZE 2
#define APP_NUM_STD_TMRS 4

Expand Down
11 changes: 9 additions & 2 deletions Source/ZigbeeNodeControlBridge/app_zcl_event_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,13 @@ void APP_vHandleZclEvents ( ZPS_tsAfEvent* psStackEvent )
ZNC_BUF_U8_UPD ( &au8LinkTxBuffer [u16Length], psStackEvent->uEvent.sApsDataConfirmEvent.u8SrcEndpoint, u16Length );
ZNC_BUF_U8_UPD ( &au8LinkTxBuffer [u16Length], psStackEvent->uEvent.sApsDataConfirmEvent.u8DstEndpoint, u16Length );
ZNC_BUF_U8_UPD ( &au8LinkTxBuffer [u16Length], psStackEvent->uEvent.sApsDataConfirmEvent.u8DstAddrMode, u16Length );
ZNC_BUF_U64_UPD ( &au8LinkTxBuffer [u16Length], psStackEvent->uEvent.sApsDataConfirmEvent.uDstAddr.u64Addr, u16Length );
if (psStackEvent->uEvent.sApsDataConfirmEvent.u8DstAddrMode == 0x03)
{
ZNC_BUF_U64_UPD ( &au8LinkTxBuffer [u16Length], psStackEvent->uEvent.sApsDataConfirmEvent.uDstAddr.u64Addr, u16Length );
}else
{
ZNC_BUF_U16_UPD ( &au8LinkTxBuffer [u16Length], psStackEvent->uEvent.sApsDataConfirmEvent.uDstAddr.u16Addr, u16Length );
}
ZNC_BUF_U8_UPD ( &au8LinkTxBuffer [u16Length], psStackEvent->uEvent.sApsDataConfirmEvent.u8SequenceNum, u16Length );
vSL_WriteMessage ( E_SL_MSG_APS_DATA_CONFIRM_FAILED,
u16Length,
Expand Down Expand Up @@ -382,6 +388,7 @@ PRIVATE void APP_ZCL_cbEndpointCallback ( tsZCL_CallBackEvent* psEvent )
}
else
{
vLog_Printf(TRACE_ZCL, LOG_DEBUG, "DROP EVT: status 0x%02x addr 0x%04x\r\n", psEvent->eZCL_Status , psEvent->pZPSevent->uEvent.sApsDataIndEvent.uSrcAddress.u16Addr);
return;
}
}
Expand All @@ -397,7 +404,7 @@ PRIVATE void APP_ZCL_cbEndpointCallback ( tsZCL_CallBackEvent* psEvent )
case E_ZCL_CBET_READ_ATTRIBUTES_RESPONSE:
case E_ZCL_CBET_TIMER:
case E_ZCL_CBET_ZIGBEE_EVENT:
vLog_Printf(TRACE_ZCL, LOG_DEBUG, "EP EVT:No action\r\n", psEvent->eZCL_Status );
vLog_Printf(TRACE_ZCL, LOG_DEBUG, "EP EVT:No action 0x%02x\r\n", psEvent->eZCL_Status );
break;

case E_ZCL_CBET_ERROR:
Expand Down

0 comments on commit e489157

Please sign in to comment.