Skip to content

Commit

Permalink
Simplify join process
Browse files Browse the repository at this point in the history
  • Loading branch information
nurikk committed May 29, 2020
1 parent ca3dbd1 commit 6dd74bc
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 23 deletions.
18 changes: 9 additions & 9 deletions CC2530DB/settings/GenericApp.dnx
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,6 @@
<Freq>50000000</Freq>
<FreqHi>0</FreqHi>
</Simulator>
<Breakpoints>
<Bp0>_ "STD_CODE" "{C:\Z-Stack 3.0.2\Components\stack\bdb\bdb_Reporting.c}.2241.7" 1 0 0 0 "" 0 ""</Bp0>
<Bp1>_ "STD_CODE" "{C:\Z-Stack 3.0.2\Components\stack\bdb\bdb_Reporting.c}.2258.3" 1 0 0 0 "" 0 ""</Bp1>
<Count>2</Count>
</Breakpoints>
<ChipconEmu>
<StopTimersOnHalt>0</StopTimersOnHalt>
<LeaveTargetRunning>1</LeaveTargetRunning>
</ChipconEmu>
<LogFile>
<LoggingEnabled>_ 0</LoggingEnabled>
<LogFile>_ ""</LogFile>
Expand All @@ -94,6 +85,15 @@
<LoggingEnabled>_ 0</LoggingEnabled>
<LogFile>_ ""</LogFile>
</TermIOLog>
<Breakpoints>
<Bp0>_ "STD_CODE" "{C:\Z-Stack 3.0.2\Components\stack\bdb\bdb_Reporting.c}.2241.6" 1 0 0 0 "" 0 ""</Bp0>
<Bp1>_ "STD_CODE" "{C:\Z-Stack 3.0.2\Components\stack\bdb\bdb_Reporting.c}.2258.3" 1 0 0 0 "" 0 ""</Bp1>
<Count>2</Count>
</Breakpoints>
<ChipconEmu>
<StopTimersOnHalt>0</StopTimersOnHalt>
<LeaveTargetRunning>1</LeaveTargetRunning>
</ChipconEmu>
<Aliases>
<Count>0</Count>
<SuppressDialog>0</SuppressDialog>
Expand Down
8 changes: 2 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 8 additions & 8 deletions Source/zcl_freepadapp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 6dd74bc

Please sign in to comment.