rfdsatt: Add 'attenuator-show' microvty command
This commit is contained in:
parent
cd97005150
commit
b94ed88133
|
@ -179,6 +179,24 @@ DEFUN(version, version_cmd, "version", "Get the firmware version")
|
|||
printf("Firmware Version: %s\r\n", GIT_VERSION);
|
||||
}
|
||||
|
||||
DEFUN(att_show, att_show_cmd, "attenuator-show", "Show state of all attenuators")
|
||||
{
|
||||
unsigned int channel;
|
||||
|
||||
for (channel = 0; channel < board_att_cfg.num_channels; channel++) {
|
||||
unsigned int stage;
|
||||
int stage_qdb[2];
|
||||
int sum_qdb = 0;
|
||||
|
||||
for (stage = 0; stage < ARRAY_SIZE(stage_qdb); stage++) {
|
||||
stage_qdb[stage] = attenuator_get(channel, stage, ATT_VAL_CURRENT);
|
||||
sum_qdb += stage_qdb[stage];
|
||||
}
|
||||
printf("Channel %02u: Stage1 %02d dB, Stage2 %02d dB, Sum %02d dB\r\n",
|
||||
channel, stage_qdb[0]/4, stage_qdb[1]/4, sum_qdb/4);
|
||||
}
|
||||
}
|
||||
|
||||
DEFUN(att_set, att_set_cmd, "attenuator-set",
|
||||
"Set an attenuator (channel, stage, dB)")
|
||||
{
|
||||
|
@ -262,6 +280,7 @@ int main(void)
|
|||
microvty_register(&reset_cmd);
|
||||
microvty_register(&uuid_cmd);
|
||||
microvty_register(&version_cmd);
|
||||
microvty_register(&att_show_cmd);
|
||||
microvty_register(&att_set_cmd);
|
||||
|
||||
print_banner();
|
||||
|
|
Loading…
Reference in New Issue