| 19 | } |
| 20 | |
| 21 | bool RgbDisplay::start() { |
| 22 | LOGGER.info("Starting"); |
| 23 | |
| 24 | if (esp_lcd_new_rgb_panel(&configuration->panelConfig, &panelHandle) != ESP_OK) { |
| 25 | LOGGER.error("Failed to create panel"); |
| 26 | return false; |
| 27 | } |
| 28 | |
| 29 | if (esp_lcd_panel_reset(panelHandle) != ESP_OK) { |
| 30 | LOGGER.error("Failed to reset panel"); |
| 31 | return false; |
| 32 | } |
| 33 | |
| 34 | if (esp_lcd_panel_init(panelHandle) != ESP_OK) { |
| 35 | LOGGER.error("Failed to init panel"); |
| 36 | return false; |
| 37 | } |
| 38 | |
| 39 | if (esp_lcd_panel_swap_xy(panelHandle, configuration->swapXY) != ESP_OK) { |
| 40 | LOGGER.error("Failed to swap XY"); |
| 41 | return false; |
| 42 | } |
| 43 | |
| 44 | if (esp_lcd_panel_mirror(panelHandle, configuration->mirrorX, configuration->mirrorY) != ESP_OK) { |
| 45 | LOGGER.error("Failed to set panel to mirror"); |
| 46 | return false; |
| 47 | } |
| 48 | |
| 49 | if (esp_lcd_panel_invert_color(panelHandle, configuration->invertColor) != ESP_OK) { |
| 50 | LOGGER.error("Failed to set panel to invert"); |
| 51 | return false; |
| 52 | } |
| 53 | |
| 54 | return true; |
| 55 | } |
| 56 | |
| 57 | bool RgbDisplay::stop() { |
| 58 | if (lvglDisplay != nullptr) { |
no test coverage detected