minimal changes

This commit is contained in:
Rohan Sircar 2019-10-28 18:38:45 +05:30
parent 0ae2d8ad4a
commit 00f01de240
2 changed files with 11 additions and 8 deletions

3
data/manualMode.txt Normal file
View File

@ -0,0 +1,3 @@
{
"manual": "False"
}

View File

@ -62,8 +62,7 @@ OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire); DallasTemperature sensors(&oneWire);
const int SENSOR_RESOLUTION = 12; const int SENSOR_RESOLUTION = 12;
unsigned long lastTempRequest = 0; unsigned long lastTempRequest = 0;
const unsigned int delayInMillisSensors = 750 / (1 << (12 - SENSOR_RESOLUTION)); const unsigned int delayInMillisSensors = 750 / (1 << (12 - SENSOR_RESOLUTION)) + 100;
;
ESP8266WiFiMulti wifiMulti; // Create an instance of the ESP8266WiFiMulti class, called 'wifiMulti' ESP8266WiFiMulti wifiMulti; // Create an instance of the ESP8266WiFiMulti class, called 'wifiMulti'
@ -291,9 +290,9 @@ void loop()
temperatures.add(sensors.getTempCByIndex(0)); temperatures.add(sensors.getTempCByIndex(0));
root.prettyPrintTo(Serial); root.prettyPrintTo(Serial);
root.prettyPrintTo(temperaturesJson); root.prettyPrintTo(temperaturesJson);
dtostrf(sensors.getTempCByIndex(0), 1, 1, str_temp); // dtostrf(sensors.getTempCByIndex(0), 1, 1, str_temp);
sprintf(b, "%s", str_temp); // sprintf(b, "%s", str_temp);
tft.drawString(str_temp, coordinates.x[3], coordinates.y[3], 2); // tft.drawString(str_temp, coordinates.x[3], coordinates.y[3], 2);
// Serial.println(sensors.getTempCByIndex(0)); // Serial.println(sensors.getTempCByIndex(0));
// Serial << "Delay: " << delayInMillisSensors << endl; // Serial << "Delay: " << delayInMillisSensors << endl;
sensors.requestTemperatures(); sensors.requestTemperatures();
@ -757,14 +756,15 @@ void handleManual()
{ {
root["manual"] = "False"; root["manual"] = "False";
} }
root.printTo(file); root.prettyPrintTo(file);
file.close(); file.close();
combineSettings(); combineSettings();
// digitalWrite(ESP_TO_ARDUINO_PIN, 1); // digitalWrite(ESP_TO_ARDUINO_PIN, 1);
displayCombinedSettings(); displayCombinedSettings();
// digitalWrite(ESP_TO_ARDUINO_PIN,1); // digitalWrite(ESP_TO_ARDUINO_PIN,1);
server.sendHeader("Location", "/manualMode.html"); // Redirect the client to the success page // server.sendHeader("Location", "/manualMode.html"); // Redirect the client to the success page
server.send(303); // server.send(303);
server.send(200);
} }
void handleSettings() void handleSettings()
{ {