mirror of
https://github.com/lumapu/ahoy.git
synced 2025-05-22 21:36:11 +02:00
review #804
This commit is contained in:
parent
a1fb4aa911
commit
3f2e40848e
3 changed files with 17 additions and 41 deletions
|
@ -144,10 +144,8 @@ class Inverter {
|
|||
void enqueCommand(uint8_t cmd) {
|
||||
_commandQueue.push(std::make_shared<T>(cmd));
|
||||
DPRINT_IVID(DBG_INFO, id);
|
||||
//DPRINT(DBG_INFO, F("(#"));
|
||||
//DBGPRINT(String(id));
|
||||
DBGPRINTLN(F("enqueCommand: 0x") + String(cmd, HEX));
|
||||
//DBGHEXLN(cmd);
|
||||
DBGPRINTLN(F("enqueCommand: 0x"));
|
||||
DBGHEXLN(cmd);
|
||||
}
|
||||
|
||||
void setQueuedCmdFinished() {
|
||||
|
@ -305,7 +303,8 @@ class Inverter {
|
|||
DPRINTLN(DBG_DEBUG, "add config");
|
||||
if (getPosByChFld(0, FLD_ACT_ACTIVE_PWR_LIMIT, rec) == pos){
|
||||
actPowerLimit = rec->record[pos];
|
||||
DPRINTLN(DBG_DEBUG, F("Inverter actual power limit: ") + String(actPowerLimit, 1));
|
||||
DPRINT(DBG_DEBUG, F("Inverter actual power limit: "));
|
||||
DBGPRINTLN(String(actPowerLimit, 1));
|
||||
}
|
||||
}
|
||||
else if (rec->assign == AlarmDataAssignment) {
|
||||
|
|
|
@ -118,10 +118,6 @@ class HmPayload {
|
|||
iv->setQueuedCmdFinished(); // command failed
|
||||
if (mSerialDebug) {
|
||||
DPRINTLN(DBG_INFO, F("enqueued cmd failed/timeout"));
|
||||
//if (mSerialDebug) {
|
||||
//DPRINT(DBG_INFO, F("(#"));
|
||||
//DBGPRINT(String(iv->id));
|
||||
//DBGPRINT(F(") no Payload received! (retransmits: "));
|
||||
DPRINT_IVID(DBG_INFO, iv->id);
|
||||
DBGPRINT(F("no Payload received! (retransmits: "));
|
||||
DBGPRINT(String(mPayload[iv->id].retransmits));
|
||||
|
@ -137,18 +133,12 @@ class HmPayload {
|
|||
yield();
|
||||
if (mSerialDebug) {
|
||||
DPRINT_IVID(DBG_INFO, iv->id);
|
||||
//DPRINT(DBG_INFO, F("(#"));
|
||||
//DBGPRINT(String(iv->id));
|
||||
//DBGPRINT(F(") Requesting Inv SN "));
|
||||
DBGPRINT(F("Requesting Inv SN "));
|
||||
DBGPRINTLN(String(iv->config->serial.u64, HEX));
|
||||
}
|
||||
|
||||
if (iv->getDevControlRequest()) {
|
||||
if (mSerialDebug) {
|
||||
//DPRINT(DBG_INFO, F("(#"));
|
||||
//DBGPRINT(String(iv->id));
|
||||
//DBGPRINT(F(") Devcontrol request 0x"));
|
||||
DPRINT_IVID(DBG_INFO, iv->id);
|
||||
DBGPRINT(F("Devcontrol request 0x"));
|
||||
DBGPRINT(String(iv->devControlCmd, HEX));
|
||||
|
@ -161,9 +151,6 @@ class HmPayload {
|
|||
//iv->enqueCommand<InfoCommand>(SystemConfigPara); // read back power limit
|
||||
} else {
|
||||
uint8_t cmd = iv->getQueuedCmd();
|
||||
//DPRINT(DBG_INFO, F("(#"));
|
||||
//DBGPRINT(String(iv->id));
|
||||
//DBGPRINT(F(") prepareDevInformCmd 0x"));
|
||||
DPRINT_IVID(DBG_INFO, iv->id);
|
||||
DBGPRINT(F("prepareDevInformCmd 0x"));
|
||||
DBGHEXLN(cmd);
|
||||
|
@ -180,7 +167,8 @@ class HmPayload {
|
|||
if (*pid == 0x00) {
|
||||
DPRINTLN(DBG_DEBUG, F("fragment number zero received and ignored"));
|
||||
} else {
|
||||
DPRINTLN(DBG_DEBUG, F("PID: 0x") + String(*pid, HEX));
|
||||
DPRINT(DBG_DEBUG, F("PID: 0x"));
|
||||
DBGHEXLN(*pid);
|
||||
if ((*pid & 0x7F) < MAX_PAYLOAD_ENTRIES) {
|
||||
memcpy(mPayload[iv->id].data[(*pid & 0x7F) - 1], &p->packet[10], p->len - 11);
|
||||
mPayload[iv->id].len[(*pid & 0x7F) - 1] = p->len - 11;
|
||||
|
@ -208,9 +196,7 @@ class HmPayload {
|
|||
mApp->setMqttPowerLimitAck(iv);
|
||||
else
|
||||
ok = false;
|
||||
//DPRINT(DBG_INFO, F("(#"));
|
||||
//DBGPRINT(String(iv->id));
|
||||
if (mSerialDebug) {
|
||||
|
||||
DPRINT_IVID(DBG_INFO, iv->id);
|
||||
DBGPRINT(F("has "));
|
||||
if(!ok) DBGPRINT(F("not "));
|
||||
|
@ -218,7 +204,6 @@ class HmPayload {
|
|||
DBGPRINT(String(iv->powerLimit[0]));
|
||||
DBGPRINT(F(" with PowerLimitControl "));
|
||||
DBGPRINTLN(String(iv->powerLimit[1]));
|
||||
}
|
||||
|
||||
iv->clearCmdQueue();
|
||||
iv->enqueCommand<InfoCommand>(SystemConfigPara); // read back power limit
|
||||
|
@ -254,8 +239,6 @@ class HmPayload {
|
|||
DPRINTLN(DBG_INFO, F("Prevent retransmit on Restart / CleanState_LockAndAlarm..."));
|
||||
mPayload[iv->id].retransmits = mMaxRetrans;
|
||||
} else if(iv->devControlCmd == ActivePowerContr) {
|
||||
//DPRINT(DBG_INFO, F("(#"));
|
||||
//DBGPRINT(String(iv->id));
|
||||
DPRINT_IVID(DBG_INFO, iv->id);
|
||||
DPRINTLN(DBG_INFO, F("retransmit power limit"));
|
||||
mSys->Radio.sendControlPacket(iv->radioId.u64, iv->devControlCmd, iv->powerLimit, true);
|
||||
|
@ -267,16 +250,12 @@ class HmPayload {
|
|||
DPRINTLN(DBG_INFO, F("(#") + String(iv->id) + F(") prepareDevInformCmd 0x") + String(mPayload[iv->id].txCmd, HEX));
|
||||
mSys->Radio.prepareDevInformCmd(iv->radioId.u64, mPayload[iv->id].txCmd, mPayload[iv->id].ts, iv->alarmMesIndex, true);
|
||||
*/
|
||||
//DPRINT(DBG_INFO, F("(#"));
|
||||
//DBGPRINT(String(iv->id));
|
||||
DPRINT_IVID(DBG_INFO, iv->id);
|
||||
DBGPRINTLN(F("nothing received"));
|
||||
mPayload[iv->id].retransmits = mMaxRetrans;
|
||||
} else {
|
||||
for (uint8_t i = 0; i < (mPayload[iv->id].maxPackId - 1); i++) {
|
||||
if (mPayload[iv->id].len[i] == 0) {
|
||||
//DPRINT(DBG_WARN, F("(#"));
|
||||
//DBGPRINT(String(iv->id));
|
||||
DPRINT_IVID(DBG_WARN, iv->id);
|
||||
DBGPRINT(F("Frame "));
|
||||
DBGPRINT(String(i + 1));
|
||||
|
@ -295,8 +274,6 @@ class HmPayload {
|
|||
mPayload[iv->id].retransmits++;
|
||||
DPRINTLN(DBG_WARN, F("CRC Error: Request Complete Retransmit"));
|
||||
mPayload[iv->id].txCmd = iv->getQueuedCmd();
|
||||
//DPRINT(DBG_INFO, F("(#"));
|
||||
//DBGPRINT(String(iv->id));
|
||||
DPRINT_IVID(DBG_INFO, iv->id);
|
||||
DBGPRINT(F("prepareDevInformCmd 0x"));
|
||||
DBGHEXLN(mPayload[iv->id].txCmd);
|
||||
|
@ -307,7 +284,8 @@ class HmPayload {
|
|||
DBGHEXLN(mPayload[iv->id].txCmd);
|
||||
DPRINT(DBG_INFO, F("procPyld: txid: 0x"));
|
||||
DBGHEXLN(mPayload[iv->id].txId);
|
||||
DPRINTLN(DBG_DEBUG, F("procPyld: max: ") + String(mPayload[iv->id].maxPackId));
|
||||
DPRINT(DBG_DEBUG, F("procPyld: max: "));
|
||||
DBGPRINTLN(String(mPayload[iv->id].maxPackId));
|
||||
record_t<> *rec = iv->getRecordStruct(mPayload[iv->id].txCmd); // choose the parser
|
||||
mPayload[iv->id].complete = true;
|
||||
|
||||
|
|
|
@ -62,8 +62,7 @@
|
|||
}
|
||||
|
||||
inline void DBGHEXLN(uint8_t b) {
|
||||
if( b<0x10 ) DBGPRINT(F("0"));
|
||||
DBGPRINT(String(b, HEX));
|
||||
DHEX(b);
|
||||
DBGPRINT(F("\r\n"));
|
||||
}
|
||||
/*inline void DHEX(uint16_t b) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue