Skip to content

Commit

Permalink
Fix build for cemi_server without RF support
Browse files Browse the repository at this point in the history
  • Loading branch information
tonylu00 committed Jun 19, 2024
1 parent 57b5b05 commit 9a46d7b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/knx/cemi_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ void CemiServer::dataConfirmationToTunnel(CemiFrame& frame)

void CemiServer::dataIndicationToTunnel(CemiFrame& frame)
{
#ifdef USE_RF
bool isRf = _dataLinkLayer->mediumType() == DptMedium::KNX_RF;
uint8_t data[frame.dataLength() + (isRf ? 10 : 0)];

Expand All @@ -74,6 +75,10 @@ void CemiServer::dataIndicationToTunnel(CemiFrame& frame)
{
memcpy(&data[0], frame.data(), frame.dataLength());
}
#else
uint8_t data[frame.dataLength()];
memcpy(&data[0], frame.data(), frame.dataLength());
#endif

CemiFrame tmpFrame(data, sizeof(data));

Expand Down Expand Up @@ -102,7 +107,7 @@ void CemiServer::frameReceived(CemiFrame& frame)
{
frame.sourceAddress(_clientAddress);
}

#ifdef USE_RF
if (isRf)
{
// Check if we have additional info for RF
Expand Down Expand Up @@ -133,7 +138,7 @@ void CemiServer::frameReceived(CemiFrame& frame)
_frameNumber = (_frameNumber + 1) & 0x7;
}
}

#endif
print("L_data_req: src: ");
print(frame.sourceAddress(), HEX);
print(" dst: ");
Expand Down
2 changes: 2 additions & 0 deletions src/knx/data_link_layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,11 @@ bool DataLinkLayer::sendTelegram(NPDU & npdu, AckType ack, uint16_t destinationA
// We can just copy the pointer for rfSerialOrDoA as sendFrame() sets
// a pointer to const uint8_t data in either device object (serial) or
// RF medium object (domain address)
#ifdef USE_RF
tmpFrame.rfSerialOrDoA(frame.rfSerialOrDoA());
tmpFrame.rfInfo(frame.rfInfo());
tmpFrame.rfLfn(frame.rfLfn());
#endif
tmpFrame.confirm(ConfirmNoError);
_cemiServer->dataIndicationToTunnel(tmpFrame);
#endif
Expand Down

0 comments on commit 9a46d7b

Please sign in to comment.