mirror of
https://github.com/esphome/esphome.git
synced 2025-10-04 02:52:22 +01:00
Nextion - Review types (#6565)
This commit is contained in:
@@ -144,11 +144,11 @@ void Nextion::set_component_pressed_font_color(const char *component, Color colo
|
||||
|
||||
// Set picture
|
||||
void Nextion::set_component_pic(const char *component, uint8_t pic_id) {
|
||||
this->add_no_result_to_queue_with_printf_("set_component_pic", "%s.pic=%d", component, pic_id);
|
||||
this->add_no_result_to_queue_with_printf_("set_component_pic", "%s.pic=%" PRIu8, component, pic_id);
|
||||
}
|
||||
|
||||
void Nextion::set_component_picc(const char *component, uint8_t pic_id) {
|
||||
this->add_no_result_to_queue_with_printf_("set_component_pic", "%s.picc=%d", component, pic_id);
|
||||
this->add_no_result_to_queue_with_printf_("set_component_pic", "%s.picc=%" PRIu8, component, pic_id);
|
||||
}
|
||||
|
||||
void Nextion::set_component_text_printf(const char *component, const char *format, ...) {
|
||||
@@ -179,7 +179,7 @@ void Nextion::set_auto_wake_on_touch(bool auto_wake) {
|
||||
|
||||
// General Component
|
||||
void Nextion::set_component_font(const char *component, uint8_t font_id) {
|
||||
this->add_no_result_to_queue_with_printf_("set_component_font", "%s.font=%d", component, font_id);
|
||||
this->add_no_result_to_queue_with_printf_("set_component_font", "%s.font=%" PRIu8, component, font_id);
|
||||
}
|
||||
|
||||
void Nextion::hide_component(const char *component) {
|
||||
@@ -199,113 +199,130 @@ void Nextion::disable_component_touch(const char *component) {
|
||||
}
|
||||
|
||||
void Nextion::set_component_picture(const char *component, uint8_t picture_id) {
|
||||
this->add_no_result_to_queue_with_printf_("set_component_picture", "%s.pic=%d", component, picture_id);
|
||||
this->add_no_result_to_queue_with_printf_("set_component_picture", "%s.pic=%" PRIu8, component, picture_id);
|
||||
}
|
||||
|
||||
void Nextion::set_component_text(const char *component, const char *text) {
|
||||
this->add_no_result_to_queue_with_printf_("set_component_text", "%s.txt=\"%s\"", component, text);
|
||||
}
|
||||
|
||||
void Nextion::set_component_value(const char *component, int value) {
|
||||
this->add_no_result_to_queue_with_printf_("set_component_value", "%s.val=%d", component, value);
|
||||
void Nextion::set_component_value(const char *component, int32_t value) {
|
||||
this->add_no_result_to_queue_with_printf_("set_component_value", "%s.val=%" PRId32, component, value);
|
||||
}
|
||||
|
||||
void Nextion::add_waveform_data(int component_id, uint8_t channel_number, uint8_t value) {
|
||||
this->add_no_result_to_queue_with_printf_("add_waveform_data", "add %d,%u,%u", component_id, channel_number, value);
|
||||
void Nextion::add_waveform_data(uint8_t component_id, uint8_t channel_number, uint8_t value) {
|
||||
this->add_no_result_to_queue_with_printf_("add_waveform_data", "add %" PRIu8 ",%" PRIu8 ",%" PRIu8, component_id,
|
||||
channel_number, value);
|
||||
}
|
||||
|
||||
void Nextion::open_waveform_channel(int component_id, uint8_t channel_number, uint8_t value) {
|
||||
this->add_no_result_to_queue_with_printf_("open_waveform_channel", "addt %d,%u,%u", component_id, channel_number,
|
||||
value);
|
||||
void Nextion::open_waveform_channel(uint8_t component_id, uint8_t channel_number, uint8_t value) {
|
||||
this->add_no_result_to_queue_with_printf_("open_waveform_channel", "addt %" PRIu8 ",%" PRIu8 ",%" PRIu8, component_id,
|
||||
channel_number, value);
|
||||
}
|
||||
|
||||
void Nextion::set_component_coordinates(const char *component, int x, int y) {
|
||||
this->add_no_result_to_queue_with_printf_("set_component_coordinates command 1", "%s.xcen=%d", component, x);
|
||||
this->add_no_result_to_queue_with_printf_("set_component_coordinates command 2", "%s.ycen=%d", component, y);
|
||||
void Nextion::set_component_coordinates(const char *component, uint16_t x, uint16_t y) {
|
||||
this->add_no_result_to_queue_with_printf_("set_component_coordinates command 1", "%s.xcen=%" PRIu16, component, x);
|
||||
this->add_no_result_to_queue_with_printf_("set_component_coordinates command 2", "%s.ycen=%" PRIu16, component, y);
|
||||
}
|
||||
|
||||
// Drawing
|
||||
void Nextion::display_picture(int picture_id, int x_start, int y_start) {
|
||||
this->add_no_result_to_queue_with_printf_("display_picture", "pic %d, %d, %d", x_start, y_start, picture_id);
|
||||
void Nextion::display_picture(uint16_t picture_id, uint16_t x_start, uint16_t y_start) {
|
||||
this->add_no_result_to_queue_with_printf_("display_picture", "pic %" PRIu16 ", %" PRIu16 ", %" PRIu16, x_start,
|
||||
y_start, picture_id);
|
||||
}
|
||||
|
||||
void Nextion::fill_area(int x1, int y1, int width, int height, uint16_t color) {
|
||||
this->add_no_result_to_queue_with_printf_("fill_area", "fill %d,%d,%d,%d,%" PRIu16, x1, y1, width, height, color);
|
||||
void Nextion::fill_area(uint16_t x1, uint16_t y1, uint16_t width, uint16_t height, uint16_t color) {
|
||||
this->add_no_result_to_queue_with_printf_(
|
||||
"fill_area", "fill %" PRIu16 ",%" PRIu16 ",%" PRIu16 ",%" PRIu16 ",%" PRIu16, x1, y1, width, height, color);
|
||||
}
|
||||
|
||||
void Nextion::fill_area(int x1, int y1, int width, int height, const char *color) {
|
||||
this->add_no_result_to_queue_with_printf_("fill_area", "fill %d,%d,%d,%d,%s", x1, y1, width, height, color);
|
||||
void Nextion::fill_area(uint16_t x1, uint16_t y1, uint16_t width, uint16_t height, const char *color) {
|
||||
this->add_no_result_to_queue_with_printf_("fill_area", "fill %" PRIu16 ",%" PRIu16 ",%" PRIu16 ",%" PRIu16 ",%s", x1,
|
||||
y1, width, height, color);
|
||||
}
|
||||
|
||||
void Nextion::fill_area(int x1, int y1, int width, int height, Color color) {
|
||||
this->add_no_result_to_queue_with_printf_("fill_area", "fill %d,%d,%d,%d,%d", x1, y1, width, height,
|
||||
display::ColorUtil::color_to_565(color));
|
||||
void Nextion::fill_area(uint16_t x1, uint16_t y1, uint16_t width, uint16_t height, Color color) {
|
||||
this->add_no_result_to_queue_with_printf_("fill_area",
|
||||
"fill %" PRIu16 ",%" PRIu16 ",%" PRIu16 ",%" PRIu16 ",%" PRIu16, x1, y1,
|
||||
width, height, display::ColorUtil::color_to_565(color));
|
||||
}
|
||||
|
||||
void Nextion::line(int x1, int y1, int x2, int y2, uint16_t color) {
|
||||
this->add_no_result_to_queue_with_printf_("line", "line %d,%d,%d,%d,%" PRIu16, x1, y1, x2, y2, color);
|
||||
void Nextion::line(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t color) {
|
||||
this->add_no_result_to_queue_with_printf_("line", "line %" PRIu16 ",%" PRIu16 ",%" PRIu16 ",%" PRIu16 ",%" PRIu16, x1,
|
||||
y1, x2, y2, color);
|
||||
}
|
||||
|
||||
void Nextion::line(int x1, int y1, int x2, int y2, const char *color) {
|
||||
this->add_no_result_to_queue_with_printf_("line", "line %d,%d,%d,%d,%s", x1, y1, x2, y2, color);
|
||||
void Nextion::line(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, const char *color) {
|
||||
this->add_no_result_to_queue_with_printf_("line", "line %" PRIu16 ",%" PRIu16 ",%" PRIu16 ",%" PRIu16 ",%s", x1, y1,
|
||||
x2, y2, color);
|
||||
}
|
||||
|
||||
void Nextion::line(int x1, int y1, int x2, int y2, Color color) {
|
||||
this->add_no_result_to_queue_with_printf_("line", "line %d,%d,%d,%d,%d", x1, y1, x2, y2,
|
||||
display::ColorUtil::color_to_565(color));
|
||||
void Nextion::line(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, Color color) {
|
||||
this->add_no_result_to_queue_with_printf_("line", "line %" PRIu16 ",%" PRIu16 ",%" PRIu16 ",%" PRIu16 ",%" PRIu16, x1,
|
||||
y1, x2, y2, display::ColorUtil::color_to_565(color));
|
||||
}
|
||||
|
||||
void Nextion::rectangle(int x1, int y1, int width, int height, uint16_t color) {
|
||||
this->add_no_result_to_queue_with_printf_("draw", "draw %d,%d,%d,%d,%" PRIu16, x1, y1, x1 + width, y1 + height,
|
||||
void Nextion::rectangle(uint16_t x1, uint16_t y1, uint16_t width, uint16_t height, uint16_t color) {
|
||||
this->add_no_result_to_queue_with_printf_("draw", "draw %" PRIu16 ",%" PRIu16 ",%" PRIu16 ",%" PRIu16 ",%" PRIu16, x1,
|
||||
y1, static_cast<uint16_t>(x1 + width), static_cast<uint16_t>(y1 + height),
|
||||
color);
|
||||
}
|
||||
|
||||
void Nextion::rectangle(int x1, int y1, int width, int height, const char *color) {
|
||||
this->add_no_result_to_queue_with_printf_("draw", "draw %d,%d,%d,%d,%s", x1, y1, x1 + width, y1 + height, color);
|
||||
void Nextion::rectangle(uint16_t x1, uint16_t y1, uint16_t width, uint16_t height, const char *color) {
|
||||
this->add_no_result_to_queue_with_printf_("draw", "draw %" PRIu16 ",%" PRIu16 ",%" PRIu16 ",%" PRIu16 ",%s", x1, y1,
|
||||
static_cast<uint16_t>(x1 + width), static_cast<uint16_t>(y1 + height),
|
||||
color);
|
||||
}
|
||||
|
||||
void Nextion::rectangle(int x1, int y1, int width, int height, Color color) {
|
||||
this->add_no_result_to_queue_with_printf_("draw", "draw %d,%d,%d,%d,%d", x1, y1, x1 + width, y1 + height,
|
||||
void Nextion::rectangle(uint16_t x1, uint16_t y1, uint16_t width, uint16_t height, Color color) {
|
||||
this->add_no_result_to_queue_with_printf_("draw", "draw %" PRIu16 ",%" PRIu16 ",%" PRIu16 ",%" PRIu16 ",%" PRIu16, x1,
|
||||
y1, static_cast<uint16_t>(x1 + width), static_cast<uint16_t>(y1 + height),
|
||||
display::ColorUtil::color_to_565(color));
|
||||
}
|
||||
|
||||
void Nextion::circle(int center_x, int center_y, int radius, uint16_t color) {
|
||||
this->add_no_result_to_queue_with_printf_("cir", "cir %d,%d,%d,%" PRIu16, center_x, center_y, radius, color);
|
||||
void Nextion::circle(uint16_t center_x, uint16_t center_y, uint16_t radius, uint16_t color) {
|
||||
this->add_no_result_to_queue_with_printf_("cir", "cir %" PRIu16 ",%" PRIu16 ",%" PRIu16 ",%" PRIu16, center_x,
|
||||
center_y, radius, color);
|
||||
}
|
||||
|
||||
void Nextion::circle(int center_x, int center_y, int radius, const char *color) {
|
||||
this->add_no_result_to_queue_with_printf_("cir", "cir %d,%d,%d,%s", center_x, center_y, radius, color);
|
||||
void Nextion::circle(uint16_t center_x, uint16_t center_y, uint16_t radius, const char *color) {
|
||||
this->add_no_result_to_queue_with_printf_("cir", "cir %" PRIu16 ",%" PRIu16 ",%" PRIu16 ",%s", center_x, center_y,
|
||||
radius, color);
|
||||
}
|
||||
|
||||
void Nextion::circle(int center_x, int center_y, int radius, Color color) {
|
||||
this->add_no_result_to_queue_with_printf_("cir", "cir %d,%d,%d,%d", center_x, center_y, radius,
|
||||
display::ColorUtil::color_to_565(color));
|
||||
void Nextion::circle(uint16_t center_x, uint16_t center_y, uint16_t radius, Color color) {
|
||||
this->add_no_result_to_queue_with_printf_("cir", "cir %" PRIu16 ",%" PRIu16 ",%" PRIu16 ",%" PRIu16, center_x,
|
||||
center_y, radius, display::ColorUtil::color_to_565(color));
|
||||
}
|
||||
|
||||
void Nextion::filled_circle(int center_x, int center_y, int radius, uint16_t color) {
|
||||
this->add_no_result_to_queue_with_printf_("cirs", "cirs %d,%d,%d,%" PRIu16, center_x, center_y, radius, color);
|
||||
void Nextion::filled_circle(uint16_t center_x, uint16_t center_y, uint16_t radius, uint16_t color) {
|
||||
this->add_no_result_to_queue_with_printf_("cirs", "cirs %" PRIu16 ",%" PRIu16 ",%" PRIu16 ",%" PRIu16, center_x,
|
||||
center_y, radius, color);
|
||||
}
|
||||
|
||||
void Nextion::filled_circle(int center_x, int center_y, int radius, const char *color) {
|
||||
this->add_no_result_to_queue_with_printf_("cirs", "cirs %d,%d,%d,%s", center_x, center_y, radius, color);
|
||||
void Nextion::filled_circle(uint16_t center_x, uint16_t center_y, uint16_t radius, const char *color) {
|
||||
this->add_no_result_to_queue_with_printf_("cirs", "cirs %" PRIu16 ",%" PRIu16 ",%" PRIu16 ",%s", center_x, center_y,
|
||||
radius, color);
|
||||
}
|
||||
|
||||
void Nextion::filled_circle(int center_x, int center_y, int radius, Color color) {
|
||||
this->add_no_result_to_queue_with_printf_("cirs", "cirs %d,%d,%d,%d", center_x, center_y, radius,
|
||||
display::ColorUtil::color_to_565(color));
|
||||
void Nextion::filled_circle(uint16_t center_x, uint16_t center_y, uint16_t radius, Color color) {
|
||||
this->add_no_result_to_queue_with_printf_("cirs", "cirs %" PRIu16 ",%" PRIu16 ",%" PRIu16 ",%" PRIu16, center_x,
|
||||
center_y, radius, display::ColorUtil::color_to_565(color));
|
||||
}
|
||||
|
||||
void Nextion::qrcode(int x1, int y1, const char *content, int size, uint16_t background_color,
|
||||
uint16_t foreground_color, int logo_pic, uint8_t border_width) {
|
||||
this->add_no_result_to_queue_with_printf_("qrcode", "qrcode %d,%d,%d,%d,%d,%d,%d,\"%s\"", x1, y1, size,
|
||||
background_color, foreground_color, logo_pic, border_width, content);
|
||||
}
|
||||
|
||||
void Nextion::qrcode(int x1, int y1, const char *content, int size, Color background_color, Color foreground_color,
|
||||
int logo_pic, uint8_t border_width) {
|
||||
void Nextion::qrcode(uint16_t x1, uint16_t y1, const char *content, uint16_t size, uint16_t background_color,
|
||||
uint16_t foreground_color, uint8_t logo_pic, uint8_t border_width) {
|
||||
this->add_no_result_to_queue_with_printf_(
|
||||
"qrcode", "qrcode %d,%d,%d,%d,%d,%d,%d,\"%s\"", x1, y1, size, display::ColorUtil::color_to_565(background_color),
|
||||
display::ColorUtil::color_to_565(foreground_color), logo_pic, border_width, content);
|
||||
"qrcode", "qrcode %" PRIu16 ",%" PRIu16 ",%" PRIu16 ",%" PRIu16 ",%" PRIu16 ",%" PRIu8 ",%" PRIu8 ",\"%s\"", x1,
|
||||
y1, size, background_color, foreground_color, logo_pic, border_width, content);
|
||||
}
|
||||
|
||||
void Nextion::qrcode(uint16_t x1, uint16_t y1, const char *content, uint16_t size, Color background_color,
|
||||
Color foreground_color, uint8_t logo_pic, uint8_t border_width) {
|
||||
this->add_no_result_to_queue_with_printf_(
|
||||
"qrcode", "qrcode %" PRIu16 ",%" PRIu16 ",%" PRIu16 ",%" PRIu16 ",%" PRIu16 ",%" PRIu8 ",%" PRIu8 ",\"%s\"", x1,
|
||||
y1, size, display::ColorUtil::color_to_565(background_color), display::ColorUtil::color_to_565(foreground_color),
|
||||
logo_pic, border_width, content);
|
||||
}
|
||||
|
||||
void Nextion::set_nextion_rtc_time(ESPTime time) {
|
||||
|
Reference in New Issue
Block a user