Merge branch 'clemensvonmolo-paint-colorchange-vibration' into develop
This commit is contained in:
commit
ada96ccdc8
3 changed files with 10 additions and 4 deletions
|
@ -430,7 +430,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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include <cstdint>
|
||||
#include <algorithm> // std::fill
|
||||
#include "displayapp/screens/Screen.h"
|
||||
#include "components/motor/MotorController.h"
|
||||
|
||||
namespace Pinetime {
|
||||
namespace Components {
|
||||
|
@ -14,7 +15,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;
|
||||
|
||||
|
@ -24,6 +25,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;
|
||||
|
|
Loading…
Reference in a new issue