mirror of
https://github.com/Laxilef/OTGateway.git
synced 2025-12-13 11:44:29 +05:00
refactor: added `Msg type` output to opentherm log
This commit is contained in:
@@ -112,6 +112,27 @@ public:
|
|||||||
return (byte)id == responseId;
|
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
|
// converters
|
||||||
template <class T>
|
template <class T>
|
||||||
static unsigned int toFloat(const T val) {
|
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) {
|
this->instance->setAfterSendRequestCallback([this](unsigned long request, unsigned long response, OpenThermResponseStatus status, byte attempt) {
|
||||||
Log.sverboseln(
|
Log.sverboseln(
|
||||||
FPSTR(L_OT),
|
FPSTR(L_OT),
|
||||||
F("ID: %4d Request: %8lx Response: %8lx Attempt: %2d Status: %s"),
|
F("ID: %4d Request: %8lx Response: %8lx Msg type: %s Attempt: %2d Status: %s"),
|
||||||
CustomOpenTherm::getDataID(request), request, response, attempt, CustomOpenTherm::statusToString(status)
|
CustomOpenTherm::getDataID(request),
|
||||||
|
request,
|
||||||
|
response,
|
||||||
|
CustomOpenTherm::getResponseMessageTypeString(response),
|
||||||
|
attempt,
|
||||||
|
CustomOpenTherm::statusToString(status)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (status == OpenThermResponseStatus::SUCCESS) {
|
if (status == OpenThermResponseStatus::SUCCESS) {
|
||||||
|
|||||||
Reference in New Issue
Block a user