33 lines
895 B
C++
33 lines
895 B
C++
#pragma once
|
|
|
|
#include "Widget.hpp"
|
|
|
|
class PowerLinkWidget : public Widget {
|
|
public:
|
|
explicit PowerLinkWidget(const WidgetConfig& config);
|
|
~PowerLinkWidget() override;
|
|
lv_obj_t* create(lv_obj_t* parent) override;
|
|
void applyStyle() override;
|
|
void onKnxValue(float value) override;
|
|
void onKnxSwitch(bool value) override;
|
|
|
|
private:
|
|
static constexpr uint8_t POINT_COUNT = 16;
|
|
lv_point_precise_t points_[POINT_COUNT] = {};
|
|
lv_obj_t* dot_ = nullptr;
|
|
float p0x_ = 0.0f;
|
|
float p0y_ = 0.0f;
|
|
float p1x_ = 0.0f;
|
|
float p1y_ = 0.0f;
|
|
float p2x_ = 0.0f;
|
|
float p2y_ = 0.0f;
|
|
float pathLen_ = 0.0f;
|
|
float dotRadius_ = 3.0f;
|
|
float speed_ = 0.0f;
|
|
bool reverse_ = false;
|
|
void buildLinePoints();
|
|
void startDotAnimation();
|
|
void updateAnimation(float speed, bool reverse);
|
|
static void dotAnimExec(void* var, int32_t value);
|
|
};
|