Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InfiniPaint vibrate on colorchange, fix color rotation #803

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/displayapp/DisplayApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction)
currentScreen = std::make_unique<Screens::Twos>(this);
break;
case Apps::Paint:
currentScreen = std::make_unique<Screens::InfiniPaint>(this, lvgl);
currentScreen = std::make_unique<Screens::InfiniPaint>(this, lvgl, motorController);
break;
case Apps::Paddle:
currentScreen = std::make_unique<Screens::Paddle>(this, lvgl);
Expand Down
8 changes: 6 additions & 2 deletions src/displayapp/screens/InfiniPaint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@

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);
}

Expand All @@ -15,6 +18,7 @@ InfiniPaint::~InfiniPaint() {
bool InfiniPaint::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
switch (event) {
case Pinetime::Applications::TouchEvents::LongTap:
color = (color + 1) % 8;
switch (color) {
case 0:
selectColor = LV_COLOR_MAGENTA;
Expand Down Expand Up @@ -47,7 +51,7 @@ bool InfiniPaint::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
}

std::fill(b, b + bufferSize, selectColor);
color++;
motor.RunForDuration(35);
return true;
default:
return true;
Expand Down
8 changes: 5 additions & 3 deletions src/displayapp/screens/InfiniPaint.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#pragma once

#include <lvgl/lvgl.h>
#include <cstdint>
#include "Screen.h"
#include "components/motor/MotorController.h"
#include <cstdint>
#include <lvgl/lvgl.h>

namespace Pinetime {
namespace Components {
Expand All @@ -13,7 +14,7 @@ namespace Pinetime {

class InfiniPaint : public Screen {
public:
InfiniPaint(DisplayApp* app, Pinetime::Components::LittleVgl& lvgl);
InfiniPaint(DisplayApp* app, Pinetime::Components::LittleVgl& lvgl, Controllers::MotorController& motor);

~InfiniPaint() override;

Expand All @@ -23,6 +24,7 @@ namespace Pinetime {

private:
Pinetime::Components::LittleVgl& lvgl;
Controllers::MotorController& motor;
static constexpr uint16_t width = 10;
static constexpr uint16_t height = 10;
static constexpr uint16_t bufferSize = width * height;
Expand Down