Skip to content

Commit

Permalink
Ignore request and set messages in handle method
Browse files Browse the repository at this point in the history
  • Loading branch information
wrfz committed Sep 13, 2024
1 parent d572305 commit e118846
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
16 changes: 10 additions & 6 deletions components/daikin_rotex_can/request.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace daikin_rotex_can {
std::array<uint16_t, 7> TRequest::calculate_reponse(TMessage const& message) {
const uint16_t DC = 0xFFFF;
std::array<uint16_t, 7> response = {DC, DC, DC, DC, DC, DC, DC};
if (message[2] == 0xFA) {
if (message[2] == 0xFA) { // https://github.com/crycode-de/ioBroker.canbus/blob/master/well-known-messages/configs/rotex-hpsu.md
response[2] = message[2];
response[3] = message[3];
response[4] = message[4];
Expand All @@ -25,14 +25,18 @@ bool TRequest::isGetInProgress() const {
}

bool TRequest::isMatch(uint32_t can_id, TMessage const& responseData) const {
//if (can_id == get_response_canid())
const uint16_t response_can_id = (m_command[0] & 0xF0) * 8 + (m_command[1] & 0x0F);

//if (can_id == response_can_id())
{
for (uint32_t index = 0; index < responseData.size(); ++index) {
if (m_expected_reponse[index] != DC && responseData[index] != m_expected_reponse[index]) {
return false;
if ((responseData[0] & 0x0F) == 0x02) { // is a response
for (uint32_t index = 0; index < responseData.size(); ++index) {
if (m_expected_reponse[index] != DC && responseData[index] != m_expected_reponse[index]) {
return false;
}
}
return responseData.size() == 7;
}
return responseData.size() == 7;
}
return false;
}
Expand Down
4 changes: 0 additions & 4 deletions components/daikin_rotex_can/request.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,6 @@ class TRequest
return m_last_handle_timestamp;
}

uint16_t get_response_canid() const {
return m_command.size() >= 7 ? (m_command[0] & 0xF0) * 8 + (m_command[1] & 0x0F) : 0x00;
}

bool isMatch(uint32_t can_id, TMessage const& responseData) const;
bool handle(uint32_t can_id, TMessage const& responseData, uint32_t timestamp);

Expand Down

0 comments on commit e118846

Please sign in to comment.