From 6dd74bc13f0a19bb9c647fdbd13d60352116a1c3 Mon Sep 17 00:00:00 2001 From: nur Date: Sat, 30 May 2020 07:34:17 +0800 Subject: [PATCH] Simplify join process --- CC2530DB/settings/GenericApp.dnx | 18 +++++++++--------- README.md | 8 ++------ Source/zcl_freepadapp.c | 16 ++++++++-------- 3 files changed, 19 insertions(+), 23 deletions(-) diff --git a/CC2530DB/settings/GenericApp.dnx b/CC2530DB/settings/GenericApp.dnx index 4a35b6b..f700fa3 100644 --- a/CC2530DB/settings/GenericApp.dnx +++ b/CC2530DB/settings/GenericApp.dnx @@ -76,15 +76,6 @@ 50000000 0 - - _ "STD_CODE" "{C:\Z-Stack 3.0.2\Components\stack\bdb\bdb_Reporting.c}.2241.7" 1 0 0 0 "" 0 "" - _ "STD_CODE" "{C:\Z-Stack 3.0.2\Components\stack\bdb\bdb_Reporting.c}.2258.3" 1 0 0 0 "" 0 "" - 2 - - - 0 - 1 - _ 0 _ "" @@ -94,6 +85,15 @@ _ 0 _ "" + + _ "STD_CODE" "{C:\Z-Stack 3.0.2\Components\stack\bdb\bdb_Reporting.c}.2241.6" 1 0 0 0 "" 0 "" + _ "STD_CODE" "{C:\Z-Stack 3.0.2\Components\stack\bdb\bdb_Reporting.c}.2258.3" 1 0 0 0 "" 0 "" + 2 + + + 0 + 1 + 0 0 diff --git a/README.md b/README.md index c6ec339..0813803 100644 --- a/README.md +++ b/README.md @@ -8,15 +8,11 @@ # How to join: -### If device in FN(factory new) state: -1. Press and hold button (1) for 2-3 seconds, until device start flashing led + +1. Press and hold button (1) for 3-100 seconds(depends whter or not device is on a network), until device start flashing led 2. Wait, in case of successfull join, device will flash led 5 times 3. If join failed, device will flash led 3 times -### If device in a network: -1. Hold button (1) for 10 seconds, this will reset device to FN(factory new) status -2. Go to step 1 for FN device - # How to use touch link 1. Bring you remote near to TL device 2. Hold button (2) for 5 seconds diff --git a/Source/zcl_freepadapp.c b/Source/zcl_freepadapp.c index 0064273..2204740 100644 --- a/Source/zcl_freepadapp.c +++ b/Source/zcl_freepadapp.c @@ -152,7 +152,13 @@ void zclFreePadApp_Init(byte task_id) { bdb_RegisterCommissioningStatusCB(zclFreePadApp_ProcessCommissioningStatus); touchLinkInitiator_RegisterNotifyTLCB(zclFreePadApp_TL_NotifyCb); - bdb_StartCommissioning(BDB_COMMISSIONING_REJOIN_EXISTING_NETWORK_ON_STARTUP); + if (zgReadStartupOptions() & ZCD_STARTOPT_DEFAULT_NETWORK_STATE) { + LREPMaster("BDB_COMMISSIONING_MODE_NWK_STEERING\r\n"); + bdb_StartCommissioning(BDB_COMMISSIONING_MODE_NWK_STEERING); + } else { + LREPMaster("BDB_COMMISSIONING_REJOIN_EXISTING_NETWORK_ON_STARTUP\r\n"); + bdb_StartCommissioning(BDB_COMMISSIONING_REJOIN_EXISTING_NETWORK_ON_STARTUP); + } LREP("Started build %s \r\n", zclFreePadApp_DateCodeNT); osal_start_reload_timer(zclFreePadApp_TaskID, FREEPADAPP_REPORT_EVT, FREEPADAPP_REPORT_DELAY); @@ -407,13 +413,7 @@ uint16 zclFreePadApp_event_loop(uint8 task_id, uint16 events) { static void zclFreePadApp_Rejoin(void) { LREPMaster("Recieved rejoin command\r\n"); HalLedSet(HAL_LED_1, HAL_LED_MODE_FLASH); - if (bdbAttributes.bdbNodeIsOnANetwork) { - LREPMaster("Reset to FN\r\n"); - bdb_resetLocalAction(); - } else { - LREPMaster("StartCommissioning STEEREING\r\n"); - bdb_StartCommissioning(BDB_COMMISSIONING_MODE_NWK_STEERING); - } + bdb_resetLocalAction(); } static void zclFreePadApp_SendButtonPress(uint8 endPoint, uint8 clicksCount) {