jomjol 5 лет назад
Родитель
Сommit
7a7cfb493d
4 измененных файлов с 27 добавлено и 7 удалено
  1. 8 1
      README.md
  2. 17 4
      code/lib/connect_wlan/connect_wlan.cpp
  3. BIN
      firmware/firmware.bin
  4. 2 2
      sd-card/wlan.ini

+ 8 - 1
README.md

@@ -29,11 +29,18 @@ A 3d-printable housing can be found here: https://www.thingiverse.com/thing:4571
 
 
 
-##### Rolling - (2020-09-10)
+##### Rolling - (2020-09-11)
+
+* Support of spaces in WLan SSID or password
+
+2020-09-10
 
 * Optimization of "DELETE ALL" - Autoreload of directory after delete, protection of wlan.ini
+
 * Internal Optimization (removal of unnessary error messages, restructure CTfLiteClass)
+
 * additional parameter in `wasserzahler.html?noerror=true`  to suppress an potential error message in case of consitency check (is equal to `ErrorMessage` = False in `config.ini`)
+
 * update ROI-configurator, in case of no ROIs defined
 
 2020-09-09

+ 17 - 4
code/lib/connect_wlan/connect_wlan.cpp

@@ -28,10 +28,13 @@ static EventGroupHandle_t wifi_event_group;
 #define BLINK_GPIO GPIO_NUM_33
 
 
-std::vector<string> ZerlegeZeile(std::string input)
+std::vector<string> ZerlegeZeile(std::string input, std::string _delimiter = "")
 {
 	std::vector<string> Output;
 	std::string delimiter = " =,";
+    if (_delimiter.length() > 0){
+        delimiter = _delimiter;
+    }
 
 	input = trim(input, delimiter);
 	size_t pos = findDelimiterPos(input, delimiter);
@@ -140,11 +143,21 @@ void LoadWlanFromFile(std::string fn, std::string &_ssid, std::string &_passphra
     while ((line.size() > 0) || !(feof(pFile)))
     {
 //        printf("%s", line.c_str());
-        zerlegt = ZerlegeZeile(line);
-        if ((zerlegt.size() > 1) && (toUpper(zerlegt[0]) == "SSID"))
+        zerlegt = ZerlegeZeile(line, "=");
+        zerlegt[0] = trim(zerlegt[0], " ");
+        zerlegt[1] = trim(zerlegt[1], " ");        
+        if ((zerlegt.size() > 1) && (toUpper(zerlegt[0]) == "SSID")){
             _ssid = zerlegt[1];
-        if ((zerlegt.size() > 1) && (toUpper(zerlegt[0]) == "PASSWORD"))
+            if ((_ssid[0] == '"') && (_ssid[_ssid.length()-1] == '"')){
+                _ssid = _ssid.substr(1, _ssid.length()-2);
+            }
+        }
+        if ((zerlegt.size() > 1) && (toUpper(zerlegt[0]) == "PASSWORD")){
             _passphrase = zerlegt[1];
+            if ((_passphrase[0] == '"') && (_passphrase[_passphrase.length()-1] == '"')){
+                _passphrase = _passphrase.substr(1, _passphrase.length()-2);
+            }
+        }
 
         if (fgets(zw, 1024, pFile) == NULL)
         {

BIN
firmware/firmware.bin


+ 2 - 2
sd-card/wlan.ini

@@ -1,2 +1,2 @@
-ssid = SSID
-password = PASSWORD
+ssid = "SSID"
+password = "PASSWORD"