esp-cpp / espp

C++ components for ESP
https://esp-cpp.github.io/espp/
MIT License
28 stars 9 forks source link

fix(math): update range mapper implementation #229

Closed finger563 closed 1 month ago

finger563 commented 1 month ago

Description

Motivation and Context

Previously the range mapper had some bugs depending on how the input or output distributions were configured (since parts of the code did a test against T(0) instead of center_ (input center) or output_center_). Additionally, the deadzone / deadband that was applied around center not only caused the output to be the output_center_ value, but also introduced a discontinuity in the output distribution for an input value of deadband +- center.

This PR fixes those issues and also adds a note about the possible deprecation / unwise use of the invert_input flag.

How has this been tested?

Building and running the math example on a qtpy esp32s3 and graphing the output of the range mapper test.

Screenshots (if appropriate, e.g. schematic, board, console logs, lab pictures):

CleanShot 2024-05-13 at 14 16 32 range_mapper.xlsx

range_mapper.csv

Types of changes

Checklist:

Software

github-actions[bot] commented 1 month ago

:white_check_mark:Static analysis result - no issues found! :white_check_mark: