├── how_it_works_diagram.webp ├── .gitignore ├── lib ├── WiFiManager-2.0.17 │ ├── extras │ │ ├── png_signal_strength_master.png │ │ ├── parse.js │ │ ├── template.h │ │ └── test.html │ ├── CMakeLists.txt │ ├── strings_en.h │ ├── library.properties │ ├── .github │ │ ├── CONTRIBUTING.md │ │ ├── workflows │ │ │ ├── cpp_lint.yml │ │ │ ├── compile_library.yml │ │ │ └── compile_examples.yaml │ │ └── ISSUE_TEMPLATE.md │ ├── library.json │ ├── examples │ │ ├── Unique │ │ │ └── cb │ │ │ │ └── AnonymousCB.ino │ │ ├── NonBlocking │ │ │ ├── AutoConnectNonBlocking │ │ │ │ └── AutoConnectNonBlocking.ino │ │ │ ├── AutoConnectNonBlockingwParams │ │ │ │ └── AutoConnectNonBlockingwParams.ino │ │ │ └── OnDemandNonBlocking │ │ │ │ └── onDemandNonBlocking.ino │ │ ├── Tests │ │ │ └── wifi_softap │ │ │ │ └── wifi_softap.ino │ │ ├── Old_examples │ │ │ ├── AutoConnectWithTimeout │ │ │ │ └── AutoConnectWithTimeout.ino │ │ │ ├── AutoConnectWithReset │ │ │ │ └── AutoConnectWithReset.ino │ │ │ ├── AutoConnectWithFeedback │ │ │ │ └── AutoConnectWithFeedback.ino │ │ │ └── AutoConnectWithStaticIP │ │ │ │ └── AutoConnectWithStaticIP.ino │ │ ├── OnDemand │ │ │ ├── OnDemandWebPortal │ │ │ │ └── onDemandWebPortal.ino │ │ │ └── OnDemandConfigPortal │ │ │ │ └── OnDemandConfigPortal.ino │ │ ├── Basic │ │ │ └── Basic.ino │ │ ├── Parameters │ │ │ ├── LittleFS │ │ │ │ └── LittleFSParameters.ino │ │ │ └── SPIFFS │ │ │ │ ├── AutoConnectWithFSParameters │ │ │ │ └── AutoConnectWithFSParameters.ino │ │ │ │ └── AutoConnectWithFSParametersAndCustomIP │ │ │ │ └── AutoConnectWithFSParametersAndCustomIP.ino │ │ ├── ParamsChildClass │ │ │ └── ParamsChildClass.ino │ │ └── Advanced │ │ │ └── Advanced.ino │ ├── keywords.txt │ ├── LICENSE │ ├── .travis.yml │ └── travis │ │ └── common.sh ├── QRCodeGenerator │ ├── library.properties │ ├── examples │ │ └── QRCode │ │ │ └── QRCode.ino │ └── src │ │ └── QRCodeGenerator.h └── GxEPD2_4G │ ├── library.properties │ ├── src │ ├── GxEPD2_4G.h │ ├── epd │ │ ├── GxEPD2_290_T5D.h │ │ ├── GxEPD2_290_I6FD.h │ │ ├── GxEPD2_213_flex.h │ │ ├── GxEPD2_290_T5.h │ │ ├── GxEPD2_420.h │ │ ├── GxEPD2_750_T7.h │ │ ├── GxEPD2_371.h │ │ ├── GxEPD2_290_T94.h │ │ └── GxEPD2_270.h │ ├── GxEPD2_4G_GFX.h │ └── gdey │ │ ├── GxEPD2_213_GDEY0213B74.h │ │ └── GxEPD2_154_GDEY0154D67.h │ └── examples │ └── GxEPD2_4G_Example │ └── GxEPD2_4G_wiring_examples.h ├── src ├── image_handler.h ├── logger.cpp ├── wireless.h ├── utils.h ├── state_manager.h ├── utils.cpp ├── http_client.h ├── sensor.h ├── state_manager.cpp ├── streaming_handler.h ├── wireless.cpp ├── logger.h └── streaming_handler.cpp ├── .vscode └── extensions.json ├── LICENSE ├── .github └── workflows │ └── PIO_build.yml ├── .clang-format ├── generate_web_manifest.py ├── platformio.ini └── README.md /how_it_works_diagram.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MultiTricker/zivyobraz-fw/main/how_it_works_diagram.webp -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .pio 2 | .vscode/.browse.c_cpp.db* 3 | .vscode/c_cpp_properties.json 4 | .vscode/launch.json 5 | .vscode/ipch 6 | .DS_Store 7 | *.code-workspace 8 | -------------------------------------------------------------------------------- /lib/WiFiManager-2.0.17/extras/png_signal_strength_master.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MultiTricker/zivyobraz-fw/main/lib/WiFiManager-2.0.17/extras/png_signal_strength_master.png -------------------------------------------------------------------------------- /lib/WiFiManager-2.0.17/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | 3 | idf_component_register( 4 | SRCS "WiFiManager.cpp" 5 | INCLUDE_DIRS "." 6 | PRIV_REQUIRES arduino 7 | ) 8 | 9 | project(WiFiManager) 10 | -------------------------------------------------------------------------------- /src/image_handler.h: -------------------------------------------------------------------------------- 1 | #ifndef IMAGE_HANDLER_H 2 | #define IMAGE_HANDLER_H 3 | 4 | #include "http_client.h" 5 | 6 | namespace ImageHandler 7 | { 8 | // Read image data from HTTP client 9 | void readImageData(HttpClient &http); 10 | } // namespace ImageHandler 11 | 12 | #endif // IMAGE_HANDLER_H 13 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | // See http://go.microsoft.com/fwlink/?LinkId=827846 3 | // for the documentation about the extensions.json format 4 | "recommendations": [ 5 | "platformio.platformio-ide" 6 | ], 7 | "unwantedRecommendations": [ 8 | "ms-vscode.cpptools-extension-pack" 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | License info 2 | 3 | ZivyObraz FW itself is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License (http://creativecommons.org/licenses/by-nc-sa/4.0/): 4 | 5 | Attribution—Noncommercial—Share Alike 6 | ✖ | Sharing without ATTRIBUTION 7 | ✖ | Commercial Use 8 | ✖ | Free Cultural Works 9 | ✖ | Meets Open Definition -------------------------------------------------------------------------------- /lib/QRCodeGenerator/library.properties: -------------------------------------------------------------------------------- 1 | name=QRCode 2 | version=0.0.1 3 | author=Richard Moore 4 | maintainer=Richard Moore 5 | sentence=A simple QR code generation library. 6 | paragraph=A simple QR code generation library. 7 | category=Other 8 | url=https://github.com/ricmoo/qrcode/ 9 | architectures=* 10 | includes=qrcode.h 11 | -------------------------------------------------------------------------------- /lib/WiFiManager-2.0.17/strings_en.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Contents of this file have moved to 2 new locations 3 | * wm_strings_nn.h 4 | * wm_consts_nn.h 5 | */ 6 | 7 | #warning "This file is deprecated" 8 | 9 | #ifndef _STRINGS_EN_H_ 10 | #define _STRINGS_EN_H_ 11 | 12 | // strings files must include a consts file! 13 | #include "wm_strings_en.h" // include constants, tokens, routes 14 | 15 | #endif -------------------------------------------------------------------------------- /lib/GxEPD2_4G/library.properties: -------------------------------------------------------------------------------- 1 | name=GxEPD2_4G 2 | version=1.0.8 3 | author=Jean-Marc Zingg 4 | maintainer=Jean-Marc Zingg 5 | sentence=Arduino Display Library for SPI E-Paper displays from Dalian Good Display and Waveshare. 6 | paragraph=Requires HW SPI and Adafruit_GFX. Caution: the bare e-paper panels require 3.3V supply AND data lines! 7 | category=Display 8 | url=https://github.com/ZinggJM/GxEPD2_4G 9 | architectures=* 10 | depends=Adafruit GFX Library 11 | -------------------------------------------------------------------------------- /lib/WiFiManager-2.0.17/library.properties: -------------------------------------------------------------------------------- 1 | name=WiFiManager 2 | version=2.0.17 3 | author=tzapu 4 | maintainer=tablatronix 5 | sentence=WiFi Configuration manager with web configuration portal for Espressif ESPx boards, by tzapu 6 | paragraph=Library for configuring ESP8266/ESP32 modules WiFi credentials and custom parameters at runtime with captive portal. 7 | category=Communication 8 | url=https://github.com/tzapu/WiFiManager.git 9 | architectures=esp8266,esp32 10 | -------------------------------------------------------------------------------- /src/logger.cpp: -------------------------------------------------------------------------------- 1 | #include "logger.h" 2 | 3 | Logger &Logger::getInstance() 4 | { 5 | static Logger instance; 6 | return instance; 7 | } 8 | 9 | String Logger::replaceFirstToken(const String &str, const String &value) const 10 | { 11 | // Find first occurrence of {} 12 | int pos = str.indexOf("{}"); 13 | if (pos >= 0) 14 | { 15 | String result = str.substring(0, pos); 16 | result += value; 17 | result += str.substring(pos + 2); 18 | return result; 19 | } 20 | return str; 21 | } 22 | -------------------------------------------------------------------------------- /src/wireless.h: -------------------------------------------------------------------------------- 1 | #ifndef WIRELESS_H 2 | #define WIRELESS_H 3 | 4 | #include 5 | 6 | namespace Wireless 7 | { 8 | void init(const String &hostname, const String &password, void (*callback)()); 9 | String getSSID(); 10 | int8_t getStrength(); 11 | String getMacAddress(); 12 | 13 | String getSoftAPSSID(); 14 | String getSoftAPIP(); 15 | String getIPAddress(); 16 | 17 | bool isConnected(); 18 | void turnOff(); 19 | void resetCredentialsAndReboot(); 20 | } // namespace Wireless 21 | 22 | #endif // WIRELESS_H 23 | -------------------------------------------------------------------------------- /lib/WiFiManager-2.0.17/.github/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | ## Contributing PRs and ISSUES 2 | 3 | The development branch is the active branch, no features or bugs will be fixed against master ( hotfixes may be considered ). 4 | 5 | Please test against development branch before submitting issues, issues against master will be closed, 6 | 7 | PRs against master may be kept open if provides something useful to other members. 8 | 9 | Please open issues before sumbitting PRs against development, as commits might be occuring very frequently. 10 | 11 | ### Documentation is in progress 12 | https://github.com/tzapu/WiFiManager/issues/500 13 | -------------------------------------------------------------------------------- /src/utils.h: -------------------------------------------------------------------------------- 1 | #ifndef UTILS_H 2 | #define UTILS_H 3 | 4 | #include 5 | 6 | // Helper macros (used in board.h and display.h for board/display type strings) 7 | #define STR(x) #x 8 | #define XSTR(x) STR(x) 9 | 10 | #define CAT(a, b) a##b 11 | #define XCAT(a, b) CAT(a, b) 12 | 13 | namespace Utils 14 | { 15 | // Memory statistics 16 | size_t getTotalHeap(); 17 | size_t getFreeHeap(); 18 | size_t getLargestFreeBlock(); 19 | void printMemoryStats(); 20 | 21 | // API key management (stored in NVS, survives power cycles) 22 | void initializeAPIKey(); 23 | uint32_t getStoredAPIKey(); 24 | } // namespace Utils 25 | 26 | #endif // UTILS_H 27 | -------------------------------------------------------------------------------- /lib/WiFiManager-2.0.17/library.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "WiFiManager", 3 | "version": "2.0.17", 4 | "keywords": "wifi,wi-fi,esp,esp8266,esp32,espressif8266,espressif32,nodemcu,wemos,arduino", 5 | "description": "WiFi Configuration manager with web configuration portal for ESP boards", 6 | "authors": 7 | [ 8 | { 9 | "name": "tzapu", 10 | "url": "https://github.com/tzapu" 11 | }, 12 | { 13 | "name": "tablatronix", 14 | "url": "https://github.com/tablatronix", 15 | "maintainer": true 16 | } 17 | ], 18 | "repository": 19 | { 20 | "type": "git", 21 | "url": "https://github.com/tzapu/WiFiManager.git" 22 | }, 23 | "frameworks": "arduino", 24 | "platforms": 25 | [ 26 | "espressif8266", 27 | "espressif32" 28 | ] 29 | } -------------------------------------------------------------------------------- /lib/WiFiManager-2.0.17/examples/Unique/cb/AnonymousCB.ino: -------------------------------------------------------------------------------- 1 | #include // https://github.com/tzapu/WiFiManager 2 | 3 | bool _enteredConfigMode = false; 4 | 5 | void setup(){ 6 | Serial.begin(115200); 7 | WiFiManager wifiManager; 8 | 9 | // wifiManager.setAPCallback([this](WiFiManager* wifiManager) { 10 | wifiManager.setAPCallback([&](WiFiManager* wifiManager) { 11 | Serial.printf("Entered config mode:ip=%s, ssid='%s'\n", 12 | WiFi.softAPIP().toString().c_str(), 13 | wifiManager->getConfigPortalSSID().c_str()); 14 | _enteredConfigMode = true; 15 | }); 16 | wifiManager.resetSettings(); 17 | if (!wifiManager.autoConnect()) { 18 | Serial.printf("*** Failed to connect and hit timeout\n"); 19 | ESP.restart(); 20 | delay(1000); 21 | } 22 | } 23 | 24 | void loop(){ 25 | 26 | } 27 | -------------------------------------------------------------------------------- /lib/WiFiManager-2.0.17/.github/workflows/cpp_lint.yml: -------------------------------------------------------------------------------- 1 | name: cpplint 2 | 3 | on: 4 | push: 5 | paths-ignore: 6 | - '.github/workflows/compile_*.yml' 7 | pull_request: 8 | paths-ignore: 9 | - '.github/workflows/compile_*.yml' 10 | jobs: 11 | build: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - uses: actions/checkout@v2 15 | - name: cpplint 16 | uses: reviewdog/action-cpplint@master 17 | with: 18 | github_token: ${{ secrets.GITHUB_TOKEN }} 19 | reporter: github-pr-check 20 | flags: --linelength=100 21 | target: . 22 | filter: "-whitespace/tab\ 23 | ,-readability/braces\ 24 | ,-whitespace/braces\ 25 | ,-whitespace/comments\ 26 | ,-whitespace/indent\ 27 | ,-whitespace/newline\ 28 | ,-whitespace/operators\ 29 | ,-whitespace/parens\ 30 | " 31 | -------------------------------------------------------------------------------- /lib/WiFiManager-2.0.17/examples/NonBlocking/AutoConnectNonBlocking/AutoConnectNonBlocking.ino: -------------------------------------------------------------------------------- 1 | #include // https://github.com/tzapu/WiFiManager 2 | WiFiManager wm; 3 | 4 | void setup() { 5 | WiFi.mode(WIFI_STA); // explicitly set mode, esp defaults to STA+AP 6 | // put your setup code here, to run once: 7 | Serial.begin(115200); 8 | 9 | //reset settings - wipe credentials for testing 10 | //wm.resetSettings(); 11 | 12 | wm.setConfigPortalBlocking(false); 13 | wm.setConfigPortalTimeout(60); 14 | //automatically connect using saved credentials if they exist 15 | //If connection fails it starts an access point with the specified name 16 | if(wm.autoConnect("AutoConnectAP")){ 17 | Serial.println("connected...yeey :)"); 18 | } 19 | else { 20 | Serial.println("Configportal running"); 21 | } 22 | } 23 | 24 | void loop() { 25 | wm.process(); 26 | // put your main code here, to run repeatedly: 27 | } 28 | -------------------------------------------------------------------------------- /src/state_manager.h: -------------------------------------------------------------------------------- 1 | #ifndef STATE_MANAGER_H 2 | #define STATE_MANAGER_H 3 | 4 | #include 5 | 6 | namespace StateManager 7 | { 8 | 9 | // Timestamp management 10 | uint64_t getTimestamp(); 11 | void setTimestamp(uint64_t ts); 12 | 13 | // WiFi failure tracking 14 | uint8_t getFailureCount(); 15 | void incrementFailureCount(); 16 | void resetFailureCount(); 17 | 18 | // Sleep duration management 19 | uint64_t getSleepDuration(); 20 | void setSleepDuration(uint64_t seconds); 21 | uint64_t calculateSleepDuration(); 22 | 23 | // Download/display refresh duration tracking 24 | void startDownloadTimer(); 25 | void endDownloadTimer(); 26 | void startRefreshTimer(); 27 | void endRefreshTimer(); 28 | unsigned long getTotalCompensation(); 29 | unsigned long getLastDownloadDuration(); 30 | unsigned long getLastRefreshDuration(); 31 | void setLastRefreshDuration(unsigned long duration); 32 | 33 | // Default sleep time 34 | static const uint64_t DEFAULT_SLEEP_SECONDS = 120; 35 | } // namespace StateManager 36 | 37 | #endif // STATE_MANAGER_H 38 | -------------------------------------------------------------------------------- /lib/WiFiManager-2.0.17/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map For WifiManager 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | WiFiManager KEYWORD1 10 | WiFiManagerParameter KEYWORD1 11 | 12 | 13 | ####################################### 14 | # Methods and Functions (KEYWORD2) 15 | ####################################### 16 | autoConnect KEYWORD2 17 | getSSID KEYWORD2 18 | getPassword KEYWORD2 19 | getConfigPortalSSID KEYWORD2 20 | resetSettings KEYWORD2 21 | setConfigPortalTimeout KEYWORD2 22 | setConnectTimeout KEYWORD2 23 | setDebugOutput KEYWORD2 24 | setMinimumSignalQuality KEYWORD2 25 | setAPStaticIPConfig KEYWORD2 26 | setSTAStaticIPConfig KEYWORD2 27 | setAPCallback KEYWORD2 28 | setSaveConfigCallback KEYWORD2 29 | addParameter KEYWORD2 30 | getID KEYWORD2 31 | getValue KEYWORD2 32 | getPlaceholder KEYWORD2 33 | getValueLength KEYWORD2 34 | 35 | ####################################### 36 | # Constants (LITERAL1) 37 | ####################################### 38 | 39 | # LITERAL1 40 | -------------------------------------------------------------------------------- /lib/WiFiManager-2.0.17/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 tzapu 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /lib/WiFiManager-2.0.17/.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## PLEASE TRY Latest Master BRANCH before submitting bugs, in case they were already fixed. ## 2 | 3 | Issues without basic info will be ignored or closed! 4 | 5 | Please fill the info fields, it helps to get you faster support ;) 6 | 7 | if you have a stack dump decode it: 8 | https://github.com/esp8266/Arduino/blob/master/doc/Troubleshooting/stack_dump.rst 9 | 10 | for better debug messages: 11 | https://github.com/esp8266/Arduino/blob/master/doc/Troubleshooting/debugging.rst 12 | 13 | ----------------------------- Remove above ----------------------------- 14 | 15 | ### Basic Infos 16 | 17 | #### Hardware 18 | WiFimanager Branch/Release: Master 19 | 20 | Esp8266/Esp32: 21 | 22 | Hardware: ESP-12e, esp01, esp25 23 | 24 | Core Version: 2.4.0, staging 25 | 26 | ### Description 27 | 28 | Problem description 29 | 30 | ### Settings in IDE 31 | 32 | Module: NodeMcu, Wemos D1 33 | 34 | Additional libraries: 35 | 36 | ### Sketch 37 | 38 | ```cpp 39 | #BEGIN 40 | #include 41 | 42 | void setup() { 43 | 44 | } 45 | 46 | void loop() { 47 | 48 | } 49 | #END 50 | ``` 51 | 52 | ### Debug Messages 53 | 54 | ``` 55 | messages here 56 | ``` 57 | 58 | -------------------------------------------------------------------------------- /lib/WiFiManager-2.0.17/examples/Tests/wifi_softap/wifi_softap.ino: -------------------------------------------------------------------------------- 1 | // wifi_basic.ino 2 | 3 | #include 4 | #include 5 | 6 | // #define NVSERASE 7 | #ifdef NVSERASE 8 | #include 9 | #include 10 | #endif 11 | 12 | void setup(){ 13 | Serial.begin(115200); 14 | delay(2000); 15 | Serial.println("Startup...."); 16 | 17 | #ifdef NVSERASE 18 | esp_err_t err; 19 | err = nvs_flash_init(); 20 | err = nvs_flash_erase(); 21 | #endif 22 | 23 | Serial.setDebugOutput(true); 24 | 25 | WiFi.begin("hellowifi","noonehere"); 26 | 27 | while (WiFi.status() != WL_CONNECTED && millis()<15000) { 28 | delay(500); 29 | Serial.print("."); 30 | } 31 | 32 | if(WiFi.status() == WL_CONNECTED){ 33 | Serial.println(""); 34 | Serial.println("WiFi connected."); 35 | Serial.println("IP address: "); 36 | // Serial.println(WiFi.localIP()); 37 | } 38 | else { 39 | Serial.println("WiFi NOT CONNECTED, starting ap"); 40 | /////////////// 41 | /// BUG 42 | // WiFi.enableSTA(false); // BREAKS softap start, says ok BUT no ap found 43 | 44 | delay(2000); 45 | WiFi.softAP("espsoftap","12345678"); 46 | } 47 | } 48 | 49 | void loop(){ 50 | 51 | } -------------------------------------------------------------------------------- /lib/WiFiManager-2.0.17/examples/NonBlocking/AutoConnectNonBlockingwParams/AutoConnectNonBlockingwParams.ino: -------------------------------------------------------------------------------- 1 | #include // https://github.com/tzapu/WiFiManager 2 | WiFiManager wm; 3 | WiFiManagerParameter custom_mqtt_server("server", "mqtt server", "", 40); 4 | 5 | void setup() { 6 | WiFi.mode(WIFI_STA); // explicitly set mode, esp defaults to STA+AP 7 | // put your setup code here, to run once: 8 | Serial.begin(115200); 9 | 10 | //reset settings - wipe credentials for testing 11 | //wm.resetSettings(); 12 | wm.addParameter(&custom_mqtt_server); 13 | wm.setConfigPortalBlocking(false); 14 | wm.setSaveParamsCallback(saveParamsCallback); 15 | 16 | //automatically connect using saved credentials if they exist 17 | //If connection fails it starts an access point with the specified name 18 | if(wm.autoConnect("AutoConnectAP")){ 19 | Serial.println("connected...yeey :)"); 20 | } 21 | else { 22 | Serial.println("Configportal running"); 23 | } 24 | } 25 | 26 | void loop() { 27 | wm.process(); 28 | // put your main code here, to run repeatedly: 29 | } 30 | 31 | void saveParamsCallback () { 32 | Serial.println("Get Params:"); 33 | Serial.print(custom_mqtt_server.getID()); 34 | Serial.print(" : "); 35 | Serial.println(custom_mqtt_server.getValue()); 36 | } 37 | -------------------------------------------------------------------------------- /lib/WiFiManager-2.0.17/examples/Old_examples/AutoConnectWithTimeout/AutoConnectWithTimeout.ino: -------------------------------------------------------------------------------- 1 | #include // https://github.com/tzapu/WiFiManager 2 | 3 | void setup() { 4 | // put your setup code here, to run once: 5 | Serial.begin(115200); 6 | 7 | //WiFiManager 8 | //Local intialization. Once its business is done, there is no need to keep it around 9 | WiFiManager wifiManager; 10 | //reset settings - for testing 11 | //wifiManager.resetSettings(); 12 | 13 | //sets timeout until configuration portal gets turned off 14 | //useful to make it all retry or go to sleep 15 | //in seconds 16 | wifiManager.setConfigPortalTimeout(180); 17 | 18 | //fetches ssid and pass and tries to connect 19 | //if it does not connect it starts an access point with the specified name 20 | //here "AutoConnectAP" 21 | //and goes into a blocking loop awaiting configuration 22 | if(!wifiManager.autoConnect("AutoConnectAP")) { 23 | Serial.println("failed to connect and hit timeout"); 24 | delay(3000); 25 | //reset and try again, or maybe put it to deep sleep 26 | ESP.restart(); 27 | delay(5000); 28 | } 29 | 30 | //if you get here you have connected to the WiFi 31 | Serial.println("connected...yeey :)"); 32 | 33 | } 34 | 35 | void loop() { 36 | // put your main code here, to run repeatedly: 37 | 38 | } 39 | -------------------------------------------------------------------------------- /lib/WiFiManager-2.0.17/examples/OnDemand/OnDemandWebPortal/onDemandWebPortal.ino: -------------------------------------------------------------------------------- 1 | /** 2 | * OnDemandWebPortal.ino 3 | * example of running the webportal (always NON blocking) 4 | */ 5 | #include // https://github.com/tzapu/WiFiManager 6 | 7 | // select which pin will trigger the configuration portal when set to LOW 8 | #define TRIGGER_PIN 0 9 | 10 | WiFiManager wm; 11 | 12 | bool portalRunning = false; 13 | 14 | void setup() { 15 | WiFi.mode(WIFI_STA); // explicitly set mode, esp defaults to STA+AP 16 | // put your setup code here, to run once 17 | Serial.begin(115200); 18 | Serial.println("\n Starting"); 19 | pinMode(TRIGGER_PIN, INPUT_PULLUP); 20 | } 21 | 22 | void loop() { 23 | checkButton(); 24 | // put your main code here, to run repeatedly: 25 | } 26 | 27 | void checkButton(){ 28 | // is auto timeout portal running 29 | if(portalRunning){ 30 | wm.process(); 31 | } 32 | 33 | // is configuration portal requested? 34 | if(digitalRead(TRIGGER_PIN) == LOW) { 35 | delay(50); 36 | if(digitalRead(TRIGGER_PIN) == LOW) { 37 | if(!portalRunning){ 38 | Serial.println("Button Pressed, Starting Portal"); 39 | wm.startWebPortal(); 40 | portalRunning = true; 41 | } 42 | else{ 43 | Serial.println("Button Pressed, Stopping Portal"); 44 | wm.stopWebPortal(); 45 | portalRunning = false; 46 | } 47 | } 48 | } 49 | } 50 | 51 | 52 | -------------------------------------------------------------------------------- /lib/WiFiManager-2.0.17/examples/Old_examples/AutoConnectWithReset/AutoConnectWithReset.ino: -------------------------------------------------------------------------------- 1 | #include // this needs to be first, or it all crashes and burns... 2 | #include // https://github.com/tzapu/WiFiManager 3 | 4 | void setup() { 5 | // put your setup code here, to run once: 6 | Serial.begin(115200); 7 | Serial.println(); 8 | 9 | //WiFiManager 10 | //Local intialization. Once its business is done, there is no need to keep it around 11 | WiFiManager wifiManager; 12 | 13 | //exit after config instead of connecting 14 | wifiManager.setBreakAfterConfig(true); 15 | 16 | //reset settings - for testing 17 | //wifiManager.resetSettings(); 18 | 19 | 20 | //tries to connect to last known settings 21 | //if it does not connect it starts an access point with the specified name 22 | //here "AutoConnectAP" with password "password" 23 | //and goes into a blocking loop awaiting configuration 24 | if (!wifiManager.autoConnect("AutoConnectAP", "password")) { 25 | Serial.println("failed to connect, we should reset as see if it connects"); 26 | delay(3000); 27 | ESP.restart(); 28 | delay(5000); 29 | } 30 | 31 | //if you get here you have connected to the WiFi 32 | Serial.println("connected...yeey :)"); 33 | 34 | 35 | Serial.println("local ip"); 36 | Serial.println(WiFi.localIP()); 37 | } 38 | 39 | void loop() { 40 | // put your main code here, to run repeatedly: 41 | 42 | 43 | } 44 | -------------------------------------------------------------------------------- /lib/QRCodeGenerator/examples/QRCode/QRCode.ino: -------------------------------------------------------------------------------- 1 | /** 2 | * QRCode 3 | * 4 | * A quick example of generating a QR code. 5 | * 6 | * This prints the QR code to the serial monitor as solid blocks. Each module 7 | * is two characters wide, since the monospace font used in the serial monitor 8 | * is approximately twice as tall as wide. 9 | * 10 | */ 11 | 12 | #include "qrcode.h" 13 | 14 | void setup() { 15 | Serial.begin(115200); 16 | 17 | // Start time 18 | uint32_t dt = millis(); 19 | 20 | // Create the QR code 21 | QRCode qrcode; 22 | uint8_t qrcodeData[qrcode_getBufferSize(3)]; 23 | qrcode_initText(&qrcode, qrcodeData, 3, 0, "HELLO WORLD"); 24 | 25 | // Delta time 26 | dt = millis() - dt; 27 | Serial.print("QR Code Generation Time: "); 28 | Serial.print(dt); 29 | Serial.print("\n"); 30 | 31 | // Top quiet zone 32 | Serial.print("\n\n\n\n"); 33 | 34 | for (uint8_t y = 0; y < qrcode.size; y++) { 35 | 36 | // Left quiet zone 37 | Serial.print(" "); 38 | 39 | // Each horizontal module 40 | for (uint8_t x = 0; x < qrcode.size; x++) { 41 | 42 | // Print each module (UTF-8 \u2588 is a solid block) 43 | Serial.print(qrcode_getModule(&qrcode, x, y) ? "\u2588\u2588": " "); 44 | 45 | } 46 | 47 | Serial.print("\n"); 48 | } 49 | 50 | // Bottom quiet zone 51 | Serial.print("\n\n\n\n"); 52 | } 53 | 54 | void loop() { 55 | 56 | } 57 | -------------------------------------------------------------------------------- /lib/WiFiManager-2.0.17/examples/Old_examples/AutoConnectWithFeedback/AutoConnectWithFeedback.ino: -------------------------------------------------------------------------------- 1 | #include // https://github.com/tzapu/WiFiManager 2 | 3 | void configModeCallback (WiFiManager *myWiFiManager) { 4 | Serial.println("Entered config mode"); 5 | Serial.println(WiFi.softAPIP()); 6 | //if you used auto generated SSID, print it 7 | Serial.println(myWiFiManager->getConfigPortalSSID()); 8 | } 9 | 10 | void setup() { 11 | // put your setup code here, to run once: 12 | Serial.begin(115200); 13 | 14 | //WiFiManager 15 | //Local intialization. Once its business is done, there is no need to keep it around 16 | WiFiManager wifiManager; 17 | //reset settings - for testing 18 | //wifiManager.resetSettings(); 19 | 20 | //set callback that gets called when connecting to previous WiFi fails, and enters Access Point mode 21 | wifiManager.setAPCallback(configModeCallback); 22 | 23 | //fetches ssid and pass and tries to connect 24 | //if it does not connect it starts an access point with the specified name 25 | //here "AutoConnectAP" 26 | //and goes into a blocking loop awaiting configuration 27 | if(!wifiManager.autoConnect()) { 28 | Serial.println("failed to connect and hit timeout"); 29 | //reset and try again, or maybe put it to deep sleep 30 | ESP.restart(); 31 | delay(1000); 32 | } 33 | 34 | //if you get here you have connected to the WiFi 35 | Serial.println("connected...yeey :)"); 36 | 37 | } 38 | 39 | void loop() { 40 | // put your main code here, to run repeatedly: 41 | 42 | } 43 | -------------------------------------------------------------------------------- /lib/WiFiManager-2.0.17/examples/OnDemand/OnDemandConfigPortal/OnDemandConfigPortal.ino: -------------------------------------------------------------------------------- 1 | /** 2 | * OnDemandConfigPortal.ino 3 | * example of running the configPortal AP manually, independantly from the captiveportal 4 | * trigger pin will start a configPortal AP for 120 seconds then turn it off. 5 | * 6 | */ 7 | #include // https://github.com/tzapu/WiFiManager 8 | 9 | // select which pin will trigger the configuration portal when set to LOW 10 | #define TRIGGER_PIN 0 11 | 12 | int timeout = 120; // seconds to run for 13 | 14 | void setup() { 15 | WiFi.mode(WIFI_STA); // explicitly set mode, esp defaults to STA+AP 16 | // put your setup code here, to run once: 17 | Serial.begin(115200); 18 | Serial.println("\n Starting"); 19 | pinMode(TRIGGER_PIN, INPUT_PULLUP); 20 | } 21 | 22 | void loop() { 23 | // is configuration portal requested? 24 | if ( digitalRead(TRIGGER_PIN) == LOW) { 25 | WiFiManager wm; 26 | 27 | //reset settings - for testing 28 | //wm.resetSettings(); 29 | 30 | // set configportal timeout 31 | wm.setConfigPortalTimeout(timeout); 32 | 33 | if (!wm.startConfigPortal("OnDemandAP")) { 34 | Serial.println("failed to connect and hit timeout"); 35 | delay(3000); 36 | //reset and try again, or maybe put it to deep sleep 37 | ESP.restart(); 38 | delay(5000); 39 | } 40 | 41 | //if you get here you have connected to the WiFi 42 | Serial.println("connected...yeey :)"); 43 | 44 | } 45 | 46 | // put your main code here, to run repeatedly: 47 | } 48 | -------------------------------------------------------------------------------- /lib/WiFiManager-2.0.17/.github/workflows/compile_library.yml: -------------------------------------------------------------------------------- 1 | name: Compile Library 2 | 3 | on: 4 | push: 5 | paths-ignore: 6 | - '.github/workflows/cpp_lint.yml' 7 | - '.github/workflows/compile_examples.yml' 8 | - 'examples/**' 9 | pull_request: 10 | paths-ignore: 11 | - '.github/workflows/cpp_lint.yml' 12 | - '.github/workflows/compile_examples.yml' 13 | - 'examples/**' 14 | 15 | jobs: 16 | build: 17 | 18 | runs-on: ubuntu-latest 19 | strategy: 20 | fail-fast: false 21 | matrix: 22 | board: 23 | - "nodemcuv2" 24 | - "lolin32" 25 | 26 | steps: 27 | - uses: actions/checkout@v2 28 | - name: Cache pip 29 | uses: actions/cache@v2 30 | with: 31 | path: ~/.cache/pip 32 | key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} 33 | restore-keys: ${{ runner.os }}-pip- 34 | - name: Cache PlatformIO 35 | uses: actions/cache@v2 36 | with: 37 | path: ~/.platformio 38 | key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} 39 | - name: Set up Python 40 | uses: actions/setup-python@v2 41 | - name: Install PlatformIO 42 | run: | 43 | python -m pip install --upgrade pip 44 | pip install --upgrade platformio 45 | 46 | - name: Create main file 47 | run: | 48 | echo "#include " >> main.ino 49 | echo "void setup() {}" >> main.ino 50 | echo "void loop() {}" >> main.ino 51 | 52 | - name: Run PlatformIO 53 | run: pio ci --board=${{ matrix.board }} . 54 | -------------------------------------------------------------------------------- /lib/WiFiManager-2.0.17/examples/Basic/Basic.ino: -------------------------------------------------------------------------------- 1 | #include // https://github.com/tzapu/WiFiManager 2 | 3 | 4 | void setup() { 5 | // WiFi.mode(WIFI_STA); // explicitly set mode, esp defaults to STA+AP 6 | // it is a good practice to make sure your code sets wifi mode how you want it. 7 | 8 | // put your setup code here, to run once: 9 | Serial.begin(115200); 10 | 11 | //WiFiManager, Local intialization. Once its business is done, there is no need to keep it around 12 | WiFiManager wm; 13 | 14 | // reset settings - wipe stored credentials for testing 15 | // these are stored by the esp library 16 | // wm.resetSettings(); 17 | 18 | // Automatically connect using saved credentials, 19 | // if connection fails, it starts an access point with the specified name ( "AutoConnectAP"), 20 | // if empty will auto generate SSID, if password is blank it will be anonymous AP (wm.autoConnect()) 21 | // then goes into a blocking loop awaiting configuration and will return success result 22 | 23 | bool res; 24 | // res = wm.autoConnect(); // auto generated AP name from chipid 25 | // res = wm.autoConnect("AutoConnectAP"); // anonymous ap 26 | res = wm.autoConnect("AutoConnectAP","password"); // password protected ap 27 | 28 | if(!res) { 29 | Serial.println("Failed to connect"); 30 | // ESP.restart(); 31 | } 32 | else { 33 | //if you get here you have connected to the WiFi 34 | Serial.println("connected...yeey :)"); 35 | } 36 | 37 | } 38 | 39 | void loop() { 40 | // put your main code here, to run repeatedly: 41 | } 42 | -------------------------------------------------------------------------------- /.github/workflows/PIO_build.yml: -------------------------------------------------------------------------------- 1 | name: Zivy obraz CI 2 | 3 | on: [push] 4 | 5 | jobs: 6 | clang-format-check: 7 | name: Check C++ code formatting 8 | runs-on: ubuntu-latest 9 | if: github.ref != 'refs/heads/main' 10 | 11 | steps: 12 | - uses: actions/checkout@v3 13 | 14 | - name: Install clang-format 15 | run: | 16 | sudo apt-get update 17 | sudo apt-get install -y clang-format 18 | 19 | - name: Check formatting 20 | run: | 21 | echo "Checking C++ code formatting..." 22 | FORMAT_ISSUES=0 23 | while read -r file; do 24 | if ! clang-format "$file" | diff -u --label "$file (current)" --label "$file (formatted)" "$file" - ; then 25 | FORMAT_ISSUES=1 26 | fi 27 | done < <(find src -name '*.cpp' -o -name '*.h' -not -path 'src/fonts/*') 28 | 29 | if [ "$FORMAT_ISSUES" = "1" ]; then 30 | echo "Formatting issues found!" 31 | exit 1 32 | fi 33 | echo "All files are properly formatted!" 34 | 35 | build-project: 36 | name: Compile firmware binaries 37 | runs-on: ubuntu-latest 38 | 39 | steps: 40 | - uses: actions/checkout@v3 41 | - uses: actions/cache@v3 42 | with: 43 | path: | 44 | ~/.cache/pip 45 | ~/.platformio/.cache 46 | key: ${{ runner.os }}-pio 47 | - uses: actions/setup-python@v4 48 | with: 49 | python-version: '3.9' 50 | - name: Install PlatformIO Core 51 | run: pip install --upgrade platformio 52 | 53 | - name: Compile firmware binaries 54 | run: pio run 55 | -------------------------------------------------------------------------------- /lib/WiFiManager-2.0.17/.travis.yml: -------------------------------------------------------------------------------- 1 | language: c 2 | sudo: false 3 | 4 | before_install: 5 | - "/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_1.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :1 -ac -screen 0 1280x1024x16" 6 | - sleep 3 7 | - export DISPLAY=:1.0 8 | - wget http://downloads.arduino.cc/arduino-1.8.10-linux64.tar.xz 9 | - tar xf arduino-1.8.10-linux64.tar.xz 10 | - sudo mv arduino-1.8.10 /usr/local/share/arduino 11 | - sudo ln -s /usr/local/share/arduino/arduino /usr/local/bin/arduino 12 | 13 | install: 14 | - ln -s $PWD /usr/local/share/arduino/libraries/WiFiManager 15 | - arduino --pref "boardsmanager.additional.urls=http://arduino.esp8266.com/stable/package_esp8266com_index.json,http://dl.espressif.com/dl/package_esp32_index.json" --save-prefs 16 | - arduino --install-library "ArduinoJson:6.18.0" 17 | - arduino --install-boards esp8266:esp8266 18 | - arduino --pref "compiler.warning_level=all" --save-prefs 19 | # install esp32 20 | - arduino --install-boards esp32:esp32 21 | 22 | script: 23 | - "echo $PWD" 24 | - "echo $HOME" 25 | - "ls $PWD" 26 | - source $TRAVIS_BUILD_DIR/travis/common.sh 27 | - arduino --board esp8266:esp8266:generic:xtal=80,eesz=4M1M,FlashMode=qio,FlashFreq=80,dbg=Serial,lvl=CORE --save-prefs 28 | - build_examples 29 | - arduino --board esp32:esp32:esp32:FlashFreq=80,FlashSize=4M,DebugLevel=info --save-prefs 30 | # some examples fail (SPIFFS defines differ esp32 vs esp8266) so we exclude them 31 | - build_examples 32 | # - arduino -v --verbose-build --verify $PWD/examples/AutoConnect/AutoConnect.ino 33 | 34 | # no coverage generated, no need to run 35 | # 36 | #after_success: 37 | # - bash <(curl -s https://codecov.io/bash) 38 | 39 | notifications: 40 | email: 41 | on_success: change 42 | on_failure: change 43 | -------------------------------------------------------------------------------- /src/utils.cpp: -------------------------------------------------------------------------------- 1 | #include "utils.h" 2 | 3 | #include "logger.h" 4 | 5 | #include 6 | #include 7 | 8 | // RTC persistent data for PIN cache (survives deep sleep) 9 | RTC_DATA_ATTR uint32_t rtc_cachedPIN = 0; 10 | 11 | // NVS storage for PIN (survives power cycles) 12 | static Preferences prefs; 13 | 14 | namespace Utils 15 | { 16 | 17 | size_t getTotalHeap() { return ESP.getHeapSize(); } 18 | 19 | size_t getFreeHeap() { return ESP.getFreeHeap(); } 20 | 21 | size_t getLargestFreeBlock() { return ESP.getMaxAllocHeap(); } 22 | 23 | void printMemoryStats() 24 | { 25 | Logger::log(" Total Heap: {} bytes\n" 26 | " Free Heap: {} bytes\n" 27 | " Largest Block: {} bytes\n" 28 | " Usage: {:.1f}%\n", 29 | getTotalHeap(), getFreeHeap(), getLargestFreeBlock(), 30 | 100.0 * (1.0 - (float)getFreeHeap() / (float)getTotalHeap())); 31 | } 32 | 33 | void initializeAPIKey() 34 | { 35 | prefs.begin("zivyobraz"); 36 | 37 | if (!prefs.isKey("apikey")) 38 | { 39 | // Generate 8-digit PIN without leading zeros (range: 10000000 - 99999999) 40 | rtc_cachedPIN = (esp_random() % 90000000) + 10000000; 41 | prefs.putULong("apikey", rtc_cachedPIN); 42 | Logger::log("Generated new device API key: {}\n", rtc_cachedPIN); 43 | } 44 | else 45 | { 46 | rtc_cachedPIN = prefs.getULong("apikey"); 47 | Logger::log("Loaded stored device API key: {}\n", rtc_cachedPIN); 48 | } 49 | 50 | prefs.end(); 51 | } 52 | 53 | uint32_t getStoredAPIKey() 54 | { 55 | if (rtc_cachedPIN == 0) 56 | { 57 | prefs.begin("zivyobraz", true); // read-only 58 | rtc_cachedPIN = prefs.getULong("apikey", 0); 59 | prefs.end(); 60 | } 61 | return rtc_cachedPIN; 62 | } 63 | 64 | } // namespace Utils 65 | -------------------------------------------------------------------------------- /lib/WiFiManager-2.0.17/extras/parse.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const fs = require('fs'); 4 | 5 | console.log('starting'); 6 | 7 | const inFile = 'WiFiManager.template.html'; 8 | const outFile = 'template.h'; 9 | 10 | const defineRegEx = //gm; 11 | console.log('parsing', inFile); 12 | 13 | fs.readFile(inFile, 'utf8', function (err,data) { 14 | if (err) { 15 | return console.log(err); 16 | } 17 | //console.log(data); 18 | 19 | let defines = data.match(defineRegEx); 20 | 21 | //console.log(defines); 22 | var stream = fs.createWriteStream(outFile); 23 | stream.once('open', function(fd) { 24 | for (const i in defines) { 25 | 26 | const start = defines[i]; 27 | const end = start.replace(' 139 |
140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 |
155 |
156 | 157 |
158 | 159 |
160 |
161 | 162 |
163 | 164 |
165 | 166 |
167 |
168 | 169 |
170 | 171 |
172 | 173 |
174 |
175 | 176 |
177 |
178 | 179 |
180 | 181 | 182 | 183 | -------------------------------------------------------------------------------- /lib/GxEPD2_4G/src/epd/GxEPD2_420.h: -------------------------------------------------------------------------------- 1 | // Display Library for SPI e-paper panels from Dalian Good Display and boards from Waveshare. 2 | // Requires HW SPI and Adafruit_GFX. Caution: these e-papers require 3.3V supply AND data lines! 3 | // 4 | // based on Demo Example from Good Display: http://www.e-paper-display.com/download_list/downloadcategoryid=34&isMode=false.html 5 | // Controller: IL0398 : http://www.e-paper-display.com/download_detail/downloadsId=537.html 6 | // 7 | // Author: Jean-Marc Zingg 8 | // 9 | // Version: see library.properties 10 | // 11 | // Library: https://github.com/ZinggJM/GxEPD2 12 | 13 | #ifndef _GxEPD2_420_H_ 14 | #define _GxEPD2_420_H_ 15 | 16 | #include "../GxEPD2_4G_EPD.h" 17 | 18 | class GxEPD2_420 : public GxEPD2_4G_EPD 19 | { 20 | public: 21 | // attributes 22 | static const uint16_t WIDTH = 400; 23 | static const uint16_t HEIGHT = 300; 24 | static const GxEPD2_4G::Panel panel = GxEPD2_4G::GDEW042T2; 25 | static const bool hasColor = false; 26 | static const bool hasPartialUpdate = true; 27 | static const bool usePartialUpdateWindow = false; // set false for better image 28 | static const bool hasFastPartialUpdate = true; 29 | static const uint16_t power_on_time = 40; // ms, e.g. 36996us 30 | static const uint16_t power_off_time = 20; // ms, e.g. 19285us 31 | static const uint16_t full_refresh_time = 1600; // ms, e.g. 1545659us 32 | static const uint16_t partial_refresh_time = 600; // ms, e.g. 563754us 33 | // constructor 34 | GxEPD2_420(int16_t cs, int16_t dc, int16_t rst, int16_t busy); 35 | // methods (virtual) 36 | // Support for Bitmaps (Sprites) to Controller Buffer and to Screen 37 | void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white) 38 | void writeScreenBuffer(uint8_t value = 0xFF); // init controller memory (default white) 39 | // write to controller memory, without screen refresh; x and w should be multiple of 8 40 | void writeImage(const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 41 | void writeImage_4G(const uint8_t bitmap[], uint8_t bpp, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 42 | void writeImagePart(const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, 43 | int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 44 | void writeImagePart_4G(const uint8_t bitmap[], uint8_t bpp, int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, 45 | int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 46 | void writeImage(const uint8_t* black, const uint8_t* color, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 47 | void writeImagePart(const uint8_t* black, const uint8_t* color, int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, 48 | int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 49 | // write sprite of native data to controller memory, without screen refresh; x and w should be multiple of 8 50 | void writeNative(const uint8_t* data1, const uint8_t* data2, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 51 | // write to controller memory, with screen refresh; x and w should be multiple of 8 52 | void drawImage(const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 53 | void drawImage_4G(const uint8_t bitmap[], uint8_t bpp, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 54 | void drawImagePart(const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, 55 | int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 56 | void drawImagePart_4G(const uint8_t bitmap[], uint8_t bpp, int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, 57 | int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 58 | void drawImage(const uint8_t* black, const uint8_t* color, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 59 | void drawImagePart(const uint8_t* black, const uint8_t* color, int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, 60 | int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 61 | // write sprite of native data to controller memory, with screen refresh; x and w should be multiple of 8 62 | void drawNative(const uint8_t* data1, const uint8_t* data2, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 63 | void refresh(bool partial_update_mode = false); // screen refresh from controller memory to full screen 64 | void refresh(int16_t x, int16_t y, int16_t w, int16_t h); // screen refresh from controller memory, partial screen 65 | void powerOff(); // turns off generation of panel driving voltages, avoids screen fading over time 66 | void hibernate(); // turns powerOff() and sets controller to deep sleep for minimum power use, ONLY if wakeable by RST (rst >= 0) 67 | private: 68 | void _setPartialRamArea(uint16_t x, uint16_t y, uint16_t w, uint16_t h); 69 | void _PowerOn(); 70 | void _PowerOff(); 71 | void _InitDisplay(); 72 | void _Force_Init_Full(); 73 | void _Init_Full(); 74 | void _Init_4G(); 75 | void _Init_Part(); 76 | void _Update_Full(); 77 | void _Update_4G(); 78 | void _Update_Part(); 79 | private: 80 | enum {full_refresh, grey_refresh, fast_refresh, forced_full_refresh} _refresh_mode; 81 | static const unsigned char lut_20_vcom0_full[]; 82 | static const unsigned char lut_21_ww_full[]; 83 | static const unsigned char lut_22_bw_full[]; 84 | static const unsigned char lut_23_wb_full[]; 85 | static const unsigned char lut_24_bb_full[]; 86 | static const unsigned char lut_20_vcom0_4G[]; 87 | static const unsigned char lut_21_ww_4G[]; 88 | static const unsigned char lut_22_bw_4G[]; 89 | static const unsigned char lut_23_wb_4G[]; 90 | static const unsigned char lut_24_bb_4G[]; 91 | static const unsigned char lut_20_vcom0_partial[]; 92 | static const unsigned char lut_21_ww_partial[]; 93 | static const unsigned char lut_22_bw_partial[]; 94 | static const unsigned char lut_23_wb_partial[]; 95 | static const unsigned char lut_24_bb_partial[]; 96 | }; 97 | 98 | #endif 99 | -------------------------------------------------------------------------------- /lib/WiFiManager-2.0.17/examples/Parameters/SPIFFS/AutoConnectWithFSParametersAndCustomIP/AutoConnectWithFSParametersAndCustomIP.ino: -------------------------------------------------------------------------------- 1 | #include //this needs to be first, or it all crashes and burns... 2 | 3 | #include //https://github.com/tzapu/WiFiManager 4 | 5 | #ifdef ESP32 6 | #include 7 | #endif 8 | 9 | #include //https://github.com/bblanchon/ArduinoJson 10 | 11 | //define your default values here, if there are different values in config.json, they are overwritten. 12 | //length should be max size + 1 13 | char mqtt_server[40]; 14 | char mqtt_port[6] = "8080"; 15 | char api_token[34] = "YOUR_APITOKEN"; 16 | //default custom static IP 17 | char static_ip[16] = "10.0.1.56"; 18 | char static_gw[16] = "10.0.1.1"; 19 | char static_sn[16] = "255.255.255.0"; 20 | 21 | //flag for saving data 22 | bool shouldSaveConfig = false; 23 | 24 | //callback notifying us of the need to save config 25 | void saveConfigCallback () { 26 | Serial.println("Should save config"); 27 | shouldSaveConfig = true; 28 | } 29 | 30 | void setup() { 31 | // put your setup code here, to run once: 32 | Serial.begin(115200); 33 | Serial.println(); 34 | 35 | //clean FS, for testing 36 | //SPIFFS.format(); 37 | 38 | //read configuration from FS json 39 | Serial.println("mounting FS..."); 40 | 41 | if (SPIFFS.begin()) { 42 | Serial.println("mounted file system"); 43 | if (SPIFFS.exists("/config.json")) { 44 | //file exists, reading and loading 45 | Serial.println("reading config file"); 46 | File configFile = SPIFFS.open("/config.json", "r"); 47 | if (configFile) { 48 | Serial.println("opened config file"); 49 | size_t size = configFile.size(); 50 | // Allocate a buffer to store contents of the file. 51 | std::unique_ptr buf(new char[size]); 52 | 53 | configFile.readBytes(buf.get(), size); 54 | #if defined(ARDUINOJSON_VERSION_MAJOR) && ARDUINOJSON_VERSION_MAJOR >= 6 55 | DynamicJsonDocument json(1024); 56 | auto deserializeError = deserializeJson(json, buf.get()); 57 | serializeJson(json, Serial); 58 | if ( ! deserializeError ) { 59 | #else 60 | DynamicJsonBuffer jsonBuffer; 61 | JsonObject& json = jsonBuffer.parseObject(buf.get()); 62 | json.printTo(Serial); 63 | if (json.success()) { 64 | #endif 65 | Serial.println("\nparsed json"); 66 | 67 | strcpy(mqtt_server, json["mqtt_server"]); 68 | strcpy(mqtt_port, json["mqtt_port"]); 69 | strcpy(api_token, json["api_token"]); 70 | 71 | if (json["ip"]) { 72 | Serial.println("setting custom ip from config"); 73 | strcpy(static_ip, json["ip"]); 74 | strcpy(static_gw, json["gateway"]); 75 | strcpy(static_sn, json["subnet"]); 76 | Serial.println(static_ip); 77 | } else { 78 | Serial.println("no custom ip in config"); 79 | } 80 | } else { 81 | Serial.println("failed to load json config"); 82 | } 83 | } 84 | } 85 | } else { 86 | Serial.println("failed to mount FS"); 87 | } 88 | //end read 89 | Serial.println(static_ip); 90 | Serial.println(api_token); 91 | Serial.println(mqtt_server); 92 | 93 | 94 | // The extra parameters to be configured (can be either global or just in the setup) 95 | // After connecting, parameter.getValue() will get you the configured value 96 | // id/name placeholder/prompt default length 97 | WiFiManagerParameter custom_mqtt_server("server", "mqtt server", mqtt_server, 40); 98 | WiFiManagerParameter custom_mqtt_port("port", "mqtt port", mqtt_port, 5); 99 | WiFiManagerParameter custom_api_token("apikey", "API token", api_token, 34); 100 | 101 | //WiFiManager 102 | //Local intialization. Once its business is done, there is no need to keep it around 103 | WiFiManager wifiManager; 104 | 105 | //set config save notify callback 106 | wifiManager.setSaveConfigCallback(saveConfigCallback); 107 | 108 | //set static ip 109 | IPAddress _ip, _gw, _sn; 110 | _ip.fromString(static_ip); 111 | _gw.fromString(static_gw); 112 | _sn.fromString(static_sn); 113 | 114 | wifiManager.setSTAStaticIPConfig(_ip, _gw, _sn); 115 | 116 | //add all your parameters here 117 | wifiManager.addParameter(&custom_mqtt_server); 118 | wifiManager.addParameter(&custom_mqtt_port); 119 | wifiManager.addParameter(&custom_api_token); 120 | 121 | //reset settings - for testing 122 | //wifiManager.resetSettings(); 123 | 124 | //set minimu quality of signal so it ignores AP's under that quality 125 | //defaults to 8% 126 | wifiManager.setMinimumSignalQuality(); 127 | 128 | //sets timeout until configuration portal gets turned off 129 | //useful to make it all retry or go to sleep 130 | //in seconds 131 | //wifiManager.setTimeout(120); 132 | 133 | //fetches ssid and pass and tries to connect 134 | //if it does not connect it starts an access point with the specified name 135 | //here "AutoConnectAP" 136 | //and goes into a blocking loop awaiting configuration 137 | if (!wifiManager.autoConnect("AutoConnectAP", "password")) { 138 | Serial.println("failed to connect and hit timeout"); 139 | delay(3000); 140 | //reset and try again, or maybe put it to deep sleep 141 | ESP.restart(); 142 | delay(5000); 143 | } 144 | 145 | //if you get here you have connected to the WiFi 146 | Serial.println("connected...yeey :)"); 147 | 148 | //read updated parameters 149 | strcpy(mqtt_server, custom_mqtt_server.getValue()); 150 | strcpy(mqtt_port, custom_mqtt_port.getValue()); 151 | strcpy(api_token, custom_api_token.getValue()); 152 | 153 | //save the custom parameters to FS 154 | if (shouldSaveConfig) { 155 | Serial.println("saving config"); 156 | #if defined(ARDUINOJSON_VERSION_MAJOR) && ARDUINOJSON_VERSION_MAJOR >= 6 157 | DynamicJsonDocument json(1024); 158 | #else 159 | DynamicJsonBuffer jsonBuffer; 160 | JsonObject& json = jsonBuffer.createObject(); 161 | #endif 162 | json["mqtt_server"] = mqtt_server; 163 | json["mqtt_port"] = mqtt_port; 164 | json["api_token"] = api_token; 165 | 166 | json["ip"] = WiFi.localIP().toString(); 167 | json["gateway"] = WiFi.gatewayIP().toString(); 168 | json["subnet"] = WiFi.subnetMask().toString(); 169 | 170 | File configFile = SPIFFS.open("/config.json", "w"); 171 | if (!configFile) { 172 | Serial.println("failed to open config file for writing"); 173 | } 174 | 175 | #if defined(ARDUINOJSON_VERSION_MAJOR) && ARDUINOJSON_VERSION_MAJOR >= 6 176 | serializeJson(json, Serial); 177 | serializeJson(json, configFile); 178 | #else 179 | json.printTo(Serial); 180 | json.printTo(configFile); 181 | #endif 182 | configFile.close(); 183 | //end save 184 | } 185 | 186 | Serial.println("local ip"); 187 | Serial.println(WiFi.localIP()); 188 | Serial.println(WiFi.gatewayIP()); 189 | Serial.println(WiFi.subnetMask()); 190 | } 191 | 192 | void loop() { 193 | // put your main code here, to run repeatedly: 194 | } 195 | -------------------------------------------------------------------------------- /lib/GxEPD2_4G/src/epd/GxEPD2_750_T7.h: -------------------------------------------------------------------------------- 1 | // Display Library for SPI e-paper panels from Dalian Good Display and boards from Waveshare. 2 | // Requires HW SPI and Adafruit_GFX. Caution: the e-paper panels require 3.3V supply AND data lines! 3 | // 4 | // based on Demo Example from Good Display: 5 | // Panel: GDEW075T7 : http://www.e-paper-display.com/products_detail/productId=456.html 6 | // Controller: GD7965 : http://www.e-paper-display.com/download_detail/downloadsId=821.html 7 | // 8 | // Author: Jean-Marc Zingg 9 | // 10 | // Version: see library.properties 11 | // 12 | // Library: https://github.com/ZinggJM/GxEPD2 13 | 14 | #ifndef _GxEPD2_750_T7_H_ 15 | #define _GxEPD2_750_T7_H_ 16 | 17 | #include "../GxEPD2_4G_EPD.h" 18 | 19 | class GxEPD2_750_T7 : public GxEPD2_4G_EPD 20 | { 21 | public: 22 | // attributes 23 | static const uint16_t WIDTH = 800; 24 | static const uint16_t HEIGHT = 480; 25 | static const GxEPD2_4G::Panel panel = GxEPD2_4G::GDEW075T7; 26 | static const bool hasColor = false; 27 | static const bool hasPartialUpdate = true; 28 | static const bool usePartialUpdateWindow = false; // set false for better image 29 | static const bool hasFastPartialUpdate = true; // set this false to force full refresh always 30 | static const uint16_t power_on_time = 140; // ms, e.g. 134460us 31 | static const uint16_t power_off_time = 42; // ms, e.g. 40033us 32 | static const uint16_t full_refresh_time = 4200; // ms, e.g. 4108238us 33 | static const uint16_t partial_refresh_time = 1600; // ms, e.g. 1584124us 34 | // constructor 35 | GxEPD2_750_T7(int16_t cs, int16_t dc, int16_t rst, int16_t busy); 36 | // methods (virtual) 37 | // Support for Bitmaps (Sprites) to Controller Buffer and to Screen 38 | void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white) 39 | void writeScreenBuffer(uint8_t value = 0xFF); // init controller memory (default white) 40 | // write to controller memory, without screen refresh; x and w should be multiple of 8 41 | void writeImage(const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 42 | void writeImagePart(const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, 43 | int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 44 | void writeImage(const uint8_t* black, const uint8_t* color, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 45 | void writeImage_4G(const uint8_t bitmap[], uint8_t bpp, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 46 | void writeImagePart(const uint8_t* black, const uint8_t* color, int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, 47 | int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 48 | void writeImagePart_4G(const uint8_t bitmap[], uint8_t bpp, int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, 49 | int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 50 | // for differential update: set current and previous buffers equal (for fast partial update to work correctly) 51 | // done by controller (N2OCP); override with empty code 52 | void writeImageAgain(const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false) {}; 53 | void writeImagePartAgain(const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, 54 | int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false) {}; 55 | // write sprite of native data to controller memory, without screen refresh; x and w should be multiple of 8 56 | void writeNative(const uint8_t* data1, const uint8_t* data2, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 57 | // write to controller memory, with screen refresh; x and w should be multiple of 8 58 | void drawImage(const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 59 | void drawImage_4G(const uint8_t bitmap[], uint8_t bpp, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 60 | void drawImagePart(const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, 61 | int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 62 | void drawImagePart_4G(const uint8_t bitmap[], uint8_t bpp, int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, 63 | int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 64 | void drawImage(const uint8_t* black, const uint8_t* color, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 65 | void drawImagePart(const uint8_t* black, const uint8_t* color, int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, 66 | int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 67 | // write sprite of native data to controller memory, with screen refresh; x and w should be multiple of 8 68 | void drawNative(const uint8_t* data1, const uint8_t* data2, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 69 | void refresh(bool partial_update_mode = false); // screen refresh from controller memory to full screen 70 | void refresh(int16_t x, int16_t y, int16_t w, int16_t h); // screen refresh from controller memory, partial screen 71 | void powerOff(); // turns off generation of panel driving voltages, avoids screen fading over time 72 | void hibernate(); // turns powerOff() and sets controller to deep sleep for minimum power use, ONLY if wakeable by RST (rst >= 0) 73 | private: 74 | void _setPartialRamArea(uint16_t x, uint16_t y, uint16_t w, uint16_t h); 75 | void _PowerOn(); 76 | void _PowerOff(); 77 | void _InitDisplay(); 78 | void _Force_Init_Full(); 79 | void _Init_Full(); 80 | void _Init_4G(); 81 | void _Init_Part(); 82 | void _Update_Full(); 83 | void _Update_4G(); 84 | void _Update_Part(); 85 | private: 86 | enum {full_refresh, grey_refresh, fast_refresh, forced_full_refresh} _refresh_mode; 87 | static const unsigned char lut_20_vcom0_4G[]; 88 | static const unsigned char lut_21_ww_4G[]; 89 | static const unsigned char lut_22_bw_4G[]; 90 | static const unsigned char lut_23_wb_4G[]; 91 | static const unsigned char lut_24_bb_4G[]; 92 | static const unsigned char lut_20_LUTC_partial[]; 93 | static const unsigned char lut_21_LUTWW_partial[]; 94 | static const unsigned char lut_22_LUTKW_partial[]; 95 | static const unsigned char lut_23_LUTWK_partial[]; 96 | static const unsigned char lut_24_LUTKK_partial[]; 97 | static const unsigned char lut_25_LUTBD_partial[]; 98 | }; 99 | 100 | #endif 101 | -------------------------------------------------------------------------------- /lib/GxEPD2_4G/src/epd/GxEPD2_371.h: -------------------------------------------------------------------------------- 1 | // Display Library for SPI e-paper panels from Dalian Good Display and boards from Waveshare. 2 | // Requires HW SPI and Adafruit_GFX. Caution: the e-paper panels require 3.3V supply AND data lines! 3 | // 4 | // based on Demo Example from Good Display: http://www.e-paper-display.com/download_detail/downloadsId=639.html 5 | // Panel: GDEW0371W7 : http://www.e-paper-display.com/products_detail/productId=401.html 6 | // Controller: IL0324 : http://www.e-paper-display.com/download_detail/downloadsId=763.html 7 | // 8 | // Author: Jean-Marc Zingg 9 | // 10 | // Version: see library.properties 11 | // 12 | // Library: https://github.com/ZinggJM/GxEPD2 13 | 14 | #ifndef _GxEPD2_371_H_ 15 | #define _GxEPD2_371_H_ 16 | 17 | #include "../GxEPD2_4G_EPD.h" 18 | 19 | class GxEPD2_371 : public GxEPD2_4G_EPD 20 | { 21 | public: 22 | // attributes 23 | static const uint16_t WIDTH = 240; 24 | static const uint16_t HEIGHT = 416; 25 | static const GxEPD2_4G::Panel panel = GxEPD2_4G::GDEW0371W7; 26 | static const bool hasColor = false; 27 | static const bool hasPartialUpdate = true; 28 | static const bool usePartialUpdateWindow = false; // set false for better image 29 | static const bool hasFastPartialUpdate = true; // set this false to force full refresh always 30 | static const uint16_t power_on_time = 200; // ms, e.g. 126267us 31 | static const uint16_t power_off_time = 50; // ms, e.g. 39563us 32 | static const uint16_t full_refresh_time = 3000; // ms, e.g. 2953630us 33 | static const uint16_t partial_refresh_time = 1500; // ms, e.g. 1482735us 34 | // constructor 35 | GxEPD2_371(int16_t cs, int16_t dc, int16_t rst, int16_t busy); 36 | // methods (virtual) 37 | // Support for Bitmaps (Sprites) to Controller Buffer and to Screen 38 | void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white) 39 | void writeScreenBuffer(uint8_t value = 0xFF); // init controller memory (default white) 40 | // write to controller memory, without screen refresh; x and w should be multiple of 8 41 | void writeImage(const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 42 | void writeImagePart(const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, 43 | int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 44 | void writeImage(const uint8_t* black, const uint8_t* color, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 45 | void writeImage_4G(const uint8_t bitmap[], uint8_t bpp, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 46 | void writeImagePart(const uint8_t* black, const uint8_t* color, int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, 47 | int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 48 | void writeImagePart_4G(const uint8_t bitmap[], uint8_t bpp, int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, 49 | int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 50 | // for differential update: set current and previous buffers equal (for fast partial update to work correctly) 51 | // done by controller (N2OCP); override with empty code 52 | void writeImageAgain(const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false) {}; 53 | void writeImagePartAgain(const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, 54 | int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false) {}; 55 | // write sprite of native data to controller memory, without screen refresh; x and w should be multiple of 8 56 | void writeNative(const uint8_t* data1, const uint8_t* data2, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 57 | // write to controller memory, with screen refresh; x and w should be multiple of 8 58 | void drawImage(const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 59 | void drawImage_4G(const uint8_t bitmap[], uint8_t bpp, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 60 | void drawImagePart(const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, 61 | int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 62 | void drawImagePart_4G(const uint8_t bitmap[], uint8_t bpp, int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, 63 | int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 64 | void drawImage(const uint8_t* black, const uint8_t* color, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 65 | void drawImagePart(const uint8_t* black, const uint8_t* color, int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, 66 | int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 67 | // write sprite of native data to controller memory, with screen refresh; x and w should be multiple of 8 68 | void drawNative(const uint8_t* data1, const uint8_t* data2, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 69 | void refresh(bool partial_update_mode = false); // screen refresh from controller memory to full screen 70 | void refresh(int16_t x, int16_t y, int16_t w, int16_t h); // screen refresh from controller memory, partial screen 71 | void powerOff(); // turns off generation of panel driving voltages, avoids screen fading over time 72 | void hibernate(); // turns powerOff() and sets controller to deep sleep for minimum power use, ONLY if wakeable by RST (rst >= 0) 73 | private: 74 | void _setPartialRamArea(uint16_t x, uint16_t y, uint16_t w, uint16_t h); 75 | void _PowerOn(); 76 | void _PowerOff(); 77 | void _InitDisplay(); 78 | void _Force_Init_Full(); 79 | void _Init_Full(); 80 | void _Init_4G(); 81 | void _Init_Part(); 82 | void _Update_Full(); 83 | void _Update_4G(); 84 | void _Update_Part(); 85 | private: 86 | enum {full_refresh, grey_refresh, fast_refresh, forced_full_refresh} _refresh_mode; 87 | static const unsigned char lut_20_vcom0_4G[]; 88 | static const unsigned char lut_21_ww_4G[]; 89 | static const unsigned char lut_22_bw_4G[]; 90 | static const unsigned char lut_23_wb_4G[]; 91 | static const unsigned char lut_24_bb_4G[]; 92 | static const unsigned char lut_20_LUTC_partial[]; 93 | static const unsigned char lut_21_LUTWW_partial[]; 94 | static const unsigned char lut_22_LUTKW_partial[]; 95 | static const unsigned char lut_23_LUTWK_partial[]; 96 | static const unsigned char lut_24_LUTKK_partial[]; 97 | static const unsigned char lut_25_LUTBD_partial[]; 98 | }; 99 | 100 | #endif 101 | -------------------------------------------------------------------------------- /lib/GxEPD2_4G/src/epd/GxEPD2_290_T94.h: -------------------------------------------------------------------------------- 1 | // Display Library for SPI e-paper panels from Dalian Good Display and boards from Waveshare. 2 | // Requires HW SPI and Adafruit_GFX. Caution: the e-paper panels require 3.3V supply AND data lines! 3 | // 4 | // based on Demo Example from Good Display, available here: http://www.e-paper-display.com/download_detail/downloadsId=806.html 5 | // Panel: GDEM029T94 : https://www.good-display.com/product/360.html 6 | // Controller : SSD1680 : https://www.good-display.com/companyfile/101.html 7 | // 8 | // Author: Jean-Marc Zingg 9 | // 10 | // Version: see library.properties 11 | // 12 | // Library: https://github.com/ZinggJM/GxEPD2 13 | 14 | #ifndef _GxEPD2_290_T94_H_ 15 | #define _GxEPD2_290_T94_H_ 16 | 17 | #include "../GxEPD2_4G_EPD.h" 18 | 19 | class GxEPD2_290_T94 : public GxEPD2_4G_EPD 20 | { 21 | public: 22 | // attributes 23 | static const uint16_t WIDTH = 128; 24 | static const uint16_t HEIGHT = 296; 25 | static const GxEPD2_4G::Panel panel = GxEPD2_4G::GDEM029T94; 26 | static const bool hasColor = false; 27 | static const bool hasPartialUpdate = false; // with grey refresh 28 | //static const bool hasFastPartialUpdate = false; // with grey refresh 29 | static const bool hasFastPartialUpdate = true; // with b/w refresh 30 | static const uint16_t power_on_time = 100; // ms, e.g. 95868us 31 | static const uint16_t power_off_time = 150; // ms, e.g. 140350us 32 | static const uint16_t full_refresh_time = 5500; // ms, e.g. 5406814us 33 | static const uint16_t partial_refresh_time = 500; // ms, e.g. 458231us 34 | // constructor 35 | GxEPD2_290_T94(int16_t cs, int16_t dc, int16_t rst, int16_t busy); 36 | // methods (virtual) 37 | // Support for Bitmaps (Sprites) to Controller Buffer and to Screen 38 | void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white) 39 | void writeScreenBuffer(uint8_t value = 0xFF); // init controller memory (default white) 40 | void writeScreenBufferAgain(uint8_t value = 0xFF); // init previous buffer controller memory (default white) 41 | // write to controller memory, without screen refresh; x and w should be multiple of 8 42 | void writeImage(const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 43 | void writeImageForFullRefresh(const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 44 | void writeImage_4G(const uint8_t bitmap[], uint8_t bpp, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 45 | void writeImagePart(const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, 46 | int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 47 | void writeImagePart_4G(const uint8_t bitmap[], uint8_t bpp, int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, 48 | int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 49 | void writeImage(const uint8_t* black, const uint8_t* color, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 50 | void writeImagePart(const uint8_t* black, const uint8_t* color, int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, 51 | int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 52 | // for differential update: set current and previous buffers equal (for fast partial update to work correctly) 53 | void writeImageAgain(const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 54 | void writeImagePartAgain(const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, 55 | int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 56 | // write sprite of native data to controller memory, without screen refresh; x and w should be multiple of 8 57 | void writeNative(const uint8_t* data1, const uint8_t* data2, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 58 | // write to controller memory, with screen refresh; x and w should be multiple of 8 59 | void drawImage(const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 60 | void drawImage_4G(const uint8_t bitmap[], uint8_t bpp, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 61 | void drawImagePart(const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, 62 | int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 63 | void drawImagePart_4G(const uint8_t bitmap[], uint8_t bpp, int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, 64 | int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 65 | void drawImage(const uint8_t* black, const uint8_t* color, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 66 | void drawImagePart(const uint8_t* black, const uint8_t* color, int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, 67 | int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 68 | // write sprite of native data to controller memory, with screen refresh; x and w should be multiple of 8 69 | void drawNative(const uint8_t* data1, const uint8_t* data2, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 70 | void refresh(bool partial_update_mode = false); // screen refresh from controller memory to full screen 71 | void refresh(int16_t x, int16_t y, int16_t w, int16_t h); // screen refresh from controller memory, partial screen 72 | void powerOff(); // turns off generation of panel driving voltages, avoids screen fading over time 73 | void hibernate(); // turns powerOff() and sets controller to deep sleep for minimum power use, ONLY if wakeable by RST (rst >= 0) 74 | void drawGreyLevels(); 75 | private: 76 | void _writeScreenBuffer(uint8_t command, uint8_t value); 77 | void _writeImage(uint8_t command, const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 78 | void _writeImagePart(uint8_t command, const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, 79 | int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 80 | void _setPartialRamArea(uint16_t x, uint16_t y, uint16_t w, uint16_t h); 81 | void _PowerOn(); 82 | void _PowerOff(); 83 | void _InitDisplay(); 84 | void _Force_Init_Full(); 85 | void _Init_Full(); 86 | void _Init_4G(); 87 | void _Init_Part(); 88 | void _Update_Full(); 89 | void _Update_4G(); 90 | void _Update_Part(); 91 | private: 92 | enum {full_refresh, grey_refresh, fast_refresh, forced_full_refresh} _refresh_mode; 93 | static const unsigned char lut_4G[]; 94 | }; 95 | 96 | #endif 97 | -------------------------------------------------------------------------------- /lib/GxEPD2_4G/src/GxEPD2_4G_GFX.h: -------------------------------------------------------------------------------- 1 | // Display Library for SPI e-paper panels from Dalian Good Display and boards from Waveshare. 2 | // Requires HW SPI and Adafruit_GFX. Caution: these e-papers require 3.3V supply AND data lines! 3 | // 4 | // based on Demo Example from Good Display: http://www.e-paper-display.com/download_list/downloadcategoryid=34&isMode=false.html 5 | // 6 | // Author: Jean-Marc Zingg 7 | // 8 | // Version: see library.properties 9 | // 10 | // Library: https://github.com/ZinggJM/GxEPD2_4G 11 | 12 | #ifndef _GxEPD2_4G_GFX_H_ 13 | #define _GxEPD2_4G_GFX_H_ 14 | 15 | #include 16 | #include 17 | 18 | class GxEPD2_4G_GFX : public Adafruit_GFX 19 | { 20 | public: 21 | GxEPD2_4G_GFX(GxEPD2_EPD& _epd2, int16_t w, int16_t h) : Adafruit_GFX(w, h), epd2(_epd2) {}; 22 | virtual uint16_t pages() = 0; 23 | virtual uint16_t pageHeight() = 0; 24 | virtual bool mirror(bool m) = 0; 25 | virtual void init(uint32_t serial_diag_bitrate = 0) = 0; // serial_diag_bitrate = 0 : disabled 26 | // init method with additional parameters: 27 | // initial false for re-init after processor deep sleep wake up, if display power supply was kept 28 | // this can be used to avoid the repeated initial full refresh on displays with fast partial update 29 | // NOTE: garbage will result on fast partial update displays, if initial full update is omitted after power loss 30 | // pulldown_rst_mode true for alternate RST handling to avoid feeding 5V through RST pin 31 | virtual void init(uint32_t serial_diag_bitrate, bool initial, bool pulldown_rst_mode = false) = 0; 32 | virtual void fillScreen(uint16_t color) = 0; // 0x0 black, >0x0 white, to buffer 33 | // display buffer content to screen, useful for full screen buffer 34 | virtual void display(bool partial_update_mode = false) = 0; 35 | // display part of buffer content to screen, useful for full screen buffer 36 | // displayWindow, use parameters according to actual rotation. 37 | // x and w should be multiple of 8, for rotation 0 or 2, 38 | // y and h should be multiple of 8, for rotation 1 or 3, 39 | // else window is increased as needed, 40 | // this is an addressing limitation of the e-paper controllers 41 | virtual void displayWindow(uint16_t x, uint16_t y, uint16_t w, uint16_t h) = 0; 42 | virtual void setFullWindow() = 0; 43 | // setPartialWindow, use parameters according to actual rotation. 44 | // x and w should be multiple of 8, for rotation 0 or 2, 45 | // y and h should be multiple of 8, for rotation 1 or 3, 46 | // else window is increased as needed, 47 | // this is an addressing limitation of the e-paper controllers 48 | virtual void setPartialWindow(uint16_t x, uint16_t y, uint16_t w, uint16_t h) = 0; 49 | virtual void firstPage() = 0; 50 | virtual bool nextPage() = 0; 51 | virtual void drawPaged(void (*drawCallback)(const void*), const void* pv) = 0; 52 | virtual void drawInvertedBitmap(int16_t x, int16_t y, const uint8_t bitmap[], int16_t w, int16_t h, uint16_t color) = 0; 53 | virtual void drawGreyPixmap(const uint8_t pixmap[], int16_t depth, int16_t x, int16_t y, int16_t w, int16_t h) = 0; 54 | // Support for Bitmaps (Sprites) to Controller Buffer and to Screen 55 | virtual void clearScreen(uint8_t value = 0xFF) = 0; // init controller memory and screen (default white) 56 | virtual void writeScreenBuffer(uint8_t value = 0xFF) = 0; // init controller memory (default white) 57 | // write to controller memory, without screen refresh; x and w should be multiple of 8 58 | virtual void writeImage(const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false) = 0; 59 | virtual void writeImage_4G(const uint8_t bitmap[], uint8_t bpp, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false) = 0; 60 | virtual void writeImagePart(const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, 61 | int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false) = 0; 62 | virtual void writeImagePart_4G(const uint8_t bitmap[], uint8_t bpp, int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, 63 | int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false) = 0; 64 | virtual void writeImage(const uint8_t* black, const uint8_t* color, int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm) = 0; 65 | virtual void writeImage(const uint8_t* black, const uint8_t* color, int16_t x, int16_t y, int16_t w, int16_t h) = 0; // default options false 66 | virtual void writeImagePart(const uint8_t* black, const uint8_t* color, int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, 67 | int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm) = 0; 68 | virtual void writeImagePart(const uint8_t* black, const uint8_t* color, int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, 69 | int16_t x, int16_t y, int16_t w, int16_t h) = 0; // default options false 70 | // write to controller memory, with screen refresh; x and w should be multiple of 8 71 | virtual void drawImage(const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false) = 0; 72 | virtual void drawImage_4G(const uint8_t bitmap[], uint8_t bpp, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false) = 0; 73 | virtual void drawImagePart(const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, 74 | int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false) = 0; 75 | virtual void drawImagePart_4G(const uint8_t bitmap[], uint8_t bpp, int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, 76 | int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false) = 0; 77 | virtual void drawImage(const uint8_t* black, const uint8_t* color, int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm) = 0; 78 | virtual void drawImage(const uint8_t* black, const uint8_t* color, int16_t x, int16_t y, int16_t w, int16_t h) = 0; // default options false 79 | virtual void drawImagePart(const uint8_t* black, const uint8_t* color, int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, 80 | int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm) = 0; 81 | virtual void drawImagePart(const uint8_t* black, const uint8_t* color, int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, 82 | int16_t x, int16_t y, int16_t w, int16_t h) = 0; // default options false 83 | virtual void refresh(bool partial_update_mode = false) = 0; // screen refresh from controller memory to full screen 84 | virtual void refresh(int16_t x, int16_t y, int16_t w, int16_t h) = 0; // screen refresh from controller memory, partial screen 85 | virtual void powerOff() = 0; // turns off generation of panel driving voltages, avoids screen fading over time 86 | virtual void hibernate() = 0; // turns powerOff() and sets controller to deep sleep for minimum power use, ONLY if wakeable by RST (rst >= 0) 87 | public: 88 | GxEPD2_EPD& epd2; 89 | }; 90 | 91 | #endif 92 | -------------------------------------------------------------------------------- /lib/GxEPD2_4G/src/gdey/GxEPD2_213_GDEY0213B74.h: -------------------------------------------------------------------------------- 1 | // Display Library for SPI e-paper panels from Dalian Good Display and boards from Waveshare. 2 | // Requires HW SPI and Adafruit_GFX. Caution: the e-paper panels require 3.3V supply AND data lines! 3 | // 4 | // based on Demo Example from Good Display, available here: https://www.good-display.com/product/391.html 5 | // Panel: GDEY0213B74 : https://www.good-display.com/product/391.html 6 | // Controller : SSD1680 : https://v4.cecdn.yun300.cn/100001_1909185148/SSD1680.pdf 7 | // 8 | // Author: Jean-Marc Zingg 9 | // 10 | // Version: see library.properties 11 | // 12 | // Library: https://github.com/ZinggJM/GxEPD2 13 | 14 | #ifndef _GxEPD2_213_GDEY0213B74_H_ 15 | #define _GxEPD2_213_GDEY0213B74_H_ 16 | 17 | #include "../GxEPD2_4G_EPD.h" 18 | 19 | class GxEPD2_213_GDEY0213B74 : public GxEPD2_4G_EPD 20 | { 21 | public: 22 | // attributes 23 | static const uint16_t WIDTH = 128; 24 | static const uint16_t HEIGHT = 250; 25 | static const GxEPD2_4G::Panel panel = GxEPD2_4G::GDEY0213B74; 26 | static const bool hasColor = false; 27 | static const bool hasPartialUpdate = true; // with grey refresh 28 | static const bool hasFastPartialUpdate = true; // with b/w refresh 29 | static const uint16_t power_on_time = 100; // ms, e.g. 90999us 30 | static const uint16_t power_off_time = 150; // ms, e.g. 140001us 31 | static const uint16_t grey_refresh_time = 5500; // ms, e.g. 5392001us 32 | static const uint16_t full_refresh_time = 1700; // ms, e.g. 1617000us 33 | static const uint16_t partial_refresh_time = 500; // ms, e.g. 457000us 34 | // constructor 35 | GxEPD2_213_GDEY0213B74(int16_t cs, int16_t dc, int16_t rst, int16_t busy); 36 | // methods (virtual) 37 | // Support for Bitmaps (Sprites) to Controller Buffer and to Screen 38 | void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white) 39 | void writeScreenBuffer(uint8_t value = 0xFF); // init controller memory (default white) 40 | void writeScreenBufferAgain(uint8_t value = 0xFF); // init previous buffer controller memory (default white) 41 | // write to controller memory, without screen refresh; x and w should be multiple of 8 42 | void writeImage(const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 43 | void writeImageForFullRefresh(const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 44 | void writeImage_4G(const uint8_t bitmap[], uint8_t bpp, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 45 | void writeImagePart(const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, 46 | int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 47 | void writeImagePart_4G(const uint8_t bitmap[], uint8_t bpp, int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, 48 | int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 49 | void writeImage(const uint8_t* black, const uint8_t* color, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 50 | void writeImagePart(const uint8_t* black, const uint8_t* color, int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, 51 | int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 52 | // for differential update: set current and previous buffers equal (for fast partial update to work correctly) 53 | void writeImageAgain(const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 54 | void writeImagePartAgain(const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, 55 | int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 56 | // write sprite of native data to controller memory, without screen refresh; x and w should be multiple of 8 57 | void writeNative(const uint8_t* data1, const uint8_t* data2, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 58 | // write to controller memory, with screen refresh; x and w should be multiple of 8 59 | void drawImage(const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 60 | void drawImage_4G(const uint8_t bitmap[], uint8_t bpp, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 61 | void drawImagePart(const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, 62 | int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 63 | void drawImagePart_4G(const uint8_t bitmap[], uint8_t bpp, int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, 64 | int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 65 | void drawImage(const uint8_t* black, const uint8_t* color, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 66 | void drawImagePart(const uint8_t* black, const uint8_t* color, int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, 67 | int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 68 | // write sprite of native data to controller memory, with screen refresh; x and w should be multiple of 8 69 | void drawNative(const uint8_t* data1, const uint8_t* data2, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 70 | void refresh(bool partial_update_mode = false); // screen refresh from controller memory to full screen 71 | void refresh(int16_t x, int16_t y, int16_t w, int16_t h); // screen refresh from controller memory, partial screen 72 | void powerOff(); // turns off generation of panel driving voltages, avoids screen fading over time 73 | void hibernate(); // turns powerOff() and sets controller to deep sleep for minimum power use, ONLY if wakeable by RST (rst >= 0) 74 | void drawGreyLevels(); 75 | private: 76 | void _writeScreenBuffer(uint8_t command, uint8_t value); 77 | void _writeScreenBufferArea(uint8_t command, uint8_t value, uint16_t x, uint16_t y, uint16_t w, uint16_t h); 78 | void _writeImage(uint8_t command, const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 79 | void _writeImagePart(uint8_t command, const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, 80 | int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 81 | void _setPartialRamArea(uint16_t x, uint16_t y, uint16_t w, uint16_t h); 82 | void _PowerOn(); 83 | void _PowerOff(); 84 | void _InitDisplay(); 85 | void _Force_Init_Full(); 86 | void _Init_Full(); 87 | void _Init_4G(); 88 | void _Init_Part(); 89 | void _Update_Full(); 90 | void _Update_4G(); 91 | void _Update_Part(); 92 | private: 93 | enum {full_refresh, grey_refresh, fast_refresh, forced_full_refresh} _refresh_mode; 94 | static const unsigned char lut_4G[]; 95 | }; 96 | 97 | #endif 98 | -------------------------------------------------------------------------------- /lib/GxEPD2_4G/src/gdey/GxEPD2_154_GDEY0154D67.h: -------------------------------------------------------------------------------- 1 | // Display Library for SPI e-paper panels from Dalian Good Display and boards from Waveshare. 2 | // Requires HW SPI and Adafruit_GFX. Caution: the e-paper panels require 3.3V supply AND data lines! 3 | // 4 | // based on Demo Example from Good Display, available here: https://www.good-display.com/product/388.html 5 | // Panel: GDEY0154D67 : https://www.good-display.com/product/388.html 6 | // Controller : SSD1681 : https://v4.cecdn.yun300.cn/100001_1909185148/SSD1681.pdf 7 | // 8 | // Author: Jean-Marc Zingg 9 | // 10 | // Version: see library.properties 11 | // 12 | // Library: https://github.com/ZinggJM/GxEPD2 13 | 14 | #ifndef _GxEPD2_154_GDEY0154D67_H_ 15 | #define _GxEPD2_154_GDEY0154D67_H_ 16 | 17 | #include "../GxEPD2_4G_EPD.h" 18 | 19 | class GxEPD2_154_GDEY0154D67 : public GxEPD2_4G_EPD 20 | { 21 | public: 22 | // attributes 23 | static const uint16_t WIDTH = 200; 24 | static const uint16_t HEIGHT = 200; 25 | static const GxEPD2_4G::Panel panel = GxEPD2_4G::GDEY0154D67; 26 | static const bool hasColor = false; 27 | static const bool hasPartialUpdate = true; // grey refresh uses full screen 28 | static const bool hasFastPartialUpdate = true; // with b/w refresh 29 | static const bool useFastFullUpdate = true; // set false for extended (low) temperature range 30 | static const uint16_t power_on_time = 100; // ms, e.g. 96000us 31 | static const uint16_t power_off_time = 150; // ms, e.g. 141000us 32 | static const uint16_t grey_refresh_time = 6000; // ms, e.g. 5517000us 33 | static const uint16_t full_refresh_time = 2000; // ms, e.g. 1907000us 34 | static const uint16_t partial_refresh_time = 500; // ms, e.g. 459000us 35 | // constructor 36 | GxEPD2_154_GDEY0154D67(int16_t cs, int16_t dc, int16_t rst, int16_t busy); 37 | // methods (virtual) 38 | // Support for Bitmaps (Sprites) to Controller Buffer and to Screen 39 | void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white) 40 | void writeScreenBuffer(uint8_t value = 0xFF); // init controller memory (default white) 41 | void writeScreenBufferAgain(uint8_t value = 0xFF); // init previous buffer controller memory (default white) 42 | // write to controller memory, without screen refresh; x and w should be multiple of 8 43 | void writeImage(const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 44 | void writeImageForFullRefresh(const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 45 | void writeImage_4G(const uint8_t bitmap[], uint8_t bpp, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 46 | void writeImagePart(const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, 47 | int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 48 | void writeImagePart_4G(const uint8_t bitmap[], uint8_t bpp, int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, 49 | int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 50 | void writeImage(const uint8_t* black, const uint8_t* color, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 51 | void writeImagePart(const uint8_t* black, const uint8_t* color, int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, 52 | int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 53 | // for differential update: set current and previous buffers equal (for fast partial update to work correctly) 54 | void writeImageAgain(const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 55 | void writeImagePartAgain(const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, 56 | int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 57 | // write sprite of native data to controller memory, without screen refresh; x and w should be multiple of 8 58 | void writeNative(const uint8_t* data1, const uint8_t* data2, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 59 | // write to controller memory, with screen refresh; x and w should be multiple of 8 60 | void drawImage(const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 61 | void drawImage_4G(const uint8_t bitmap[], uint8_t bpp, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 62 | void drawImagePart(const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, 63 | int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 64 | void drawImagePart_4G(const uint8_t bitmap[], uint8_t bpp, int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, 65 | int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 66 | void drawImage(const uint8_t* black, const uint8_t* color, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 67 | void drawImagePart(const uint8_t* black, const uint8_t* color, int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, 68 | int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 69 | // write sprite of native data to controller memory, with screen refresh; x and w should be multiple of 8 70 | void drawNative(const uint8_t* data1, const uint8_t* data2, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 71 | void refresh(bool partial_update_mode = false); // screen refresh from controller memory to full screen 72 | void refresh(int16_t x, int16_t y, int16_t w, int16_t h); // screen refresh from controller memory, partial screen 73 | void powerOff(); // turns off generation of panel driving voltages, avoids screen fading over time 74 | void hibernate(); // turns powerOff() and sets controller to deep sleep for minimum power use, ONLY if wakeable by RST (rst >= 0) 75 | void drawGreyLevels(); 76 | private: 77 | void _writeScreenBuffer(uint8_t command, uint8_t value); 78 | void _writeScreenBufferArea(uint8_t command, uint8_t value, uint16_t x, uint16_t y, uint16_t w, uint16_t h); 79 | void _writeImage(uint8_t command, const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 80 | void _writeImagePart(uint8_t command, const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, 81 | int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 82 | void _setPartialRamArea(uint16_t x, uint16_t y, uint16_t w, uint16_t h); 83 | void _PowerOn(); 84 | void _PowerOff(); 85 | void _InitDisplay(); 86 | void _Force_Init_Full(); 87 | void _Init_Full(); 88 | void _Init_4G(); 89 | void _Init_Part(); 90 | void _Update_Full(); 91 | void _Update_4G(); 92 | void _Update_Part(); 93 | private: 94 | enum {full_refresh, grey_refresh, fast_refresh, forced_full_refresh} _refresh_mode; 95 | static const unsigned char lut_4G[]; 96 | }; 97 | 98 | #endif 99 | -------------------------------------------------------------------------------- /lib/GxEPD2_4G/src/epd/GxEPD2_270.h: -------------------------------------------------------------------------------- 1 | // Display Library for SPI e-paper panels from Dalian Good Display and boards from Waveshare. 2 | // Requires HW SPI and Adafruit_GFX. Caution: these e-papers require 3.3V supply AND data lines! 3 | // 4 | // based on Demo Example from Good Display: http://www.e-paper-display.com/download_list/downloadcategoryid=34&isMode=false.html 5 | // Controller: IL91874 : http://www.e-paper-display.com/download_detail/downloadsId=539.html 6 | // 7 | // Author: Jean-Marc Zingg 8 | // 9 | // Version: see library.properties 10 | // 11 | // Library: https://github.com/ZinggJM/GxEPD2 12 | 13 | #ifndef _GxEPD2_270_H_ 14 | #define _GxEPD2_270_H_ 15 | 16 | #include "../GxEPD2_4G_EPD.h" 17 | 18 | class GxEPD2_270 : public GxEPD2_4G_EPD 19 | { 20 | public: 21 | // attributes 22 | static const uint16_t WIDTH = 176; 23 | static const uint16_t HEIGHT = 264; 24 | static const GxEPD2_4G::Panel panel = GxEPD2_4G::GDEW027W3; 25 | static const bool hasColor = false; 26 | static const bool hasPartialUpdate = true; 27 | static const bool hasFastPartialUpdate = true; 28 | static const uint16_t power_on_time = 100; // ms, e.g. 98877us 29 | static const uint16_t power_off_time = 30; // ms, e.g. 28405us 30 | static const uint16_t full_refresh_time = 2000; // ms, e.g. 1979027us 31 | static const uint16_t partial_refresh_time = 400; // ms, e.g. 363637us 32 | // constructor 33 | GxEPD2_270(int16_t cs, int16_t dc, int16_t rst, int16_t busy); 34 | // methods (virtual) 35 | // Support for Bitmaps (Sprites) to Controller Buffer and to Screen 36 | void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white) 37 | void writeScreenBuffer(uint8_t value = 0xFF); // init controller memory (default white) 38 | void writeScreenBufferAgain(uint8_t value = 0xFF); // init previous buffer controller memory (default white) 39 | // write to controller memory, without screen refresh; x and w should be multiple of 8 40 | void writeImage(const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 41 | void writeImage_4G(const uint8_t bitmap[], uint8_t bpp, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 42 | void writeImagePart(const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, 43 | int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 44 | void writeImagePart_4G(const uint8_t bitmap[], uint8_t bpp, int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, 45 | int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 46 | void writeImage(const uint8_t* black, const uint8_t* color, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 47 | void writeImagePart(const uint8_t* black, const uint8_t* color, int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, 48 | int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 49 | // for differential update: set current and previous buffers equal (for fast partial update to work correctly) 50 | void writeImageAgain(const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 51 | void writeImagePartAgain(const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, 52 | int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 53 | // write sprite of native data to controller memory, without screen refresh; x and w should be multiple of 8 54 | void writeNative(const uint8_t* data1, const uint8_t* data2, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 55 | // write to controller memory, with screen refresh; x and w should be multiple of 8 56 | void drawImage(const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 57 | void drawImage_4G(const uint8_t bitmap[], uint8_t bpp, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 58 | void drawImagePart(const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, 59 | int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 60 | void drawImagePart_4G(const uint8_t bitmap[], uint8_t bpp, int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, 61 | int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 62 | void drawImage(const uint8_t* black, const uint8_t* color, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 63 | void drawImagePart(const uint8_t* black, const uint8_t* color, int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, 64 | int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 65 | // write sprite of native data to controller memory, with screen refresh; x and w should be multiple of 8 66 | void drawNative(const uint8_t* data1, const uint8_t* data2, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 67 | void refresh(bool partial_update_mode = false); // screen refresh from controller memory to full screen 68 | void refresh(int16_t x, int16_t y, int16_t w, int16_t h); // screen refresh from controller memory, partial screen 69 | void powerOff(); // turns off generation of panel driving voltages, avoids screen fading over time 70 | void hibernate(); // turns powerOff() and sets controller to deep sleep for minimum power use, ONLY if wakeable by RST (rst >= 0) 71 | private: 72 | void _writeImage(uint8_t command, const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 73 | void _writeImagePart(uint8_t command, const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, 74 | int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); 75 | void _setPartialRamArea(uint8_t command, uint16_t x, uint16_t y, uint16_t w, uint16_t h); 76 | void _refreshWindow(uint16_t x, uint16_t y, uint16_t w, uint16_t h); 77 | void _PowerOn(); 78 | void _PowerOff(); 79 | void _InitDisplay(); 80 | void _Force_Init_Full(); 81 | void _Init_Full(); 82 | void _Init_4G(); 83 | void _Init_Part(); 84 | void _Update_Full(); 85 | void _Update_4G(); 86 | void _Update_Part(); 87 | private: 88 | enum {full_refresh, grey_refresh, fast_refresh, forced_full_refresh} _refresh_mode; 89 | static const unsigned char lut_20_vcomDC[]; 90 | static const unsigned char lut_21_ww[]; 91 | static const unsigned char lut_22_bw[]; 92 | static const unsigned char lut_23_wb[]; 93 | static const unsigned char lut_24_bb[]; 94 | static const unsigned char lut_20_vcom0_4G[]; 95 | static const unsigned char lut_21_ww_4G[]; 96 | static const unsigned char lut_22_bw_4G[]; 97 | static const unsigned char lut_23_wb_4G[]; 98 | static const unsigned char lut_24_bb_4G[]; 99 | static const unsigned char lut_20_vcomDC_partial[]; 100 | static const unsigned char lut_21_ww_partial[]; 101 | static const unsigned char lut_22_bw_partial[]; 102 | static const unsigned char lut_23_wb_partial[]; 103 | static const unsigned char lut_24_bb_partial[]; 104 | }; 105 | 106 | #endif 107 | --------------------------------------------------------------------------------