Skip to content

Commit 0eb526d

Browse files
Fix Command Processing: Write to KO for diagnoseKO only
1 parent d700ed6 commit 0eb526d

File tree

4 files changed

+21
-14
lines changed

4 files changed

+21
-14
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## upcoming (v0.6.1 or v0.7.0)
2+
3+
* Fix #52: Die Diagnose-Kommandos haben auch beim Aufruf von Konsole aufs KO geschrieben
4+
5+
16
# 2025-07-18 v0.6.0
27

38
* Fix #48: Diagnose-Kommandos im Modul wurden auch angezeigt und verarbeitet, wenn das Gerät nicht konfiguriert ist

src/DfaChannel.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,7 @@ void DfaChannel::restore()
675675

676676
#pragma region "DFA_CHANNEL_COMMANDS"
677677

678-
bool DfaChannel::processCommandDfa()
678+
bool DfaChannel::processCommandDfa(bool diagnoseKo)
679679
{
680680
logDebugP("status and remaining delay");
681681
const uint8_t state = _state + 1;
@@ -697,33 +697,35 @@ bool DfaChannel::processCommandDfa()
697697
const uint16_t timeoutHours = remaining;
698698

699699
logInfoP((timeoutHours < 10) ? "%02d%c%d:%02d:%02d.%03d" : "%02d%c%5d:%02d:%02d", state, mode, timeoutHours, timeoutMinutes, timeoutSeconds, timeoutMillis);
700-
openknx.console.writeDiagenoseKo((timeoutHours < 10) ? "%02d%c%d:%02d:%02d.%03d" : "%02d%c%5d:%02d:%02d", state, mode, timeoutHours, timeoutMinutes, timeoutSeconds, timeoutMillis);
700+
if (diagnoseKo)
701+
openknx.console.writeDiagenoseKo((timeoutHours < 10) ? "%02d%c%d:%02d:%02d.%03d" : "%02d%c%5d:%02d:%02d", state, mode, timeoutHours, timeoutMinutes, timeoutSeconds, timeoutMillis);
701702
}
702703
else
703704
{
704705
logInfoP("%02d%cNO_TIMEOUT", state, mode);
705-
openknx.console.writeDiagenoseKo("%02d%c NO_TIMEOUT", state, mode);
706+
if (diagnoseKo)
707+
openknx.console.writeDiagenoseKo("%02d%c NO_TIMEOUT", state, mode);
706708
}
707709
return true;
708710
}
709711

710-
bool DfaChannel::processCommandDfaTimeout()
712+
bool DfaChannel::processCommandDfaTimeout(bool diagnoseKo)
711713
{
712714
logInfoP("timeout end now!");
713715
// TODO define behaviour when disabled
714716
endTimeout();
715717
return true;
716718
}
717719

718-
bool DfaChannel::processCommandDfaStateSet(const uint8_t stateStarting1)
720+
bool DfaChannel::processCommandDfaStateSet(const uint8_t stateStarting1, bool diagnoseKo)
719721
{
720722
const uint8_t state = stateStarting1 - 1;
721723
// TODO check setState returning valid state
722724
setState(state);
723725
return isValidState(state);
724726
}
725727

726-
bool DfaChannel::processCommandDfaSymbolInsert(const uint8_t inputSymbolNumber)
728+
bool DfaChannel::processCommandDfaSymbolInsert(const uint8_t inputSymbolNumber, bool diagnoseKo)
727729
{
728730
transfer(inputSymbolNumber);
729731
return true;

src/DfaChannel.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ class DfaChannel : public OpenKNX::Channel
112112
void save();
113113
void restore();
114114

115-
bool processCommandDfa();
116-
bool processCommandDfaTimeout();
117-
bool processCommandDfaStateSet(const uint8_t stateStarting1);
118-
bool processCommandDfaSymbolInsert(const uint8_t inputSymbolNumber);
115+
bool processCommandDfa(bool diagnoseKo);
116+
bool processCommandDfaTimeout(bool diagnoseKo);
117+
bool processCommandDfaStateSet(const uint8_t stateStarting1, bool diagnoseKo);
118+
bool processCommandDfaSymbolInsert(const uint8_t inputSymbolNumber, bool diagnoseKo);
119119
};

src/DfaModule.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ bool DfaModule::processCommand(const std::string cmd, bool diagnoseKo)
216216
if (cmdLength == 5)
217217
{
218218
logDebugP("=> DFA-Channel<%u> overview!", (channelIdx + 1));
219-
return _channels[channelIdx]->processCommandDfa();
219+
return _channels[channelIdx]->processCommandDfa(diagnoseKo);
220220
}
221221
else if (!diagnoseKo || ParamDFA_DiagnoseAccess == 1) // writing to DFAs is allowed
222222
{
@@ -225,21 +225,21 @@ bool DfaModule::processCommand(const std::string cmd, bool diagnoseKo)
225225
if (cmd.substr(5, 9) == " timeout!")
226226
{
227227
logDebugP("=> DFA-Channel<%u> timeout end now!", (channelIdx + 1));
228-
return _channels[channelIdx]->processCommandDfaTimeout();
228+
return _channels[channelIdx]->processCommandDfaTimeout(diagnoseKo);
229229
}
230230
else if (cmd.substr(5, 7) == " state=" && std::isdigit(cmd[12]) && std::isdigit(cmd[13]))
231231
{
232232
const uint8_t newState = std::stoi(cmd.substr(12, 2));
233233

234234
logDebugP("=> DFA-Channel<%u> set state=%u!", (channelIdx + 1), newState);
235-
return _channels[channelIdx]->processCommandDfaStateSet(newState);
235+
return _channels[channelIdx]->processCommandDfaStateSet(newState, diagnoseKo);
236236
}
237237
else if (cmd.substr(5, 8) == " symbol=" && ('A' <= cmd[13] && cmd[13] <= 'H'))
238238
{
239239
const uint8_t inputSymbolNumber = cmd[13] - 'A';
240240

241241
logDebugP("=> DFA-Channel<%u> input Symbol=%c (%u)!", (channelIdx + 1), ('A' + inputSymbolNumber), inputSymbolNumber);
242-
return _channels[channelIdx]->processCommandDfaSymbolInsert(inputSymbolNumber);
242+
return _channels[channelIdx]->processCommandDfaSymbolInsert(inputSymbolNumber, diagnoseKo);
243243
}
244244
}
245245
}

0 commit comments

Comments
 (0)