I think the intent here is to only keep the entry with the "better measurement data". But channel and frequency don't really say anything about being better. With this the existing entry in wifi_measures will get replaced, if we get a second entry for the same key, but a different channel/frequency. That's not quite the same logic as the one for signal.

In this case I'd actually stick with the first entry we got and delete the channel/frequency checks. The first value is as likely good, as is the second for the same key.