mmu: Embed the newline in MMU2_ECHO_MSG/MMU2_ERROR_MSG
This allows to redefine both macros to silence debugging messages, since we can't redefine the base SERIAL_ECHO.
This commit is contained in:
parent
5f2f6dde13
commit
78cf51274f
|
|
@ -22,17 +22,15 @@ void LogEchoEvent_P(const char *msg);
|
|||
|
||||
#define SERIAL_MMU2() { serialprintPGM(mmu2Magic); }
|
||||
|
||||
#define MMU2_ECHO_MSG(S) do{ SERIAL_ECHO_START; SERIAL_MMU2(); SERIAL_ECHO(S); }while(0)
|
||||
#define MMU2_ERROR_MSG(S) MMU2_ECHO_MSG(S) //!@todo Decide MMU2 errors on serial line
|
||||
#define MMU2_ECHO_MSGLN(S) do{ SERIAL_ECHO_START; SERIAL_MMU2(); SERIAL_ECHOLN(S); }while(0)
|
||||
#define MMU2_ERROR_MSGLN(S) MMU2_ECHO_MSGLN(S) //!@todo Decide MMU2 errors on serial line
|
||||
#define MMU2_ECHO_MSGRPGM(S) do{ SERIAL_ECHO_START; SERIAL_MMU2(); SERIAL_ECHORPGM(S); }while(0)
|
||||
#define MMU2_ERROR_MSGRPGM(S) MMU2_ECHO_MSGRPGM(S) //!@todo Decide MMU2 errors on serial line
|
||||
|
||||
#else // #ifndef UNITTEST
|
||||
|
||||
#define MMU2_ECHO_MSG(S) /* */
|
||||
#define MMU2_ERROR_MSG(S) /* */
|
||||
#define SERIAL_ECHO(S) /* */
|
||||
#define SERIAL_ECHOLN(S) /* */
|
||||
#define MMU2_ECHO_MSGLN(S) /* */
|
||||
#define MMU2_ERROR_MSGLN(S) /* */
|
||||
#define MMU2_ECHO_MSGRPGM(S) /* */
|
||||
#define MMU2_ERROR_MSGRPGM(S) /* */
|
||||
|
||||
|
|
|
|||
|
|
@ -693,7 +693,7 @@ void ProtocolLogic::FormatLastResponseMsgAndClearLRB(char *dst) {
|
|||
}
|
||||
|
||||
void ProtocolLogic::LogRequestMsg(const uint8_t *txbuff, uint8_t size) {
|
||||
constexpr uint_fast8_t rqs = modules::protocol::Protocol::MaxRequestSize() + 2;
|
||||
constexpr uint_fast8_t rqs = modules::protocol::Protocol::MaxRequestSize() + 1;
|
||||
char tmp[rqs] = ">";
|
||||
static char lastMsg[rqs] = "";
|
||||
for (uint8_t i = 0; i < size; ++i) {
|
||||
|
|
@ -704,9 +704,8 @@ void ProtocolLogic::LogRequestMsg(const uint8_t *txbuff, uint8_t size) {
|
|||
b = '.';
|
||||
tmp[i + 1] = b;
|
||||
}
|
||||
tmp[size + 1] = '\n';
|
||||
tmp[size + 2] = 0;
|
||||
if (!strncmp_P(tmp, PSTR(">S0*99.\n"), rqs) && !strncmp(lastMsg, tmp, rqs)) {
|
||||
tmp[size + 1] = 0;
|
||||
if (!strncmp_P(tmp, PSTR(">S0*99."), rqs) && !strncmp(lastMsg, tmp, rqs)) {
|
||||
// @@TODO we skip the repeated request msgs for now
|
||||
// to avoid spoiling the whole log just with ">S0" messages
|
||||
// especially when the MMU is not connected.
|
||||
|
|
@ -714,7 +713,7 @@ void ProtocolLogic::LogRequestMsg(const uint8_t *txbuff, uint8_t size) {
|
|||
// trying to find the MMU, but since it has been reliable in the past
|
||||
// we can live without it for now.
|
||||
} else {
|
||||
MMU2_ECHO_MSG(tmp);
|
||||
MMU2_ECHO_MSGLN(tmp);
|
||||
}
|
||||
memcpy(lastMsg, tmp, rqs);
|
||||
}
|
||||
|
|
@ -731,8 +730,7 @@ void ProtocolLogic::LogError(const char *reason_P) {
|
|||
void ProtocolLogic::LogResponse() {
|
||||
char lrb[lastReceivedBytes.size()];
|
||||
FormatLastResponseMsgAndClearLRB(lrb);
|
||||
MMU2_ECHO_MSG(lrb);
|
||||
SERIAL_ECHOLN();
|
||||
MMU2_ECHO_MSGLN(lrb);
|
||||
}
|
||||
|
||||
StepStatus ProtocolLogic::SuppressShortDropOuts(const char *msg_P, StepStatus ss) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue