atomic14 / diy-esp32-epub-reader

An ESP32 e-reader
MIT License
318 stars 43 forks source link

Add touch gestures Swipe and double Tap #50

Closed martinberlin closed 2 years ago

martinberlin commented 2 years ago

First I will have to add this in my component, so the blocker is this issue in Focal Tech repository The basic idea is to add first Swipe left and right gestures provided it does not affect Tap detection. Then here I will add this Event as UP or DOWN so you can pass the pages of the book swaping the finger in the screen.

martinberlin commented 2 years ago

@cgreening this started working albeit it reduces the speed of touch events. Logically every event of this type should be lighting fast that's why Focal Tech and other vendors, that do professional touch screens, have a chip that delivers Gestures directly as events. Doing this by software it's tricky and they are already too many things going on to make touch as responsive as in a mobile device. I will play around with it a little bit, by no means this should be merged before a heavy refactoring, and only if does not make touch less responsive than with no Gestures. I prefer to have them out if we need to pay a performance price to have them.

martinberlin commented 2 years ago

Note for my research, sometimes it hangs when arriving to this line:

void RubbishHtmlParser::render_page(int page_index, Renderer *renderer, Epub *epub) {
     renderer->clear_screen();
     pages[page_index]->render(renderer, epub); //L: 247
}

Trace:


  #0  0x4013dc0f:0x3ffd0360 in RubbishHtmlParser::render_page(int, Renderer*, Epub*) at lib/Epub/RubbishHtmlParser/RubbishHtmlParser.cpp:247
  #1  0x400e2f7d:0x3ffd0380 in EpubReader::render() at lib/Epub/EpubList/EpubReader.cpp:95
  #2  0x400d3bae:0x3ffd03a0 in handleEpub(Renderer*, UIAction) at src/main.cpp:95
  #3  0x400d3bc6:0x3ffd03c0 in handleUserInteraction(Renderer*, UIAction) at src/main.cpp:141
  #4  0x400d3fa6:0x3ffd03e0 in main_task(void*) at src/main.cpp:267
martinberlin commented 2 years ago

After playing enough time with this I realized is better not to implement Gestures since they make everything slower and is buggy. @cgreening anyways I left the branch there both on touch and here, before we discard it completely maybe we can give it one more try. But at the moment they are much more important things to do than this.