file(s) created; namespace UTILITY_FUNCTIONS moved here from Controller.h(pp)
This commit is contained in:
Binary file not shown.
@@ -1,2 +0,0 @@
|
||||
# Generated by CMake. Changes will be overwritten.
|
||||
/home/k4/tmp/bbr-algo/BinderBeispielRegler/app/main.cpp
|
||||
Binary file not shown.
Binary file not shown.
@@ -1,15 +0,0 @@
|
||||
# Generated by CMake. Changes will be overwritten.
|
||||
/home/k4/tmp/bbr-algo/BinderBeispielRegler/app/datamodel.h
|
||||
/home/k4/tmp/bbr-algo/BinderBeispielRegler/app/datamodel.cpp
|
||||
/home/k4/tmp/bbr-algo/BinderBeispielRegler/app/pid.cpp
|
||||
/home/k4/tmp/bbr-algo/BinderBeispielRegler/app/pwm.cpp
|
||||
/home/k4/tmp/bbr-algo/BinderBeispielRegler/app/filter.h
|
||||
/home/k4/tmp/bbr-algo/BinderBeispielRegler/app/filter.cpp
|
||||
/home/k4/tmp/bbr-algo/BinderBeispielRegler/app/main.cpp
|
||||
/home/k4/tmp/bbr-algo/BinderBeispielRegler/app/pid.h
|
||||
/home/k4/tmp/bbr-algo/BinderBeispielRegler/app/dataset.h
|
||||
/home/k4/tmp/bbr-algo/BinderBeispielRegler/app/pwm.h
|
||||
/home/k4/tmp/bbr-algo/BinderBeispielRegler/app/climate-algorithm.cpp
|
||||
/home/k4/tmp/bbr-algo/BinderBeispielRegler/app/text-templates.h
|
||||
/home/k4/tmp/bbr-algo/BinderBeispielRegler/app/dataset.cpp
|
||||
/home/k4/tmp/bbr-algo/BinderBeispielRegler/app/climate-algorithm.h
|
||||
6
app/util.cpp
Normal file
6
app/util.cpp
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
|
||||
namespace UTILITY_FUNCTIONS {
|
||||
|
||||
|
||||
}
|
||||
52
app/util.h
Normal file
52
app/util.h
Normal file
@@ -0,0 +1,52 @@
|
||||
#ifndef UTIL_H
|
||||
#define UTIL_H
|
||||
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <cstdint>
|
||||
|
||||
|
||||
#define MAX std::max
|
||||
#define MIN std::min
|
||||
|
||||
namespace UTILITY_FUNCTIONS {
|
||||
|
||||
|
||||
inline double limit(double x, double lo, double hi) {
|
||||
return (x < lo) ? lo : (x > hi) ? hi : x;
|
||||
}
|
||||
|
||||
inline double max3(double a, double b, double c) {
|
||||
return std::max(a, std::max(b, c));
|
||||
}
|
||||
inline double min3(double a, double b, double c) {
|
||||
return std::min(a, std::min(b, c));
|
||||
}
|
||||
|
||||
|
||||
inline bool is_valid(double x) { return std::isfinite(x); }
|
||||
|
||||
// ST: REAL_TO_INT(x) i.d.R. trunc Richtung 0. Bei Siemens oft ROUND? Du nutzt
|
||||
// häufig +0.5.
|
||||
inline int real_to_int(double x) { return static_cast<int>(x); }
|
||||
|
||||
// Platzhalter für GET_VALUE_* (kommt vermutlich aus Parameter-/Recipe-System)
|
||||
inline std::int32_t GET_VALUE_DINT(int /*a*/, int /*b*/, int /*c*/, int /*d*/) {
|
||||
// TODO: an dein Parameter-System anbinden
|
||||
return 0;
|
||||
}
|
||||
inline double GET_VALUE_REAL(int /*a*/, int /*b*/, int /*c*/, int /*d*/) {
|
||||
// TODO: an dein Parameter-System anbinden
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
class Util{
|
||||
public:
|
||||
|
||||
};
|
||||
|
||||
} // namespace UTILITY_FUNCTIONS
|
||||
|
||||
|
||||
|
||||
#endif // UTIL_H
|
||||
Reference in New Issue
Block a user