mirror of
https://github.com/esphome/esphome.git
synced 2026-02-08 00:31:58 +00:00
[mipi_rgb] Fix dump_summary deprecation warning (#13463)
This commit is contained in:
committed by
Jonathan Swoboda
parent
ccbf17d5ab
commit
ab1661ef22
@@ -1,9 +1,11 @@
|
|||||||
#ifdef USE_ESP32_VARIANT_ESP32S3
|
#ifdef USE_ESP32_VARIANT_ESP32S3
|
||||||
#include "mipi_rgb.h"
|
#include "mipi_rgb.h"
|
||||||
|
#include "esphome/core/gpio.h"
|
||||||
|
#include "esphome/core/hal.h"
|
||||||
#include "esphome/core/helpers.h"
|
#include "esphome/core/helpers.h"
|
||||||
#include "esphome/core/log.h"
|
#include "esphome/core/log.h"
|
||||||
#include "esphome/core/hal.h"
|
|
||||||
#include "esp_lcd_panel_rgb.h"
|
#include "esp_lcd_panel_rgb.h"
|
||||||
|
#include <span>
|
||||||
|
|
||||||
namespace esphome {
|
namespace esphome {
|
||||||
namespace mipi_rgb {
|
namespace mipi_rgb {
|
||||||
@@ -343,19 +345,27 @@ int MipiRgb::get_height() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::string get_pin_name(GPIOPin *pin) {
|
static const char *get_pin_name(GPIOPin *pin, std::span<char, GPIO_SUMMARY_MAX_LEN> buffer) {
|
||||||
if (pin == nullptr)
|
if (pin == nullptr)
|
||||||
return "None";
|
return "None";
|
||||||
return pin->dump_summary();
|
pin->dump_summary(buffer.data(), buffer.size());
|
||||||
|
return buffer.data();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MipiRgb::dump_pins_(uint8_t start, uint8_t end, const char *name, uint8_t offset) {
|
void MipiRgb::dump_pins_(uint8_t start, uint8_t end, const char *name, uint8_t offset) {
|
||||||
|
char pin_summary[GPIO_SUMMARY_MAX_LEN];
|
||||||
for (uint8_t i = start; i != end; i++) {
|
for (uint8_t i = start; i != end; i++) {
|
||||||
ESP_LOGCONFIG(TAG, " %s pin %d: %s", name, offset++, this->data_pins_[i]->dump_summary().c_str());
|
this->data_pins_[i]->dump_summary(pin_summary, sizeof(pin_summary));
|
||||||
|
ESP_LOGCONFIG(TAG, " %s pin %d: %s", name, offset++, pin_summary);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MipiRgb::dump_config() {
|
void MipiRgb::dump_config() {
|
||||||
|
char reset_buf[GPIO_SUMMARY_MAX_LEN];
|
||||||
|
char de_buf[GPIO_SUMMARY_MAX_LEN];
|
||||||
|
char pclk_buf[GPIO_SUMMARY_MAX_LEN];
|
||||||
|
char hsync_buf[GPIO_SUMMARY_MAX_LEN];
|
||||||
|
char vsync_buf[GPIO_SUMMARY_MAX_LEN];
|
||||||
ESP_LOGCONFIG(TAG,
|
ESP_LOGCONFIG(TAG,
|
||||||
"MIPI_RGB LCD"
|
"MIPI_RGB LCD"
|
||||||
"\n Model: %s"
|
"\n Model: %s"
|
||||||
@@ -379,9 +389,9 @@ void MipiRgb::dump_config() {
|
|||||||
this->model_, this->width_, this->height_, this->rotation_, YESNO(this->pclk_inverted_),
|
this->model_, this->width_, this->height_, this->rotation_, YESNO(this->pclk_inverted_),
|
||||||
this->hsync_pulse_width_, this->hsync_back_porch_, this->hsync_front_porch_, this->vsync_pulse_width_,
|
this->hsync_pulse_width_, this->hsync_back_porch_, this->hsync_front_porch_, this->vsync_pulse_width_,
|
||||||
this->vsync_back_porch_, this->vsync_front_porch_, YESNO(this->invert_colors_),
|
this->vsync_back_porch_, this->vsync_front_porch_, YESNO(this->invert_colors_),
|
||||||
(unsigned) (this->pclk_frequency_ / 1000000), get_pin_name(this->reset_pin_).c_str(),
|
(unsigned) (this->pclk_frequency_ / 1000000), get_pin_name(this->reset_pin_, reset_buf),
|
||||||
get_pin_name(this->de_pin_).c_str(), get_pin_name(this->pclk_pin_).c_str(),
|
get_pin_name(this->de_pin_, de_buf), get_pin_name(this->pclk_pin_, pclk_buf),
|
||||||
get_pin_name(this->hsync_pin_).c_str(), get_pin_name(this->vsync_pin_).c_str());
|
get_pin_name(this->hsync_pin_, hsync_buf), get_pin_name(this->vsync_pin_, vsync_buf));
|
||||||
|
|
||||||
this->dump_pins_(8, 13, "Blue", 0);
|
this->dump_pins_(8, 13, "Blue", 0);
|
||||||
this->dump_pins_(13, 16, "Green", 0);
|
this->dump_pins_(13, 16, "Green", 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user