Simplify dumpBuf method in HoymilesRadio
This commit is contained in:
parent
83c623708f
commit
46036eb958
@ -51,17 +51,15 @@ void HoymilesRadio::sendLastPacketAgain()
|
|||||||
sendEsbPacket(cmd);
|
sendEsbPacket(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HoymilesRadio::dumpBuf(const char* info, uint8_t buf[], uint8_t len)
|
void HoymilesRadio::dumpBuf(const uint8_t buf[], uint8_t len, bool appendNewline)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (NULL != info)
|
|
||||||
Hoymiles.getMessageOutput()->print(String(info));
|
|
||||||
|
|
||||||
for (uint8_t i = 0; i < len; i++) {
|
for (uint8_t i = 0; i < len; i++) {
|
||||||
Hoymiles.getMessageOutput()->printf("%02X ", buf[i]);
|
Hoymiles.getMessageOutput()->printf("%02X ", buf[i]);
|
||||||
}
|
}
|
||||||
|
if (appendNewline) {
|
||||||
Hoymiles.getMessageOutput()->println("");
|
Hoymiles.getMessageOutput()->println("");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool HoymilesRadio::isInitialized()
|
bool HoymilesRadio::isInitialized()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -23,7 +23,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
static serial_u convertSerialToRadioId(serial_u serial);
|
static serial_u convertSerialToRadioId(serial_u serial);
|
||||||
void dumpBuf(const char* info, uint8_t buf[], uint8_t len);
|
void dumpBuf(const uint8_t buf[], uint8_t len, bool appendNewline = true);
|
||||||
|
|
||||||
bool checkFragmentCrc(fragment_t* fragment);
|
bool checkFragmentCrc(fragment_t* fragment);
|
||||||
virtual void sendEsbPacket(CommandAbstract* cmd) = 0;
|
virtual void sendEsbPacket(CommandAbstract* cmd) = 0;
|
||||||
|
|||||||
@ -112,7 +112,7 @@ bool HoymilesRadio_CMT::cmtSwitchInvAndDtuFreq(const uint64_t inv_serial, const
|
|||||||
cmtTxBuffer[14] = crc8(cmtTxBuffer, 14);
|
cmtTxBuffer[14] = crc8(cmtTxBuffer, 14);
|
||||||
|
|
||||||
Hoymiles.getMessageOutput()->printf("TX CMD56 %s --> ", cmtChToFreq(cmtCurrentCh).c_str());
|
Hoymiles.getMessageOutput()->printf("TX CMD56 %s --> ", cmtChToFreq(cmtCurrentCh).c_str());
|
||||||
dumpBuf("", cmtTxBuffer, 15);
|
dumpBuf(cmtTxBuffer, 15);
|
||||||
|
|
||||||
cmtTxLength = 15;
|
cmtTxLength = 15;
|
||||||
cmtTxTimeout = 100;
|
cmtTxTimeout = 100;
|
||||||
@ -371,7 +371,7 @@ void HoymilesRadio_CMT::loop()
|
|||||||
if (nullptr != inv) {
|
if (nullptr != inv) {
|
||||||
// Save packet in inverter rx buffer
|
// Save packet in inverter rx buffer
|
||||||
Hoymiles.getMessageOutput()->printf("RX %s --> ", cmtChToFreq(f.channel).c_str());
|
Hoymiles.getMessageOutput()->printf("RX %s --> ", cmtChToFreq(f.channel).c_str());
|
||||||
dumpBuf("", f.fragment, f.len);
|
dumpBuf(f.fragment, f.len, false);
|
||||||
Hoymiles.getMessageOutput()->printf("| %d dBm", f.rssi);
|
Hoymiles.getMessageOutput()->printf("| %d dBm", f.rssi);
|
||||||
|
|
||||||
inv->addRxFragment(f.fragment, f.len);
|
inv->addRxFragment(f.fragment, f.len);
|
||||||
|
|||||||
@ -75,9 +75,8 @@ void HoymilesRadio_NRF::loop()
|
|||||||
|
|
||||||
if (nullptr != inv) {
|
if (nullptr != inv) {
|
||||||
// Save packet in inverter rx buffer
|
// Save packet in inverter rx buffer
|
||||||
char buf[30];
|
Hoymiles.getMessageOutput()->printf("RX Channel: %d --> ", f.channel);
|
||||||
snprintf(buf, sizeof(buf), "RX Channel: %d --> ", f.channel);
|
dumpBuf(f.fragment, f.len);
|
||||||
dumpBuf(buf, f.fragment, f.len);
|
|
||||||
inv->addRxFragment(f.fragment, f.len);
|
inv->addRxFragment(f.fragment, f.len);
|
||||||
} else {
|
} else {
|
||||||
Hoymiles.getMessageOutput()->println("Inverter Not found!");
|
Hoymiles.getMessageOutput()->println("Inverter Not found!");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user