Skip to content

Commit

Permalink
refactor: improved display of sensors on Dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
Laxilef committed Dec 4, 2024
1 parent 105a79f commit 5c1e967
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/PortalTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,7 @@ class PortalTask : public LeanTask {
for (uint8_t sensorId = 0; sensorId <= Sensors::getMaxSensorId(); sensorId++) {
if (detailed) {
auto& sSensor = Sensors::settings[sensorId];
doc[sensorId][FPSTR(S_ENABLED)] = sSensor.enabled;
doc[sensorId][FPSTR(S_NAME)] = sSensor.name;
doc[sensorId][FPSTR(S_PURPOSE)] = static_cast<uint8_t>(sSensor.purpose);
sensorResultToJson(sensorId, doc[sensorId]);
Expand Down
6 changes: 3 additions & 3 deletions src_data/pages/dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -581,12 +581,12 @@ <h2 data-i18n>dashboard.name</h2>
}

const sData = result[sensorId];
if (sData.purpose == 255) {
sensorNode.classList.add("hidden");
if (!sData.enabled || sData.purpose == 255) {
sensorNode.classList.toggle("hidden", true);
continue;
}

sensorNode.classList.remove("hidden");
sensorNode.classList.toggle("hidden", false);

setStatus(
".sStatus",
Expand Down

0 comments on commit 5c1e967

Please sign in to comment.