Skip to content

Percentage formula is inaccurate #2

@ghost

Description

Hello, I'm noticing an inaccuracy with the percentage formula provided in the README.

Your docs as well as a controller in your app suggest that a "percentage" can be calculated from the RSSI values provided by the scale. However, it seems that these give the wrong values. For example, the README gives an example value of 91 (in -dbM). Plugged into this formula, this simply returns 0. The same is true of all values ranging from 36 to 119:

=min(0, max(1, (115 - 91) / 52)) * 100 // returns 0
=min(0, max(1, (115 - 36) / 52)) * 100 // returns 0
=min(0, max(1, (115 - 119) / 52)) * 100 // returns 0

Something can't be right about this formula.

Perhaps substituting max and min for each other in the formula is what was meant? That would yield following percentages given the following example values:

=max(0, min(1, (115 - rssi) / 52)) * 100 // returns 46.15
=max(0, min(1, (115 - 36) / 52)) * 100 // returns 100
=max(0, min(1, (115 - 119) / 52)) * 100 // returns 0

=max(0, min(1, (115 - 102) / 52)) * 100 // returns 25
=max(0, min(1, (115 - 88) / 52)) * 100 // returns 51.92
=max(0, min(1, (115 - 76) / 52)) * 100 // returns 75

Do these percentages seem correct to y'all?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions