MAC command mac_decode calls
This commit is contained in:
parent
3187fb0d51
commit
63fd681c3b
@ -472,11 +472,6 @@ void myEventCallback(void *pUserData, ev_t ev) {
|
|||||||
void myRxCallback(void *pUserData, uint8_t port, const uint8_t *pMsg,
|
void myRxCallback(void *pUserData, uint8_t port, const uint8_t *pMsg,
|
||||||
size_t nMsg) {
|
size_t nMsg) {
|
||||||
|
|
||||||
// calculate if we have encapsulated MAC commands
|
|
||||||
uint8_t nMac = pMsg - &LMIC.frame[0];
|
|
||||||
if (port != MACPORT)
|
|
||||||
--nMac;
|
|
||||||
|
|
||||||
// display amount of received data
|
// display amount of received data
|
||||||
if (nMsg)
|
if (nMsg)
|
||||||
ESP_LOGI(TAG, "Received %u byte(s) of payload on port %u", nMsg, port);
|
ESP_LOGI(TAG, "Received %u byte(s) of payload on port %u", nMsg, port);
|
||||||
@ -485,11 +480,12 @@ void myRxCallback(void *pUserData, uint8_t port, const uint8_t *pMsg,
|
|||||||
|
|
||||||
switch (port) {
|
switch (port) {
|
||||||
|
|
||||||
// decode unpiggybacked mac messages if we want to print those
|
// decode mac messages if we want to print those
|
||||||
#if (VERBOSE)
|
#if (VERBOSE)
|
||||||
case MACPORT:
|
case MACPORT:
|
||||||
// decode downlink MAC commands
|
// decode downlink MAC commands
|
||||||
// mac_decode(LMIC.frame, nMac, MACdn_table, MACdn_tSize);
|
if (LMIC.dataBeg)
|
||||||
|
mac_decode(LMIC.frame, LMIC.dataBeg, MACdn_table, MACdn_tSize);
|
||||||
// decode uplink MAC commands
|
// decode uplink MAC commands
|
||||||
if (LMIC.pendMacLen)
|
if (LMIC.pendMacLen)
|
||||||
mac_decode(LMIC.pendMacData, LMIC.pendMacLen, MACup_table, MACup_tSize);
|
mac_decode(LMIC.pendMacData, LMIC.pendMacLen, MACup_table, MACup_tSize);
|
||||||
@ -509,15 +505,11 @@ void myRxCallback(void *pUserData, uint8_t port, const uint8_t *pMsg,
|
|||||||
recv_timeserver_ans(pMsg, nMsg);
|
recv_timeserver_ans(pMsg, nMsg);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// decode any piggybacked downlink MAC commands if we want to print those
|
||||||
default:
|
default:
|
||||||
|
|
||||||
// decode any piggybacked downlink MAC commands
|
|
||||||
#if (VERBOSE)
|
#if (VERBOSE)
|
||||||
if (nMac) {
|
if (LMIC.dataBeg > 1)
|
||||||
// decoding yet to come
|
mac_decode(LMIC.frame, LMIC.dataBeg - 1, MACdn_table, MACdn_tSize);
|
||||||
// -> whe need to unwrap the MAC command from LMIC.frame before calling
|
|
||||||
// mac_decode(LMIC.frame, nMac, MACdn_table, MACdn_tSize);
|
|
||||||
}
|
|
||||||
#endif // VERBOSE
|
#endif // VERBOSE
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user