mirror of https://github.com/arendst/Tasmota.git
Fix map_double compile error
This commit is contained in:
parent
19fcaf8866
commit
faf6e66e32
|
@ -481,3 +481,7 @@ float Polynomialf(const float *factors, uint32_t degree, float x) {
|
|||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
float map_float(float x, float in_min, float in_max, float out_min, float out_max) {
|
||||
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
|
||||
}
|
||||
|
|
|
@ -2464,7 +2464,7 @@ void CmndScale(void)
|
|||
float fromHigh = CharToFloat(ArgV(argument, 3));
|
||||
float toLow = CharToFloat(ArgV(argument, 4));
|
||||
float toHigh = CharToFloat(ArgV(argument, 5));
|
||||
float value = map_double(valueIN, fromLow, fromHigh, toLow, toHigh);
|
||||
float value = map_float(valueIN, fromLow, fromHigh, toLow, toHigh);
|
||||
dtostrfd(value, Settings->flag2.calc_resolution, rules_vars[XdrvMailbox.index -1]);
|
||||
bitSet(Rules.vars_event, XdrvMailbox.index -1);
|
||||
} else {
|
||||
|
@ -2475,11 +2475,6 @@ void CmndScale(void)
|
|||
}
|
||||
}
|
||||
|
||||
float map_double(float x, float in_min, float in_max, float out_min, float out_max)
|
||||
{
|
||||
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
|
||||
}
|
||||
|
||||
/*********************************************************************************************\
|
||||
* Interface
|
||||
\*********************************************************************************************/
|
||||
|
|
|
@ -390,17 +390,17 @@ int usaEpaStandardPm2d5Adjustment(int pm25_standard, int relative_humidity)
|
|||
int compute_us_aqi(int pm25_standard)
|
||||
{
|
||||
if (pm25_standard <= 9) {
|
||||
return map_double(pm25_standard, 0, 9, 0, 50);
|
||||
return map_float(pm25_standard, 0, 9, 0, 50);
|
||||
} else if (pm25_standard <= 35) {
|
||||
return map_double(pm25_standard, 9.1f, 35.4f, 51, 100);
|
||||
return map_float(pm25_standard, 9.1f, 35.4f, 51, 100);
|
||||
} else if (pm25_standard <= 55) {
|
||||
return map_double(pm25_standard, 35.5f, 55.4f, 101, 150);
|
||||
return map_float(pm25_standard, 35.5f, 55.4f, 101, 150);
|
||||
} else if (pm25_standard <= 125) {
|
||||
return map_double(pm25_standard, 55.5f, 125.4f, 151, 200);
|
||||
return map_float(pm25_standard, 55.5f, 125.4f, 151, 200);
|
||||
} else if (pm25_standard <= 225) {
|
||||
return map_double(pm25_standard, 125.5f, 225.4f, 201, 300);
|
||||
return map_float(pm25_standard, 125.5f, 225.4f, 201, 300);
|
||||
} else if (pm25_standard <= 325) {
|
||||
return map_double(pm25_standard, 225.5f, 325.4f, 301, 500);
|
||||
return map_float(pm25_standard, 225.5f, 325.4f, 301, 500);
|
||||
} else {
|
||||
return 500;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue