1
0
Fork 0
This commit is contained in:
Frab012 2026-07-16 07:43:23 +00:00 committed by GitHub
commit 289c7f0c4e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 14 additions and 11 deletions

View file

@ -327,10 +327,10 @@ CO_HBconsumer_process(CO_HBconsumer_t* HBcons, bool_t NMTisPreOrOperational, uin
monitoredNode->functSignalObjectRemoteReset);
}
#endif
if (monitoredNode->HBstate == CO_HBconsumer_ACTIVE) {
if (monitoredNode->HBstate != CO_HBconsumer_UNKNOWN) {
CO_errorReport(HBcons->em, CO_EM_HB_CONSUMER_REMOTE_RESET, CO_EMC_HEARTBEAT, i);
monitoredNode->HBstate = CO_HBconsumer_RESTART;
}
monitoredNode->HBstate = CO_HBconsumer_UNKNOWN;
} else {
/* heartbeat message */
@ -342,15 +342,15 @@ CO_HBconsumer_process(CO_HBconsumer_t* HBcons, bool_t NMTisPreOrOperational, uin
}
#endif
monitoredNode->HBstate = CO_HBconsumer_ACTIVE;
/* reset timer */
monitoredNode->timeoutTimer = 0;
timeDifference_us_copy = 0;
}
CO_FLAG_CLEAR(monitoredNode->CANrxNew);
/* reset timer */
monitoredNode->timeoutTimer = 0;
timeDifference_us_copy = 0;
}
/* Verify timeout */
if (monitoredNode->HBstate == CO_HBconsumer_ACTIVE) {
if (monitoredNode->HBstate == CO_HBconsumer_ACTIVE || monitoredNode->HBstate == CO_HBconsumer_RESTART) {
monitoredNode->timeoutTimer += timeDifference_us_copy;
if (monitoredNode->timeoutTimer >= monitoredNode->time_us) {
@ -377,11 +377,13 @@ CO_HBconsumer_process(CO_HBconsumer_t* HBcons, bool_t NMTisPreOrOperational, uin
#endif
}
if (monitoredNode->HBstate != CO_HBconsumer_ACTIVE) {
allMonitoredActiveCurrent = false;
}
if (monitoredNode->NMTstate != CO_NMT_OPERATIONAL) {
allMonitoredOperationalCurrent = false;
if (monitoredNode->HBstate != CO_HBconsumer_UNKNOWN) {
if (monitoredNode->HBstate != CO_HBconsumer_ACTIVE) {
allMonitoredActiveCurrent = false;
}
if (monitoredNode->NMTstate != CO_NMT_OPERATIONAL) {
allMonitoredOperationalCurrent = false;
}
}
#if (((CO_CONFIG_HB_CONS)&CO_CONFIG_HB_CONS_CALLBACK_CHANGE) != 0) \
|| (((CO_CONFIG_HB_CONS)&CO_CONFIG_HB_CONS_CALLBACK_MULTI) != 0)

View file

@ -64,6 +64,7 @@ typedef enum {
CO_HBconsumer_UNKNOWN = 0x01U, /**< Consumer enabled, but no heartbeat received yet */
CO_HBconsumer_ACTIVE = 0x02U, /**< Heartbeat received within set time */
CO_HBconsumer_TIMEOUT = 0x03U, /**< No heatbeat received for set time */
CO_HBconsumer_RESTART = 0x04U, /**< Monitored node was reset */
} CO_HBconsumer_state_t;
/**