Stop auto attenuation with attunate command

tinySA-v0.2
erikkaashoek 6 years ago
parent 3493e82d83
commit 59b7d2b1ad

@ -2403,7 +2403,7 @@ THD_FUNCTION(myshellThread, p)
{
(void)p;
chRegSetThreadName("shell");
shell_printf(VNA_SHELL_NEWLINE_STR"NanoVNA Shell"VNA_SHELL_NEWLINE_STR);
shell_printf(VNA_SHELL_NEWLINE_STR"tinySA Shell"VNA_SHELL_NEWLINE_STR);
while (true) {
shell_printf(VNA_SHELL_PROMPT_STR);
if (VNAShell_readLine(shell_line, VNA_SHELL_MAX_LENGTH))
@ -2666,7 +2666,7 @@ int main(void)
myshellThread, NULL);
chThdWait(shelltp);
#else
shell_printf(VNA_SHELL_NEWLINE_STR"NanoVNA Shell"VNA_SHELL_NEWLINE_STR);
shell_printf(VNA_SHELL_NEWLINE_STR"tinySA Shell"VNA_SHELL_NEWLINE_STR);
do {
shell_printf(VNA_SHELL_PROMPT_STR);
if (VNAShell_readLine(shell_line, VNA_SHELL_MAX_LENGTH))

@ -212,16 +212,6 @@ int GetMode(void)
#define POWER_OFFSET 15
#define SWITCH_ATTENUATION 30
int get_attenuation(void)
{
if (setting.mode == M_GENLOW) {
if (setting.step_atten)
return ( -(POWER_OFFSET + setting.attenuate - (setting.step_atten-1)*POWER_STEP + SWITCH_ATTENUATION));
else
return ( -POWER_OFFSET - setting.attenuate + (setting.drive & 7) * 3);
}
return(setting.attenuate);
}
void set_auto_attenuation(void)
{
@ -234,6 +224,17 @@ void set_auto_reflevel(int v)
setting.auto_reflevel = v;
}
int get_attenuation(void)
{
if (setting.mode == M_GENLOW) {
if (setting.step_atten)
return ( -(POWER_OFFSET + setting.attenuate - (setting.step_atten-1)*POWER_STEP + SWITCH_ATTENUATION));
else
return ( -POWER_OFFSET - setting.attenuate + (setting.drive & 7) * 3);
}
return(setting.attenuate);
}
void set_attenuation(int a)
{
if (setting.mode == M_GENLOW) {
@ -262,6 +263,7 @@ void set_attenuation(int a)
a = -a;
} else {
setting.step_atten = 0;
setting.auto_attenuation = false;
}
if (a<0)
a = 0;
@ -269,7 +271,6 @@ void set_attenuation(int a)
a=31;
// if (setting.attenuate == a)
// return;
setting.auto_attenuation = false;
setting.attenuate = a;
dirty = true;
}

Loading…
Cancel
Save

Powered by TurnKey Linux.