Skip to content

Commit

Permalink
ChangeSlowly SVF optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
profezzorn committed Dec 31, 2023
1 parent 8a26003 commit b752519
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion functions/change_slowly.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
class BladeBase;

template<class F, class SPEED>
class ChangeSlowly {
class ChangeSlowlySVF {
public:
void run(BladeBase* blade) {
f_.run(blade);
Expand All @@ -31,11 +31,19 @@ class ChangeSlowly {
}
}
int getInteger(int led) { return value_; }
int calculate(BladeBase* blade) { return value_; }
private:
PONUA SVFWrapper<F> f_;
PONUA SVFWrapper<SPEED> speed_;
uint32_t last_micros_ = 0;
int value_;
};

// optimized specialization
template<class F, class SPEED>
class SingleValueAdapter<ChangeSlowlySVF<F, SPEED>> : public ChangeSlowlySVF<F, SPEED> {};

template<class F, class SPEED>
using ChangeSlowly = SingleValueAdapter<ChangeSlowlySVF<F, SPEED>>;

#endif

0 comments on commit b752519

Please sign in to comment.