diff --git a/Platformio/.vscode/settings.json b/Platformio/.vscode/settings.json index 2d766ef..0745d47 100644 --- a/Platformio/.vscode/settings.json +++ b/Platformio/.vscode/settings.json @@ -55,7 +55,30 @@ "bit": "cpp", "compare": "cpp", "concepts": "cpp", - "numbers": "cpp" + "numbers": "cpp", + "any": "cpp", + "hash_map": "cpp", + "strstream": "cpp", + "bitset": "cpp", + "charconv": "cpp", + "chrono": "cpp", + "complex": "cpp", + "condition_variable": "cpp", + "forward_list": "cpp", + "list": "cpp", + "ratio": "cpp", + "format": "cpp", + "future": "cpp", + "mutex": "cpp", + "semaphore": "cpp", + "shared_mutex": "cpp", + "span": "cpp", + "stop_token": "cpp", + "thread": "cpp", + "cfenv": "cpp", + "typeindex": "cpp", + "valarray": "cpp", + "variant": "cpp" }, "cmake.sourceDirectory": "${workspaceFolder}/.pio/libdeps/esp32/Adafruit BusIO", "editor.formatOnSave": false, diff --git a/Platformio/HAL/Architecture.png b/Platformio/HAL/Architecture.png index ac3de9e..88deb45 100644 Binary files a/Platformio/HAL/Architecture.png and b/Platformio/HAL/Architecture.png differ diff --git a/Platformio/HAL/HardwareAbstract.cpp b/Platformio/HAL/HardwareAbstract.cpp index 7752d9c..31aa920 100644 --- a/Platformio/HAL/HardwareAbstract.cpp +++ b/Platformio/HAL/HardwareAbstract.cpp @@ -1,48 +1,23 @@ #include "HardwareAbstract.hpp" -HardwareAbstract::HardwareAbstract( - std::shared_ptr aDisplay, - std::shared_ptr aBattery, - std::shared_ptr aWifiHandler -) -: mBattery(std::move(aBattery)), - mWifiHandler(std::move(aWifiHandler)), - mDisplay(std::move(aDisplay)) +HardwareAbstract::HardwareAbstract() {} std::optional HardwareAbstract::getBatteryStatus(){ +#if 0 if(mBattery){ HardwareAbstract::batteryStatus currentStatus; currentStatus.percentage = mBattery->getPercentage(); currentStatus.isCharging = mBattery->isCharging(); return currentStatus; } +#endif return std::nullopt; } +#if 0 void HardwareAbstract::onBatteryChange(std::function onBatteryStatusChangeHandler){ mBatteryNotification.onNotify(std::move(onBatteryStatusChangeHandler)); } - -void HardwareAbstract::onStartWifiScan(std::function cb_func){ - this->wifi_scan_start_cb.push_back(cb_func); -} - -void HardwareAbstract::onWifiScanDone(std::function>)> cb_func){ - this->wifi_scan_done_cb.push_back(cb_func); -} - -void HardwareAbstract::notifyStartWifiScan(){ - for (std::function cb_func:this->wifi_scan_start_cb) - { - cb_func(); - } -} - -void HardwareAbstract::notifyWifiScanDone(std::shared_ptr> info){ - for (std::function>)> cb_func: this->wifi_scan_done_cb) - { - cb_func(info); - } -} +#endif diff --git a/Platformio/HAL/HardwareAbstract.hpp b/Platformio/HAL/HardwareAbstract.hpp index e1ebc84..65b79a9 100644 --- a/Platformio/HAL/HardwareAbstract.hpp +++ b/Platformio/HAL/HardwareAbstract.hpp @@ -1,16 +1,13 @@ // OMOTE Hardware Abstraction // 2023 Matthew Colvin - -#pragma once +#ifndef _HARDWAREABSTRACT_H_ +#define _HARDWAREABSTRACT_H_ #include #include #include #include #include #include -#include "BatteryInterface.h" -#include "DisplayAbstract.h" -#include "wifiHandlerInterface.h" #include "Notification.hpp" typedef struct { @@ -18,12 +15,15 @@ typedef struct { int rssi; } WifiInfo; +typedef struct { + bool isConnected; + std::string IP; + std::string ssid; +}wifiStatus; + class HardwareAbstract { public: HardwareAbstract( - std::shared_ptr aDisplay, - std::shared_ptr aBattery = nullptr, - std::shared_ptr aWifiHandler = nullptr ); struct batteryStatus { @@ -39,27 +39,24 @@ public: /// status has changed. /// @param onBatteryStatusChangeHandler - Callable to be ran when batter status changes void onBatteryChange(std::function onBatteryStatusChangeHandler); - - void onStartWifiScan(std::function cb_func); - void onWifiScanDone(std::function>)> cb_func); - void notifyStartWifiScan(); - void notifyWifiScanDone(std::shared_ptr> info); + /// @brief Override in order to do setup of hardware devices virtual void init() = 0; /// @brief Override to allow printing of a message for debugging /// @param message - Debug message - virtual void debugPrint(std::string message) = 0; + virtual void debugPrint(const char* fmt, ...) = 0; + + Notification>> wifi_scan_done; + Notification<> wifi_scan_start; + Notification, std::shared_ptr> wifi_connect; + Notification> wifi_status_update; protected: Notification mBatteryNotification; private: - std::vector> wifi_scan_start_cb; - std::vector>)>> wifi_scan_done_cb; - std::shared_ptr mBattery; - std::shared_ptr mWifiHandler; - std::shared_ptr mDisplay; }; +#endif \ No newline at end of file diff --git a/Platformio/HAL/HardwareModules/wifiHandlerInterface.h b/Platformio/HAL/HardwareModules/wifiHandlerInterface.h index e8c2a31..38caa54 100644 --- a/Platformio/HAL/HardwareModules/wifiHandlerInterface.h +++ b/Platformio/HAL/HardwareModules/wifiHandlerInterface.h @@ -1,14 +1,14 @@ #pragma once #include +#include "HardwareAbstract.hpp" class wifiHandlerInterface{ public: virtual void begin() = 0; - virtual void connect(const char* SSID, const char* password) = 0; + //virtual void connect(const char* SSID, const char* password) = 0; virtual void disconnect() = 0; virtual bool isConnected() = 0; virtual void turnOff() = 0; virtual void scan() = 0; - virtual char* getSSID() = 0; virtual std::string getIP() = 0; }; \ No newline at end of file diff --git a/Platformio/HAL/Notification.hpp b/Platformio/HAL/Notification.hpp index 876c5aa..6b8920f 100644 --- a/Platformio/HAL/Notification.hpp +++ b/Platformio/HAL/Notification.hpp @@ -15,6 +15,7 @@ class Notification{ std::vector mFunctionHandlers; }; + template void Notification::onNotify(HandlerTy aHandler){ mFunctionHandlers.push_back(std::move(aHandler)); @@ -25,4 +26,4 @@ void Notification::notify(outboundData... notifySendData){ for (auto handler : mFunctionHandlers){ handler(notifySendData...); } -} +} \ No newline at end of file diff --git a/Platformio/HAL/Targets/ESP32/HardwareRevX.cpp b/Platformio/HAL/Targets/ESP32/HardwareRevX.cpp index c2f8e35..e29c29b 100644 --- a/Platformio/HAL/Targets/ESP32/HardwareRevX.cpp +++ b/Platformio/HAL/Targets/ESP32/HardwareRevX.cpp @@ -52,13 +52,7 @@ void HardwareRevX::initIO() { } HardwareRevX::HardwareRevX(): - HardwareAbstract( - Display::getInstance(), - std::make_shared(ADC_BAT,CRG_STAT), - wifiHandler::getInstance() - ){ - // Reset Sleep Timer on Touch Events - Display::getInstance()->onTouch([this]([[maybe_unused]] auto touchPoint){ standbyTimer = SLEEP_TIMEOUT;}); + HardwareAbstract(){ } HardwareRevX::WakeReason getWakeReason() { @@ -77,6 +71,9 @@ void HardwareRevX::init() { // Make sure ESP32 is running at full speed setCpuFrequencyMhz(240); + mDisplay = Display::getInstance(std::shared_ptr(this)); + mBattery = std::make_shared(ADC_BAT,CRG_STAT); + mWifiHandler = wifiHandler::getInstance(std::shared_ptr(this)); wakeup_reason = getWakeReason(); initIO(); setupBacklight(); @@ -86,12 +83,26 @@ void HardwareRevX::init() { setupIMU(); setupIR(); - debugPrint(std::string("Finished Hardware Setup in %d", millis())); + debugPrint("Finished Hardware Setup in %d", millis()); } +#if 0 void HardwareRevX::debugPrint(std::string aDebugMessage) { Serial.print(aDebugMessage.c_str()); } +#else +void HardwareRevX::debugPrint(const char* fmt, ...) +{ + char result[100]; + va_list arguments; + + va_start(arguments, fmt); + vsnprintf(result, 100, fmt, arguments); + va_end (arguments); + + Serial.print(result); +} +#endif std::shared_ptr HardwareRevX::getInstance(){ if (!mInstance) { diff --git a/Platformio/HAL/Targets/ESP32/HardwareRevX.hpp b/Platformio/HAL/Targets/ESP32/HardwareRevX.hpp index 82417b9..ed5fa67 100644 --- a/Platformio/HAL/Targets/ESP32/HardwareRevX.hpp +++ b/Platformio/HAL/Targets/ESP32/HardwareRevX.hpp @@ -16,6 +16,9 @@ #include "omoteconfig.h" +#include "BatteryInterface.h" +#include "wifiHandlerInterface.h" +#include "DisplayAbstract.h" class HardwareRevX : public HardwareAbstract { @@ -27,7 +30,11 @@ public: // HardwareAbstract virtual void init() override; + #if 0 virtual void debugPrint(std::string aDebugMessage) override; + #else + void debugPrint(const char* fmt, ...); + #endif void loopHandler(); @@ -54,6 +61,9 @@ protected: private: HardwareRevX(); + std::shared_ptr mBattery; + std::shared_ptr mWifiHandler; + std::shared_ptr mDisplay; // IMU Motion Detection LIS3DH IMU = LIS3DH(I2C_MODE, 0x19); // Default constructor is I2C, addr 0x19. int standbyTimer = SLEEP_TIMEOUT; diff --git a/Platformio/HAL/Targets/ESP32/display/display.cpp b/Platformio/HAL/Targets/ESP32/display/display.cpp index 422bd2c..f3290a0 100644 --- a/Platformio/HAL/Targets/ESP32/display/display.cpp +++ b/Platformio/HAL/Targets/ESP32/display/display.cpp @@ -3,20 +3,21 @@ #include "omoteconfig.h" #include "Wire.h" -std::shared_ptr Display::getInstance() +std::shared_ptr Display::getInstance(std::shared_ptr aHardware) { if (DisplayAbstract::mInstance == nullptr) { - DisplayAbstract::mInstance = std::shared_ptr(new Display(LCD_EN, LCD_BL)); + DisplayAbstract::mInstance = std::shared_ptr(new Display(LCD_EN, LCD_BL, aHardware)); } return std::static_pointer_cast(mInstance); } -Display::Display(int backlight_pin, int enable_pin): DisplayAbstract(), +Display::Display(int backlight_pin, int enable_pin, std::shared_ptr aHardware): DisplayAbstract(), mBacklightPin(backlight_pin), mEnablePin(enable_pin), tft(TFT_eSPI()), - touch(Adafruit_FT6206()) + touch(Adafruit_FT6206()), + mHardware(aHardware) { pinMode(mEnablePin, OUTPUT); digitalWrite(mEnablePin, HIGH); diff --git a/Platformio/HAL/Targets/ESP32/display/display.hpp b/Platformio/HAL/Targets/ESP32/display/display.hpp index a359ebb..ac3adb9 100644 --- a/Platformio/HAL/Targets/ESP32/display/display.hpp +++ b/Platformio/HAL/Targets/ESP32/display/display.hpp @@ -1,5 +1,6 @@ #pragma once #include "DisplayAbstract.h" +#include "HardwareAbstract.hpp" #include "Notification.hpp" #include #include @@ -19,7 +20,7 @@ class Display: public DisplayAbstract { public: - static std::shared_ptr getInstance(); + static std::shared_ptr getInstance(std::shared_ptr aHardware); virtual void setBrightness(uint8_t brightness) override; virtual void turnOff() override; @@ -31,7 +32,7 @@ class Display: public DisplayAbstract virtual void screenInput(lv_indev_drv_t *indev_driver, lv_indev_data_t *data) override; private: - Display(int backlight_pin, int enable_pin); + Display(int backlight_pin, int enable_pin, std::shared_ptr aHardware); void setupTFT(); void setupTouchScreen(); @@ -42,6 +43,6 @@ class Display: public DisplayAbstract Adafruit_FT6206 touch; TS_Point touchPoint; TS_Point oldPoint; - + std::shared_ptr mHardware; Notification mTouchEvent; }; \ No newline at end of file diff --git a/Platformio/HAL/Targets/ESP32/wifiHandler/wifihandler.cpp b/Platformio/HAL/Targets/ESP32/wifiHandler/wifihandler.cpp index 7e32afb..bde29b9 100644 --- a/Platformio/HAL/Targets/ESP32/wifiHandler/wifihandler.cpp +++ b/Platformio/HAL/Targets/ESP32/wifiHandler/wifihandler.cpp @@ -1,18 +1,29 @@ #include "wifihandler.hpp" #include #include +#include "HardwareAbstract.hpp" std::shared_ptr wifiHandler::mInstance = nullptr; - // WiFi status event void wifiHandler::WiFiEvent(WiFiEvent_t event){ int no_networks = 0; switch (event) { case ARDUINO_EVENT_WIFI_SCAN_DONE: + { Serial.println("WIFI scan done\n"); no_networks = WiFi.scanComplete(); + std::vector *vec = new std::vector(); + std::shared_ptr> info = std::shared_ptr>(vec); + + for (int i = 0; i < no_networks; i++) + { + info->push_back(WifiInfo { + .ssid = std::string(WiFi.SSID(i).c_str()), + .rssi = WiFi.RSSI(i) + }); + } if (no_networks < 0) { Serial.println("Scan failed"); @@ -25,40 +36,74 @@ void wifiHandler::WiFiEvent(WiFiEvent_t event){ Serial.print(" found\n"); //this->display.wifi_scan_complete( no_networks); } + mHardware->wifi_scan_done.notify(info); break; + } case ARDUINO_EVENT_WIFI_STA_GOT_IP: case ARDUINO_EVENT_WIFI_STA_GOT_IP6: - // TODO convert to callbacks - //display.update_wifi(true); - //update_credentials(temporary_ssid, temporary_password); - break; + this->update_credentials(); case ARDUINO_EVENT_WIFI_STA_DISCONNECTED: case ARDUINO_EVENT_WIFI_STA_LOST_IP: case ARDUINO_EVENT_WIFI_STA_STOP: - // TODO Convert to Callbacks - //display.update_wifi(false); + this->update_status(); default: break; } + if (WiFi.status() == WL_CONNECT_FAILED) + { + Serial.println("connection failed."); + WiFi.disconnect(); + } + Serial.println(WiFi.status()); } -std::shared_ptr wifiHandler::getInstance() +std::shared_ptr wifiHandler::getInstance(std::shared_ptr aHardware) { if(mInstance) { return mInstance; } - return std::shared_ptr(new wifiHandler()); + mInstance = std::shared_ptr(new wifiHandler(aHardware)); + return mInstance; }; -wifiHandler::wifiHandler() +wifiHandler::wifiHandler(std::shared_ptr aHardware) { - this->password[0] = '\0'; - this->SSID[0] = '\0'; + this->mHardware = aHardware; + this->mHardware->wifi_scan_start.onNotify([this](){this->mHardware->debugPrint("scan called\n"); this->scan();}); + this->mHardware->wifi_connect.onNotify([this] (std::shared_ptr ssid, std::shared_ptr password){this->connect(ssid, password);}); + this->password = ""; + this->SSID = ""; + this->begin(); } -void wifiHandler::update_credentials(const char* temporary_ssid, const char* temporary_password) +void wifiHandler::update_status() { + Serial.println("update_status"); + std::shared_ptr status = std::make_shared(wifiStatus()); + //wifiStatus *status = new wifiStatus(); + status->isConnected = WiFi.isConnected(); + //status->IP = WiFi.localIP(); + IPAddress ip = WiFi.localIP(); + String ip_str = ip.toString(); + status->IP = ip.toString().c_str(); + + //ip.copy(status->IP, ip.length()); + String ssid = WiFi.SSID(); + status->ssid = WiFi.SSID().c_str(); + + //this->wifi_status.isConnected = WiFi.isConnected(); + //this->wifi_status.IP = WiFi.localIP(); + //this->wifi_status.isConnected = true; + + + //Serial.println(WiFi.localIP()); + this->mHardware->wifi_status_update.notify(status); +} + +void wifiHandler::update_credentials() +{ +#if 0 if (strcmp(temporary_password, wifiHandler::password) != 0 || strcmp(temporary_ssid, wifiHandler::SSID) != 0) { strcpy(wifiHandler::password, temporary_password); @@ -72,18 +117,36 @@ void wifiHandler::update_credentials(const char* temporary_ssid, const char* tem preferences.putString("SSID", tempString); preferences.end(); } +#else + if (this->temporary_password->compare(this->password) != 0 || this->temporary_ssid->compare(this->SSID)) + { + this->password = *(this->temporary_password); + this->SSID = *(this->temporary_ssid); + + Preferences preferences; + preferences.begin("wifiSettings", false); + String tempString = this->temporary_password->c_str(); + preferences.putString("password", tempString); + tempString = this->temporary_ssid->c_str(); + preferences.putString("SSID", tempString); + preferences.end(); + } +#endif } void wifiHandler::scan() { + Serial.println("scan called"); WiFi.scanNetworks(true); } + void wifiHandler::begin() { //this->display = display; WiFi.setHostname("OMOTE"); WiFi.mode(WIFI_STA); + //WiFi.onEvent([this] (WiFiEvent_t event) {mInstance->WiFiEvent(event);}); WiFi.onEvent([] (WiFiEvent_t event) {mInstance->WiFiEvent(event);}); Preferences preferences; @@ -97,9 +160,11 @@ void wifiHandler::begin() { Serial.print("Connecting to wifi "); Serial.println(ssid); - strcpy(this->SSID, ssid.c_str()); - strcpy(this->password, password.c_str()); - this->connect(this->SSID, this->password); + //strcpy(this->SSID, ssid.c_str()); + //strcpy(this->password, password.c_str()); + this->SSID = ssid.c_str(); + this->password = password.c_str(); + //this->connect(this->SSID, this->password); } else { @@ -113,11 +178,11 @@ void wifiHandler::begin() WiFi.setSleep(true); } -void wifiHandler::connect(const char* SSID, const char* password) +void wifiHandler::connect(std::shared_ptr ssid, std::shared_ptr password) { - strncpy(this->temporary_password, password, STRING_SIZE); - strncpy(this->temporary_ssid, SSID, STRING_SIZE); - WiFi.begin(SSID, password); + this->temporary_password = password; + this->temporary_ssid = ssid; + WiFi.begin(ssid->c_str(), password->c_str()); } void wifiHandler::turnOff() @@ -135,11 +200,6 @@ bool wifiHandler::isConnected() return WiFi.isConnected(); } -char* wifiHandler::getSSID() -{ - return this->SSID; -} - std::string wifiHandler::getIP() { return std::string(WiFi.localIP().toString().c_str()); diff --git a/Platformio/HAL/Targets/ESP32/wifiHandler/wifihandler.hpp b/Platformio/HAL/Targets/ESP32/wifiHandler/wifihandler.hpp index 02c6eef..458e245 100644 --- a/Platformio/HAL/Targets/ESP32/wifiHandler/wifihandler.hpp +++ b/Platformio/HAL/Targets/ESP32/wifiHandler/wifihandler.hpp @@ -1,12 +1,14 @@ #pragma once #include "wifiHandlerInterface.h" +#include "HardwareAbstract.hpp" #include #define STRING_SIZE 50 class wifiHandler: public wifiHandlerInterface { public: - static std::shared_ptr getInstance(); + wifiHandler(std::shared_ptr aHardware); + static std::shared_ptr getInstance(std::shared_ptr aHardware); /** * @brief Function to initialize the wifi handler * @@ -19,7 +21,7 @@ class wifiHandler: public wifiHandlerInterface { * @param SSID * @param password */ - void connect(const char* SSID, const char* password); + //void connect(const char* SSID, const char* password); /** * @brief Function to disconnect from the network @@ -47,13 +49,6 @@ class wifiHandler: public wifiHandlerInterface { */ void scan(); - /** - * @brief Function to get SSID of the currently connected wifi network - * - * @return char* SSID of the currently connected network - */ - char* getSSID(); - /** * @brief Function to update the wifi credentials. This function is called in the wifi event callback function * after a connection is established. Only then is the new credentials stored and the old stored credentials @@ -62,7 +57,7 @@ class wifiHandler: public wifiHandlerInterface { * @param temporary_ssid * @param temporary_password */ - void update_credentials(const char* temporary_ssid, const char* temporary_password); + void update_credentials(); void WiFiEvent(WiFiEvent_t event); @@ -72,24 +67,27 @@ class wifiHandler: public wifiHandlerInterface { * @return String IP Address of the device */ std::string getIP(); + Notification>> scan_done; private: - wifiHandler(); - + wifiStatus wifi_status; static std::shared_ptr mInstance; - char temporary_password[STRING_SIZE]; - char temporary_ssid[STRING_SIZE]; + std::shared_ptr mHardware; + std::shared_ptr temporary_password; + std::shared_ptr temporary_ssid; + void connect(std::shared_ptr ssid, std::shared_ptr password); + void update_status(); /** * @brief Internal variable to store the wifi password * */ - char password[STRING_SIZE]; + std::string password; /** * @brief Internal variable to store the wifi SSID * */ - char SSID[STRING_SIZE]; + std::string SSID; }; \ No newline at end of file diff --git a/Platformio/HAL/Targets/Simulator/HardwareSimulator.hpp b/Platformio/HAL/Targets/Simulator/HardwareSimulator.hpp index 5837fe3..5d40d5f 100644 --- a/Platformio/HAL/Targets/Simulator/HardwareSimulator.hpp +++ b/Platformio/HAL/Targets/Simulator/HardwareSimulator.hpp @@ -6,10 +6,18 @@ class HardwareSimulator : public HardwareAbstract { public: HardwareSimulator(); - +#if 0 virtual void debugPrint(std::string message) override { std::cout << message; } + #else + virtual void debugPrint(const char* fmt, ...) override { + va_list arguments; + va_start(arguments, fmt); + vprintf(fmt, arguments); + va_end(arguments); + } + #endif virtual void init() override {}; diff --git a/Platformio/OmoteUI/Images.cpp b/Platformio/OmoteUI/Images.cpp index 6fb51a3..0a32e1a 100644 --- a/Platformio/OmoteUI/Images.cpp +++ b/Platformio/OmoteUI/Images.cpp @@ -1,5 +1,10 @@ #include "Images.hpp" +static void update_default_image_color(lv_obj_t* image) +{ + lv_obj_set_style_img_recolor(image, lv_color_white(), LV_PART_MAIN); + lv_obj_set_style_img_recolor_opa(image, LV_OPA_COVER, LV_PART_MAIN); +} Images::Images(){ setupImageDescriptions(); @@ -36,6 +41,27 @@ lv_obj_t* Images::addLightBulbIcon(lv_obj_t* parent){ return bulbIcon; } +lv_obj_t* Images::addWifiNoSignal(lv_obj_t* parent){ + lv_obj_t* noSignal = this->addImg(parent, &this->wifiNoSignal); + update_default_image_color(noSignal); + return noSignal; +} +lv_obj_t* Images::addWifiLowSignal(lv_obj_t* parent){ + lv_obj_t* lowSignal = this->addImg(parent, &this->wifiLowSignal); + update_default_image_color(lowSignal); + return lowSignal; +} +lv_obj_t* Images::addWifiMidSignal(lv_obj_t* parent){ + lv_obj_t* lowSignal = this->addImg(parent, &this->wifiMidSignal); + update_default_image_color(lowSignal); + return lowSignal; +} +lv_obj_t* Images::addWifiHighSignal(lv_obj_t* parent){ + lv_obj_t* lowSignal = this->addImg(parent, &this->wifiHighSignal); + update_default_image_color(lowSignal); + return lowSignal; +} + lv_obj_t* Images::addLeftGradiant(lv_obj_t* parent){ return this->addImg(parent, &this->gradientLeft); } @@ -934,6 +960,103 @@ inline static const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_LARGE_CONST uint8_t 0xff, 0xff, 0xff, 0xff, 0x69, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x21, 0x22, 0x22, 0x21, 0x01, 0x00, 0x00, 0x00, }; + +inline static const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_LARGE_CONST uint8_t WiFi_No_Signal_map[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, + 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, + 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, + 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, + 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; + +inline static const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_LARGE_CONST uint8_t WiFi_Mid_Signal_map[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, + 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, + 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, + 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, + 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; + +inline static const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_LARGE_CONST uint8_t WiFi_Low_Signal_map[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, + 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, + 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, + 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, + 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; + +inline static const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_LARGE_CONST uint8_t WiFi_High_Signal_map[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, + 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; + void Images::setupImageDescriptions(){ this->low_brightness.header.cf = LV_IMG_CF_ALPHA_8BIT; this->low_brightness.header.always_zero = 0; @@ -995,4 +1118,37 @@ void Images::setupImageDescriptions(){ this->gradientRight.header.h = 1; this->gradientRight.data_size = 30; this->gradientRight.data = gradientRight_map; + + this->wifiNoSignal.header.cf = LV_IMG_CF_ALPHA_8BIT; + this->wifiNoSignal.header.always_zero = 0; + this->wifiNoSignal.header.reserved = 0; + this->wifiNoSignal.header.w = 25; + this->wifiNoSignal.header.h = 21; + this->wifiNoSignal.data_size = 525; + this->wifiNoSignal.data = WiFi_No_Signal_map; + + this->wifiLowSignal.header.cf = LV_IMG_CF_ALPHA_8BIT; + this->wifiLowSignal.header.always_zero = 0; + this->wifiLowSignal.header.reserved = 0; + this->wifiLowSignal.header.w = 25; + this->wifiLowSignal.header.h = 21; + this->wifiLowSignal.data_size = 525; + this->wifiLowSignal.data = WiFi_Low_Signal_map; + + this->wifiMidSignal.header.cf = LV_IMG_CF_ALPHA_8BIT; + this->wifiMidSignal.header.always_zero = 0; + this->wifiMidSignal.header.reserved = 0; + this->wifiMidSignal.header.w = 25; + this->wifiMidSignal.header.h = 21; + this->wifiMidSignal.data_size = 525; + this->wifiMidSignal.data = WiFi_Mid_Signal_map; + + this->wifiHighSignal.header.cf = LV_IMG_CF_ALPHA_8BIT; + this->wifiHighSignal.header.always_zero = 0; + this->wifiHighSignal.header.reserved = 0; + this->wifiHighSignal.header.w = 25; + this->wifiHighSignal.header.h = 21; + this->wifiHighSignal.data_size = 525; + this->wifiHighSignal.data = WiFi_High_Signal_map; + } \ No newline at end of file diff --git a/Platformio/OmoteUI/Images.hpp b/Platformio/OmoteUI/Images.hpp index 6c00649..be23311 100644 --- a/Platformio/OmoteUI/Images.hpp +++ b/Platformio/OmoteUI/Images.hpp @@ -19,6 +19,12 @@ public: lv_obj_t* addLeftGradiant(lv_obj_t* parent); lv_obj_t* addRightGradiant(lv_obj_t* parent); + lv_obj_t* addWifiNoSignal(lv_obj_t* parent); + lv_obj_t* addWifiLowSignal(lv_obj_t* parent); + lv_obj_t* addWifiMidSignal(lv_obj_t* parent); + lv_obj_t* addWifiHighSignal(lv_obj_t* parent); + + private: // Make Image based on anImageDesc then // add that image to parent. @@ -36,6 +42,9 @@ private: lv_img_dsc_t gradientLeft; lv_img_dsc_t gradientRight; - + lv_img_dsc_t wifiNoSignal; + lv_img_dsc_t wifiLowSignal; + lv_img_dsc_t wifiMidSignal; + lv_img_dsc_t wifiHighSignal; }; \ No newline at end of file diff --git a/Platformio/OmoteUI/OmoteUI.hpp b/Platformio/OmoteUI/OmoteUI.hpp index 912ad9b..a6040a6 100644 --- a/Platformio/OmoteUI/OmoteUI.hpp +++ b/Platformio/OmoteUI/OmoteUI.hpp @@ -78,7 +78,7 @@ private: std::shared_ptr mHardware; void reset_settings_menu(); void attach_keyboard(lv_obj_t* textarea); - + std::shared_ptr> found_wifi_networks; /** * @brief Keyboard object used whenever a keyboard is needed. * @@ -180,6 +180,7 @@ void create_keyboard(); unsigned int no_wifi_networks; + void wifi_status(std::shared_ptr status); /** * @brief callback function to get next wifi subpage. This callback can be used to get the next or previous page * diff --git a/Platformio/OmoteUI/wifiSettings.cpp b/Platformio/OmoteUI/wifiSettings.cpp index 2745668..f975490 100644 --- a/Platformio/OmoteUI/wifiSettings.cpp +++ b/Platformio/OmoteUI/wifiSettings.cpp @@ -1,5 +1,8 @@ #include "OmoteUI.hpp" +#define WIFI_SUBPAGE_SIZE 3 +static char* ssid; + lv_obj_t* OmoteUI::create_wifi_selection_page(lv_obj_t* menu) { /* Create sub page for wifi*/ @@ -49,7 +52,7 @@ void OmoteUI::password_field_event_cb(lv_event_t* e) const char* password = lv_textarea_get_text(ta); switch(code){ case LV_EVENT_READY: - //wifihandler.connect(ssid, password); + this->mHardware->wifi_connect.notify(std::make_shared(std::string(ssid)), std::make_shared(std::string(password))); lv_obj_clear_state(ta, LV_STATE_FOCUSED); this->hide_keyboard(); this->reset_settings_menu(); @@ -70,11 +73,13 @@ void OmoteUI::connect_btn_cb(lv_event_t* event) lv_obj_t* ta = (lv_obj_t*) event->user_data; const char* password = lv_textarea_get_text(ta); + this->mHardware->wifi_connect.notify(std::make_shared(std::string(ssid)), std::make_shared(std::string(password))); //Trigger wifi connection here //wifihandler.connect(ssid, password); lv_obj_clear_state(ta, LV_STATE_FOCUSED); - this->hide_keyboard(); + this->hide_keyboard(); this->reset_settings_menu(); + } void OmoteUI::create_wifi_main_page(lv_obj_t* parent) @@ -107,10 +112,120 @@ void OmoteUI::create_wifi_main_page(lv_obj_t* parent) void OmoteUI::wifi_scan_done(std::shared_ptr> info) { - for (WifiInfo i:*info) + unsigned int size = info->size(); + this->no_subpages = (size + WIFI_SUBPAGE_SIZE - 1)/WIFI_SUBPAGE_SIZE; + this->no_wifi_networks = size; + this->found_wifi_networks = info; + + if (size == 0) + { + lv_obj_t* menuBox = lv_obj_create(this->wifi_setting_cont); + lv_obj_set_size(menuBox, lv_pct(100), 45); + lv_obj_set_scrollbar_mode(menuBox, LV_SCROLLBAR_MODE_OFF); + lv_obj_t* menuLabel = lv_label_create(menuBox); + lv_label_set_text(menuLabel, "no networks found"); + } + else + { + this->update_wifi_selection_subpage(0); + } +} +void OmoteUI::next_wifi_selection_subpage(lv_event_t* e) +{ + int subpage = (int) lv_event_get_user_data(e); + this->update_wifi_selection_subpage(subpage); +} + + +/** + * @brief Callback function in case a wifi is selected. This callback function will change the label of the wifi password + * sub page to the selected wifi network. + * + * @param e Pointer to event object for the event where this callback is called + */ +static void wifi_selected_cb(lv_event_t* e) +{ + lv_obj_t* label = lv_obj_get_child(e->target, 0); + lv_label_set_text((lv_obj_t*) e->user_data, lv_label_get_text(label)); + ssid = lv_label_get_text(label); +} + + +void OmoteUI::update_wifi_selection_subpage(int page) +{ + if (page < this->no_subpages) + { + lv_obj_clean(this->wifi_setting_cont); + + lv_obj_t* pageLabel = lv_label_create(this->wifi_setting_cont); + lv_label_set_text_fmt(pageLabel, "Page %d/%d", page + 1, this->no_subpages); + if (page > 0) { - mHardware->debugPrint(i.ssid); + lv_obj_t* menuBox = lv_obj_create(this->wifi_setting_cont); + lv_obj_set_size(menuBox, lv_pct(100), 45); + lv_obj_set_scrollbar_mode(menuBox, LV_SCROLLBAR_MODE_OFF); + + lv_obj_t* menuLabel = lv_label_create(menuBox); + lv_label_set_text(menuLabel, "Previous"); + lv_obj_align(menuLabel, LV_ALIGN_TOP_RIGHT, 0, 0); + lv_obj_add_event_cb(menuBox, [](lv_event_t* e) {mInstance->next_wifi_selection_subpage(e);},LV_EVENT_CLICKED, (void*)(page - 1)); + lv_obj_t* arrow = lv_label_create(menuBox); + lv_label_set_text(arrow, LV_SYMBOL_LEFT); + lv_obj_align(arrow, LV_ALIGN_TOP_LEFT, 0, 0); } + + for (int i = 0; i < WIFI_SUBPAGE_SIZE && (page*WIFI_SUBPAGE_SIZE + i) < this->no_wifi_networks; i++) + { + lv_obj_t* menuBox = lv_obj_create(this->wifi_setting_cont); + lv_obj_set_size(menuBox, lv_pct(100), 45); + lv_obj_set_scrollbar_mode(menuBox, LV_SCROLLBAR_MODE_OFF); + + lv_obj_add_flag(menuBox, LV_OBJ_FLAG_EVENT_BUBBLE); + + lv_obj_t* menuLabel = lv_label_create(menuBox); + lv_label_set_text(menuLabel, this->found_wifi_networks->at(page*WIFI_SUBPAGE_SIZE + i).ssid.c_str()); + lv_obj_t* wifi_image; + + int RSSI = this->found_wifi_networks->at(page*WIFI_SUBPAGE_SIZE + i).rssi; + + if (RSSI > -50) + { + wifi_image = imgs.addWifiHighSignal(menuBox); + } + else if (RSSI > -60) + { + wifi_image = imgs.addWifiMidSignal(menuBox); + } + else if (RSSI > -70) + { + wifi_image = imgs.addWifiLowSignal(menuBox); + } + else + { + wifi_image = imgs.addWifiLowSignal(menuBox); + } + lv_obj_align(wifi_image, LV_ALIGN_TOP_RIGHT, 0, 0); + lv_menu_set_load_page_event(this->settingsMenu, menuBox, this->wifi_password_page); + lv_obj_add_event_cb(menuBox, wifi_selected_cb, LV_EVENT_CLICKED, this->wifi_password_label); + } + + if ((page + 1) < this->no_subpages) + { + lv_obj_t* menuBox = lv_obj_create(this->wifi_setting_cont); + lv_obj_set_size(menuBox, lv_pct(100), 45); + lv_obj_set_scrollbar_mode(menuBox, LV_SCROLLBAR_MODE_OFF); + + lv_obj_t* menuLabel = lv_label_create(menuBox); + lv_label_set_text(menuLabel, "Next"); + lv_obj_add_event_cb(menuBox, [](lv_event_t* e) {mInstance->next_wifi_selection_subpage(e);}, LV_EVENT_CLICKED, (void*)(page + 1)); + + lv_obj_t* arrow = lv_label_create(menuBox); + lv_label_set_text(arrow, LV_SYMBOL_RIGHT); + lv_obj_align(arrow, LV_ALIGN_TOP_RIGHT, 0, 0); + + } + lv_obj_scroll_to_y(this->wifi_setting_cont, 0, LV_ANIM_OFF); + } } void OmoteUI::create_wifi_settings(lv_obj_t* menu, lv_obj_t* parent) @@ -118,7 +233,31 @@ void OmoteUI::create_wifi_settings(lv_obj_t* menu, lv_obj_t* parent) this->wifi_selection_page = this->create_wifi_selection_page(menu); this->wifi_password_page = this->create_wifi_password_page(this->settingsMenu); this->create_wifi_main_page(parent); - this->mHardware->onWifiScanDone([this] (std::shared_ptr> info) {this->wifi_scan_done(info);}); + this->mHardware->wifi_scan_done.onNotify([this] (std::shared_ptr> info) {this->wifi_scan_done(info);}); + this->mHardware->wifi_status_update.onNotify([this] (std::shared_ptr status) {this->wifi_status(status);}); +} + +void OmoteUI::wifi_status(std::shared_ptr status) +{ + this->mHardware->debugPrint("connected %d\n", status->isConnected); + this->mHardware->debugPrint("IP %s\n", status->IP); + this->mHardware->debugPrint("SSID %s\n", status->ssid); + + lv_obj_t* ip_label = lv_obj_get_child(this->wifiOverview, 3); + lv_obj_t* ssid_label = lv_obj_get_child(this->wifiOverview, 0); + + if (status->isConnected) + { + lv_label_set_text(this->WifiLabel, LV_SYMBOL_WIFI); + lv_label_set_text(ssid_label, status->ssid.c_str()); + lv_label_set_text(ip_label, status->IP.c_str()); + } + else + { + lv_label_set_text(this->WifiLabel, ""); + lv_label_set_text(ssid_label, "Disconnected"); + lv_label_set_text(ip_label, "-"); + } } lv_obj_t* OmoteUI::create_wifi_password_page(lv_obj_t* menu) @@ -165,6 +304,8 @@ void OmoteUI::wifi_settings_cb(lv_event_t* event) lv_obj_clean(cont); lv_obj_t* label = lv_label_create(cont); lv_label_set_text(label, "Searching for wifi networks"); + mHardware->debugPrint("Wifi settings cb called\n"); + mHardware->wifi_scan_start.notify(); //This will trigger an asynchronouse network scan // We need to trigger wifi search via HAL //wifihandler.scan();