@@ -721,6 +721,14 @@ void updateRadioState()
721721 triggerEvent (TRIGGER_RX_DATA);
722722
723723 // Place the data in the serial output buffer
724+ if (settings.debugSerial )
725+ {
726+ systemPrint (" Moving " );
727+ systemPrint (rxDataBytes);
728+ systemPrintln (" from incomingBuffer to serialTransmitBuffer" );
729+ dumpBuffer (rxData, length);
730+ outputSerialData (true );
731+ }
724732 serialBufferOutput (rxData, rxDataBytes);
725733
726734 // Transmit ACK
@@ -750,6 +758,16 @@ void updateRadioState()
750758 case DATAGRAM_REMOTE_COMMAND:
751759 triggerEvent (TRIGGER_RX_COMMAND);
752760
761+ // Debug the remote command operation
762+ if (settings.debugSerial )
763+ {
764+ systemPrint (" Moving " );
765+ systemPrint (rxDataBytes);
766+ systemPrintln (" from incomingBuffer to commandRXBuffer" );
767+ dumpBuffer (rxData, length);
768+ outputSerialData (true );
769+ }
770+
753771 // Determine the number of bytes received
754772 length = 0 ;
755773 if ((commandRXHead + rxDataBytes) > sizeof (commandRXBuffer))
@@ -772,9 +790,16 @@ void updateRadioState()
772790 case DATAGRAM_REMOTE_COMMAND_RESPONSE:
773791 triggerEvent (TRIGGER_RX_COMMAND_RESPONSE);
774792
775- // Print received data. This is blocking but we do not use the serialTransmitBuffer because we're in command mode (and it's not much data to print).
776- for (int x = 0 ; x < rxDataBytes ; x++)
777- Serial.write (rxData[x]);
793+ // Print received data.
794+ if (settings.debugSerial )
795+ {
796+ systemPrint (" Moving " );
797+ systemPrint (rxDataBytes);
798+ systemPrintln (" from incomingBuffer to serialTransmitBuffer" );
799+ dumpBuffer (rxData, length);
800+ outputSerialData (true );
801+ }
802+ serialBufferOutput (rxData, rxDataBytes);
778803
779804 // Transmit ACK
780805 P2P_SEND_ACK (TRIGGER_TX_ACK);
@@ -963,7 +988,7 @@ void updateRadioState()
963988 // ----------
964989 // Always check for link timeout
965990 // ----------
966- if ((millis () - linkDownTimer) >= (P2P_LINK_BREAK_MULTIPLIER * settings.heartbeatTimeout ))
991+ if ((millis () - linkDownTimer) >= (LINK_BREAK_MULTIPLIER * settings.heartbeatTimeout ))
967992 // Break the link
968993 breakLink ();
969994 break ;
@@ -2461,7 +2486,7 @@ void updateRadioState()
24612486 // Determine if the link has timed out
24622487 vc = &virtualCircuitList[index];
24632488 if ((vc->vcState != VC_STATE_LINK_DOWN) && (serverLinkBroken
2464- || ((currentMillis - vc->lastTrafficMillis ) > (VC_LINK_BREAK_MULTIPLIER * settings.heartbeatTimeout ))))
2489+ || ((currentMillis - vc->lastTrafficMillis ) > (LINK_BREAK_MULTIPLIER * settings.heartbeatTimeout ))))
24652490 {
24662491 if (index == VC_SERVER)
24672492 {
@@ -2887,7 +2912,10 @@ void breakLink()
28872912 }
28882913
28892914 // Flush the buffers
2890- resetSerial ();
2915+ if (!inCommandMode)
2916+ resetSerial ();
2917+ radioTxHead = radioTxTail;
2918+ endOfTxData = &outgoingPacket[headerBytes];
28912919
28922920 // Reset the radio and the link
28932921 triggerEvent (TRIGGER_RADIO_RESET);
@@ -3052,7 +3080,11 @@ void vcBreakLink(int8_t vcIndex)
30523080 // Flush the buffers
30533081 outputSerialData (true );
30543082 if (vcIndex == myVc)
3083+ {
30553084 resetSerial ();
3085+ radioTxHead = radioTxTail;
3086+ endOfTxData = &outgoingPacket[headerBytes];
3087+ }
30563088}
30573089
30583090// Place VC in LINK-UP state since it is receiving HEARTBEATs from the remote radio
0 commit comments