mirror of
https://github.com/Laxilef/OTGateway.git
synced 2025-12-10 18:24:27 +05:00
refactor: added `Msg type` output to opentherm log
This commit is contained in:
@@ -112,6 +112,27 @@ public:
|
||||
return (byte)id == responseId;
|
||||
}
|
||||
|
||||
static uint8_t getResponseMessageTypeId(unsigned long response) {
|
||||
return (response << 1) >> 29;
|
||||
}
|
||||
|
||||
static const char* getResponseMessageTypeString(unsigned long response) {
|
||||
uint8_t msgType = getResponseMessageTypeId(response);
|
||||
|
||||
switch (msgType) {
|
||||
case (uint8_t) OpenThermMessageType::READ_ACK:
|
||||
case (uint8_t) OpenThermMessageType::WRITE_ACK:
|
||||
case (uint8_t) OpenThermMessageType::DATA_INVALID:
|
||||
case (uint8_t) OpenThermMessageType::UNKNOWN_DATA_ID:
|
||||
return CustomOpenTherm::messageTypeToString(
|
||||
static_cast<OpenThermMessageType>(msgType)
|
||||
);
|
||||
|
||||
default:
|
||||
return "UNKNOWN";
|
||||
}
|
||||
}
|
||||
|
||||
// converters
|
||||
template <class T>
|
||||
static unsigned int toFloat(const T val) {
|
||||
|
||||
@@ -93,8 +93,13 @@ protected:
|
||||
this->instance->setAfterSendRequestCallback([this](unsigned long request, unsigned long response, OpenThermResponseStatus status, byte attempt) {
|
||||
Log.sverboseln(
|
||||
FPSTR(L_OT),
|
||||
F("ID: %4d Request: %8lx Response: %8lx Attempt: %2d Status: %s"),
|
||||
CustomOpenTherm::getDataID(request), request, response, attempt, CustomOpenTherm::statusToString(status)
|
||||
F("ID: %4d Request: %8lx Response: %8lx Msg type: %s Attempt: %2d Status: %s"),
|
||||
CustomOpenTherm::getDataID(request),
|
||||
request,
|
||||
response,
|
||||
CustomOpenTherm::getResponseMessageTypeString(response),
|
||||
attempt,
|
||||
CustomOpenTherm::statusToString(status)
|
||||
);
|
||||
|
||||
if (status == OpenThermResponseStatus::SUCCESS) {
|
||||
|
||||
Reference in New Issue
Block a user