diff --git a/core/MyOTAFirmwareUpdate.h b/core/MyOTAFirmwareUpdate.h index 4738359..b26589d 100644 --- a/core/MyOTAFirmwareUpdate.h +++ b/core/MyOTAFirmwareUpdate.h @@ -34,19 +34,19 @@ * * MyOTAFirmwareUpdate debug log messages: * -* |E| SYS | SUB | Message | Comment -* |-|------|-------|-------------------------------------------|---------------------------------------------------------------------------- -* | | OTA | FWP | UPDATE | FW update initiated -* |!| OTA | FWP | FLASH INIT FAIL | Failed to initialise flash -* | | OTA | FWP | UPDATE SKIPPED | FW update skipped, no newer version available -* | | OTA | FWP | RECV B=%04X | Received FW block (B) -* |!| OTA | FWP | WRONG FWB | Wrong FW block received -* | | OTA | FWP | FW END | FW received, proceed to CRC verification -* | | OTA | FWP | CRC OK | FW CRC verification OK -* |!| OTA | FWP | CRC FAIL | FW CRC verification failed -* | | OTA | FRQ | FW REQ,T=%04X,V=%04X,B=%04X | Request FW update, FW type (T), version (V), block (B) -* |!| OTA | FRQ | FW UPD FAIL | FW update failed -* | | OTA | CRC | B=%04X,C=%04X,F=%04X | FW CRC verification. FW blocks (B), calculated CRC (C), FW CRC (F) +* |E| SYS | SUB | Message | Comment +* |-|-----|-----|-----------------------------|---------------------------------------------------------------------------- +* | | OTA | FWP | UPDATE | FW update initiated +* |!| OTA | FWP | FLASH INIT FAIL | Failed to initialise flash +* | | OTA | FWP | UPDATE SKIPPED | FW update skipped, no newer version available +* | | OTA | FWP | RECV B=%04X | Received FW block (B) +* |!| OTA | FWP | WRONG FWB | Wrong FW block received +* | | OTA | FWP | FW END | FW received, proceed to CRC verification +* | | OTA | FWP | CRC OK | FW CRC verification OK +* |!| OTA | FWP | CRC FAIL | FW CRC verification failed +* | | OTA | FRQ | FW REQ,T=%04X,V=%04X,B=%04X | Request FW update, FW type (T), version (V), block (B) +* |!| OTA | FRQ | FW UPD FAIL | FW update failed +* | | OTA | CRC | B=%04X,C=%04X,F=%04X | FW CRC verification. FW blocks (B), calculated CRC (C), FW CRC (F) * * * @brief API declaration for MyOTAFirmwareUpdate diff --git a/core/MySensorsCore.cpp b/core/MySensorsCore.cpp index aa35d3e..eb999ad 100644 --- a/core/MySensorsCore.cpp +++ b/core/MySensorsCore.cpp @@ -31,7 +31,6 @@ #define CORE_DEBUG(x,...) //!< debug NULL #endif - // message buffers MyMessage _msg; // Buffer for incoming messages MyMessage _msgTmp; // Buffer for temporary messages (acks and nonces among others) diff --git a/core/MySensorsCore.h b/core/MySensorsCore.h index 1fd4f2b..21ef279 100644 --- a/core/MySensorsCore.h +++ b/core/MySensorsCore.h @@ -37,26 +37,26 @@ * * MySensorsCore debug log messages: * -* |E| SYS | SUB | Message | Comment -* |-|-------|-------|-----------------------------------------------|---------------------------------------------------------------------------- -* |!| MCO | BGN | HW ERR | Error HW initialization (e.g. ext. EEPROM) -* | | MCO | BGN | INIT %%s,CP=%%s,LIB=%%s | Core initialization, capabilities (CP), library version (VER) -* | | MCO | BGN | BFR | Callback before() -* | | MCO | BGN | STP | Callback setup() -* | | MCO | BGN | INIT OK,TSP=%%d | Core initialised, transport status (TSP), 1=initialised, 0=not initialised, NA=not available -* | | MCO | BGN | NODE UNLOCKED | Node successfully unlocked (see signing chapter) -* |!| MCO | BGN | TSP FAIL | Transport initialization failed -* | | MCO | REG | REQ | Registration request -* | | MCO | REG | NOT NEEDED | No registration needed (i.e. GW) -* |!| MCO | SND | NODE NOT REG | Node is not registered, cannot send message -* | | MCO | PIM | NODE REG=%%d | Registration response received, registration status (REG) -* | | MCO | SLP | MS=%%lu,SMS=%%d,I1=%%d,M1=%%d,I2=%%d,M2=%%d | Sleep node, time (MS), smartSleep (SMS), Int1/M1, Int2/M2 -* | | MCO | SLP | WUP=%%d | Node woke-up, reason/IRQ (WUP) -* |!| MCO | SLP | FWUPD | Sleeping not possible, FW update ongoing -* |!| MCO | SLP | REP | Sleeping not possible, repeater feature enabled -* |!| MCO | SLP | TNR | Transport not ready, attempt to reconnect until timeout (MY_SLEEP_TRANSPORT_RECONNECT_TIMEOUT_MS) -* | | MCO | NLK | NODE LOCKED. UNLOCK: GND PIN %%d AND RESET | Node locked during booting, see signing chapter for additional information -* | | MCO | NLK | TSL | Set transport to sleep +* |E| SYS | SUB | Message | Comment +* |-|-----|-----|---------------------------------------------|---------------------------------------------------------------------------- +* |!| MCO | BGN | HW ERR | Error HW initialization (e.g. ext. EEPROM) +* | | MCO | BGN | INIT %%s,CP=%%s,LIB=%%s | Core initialization, capabilities (CP), library version (LIB) +* | | MCO | BGN | BFR | Callback before() +* | | MCO | BGN | STP | Callback setup() +* | | MCO | BGN | INIT OK,TSP=%%d | Core initialised, transport status (TSP): 0=not initialised, 1=initialised, NA=not available +* | | MCO | BGN | NODE UNLOCKED | Node successfully unlocked (see signing chapter) +* |!| MCO | BGN | TSP FAIL | Transport initialization failed +* | | MCO | REG | REQ | Registration request +* | | MCO | REG | NOT NEEDED | No registration needed (i.e. GW) +* |!| MCO | SND | NODE NOT REG | Node is not registered, cannot send message +* | | MCO | PIM | NODE REG=%%d | Registration response received, registration status (REG) +* | | MCO | SLP | MS=%%lu,SMS=%%d,I1=%%d,M1=%%d,I2=%%d,M2=%%d | Sleep node, time (MS), smartSleep (SMS), Int1/M1, Int2/M2 +* | | MCO | SLP | WUP=%%d | Node woke-up, reason/IRQ (WUP) +* |!| MCO | SLP | FWUPD | Sleeping not possible, FW update ongoing +* |!| MCO | SLP | REP | Sleeping not possible, repeater feature enabled +* |!| MCO | SLP | TNR | Transport not ready, attempt to reconnect until timeout (MY_SLEEP_TRANSPORT_RECONNECT_TIMEOUT_MS) +* | | MCO | NLK | NODE LOCKED. UNLOCK: GND PIN %%d AND RESET | Node locked during booting, see signing chapter for additional information +* | | MCO | NLK | TSL | Set transport to sleep * * * @brief API declaration for MySensorsCore @@ -73,17 +73,17 @@ #include #include -#define GATEWAY_ADDRESS ((uint8_t)0) //!< Node ID for GW sketch -#define NODE_SENSOR_ID ((uint8_t)255) //!< Node child is always created/presented when a node is started -#define MY_CORE_VERSION ((uint8_t)2) //!< core version -#define MY_CORE_MIN_VERSION ((uint8_t)2) //!< min core version required for compatibility +#define GATEWAY_ADDRESS ((uint8_t)0) //!< Node ID for GW sketch +#define NODE_SENSOR_ID ((uint8_t)255) //!< Node child is always created/presented when a node is started +#define MY_CORE_VERSION ((uint8_t)2) //!< core version +#define MY_CORE_MIN_VERSION ((uint8_t)2) //!< min core version required for compatibility -#define MY_WAKE_UP_BY_TIMER ((int8_t)-1) //!< Sleeping wake up by timer -#define MY_SLEEP_NOT_POSSIBLE ((int8_t)-2) //!< Sleeping not possible -#define INTERRUPT_NOT_DEFINED ((uint8_t)255) //!< _sleep() param: no interrupt defined -#define MODE_NOT_DEFINED ((uint8_t)255) //!< _sleep() param: no mode defined -#define VALUE_NOT_DEFINED ((uint8_t)255) //!< Value not defined -#define FUNCTION_NOT_SUPPORTED ((uint16_t)0) //!< Function not supported +#define MY_WAKE_UP_BY_TIMER ((int8_t)-1) //!< Sleeping wake up by timer +#define MY_SLEEP_NOT_POSSIBLE ((int8_t)-2) //!< Sleeping not possible +#define INTERRUPT_NOT_DEFINED ((uint8_t)255) //!< _sleep() param: no interrupt defined +#define MODE_NOT_DEFINED ((uint8_t)255) //!< _sleep() param: no mode defined +#define VALUE_NOT_DEFINED ((uint8_t)255) //!< Value not defined +#define FUNCTION_NOT_SUPPORTED ((uint16_t)0) //!< Function not supported /** * @brief Controller configuration diff --git a/core/MyTransport.h b/core/MyTransport.h index 8871b74..74a26fe 100644 --- a/core/MyTransport.h +++ b/core/MyTransport.h @@ -31,12 +31,12 @@ * - TSF: messages emitted by transport support functions * - SUB SYSTEMS: * - Transport state machine (TSM) -* - TSM:INIT from stInit Initialize transport and radio -* - TSM:FPAR from stParent Find parent +* - TSM:INIT from stInit Initialize transport and radio +* - TSM:FPAR from stParent Find parent * - TSM:ID from stID Check/request node ID, if dynamic node ID set * - TSM:UPL from stUplink Verify uplink connection by pinging GW -* - TSM:READY from stReady Transport is ready and fully operational -* - TSM:FAIL from stFailure Failure in transport link or transport HW +* - TSM:READY from stReady Transport is ready and fully operational +* - TSM:FAIL from stFailure Failure in transport link or transport HW * - Transport support function (TSF) * - TSF:CKU from @ref transportCheckUplink(), checks connection to GW * - TSF:SID from @ref transportAssignNodeID(), assigns node ID @@ -55,77 +55,77 @@ * * Transport debug log messages: * -* |E| SYS | SUB | Message | Comment -* |-|-------|-----------|---------------------------|--------------------------------------------------------------------- -* | | TSM | INIT | | Transition to stInit state -* | | TSM | INIT | STATID=%%d | Node ID is static -* | | TSM | INIT | TSP OK | Transport device configured and fully operational -* | | TSM | INIT | TSP PSM | Transport passive mode set -* | | TSM | INIT | GW MODE | Node is set up as GW, thus omitting ID and findParent states -* |!| TSM | INIT | TSP FAIL | Transport device initialization failed -* | | TSM | FPAR | | Transition to stParent state -* | | TSM | FPAR | STATP=%%d | Static parent set, skip finding parent -* | | TSM | FPAR | OK | Parent node identified -* |!| TSM | FPAR | NO REPLY | No potential parents replied to find parent request -* |!| TSM | FPAR | FAIL | Finding parent failed -* | | TSM | ID | | Transition to stID state -* | | TSM | ID | OK,ID=%%d | Node ID is valid -* | | TSM | ID | REQ | Request node ID from controller -* |!| TSM | ID | FAIL,ID=%%d | ID verification failed, ID invalid -* | | TSM | UPL | | Transition to stUplink state -* | | TSM | UPL | OK | Uplink OK, GW returned ping -* | | TSF | UPL | DGWC,O=%%d,N=%%d | Uplink check revealed changed network topology, old distance (O), new distance (N) -* |!| TSM | UPL | FAIL | Uplink check failed, i.e. GW could not be pinged -* | | TSM | READY | SRT | Save routing table -* | | TSM | READY | ID=%%d,PAR=%%d,DIS=%%d | Transition to stReady Transport ready, node ID (ID), parent node ID (PAR), distance to GW (DIS) -* |!| TSM | READY | UPL FAIL,SNP | Too many failed uplink transmissions, search new parent -* |!| TSM | READY | FAIL,STATP | Too many failed uplink transmissions, static parent enforced -* | | TSM | FAIL | CNT=%%d | Transition to stFailure state, consecutive failure counter (CNT) -* | | TSM | FAIL | DIS | Disable transport -* | | TSM | FAIL | RE-INIT | Attempt to re-initialize transport -* | | TSF | CKU | OK | Uplink OK -* | | TSF | CKU | OK,FCTRL | Uplink OK, flood control prevents pinging GW in too short intervals -* | | TSF | CKU | DGWC,O=%%d,N=%%d | Uplink check revealed changed network topology, old distance (O), new distance (N) -* | | TSF | CKU | FAIL | No reply received when checking uplink -* | | TSF | SID | OK,ID=%%d | Node ID assigned -* |!| TSF | SID | FAIL,ID=%%d | Assigned ID is invalid -* | | TSF | PNG | SEND,TO=%%d | Send ping to destination (TO) -* | | TSF | WUR | MS=%%lu | Wait until transport ready, timeout (MS) -* | | TSF | MSG | ACK REQ | ACK message requested -* | | TSF | MSG | ACK | ACK message, do not proceed but forward to callback -* | | TSF | MSG | FPAR RES,ID=%%d,D=%%d | Response to find parent received from node (ID) with distance (D) to GW -* | | TSF | MSG | FPAR PREF FOUND | Preferred parent found, i.e. parent defined via MY_PARENT_NODE_ID -* | | TSF | MSG | FPAR OK,ID=%%d,D=%%d | Find parent response from node (ID) is valid, distance (D) to GW -* | | TSF | MSG | FPAR INACTIVE | Find parent response received, but no find parent request active, skip response -* | | TSF | MSG | FPAR REQ,ID=%%d | Find parent request from node (ID) -* | | TSF | MSG | PINGED,ID=%%d,HP=%%d | Node pinged by node (ID) with (HP) hops -* | | TSF | MSG | PONG RECV,HP=%%d | Pinged node replied with (HP) hops -* | | TSF | MSG | BC | Broadcast message received -* | | TSF | MSG | GWL OK | Link to GW ok -* | | TSF | MSG | FWD BC MSG | Controlled broadcast message forwarding -* | | TSF | MSG | REL MSG | Relay message -* | | TSF | MSG | REL PxNG,HP=%%d | Relay PING/PONG message, increment hop counter (HP) -* |!| TSF | MSG | LEN,%%d!=%%d | Invalid message length, (actual!=expected) -* |!| TSF | MSG | PVER,%%d!=%%d | Message protocol version mismatch (actual!=expected) -* |!| TSF | MSG | SIGN VERIFY FAIL | Signing verification failed -* |!| TSF | MSG | REL MSG,NORP | Node received a message for relaying, but node is not a repeater, message skipped -* |!| TSF | MSG | SIGN FAIL | Signing message failed -* |!| TSF | MSG | GWL FAIL | GW uplink failed -* |!| TSF | MSG | ID TK INVALID | Token for ID request invalid -* | | TSF | SAN | OK | Sanity check passed -* |!| TSF | SAN | FAIL | Sanity check failed, attempt to re-initialize radio -* | | TSF | CRT | OK | Clearing routing table successful -* | | TSF | LRT | OK | Loading routing table successful -* | | TSF | SRT | OK | Saving routing table successful -* |!| TSF | RTE | FPAR ACTIVE | Finding parent active, message not sent -* |!| TSF | RTE | DST %%d UNKNOWN | Routing for destination (DST) unknown, send message to parent -* | | TSF | RRT | ROUTE N=%%d,R=%%d | Routing table, messages to node (N) are routed via node (R) -* |!| TSF | SND | TNR | Transport not ready, message cannot be sent -* | | TSF | TDI | TSL | Set transport to sleep -* | | TSF | TDI | TPD | Power down transport -* | | TSF | TRI | TRI | Reinitialise transport -* | | TSF | TRI | TSB | Set transport to standby -* | | TSF | SIR | CMD=%d,VAL=%d | Get signal report +* |E| SYS | SUB | Message | Comment +* |-|-----|-------|---------------------------|--------------------------------------------------------------------- +* | | TSM | INIT | | Transition to stInit state +* | | TSM | INIT | STATID=%%d | Node ID is static +* | | TSM | INIT | TSP OK | Transport device configured and fully operational +* | | TSM | INIT | TSP PSM | Transport passive mode set +* | | TSM | INIT | GW MODE | Node is set up as GW, thus omitting ID and findParent states +* |!| TSM | INIT | TSP FAIL | Transport device initialization failed +* | | TSM | FPAR | | Transition to stParent state +* | | TSM | FPAR | STATP=%%d | Static parent set, skip finding parent +* | | TSM | FPAR | OK | Parent node identified +* |!| TSM | FPAR | NO REPLY | No potential parents replied to find parent request +* |!| TSM | FPAR | FAIL | Finding parent failed +* | | TSM | ID | | Transition to stID state +* | | TSM | ID | OK,ID=%%d | Node ID is valid +* | | TSM | ID | REQ | Request node ID from controller +* |!| TSM | ID | FAIL,ID=%%d | ID verification failed, ID invalid +* | | TSM | UPL | | Transition to stUplink state +* | | TSM | UPL | OK | Uplink OK, GW returned ping +* | | TSF | UPL | DGWC,O=%%d,N=%%d | Uplink check revealed changed network topology, old distance (O), new distance (N) +* |!| TSM | UPL | FAIL | Uplink check failed, i.e. GW could not be pinged +* | | TSM | READY | SRT | Save routing table +* | | TSM | READY | ID=%%d,PAR=%%d,DIS=%%d | Transition to stReady Transport ready, node ID (ID), parent node ID (PAR), distance to GW (DIS) +* |!| TSM | READY | UPL FAIL,SNP | Too many failed uplink transmissions, search new parent +* |!| TSM | READY | FAIL,STATP | Too many failed uplink transmissions, static parent enforced +* | | TSM | FAIL | CNT=%%d | Transition to stFailure state, consecutive failure counter (CNT) +* | | TSM | FAIL | DIS | Disable transport +* | | TSM | FAIL | RE-INIT | Attempt to re-initialize transport +* | | TSF | CKU | OK | Uplink OK +* | | TSF | CKU | OK,FCTRL | Uplink OK, flood control prevents pinging GW in too short intervals +* | | TSF | CKU | DGWC,O=%%d,N=%%d | Uplink check revealed changed network topology, old distance (O), new distance (N) +* | | TSF | CKU | FAIL | No reply received when checking uplink +* | | TSF | SID | OK,ID=%%d | Node ID assigned +* |!| TSF | SID | FAIL,ID=%%d | Assigned ID is invalid +* | | TSF | PNG | SEND,TO=%%d | Send ping to destination (TO) +* | | TSF | WUR | MS=%%lu | Wait until transport ready, timeout (MS) +* | | TSF | MSG | ACK REQ | ACK message requested +* | | TSF | MSG | ACK | ACK message, do not proceed but forward to callback +* | | TSF | MSG | FPAR RES,ID=%%d,D=%%d | Response to find parent received from node (ID) with distance (D) to GW +* | | TSF | MSG | FPAR PREF FOUND | Preferred parent found, i.e. parent defined via MY_PARENT_NODE_ID +* | | TSF | MSG | FPAR OK,ID=%%d,D=%%d | Find parent response from node (ID) is valid, distance (D) to GW +* | | TSF | MSG | FPAR INACTIVE | Find parent response received, but no find parent request active, skip response +* | | TSF | MSG | FPAR REQ,ID=%%d | Find parent request from node (ID) +* | | TSF | MSG | PINGED,ID=%%d,HP=%%d | Node pinged by node (ID) with (HP) hops +* | | TSF | MSG | PONG RECV,HP=%%d | Pinged node replied with (HP) hops +* | | TSF | MSG | BC | Broadcast message received +* | | TSF | MSG | GWL OK | Link to GW ok +* | | TSF | MSG | FWD BC MSG | Controlled broadcast message forwarding +* | | TSF | MSG | REL MSG | Relay message +* | | TSF | MSG | REL PxNG,HP=%%d | Relay PING/PONG message, increment hop counter (HP) +* |!| TSF | MSG | LEN,%%d!=%%d | Invalid message length, (actual!=expected) +* |!| TSF | MSG | PVER,%%d!=%%d | Message protocol version mismatch (actual!=expected) +* |!| TSF | MSG | SIGN VERIFY FAIL | Signing verification failed +* |!| TSF | MSG | REL MSG,NORP | Node received a message for relaying, but node is not a repeater, message skipped +* |!| TSF | MSG | SIGN FAIL | Signing message failed +* |!| TSF | MSG | GWL FAIL | GW uplink failed +* |!| TSF | MSG | ID TK INVALID | Token for ID request invalid +* | | TSF | SAN | OK | Sanity check passed +* |!| TSF | SAN | FAIL | Sanity check failed, attempt to re-initialize radio +* | | TSF | CRT | OK | Clearing routing table successful +* | | TSF | LRT | OK | Loading routing table successful +* | | TSF | SRT | OK | Saving routing table successful +* |!| TSF | RTE | FPAR ACTIVE | Finding parent active, message not sent +* |!| TSF | RTE | DST %%d UNKNOWN | Routing for destination (DST) unknown, send message to parent +* | | TSF | RRT | ROUTE N=%%d,R=%%d | Routing table, messages to node (N) are routed via node (R) +* |!| TSF | SND | TNR | Transport not ready, message cannot be sent +* | | TSF | TDI | TSL | Set transport to sleep +* | | TSF | TDI | TPD | Power down transport +* | | TSF | TRI | TRI | Reinitialise transport +* | | TSF | TRI | TSB | Set transport to standby +* | | TSF | SIR | CMD=%d,VAL=%d | Get signal report * * * Incoming / outgoing messages: