change udisplay file names

This commit is contained in:
gemu2015 2021-05-01 09:54:05 +02:00
parent 277857b5d1
commit c0d8f40f14
4 changed files with 60 additions and 8 deletions

View File

@ -7879,6 +7879,8 @@ void start_lvgl(const char * uconfig);
lv_event_t lvgl_last_event;
uint8_t lvgl_last_object;
uint8_t lvgl_last_slider;
static lv_obj_t * kb;
static lv_obj_t * ta;
void lvgl_set_last(lv_obj_t * obj, lv_event_t event);
void lvgl_set_last(lv_obj_t * obj, lv_event_t event) {
@ -7910,6 +7912,33 @@ void slider_event_cb(lv_obj_t * sld, lv_event_t event) {
}
}
static void kb_create(void);
static void ta_event_cb(lv_obj_t * ta_local, lv_event_t e);
static void kb_event_cb(lv_obj_t * keyboard, lv_event_t e);
static void kb_event_cb(lv_obj_t * keyboard, lv_event_t e) {
lv_keyboard_def_event_cb(kb, e);
if(e == LV_EVENT_CANCEL) {
lv_keyboard_set_textarea(kb, NULL);
lv_obj_del(kb);
kb = NULL;
}
}
static void kb_create(void) {
kb = lv_keyboard_create(lv_scr_act(), NULL);
lv_keyboard_set_cursor_manage(kb, true);
lv_obj_set_event_cb(kb, kb_event_cb);
lv_keyboard_set_textarea(kb, ta);
}
static void ta_event_cb(lv_obj_t * ta_local, lv_event_t e) {
if(e == LV_EVENT_CLICKED && kb == NULL) {
kb_create();
}
}
void lvgl_StoreObj(lv_obj_t *obj);
void lvgl_StoreObj(lv_obj_t *obj) {
if (lvgl_numobjs < MAX_LVGL_OBJS) {
@ -8039,6 +8068,18 @@ int32_t lvgl_test(char **lpp, int32_t p) {
}
break;
case 8:
{
ta = lv_textarea_create(lv_scr_act(), NULL);
lv_obj_align(ta, NULL, LV_ALIGN_IN_TOP_MID, 0, LV_DPI / 16);
lv_obj_set_event_cb(ta, ta_event_cb);
lv_textarea_set_text(ta, "");
lv_coord_t max_h = LV_VER_RES / 2 - LV_DPI / 8;
if (lv_obj_get_height(ta) > max_h) lv_obj_set_height(ta, max_h);
kb_create();
}
break;
case 50:
res = lvgl_last_object;
break;
@ -8051,6 +8092,7 @@ int32_t lvgl_test(char **lpp, int32_t p) {
default:
start_lvgl(0);
lvgl_setup();
break;
}
@ -8059,6 +8101,7 @@ int32_t lvgl_test(char **lpp, int32_t p) {
return res;
}
lv_obj_t *tabview, // LittlevGL tabview object
*gauge, // Gauge object (on first of three tabs)
*chart, // Chart object (second tab)

View File

@ -27,6 +27,9 @@ Renderer *renderer;
enum ColorType { COLOR_BW, COLOR_COLOR };
#ifndef DISP_BATCH_FILE
#define DISP_BATCH_FILE "/display.bat"
#endif
#ifdef USE_UFILESYS
extern FS *ufsp;
@ -1110,6 +1113,8 @@ extern FS *ffsp;
}
}
#ifdef USE_UFILESYS
void Display_Text_From_File(const char *file) {
File fp;
@ -1763,7 +1768,7 @@ void DisplayInitDriver(void)
#endif
#ifdef USE_UFILESYS
Display_Text_From_File("/display.ini");
Display_Text_From_File(DISP_BATCH_FILE);
#endif
#ifdef USE_GRAPH

View File

@ -22,7 +22,6 @@
#include <renderer.h>
#include "lvgl.h"
#include "tasmota_lvgl_assets.h" // force compilation of assets
#define XDRV_54 54
@ -140,10 +139,6 @@ void lv_flush_callback(lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *c
// save pixels to file
int32_t btw = (width * height * LV_COLOR_DEPTH + 7) / 8;
while (btw > 0) {
#if (LV_COLOR_DEPTH == 16) && (LV_COLOR_16_SWAP == 1)
uint16_t * pix = (uint16_t*) color_p;
for (uint32_t i = 0; i < btw / 2; i++) (pix[i] = pix[i] << 8 | pix[i] >> 8);
#endif
int32_t ret = glue->getScreenshotFile()->write((const uint8_t*) color_p, btw);
if (ret >= 0) {
btw -= ret;
@ -314,7 +309,7 @@ void start_lvgl(const char * uconfig) {
return;
}
if (uconfig && !renderer) {
if (!renderer || uconfig) {
#ifdef USE_UNIVERSAL_DISPLAY // TODO - we will probably support only UNIV_DISPLAY
renderer = Init_uDisplay((char*)uconfig, -1);
if (!renderer) return;
@ -323,6 +318,8 @@ void start_lvgl(const char * uconfig) {
#endif
}
renderer->DisplayOnff(true);
// **************************************************
// Initialize the glue between Adafruit and LVGL
// **************************************************

View File

@ -23,6 +23,7 @@
#define XDSP_17 17
#include <uDisplay.h>
bool udisp_init_done = false;
@ -52,6 +53,11 @@ void Core2DisplayDim(uint8_t dim);
//#define DSP_ROM_DESC
#ifndef DISP_DESC_FILE
//#define DISP_DESC_FILE "/dispdesc.txt"
#define DISP_DESC_FILE "/display.ini"
#endif
/*********************************************************************************************/
#ifdef DSP_ROM_DESC
/* sample descriptor */
@ -92,6 +98,7 @@ uDisplay *udisp;
Settings.display_model = XDSP_17;
fbuff = (char*)calloc(DISPDESC_SIZE, 1);
if (!fbuff) return 0;
@ -105,7 +112,7 @@ uDisplay *udisp;
#ifdef USE_UFILESYS
if (ffsp && !TasmotaGlobal.no_autoexec && !ddesc) {
File fp;
fp = ffsp->open("/dispdesc.txt", "r");
fp = ffsp->open(DISP_DESC_FILE, "r");
if (fp > 0) {
uint32_t size = fp.size();
fp.read((uint8_t*)fbuff, size);