clang format code
This commit is contained in:
parent
91d7c9fffc
commit
1458aa7992
18 changed files with 1230 additions and 1212 deletions
2
Platformio/.vscode/settings.json
vendored
2
Platformio/.vscode/settings.json
vendored
|
@ -81,6 +81,6 @@
|
||||||
"variant": "cpp"
|
"variant": "cpp"
|
||||||
},
|
},
|
||||||
"cmake.sourceDirectory": "${workspaceFolder}/.pio/libdeps/esp32/Adafruit BusIO",
|
"cmake.sourceDirectory": "${workspaceFolder}/.pio/libdeps/esp32/Adafruit BusIO",
|
||||||
"editor.formatOnSave": false,
|
"editor.formatOnSave": true,
|
||||||
"idf.portWin": "COM8"
|
"idf.portWin": "COM8"
|
||||||
}
|
}
|
File diff suppressed because it is too large
Load diff
|
@ -24,7 +24,6 @@ public:
|
||||||
lv_obj_t *addWifiMidSignal(lv_obj_t *parent);
|
lv_obj_t *addWifiMidSignal(lv_obj_t *parent);
|
||||||
lv_obj_t *addWifiHighSignal(lv_obj_t *parent);
|
lv_obj_t *addWifiHighSignal(lv_obj_t *parent);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Make Image based on anImageDesc then
|
// Make Image based on anImageDesc then
|
||||||
// add that image to parent.
|
// add that image to parent.
|
||||||
|
@ -46,5 +45,4 @@ private:
|
||||||
lv_img_dsc_t wifiLowSignal;
|
lv_img_dsc_t wifiLowSignal;
|
||||||
lv_img_dsc_t wifiMidSignal;
|
lv_img_dsc_t wifiMidSignal;
|
||||||
lv_img_dsc_t wifiHighSignal;
|
lv_img_dsc_t wifiHighSignal;
|
||||||
|
|
||||||
};
|
};
|
|
@ -2,6 +2,5 @@
|
||||||
|
|
||||||
using namespace UI;
|
using namespace UI;
|
||||||
|
|
||||||
UIBase::UIBase(std::shared_ptr<HardwareAbstract> aHardware):mHardware(aHardware){
|
UIBase::UIBase(std::shared_ptr<HardwareAbstract> aHardware)
|
||||||
|
: mHardware(aHardware) {}
|
||||||
}
|
|
|
@ -13,7 +13,6 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::shared_ptr<HardwareAbstract> mHardware;
|
std::shared_ptr<HardwareAbstract> mHardware;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
} // namespace UI
|
|
@ -1,13 +1,10 @@
|
||||||
#include "ScreenManager.hpp"
|
#include "ScreenManager.hpp"
|
||||||
|
|
||||||
|
|
||||||
using namespace UI::Screen;
|
using namespace UI::Screen;
|
||||||
|
|
||||||
Manager Manager::mManager = Manager();
|
Manager Manager::mManager = Manager();
|
||||||
|
|
||||||
Manager& Manager::getInstance(){
|
Manager &Manager::getInstance() { return mManager; }
|
||||||
return mManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
Manager::Manager() {}
|
Manager::Manager() {}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "ScreenBase.hpp"
|
#include "ScreenBase.hpp"
|
||||||
#include <stack>
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <stack>
|
||||||
|
|
||||||
namespace UI::Screen {
|
namespace UI::Screen {
|
||||||
|
|
||||||
|
@ -17,4 +17,4 @@ private:
|
||||||
std::stack<std::unique_ptr<UI::Screen::Base>> pages;
|
std::stack<std::unique_ptr<UI::Screen::Base>> pages;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
} // namespace UI::Screen
|
|
@ -1,11 +1,8 @@
|
||||||
#include "UIElement.hpp"
|
#include "UIElement.hpp"
|
||||||
|
|
||||||
namespace UI
|
namespace UI {
|
||||||
{
|
UIElement::UIElement(lv_obj_t *aLvglSelf, uint16_t aId)
|
||||||
UIElement::UIElement(lv_obj_t* aLvglSelf, uint16_t aId):
|
: mLvglSelf(aLvglSelf), mId(aId) {
|
||||||
mLvglSelf(aLvglSelf),
|
|
||||||
mId(aId)
|
|
||||||
{
|
|
||||||
mLvglSelf->user_data = this;
|
mLvglSelf->user_data = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,4 +13,4 @@ protected:
|
||||||
lv_obj_t *mLvglSelf;
|
lv_obj_t *mLvglSelf;
|
||||||
uint16_t mId;
|
uint16_t mId;
|
||||||
};
|
};
|
||||||
}
|
} // namespace UI
|
|
@ -1,3 +1,4 @@
|
||||||
|
#pragma once
|
||||||
class IHandleButtons {
|
class IHandleButtons {
|
||||||
virtual void OnKeyTap() = 0;
|
virtual void OnKeyTap() = 0;
|
||||||
};
|
};
|
|
@ -4,8 +4,10 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
using namespace std::chrono;
|
using namespace std::chrono;
|
||||||
|
using namespace UI;
|
||||||
|
|
||||||
poller::poller(std::function<void()> aOnPollCb, milliseconds aPollTime):mIntermittentCallback(std::move(aOnPollCb)){
|
poller::poller(std::function<void()> aOnPollCb, milliseconds aPollTime)
|
||||||
|
: mIntermittentCallback(std::move(aOnPollCb)) {
|
||||||
mTimer = lv_timer_create(poller::onPoll, aPollTime.count(), this);
|
mTimer = lv_timer_create(poller::onPoll, aPollTime.count(), this);
|
||||||
lv_timer_set_repeat_count(mTimer, -1); // Call forever
|
lv_timer_set_repeat_count(mTimer, -1); // Call forever
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,18 @@
|
||||||
#include <chrono>
|
|
||||||
#include <memory>
|
|
||||||
#include <functional>
|
|
||||||
#include "lvgl.h"
|
#include "lvgl.h"
|
||||||
|
#include <chrono>
|
||||||
|
#include <functional>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
namespace UI {
|
||||||
class poller {
|
class poller {
|
||||||
public:
|
public:
|
||||||
poller(std::function<void()> aOnPollCb, std::chrono::milliseconds pollTime = std::chrono::seconds(5));
|
poller(std::function<void()> aOnPollCb,
|
||||||
|
std::chrono::milliseconds pollTime = std::chrono::seconds(5));
|
||||||
virtual ~poller();
|
virtual ~poller();
|
||||||
|
|
||||||
void setPollPeriod(std::chrono::milliseconds aPollPeriod){ lv_timer_set_period(mTimer, aPollPeriod.count());}
|
void setPollPeriod(std::chrono::milliseconds aPollPeriod) {
|
||||||
|
lv_timer_set_period(mTimer, aPollPeriod.count());
|
||||||
|
}
|
||||||
inline void pause() { lv_timer_pause(mTimer); }
|
inline void pause() { lv_timer_pause(mTimer); }
|
||||||
inline void resume() { lv_timer_resume(mTimer); }
|
inline void resume() { lv_timer_resume(mTimer); }
|
||||||
inline void reset() { lv_timer_reset(mTimer); }
|
inline void reset() { lv_timer_reset(mTimer); }
|
||||||
|
@ -18,6 +22,8 @@ private:
|
||||||
lv_timer_t *mTimer = nullptr;
|
lv_timer_t *mTimer = nullptr;
|
||||||
std::function<void()> mIntermittentCallback = nullptr;
|
std::function<void()> mIntermittentCallback = nullptr;
|
||||||
|
|
||||||
// Static function registered to every timers callback to pass this object as context
|
// Static function registered to every timers callback to pass this object as
|
||||||
|
// context
|
||||||
static void onPoll(_lv_timer_t *aTimer);
|
static void onPoll(_lv_timer_t *aTimer);
|
||||||
};
|
};
|
||||||
|
} // namespace UI
|
0
Platformio/OmoteUI/core/screen/HomeScreen.cpp
Normal file
0
Platformio/OmoteUI/core/screen/HomeScreen.cpp
Normal file
0
Platformio/OmoteUI/core/screen/HomeScreen.hpp
Normal file
0
Platformio/OmoteUI/core/screen/HomeScreen.hpp
Normal file
|
@ -2,12 +2,9 @@
|
||||||
|
|
||||||
using namespace UI::Screen;
|
using namespace UI::Screen;
|
||||||
|
|
||||||
Base::Base(uint16_t aId) : UIElement(mScreen, aId),
|
Base::Base(uint16_t aId)
|
||||||
mScreen(lv_obj_create(NULL))
|
: UIElement(mScreen, aId), mScreen(lv_obj_create(NULL)) {}
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void Base::AddWidget(Widget::Base::Ptr aWidget)
|
void Base::AddWidget(Widget::Base::Ptr aWidget) {
|
||||||
{
|
|
||||||
mWidgets.push_back(std::move(aWidget));
|
mWidgets.push_back(std::move(aWidget));
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,4 +21,4 @@ private:
|
||||||
std::vector<Widget::Base::Ptr> mWidgets;
|
std::vector<Widget::Base::Ptr> mWidgets;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
} // namespace UI::Screen
|
|
@ -1,8 +1,5 @@
|
||||||
#include "WidgetBase.hpp"
|
#include "WidgetBase.hpp"
|
||||||
|
|
||||||
namespace UI::Widget{
|
using namespace UI::Widget;
|
||||||
|
|
||||||
Base::Base(lv_obj_t *aLvglSelf) : UIElement(aLvglSelf) {}
|
Base::Base(lv_obj_t *aLvglSelf) : UIElement(aLvglSelf) {}
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -11,7 +11,6 @@ public:
|
||||||
Base(lv_obj_t *aLvglSelf);
|
Base(lv_obj_t *aLvglSelf);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
} // namespace UI::Widget
|
||||||
|
|
Loading…
Add table
Reference in a new issue