8 static const char *
const TAG =
"nextion";
21 ESP_LOGD(TAG,
"Sleep timeout out of bounds, range 3-65535");
40 ESP_LOGV(TAG,
"Set Nextion protocol reparse mode: %s", YESNO(active_mode));
42 bool all_commands_sent =
true;
55 return all_commands_sent;
174 va_start(arg, format);
176 int ret = vsnprintf(buffer,
sizeof(buffer), format, arg);
187 if (brightness < 0 || brightness > 1.0) {
188 ESP_LOGD(TAG,
"Brightness out of bounds, percentage range 0-1.0");
233 channel_number, value);
238 channel_number, value);
249 y_start, picture_id);
254 "fill_area",
"fill %" PRIu16
",%" PRIu16
",%" PRIu16
",%" PRIu16
",%" PRIu16, x1, y1, width, height, color);
257 void Nextion::fill_area(uint16_t x1, uint16_t y1, uint16_t width, uint16_t height,
const char *color) {
259 y1, width, height, color);
264 "fill %" PRIu16
",%" PRIu16
",%" PRIu16
",%" PRIu16
",%" PRIu16, x1, y1,
268 void Nextion::line(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t color) {
273 void Nextion::line(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2,
const char *color) {
285 y1, static_cast<uint16_t>(x1 + width), static_cast<uint16_t>(y1 + height),
289 void Nextion::rectangle(uint16_t x1, uint16_t y1, uint16_t width, uint16_t height,
const char *color) {
291 static_cast<uint16_t>(x1 + width), static_cast<uint16_t>(y1 + height),
297 y1, static_cast<uint16_t>(x1 + width), static_cast<uint16_t>(y1 + height),
301 void Nextion::circle(uint16_t center_x, uint16_t center_y, uint16_t radius, uint16_t color) {
303 center_y, radius, color);
306 void Nextion::circle(uint16_t center_x, uint16_t center_y, uint16_t radius,
const char *color) {
318 center_y, radius, color);
331 void Nextion::qrcode(uint16_t x1, uint16_t y1,
const char *content, uint16_t size, uint16_t background_color,
332 uint16_t foreground_color, uint8_t logo_pic, uint8_t border_width) {
334 "qrcode",
"qrcode %" PRIu16
",%" PRIu16
",%" PRIu16
",%" PRIu16
",%" PRIu16
",%" PRIu8
",%" PRIu8
",\"%s\"", x1,
335 y1, size, background_color, foreground_color, logo_pic, border_width, content);
339 Color foreground_color, uint8_t logo_pic, uint8_t border_width) {
341 "qrcode",
"qrcode %" PRIu16
",%" PRIu16
",%" PRIu16
",%" PRIu16
",%" PRIu16
",%" PRIu8
",%" PRIu8
",\"%s\"", x1,
343 logo_pic, border_width, content);
void goto_page(const char *page)
Show the page with a given name.
void set_nextion_rtc_time(ESPTime time)
Send the current time to the nextion display.
bool ignore_is_setup_
Sends commands ignoring of the Nextion has been setup.
void set_component_pic(const char *component, uint8_t pic_id)
Set the picture id of a component.
void set_component_picture(const char *component, uint8_t picture_id)
Set the picture of an image component.
void add_waveform_data(uint8_t component_id, uint8_t channel_number, uint8_t value)
Add waveform data to a waveform component.
static uint16_t color_to_565(Color color, ColorOrder color_order=ColorOrder::COLOR_ORDER_RGB)
void hide_component(const char *component) override
Hide a component.
bool exit_reparse_on_start_
void circle(uint16_t center_x, uint16_t center_y, uint16_t radius, uint16_t color)
Draw a circle outline.
void set_component_position(const char *component, uint32_t x, uint32_t y)
Set the position of a component.
A more user-friendly version of struct tm from time.h.
bool send_command_(const std::string &command)
Manually send a raw command to the display and don't wait for an acknowledgement packet.
void set_component_vid(const char *component, uint8_t vid_id)
Set the video id of a component.
void set_component_picc(const char *component, uint8_t pic_id)
Set the background picture id of component.
void sleep(bool sleep)
Sets Nextion mode between sleep and awake.
void disable_component_touch(const char *component)
Disable touch for a component.
void rectangle(uint16_t x1, uint16_t y1, uint16_t width, uint16_t height, uint16_t color)
Draw a rectangle outline.
void set_exit_reparse_on_start(bool exit_reparse)
Sets if Nextion should exit the active reparse mode before the "connect" command is sent...
void show_component(const char *component) override
Show a component.
bool nextion_reports_is_setup_
bool add_no_result_to_queue_with_printf_(const std::string &variable_name, const char *format,...) __attribute__((format(printf
Sends a formatted command to the nextion.
void set_component_pressed_background_color(const char *component, uint16_t color)
Set the pressed background color of a component.
void set_component_pressed_foreground_color(const char *component, uint16_t color)
Set the pressed foreground color of a component.
void set_component_background_color(const char *component, uint16_t color)
Set the background color of a component.
void set_component_text_printf(const char *component, const char *format,...) __attribute__((format(printf
Set the text of a component to a formatted string.
uint8_t second
seconds after the minute [0-60]
bool set_protocol_reparse_mode(bool active_mode)
Sets the Nextion display's protocol reparse mode.
void line(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t color)
Draw a line on the screen.
void set_component_text(const char *component, const char *text)
Set the text of a component to a static string.
uint8_t minute
minutes after the hour [0-59]
void set_component_font_color(const char *component, uint16_t color)
Set the font color of a component.
void set_component_font(const char *component, uint8_t font_id) override
Set the font id for a component.
void enable_component_touch(const char *component)
Enable touch for a component.
void fill_area(uint16_t x1, uint16_t y1, uint16_t width, uint16_t height, uint16_t color)
Fill a rectangle with a color.
void set_backlight_brightness(float brightness)
Set the brightness of the backlight.
bool void add_no_result_to_queue_with_set_internal_(const std::string &variable_name, const std::string &variable_name_to_send, int32_t state_value, bool is_sleep_safe=false)
void soft_reset()
Softreset the Nextion.
void set_touch_sleep_timeout(uint16_t timeout)
Set the touch sleep timeout of the display.
void display_picture(uint16_t picture_id, uint16_t x_start, uint16_t y_start)
Display a picture at coordinates.
void set_wake_up_page(uint8_t page_id=255)
Sets which page Nextion loads when exiting sleep mode.
void filled_circle(uint16_t center_x, uint16_t center_y, uint16_t radius, uint16_t color)
Draw a filled circled.
void set_auto_wake_on_touch(bool auto_wake)
Sets if Nextion should auto-wake from sleep when touch press occurs.
Implementation of SPI Controller mode.
void void set_component_value(const char *component, int32_t value)
Set the integer value of a component.
void set_start_up_page(uint8_t page_id=255)
Sets which page Nextion loads when connecting to ESPHome.
uint8_t month
month; january=1 [1-12]
void qrcode(uint16_t x1, uint16_t y1, const char *content, uint16_t size=200, uint16_t background_color=65535, uint16_t foreground_color=0, uint8_t logo_pic=-1, uint8_t border_width=8)
Draws a QR code in the screen.
uint8_t hour
hours since midnight [0-23]
void set_component_foreground_color(const char *component, uint16_t color)
Set the foreground color of a component.
void set_component_coordinates(const char *component, uint16_t x, uint16_t y)
Set the coordinates of a component on screen.
void set_component_aph(const char *component, uint8_t aph)
Set the opaqueness (fading) of a component.
void set_component_pressed_font_color(const char *component, uint16_t color)
Set the pressed font color of a component.
void set_component_drag(const char *component, bool drag)
Set the drag availability of a component.
uint8_t day_of_month
day of the month [1-31]
void add_no_result_to_queue_with_set(NextionComponentBase *component, int32_t state_value) override
void open_waveform_channel(uint8_t component_id, uint8_t channel_number, uint8_t value)