forked from electronics/osmo-opencm3-projects
rfdsatt: add 'test' command for ramping up the gain of one channel
This commit is contained in:
parent
1adf7c0ee4
commit
60499f4ebf
|
@ -275,6 +275,42 @@ DEFUN(interact, interact_cmd, "interact", "Enter interactive single-key mode")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEFUN(test, test_cmd, "test", "Enter interactive test-ramp mode")
|
||||||
|
{
|
||||||
|
uint8_t g_chan = 0;
|
||||||
|
uint8_t g_stage = 0;
|
||||||
|
uint8_t g_val = 0;
|
||||||
|
|
||||||
|
printf("Entering interactive test-ramp mode. Press 'X' for exit\r\n");
|
||||||
|
|
||||||
|
while (1) {
|
||||||
|
int ch, rc;
|
||||||
|
if ((ch = getchar()) != EOF) {
|
||||||
|
switch (ch) {
|
||||||
|
case 'X': /* exit */
|
||||||
|
return;
|
||||||
|
case '1': case '2': case '3': case '4': /* channel number */
|
||||||
|
g_chan = ch - '1';
|
||||||
|
g_val = 0;
|
||||||
|
break;
|
||||||
|
case '0': /* set to 0dB */
|
||||||
|
g_val = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (g_val < 60)
|
||||||
|
g_val += 10;
|
||||||
|
else
|
||||||
|
g_val = 0;
|
||||||
|
|
||||||
|
rc = attenuator_chan_set(g_chan, g_val*4, false);
|
||||||
|
if (rc < 0)
|
||||||
|
printf("Error setting attenuator: %d\r\n", rc);
|
||||||
|
|
||||||
|
msleep(500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* main
|
* main
|
||||||
|
@ -341,6 +377,7 @@ int main(void)
|
||||||
microvty_register(&att_show_cmd);
|
microvty_register(&att_show_cmd);
|
||||||
microvty_register(&att_set_cmd);
|
microvty_register(&att_set_cmd);
|
||||||
microvty_register(&interact_cmd);
|
microvty_register(&interact_cmd);
|
||||||
|
microvty_register(&test_cmd);
|
||||||
|
|
||||||
print_banner();
|
print_banner();
|
||||||
microvty_print_prompt();
|
microvty_print_prompt();
|
||||||
|
|
Loading…
Reference in New Issue