Add optional UMP serial debugging.
This commit is contained in:
parent
9238d74082
commit
91756e37be
1 changed files with 8 additions and 0 deletions
8
UMP.cpp
8
UMP.cpp
|
@ -68,6 +68,8 @@ bool CUMP::open()
|
||||||
buffer[1U] = 3U;
|
buffer[1U] = 3U;
|
||||||
buffer[2U] = UMP_HELLO;
|
buffer[2U] = UMP_HELLO;
|
||||||
|
|
||||||
|
// CUtils::dump(1U, "Transmitted", buffer, 3U);
|
||||||
|
|
||||||
int n = m_serial.write(buffer, 3U);
|
int n = m_serial.write(buffer, 3U);
|
||||||
if (n != 3) {
|
if (n != 3) {
|
||||||
m_serial.close();
|
m_serial.close();
|
||||||
|
@ -91,6 +93,8 @@ bool CUMP::setMode(unsigned char mode)
|
||||||
buffer[2U] = UMP_SET_MODE;
|
buffer[2U] = UMP_SET_MODE;
|
||||||
buffer[3U] = mode;
|
buffer[3U] = mode;
|
||||||
|
|
||||||
|
// CUtils::dump(1U, "Transmitted", buffer, 4U);
|
||||||
|
|
||||||
return m_serial.write(buffer, 4U) == 4;
|
return m_serial.write(buffer, 4U) == 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,6 +112,8 @@ bool CUMP::setTX(bool on)
|
||||||
buffer[2U] = UMP_SET_TX;
|
buffer[2U] = UMP_SET_TX;
|
||||||
buffer[3U] = on ? 0x01U : 0x00U;
|
buffer[3U] = on ? 0x01U : 0x00U;
|
||||||
|
|
||||||
|
// CUtils::dump(1U, "Transmitted", buffer, 4U);
|
||||||
|
|
||||||
return m_serial.write(buffer, 4U) == 4;
|
return m_serial.write(buffer, 4U) == 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,6 +135,8 @@ int CUMP::write(const unsigned char* data, unsigned int length)
|
||||||
|
|
||||||
::memcpy(buffer + 3U, data, length);
|
::memcpy(buffer + 3U, data, length);
|
||||||
|
|
||||||
|
// CUtils::dump(1U, "Transmitted", buffer, length + 3U);
|
||||||
|
|
||||||
return m_serial.write(buffer, length + 3U);
|
return m_serial.write(buffer, length + 3U);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue