mirror of
https://github.com/thelsing/knx.git
synced 2024-12-18 19:08:18 +01:00
support detect acks with busy + nack and show in monitoring
This commit is contained in:
parent
2adac5e4af
commit
a645575a72
@ -19,13 +19,16 @@
|
||||
#define TP_FRAME_FLAG_ECHO 0b00010000
|
||||
|
||||
// Means that the frame is processed by this device
|
||||
#define TP_FRAME_FLAG_ADDRESSED 0b00000100
|
||||
#define TP_FRAME_FLAG_ADDRESSED 0b00001000
|
||||
|
||||
// Means that the frame has been acked by this device.
|
||||
#define TP_FRAME_FLAG_ACKING 0b00000010
|
||||
// Means that the frame has been acked with BUSY
|
||||
#define TP_FRAME_FLAG_ACK_BUSY 0b00000100
|
||||
|
||||
// Means that the frame has been acked by other (Busmontior)
|
||||
#define TP_FRAME_FLAG_ACKED 0b00000001
|
||||
// Means that the frame has been acked with NACK
|
||||
#define TP_FRAME_FLAG_ACK_NACK 0b00000010
|
||||
|
||||
// Means that the frame has been acked
|
||||
#define TP_FRAME_FLAG_ACK 0b00000001
|
||||
|
||||
class TpFrame
|
||||
{
|
||||
|
@ -61,6 +61,8 @@
|
||||
// acknowledge services (device is transparent in bus monitor mode)
|
||||
#define L_ACKN_IND 0x00
|
||||
#define L_ACKN_MASK 0x33
|
||||
#define L_ACKN_BUSY_MASK 0x0C
|
||||
#define L_ACKN_NACK_MASK 0xC0
|
||||
#define L_DATA_CON 0x0B
|
||||
#define L_DATA_CON_MASK 0x7F
|
||||
#define SUCCESS 0x80
|
||||
@ -139,11 +141,11 @@ void printFrame(TpFrame *tpframe)
|
||||
print((tpframe->flags() & TP_FRAME_FLAG_INVALID) ? 'I' : '_'); // Invalid
|
||||
print((tpframe->flags() & TP_FRAME_FLAG_EXTENDED) ? 'E' : '_'); // Extended
|
||||
print((tpframe->flags() & TP_FRAME_FLAG_REPEATED) ? 'R' : '_'); // Repeat
|
||||
print((tpframe->flags() & TP_FRAME_FLAG_ECHO) ? 'O' : '_'); // My own
|
||||
print((tpframe->flags() & 0b00001000) ? 'x' : '_'); // Reserve
|
||||
print((tpframe->flags() & TP_FRAME_FLAG_ADDRESSED) ? 'D' : '_'); // For me
|
||||
print((tpframe->flags() & TP_FRAME_FLAG_ACKING) ? 'A' : '_'); // ACK recevied
|
||||
print((tpframe->flags() & TP_FRAME_FLAG_ACKED) ? 'A' : '_'); // ACK sent
|
||||
print((tpframe->flags() & TP_FRAME_FLAG_ECHO) ? 'T' : '_'); // Send by me
|
||||
print((tpframe->flags() & TP_FRAME_FLAG_ADDRESSED) ? 'D' : '_'); // Recv for me
|
||||
print((tpframe->flags() & TP_FRAME_FLAG_ACK_NACK) ? 'N' : '_'); // ACK + NACK
|
||||
print((tpframe->flags() & TP_FRAME_FLAG_ACK_BUSY) ? 'B' : '_'); // ACK + BUSY
|
||||
print((tpframe->flags() & TP_FRAME_FLAG_ACK) ? 'A' : '_'); // ACK
|
||||
print("] ");
|
||||
printHex("( ", tpframe->data(), tpframe->size(), false);
|
||||
print(")");
|
||||
@ -295,7 +297,13 @@ void TpUartDataLinkLayer::processRxByte()
|
||||
*/
|
||||
if (_rxFrame->size() > 0)
|
||||
{
|
||||
_rxFrame->addFlags(TP_FRAME_FLAG_ACKED);
|
||||
if (!(byte & L_ACKN_BUSY_MASK))
|
||||
_rxFrame->addFlags(TP_FRAME_FLAG_ACK_BUSY);
|
||||
|
||||
if (!(byte & L_ACKN_NACK_MASK))
|
||||
_rxFrame->addFlags(TP_FRAME_FLAG_ACK_NACK);
|
||||
|
||||
_rxFrame->addFlags(TP_FRAME_FLAG_ACK);
|
||||
processRxFrameComplete();
|
||||
}
|
||||
// println("L_ACKN_IND");
|
||||
@ -414,7 +422,7 @@ void TpUartDataLinkLayer::processRxFrameByte(uint8_t byte)
|
||||
if (_txState == TX_IDLE)
|
||||
{
|
||||
// Speichere das ein Acking erfolgen soll
|
||||
_rxFrame->addFlags(TP_FRAME_FLAG_ACKING);
|
||||
_rxFrame->addFlags(TP_FRAME_FLAG_ACK);
|
||||
|
||||
// und im TPUart damit dieser das ACK schicken kann
|
||||
_platform.writeUart(U_ACK_REQ | U_ACK_REQ_ADRESSED);
|
||||
|
Loading…
Reference in New Issue
Block a user