Skip to content

Commit d148d40

Browse files
committed
complete reset implementation
1 parent 60ee7e1 commit d148d40

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/MainClasses/ANTPLUS_AntPlusRouter.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,16 @@ void AntPlusRouter::loop() {
107107
void AntPlusRouter::reset() {
108108
_ant = NULL;
109109
_networkKey = NULL;
110-
// TODO
111-
// disconnect profiles
112-
// Reset max channels
113-
// reset system state
110+
_maxChannels = 0;
111+
resetRadio(ANTPLUS_RESET_WAIT_FOR_STARTUP);
112+
for (uint8_t i = 0; i < ANTPLUS_MAX_CHANNELS_POSSIBLE; i++) {
113+
if (_profiles[i]) {
114+
// profile stopped in resetRadio
115+
_profiles[i]->setChannelNumber(0);
116+
_profiles[i]->setRouter(NULL);
117+
_profiles[i] = NULL;
118+
}
119+
}
114120
}
115121

116122
uint8_t AntPlusRouter::resetRadio(uint8_t waitForStartup) {

0 commit comments

Comments
 (0)