mirror of
https://git.mirrors.martin98.com/https://github.com/luc-github/ESP3D.git
synced 2025-08-05 05:10:37 +08:00

### Maintenance page * Add add tab color for mobile view * Add spellcheck off / autocorect off in input * Add disconnect button when authenticate enabled * Add Invalid user or password message when authentication failed ### Board support * Add ESP32 S2 support * Add ESP32 S3 support * Add ESP32 C3 support ### ESP commands * Add command 701 to control GCODE streaming * Remove command 901 as duplicate * Update command 420 to add more details * Use text as default output * All json on all commands for formated output ### Core * Add benchmak function to check transfer speed (for test only-not production) * Merge code for ESP3DLib support * Add better printer display support (M117 / Serial TFT) * Use ESP32 analogWrite instead of emulated one ### Modules * Display * Refactor code * Remove SPI ILI 9341 / 9488 support as not suitable * Add ST7789 support (135x240 / 240x240) * Filesystem * Bug fixes due to esp core updates * Better SD sharing mecanism * Better global FS management * FTP * Add SD sharing support * Better global FS management * GCODE Host * Add basic support for macro files * Add ESP command support * Use not blocking method to stream commands / handle response * Notifications * Add IFTTT notification service * Add WebUI notification * Add ESP3D display notification * WebDav * Add SD sharing support * Add bug fix from https://github.com/d-a-v/ESPWebDAV * Better global FS management * Websocket * Add function to handle zombies connections * WiFi * Fix connection to AP sometime fail * Fix low signal not diplayed in ESP420 even connected * Add AP Setup mode ### Libraries * Update SDFat-2.0.6 to 2.1.2 * Update ESP32SSDP 1.1.1 to 1.2.0 * Update TFT_eSPI-1.4.11 to 2.4.61 * Update arduinoWebSockets-2.3.5 to 2.3.6 * Update esp8266-oled-ssd1306-4.0.0 to 4.3.0 * Remove lvgl support ### Tools * Add I2C scanner script * Add python script to simulate/stress printer serial communication ### PlatformIO * Use latest 4.4.0 Espressif32 release (ESP32-arduino core 2.0.3) * Add fix for Flash more than 4MB * Add Esp32 S2/S3/C3 env * Add ESP32-ST7789 / esp32-TTGO_T_Display env
193 lines
5.7 KiB
C
193 lines
5.7 KiB
C
#include "../lv_examples.h"
|
|
#if LV_USE_FLEX && LV_BUILD_EXAMPLES
|
|
|
|
static lv_anim_timeline_t * anim_timeline = NULL;
|
|
|
|
static lv_obj_t * obj1 = NULL;
|
|
static lv_obj_t * obj2 = NULL;
|
|
static lv_obj_t * obj3 = NULL;
|
|
|
|
static const lv_coord_t obj_width = 90;
|
|
static const lv_coord_t obj_height = 70;
|
|
|
|
static void set_width(void * var, int32_t v)
|
|
{
|
|
lv_obj_set_width((lv_obj_t *)var, v);
|
|
}
|
|
|
|
static void set_height(void * var, int32_t v)
|
|
{
|
|
lv_obj_set_height((lv_obj_t *)var, v);
|
|
}
|
|
|
|
static void anim_timeline_create(void)
|
|
{
|
|
/* obj1 */
|
|
lv_anim_t a1;
|
|
lv_anim_init(&a1);
|
|
lv_anim_set_var(&a1, obj1);
|
|
lv_anim_set_values(&a1, 0, obj_width);
|
|
lv_anim_set_early_apply(&a1, false);
|
|
lv_anim_set_exec_cb(&a1, (lv_anim_exec_xcb_t)set_width);
|
|
lv_anim_set_path_cb(&a1, lv_anim_path_overshoot);
|
|
lv_anim_set_time(&a1, 300);
|
|
|
|
lv_anim_t a2;
|
|
lv_anim_init(&a2);
|
|
lv_anim_set_var(&a2, obj1);
|
|
lv_anim_set_values(&a2, 0, obj_height);
|
|
lv_anim_set_early_apply(&a2, false);
|
|
lv_anim_set_exec_cb(&a2, (lv_anim_exec_xcb_t)set_height);
|
|
lv_anim_set_path_cb(&a2, lv_anim_path_ease_out);
|
|
lv_anim_set_time(&a2, 300);
|
|
|
|
/* obj2 */
|
|
lv_anim_t a3;
|
|
lv_anim_init(&a3);
|
|
lv_anim_set_var(&a3, obj2);
|
|
lv_anim_set_values(&a3, 0, obj_width);
|
|
lv_anim_set_early_apply(&a3, false);
|
|
lv_anim_set_exec_cb(&a3, (lv_anim_exec_xcb_t)set_width);
|
|
lv_anim_set_path_cb(&a3, lv_anim_path_overshoot);
|
|
lv_anim_set_time(&a3, 300);
|
|
|
|
lv_anim_t a4;
|
|
lv_anim_init(&a4);
|
|
lv_anim_set_var(&a4, obj2);
|
|
lv_anim_set_values(&a4, 0, obj_height);
|
|
lv_anim_set_early_apply(&a4, false);
|
|
lv_anim_set_exec_cb(&a4, (lv_anim_exec_xcb_t)set_height);
|
|
lv_anim_set_path_cb(&a4, lv_anim_path_ease_out);
|
|
lv_anim_set_time(&a4, 300);
|
|
|
|
/* obj3 */
|
|
lv_anim_t a5;
|
|
lv_anim_init(&a5);
|
|
lv_anim_set_var(&a5, obj3);
|
|
lv_anim_set_values(&a5, 0, obj_width);
|
|
lv_anim_set_early_apply(&a5, false);
|
|
lv_anim_set_exec_cb(&a5, (lv_anim_exec_xcb_t)set_width);
|
|
lv_anim_set_path_cb(&a5, lv_anim_path_overshoot);
|
|
lv_anim_set_time(&a5, 300);
|
|
|
|
lv_anim_t a6;
|
|
lv_anim_init(&a6);
|
|
lv_anim_set_var(&a6, obj3);
|
|
lv_anim_set_values(&a6, 0, obj_height);
|
|
lv_anim_set_early_apply(&a6, false);
|
|
lv_anim_set_exec_cb(&a6, (lv_anim_exec_xcb_t)set_height);
|
|
lv_anim_set_path_cb(&a6, lv_anim_path_ease_out);
|
|
lv_anim_set_time(&a6, 300);
|
|
|
|
/* Create anim timeline */
|
|
anim_timeline = lv_anim_timeline_create();
|
|
lv_anim_timeline_add(anim_timeline, 0, &a1);
|
|
lv_anim_timeline_add(anim_timeline, 0, &a2);
|
|
lv_anim_timeline_add(anim_timeline, 200, &a3);
|
|
lv_anim_timeline_add(anim_timeline, 200, &a4);
|
|
lv_anim_timeline_add(anim_timeline, 400, &a5);
|
|
lv_anim_timeline_add(anim_timeline, 400, &a6);
|
|
}
|
|
|
|
static void btn_start_event_handler(lv_event_t * e)
|
|
{
|
|
lv_obj_t * btn = lv_event_get_target(e);
|
|
|
|
if (!anim_timeline) {
|
|
anim_timeline_create();
|
|
}
|
|
|
|
bool reverse = lv_obj_has_state(btn, LV_STATE_CHECKED);
|
|
lv_anim_timeline_set_reverse(anim_timeline, reverse);
|
|
lv_anim_timeline_start(anim_timeline);
|
|
}
|
|
|
|
static void btn_del_event_handler(lv_event_t * e)
|
|
{
|
|
LV_UNUSED(e);
|
|
if (anim_timeline) {
|
|
lv_anim_timeline_del(anim_timeline);
|
|
anim_timeline = NULL;
|
|
}
|
|
}
|
|
|
|
static void btn_stop_event_handler(lv_event_t * e)
|
|
{
|
|
LV_UNUSED(e);
|
|
if (anim_timeline) {
|
|
lv_anim_timeline_stop(anim_timeline);
|
|
}
|
|
}
|
|
|
|
static void slider_prg_event_handler(lv_event_t * e)
|
|
{
|
|
lv_obj_t * slider = lv_event_get_target(e);
|
|
|
|
if (!anim_timeline) {
|
|
anim_timeline_create();
|
|
}
|
|
|
|
int32_t progress = lv_slider_get_value(slider);
|
|
lv_anim_timeline_set_progress(anim_timeline, progress);
|
|
}
|
|
|
|
/**
|
|
* Create an animation timeline
|
|
*/
|
|
void lv_example_anim_timeline_1(void)
|
|
{
|
|
lv_obj_t * par = lv_scr_act();
|
|
lv_obj_set_flex_flow(par, LV_FLEX_FLOW_ROW);
|
|
lv_obj_set_flex_align(par, LV_FLEX_ALIGN_SPACE_AROUND, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER);
|
|
|
|
/* create btn_start */
|
|
lv_obj_t * btn_start = lv_btn_create(par);
|
|
lv_obj_add_event_cb(btn_start, btn_start_event_handler, LV_EVENT_VALUE_CHANGED, NULL);
|
|
lv_obj_add_flag(btn_start, LV_OBJ_FLAG_IGNORE_LAYOUT);
|
|
lv_obj_add_flag(btn_start, LV_OBJ_FLAG_CHECKABLE);
|
|
lv_obj_align(btn_start, LV_ALIGN_TOP_MID, -100, 20);
|
|
|
|
lv_obj_t * label_start = lv_label_create(btn_start);
|
|
lv_label_set_text(label_start, "Start");
|
|
lv_obj_center(label_start);
|
|
|
|
/* create btn_del */
|
|
lv_obj_t * btn_del = lv_btn_create(par);
|
|
lv_obj_add_event_cb(btn_del, btn_del_event_handler, LV_EVENT_CLICKED, NULL);
|
|
lv_obj_add_flag(btn_del, LV_OBJ_FLAG_IGNORE_LAYOUT);
|
|
lv_obj_align(btn_del, LV_ALIGN_TOP_MID, 0, 20);
|
|
|
|
lv_obj_t * label_del = lv_label_create(btn_del);
|
|
lv_label_set_text(label_del, "Delete");
|
|
lv_obj_center(label_del);
|
|
|
|
/* create btn_stop */
|
|
lv_obj_t * btn_stop = lv_btn_create(par);
|
|
lv_obj_add_event_cb(btn_stop, btn_stop_event_handler, LV_EVENT_CLICKED, NULL);
|
|
lv_obj_add_flag(btn_stop, LV_OBJ_FLAG_IGNORE_LAYOUT);
|
|
lv_obj_align(btn_stop, LV_ALIGN_TOP_MID, 100, 20);
|
|
|
|
lv_obj_t * label_stop = lv_label_create(btn_stop);
|
|
lv_label_set_text(label_stop, "Stop");
|
|
lv_obj_center(label_stop);
|
|
|
|
/* create slider_prg */
|
|
lv_obj_t * slider_prg = lv_slider_create(par);
|
|
lv_obj_add_event_cb(slider_prg, slider_prg_event_handler, LV_EVENT_VALUE_CHANGED, NULL);
|
|
lv_obj_add_flag(slider_prg, LV_OBJ_FLAG_IGNORE_LAYOUT);
|
|
lv_obj_align(slider_prg, LV_ALIGN_BOTTOM_MID, 0, -20);
|
|
lv_slider_set_range(slider_prg, 0, 65535);
|
|
|
|
/* create 3 objects */
|
|
obj1 = lv_obj_create(par);
|
|
lv_obj_set_size(obj1, obj_width, obj_height);
|
|
|
|
obj2 = lv_obj_create(par);
|
|
lv_obj_set_size(obj2, obj_width, obj_height);
|
|
|
|
obj3 = lv_obj_create(par);
|
|
lv_obj_set_size(obj3, obj_width, obj_height);
|
|
}
|
|
|
|
#endif
|