diff --git a/libuavcan/include/uavcan/timer.hpp b/libuavcan/include/uavcan/timer.hpp index ae7f78aa77..fdd2b13379 100644 --- a/libuavcan/include/uavcan/timer.hpp +++ b/libuavcan/include/uavcan/timer.hpp @@ -8,6 +8,7 @@ #include #include #include +#include namespace uavcan { @@ -63,21 +64,25 @@ class TimerEventForwarder : public Timer Functor functor_; public: + TimerEventForwarder(Scheduler& node) + : Timer(node) + , functor_() + { } + TimerEventForwarder(Scheduler& node, Functor functor) : Timer(node) , functor_(functor) - { - assert(try_implicit_cast(functor, true)); - } + { } const Functor& getFunctor() const { return functor_; } + void setFunctor(const Functor& functor) { functor_ = functor; } void onTimerEvent(const TimerEvent& event) { if (try_implicit_cast(functor_, true)) functor_(event); else - assert(0); + handleFatalError("Invalid timer functor"); } };