 #include <DallasTemperature.h>
 #include <DHT.h>
 #include <ESPmDNS.h>
-#define ONE_WIRE_BUS 5
-#define DHTPIN 15
-#define DHTTYPE DHT11
+#define ONE_WIRE_BUS 5 //dallas sensor pin
+#define DHTPIN 15 // dht sensor pin
+#define DHTTYPE DHT11 //dht type 11 or 22
 DHT dht(DHTPIN, DHTTYPE);
 OneWire oneWire(ONE_WIRE_BUS);
 DallasTemperature sensors(&oneWire);
 // end of sensors
 
-// Settings you should check/change !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! mabe not anymore !!!!!!!!!!!!!
-
-const char* www_username = "admin";
-String resetpass = "admin"; // password to reset wifimanager when allready connected
-String thingkey = "none"; //your thingspeak API key
-String thingchanel = "none"; //your thingspeak Chanel #
-const long interval = 60000; // interval in ms for sending temperature data to thingspeak
-String liens = "";
-String dernadd = "Fraichement boot&eacute;"; //variable for ip logging (you can put your fresh boot mesage here in text/html)
 // led pins
 uint8_t pinRouge = 12;
-uint8_t pinVerte = 14; // internally pulled up
+uint8_t pinVerte = 14;
 uint8_t pinBleu = 13;
-// end of settings you should check/change
+//end of led pins
 
 // internally used vars
+// Some used vars, some of these are set and loaded in setup() using esp32 Preferences
+const long interval = 60000; // interval in ms for sending temperature data to thingspeak
+const char* www_username = "admin";
+String dernadd = "Fraichement boot&eacute;"; //variable for ip logging (you can put your fresh boot mesage here in text/html)
+String resetpass = ""; // password to reset wifimanager when allready connected
+String thingkey = ""; //your thingspeak API key
+String thingchanel = ""; //your thingspeak Chanel #
+String liens = "";
+String derncoul = "";
 WebServer server(80);
-String derncoul = "#000000";
 long r = 0;
 long g = 0;
 long b = 0;

// log rotator
void logtourne() {
  for (int i = 49; i > 0; i--) {
    int l = i;
    l = l + 1;
    logs[l] = logs[i];
  }
}

  logtourne();
  logs[1] = addy;
  logs[1] += " : Settings : Password=";
  if (passme != resetpass) {
    logs[1] += passme;
  } else {
    logs[1] += "!!! Not showing password !!!";
  }
  logs[1].replace("<", "</"); //prevent html tags in logs so hackers cant code in log page lol
  if (ouireset == 1) {
    Serial.println("Settings changed");
    if (noupass != resetpass) {
      preferences.putString("resetpass", noupass);
      resetpass = noupass;
      Serial.print("NEW Password : ");
      Serial.println(resetpass);
    }
    if (lakey != thingkey) {
      preferences.putString("thingkey", lakey);
      thingkey = lakey;
      Serial.print("NEW API KEY : ");
      Serial.println(thingkey);
    }
    if (lechan != thingchanel) {
      preferences.putString("thingchanel", lechan);
      thingchanel = lechan;
      liens = "<a href=\"/\">Acceuil</a> - <a href=\"/temp\">Temp&eacute;rature</a> - <a href=\"/version\">Version</a> - <a href=\"/setup\">Setup</a> - <a href=\"/reset\">Reset</a> - <a href=\"https://thingspeak.com/channels/";
      liens += thingchanel;
      liens += "\">Temp stats</a>\n";
      Serial.print("NEW channel : ");
      Serial.println(thingchanel);
    }
  }
}

// convert string 2 char*
char* string2char(String command) {
  if (command.length() != 0) {
    char *p = const_cast<char*>(command.c_str());
