• Well, optimizing for speed is often bad for readability. I wouldn't add "+0.5" to the code, just to save the time needed for this extra operation.
    And yes, numbers in square brackets are not rounded to an integer. And we all love code like this:

    >foo={"0.5": "bar", "1": "foo"};

    Since prepareDisplay is one of the slowest functions: ColorMap has only 8 different values, Temperature has 208 different values - so it might be feasible to pre-compute things and avoid all division and multiplication operations with Temperature in this function - if there's enough RAM available on the ESP32. Anyway, that's much harder than just removing rounding and clamping for TemperatureMap values. Removing 262 function calls will result in a measurable improvement, even for the compiled version.


Avatar for maze1980 @maze1980 started