Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ESP8266_Code.ino to display DHT sensor information on ESP server dashboard #1

Merged
merged 1 commit into from
Apr 25, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion ESP8266_Code/ESP8266_Code.ino
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,26 @@ const char WEBSITE[] PROGMEM = R"=====(
Miner version
</div>
</div>
)====="
#ifdef USE_DHT
" <div class=\"column\" style=\"min-width:15em\">"
" <div class=\"title is-size-5 mb-0\">"
" @@TEMP@@ °C"
" </div>"
" <div class=\"heading is-size-5\">"
" Temperature"
" </div>"
" </div>"
" <div class=\"column\" style=\"min-width:15em\">"
" <div class=\"title is-size-5 mb-0\">"
" @@HUM@@ %"
" </div>"
" <div class=\"heading is-size-5\">"
" Humidity"
" </div>"
" </div>"
#endif
R"=====(
</div>
</div>
</div>
Expand Down Expand Up @@ -494,7 +514,12 @@ void dashboard() {
s.replace("@@ID@@", String(RIG_IDENTIFIER));
s.replace("@@MEMORY@@", String(ESP.getFreeHeap()));
s.replace("@@VERSION@@", String(MINER_VER));

#ifdef USE_DHT
int temp = dht.readTemperature();
int hum = dht.readHumidity();
s.replace("@@TEMP@@", String(temp));
s.replace("@@HUM@@", String(hum));
#endif
server.send(200, "text/html", s);
}

Expand Down