Fix remaining known issues

This commit is contained in:
Riku Isokoski 2021-07-16 11:55:29 +03:00
parent baffa1594f
commit 329482f873
4 changed files with 17 additions and 10 deletions

View file

@ -226,7 +226,9 @@ void DisplayApp::Refresh() {
} }
} }
if (touchHandler.IsTouching()) {
currentScreen->OnTouchEvent(touchHandler.GetX(), touchHandler.GetY()); currentScreen->OnTouchEvent(touchHandler.GetX(), touchHandler.GetY());
}
if (nextApp != Apps::None) { if (nextApp != Apps::None) {
LoadApp(nextApp, nextDirection); LoadApp(nextApp, nextDirection);

View file

@ -91,6 +91,7 @@ Tile::Tile(uint8_t screenID,
lv_obj_set_style_local_bg_color(btnm1, LV_BTNMATRIX_PART_BTN, LV_STATE_DISABLED, lv_color_hex(0x111111)); lv_obj_set_style_local_bg_color(btnm1, LV_BTNMATRIX_PART_BTN, LV_STATE_DISABLED, lv_color_hex(0x111111));
for (uint8_t i = 0; i < 6; i++) { for (uint8_t i = 0; i < 6; i++) {
lv_btnmatrix_set_btn_ctrl(btnm1, i, LV_BTNMATRIX_CTRL_CLICK_TRIG);
if (applications[i].application == Apps::None) { if (applications[i].application == Apps::None) {
lv_btnmatrix_set_btn_ctrl(btnm1, i, LV_BTNMATRIX_CTRL_DISABLED); lv_btnmatrix_set_btn_ctrl(btnm1, i, LV_BTNMATRIX_CTRL_DISABLED);
} }
@ -123,7 +124,7 @@ bool Tile::Refresh() {
} }
void Tile::OnObjectEvent(lv_obj_t* obj, lv_event_t event) { void Tile::OnObjectEvent(lv_obj_t* obj, lv_event_t event) {
if (event == LV_EVENT_CLICKED) { if (event == LV_EVENT_VALUE_CHANGED) {
app->StartApp(apps[lv_btnmatrix_get_active_btn(obj)], DisplayApp::FullRefreshDirections::Up); app->StartApp(apps[lv_btnmatrix_get_active_btn(obj)], DisplayApp::FullRefreshDirections::Up);
running = false; running = false;
} }

View file

@ -6,9 +6,11 @@ TouchHandler::TouchHandler(Drivers::Cst816S& touchPanel, Components::LittleVgl&
} }
void TouchHandler::CancelTap() { void TouchHandler::CancelTap() {
if (info.touching) {
isCancelled = true; isCancelled = true;
lvgl.SetNewTouchPoint(-1, -1, true); lvgl.SetNewTouchPoint(-1, -1, true);
} }
}
Pinetime::Drivers::Cst816S::Gestures TouchHandler::GestureGet() { Pinetime::Drivers::Cst816S::Gestures TouchHandler::GestureGet() {
auto returnGesture = gesture; auto returnGesture = gesture;
@ -28,7 +30,6 @@ void TouchHandler::Process(void* instance) {
} }
void TouchHandler::Work() { void TouchHandler::Work() {
Pinetime::Drivers::Cst816S::TouchInfos info;
Pinetime::Drivers::Cst816S::Gestures prevGesture = Pinetime::Drivers::Cst816S::Gestures::None; Pinetime::Drivers::Cst816S::Gestures prevGesture = Pinetime::Drivers::Cst816S::Gestures::None;
while (true) { while (true) {
vTaskSuspend(taskHandle); vTaskSuspend(taskHandle);
@ -48,8 +49,6 @@ void TouchHandler::Work() {
if (systemTask->IsSleeping()) { if (systemTask->IsSleeping()) {
systemTask->PushMessage(System::Messages::TouchWakeUp); systemTask->PushMessage(System::Messages::TouchWakeUp);
} else { } else {
x = info.x;
y = info.y;
if (info.touching) { if (info.touching) {
if (!isCancelled) { if (!isCancelled) {
lvgl.SetNewTouchPoint(info.x, info.y, true); lvgl.SetNewTouchPoint(info.x, info.y, true);

View file

@ -22,23 +22,28 @@ namespace Pinetime {
void Register(Pinetime::System::SystemTask* systemTask); void Register(Pinetime::System::SystemTask* systemTask);
void Start(); void Start();
void WakeUp(); void WakeUp();
bool IsTouching() const {
return info.touching;
}
uint8_t GetX() const { uint8_t GetX() const {
return x; return info.x;
} }
uint8_t GetY() const { uint8_t GetY() const {
return y; return info.y;
} }
Drivers::Cst816S::Gestures GestureGet(); Drivers::Cst816S::Gestures GestureGet();
private: private:
static void Process(void* instance); static void Process(void* instance);
void Work(); void Work();
Pinetime::Drivers::Cst816S::TouchInfos info;
Pinetime::System::SystemTask* systemTask = nullptr; Pinetime::System::SystemTask* systemTask = nullptr;
TaskHandle_t taskHandle; TaskHandle_t taskHandle;
Pinetime::Drivers::Cst816S& touchPanel; Pinetime::Drivers::Cst816S& touchPanel;
Pinetime::Components::LittleVgl& lvgl; Pinetime::Components::LittleVgl& lvgl;
Pinetime::Drivers::Cst816S::Gestures gesture; Pinetime::Drivers::Cst816S::Gestures gesture;
bool isCancelled = false; bool isCancelled = false;
uint8_t x, y;
}; };
} }
} }