mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-16 20:59:51 +03:00
add telnet command show gpio
This commit is contained in:
@@ -100,6 +100,8 @@ static void setup_commands(std::shared_ptr<Commands> const & commands) {
|
|||||||
EMSESP::show_sensor_values(shell);
|
EMSESP::show_sensor_values(shell);
|
||||||
} else if (command == F_(mqtt)) {
|
} else if (command == F_(mqtt)) {
|
||||||
Mqtt::show_mqtt(shell);
|
Mqtt::show_mqtt(shell);
|
||||||
|
} else if (command == F_(gpio)) {
|
||||||
|
EMSESP::system_.show_gpio(shell);
|
||||||
} else {
|
} else {
|
||||||
shell.printfln("Unknown show command");
|
shell.printfln("Unknown show command");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ MAKE_WORD(ems)
|
|||||||
MAKE_WORD(devices)
|
MAKE_WORD(devices)
|
||||||
MAKE_WORD(shower)
|
MAKE_WORD(shower)
|
||||||
MAKE_WORD(mqtt)
|
MAKE_WORD(mqtt)
|
||||||
|
MAKE_WORD(gpio)
|
||||||
MAKE_WORD(modbus)
|
MAKE_WORD(modbus)
|
||||||
MAKE_WORD(emsesp)
|
MAKE_WORD(emsesp)
|
||||||
MAKE_WORD(connected)
|
MAKE_WORD(connected)
|
||||||
@@ -158,7 +159,7 @@ MAKE_WORD_CUSTOM(deviceid_mandatory, "<deviceID>")
|
|||||||
MAKE_WORD_CUSTOM(device_type_optional, "[device]")
|
MAKE_WORD_CUSTOM(device_type_optional, "[device]")
|
||||||
MAKE_WORD_CUSTOM(invalid_log_level, "Invalid log level")
|
MAKE_WORD_CUSTOM(invalid_log_level, "Invalid log level")
|
||||||
MAKE_WORD_CUSTOM(log_level_optional, "[level]")
|
MAKE_WORD_CUSTOM(log_level_optional, "[level]")
|
||||||
MAKE_WORD_CUSTOM(show_commands, "[system | users | devices | log | ems | values | mqtt | commands]")
|
MAKE_WORD_CUSTOM(show_commands, "[system | users | devices | log | ems | values | mqtt | commands | gpio]")
|
||||||
MAKE_WORD_CUSTOM(name_mandatory, "<name>")
|
MAKE_WORD_CUSTOM(name_mandatory, "<name>")
|
||||||
MAKE_WORD_CUSTOM(name_optional, "[name]")
|
MAKE_WORD_CUSTOM(name_optional, "[name]")
|
||||||
MAKE_WORD_CUSTOM(new_password_prompt1, "Enter new password: ")
|
MAKE_WORD_CUSTOM(new_password_prompt1, "Enter new password: ")
|
||||||
|
|||||||
@@ -1015,6 +1015,22 @@ void System::show_users(uuid::console::Shell & shell) {
|
|||||||
shell.println();
|
shell.println();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// print GPIO available and used pins to console
|
||||||
|
void System::show_gpio(uuid::console::Shell & shell) {
|
||||||
|
shell.printfln("GPIO:");
|
||||||
|
shell.printf(" In use (%d):", used_gpios_.size());
|
||||||
|
for (const auto & gpio : used_gpios_) {
|
||||||
|
shell.printf(" %d", gpio);
|
||||||
|
}
|
||||||
|
shell.println();
|
||||||
|
auto available = available_gpios();
|
||||||
|
shell.printf(" Available (%d):", available.size());
|
||||||
|
for (const auto & gpio : available) {
|
||||||
|
shell.printf(" %d", gpio);
|
||||||
|
}
|
||||||
|
shell.println();
|
||||||
|
}
|
||||||
|
|
||||||
// shell command 'show system'
|
// shell command 'show system'
|
||||||
void System::show_system(uuid::console::Shell & shell) {
|
void System::show_system(uuid::console::Shell & shell) {
|
||||||
refreshHeapMem(); // refresh free heap and max alloc heap
|
refreshHeapMem(); // refresh free heap and max alloc heap
|
||||||
|
|||||||
@@ -300,8 +300,10 @@ class System {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void show_system(uuid::console::Shell & shell);
|
void show_system(uuid::console::Shell & shell);
|
||||||
void wifi_reconnect();
|
|
||||||
void show_users(uuid::console::Shell & shell);
|
void show_users(uuid::console::Shell & shell);
|
||||||
|
void show_gpio(uuid::console::Shell & shell);
|
||||||
|
|
||||||
|
void wifi_reconnect();
|
||||||
|
|
||||||
static std::string languages_string();
|
static std::string languages_string();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user