Start webserver only in standalone-mode
This commit is contained in:
parent
81adc9bd61
commit
41ebed2b27
16
src/main.cpp
16
src/main.cpp
@ -97,7 +97,7 @@ void log(int level, String message, int code);
|
|||||||
bool mConfigured = false;
|
bool mConfigured = false;
|
||||||
bool mConnected = false;
|
bool mConnected = false;
|
||||||
bool mFailedI2Cinitialization = false;
|
bool mFailedI2Cinitialization = false;
|
||||||
AsyncWebServer* mHttp;
|
AsyncWebServer* mHttp = NULL;
|
||||||
|
|
||||||
/******************************* Sensor data **************************/
|
/******************************* Sensor data **************************/
|
||||||
HomieNode particle(NODE_PARTICLE, "particle", "number"); /**< Measuret in micro gram per quibik meter air volume */
|
HomieNode particle(NODE_PARTICLE, "particle", "number"); /**< Measuret in micro gram per quibik meter air volume */
|
||||||
@ -209,7 +209,7 @@ void onHomieEvent(const HomieEvent &event)
|
|||||||
digitalWrite(WITTY_RGB_B, LOW);
|
digitalWrite(WITTY_RGB_B, LOW);
|
||||||
strip.fill(strip.Color(0,0,128));
|
strip.fill(strip.Color(0,0,128));
|
||||||
strip.show();
|
strip.show();
|
||||||
if (String(Homie.getConfiguration().mqtt.server.host).equals(MQTT_DUMMYHOST)) {
|
if (mHttp != NULL) {
|
||||||
strip.fill(strip.Color(0,64,0));
|
strip.fill(strip.Color(0,64,0));
|
||||||
mConnectedNonMQTT = true;
|
mConnectedNonMQTT = true;
|
||||||
}
|
}
|
||||||
@ -459,12 +459,6 @@ void setup()
|
|||||||
for (int i=0;i < (PIXEL_COUNT / 2); i++) {
|
for (int i=0;i < (PIXEL_COUNT / 2); i++) {
|
||||||
strip.setPixelColor(0, strip.Color(0,128,0));
|
strip.setPixelColor(0, strip.Color(0,128,0));
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
for (int i=0;i < (PIXEL_COUNT / 2); i++) {
|
|
||||||
strip.setPixelColor(0, strip.Color(0,0,128));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
strip.show();
|
|
||||||
mHttp = new AsyncWebServer(80);
|
mHttp = new AsyncWebServer(80);
|
||||||
mHttp->on("/heap", HTTP_GET, [](AsyncWebServerRequest *request){
|
mHttp->on("/heap", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||||
request->send(200, "text/plain", String(ESP.getFreeHeap()));
|
request->send(200, "text/plain", String(ESP.getFreeHeap()));
|
||||||
@ -475,6 +469,12 @@ void setup()
|
|||||||
mHttp->serveStatic("/", SPIFFS, "/").setDefaultFile("index.htm");
|
mHttp->serveStatic("/", SPIFFS, "/").setDefaultFile("index.htm");
|
||||||
mHttp->begin();
|
mHttp->begin();
|
||||||
Homie.getLogger() << "Webserver started" << endl;
|
Homie.getLogger() << "Webserver started" << endl;
|
||||||
|
} else {
|
||||||
|
for (int i=0;i < (PIXEL_COUNT / 2); i++) {
|
||||||
|
strip.setPixelColor(0, strip.Color(0,0,128));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
strip.show();
|
||||||
digitalWrite(WITTY_RGB_B, HIGH);
|
digitalWrite(WITTY_RGB_B, HIGH);
|
||||||
} else {
|
} else {
|
||||||
strip.fill(strip.Color(128,0,0));
|
strip.fill(strip.Color(128,0,0));
|
||||||
|
Loading…
Reference in New Issue
Block a user