Skip to content

File evamMinmaxDecor.h

File List > src > evamMinmaxDecor.h

Go to the documentation of this file

#pragma once

#include <evafMinmax.h>
#include <evaStdReaders.h>

namespace evam
{
    template <class TMotor, unsigned char N>
    class MinmaxDecor : public TMotor
    {
    private:
        evaf::Minmax<eva::ValueReader, N> mFilter;

    public:
        // MinmaxDecor() : eva::Heartbeat(kHeartbeatPeriodMs) {}

        template <typename... Args>
        MinmaxDecor(Args... args) : TMotor(args...) {}

        void Go(signed short value)
        {
            mFilter.setValue(constrain(value, -1000, 1000));
            TMotor::Go(mFilter.getValue());
        }
    };
}