-
-
Save PolynomialDivision/059e034311eefff17d6fc28d23ea2547 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (iw->survey(ifname, buf, &val)) { | |
val = 0; | |
} else { | |
for (int i = 0, x = 1; i < len; i += sizeof(struct iwinfo_survey_entry), x++) { | |
e = (struct iwinfo_survey_entry *) &buf[i]; | |
if(e->mhz == freq) | |
{ | |
uint64_t dividend = e->busy_time - *last_channel_time_busy; | |
uint64_t divisor = e->active_time - *last_channel_time; | |
*last_channel_time = e->active_time; | |
*last_channel_time_busy = e->busy_time; | |
if(divisor) | |
ret = (int)(dividend * 255 / divisor); | |
break; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment