This commit is contained in:
Dmitry Borisenko
2020-08-28 04:58:38 +03:00
parent eb6c06c8e9
commit 3ab75bcea6
5 changed files with 50 additions and 26 deletions

View File

@@ -9,20 +9,21 @@ class SensorConverting : public LineParsing {
public:
SensorConverting() : LineParsing(){};
int mapping(int input) {
if (_map != "") {
_map.replace("map[", "");
_map.replace("]", "");
int mapping(String key, int input) {
String map_ = jsonReadStr(configOptionJson, key + "_map");
if (map_ != "") {
map_.replace("map[", "");
map_.replace("]", "");
input = map(input,
selectFromMarkerToMarker(_map, ",", 0).toInt(),
selectFromMarkerToMarker(_map, ",", 1).toInt(),
selectFromMarkerToMarker(_map, ",", 2).toInt(),
selectFromMarkerToMarker(_map, ",", 3).toInt());
selectFromMarkerToMarker(map_, ",", 0).toInt(),
selectFromMarkerToMarker(map_, ",", 1).toInt(),
selectFromMarkerToMarker(map_, ",", 2).toInt(),
selectFromMarkerToMarker(map_, ",", 3).toInt());
}
return input;
}
float correction(float input) {
float correction(String key, float input) {
_c.replace("c[", "");
_c.replace("]", "");
float coef = _c.toFloat();