clang-format, ci-custom, and build fixes

This commit is contained in:
Michael Davidson 2023-12-30 10:24:38 +11:00
parent 4046d9e074
commit 409ba147a3
No known key found for this signature in database
GPG Key ID: B8D1A99712B8B0EB
8 changed files with 19 additions and 17 deletions

View File

@ -1,7 +1,12 @@
import esphome.codegen as cg import esphome.codegen as cg
import esphome.config_validation as cv import esphome.config_validation as cv
from esphome.components import display, font, color from esphome.components import display, font, color
from esphome.const import CONF_ID, CONF_TRIGGER_ID from esphome.const import (
CONF_ID,
CONF_TRIGGER_ID,
CONF_FOREGROUND_COLOR,
CONF_BACKGROUND_COLOR,
)
from esphome import automation, core from esphome import automation, core
from esphome.components.display_menu_base import ( from esphome.components.display_menu_base import (
@ -13,8 +18,6 @@ from esphome.components.display_menu_base import (
CONF_DISPLAY = "display" CONF_DISPLAY = "display"
CONF_FONT = "font" CONF_FONT = "font"
CONF_MENU_ITEM_VALUE = "menu_item_value" CONF_MENU_ITEM_VALUE = "menu_item_value"
CONF_FOREGROUND_COLOR = "foreground_color"
CONF_BACKGROUND_COLOR = "background_color"
CONF_ON_REDRAW = "on_redraw" CONF_ON_REDRAW = "on_redraw"
graphical_display_menu_ns = cg.esphome_ns.namespace("graphical_display_menu") graphical_display_menu_ns = cg.esphome_ns.namespace("graphical_display_menu")

View File

@ -12,7 +12,7 @@ static const char *const TAG = "fixeddimensionpanel";
void FixedDimensionPanel::dump_config(int indent_depth, int additional_level_depth) { void FixedDimensionPanel::dump_config(int indent_depth, int additional_level_depth) {
ESP_LOGCONFIG(TAG, "%*sWidth: %i (Will use display width: %s)", indent_depth, "", this->width_.value(), ESP_LOGCONFIG(TAG, "%*sWidth: %i (Will use display width: %s)", indent_depth, "", this->width_.value(),
YESNO(this->width_.value() < 1)); YESNO(this->width_.value() < 1));
+ ESP_LOGCONFIG(TAG, "%*sHeight: %i (Will use display height: %s)", indent_depth, "", this->height_.value(), ESP_LOGCONFIG(TAG, "%*sHeight: %i (Will use display height: %s)", indent_depth, "", this->height_.value(),
YESNO(this->height_.value() < 1)); YESNO(this->height_.value() < 1));
this->child_->dump_config(indent_depth + additional_level_depth, additional_level_depth); this->child_->dump_config(indent_depth + additional_level_depth, additional_level_depth);
} }

View File

@ -2,6 +2,7 @@ import esphome.codegen as cg
import esphome.config_validation as cv import esphome.config_validation as cv
from esphome.components import font, color from esphome.components import font, color
from esphome.components.display import display_ns from esphome.components.display import display_ns
# from esphome.const import CONF_FOREGROUND_COLOR, CONF_BACKGROUND_COLOR
graphical_layout_ns = cg.esphome_ns.namespace("graphical_layout") graphical_layout_ns = cg.esphome_ns.namespace("graphical_layout")
TextPanel = graphical_layout_ns.class_("TextPanel") TextPanel = graphical_layout_ns.class_("TextPanel")
@ -9,8 +10,6 @@ TextAlign = display_ns.enum("TextAlign", is_class=True)
CONF_TEXT_PANEL = "text_panel" CONF_TEXT_PANEL = "text_panel"
CONF_FONT = "font" CONF_FONT = "font"
CONF_FOREGROUND_COLOR = "foreground_color"
CONF_BACKGROUND_COLOR = "background_color"
CONF_TEXT = "text" CONF_TEXT = "text"
CONF_TEXT_ALIGN = "text_align" CONF_TEXT_ALIGN = "text_align"

View File

@ -48,7 +48,7 @@ void TextRunPanel::render_internal(display::Display *display, display::Rect boun
calculated->run->background_color_); calculated->run->background_color_);
} }
display->print(calculated->bounds.x, calculated->bounds.y, calculated->run->font_, display->print(calculated->bounds.x, calculated->bounds.y, calculated->run->font_,
calculated->run->foreground_color_, display::TextAlign::TOP_LEFT, calculated->text_.c_str() calculated->run->foreground_color_, display::TextAlign::TOP_LEFT, calculated->text_.c_str());
} }
if (this->debug_outline_runs_) { if (this->debug_outline_runs_) {
@ -233,7 +233,8 @@ void TextRunPanel::apply_alignment_to_layout(CalculatedLayout *calculated_layout
switch (y_align) { switch (y_align) {
case display::TextAlign::BOTTOM: { case display::TextAlign::BOTTOM: {
y_adjustment = max_line_height - run->bounds.h; y_adjustment = max_line_height - run->bounds.h;
ESP_LOGVV(TAG, "Will adjust line %i by %i y-pixels (%i vs %i)", i, y_adjustment, max_line_height, run->bounds.h); ESP_LOGVV(TAG, "Will adjust line %i by %i y-pixels (%i vs %i)", i, y_adjustment, max_line_height,
run->bounds.h);
break; break;
} }
case display::TextAlign::CENTER_VERTICAL: { case display::TextAlign::CENTER_VERTICAL: {

View File

@ -2,7 +2,7 @@ import esphome.codegen as cg
import esphome.config_validation as cv import esphome.config_validation as cv
from esphome.components import font, color from esphome.components import font, color
from esphome.components.display import display_ns from esphome.components.display import display_ns
from esphome.const import CONF_ID from esphome.const import CONF_ID#, CONF_FOREGROUND_COLOR, CONF_BACKGROUND_COLOR
graphical_layout_ns = cg.esphome_ns.namespace("graphical_layout") graphical_layout_ns = cg.esphome_ns.namespace("graphical_layout")
TextRunPanel = graphical_layout_ns.class_("TextRunPanel") TextRunPanel = graphical_layout_ns.class_("TextRunPanel")
@ -11,8 +11,6 @@ TextRun = graphical_layout_ns.class_("TextRun")
CONF_TEXT_RUN_PANEL = "text_run_panel" CONF_TEXT_RUN_PANEL = "text_run_panel"
CONF_FONT = "font" CONF_FONT = "font"
CONF_FOREGROUND_COLOR = "foreground_color"
CONF_BACKGROUND_COLOR = "background_color"
CONF_TEXT = "text" CONF_TEXT = "text"
CONF_TEXT_ALIGN = "text_align" CONF_TEXT_ALIGN = "text_align"
CONF_MAX_WIDTH = "max_width" CONF_MAX_WIDTH = "max_width"
@ -20,7 +18,6 @@ CONF_MIN_WIDTH = "min_width"
CONF_RUNS = "runs" CONF_RUNS = "runs"
CONF_DEBUG_OUTLINE_RUNS = "debug_outline_runs" CONF_DEBUG_OUTLINE_RUNS = "debug_outline_runs"
TEXT_ALIGN = { TEXT_ALIGN = {
"TOP_LEFT": TextAlign.TOP_LEFT, "TOP_LEFT": TextAlign.TOP_LEFT,
"TOP_CENTER": TextAlign.TOP_CENTER, "TOP_CENTER": TextAlign.TOP_CENTER,

View File

@ -4,6 +4,8 @@ import esphome.codegen as cg
from esphome.components import color from esphome.components import color
from esphome.const import ( from esphome.const import (
CONF_VISIBLE, CONF_VISIBLE,
CONF_FOREGROUND_COLOR,
CONF_BACKGROUND_COLOR,
) )
from . import CONF_NEXTION_ID from . import CONF_NEXTION_ID
from . import Nextion from . import Nextion
@ -24,9 +26,7 @@ CONF_WAKE_UP_PAGE = "wake_up_page"
CONF_START_UP_PAGE = "start_up_page" CONF_START_UP_PAGE = "start_up_page"
CONF_AUTO_WAKE_ON_TOUCH = "auto_wake_on_touch" CONF_AUTO_WAKE_ON_TOUCH = "auto_wake_on_touch"
CONF_WAVE_MAX_LENGTH = "wave_max_length" CONF_WAVE_MAX_LENGTH = "wave_max_length"
CONF_BACKGROUND_COLOR = "background_color"
CONF_BACKGROUND_PRESSED_COLOR = "background_pressed_color" CONF_BACKGROUND_PRESSED_COLOR = "background_pressed_color"
CONF_FOREGROUND_COLOR = "foreground_color"
CONF_FOREGROUND_PRESSED_COLOR = "foreground_pressed_color" CONF_FOREGROUND_PRESSED_COLOR = "foreground_pressed_color"
CONF_FONT_ID = "font_id" CONF_FONT_ID = "font_id"
CONF_EXIT_REPARSE_ON_START = "exit_reparse_on_start" CONF_EXIT_REPARSE_ON_START = "exit_reparse_on_start"

View File

@ -70,6 +70,7 @@ CONF_AWAY = "away"
CONF_AWAY_COMMAND_TOPIC = "away_command_topic" CONF_AWAY_COMMAND_TOPIC = "away_command_topic"
CONF_AWAY_CONFIG = "away_config" CONF_AWAY_CONFIG = "away_config"
CONF_AWAY_STATE_TOPIC = "away_state_topic" CONF_AWAY_STATE_TOPIC = "away_state_topic"
CONF_BACKGROUND_COLOR = "background_color"
CONF_BACKLIGHT_PIN = "backlight_pin" CONF_BACKLIGHT_PIN = "backlight_pin"
CONF_BASELINE = "baseline" CONF_BASELINE = "baseline"
CONF_BATTERY_LEVEL = "battery_level" CONF_BATTERY_LEVEL = "battery_level"
@ -288,6 +289,7 @@ CONF_FLOW = "flow"
CONF_FLOW_CONTROL_PIN = "flow_control_pin" CONF_FLOW_CONTROL_PIN = "flow_control_pin"
CONF_FOR = "for" CONF_FOR = "for"
CONF_FORCE_UPDATE = "force_update" CONF_FORCE_UPDATE = "force_update"
CONF_FOREGROUND_COLOR = "foreground_color"
CONF_FORMALDEHYDE = "formaldehyde" CONF_FORMALDEHYDE = "formaldehyde"
CONF_FORMAT = "format" CONF_FORMAT = "format"
CONF_FORWARD_ACTIVE_ENERGY = "forward_active_energy" CONF_FORWARD_ACTIVE_ENERGY = "forward_active_energy"