How to convert Wifi signal strength from Quality (percent) to RSSI (dBm)?

后端 未结 11 947
故里飘歌
故里飘歌 2020-12-04 12:42

How should I convert Wifi signal strength from a Quality in percentage, usually 0% to 100% into an RSSI value, usually a negative dBm number (i.e. -96db)?

11条回答
  •  攒了一身酷
    2020-12-04 13:01

    In JS I prefer doing something like:

    Math.min(Math.max(2 * (x + 100), 0), 100)

    My personal opinion is that it's more elegant way to write it, instead of using if's.

提交回复
热议问题