-
Notifications
You must be signed in to change notification settings - Fork 36
spectrum-scanner: Run time performance improvements #52
base: master
Are you sure you want to change the base?
Conversation
f825374
to
29589dc
Compare
This change does truncate the averaged ED to integers, but I don't think the precision matters here because radio noise is not exact, we are only interested in seeing which channels are occupied. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good code-wise, but also the output changed considerably: i.e. the values are more wide-spread. On master its mostly blue-ish but with this PR it get yellow and green, too. Which I think is good because it makes differences more visible.
Btw. I tested with samr21-xpro, everything still works - with these IMHO good visual enhancements.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure why the output changes on samr21-xpro. My intuition tells me that it is because of the increased effective duty cycle of the CCA checks detecting more short frame wifi traffic than before, and thus the average ED level will go up.
spectrum-scanner/main.c
Outdated
@@ -125,10 +126,10 @@ void spectrum_scanner(unsigned long interval_us) | |||
print("] ", 2); | |||
for (unsigned int ch = IEEE802154_CHANNEL_MIN; ch <= IEEE802154_CHANNEL_MAX; ++ch) { | |||
/* Compute the average pseudo-energy and convert back to dB */ | |||
ed_average[k][ch] = logf(ed_average[k][ch] / count) * 128.f; | |||
uint32_t ed = ilogbf(ed_average[k][ch] / count); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be int32_t
29589dc
to
b27903a
Compare
Experiments show that using ldexpf, ilogbf yields significantly faster run time performance on Cortex-M0+ without floating point hardware.
b27903a
to
e3f85f0
Compare
Experiments show that using ldexpf, ilogbf yields significantly faster
run time performance on Cortex-M0+ without floating point hardware.