8 static const char *
const TAG =
"nextion";
21 ESP_LOGD(TAG,
"Sleep timeout out of bounds, range 3-65535");
40 const uint8_t to_send[3] = {0xFF, 0xFF, 0xFF};
46 this->
write_str(
"DRAKJHSUYDGBNCJHGJKSHBDN");
155 va_start(arg, format);
157 int ret = vsnprintf(buffer,
sizeof(buffer), format, arg);
168 if (brightness < 0 || brightness > 1.0) {
169 ESP_LOGD(TAG,
"Brightness out of bounds, percentage range 0-1.0");
232 this->
add_no_result_to_queue_with_printf_(
"fill_area",
"fill %d,%d,%d,%d,%" PRIu16, x1, y1, width, height, color);
236 this->
add_no_result_to_queue_with_printf_(
"fill_area",
"fill %d,%d,%d,%d,%s", x1, y1, width, height, color);
240 this->
add_no_result_to_queue_with_printf_(
"fill_area",
"fill %d,%d,%d,%d,%d", x1, y1, width, height,
245 this->
add_no_result_to_queue_with_printf_(
"line",
"line %d,%d,%d,%d,%" PRIu16, x1, y1, x2, y2, color);
249 this->
add_no_result_to_queue_with_printf_(
"line",
"line %d,%d,%d,%d,%s", x1, y1, x2, y2, color);
253 this->
add_no_result_to_queue_with_printf_(
"line",
"line %d,%d,%d,%d,%d", x1, y1, x2, y2,
258 this->
add_no_result_to_queue_with_printf_(
"draw",
"draw %d,%d,%d,%d,%" PRIu16, x1, y1, x1 + width, y1 + height,
263 this->
add_no_result_to_queue_with_printf_(
"draw",
"draw %d,%d,%d,%d,%s", x1, y1, x1 + width, y1 + height, color);
267 this->
add_no_result_to_queue_with_printf_(
"draw",
"draw %d,%d,%d,%d,%d", x1, y1, x1 + width, y1 + height,
297 void Nextion::qrcode(
int x1,
int y1,
const char *content,
int size, uint16_t background_color,
298 uint16_t foreground_color,
int logo_pic, uint8_t border_width) {
299 this->
add_no_result_to_queue_with_printf_(
"qrcode",
"qrcode %d,%d,%d,%d,%d,%d,%d,\"%s\"", x1, y1, size,
300 background_color, foreground_color, logo_pic, border_width, content);
304 int logo_pic, uint8_t border_width) {
306 "qrcode",
"qrcode %d,%d,%d,%d,%d,%d,%d,\"%s\"", x1, y1, size,
display::ColorUtil::color_to_565(background_color),
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.
void write_str(const char *str)
void set_protocol_reparse_mode(bool active_mode)
Sets Nextion Protocol Reparse mode between active or passive.
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 write_array(const uint8_t *data, size_t len)
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.
void add_no_result_to_queue_with_set(NextionComponentBase *component, int state_value) override
bool exit_reparse_on_start_
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_coordinates(const char *component, int x, int y)
Set the coordinates of a component on screen.
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.
bool void add_no_result_to_queue_with_set_internal_(const std::string &variable_name, const std::string &variable_name_to_send, int state_value, bool is_sleep_safe=false)
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.
void void set_component_value(const char *component, int value)
Set the integer value of a component.
void filled_circle(int center_x, int center_y, int radius, uint16_t color)
Draw a filled circled.
void open_waveform_channel(int component_id, uint8_t channel_number, uint8_t value)
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 add_waveform_data(int component_id, uint8_t channel_number, uint8_t value)
Add waveform data to a waveform component.
void fill_area(int x1, int y1, int width, int height, uint16_t color)
Fill a rectangle with a color.
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]
void display_picture(int picture_id, int x_start, int y_start)
Display a picture at coordinates.
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 set_backlight_brightness(float brightness)
Set the brightness of the backlight.
void soft_reset()
Softreset the Nextion.
void set_touch_sleep_timeout(uint16_t timeout)
Set the touch sleep timeout of the display.
void set_wake_up_page(uint8_t page_id=255)
Sets which page Nextion loads when exiting sleep mode.
void qrcode(int x1, int y1, const char *content, int size=200, uint16_t background_color=65535, uint16_t foreground_color=0, int logo_pic=-1, uint8_t border_width=8)
Draws a QR code in the screen.
void rectangle(int x1, int y1, int width, int height, uint16_t color)
Draw a rectangle outline.
void set_auto_wake_on_touch(bool auto_wake)
Sets if Nextion should auto-wake from sleep when touch press occurs.
This is a workaround until we can figure out a way to get the tflite-micro idf component code availab...
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]
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_pressed_font_color(const char *component, uint16_t color)
Set the pressed font color of a component.
uint8_t day_of_month
day of the month [1-31]
void circle(int center_x, int center_y, int radius, uint16_t color)
Draw a circle outline.
void line(int x1, int y1, int x2, int y2, uint16_t color)
Draw a line on the screen.