Skip to content

Commit

Permalink
Fixed filter to not drop packets when no modification
Browse files Browse the repository at this point in the history
packet drop check is skipped if no modification for signal quality made.
  • Loading branch information
Mika Tervonen committed Nov 7, 2018
1 parent a9d7c1b commit 426acd1
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions source/MAC/IEEE802_15_4/mac_filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,6 @@ int_fast8_t mac_filter_modify_link_quality(int8_t interface_id, mac_pre_parsed_f
dbm_add = this->dbm_add;
}


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

tr_debug_extra("mac_filter_modify_link_quality result lqi %d dbm %d",mac_frame->LQI,mac_frame->dbm);
// If quality goes below treshold packet is dropped
if ( ( mac_frame->dbm < MAC_FILTER_SIGNAL_FLOOR ) || ( mac_frame->LQI < 1 )) {
tr_debug_extra("Filter dropped packet");
if ( (dbm_m != 0x100 || dbm_add != 0) && (mac_frame->dbm < MAC_FILTER_SIGNAL_FLOOR)) {
tr_debug_extra("Filter dropped packet signal too low");
return 1;
}

if ( (lqi_m != 0x100 || lqi_add != 0) && (mac_frame->LQI < 1)) {
tr_debug_extra("Filter dropped packet LQI < 1");
return 1;
}
return 0;
Expand Down

0 comments on commit 426acd1

Please sign in to comment.