diff options
| author | Joaquim <joaquim.org@gmail.com> | 2021-04-04 02:08:51 (GMT) |
|---|---|---|
| committer | Joaquim <joaquim.org@gmail.com> | 2021-04-04 02:08:51 (GMT) |
| commit | 1d3742e14f09316a1d795527713eb8f9742f0ffb (patch) | |
| tree | 6bc6343538506b68256aa057121e063d22f8ed1a /src/displayapp/LittleVgl.cpp | |
| parent | 58a2d000c4d49d96121894d6dd6bb861d7564bea (diff) | |
Big UI and navigation Rewrite
new navigation
add some color to the apps
redesign menus
new settings menu
new quick settings
code clean up
size reduction by converting navigation images to font
and more...
Diffstat (limited to 'src/displayapp/LittleVgl.cpp')
| -rw-r--r-- | src/displayapp/LittleVgl.cpp | 36 |
1 files changed, 29 insertions, 7 deletions
diff --git a/src/displayapp/LittleVgl.cpp b/src/displayapp/LittleVgl.cpp index 238164a..500fd75 100644 --- a/src/displayapp/LittleVgl.cpp +++ b/src/displayapp/LittleVgl.cpp @@ -61,18 +61,27 @@ void LittleVgl::InitTouchpad() { void LittleVgl::SetFullRefresh(FullRefreshDirections direction) { if(scrollDirection == FullRefreshDirections::None) { scrollDirection = direction; - if (scrollDirection == FullRefreshDirections::Down) + if (scrollDirection == FullRefreshDirections::Down) { lv_disp_set_direction(lv_disp_get_default(), 1); + } else if (scrollDirection == FullRefreshDirections::Right) { + lv_disp_set_direction(lv_disp_get_default(), 2); + } else if (scrollDirection == FullRefreshDirections::Left) { + lv_disp_set_direction(lv_disp_get_default(), 3); + } else if (scrollDirection == FullRefreshDirections::RightAnim) { + lv_disp_set_direction(lv_disp_get_default(), 5); + } else if (scrollDirection == FullRefreshDirections::LeftAnim) { + lv_disp_set_direction(lv_disp_get_default(), 4); + } } } void LittleVgl::FlushDisplay(const lv_area_t *area, lv_color_t *color_p) { uint16_t y1, y2, width, height = 0; - ulTaskNotifyTake(pdTRUE, 500); - // Notification is still needed (even if there is a mutex on SPI) because of the DataCommand pin - // which cannot be set/clear during a transfer. - + ulTaskNotifyTake(pdTRUE, 200); + // NOtification is still needed (even if there is a mutex on SPI) because of the DataCommand pin + // which cannot be set/clear during a transfert. + if( (scrollDirection == LittleVgl::FullRefreshDirections::Down) && (area->y2 == visibleNbLines - 1)) { writeOffset = ((writeOffset + totalNbLines) - visibleNbLines) % totalNbLines; } else if( (scrollDirection == FullRefreshDirections::Up) && (area->y1 == 0) ) { @@ -86,6 +95,7 @@ void LittleVgl::FlushDisplay(const lv_area_t *area, lv_color_t *color_p) { height = (area->y2 - area->y1) + 1; if(scrollDirection == LittleVgl::FullRefreshDirections::Down) { + if(area->y2 < visibleNbLines - 1) { uint16_t toScroll = 0; if(area->y1 == 0) { @@ -95,6 +105,7 @@ void LittleVgl::FlushDisplay(const lv_area_t *area, lv_color_t *color_p) { } else { toScroll = height; } + if(scrollOffset >= toScroll) scrollOffset -= toScroll; else { @@ -117,6 +128,16 @@ void LittleVgl::FlushDisplay(const lv_area_t *area, lv_color_t *color_p) { scrollOffset = scrollOffset % totalNbLines; lcd.VerticalScrollStartAddress(scrollOffset); } + } else if(scrollDirection == FullRefreshDirections::Left or scrollDirection == FullRefreshDirections::LeftAnim) { + if(area->x2 == visibleNbLines - 1) { + scrollDirection = FullRefreshDirections::None; + lv_disp_set_direction(lv_disp_get_default(), 0); + } + } else if(scrollDirection == FullRefreshDirections::Right or scrollDirection == FullRefreshDirections::RightAnim) { + if(area->x1 == 0) { + scrollDirection = FullRefreshDirections::None; + lv_disp_set_direction(lv_disp_get_default(), 0); + } } if (y2 < y1) { @@ -124,13 +145,14 @@ void LittleVgl::FlushDisplay(const lv_area_t *area, lv_color_t *color_p) { if ( height > 0 ) { lcd.DrawBuffer(area->x1, y1, width, height, reinterpret_cast<const uint8_t *>(color_p), width * height * 2); - ulTaskNotifyTake(pdTRUE, 320); + ulTaskNotifyTake(pdTRUE, 100); } + uint16_t pixOffset = width * height; height = y2 + 1; lcd.DrawBuffer(area->x1, 0, width, height, reinterpret_cast<const uint8_t *>(color_p + pixOffset), width * height * 2); - } else { + } else { lcd.DrawBuffer(area->x1, y1, width, height, reinterpret_cast<const uint8_t *>(color_p), width * height * 2); } |
