1
0
Fork 0

Merge branch 'clemensvonmolo-paint-colorchange-vibration' into develop

This commit is contained in:
Jean-François Milants 2021-12-02 21:43:17 +01:00
commit ada96ccdc8
3 changed files with 10 additions and 4 deletions

View file

@ -430,7 +430,7 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction)
currentScreen = std::make_unique<Screens::Twos>(this); currentScreen = std::make_unique<Screens::Twos>(this);
break; break;
case Apps::Paint: case Apps::Paint:
currentScreen = std::make_unique<Screens::InfiniPaint>(this, lvgl); currentScreen = std::make_unique<Screens::InfiniPaint>(this, lvgl, motorController);
break; break;
case Apps::Paddle: case Apps::Paddle:
currentScreen = std::make_unique<Screens::Paddle>(this, lvgl); currentScreen = std::make_unique<Screens::Paddle>(this, lvgl);

View file

@ -4,7 +4,10 @@
using namespace Pinetime::Applications::Screens; using namespace Pinetime::Applications::Screens;
InfiniPaint::InfiniPaint(Pinetime::Applications::DisplayApp* app, Pinetime::Components::LittleVgl& lvgl) : Screen(app), lvgl {lvgl} { InfiniPaint::InfiniPaint(Pinetime::Applications::DisplayApp* app,
Pinetime::Components::LittleVgl& lvgl,
Pinetime::Controllers::MotorController& motor)
: Screen(app), lvgl {lvgl}, motor {motor} {
std::fill(b, b + bufferSize, selectColor); std::fill(b, b + bufferSize, selectColor);
} }
@ -15,6 +18,7 @@ InfiniPaint::~InfiniPaint() {
bool InfiniPaint::OnTouchEvent(Pinetime::Applications::TouchEvents event) { bool InfiniPaint::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
switch (event) { switch (event) {
case Pinetime::Applications::TouchEvents::LongTap: case Pinetime::Applications::TouchEvents::LongTap:
color = (color + 1) % 8;
switch (color) { switch (color) {
case 0: case 0:
selectColor = LV_COLOR_MAGENTA; selectColor = LV_COLOR_MAGENTA;
@ -47,7 +51,7 @@ bool InfiniPaint::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
} }
std::fill(b, b + bufferSize, selectColor); std::fill(b, b + bufferSize, selectColor);
color++; motor.RunForDuration(35);
return true; return true;
default: default:
return true; return true;

View file

@ -4,6 +4,7 @@
#include <cstdint> #include <cstdint>
#include <algorithm> // std::fill #include <algorithm> // std::fill
#include "displayapp/screens/Screen.h" #include "displayapp/screens/Screen.h"
#include "components/motor/MotorController.h"
namespace Pinetime { namespace Pinetime {
namespace Components { namespace Components {
@ -14,7 +15,7 @@ namespace Pinetime {
class InfiniPaint : public Screen { class InfiniPaint : public Screen {
public: public:
InfiniPaint(DisplayApp* app, Pinetime::Components::LittleVgl& lvgl); InfiniPaint(DisplayApp* app, Pinetime::Components::LittleVgl& lvgl, Controllers::MotorController& motor);
~InfiniPaint() override; ~InfiniPaint() override;
@ -24,6 +25,7 @@ namespace Pinetime {
private: private:
Pinetime::Components::LittleVgl& lvgl; Pinetime::Components::LittleVgl& lvgl;
Controllers::MotorController& motor;
static constexpr uint16_t width = 10; static constexpr uint16_t width = 10;
static constexpr uint16_t height = 10; static constexpr uint16_t height = 10;
static constexpr uint16_t bufferSize = width * height; static constexpr uint16_t bufferSize = width * height;