Fix most issues
This commit is contained in:
@@ -226,9 +226,7 @@ void DisplayApp::Refresh() {
|
||||
}
|
||||
}
|
||||
|
||||
if (touchMode == TouchModes::Polling) {
|
||||
currentScreen->OnTouchEvent(touchHandler.GetX(), touchHandler.GetY());
|
||||
}
|
||||
currentScreen->OnTouchEvent(touchHandler.GetX(), touchHandler.GetY());
|
||||
|
||||
if (nextApp != Apps::None) {
|
||||
LoadApp(nextApp, nextDirection);
|
||||
@@ -367,6 +365,7 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction)
|
||||
break;
|
||||
case Apps::Metronome:
|
||||
currentScreen = std::make_unique<Screens::Metronome>(this, motorController, *systemTask);
|
||||
ReturnApp(Apps::Launcher, FullRefreshDirections::Down, TouchEvents::None);
|
||||
break;
|
||||
case Apps::Motion:
|
||||
currentScreen = std::make_unique<Screens::Motion>(this, motionController);
|
||||
@@ -397,10 +396,8 @@ void DisplayApp::PushMessage(Messages msg) {
|
||||
TouchEvents DisplayApp::GetGesture() {
|
||||
auto gesture = touchHandler.GestureGet();
|
||||
switch (gesture) {
|
||||
/*
|
||||
case Pinetime::Drivers::Cst816S::Gestures::SingleTap:
|
||||
return TouchEvents::Tap;
|
||||
*/
|
||||
case Pinetime::Drivers::Cst816S::Gestures::LongPress:
|
||||
return TouchEvents::LongTap;
|
||||
case Pinetime::Drivers::Cst816S::Gestures::DoubleTap:
|
||||
@@ -445,10 +442,6 @@ void DisplayApp::SetFullRefresh(DisplayApp::FullRefreshDirections direction) {
|
||||
}
|
||||
}
|
||||
|
||||
void DisplayApp::SetTouchMode(DisplayApp::TouchModes mode) {
|
||||
touchMode = mode;
|
||||
}
|
||||
|
||||
void DisplayApp::PushMessageToSystemTask(Pinetime::System::Messages message) {
|
||||
if(systemTask != nullptr)
|
||||
systemTask->PushMessage(message);
|
||||
|
@@ -43,7 +43,6 @@ namespace Pinetime {
|
||||
public:
|
||||
enum class States { Idle, Running };
|
||||
enum class FullRefreshDirections { None, Up, Down, Left, Right, LeftAnim, RightAnim };
|
||||
enum class TouchModes { Gestures, Polling };
|
||||
|
||||
DisplayApp(Drivers::St7789& lcd,
|
||||
Components::LittleVgl& lvgl,
|
||||
@@ -65,7 +64,6 @@ namespace Pinetime {
|
||||
void StartApp(Apps app, DisplayApp::FullRefreshDirections direction);
|
||||
|
||||
void SetFullRefresh(FullRefreshDirections direction);
|
||||
void SetTouchMode(TouchModes mode);
|
||||
|
||||
void Register(Pinetime::System::SystemTask* systemTask);
|
||||
|
||||
@@ -104,8 +102,6 @@ namespace Pinetime {
|
||||
FullRefreshDirections returnDirection = FullRefreshDirections::None;
|
||||
TouchEvents returnTouchEvent = TouchEvents::None;
|
||||
|
||||
TouchModes touchMode = TouchModes::Gestures;
|
||||
|
||||
TouchEvents GetGesture();
|
||||
void RunningState();
|
||||
void IdleState();
|
||||
|
@@ -166,7 +166,7 @@ void LittleVgl::FlushDisplay(const lv_area_t* area, lv_color_t* color_p) {
|
||||
lv_disp_flush_ready(&disp_drv);
|
||||
}
|
||||
|
||||
void LittleVgl::SetNewTapEvent(uint16_t x, uint16_t y, bool contact) {
|
||||
void LittleVgl::SetNewTouchPoint(uint16_t x, uint16_t y, bool contact) {
|
||||
tap_x = x;
|
||||
tap_y = y;
|
||||
tapped = contact;
|
||||
|
@@ -24,7 +24,7 @@ namespace Pinetime {
|
||||
void FlushDisplay(const lv_area_t* area, lv_color_t* color_p);
|
||||
bool GetTouchPadInfo(lv_indev_data_t* ptr);
|
||||
void SetFullRefresh(FullRefreshDirections direction);
|
||||
void SetNewTapEvent(uint16_t x, uint16_t y, bool contact);
|
||||
void SetNewTouchPoint(uint16_t x, uint16_t y, bool contact);
|
||||
|
||||
private:
|
||||
void InitDisplay();
|
||||
|
@@ -5,13 +5,10 @@
|
||||
using namespace Pinetime::Applications::Screens;
|
||||
|
||||
InfiniPaint::InfiniPaint(Pinetime::Applications::DisplayApp* app, Pinetime::Components::LittleVgl& lvgl) : Screen(app), lvgl {lvgl} {
|
||||
app->SetTouchMode(DisplayApp::TouchModes::Polling);
|
||||
std::fill(b, b + bufferSize, selectColor);
|
||||
}
|
||||
|
||||
InfiniPaint::~InfiniPaint() {
|
||||
// Reset the touchmode
|
||||
app->SetTouchMode(DisplayApp::TouchModes::Gestures);
|
||||
lv_obj_clean(lv_scr_act());
|
||||
}
|
||||
|
||||
|
@@ -91,7 +91,7 @@ Metronome::~Metronome() {
|
||||
}
|
||||
|
||||
bool Metronome::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Metronome::Refresh() {
|
||||
|
@@ -5,8 +5,6 @@
|
||||
using namespace Pinetime::Applications::Screens;
|
||||
|
||||
Paddle::Paddle(Pinetime::Applications::DisplayApp* app, Pinetime::Components::LittleVgl& lvgl) : Screen(app), lvgl {lvgl} {
|
||||
app->SetTouchMode(DisplayApp::TouchModes::Polling);
|
||||
|
||||
background = lv_obj_create(lv_scr_act(), nullptr);
|
||||
lv_obj_set_size(background, LV_HOR_RES + 1, LV_VER_RES);
|
||||
lv_obj_set_pos(background, -1, 0);
|
||||
@@ -32,8 +30,6 @@ Paddle::Paddle(Pinetime::Applications::DisplayApp* app, Pinetime::Components::Li
|
||||
}
|
||||
|
||||
Paddle::~Paddle() {
|
||||
// Reset the touchmode
|
||||
app->SetTouchMode(DisplayApp::TouchModes::Gestures);
|
||||
lv_obj_clean(lv_scr_act());
|
||||
}
|
||||
|
||||
|
@@ -60,6 +60,7 @@ namespace Pinetime {
|
||||
}
|
||||
|
||||
/** @return false if the event hasn't been handled by the app, true if it has been handled */
|
||||
// Returning true will cancel lvgl tap
|
||||
virtual bool OnTouchEvent(TouchEvents event) {
|
||||
return false;
|
||||
}
|
||||
|
Reference in New Issue
Block a user