Cleanup remaining warnings.

This commit is contained in:
Shaun Reed 2025-02-16 09:38:28 -05:00
parent 74404b1a44
commit 75b51f0c7c
4 changed files with 14 additions and 16 deletions

View File

@ -1,13 +1,13 @@
#include "display.h"
#include "ssd1306.h"
#include <esp_timer.h>
#include <lv_init.h>
#include <mutex>
#include "display.h"
#include "ssd1306.h"
// LVGL library is not thread-safe, this example calls LVGL APIs from tasks.
// We must use a mutex to protect it.
_lock_t Display::ScopedLock::lv_lock_;
@ -30,11 +30,9 @@ Display::Display(IPanelDevice &device) :
lv_display_set_user_data(lv_display_, panel_.esp_panel_);
register_draw_buffer();
register_lvgl_tick_timer();
// TODO: What is this
ESP_LOGI(TAG, "Create LVGL task");
ESP_LOGI(TAG, "Create LVGL FreeRTOS task");
xTaskCreate(Display::lvgl_port_task, "LVGL", LVGL_TASK_STACK_SIZE,
nullptr, LVGL_TASK_PRIORITY, nullptr);
}

View File

@ -1,10 +1,11 @@
#ifndef DISPLAY_H
#define DISPLAY_H
#include <esp_timer.h>
#include <widgets/label/lv_label.h>
#include <unordered_map>
#include <esp_timer.h>
#include <memory>
#include "panel.h"
@ -51,7 +52,7 @@ class Display {
return &managed_timers_.at(name);
}
TimerHandle operator[](const char * name) { return get_handle(name); }
TimerHandle operator[](const char *name) { return get_handle(name); }
TimerHandle create_timer(esp_timer_create_args_t args)
{
@ -144,7 +145,7 @@ public:
private:
void register_draw_buffer();
void register_lvgl_tick_timer();
static void register_lvgl_tick_timer();
Panel panel_;

View File

@ -4,7 +4,7 @@
// To use LV_COLOR_FORMAT_I1 we need an extra buffer to hold the converted data.
uint8_t SSD1306::oled_buffer_[LCD_H_RES * LCD_V_RES / 8];
SSD1306::SSD1306(I2C& i2c,
SSD1306::SSD1306(I2C &i2c,
esp_lcd_panel_ssd1306_config_t config,
int width,
int height) :
@ -14,11 +14,10 @@ SSD1306::SSD1306(I2C& i2c,
.control_phase_bytes = 1,
.dc_bit_offset = 6,
.lcd_cmd_bits = LCD_CMD_BITS,
.lcd_param_bits = LCD_CMD_BITS,
.lcd_param_bits = LCD_PARAM_BITS,
.scl_speed_hz = LCD_PIXEL_CLOCK_HZ,
},
width,
height
),
ssd1306_config_(config)
{ }
ssd1306_config_(config) { }

View File

@ -20,17 +20,17 @@
// According to SSD1306 datasheet
// https://www.digikey.com/en/products/detail/winstar-display/WEA012864DWPP3N00003/20533255
// Bit number used to represent command and parameter
#define SCREEN_WIDTH 128 // OLED display width, in pixels.
#define SCREEN_HEIGHT 64 // OLED display height, in pixels.
#define LCD_H_RES SCREEN_WIDTH
#define LCD_V_RES SCREEN_HEIGHT
#define I2C_HW_ADDR 0x3C
#define LCD_PIXEL_CLOCK_HZ (400 * 1000)
// Bit number used to represent command and parameter
#define LCD_CMD_BITS 8
#define LCD_PARAM_BITS 8
class SSD1306 : public IPanelDevice {
class SSD1306 final : public IPanelDevice {
public:
// Constructors allow overriding ssd1306 config.
explicit SSD1306(I2C &i2c) :
@ -42,7 +42,7 @@ public:
int height = SCREEN_HEIGHT
);
virtual ~SSD1306() = default;
~SSD1306() final = default;
void *vendor_config() override
{