mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-24 11:46:34 +00:00
Small changes
This commit is contained in:
parent
d2b82ba716
commit
75819f9e96
20
src/hasp.cpp
20
src/hasp.cpp
@ -312,6 +312,19 @@ void haspReconnect()
|
||||
lv_obj_set_hidden(obj, true);*/
|
||||
}
|
||||
|
||||
/*Add a custom apply callback*/
|
||||
static void custom_font_apply_cb(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
{
|
||||
lv_style_list_t * list;
|
||||
|
||||
switch(name) {
|
||||
case LV_THEME_BTN:
|
||||
list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
|
||||
// _lv_style_list_add_style(list, &my_style);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a demo application
|
||||
*/
|
||||
@ -319,12 +332,6 @@ void haspSetup()
|
||||
{
|
||||
guiSetDim(haspStartDim);
|
||||
|
||||
// lv_coord_t hres = lv_disp_get_hor_res(NULL);
|
||||
// lv_coord_t vres = lv_disp_get_ver_res(NULL);
|
||||
|
||||
// static lv_font_t *
|
||||
// my_font = (lv_font_t *)lv_mem_alloc(sizeof(lv_font_t));
|
||||
|
||||
/******* File System Test ********************************************************************/
|
||||
lv_fs_file_t f;
|
||||
lv_fs_res_t res;
|
||||
@ -867,7 +874,6 @@ void haspNewObject(const JsonObject & config, uint8_t & saved_page_id)
|
||||
}
|
||||
case LV_HASP_ROLLER: {
|
||||
obj = lv_roller_create(parent_obj, NULL);
|
||||
bool infinite = config[F("infinite")].as<bool>();
|
||||
// lv_roller_set_fix_width(obj, width);
|
||||
// lv_obj_align(obj, NULL, LV_ALIGN_IN_TOP_MID, 0, 20);
|
||||
lv_obj_set_event_cb(obj, roller_event_handler);
|
||||
|
@ -14,6 +14,8 @@
|
||||
#include "hasp_config.h"
|
||||
#include "hasp_dispatch.h"
|
||||
|
||||
#if HASP_USE_WIFI > 0
|
||||
|
||||
#if HASP_USE_QRCODE > 0
|
||||
#include "lv_qrcode.h"
|
||||
#endif
|
||||
@ -73,14 +75,13 @@ static void kb_event_cb(lv_obj_t * event_kb, lv_event_t event)
|
||||
strncpy(pass, lv_textarea_get_text(obj), sizeof(pass));
|
||||
settings[FPSTR(F_CONFIG_PASS)] = pass;
|
||||
}
|
||||
#if HASP_USE_WIFI > 0
|
||||
|
||||
if(strlen(ssid) > 0) {
|
||||
wifiSetConfig(settings.as<JsonObject>());
|
||||
if(wifiTestConnection()) {
|
||||
dispatchReboot(true);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
} else if(event == LV_EVENT_CANCEL) {
|
||||
oobeSetPage(0);
|
||||
@ -295,10 +296,33 @@ static void oobe_calibrate_cb(lv_obj_t * ta, lv_event_t event)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void oobeFakeSetup()
|
||||
{
|
||||
char ssid[32] = "HASP-ABCDEF";
|
||||
char pass[32] = "haspadmin";
|
||||
|
||||
guiSetDim(100);
|
||||
oobeSetupQR(ssid, pass);
|
||||
oobeSetupSsid();
|
||||
oobeSetPage(0);
|
||||
lv_obj_set_click(lv_disp_get_layer_sys(NULL), true);
|
||||
lv_obj_set_event_cb(lv_disp_get_layer_sys(NULL), gotoPage1_cb);
|
||||
|
||||
if(oobeAutoCalibrate) {
|
||||
lv_obj_set_click(lv_disp_get_layer_sys(NULL), true);
|
||||
lv_obj_set_event_cb(lv_disp_get_layer_sys(NULL), oobe_calibrate_cb);
|
||||
Log.verbose(F("OOBE: Enabled Auto Calibrate on touch"));
|
||||
} else {
|
||||
Log.verbose(F("OOBE: Already calibrated"));
|
||||
}
|
||||
}
|
||||
#endif // HASP_USE_WIFI
|
||||
|
||||
bool oobeSetup()
|
||||
{
|
||||
#if HASP_USE_ETHERNET > 0
|
||||
if (eth_connected) return false;
|
||||
if(eth_connected) return false;
|
||||
#endif
|
||||
#if HASP_USE_WIFI > 0
|
||||
char ssid[32];
|
||||
@ -325,24 +349,3 @@ if (eth_connected) return false;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void oobeFakeSetup()
|
||||
{
|
||||
char ssid[32] = "HASP-ABCDEF";
|
||||
char pass[32] = "haspadmin";
|
||||
|
||||
guiSetDim(100);
|
||||
oobeSetupQR(ssid, pass);
|
||||
oobeSetupSsid();
|
||||
oobeSetPage(0);
|
||||
lv_obj_set_click(lv_disp_get_layer_sys(NULL), true);
|
||||
lv_obj_set_event_cb(lv_disp_get_layer_sys(NULL), gotoPage1_cb);
|
||||
|
||||
if(oobeAutoCalibrate) {
|
||||
lv_obj_set_click(lv_disp_get_layer_sys(NULL), true);
|
||||
lv_obj_set_event_cb(lv_disp_get_layer_sys(NULL), oobe_calibrate_cb);
|
||||
Log.verbose(F("OOBE: Enabled Auto Calibrate on touch"));
|
||||
} else {
|
||||
Log.verbose(F("OOBE: Already calibrated"));
|
||||
}
|
||||
}
|
@ -109,18 +109,19 @@ void loop()
|
||||
/* Graphics Loops */
|
||||
// tftLoop();
|
||||
guiLoop();
|
||||
|
||||
/* Application Loops */
|
||||
// haspLoop();
|
||||
debugLoop();
|
||||
|
||||
#if HASP_USE_GPIO > 0
|
||||
gpioLoop();
|
||||
#endif
|
||||
#endif // GPIO
|
||||
|
||||
/* Network Services Loops */
|
||||
#if HASP_USE_ETHERNET > 0
|
||||
ethernetLoop();
|
||||
#endif
|
||||
#endif // ETHERNET
|
||||
|
||||
#if HASP_USE_MQTT > 0
|
||||
mqttLoop();
|
||||
@ -146,8 +147,6 @@ void loop()
|
||||
slaveLoop();
|
||||
#endif // TASMOTASLAVE
|
||||
|
||||
// digitalWrite(HASP_OUTPUT_PIN, digitalRead(HASP_INPUT_PIN)); // sets the LED to the button's value
|
||||
|
||||
/* Timer Loop */
|
||||
if(millis() - mainLastLoopTime >= 1000) {
|
||||
/* Run Every Second */
|
||||
|
Loading…
x
Reference in New Issue
Block a user