Fix build errors

This commit is contained in:
fvanroie 2020-11-04 00:15:39 +01:00
parent 75819f9e96
commit 4d74a4037a
3 changed files with 37 additions and 33 deletions

View File

@ -148,7 +148,8 @@ bool get_page_id(lv_obj_t * obj, uint8_t * pageid)
lv_obj_t * hasp_find_obj_from_id(lv_obj_t * parent, uint8_t objid)
{
if(objid == 0) return parent;
if(objid == 0 || parent == nullptr) return parent;
lv_obj_t * child;
child = lv_obj_get_child(parent, NULL);
while(child) {
@ -873,7 +874,7 @@ void haspNewObject(const JsonObject & config, uint8_t & saved_page_id)
break;
}
case LV_HASP_ROLLER: {
obj = lv_roller_create(parent_obj, NULL);
obj = lv_roller_create(parent_obj, NULL);
// 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);

View File

@ -14,6 +14,8 @@
#include "hasp_config.h"
#include "hasp_dispatch.h"
static bool oobeAutoCalibrate = true;
#if HASP_USE_WIFI > 0
#if HASP_USE_QRCODE > 0
@ -23,15 +25,9 @@
static lv_obj_t * oobepage[2];
static lv_obj_t * oobekb;
extern lv_font_t * defaultFont;
static bool oobeAutoCalibrate = true;
lv_obj_t * pwd_ta;
void oobeSetAutoCalibrate(bool cal)
{
oobeAutoCalibrate = cal;
}
static inline void oobeSetPage(uint8_t pageid)
{
lv_scr_load(oobepage[pageid]);
@ -295,30 +291,13 @@ 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
void oobeSetAutoCalibrate(bool cal)
{
oobeAutoCalibrate = cal;
}
bool oobeSetup()
{
#if HASP_USE_ETHERNET > 0
@ -348,4 +327,28 @@ bool oobeSetup()
return false;
}
#endif
return false;
}
void oobeFakeSetup()
{
#if HASP_USE_WIFI > 0
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
}

View File

@ -77,7 +77,7 @@ void telnetAcceptClient()
telnetClient.stop(); // client disconnected
Log.unregisterOutput(1); // telnetClient
}
telnetClient = telnetServer.available(); // ready for new client
telnetClient = telnetServer->available(); // ready for new client
// Log.notice(F("Client connected from %s"), telnetClient.remoteIP().toString().c_str());
if(!telnetClient) {
Log.notice(F("Client NOT connected"));
@ -199,7 +199,7 @@ void telnetSetup()
#if defined(STM32F4xx)
// if(!telnetServer) telnetServer = new EthernetServer(telnetPort);
// if(telnetServer) {
telnetServer.begin();
telnetServer->begin();
Log.notice(F("Debug telnet console started"));
// } else {
// Log.error(F("Failed to start telnet server"));
@ -232,7 +232,7 @@ void IRAM_ATTR telnetLoop()
Ethernet.schedule();
// if(telnetServer)
{ // client is connected
EthernetClient client = telnetServer.available();
EthernetClient client = telnetServer->available();
if(client) {
if(!telnetClient || !telnetClient.connected()) {
//telnetAcceptClient(client);