A Hardware Hacking Tool with Web-Based CLI That Speaks Every Protocol
C arduinobluetoothcan-busdebuggingeepromesp32flipperzerogpiohardware-hackingi2cjtagopenocdprotocolspwmradiorfidspisubghzuartwifi
add standalone setup for tembed
Geo191bbe8e1672
diff --git a/src/Vendors/TembedWifiSetup.cpp b/src/Vendors/TembedWifiSetup.cppnew file mode 100644index 00000000..54914ef5--- /dev/null+++ b/src/Vendors/TembedWifiSetup.cpp@@ -0,0 +1,70 @@+#if defined(DEVICE_TEMBEDS3) || defined(DEVICE_TEMBEDS3CC1101)++#include "TembedWifiSetup.h"+#include <WiFi.h>+#include <Preferences.h>+#include <TFT_eSPI.h>++TFT_eSPI tft;++Preferences& getPreferences() {+ static Preferences preferences;+ return preferences;+}++bool loadWifiCredentials(String& ssid, String& password) {+ Preferences& preferences = getPreferences();+ preferences.begin("wifi_settings", true);+ ssid = preferences.getString(NVS_SSID_KEY, "");+ password = preferences.getString(NVS_PASS_KEY, "");+ preferences.end();+ return !ssid.isEmpty() && !password.isEmpty();+}++void drawWifiBox(uint16_t borderColor, const String& msg1, const String& msg2, uint8_t textSize = 2) {+ tft.fillScreen(TFT_BLACK);++ tft.fillRoundRect(20, 20, tft.width() - 40, tft.height() - 40, 5, DARK_GREY);+ tft.drawRoundRect(20, 20, tft.width() - 40, tft.height() - 40, 5, borderColor);++ tft.setTextColor(TFT_WHITE);+ tft.setTextSize(textSize);+ tft.drawString(msg1, 37, 45);++ tft.setTextFont(1);+ tft.setTextSize(1);+ tft.setTextColor(TFT_LIGHTGREY);+ tft.drawString(msg2, 36, 70);+}++bool setupTembedWifi() {+ tft.setRotation(3);+ String ssid, password;+ drawWifiBox(TFT_GREEN, "Loading WiFi...", "");++ if (!loadWifiCredentials(ssid, password)) {+ drawWifiBox(TFT_GREEN, "No saved WiFi", "Setup your Wi-Fi with USB Serial");+ delay(5000);+ return false;+ }++ drawWifiBox(TFT_GREEN, "Connecting", ssid);++ WiFi.begin(ssid.c_str(), password.c_str());++ tft.setTextColor(TFT_LIGHTGREY);+ tft.setCursor(55, 100);+ for (int i = 0; i < 30; ++i) {+ if (WiFi.status() == WL_CONNECTED) {+ return true;+ }+ delay(500);+ tft.print(".");+ }++ drawWifiBox(TFT_GREEN, "Failed to connect", "Setup your Wi-Fi with USB Serial");+ delay(4000);+ return false;+}++#endifdiff --git a/src/Vendors/TembedWifiSetup.h b/src/Vendors/TembedWifiSetup.hnew file mode 100644index 00000000..16cf2855--- /dev/null+++ b/src/Vendors/TembedWifiSetup.h@@ -0,0 +1,10 @@+#pragma once++#include <Arduino.h>++#define NVS_SSID_KEY "ssid"+#define NVS_PASS_KEY "pass"++#define DARK_GREY 0x4208++bool setupTembedWifi();