Skip to content

Commit 2d98530

Browse files
color rotation using modulo, ran clang-format for InfiniPaint
1 parent 5e1f483 commit 2d98530

3 files changed

Lines changed: 12 additions & 7 deletions

File tree

src/displayapp/DisplayApp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction)
410410
currentScreen = std::make_unique<Screens::Twos>(this);
411411
break;
412412
case Apps::Paint:
413-
currentScreen = std::make_unique<Screens::InfiniPaint>(this, lvgl,motorController);
413+
currentScreen = std::make_unique<Screens::InfiniPaint>(this, lvgl, motorController);
414414
break;
415415
case Apps::Paddle:
416416
currentScreen = std::make_unique<Screens::Paddle>(this, lvgl);

src/displayapp/screens/InfiniPaint.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44

55
using namespace Pinetime::Applications::Screens;
66

7-
InfiniPaint::InfiniPaint(Pinetime::Applications::DisplayApp* app, Pinetime::Components::LittleVgl& lvgl, Pinetime::Controllers::MotorController& motor) : Screen(app), lvgl {lvgl}, motor{motor} {
7+
InfiniPaint::InfiniPaint(Pinetime::Applications::DisplayApp* app,
8+
Pinetime::Components::LittleVgl& lvgl,
9+
Pinetime::Controllers::MotorController& motor)
10+
: Screen(app), lvgl {lvgl}, motor {motor} {
811
std::fill(b, b + bufferSize, selectColor);
912
}
1013

@@ -15,7 +18,11 @@ InfiniPaint::~InfiniPaint() {
1518
bool InfiniPaint::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
1619
switch (event) {
1720
case Pinetime::Applications::TouchEvents::LongTap:
21+
color = (color + 1) % 8;
1822
switch (color) {
23+
case 0:
24+
selectColor = LV_COLOR_MAGENTA;
25+
break;
1926
case 1:
2027
selectColor = LV_COLOR_GREEN;
2128
break;
@@ -40,12 +47,10 @@ bool InfiniPaint::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
4047

4148
default:
4249
color = 0;
43-
selectColor = LV_COLOR_MAGENTA;
4450
break;
4551
}
4652

4753
std::fill(b, b + bufferSize, selectColor);
48-
color++;
4954
motor.RunForDuration(50);
5055
return true;
5156
default:

src/displayapp/screens/InfiniPaint.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#pragma once
22

3-
#include <lvgl/lvgl.h>
4-
#include <cstdint>
53
#include "Screen.h"
64
#include "components/motor/MotorController.h"
5+
#include <cstdint>
6+
#include <lvgl/lvgl.h>
77

88
namespace Pinetime {
99
namespace Components {
@@ -30,7 +30,7 @@ namespace Pinetime {
3030
static constexpr uint16_t bufferSize = width * height;
3131
lv_color_t b[bufferSize];
3232
lv_color_t selectColor = LV_COLOR_WHITE;
33-
uint8_t color = 3;
33+
uint8_t color = 2;
3434
};
3535
}
3636
}

0 commit comments

Comments
 (0)