Added command names to serial output

This commit is contained in:
Thomas Basler 2022-10-02 17:17:34 +02:00
parent c8c6b2a978
commit 18ec145dda
16 changed files with 55 additions and 1 deletions

View File

@ -233,7 +233,9 @@ void HoymilesRadio::sendEsbPacket(CommandAbstract* cmd)
openWritingPipe(s); openWritingPipe(s);
_radio->setRetries(3, 15); _radio->setRetries(3, 15);
Serial.print(F("TX Channel: ")); Serial.print(F("TX "));
Serial.print(cmd->getCommandName());
Serial.print(F(" Channel: "));
Serial.print(_radio->getChannel()); Serial.print(_radio->getChannel());
Serial.print(F(" --> ")); Serial.print(F(" --> "));
cmd->dumpDataPayload(Serial); cmd->dumpDataPayload(Serial);

View File

@ -20,6 +20,11 @@ ActivePowerControlCommand::ActivePowerControlCommand(uint64_t target_address, ui
setTimeout(2000); setTimeout(2000);
} }
String ActivePowerControlCommand::getCommandName()
{
return "ActivePowerControl";
}
void ActivePowerControlCommand::setActivePowerLimit(float limit, PowerLimitControlType type) void ActivePowerControlCommand::setActivePowerLimit(float limit, PowerLimitControlType type)
{ {
uint16_t l = limit * 10; uint16_t l = limit * 10;

View File

@ -12,6 +12,9 @@ typedef enum { // ToDo: to be verified by field tests
class ActivePowerControlCommand : public DevControlCommand { class ActivePowerControlCommand : public DevControlCommand {
public: public:
explicit ActivePowerControlCommand(uint64_t target_address = 0, uint64_t router_address = 0); explicit ActivePowerControlCommand(uint64_t target_address = 0, uint64_t router_address = 0);
virtual String getCommandName();
virtual bool handleResponse(InverterAbstract* inverter, fragment_t fragment[], uint8_t max_fragment_id); virtual bool handleResponse(InverterAbstract* inverter, fragment_t fragment[], uint8_t max_fragment_id);
virtual void gotTimeout(InverterAbstract* inverter); virtual void gotTimeout(InverterAbstract* inverter);

View File

@ -9,6 +9,11 @@ AlarmDataCommand::AlarmDataCommand(uint64_t target_address, uint64_t router_addr
setTimeout(500); setTimeout(500);
} }
String AlarmDataCommand::getCommandName()
{
return "AlarmData";
}
bool AlarmDataCommand::handleResponse(InverterAbstract* inverter, fragment_t fragment[], uint8_t max_fragment_id) bool AlarmDataCommand::handleResponse(InverterAbstract* inverter, fragment_t fragment[], uint8_t max_fragment_id)
{ {
// Check CRC of whole payload // Check CRC of whole payload

View File

@ -6,6 +6,8 @@ class AlarmDataCommand : public MultiDataCommand {
public: public:
explicit AlarmDataCommand(uint64_t target_address = 0, uint64_t router_address = 0, time_t time = 0); explicit AlarmDataCommand(uint64_t target_address = 0, uint64_t router_address = 0, time_t time = 0);
virtual String getCommandName();
virtual bool handleResponse(InverterAbstract* inverter, fragment_t fragment[], uint8_t max_fragment_id); virtual bool handleResponse(InverterAbstract* inverter, fragment_t fragment[], uint8_t max_fragment_id);
virtual void gotTimeout(InverterAbstract* inverter); virtual void gotTimeout(InverterAbstract* inverter);
}; };

View File

@ -27,6 +27,8 @@ public:
void setTimeout(uint32_t timeout); void setTimeout(uint32_t timeout);
uint32_t getTimeout(); uint32_t getTimeout();
virtual String getCommandName() = 0;
void setSendCount(uint8_t count); void setSendCount(uint8_t count);
uint8_t getSendCount(); uint8_t getSendCount();
uint8_t incrementSendCount(); uint8_t incrementSendCount();

View File

@ -9,6 +9,11 @@ DevInfoAllCommand::DevInfoAllCommand(uint64_t target_address, uint64_t router_ad
setTimeout(200); setTimeout(200);
} }
String DevInfoAllCommand::getCommandName()
{
return "DevInfoAll";
}
bool DevInfoAllCommand::handleResponse(InverterAbstract* inverter, fragment_t fragment[], uint8_t max_fragment_id) bool DevInfoAllCommand::handleResponse(InverterAbstract* inverter, fragment_t fragment[], uint8_t max_fragment_id)
{ {
// Check CRC of whole payload // Check CRC of whole payload

View File

@ -6,5 +6,7 @@ class DevInfoAllCommand : public MultiDataCommand {
public: public:
explicit DevInfoAllCommand(uint64_t target_address = 0, uint64_t router_address = 0, time_t time = 0); explicit DevInfoAllCommand(uint64_t target_address = 0, uint64_t router_address = 0, time_t time = 0);
virtual String getCommandName();
virtual bool handleResponse(InverterAbstract* inverter, fragment_t fragment[], uint8_t max_fragment_id); virtual bool handleResponse(InverterAbstract* inverter, fragment_t fragment[], uint8_t max_fragment_id);
}; };

View File

@ -9,6 +9,11 @@ DevInfoSimpleCommand::DevInfoSimpleCommand(uint64_t target_address, uint64_t rou
setTimeout(200); setTimeout(200);
} }
String DevInfoSimpleCommand::getCommandName()
{
return "DevInfoSimple";
}
bool DevInfoSimpleCommand::handleResponse(InverterAbstract* inverter, fragment_t fragment[], uint8_t max_fragment_id) bool DevInfoSimpleCommand::handleResponse(InverterAbstract* inverter, fragment_t fragment[], uint8_t max_fragment_id)
{ {
// Check CRC of whole payload // Check CRC of whole payload

View File

@ -6,5 +6,7 @@ class DevInfoSimpleCommand : public MultiDataCommand {
public: public:
explicit DevInfoSimpleCommand(uint64_t target_address = 0, uint64_t router_address = 0, time_t time = 0); explicit DevInfoSimpleCommand(uint64_t target_address = 0, uint64_t router_address = 0, time_t time = 0);
virtual String getCommandName();
virtual bool handleResponse(InverterAbstract* inverter, fragment_t fragment[], uint8_t max_fragment_id); virtual bool handleResponse(InverterAbstract* inverter, fragment_t fragment[], uint8_t max_fragment_id);
}; };

View File

@ -9,6 +9,11 @@ RealTimeRunDataCommand::RealTimeRunDataCommand(uint64_t target_address, uint64_t
setTimeout(200); setTimeout(200);
} }
String RealTimeRunDataCommand::getCommandName()
{
return "RealTimeRunData";
}
bool RealTimeRunDataCommand::handleResponse(InverterAbstract* inverter, fragment_t fragment[], uint8_t max_fragment_id) bool RealTimeRunDataCommand::handleResponse(InverterAbstract* inverter, fragment_t fragment[], uint8_t max_fragment_id)
{ {
// Check CRC of whole payload // Check CRC of whole payload

View File

@ -6,6 +6,8 @@ class RealTimeRunDataCommand : public MultiDataCommand {
public: public:
explicit RealTimeRunDataCommand(uint64_t target_address = 0, uint64_t router_address = 0, time_t time = 0); explicit RealTimeRunDataCommand(uint64_t target_address = 0, uint64_t router_address = 0, time_t time = 0);
virtual String getCommandName();
virtual bool handleResponse(InverterAbstract* inverter, fragment_t fragment[], uint8_t max_fragment_id); virtual bool handleResponse(InverterAbstract* inverter, fragment_t fragment[], uint8_t max_fragment_id);
virtual void gotTimeout(InverterAbstract* inverter); virtual void gotTimeout(InverterAbstract* inverter);
}; };

View File

@ -10,6 +10,11 @@ RequestFrameCommand::RequestFrameCommand(uint64_t target_address, uint64_t route
_payload_size = 10; _payload_size = 10;
} }
String RequestFrameCommand::getCommandName()
{
return "RequestFrame";
}
void RequestFrameCommand::setFrameNo(uint8_t frame_no) void RequestFrameCommand::setFrameNo(uint8_t frame_no)
{ {
_payload[9] = frame_no | 0x80; _payload[9] = frame_no | 0x80;

View File

@ -6,6 +6,8 @@ class RequestFrameCommand : public SingleDataCommand {
public: public:
explicit RequestFrameCommand(uint64_t target_address = 0, uint64_t router_address = 0, uint8_t frame_no = 0); explicit RequestFrameCommand(uint64_t target_address = 0, uint64_t router_address = 0, uint8_t frame_no = 0);
virtual String getCommandName();
void setFrameNo(uint8_t frame_no); void setFrameNo(uint8_t frame_no);
uint8_t getFrameNo(); uint8_t getFrameNo();

View File

@ -9,6 +9,11 @@ SystemConfigParaCommand::SystemConfigParaCommand(uint64_t target_address, uint64
setTimeout(200); setTimeout(200);
} }
String SystemConfigParaCommand::getCommandName()
{
return "SystemConfigPara";
}
bool SystemConfigParaCommand::handleResponse(InverterAbstract* inverter, fragment_t fragment[], uint8_t max_fragment_id) bool SystemConfigParaCommand::handleResponse(InverterAbstract* inverter, fragment_t fragment[], uint8_t max_fragment_id)
{ {
// Check CRC of whole payload // Check CRC of whole payload

View File

@ -6,6 +6,8 @@ class SystemConfigParaCommand : public MultiDataCommand {
public: public:
explicit SystemConfigParaCommand(uint64_t target_address = 0, uint64_t router_address = 0, time_t time = 0); explicit SystemConfigParaCommand(uint64_t target_address = 0, uint64_t router_address = 0, time_t time = 0);
virtual String getCommandName();
virtual bool handleResponse(InverterAbstract* inverter, fragment_t fragment[], uint8_t max_fragment_id); virtual bool handleResponse(InverterAbstract* inverter, fragment_t fragment[], uint8_t max_fragment_id);
virtual void gotTimeout(InverterAbstract* inverter); virtual void gotTimeout(InverterAbstract* inverter);
}; };