mode low optional

pull/34/head
erikkaashoek 3 years ago
parent dc104f3c9f
commit fa7675efec

@ -24,23 +24,36 @@ VNA_SHELL_FUNCTION(cmd_mode)
{ {
#ifdef TINYSA3 #ifdef TINYSA3
static const char cmd_low_high[] = "low|high"; static const char cmd_low_high[] = "low|high";
#else
static const char cmd_low_high[] = "low";
#endif #endif
static const char cmd_in_out[] = "input|output"; static const char cmd_in_out[] = "input|output";
#ifdef TINYSA3
if (argc != 2) { if (argc != 2) {
usage: #else
if (argc != 1 && argc != 2) {
#endif
usage:
#ifdef TINYSA4 #ifdef TINYSA4
shell_printf("usage: mode low %s\r\n", cmd_in_out); shell_printf("usage: mode [low] %s\r\n", cmd_in_out);
#else #else
shell_printf("usage: mode %s %s\r\n", cmd_low_high,cmd_in_out); shell_printf("usage: mode %s %s\r\n", cmd_low_high,cmd_in_out);
#endif #endif
return; return;
} }
#ifdef TINYSA3 int io = 0;
int lh = get_str_index(argv[0], cmd_low_high);
#else
int lh = 0; int lh = 0;
#endif #ifdef TINYSA4
lh = get_str_index(argv[0], cmd_low_high);
if (lh != 0) {
lh = 0;
io = get_str_index(argv[0], cmd_in_out);
} else
io = get_str_index(argv[1], cmd_in_out);
#else
int lh = get_str_index(argv[0], cmd_low_high);
int io = get_str_index(argv[1], cmd_in_out); int io = get_str_index(argv[1], cmd_in_out);
#endif
if (lh < 0 || io<0) if (lh < 0 || io<0)
goto usage; goto usage;
menu_move_top(); menu_move_top();

Loading…
Cancel
Save

Powered by TurnKey Linux.