Skip to content

Commit

Permalink
temperaturesensor commands only if enabled (gpio != 0)
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDvP committed Sep 29, 2023
1 parent 3a1b7ca commit 2e25e46
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions src/command.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -550,11 +550,11 @@ bool Command::device_has_commands(const uint8_t device_type) {
}

if (device_type == EMSdevice::DeviceType::TEMPERATURESENSOR) {
return true;
return EMSESP::sensor_enabled();
}

if (device_type == EMSdevice::DeviceType::ANALOGSENSOR) {
return EMSESP::system_.analog_enabled();
return EMSESP::analog_enabled();
}

for (const auto & emsdevice : EMSESP::emsdevices) {
Expand All @@ -576,8 +576,10 @@ void Command::show_devices(uuid::console::Shell & shell) {
shell.printf("%s ", EMSdevice::device_type_2_device_name(EMSdevice::DeviceType::SYSTEM));
shell.printf("%s ", EMSdevice::device_type_2_device_name(EMSdevice::DeviceType::CUSTOM));
shell.printf("%s ", EMSdevice::device_type_2_device_name(EMSdevice::DeviceType::SCHEDULER));
shell.printf("%s ", EMSdevice::device_type_2_device_name(EMSdevice::DeviceType::TEMPERATURESENSOR));
if (EMSESP::analogsensor_.analog_enabled()) {
if (EMSESP::sensor_enabled()) {
shell.printf("%s ", EMSdevice::device_type_2_device_name(EMSdevice::DeviceType::TEMPERATURESENSOR));
}
if (EMSESP::analog_enabled()) {
shell.printf("%s ", EMSdevice::device_type_2_device_name(EMSdevice::DeviceType::ANALOGSENSOR));
}

Expand Down Expand Up @@ -627,13 +629,15 @@ void Command::show_all(uuid::console::Shell & shell) {
show(shell, EMSdevice::DeviceType::SCHEDULER, true);

// show sensors
shell.print(COLOR_BOLD_ON);
shell.print(COLOR_YELLOW);
shell.printf(" %s: ", EMSdevice::device_type_2_device_name(EMSdevice::DeviceType::TEMPERATURESENSOR));
shell.print(COLOR_RESET);
show(shell, EMSdevice::DeviceType::TEMPERATURESENSOR, true);
if (EMSESP::sensor_enabled()) {
shell.print(COLOR_BOLD_ON);
shell.print(COLOR_YELLOW);
shell.printf(" %s: ", EMSdevice::device_type_2_device_name(EMSdevice::DeviceType::TEMPERATURESENSOR));
shell.print(COLOR_RESET);
show(shell, EMSdevice::DeviceType::TEMPERATURESENSOR, true);
}

if (EMSESP::analogsensor_.analog_enabled()) {
if (EMSESP::analog_enabled()) {
shell.print(COLOR_BOLD_ON);
shell.print(COLOR_YELLOW);
shell.printf(" %s: ", EMSdevice::device_type_2_device_name(EMSdevice::DeviceType::ANALOGSENSOR));
Expand Down

0 comments on commit 2e25e46

Please sign in to comment.