Skip to content

Commit 426acd1

Browse files
author
Mika Tervonen
committed
Fixed filter to not drop packets when no modification
packet drop check is skipped if no modification for signal quality made.
1 parent a9d7c1b commit 426acd1

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

source/MAC/IEEE802_15_4/mac_filter.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,6 @@ int_fast8_t mac_filter_modify_link_quality(int8_t interface_id, mac_pre_parsed_f
343343
dbm_add = this->dbm_add;
344344
}
345345

346-
347346
//calculate
348347
int16_t lqi = ( (mac_frame->LQI * lqi_m ) >> 8 ) + lqi_add;
349348
// Saturate
@@ -368,8 +367,13 @@ int_fast8_t mac_filter_modify_link_quality(int8_t interface_id, mac_pre_parsed_f
368367

369368
tr_debug_extra("mac_filter_modify_link_quality result lqi %d dbm %d",mac_frame->LQI,mac_frame->dbm);
370369
// If quality goes below treshold packet is dropped
371-
if ( ( mac_frame->dbm < MAC_FILTER_SIGNAL_FLOOR ) || ( mac_frame->LQI < 1 )) {
372-
tr_debug_extra("Filter dropped packet");
370+
if ( (dbm_m != 0x100 || dbm_add != 0) && (mac_frame->dbm < MAC_FILTER_SIGNAL_FLOOR)) {
371+
tr_debug_extra("Filter dropped packet signal too low");
372+
return 1;
373+
}
374+
375+
if ( (lqi_m != 0x100 || lqi_add != 0) && (mac_frame->LQI < 1)) {
376+
tr_debug_extra("Filter dropped packet LQI < 1");
373377
return 1;
374378
}
375379
return 0;

0 commit comments

Comments
 (0)