add Linux telnet keys

This commit is contained in:
MichaelDvP
2020-11-02 18:52:24 +01:00
parent a15efa4f53
commit df4f12cb96
3 changed files with 23 additions and 10 deletions

View File

@@ -213,7 +213,7 @@ void Shell::loop_normal() {
default: default:
if (esc_) { if (esc_) {
if (c == '[') { if ((c == '[') || (c == 'O')) {
// start of sequence // start of sequence
} else if (c >= '0' && (c <= '9')) { } else if (c >= '0' && (c <= '9')) {
// numbers // numbers
@@ -240,6 +240,22 @@ void Shell::loop_normal() {
cursor_++; cursor_++;
} }
esc_ = 0; esc_ = 0;
} else if (c == 'H') {
// Home
cursor_ = line_buffer_.length();
esc_ = 0;
} else if (c == 'F') {
// End
cursor_ = 0;
esc_ = 0;
} else if (c == 'P') {
// F1
set_command_str(F("help"));
esc_ = 0;
} else if (c == 'Q') {
// F2
set_command_str(F("show"));
esc_ = 0;
} else if (c == '~') { } else if (c == '~') {
// function keys with number // function keys with number
if ((esc_ == 3) && cursor_) { if ((esc_ == 3) && cursor_) {
@@ -262,8 +278,8 @@ void Shell::loop_normal() {
// F9 // F9
line_buffer_ = read_flash_string(F("send telegram \"0B \"")); line_buffer_ = read_flash_string(F("send telegram \"0B \""));
cursor_ = 1; cursor_ = 1;
} else if (esc_ == 21) { } else if (esc_ == 15) {
// F10 // F5
set_command_str(F("call system report")); set_command_str(F("call system report"));
} }
esc_ = 0; esc_ = 0;

View File

@@ -140,18 +140,14 @@ char * Helpers::render_enum(char * result, const std::vector<const __FlashString
if (no >= value.size()) { if (no >= value.size()) {
return nullptr; // out of bounds return nullptr; // out of bounds
} }
std::string str = uuid::read_flash_string(value[no]); strcpy(result, uuid::read_flash_string(value[no]).c_str());
if (bool_format() == BOOL_FORMAT_ONOFF) { if (bool_format() == BOOL_FORMAT_TRUEFALSE) {
strcpy(result, str.c_str());
} else if (bool_format() == BOOL_FORMAT_TRUEFALSE) {
if (no == 0 && uuid::read_flash_string(value[0]) == "off") { if (no == 0 && uuid::read_flash_string(value[0]) == "off") {
strlcpy(result, "false", 7); strlcpy(result, "false", 7);
} else if (no == 1 && uuid::read_flash_string(value[1]) == "on") { } else if (no == 1 && uuid::read_flash_string(value[1]) == "on") {
strlcpy(result, "true", 6); strlcpy(result, "true", 6);
} else {
strcpy(result, str.c_str());
} }
} else { } else if (bool_format() == BOOL_FORMAT_NUMBERS) {
itoa(result, no); itoa(result, no);
} }
return result; return result;

View File

@@ -26,6 +26,7 @@
#define BOOL_FORMAT_ONOFF 1 #define BOOL_FORMAT_ONOFF 1
#define BOOL_FORMAT_TRUEFALSE 2 #define BOOL_FORMAT_TRUEFALSE 2
#define BOOL_FORMAT_NUMBERS 3
namespace emsesp { namespace emsesp {