mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-24 11:46:34 +00:00
lvgl v8 preparations
This commit is contained in:
parent
5470d99c7a
commit
c8ab33232c
@ -581,9 +581,15 @@ typedef void * lv_font_user_data_t;
|
||||
* LV_OBJ SETTINGS
|
||||
*==================*/
|
||||
|
||||
typedef struct {
|
||||
uint8_t objid:5;
|
||||
uint8_t groupid:3;
|
||||
uint8_t id;
|
||||
} lv_obj_user_data_t;
|
||||
|
||||
#if LV_USE_USER_DATA
|
||||
/*Declare the type of the user data of object (can be e.g. `void *`, `int`, `struct`)*/
|
||||
typedef uint8_t lv_obj_user_data_t;
|
||||
//typedef hasp_obj_user_data_t lv_obj_user_data_t;
|
||||
/*Provide a function to free user data*/
|
||||
#define LV_USE_USER_DATA_FREE 0
|
||||
#if LV_USE_USER_DATA_FREE
|
||||
|
@ -58,23 +58,23 @@ build_flags =
|
||||
;-D DISABLE_LOGGING
|
||||
${override.build_flags}
|
||||
-D HASP_VERSION_MAJOR=0
|
||||
-D HASP_VERSION_MINOR=2
|
||||
-D HASP_VERSION_REVISION=1129
|
||||
-D HASP_VERSION_MINOR=3
|
||||
-D HASP_VERSION_REVISION=1207
|
||||
|
||||
; -- Shared library dependencies in all environments
|
||||
; Warning : don't put comments after github links => causes infinite download loop
|
||||
lib_deps =
|
||||
https://github.com/fvanroie/lvgl.git#dev ; lvgl 8.0.0 dev
|
||||
https://github.com/fvanroie/lv_components ;lvgl widgets 8.0.0
|
||||
|
||||
;lvgl/lvgl @ ^7.7.2 ; from PIO library
|
||||
bodmer/TFT_eSPI @ 2.3.4 ; Tft SPI drivers EXACT version 2.3.5 has compile error
|
||||
bxparks/AceButton @ ^1.7.1 ; GPIO button library
|
||||
bblanchon/ArduinoJson @ ^6.17.2 ; Json(l) parser
|
||||
bblanchon/StreamUtils @ 1.6.0 ; for EEPromStream
|
||||
knolleary/PubSubClient @ ^2.8.0 ; MQTT client
|
||||
;https://github.com/Bodmer/TFT_eSPI.git ; ^2.3.5 needed for DMA
|
||||
https://github.com/fvanroie/ConsoleInput.git
|
||||
https://github.com/andrethomas/TasmotaSlave.git
|
||||
git+https://github.com/Bodmer/TFT_eSPI.git ; ztest
|
||||
git+https://github.com/fvanroie/ConsoleInput.git
|
||||
git+https://github.com/andrethomas/TasmotaSlave.git
|
||||
git+https://github.com/fvanroie/lv_components.git
|
||||
git+https://github.com/lvgl/lvgl.git#dev
|
||||
;lvgl/lvgl @ ^7.7.2 ; from PIO library
|
||||
;bodmer/TFT_eSPI @ 2.3.4 ; Tft SPI drivers EXACT version 2.3.5 has compile error
|
||||
; ------ Unused / Test libraries
|
||||
;https://github.com/netwizeBE/TFT_eSPI.git
|
||||
;Syslog@^2.0.0 ; Obsoleted
|
||||
@ -130,7 +130,7 @@ build_flags=
|
||||
-D ATOMIC_FS_UPDATE ; enabled compressed ota updates
|
||||
-D NO_GLOBAL_HTTPUPDATE ; dont instantiate httpUpdate
|
||||
; -- lvgl build options -----------------------------
|
||||
-D LV_MEM_SIZE=10240U ; 10kB lvgl memory
|
||||
-D LV_MEM_SIZE=16384U ; 16kB lvgl memory
|
||||
; -- hasp-lvgl build options ------------------------
|
||||
-D HASP_USE_WIFI=1
|
||||
-D HASP_USE_MQTT=1
|
||||
|
@ -187,7 +187,7 @@ void haspReconnect()
|
||||
void haspProgressVal(uint8_t val)
|
||||
{
|
||||
lv_obj_t * layer = lv_disp_get_layer_sys(NULL);
|
||||
lv_obj_t * bar = hasp_find_obj_from_id(255, 10);
|
||||
lv_obj_t * bar = hasp_find_obj_from_parent_id(get_page_obj(255), (uint8_t)10);
|
||||
if(layer && bar) {
|
||||
if(val == 255) {
|
||||
if(!lv_obj_get_hidden(bar)) {
|
||||
@ -212,7 +212,7 @@ void haspProgressVal(uint8_t val)
|
||||
// Sets the value string of the global progress bar
|
||||
void haspProgressMsg(const char * msg)
|
||||
{
|
||||
lv_obj_t * bar = hasp_find_obj_from_id(255, 10);
|
||||
lv_obj_t * bar = hasp_find_obj_from_parent_id(get_page_obj(255), (uint8_t)10);
|
||||
|
||||
char value_str[10];
|
||||
snprintf_P(value_str, sizeof(value_str), PSTR("value_str"));
|
||||
@ -539,13 +539,14 @@ void haspSetPage(uint8_t pageid)
|
||||
}
|
||||
}
|
||||
|
||||
// TODO make this a recursicee function
|
||||
void hasp_set_group_objects(uint8_t groupid, uint8_t eventid, lv_obj_t * src_obj)
|
||||
{
|
||||
bool state = dispatch_get_event_state(eventid);
|
||||
for(uint8_t page = 0; page < HASP_NUM_PAGES; page++) {
|
||||
uint8_t startid = 100 + groupid * 10; // groups start at id 100
|
||||
for(uint8_t objid = startid; objid < (startid + 10); objid++) {
|
||||
lv_obj_t * obj = hasp_find_obj_from_id(page, objid);
|
||||
lv_obj_t * obj = hasp_find_obj_from_parent_id(get_page_obj(page), objid);
|
||||
if(obj && obj != src_obj) { // skip source object, if set
|
||||
lv_obj_set_state(obj, state ? LV_STATE_PRESSED | LV_STATE_CHECKED : LV_STATE_DEFAULT);
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include "ArduinoLog.h"
|
||||
|
||||
#if LVGL_VERSION_MAJOR != 7
|
||||
#include "../lv_components/lv_components.h"
|
||||
#include "../lv_components.h"
|
||||
#endif
|
||||
#include "lvgl.h"
|
||||
#include "lv_conf.h"
|
||||
@ -977,7 +977,7 @@ void hasp_process_obj_attribute(lv_obj_t * obj, const char * attr_p, const char
|
||||
}
|
||||
|
||||
case ATTR_ID:
|
||||
return update ? (void)(obj->user_data = (uint8_t)val) : hasp_out_int(obj, attr, obj->user_data);
|
||||
return update ? (void)(obj->user_data.id = (uint8_t)val) : hasp_out_int(obj, attr, obj->user_data.id);
|
||||
|
||||
case ATTR_VIS:
|
||||
return update ? lv_obj_set_hidden(obj, !is_true(payload))
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
#include "lvgl.h"
|
||||
#if LVGL_VERSION_MAJOR != 7
|
||||
#include "../lv_components/lv_components.h"
|
||||
#include "../lv_components.h"
|
||||
#endif
|
||||
|
||||
#include "hasp.h"
|
||||
@ -28,7 +28,7 @@
|
||||
|
||||
// ##################### Object Finders ########################################################
|
||||
|
||||
lv_obj_t * hasp_find_obj_from_id(lv_obj_t * parent, uint8_t objid)
|
||||
lv_obj_t * hasp_find_obj_from_parent_id(lv_obj_t * parent, uint8_t objid)
|
||||
{
|
||||
if(objid == 0 || parent == nullptr) return parent;
|
||||
|
||||
@ -36,10 +36,10 @@ lv_obj_t * hasp_find_obj_from_id(lv_obj_t * parent, uint8_t objid)
|
||||
child = lv_obj_get_child(parent, NULL);
|
||||
while(child) {
|
||||
/* child found, return it */
|
||||
if(child->user_data && (lv_obj_user_data_t)objid == child->user_data) return child;
|
||||
if(objid == child->user_data.id) return child;
|
||||
|
||||
/* check grandchildren */
|
||||
lv_obj_t * grandchild = hasp_find_obj_from_id(child, objid);
|
||||
lv_obj_t * grandchild = hasp_find_obj_from_parent_id(child, objid);
|
||||
if(grandchild) return grandchild; /* grandchild found, return it */
|
||||
|
||||
/* check tabs */
|
||||
@ -52,7 +52,7 @@ lv_obj_t * hasp_find_obj_from_id(lv_obj_t * parent, uint8_t objid)
|
||||
if(tab->user_data && (lv_obj_user_data_t)objid == tab->user_data) return tab; /* tab found, return it */
|
||||
|
||||
/* check grandchildren */
|
||||
grandchild = hasp_find_obj_from_id(tab, objid);
|
||||
grandchild = hasp_find_obj_from_parent_id(tab, objid);
|
||||
if(grandchild) return grandchild; /* grandchild found, return it */
|
||||
}
|
||||
#endif
|
||||
@ -64,16 +64,17 @@ lv_obj_t * hasp_find_obj_from_id(lv_obj_t * parent, uint8_t objid)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
lv_obj_t * hasp_find_obj_from_id(uint8_t pageid, uint8_t objid)
|
||||
{
|
||||
return hasp_find_obj_from_id(get_page_obj(pageid), objid);
|
||||
}
|
||||
// lv_obj_t * hasp_find_obj_from_page_id(uint8_t pageid, uint8_t objid)
|
||||
// {
|
||||
// return hasp_find_obj_from_parent_id(get_page_obj(pageid), objid);
|
||||
// }
|
||||
|
||||
bool hasp_find_id_from_obj(lv_obj_t * obj, uint8_t * pageid, lv_obj_user_data_t * objid)
|
||||
bool hasp_find_id_from_obj(lv_obj_t * obj, uint8_t * pageid, uint8_t * objid)
|
||||
{
|
||||
if(!get_page_id(obj, pageid)) return false;
|
||||
if(!(obj->user_data > 0)) return false;
|
||||
memcpy(objid, &obj->user_data, sizeof(lv_obj_user_data_t));
|
||||
if(!(obj->user_data.id > 0)) return false;
|
||||
// memcpy(objid, &obj->user_data.id, sizeof(lv_obj_user_data_t));
|
||||
*objid = obj->user_data.id;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -180,7 +181,7 @@ void hasp_object_tree(lv_obj_t * parent, uint8_t pageid, uint16_t level)
|
||||
child = lv_obj_get_child(parent, NULL);
|
||||
while(child) {
|
||||
/* child found, process it */
|
||||
if(child->user_data) hasp_object_tree(child, pageid, level + 1);
|
||||
hasp_object_tree(child, pageid, level + 1);
|
||||
|
||||
/* try next sibling */
|
||||
child = lv_obj_get_child(parent, child);
|
||||
@ -265,33 +266,27 @@ static inline void hasp_send_obj_attribute_txt(lv_obj_t * obj, const char * txt)
|
||||
void IRAM_ATTR btn_event_handler(lv_obj_t * obj, lv_event_t event)
|
||||
{
|
||||
uint8_t eventid;
|
||||
char buffer[6];
|
||||
|
||||
switch(event) {
|
||||
case LV_EVENT_PRESSED:
|
||||
eventid = HASP_EVENT_DOWN;
|
||||
memcpy_P(buffer, PSTR("DOWN"), sizeof(buffer));
|
||||
break;
|
||||
case LV_EVENT_CLICKED:
|
||||
// UP = the same object was release then was pressed and press was not lost!
|
||||
eventid = HASP_EVENT_UP;
|
||||
memcpy_P(buffer, PSTR("UP"), sizeof(buffer));
|
||||
break;
|
||||
case LV_EVENT_SHORT_CLICKED:
|
||||
eventid = HASP_EVENT_SHORT;
|
||||
memcpy_P(buffer, PSTR("SHORT"), sizeof(buffer));
|
||||
break;
|
||||
case LV_EVENT_LONG_PRESSED:
|
||||
eventid = HASP_EVENT_LONG;
|
||||
memcpy_P(buffer, PSTR("LONG"), sizeof(buffer));
|
||||
break;
|
||||
case LV_EVENT_LONG_PRESSED_REPEAT:
|
||||
eventid = HASP_EVENT_HOLD;
|
||||
memcpy_P(buffer, PSTR("HOLD"), sizeof(buffer));
|
||||
break;
|
||||
return; // we don't care about hold
|
||||
// eventid = HASP_EVENT_HOLD;
|
||||
// break;
|
||||
case LV_EVENT_PRESS_LOST:
|
||||
eventid = HASP_EVENT_LOST;
|
||||
memcpy_P(buffer, PSTR("LOST"), sizeof(buffer));
|
||||
break;
|
||||
case LV_EVENT_PRESSING:
|
||||
case LV_EVENT_FOCUSED:
|
||||
@ -312,15 +307,20 @@ void IRAM_ATTR btn_event_handler(lv_obj_t * obj, lv_event_t event)
|
||||
return;
|
||||
}
|
||||
|
||||
guiCheckSleep();
|
||||
guiCheckSleep(); // wakeup?
|
||||
dispatch_send_object_event(haspGetPage(), (uint8_t)obj->user_data.id, eventid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a press on the system layer is detected
|
||||
* @param obj pointer to a button matrix
|
||||
* @param event type of event that occured
|
||||
*/
|
||||
void wakeup_event_handler(lv_obj_t * obj, lv_event_t event)
|
||||
{
|
||||
if(obj == lv_disp_get_layer_sys(NULL)) {
|
||||
#if HASP_USE_MQTT > 0
|
||||
mqtt_send_state(F("wakeuptouch"), buffer); // TODO: enable wakeuptouch
|
||||
#endif
|
||||
} else {
|
||||
// hasp_send_obj_attribute_event(obj, buffer);
|
||||
dispatch_send_object_event(haspGetPage(), (uint8_t)obj->user_data, eventid);
|
||||
guiCheckSleep(); // wakeup?
|
||||
lv_obj_set_click(obj, false); // disable fist click
|
||||
}
|
||||
}
|
||||
|
||||
@ -331,7 +331,10 @@ void IRAM_ATTR btn_event_handler(lv_obj_t * obj, lv_event_t event)
|
||||
*/
|
||||
static void btnmap_event_handler(lv_obj_t * obj, lv_event_t event)
|
||||
{
|
||||
if(event == LV_EVENT_VALUE_CHANGED) hasp_send_obj_attribute_val(obj, lv_btnmatrix_get_active_btn(obj));
|
||||
if(event == LV_EVENT_VALUE_CHANGED) {
|
||||
guiCheckSleep(); // wakeup?
|
||||
hasp_send_obj_attribute_val(obj, lv_btnmatrix_get_active_btn(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -342,10 +345,10 @@ static void btnmap_event_handler(lv_obj_t * obj, lv_event_t event)
|
||||
static void table_event_handler(lv_obj_t * obj, lv_event_t event)
|
||||
{
|
||||
if(event == LV_EVENT_VALUE_CHANGED) {
|
||||
guiCheckSleep(); // wakeup?
|
||||
|
||||
uint16_t row;
|
||||
uint16_t col;
|
||||
guiCheckSleep();
|
||||
|
||||
if(lv_table_get_pressed_cell(obj, &row, &col) == LV_RES_OK) hasp_send_obj_attribute_val(obj, row);
|
||||
}
|
||||
}
|
||||
@ -358,10 +361,7 @@ static void table_event_handler(lv_obj_t * obj, lv_event_t event)
|
||||
void IRAM_ATTR toggle_event_handler(lv_obj_t * obj, lv_event_t event)
|
||||
{
|
||||
if(event == LV_EVENT_VALUE_CHANGED) {
|
||||
// bool toggled = lv_btn_get_state(obj) == LV_BTN_STATE_CHECKED_PRESSED ||
|
||||
// lv_btn_get_state(obj) == LV_BTN_STATE_CHECKED_RELEASED;
|
||||
guiCheckSleep();
|
||||
|
||||
guiCheckSleep(); // wakeup?
|
||||
hasp_send_obj_attribute_val(obj, lv_checkbox_is_checked(obj));
|
||||
}
|
||||
}
|
||||
@ -373,7 +373,10 @@ void IRAM_ATTR toggle_event_handler(lv_obj_t * obj, lv_event_t event)
|
||||
*/
|
||||
static void switch_event_handler(lv_obj_t * obj, lv_event_t event)
|
||||
{
|
||||
if(event == LV_EVENT_VALUE_CHANGED) hasp_send_obj_attribute_val(obj, lv_switch_get_state(obj));
|
||||
if(event == LV_EVENT_VALUE_CHANGED) {
|
||||
guiCheckSleep(); // wakeup?
|
||||
hasp_send_obj_attribute_val(obj, lv_switch_get_state(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -444,7 +447,7 @@ static void roller_event_handler(lv_obj_t * obj, lv_event_t event)
|
||||
// Used in the dispatcher & hasp_new_object
|
||||
void hasp_process_attribute(uint8_t pageid, uint8_t objid, const char * attr, const char * payload)
|
||||
{
|
||||
if(lv_obj_t * obj = hasp_find_obj_from_id(pageid, objid)) {
|
||||
if(lv_obj_t * obj = hasp_find_obj_from_parent_id(get_page_obj(pageid), objid)) {
|
||||
hasp_process_obj_attribute(obj, attr, payload, strlen(payload) > 0);
|
||||
} else {
|
||||
Log.warning(TAG_HASP, F("Unknown object p[%d].b[%d]"), pageid, objid);
|
||||
@ -478,7 +481,7 @@ void hasp_new_object(const JsonObject & config, uint8_t & saved_page_id)
|
||||
lv_obj_t * parent_obj = page;
|
||||
if(!config[F("parentid")].isNull()) {
|
||||
uint8_t parentid = config[F("parentid")].as<uint8_t>();
|
||||
parent_obj = hasp_find_obj_from_id(page, parentid);
|
||||
parent_obj = hasp_find_obj_from_parent_id(page, parentid);
|
||||
if(!parent_obj) {
|
||||
return Log.warning(TAG_HASP, F("Parent ID p[%u].b[%u] not found, skipping..."), pageid, parentid);
|
||||
// parent_obj = page; // don't create on the page instead ??
|
||||
@ -487,11 +490,12 @@ void hasp_new_object(const JsonObject & config, uint8_t & saved_page_id)
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t objid = config[F("objid")].as<uint8_t>();
|
||||
uint8_t id = config[F("id")].as<uint8_t>();
|
||||
uint8_t groupid = config[F("groupid")].as<uint8_t>();
|
||||
uint8_t objid = config[F("objid")].as<uint8_t>();
|
||||
uint8_t id = config[F("id")].as<uint8_t>();
|
||||
|
||||
/* Define Objects*/
|
||||
lv_obj_t * obj = hasp_find_obj_from_id(parent_obj, id);
|
||||
lv_obj_t * obj = hasp_find_obj_from_parent_id(parent_obj, id);
|
||||
if(obj) {
|
||||
return Log.warning(TAG_HASP, F("Object ID %u already exists!"), id);
|
||||
}
|
||||
@ -585,11 +589,11 @@ void hasp_new_object(const JsonObject & config, uint8_t & saved_page_id)
|
||||
if(obj) {
|
||||
lv_obj_t * tab;
|
||||
tab = lv_tabview_add_tab(obj, "tab 1");
|
||||
lv_obj_set_user_data(tab, id + 1);
|
||||
// lv_obj_set_user_data(tab, id + 1);
|
||||
tab = lv_tabview_add_tab(obj, "tab 2");
|
||||
lv_obj_set_user_data(tab, id + 2);
|
||||
// lv_obj_set_user_data(tab, id + 2);
|
||||
tab = lv_tabview_add_tab(obj, "tab 3");
|
||||
lv_obj_set_user_data(tab, id + 3);
|
||||
// lv_obj_set_user_data(tab, id + 3);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -634,7 +638,7 @@ void hasp_new_object(const JsonObject & config, uint8_t & saved_page_id)
|
||||
#endif
|
||||
/* ----- Range Objects ------ */
|
||||
case LV_HASP_SLIDER: {
|
||||
// obj = lv_slider_create(parent_obj, NULL);
|
||||
// obj = lv_slider_create(parent_obj, NULL);
|
||||
if(obj) {
|
||||
lv_slider_set_range(obj, 0, 100);
|
||||
lv_obj_set_event_cb(obj, slider_event_handler);
|
||||
@ -725,7 +729,10 @@ void hasp_new_object(const JsonObject & config, uint8_t & saved_page_id)
|
||||
}
|
||||
|
||||
/* id tag the object */
|
||||
lv_obj_set_user_data(obj, id);
|
||||
// lv_obj_set_user_data(obj, id);
|
||||
obj->user_data.id = id;
|
||||
obj->user_data.objid = objid & 0b11111;
|
||||
obj->user_data.groupid = groupid & 0b111;
|
||||
|
||||
/* do not process these attributes */
|
||||
config.remove(F("page"));
|
||||
@ -742,7 +749,7 @@ void hasp_new_object(const JsonObject & config, uint8_t & saved_page_id)
|
||||
}
|
||||
|
||||
/** testing start **/
|
||||
lv_obj_user_data_t temp;
|
||||
uint8_t temp;
|
||||
if(!hasp_find_id_from_obj(obj, &pageid, &temp)) {
|
||||
return Log.error(TAG_HASP, F("Lost track of the created object, not found!"));
|
||||
}
|
||||
@ -753,7 +760,7 @@ void hasp_new_object(const JsonObject & config, uint8_t & saved_page_id)
|
||||
Log.verbose(TAG_HASP, F(" * p[%u].b[%u] = %s"), pageid, temp, list.type[0]);
|
||||
|
||||
/* test double-check */
|
||||
lv_obj_t * test = hasp_find_obj_from_id(pageid, (uint8_t)temp);
|
||||
lv_obj_t * test = hasp_find_obj_from_parent_id(get_page_obj(pageid), (uint8_t)temp);
|
||||
if(test != obj) {
|
||||
return Log.error(TAG_HASP, F("Objects DO NOT match!"));
|
||||
}
|
||||
|
@ -50,9 +50,9 @@ enum lv_hasp_obj_type_t {
|
||||
|
||||
void hasp_new_object(const JsonObject & config, uint8_t & saved_page_id);
|
||||
|
||||
lv_obj_t * hasp_find_obj_from_id(lv_obj_t * parent, uint8_t objid);
|
||||
lv_obj_t * hasp_find_obj_from_id(uint8_t pageid, uint8_t objid);
|
||||
bool hasp_find_id_from_obj(lv_obj_t * obj, uint8_t * pageid, lv_obj_user_data_t * objid);
|
||||
lv_obj_t * hasp_find_obj_from_parent_id(lv_obj_t * parent, uint8_t objid);
|
||||
// lv_obj_t * hasp_find_obj_from_page_id(uint8_t pageid, uint8_t objid);
|
||||
bool hasp_find_id_from_obj(lv_obj_t * obj, uint8_t * pageid, uint8_t * objid);
|
||||
bool check_obj_type(const char * lvobjtype, lv_hasp_obj_type_t haspobjtype);
|
||||
bool check_obj_type(lv_obj_t * obj, lv_hasp_obj_type_t haspobjtype);
|
||||
void hasp_object_tree(lv_obj_t * parent, uint8_t pageid, uint16_t level);
|
||||
@ -64,5 +64,6 @@ void hasp_process_attribute(uint8_t pageid, uint8_t objid, const char * attr, co
|
||||
|
||||
void IRAM_ATTR btn_event_handler(lv_obj_t * obj, lv_event_t event);
|
||||
void IRAM_ATTR toggle_event_handler(lv_obj_t * obj, lv_event_t event);
|
||||
void wakeup_event_handler(lv_obj_t * obj, lv_event_t event);
|
||||
|
||||
#endif
|
@ -8,7 +8,7 @@
|
||||
|
||||
#include "lvgl.h"
|
||||
#if LVGL_VERSION_MAJOR != 7
|
||||
#include "../lv_components/lv_components.h"
|
||||
#include "../lv_components.h"
|
||||
#endif
|
||||
|
||||
#include "hasp_object.h"
|
||||
@ -62,14 +62,14 @@ static void kb_event_cb(lv_obj_t * event_kb, lv_event_t event)
|
||||
char pass[32];
|
||||
lv_obj_t * obj;
|
||||
|
||||
obj = hasp_find_obj_from_id(oobepage[1], 10);
|
||||
obj = hasp_find_obj_from_parent_id(oobepage[1], (uint8_t)10);
|
||||
if(obj) {
|
||||
strncpy(ssid, lv_textarea_get_text(obj), sizeof(ssid));
|
||||
settings[FPSTR(F_CONFIG_SSID)] = ssid;
|
||||
if(oobekb != NULL) lv_keyboard_set_textarea(oobekb, obj);
|
||||
}
|
||||
|
||||
obj = hasp_find_obj_from_id(oobepage[1], 20);
|
||||
obj = hasp_find_obj_from_parent_id(oobepage[1],(uint8_t) 20);
|
||||
if(obj) {
|
||||
strncpy(pass, lv_textarea_get_text(obj), sizeof(pass));
|
||||
settings[FPSTR(F_CONFIG_PASS)] = pass;
|
||||
@ -106,9 +106,9 @@ static void ta_event_cb(lv_obj_t * ta, lv_event_t event)
|
||||
if(str[0] == '\n') {
|
||||
lv_obj_t * obj;
|
||||
|
||||
obj = hasp_find_obj_from_id(oobepage[1], 10);
|
||||
obj = hasp_find_obj_from_parent_id(oobepage[1], (uint8_t)10);
|
||||
if(ta == obj) { // now ssid, goto pass
|
||||
obj = hasp_find_obj_from_id(oobepage[1], 20);
|
||||
obj = hasp_find_obj_from_parent_id(oobepage[1], (uint8_t)20);
|
||||
}
|
||||
|
||||
if(oobekb && obj) {
|
||||
@ -222,7 +222,8 @@ static void oobeSetupSsid(void)
|
||||
lv_textarea_set_pwd_mode(pwd_ta, true);
|
||||
lv_textarea_set_one_line(pwd_ta, true);
|
||||
lv_textarea_set_cursor_hidden(pwd_ta, true);
|
||||
lv_obj_set_user_data(pwd_ta, 20);
|
||||
lv_obj_user_data_t udata = (lv_obj_user_data_t){20, 1, 0};
|
||||
lv_obj_set_user_data(pwd_ta, udata);
|
||||
lv_obj_set_width(pwd_ta, disp->driver.hor_res - leftmargin - 20 - lv_obj_get_height(pwd_ta));
|
||||
lv_obj_set_event_cb(pwd_ta, ta_event_cb);
|
||||
lv_obj_align(pwd_ta, NULL, LV_ALIGN_CENTER, leftmargin / 2 - lv_obj_get_height(pwd_ta) / 2, topmargin - voffset);
|
||||
@ -242,7 +243,7 @@ static void oobeSetupSsid(void)
|
||||
lv_obj_set_style_local_text_font(oneline_ta, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, defaultfont);
|
||||
|
||||
lv_textarea_set_pwd_mode(oneline_ta, false);
|
||||
lv_obj_set_user_data(oneline_ta, 10);
|
||||
lv_obj_set_user_data(oneline_ta, (lv_obj_user_data_t){10, 1, 0});
|
||||
lv_obj_align(oneline_ta, pwd_ta, LV_ALIGN_OUT_TOP_MID, 0, topmargin);
|
||||
|
||||
/* Create a label and position it above the text box */
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include "lv_conf.h" /*To see all the widgets*/
|
||||
#include "lv_theme_hasp.h" /*To see all the widgets*/
|
||||
#if LVGL_VERSION_MAJOR != 7
|
||||
#include "../lv_components/lv_components.h"
|
||||
#include "../lv_components.h"
|
||||
#endif
|
||||
|
||||
//#if LV_USE_THEME_HASP
|
||||
|
Loading…
x
Reference in New Issue
Block a user