@@ -5630,7 +5630,8 @@ SARA_R5_error_t SARA_R5::sendCommandWithResponse(
5630
5630
int responseLen = 0 ;
5631
5631
int errorLen = 0 ;
5632
5632
const char * expectedError= nullptr ;
5633
- // bool printedSomething = false;
5633
+ bool printResponse = false ; // Change to true to print the full response
5634
+ bool printedSomething = false ;
5634
5635
5635
5636
if (_printDebug == true )
5636
5637
{
@@ -5654,15 +5655,15 @@ SARA_R5_error_t SARA_R5::sendCommandWithResponse(
5654
5655
if (hwAvailable () > 0 ) // hwAvailable can return -1 if the serial port is nullptr
5655
5656
{
5656
5657
char c = readChar ();
5657
- // if (_printDebug == true)
5658
- // {
5659
- // if (printedSomething == false)
5660
- // {
5661
- // _debugPort->print(F("sendCommandWithResponse: Response: "));
5662
- // printedSomething = true;
5663
- // }
5664
- // _debugPort->write(c);
5665
- // }
5658
+ if ((printResponse = true ) && ( _printDebug == true ) )
5659
+ {
5660
+ if (printedSomething == false )
5661
+ {
5662
+ _debugPort->print (F (" sendCommandWithResponse: Response: " ));
5663
+ printedSomething = true ;
5664
+ }
5665
+ _debugPort->write (c);
5666
+ }
5666
5667
if (responseDest != nullptr )
5667
5668
{
5668
5669
if (destIndex < destSize) // Only add this char to response if there is room for it
@@ -5672,11 +5673,11 @@ SARA_R5_error_t SARA_R5::sendCommandWithResponse(
5672
5673
{
5673
5674
if (_printDebug == true )
5674
5675
{
5675
- // if (printedSomething)
5676
- // _debugPort->println();
5676
+ if ((printResponse = true ) && ( printedSomething) )
5677
+ _debugPort->println ();
5677
5678
_debugPort->print (F (" sendCommandWithResponse: Panic! responseDest is full!" ));
5678
- // if (printedSomething)
5679
- // _debugPort->print(F("sendCommandWithResponse: Ignored response: "));
5679
+ if ((printResponse = true ) && ( printedSomething) )
5680
+ _debugPort->print (F (" sendCommandWithResponse: Ignored response: " ));
5680
5681
}
5681
5682
}
5682
5683
}
@@ -5722,9 +5723,9 @@ SARA_R5_error_t SARA_R5::sendCommandWithResponse(
5722
5723
}
5723
5724
}
5724
5725
5725
- // if (_printDebug == true)
5726
- // if (printedSomething)
5727
- // _debugPort->println();
5726
+ if (_printDebug == true )
5727
+ if ((printResponse = true ) && ( printedSomething) )
5728
+ _debugPort->println ();
5728
5729
5729
5730
pruneBacklog (); // Prune any incoming non-actionable URC's and responses/errors from the backlog
5730
5731
0 commit comments