Skip to content

Commit cb9465c

Browse files
authored
Fix NowCast weight_factor calculation
weight_factor is supposed to be based on the rate of change, not the range itself.
1 parent 1c501ad commit cb9465c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/sensor_nowcast_aqi.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ script:
221221
// Calculate the weight factor
222222
float range = max - min;
223223
float rate = range / max;
224-
float weight_factor = 1.0 - range;
224+
float weight_factor = 1.0 - rate;
225225
if (weight_factor < 0.5) {
226226
weight_factor = 0.5;
227227
} else if (weight_factor > 1.0) {
@@ -274,7 +274,7 @@ script:
274274
// Calculate the weight factor
275275
float range = max - min;
276276
float rate = range / max;
277-
float weight_factor = 1.0 - range;
277+
float weight_factor = 1.0 - rate;
278278
if (weight_factor < 0.5) {
279279
weight_factor = 0.5;
280280
} else if (weight_factor > 1.0) {

0 commit comments

Comments
 (0)