diff --git a/include/UrlEncode.h b/include/UrlEncode.h
new file mode 100644
index 00000000..707baab4
--- /dev/null
+++ b/include/UrlEncode.h
@@ -0,0 +1,34 @@
+//+--------------------------------------------------------------------------
+//
+// File: UrlEncode.h
+//
+// NightDriverStrip - (c) 2026 Plummer's Software LLC. All Rights Reserved.
+//
+// This file is part of the NightDriver software project.
+//
+// NightDriver is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// NightDriver is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Nightdriver. It is normally found in copying.txt
+// If not, see .
+//
+// Description:
+//
+// Helper to URL-encode strings for API calls.
+// Implemenation provides RFC 1738 style percent-encoding.
+//
+//---------------------------------------------------------------------------
+
+#pragma once
+
+#include
+
+String urlEncode(const String& str);
diff --git a/include/effects/matrix/PatternStocks.h b/include/effects/matrix/PatternStocks.h
index 30e730a7..c89c95db 100644
--- a/include/effects/matrix/PatternStocks.h
+++ b/include/effects/matrix/PatternStocks.h
@@ -39,7 +39,6 @@
#include // Adafruit GFX font structs
#include
#include
-#include
#include
#include
#include "systemcontainer.h"
diff --git a/include/effects/matrix/PatternSubscribers.h b/include/effects/matrix/PatternSubscribers.h
index 55b3918f..4afe5c92 100644
--- a/include/effects/matrix/PatternSubscribers.h
+++ b/include/effects/matrix/PatternSubscribers.h
@@ -33,7 +33,6 @@
#ifndef PatternSub_H
#define PatternSub_H
-#include
#include "systemcontainer.h"
extern const GFXfont Apple5x7 PROGMEM;
diff --git a/include/effects/matrix/PatternWeather.h b/include/effects/matrix/PatternWeather.h
index 6dcd4410..552896c1 100644
--- a/include/effects/matrix/PatternWeather.h
+++ b/include/effects/matrix/PatternWeather.h
@@ -604,4 +604,4 @@ class PatternWeather : public EffectWithId
}
};
-#endif
\ No newline at end of file
+#endif
diff --git a/platformio.ini b/platformio.ini
index 38a5f176..01e347df 100644
--- a/platformio.ini
+++ b/platformio.ini
@@ -58,7 +58,6 @@ lib_deps = crankyoldgit/IRremoteESP8266 @ ^2.8.6
esp32async/ESPAsyncWebServer @ ^3.7.10
bblanchon/ArduinoJson @ ^7.4.2
https://github.com/PlummersSoftwareLLC/RemoteDebug
- plageoj/UrlEncode @ ^1.0.1
; This partition table is the default and fits everything in 4M of flash without OTA.
board_build.partitions = config/partitions_custom_noota.csv
diff --git a/src/deviceconfig.cpp b/src/deviceconfig.cpp
index 448467f0..6011b854 100644
--- a/src/deviceconfig.cpp
+++ b/src/deviceconfig.cpp
@@ -107,6 +107,7 @@ bool DeviceConfig::SetTimeZone(const String& newTimeZone, bool skipWrite)
DeviceConfig::ValidateResponse DeviceConfig::ValidateOpenWeatherAPIKey(const String &newOpenWeatherAPIKey)
{
+#if ENABLE_WIFI
HTTPClient http;
String url = "http://api.openweathermap.org/data/2.5/weather?lat=0&lon=0&appid=" + urlEncode(newOpenWeatherAPIKey);
@@ -141,6 +142,9 @@ DeviceConfig::ValidateResponse DeviceConfig::ValidateOpenWeatherAPIKey(const Str
return { false, "Unable to validate" };
}
}
+#else
+ return { true, "" };
+#endif
}
void DeviceConfig::SetColorSettings(const CRGB& newGlobalColor, const CRGB& newSecondColor)
diff --git a/src/network.cpp b/src/network.cpp
index 39e1d84c..2d110369 100644
--- a/src/network.cpp
+++ b/src/network.cpp
@@ -51,8 +51,36 @@ DRAM_ATTR bool NTPTimeClient::_bClockSet = false;
DRAM_ATTR std::mutex NTPTimeClient::_clockMutex; // Clock guard mutex for SNTP client
-
#if ENABLE_WIFI
+
+String urlEncode(const String& str)
+{
+ String encodedString = "";
+ char c;
+ char code0;
+ char code1;
+ for (int i = 0; i < str.length(); i++) {
+ c = str.charAt(i);
+ if (isalnum(c)) {
+ encodedString += c;
+ } else {
+ code1 = (c & 0xf) + '0';
+ if ((c & 0xf) > 9) {
+ code1 = (c & 0xf) - 10 + 'A';
+ }
+ c = (c >> 4) & 0xf;
+ code0 = c + '0';
+ if (c > 9) {
+ code0 = c - 10 + 'A';
+ }
+ encodedString += '%';
+ encodedString += code0;
+ encodedString += code1;
+ }
+ }
+ return encodedString;
+}
+
void DoStatsCommand()
{
auto& bufferManager = g_ptrSystem->BufferManagers()[0];