Make FR & FT commands aware of new vfo structs.

Get rid of vfo_rx & vfo_tx; find both thru vfoLR.
pull/1626/head
George Baltz N3GB 2024-10-29 14:38:19 -04:00
rodzic da5e490b24
commit ab883be850
1 zmienionych plików z 42 dodań i 20 usunięć

Wyświetl plik

@ -36,7 +36,7 @@ int mysleep = 20;
int filternum1 = 7; int filternum1 = 7;
int filternum2 = 8; int filternum2 = 8;
int vfo_rx, vfo_tx, ptt, ptt_data, ptt_mic, ptt_tune; int ptt, ptt_data, ptt_mic, ptt_tune;
int keyspd = 20; int keyspd = 20;
int sl=3, sh=3; int sl=3, sh=3;
int nr=0; int nr=0;
@ -434,7 +434,7 @@ int main(int argc, char *argv[])
{ {
int temp = -1; int temp = -1;
sscanf(buf + 8, "%3d", &temp); sscanf(buf + 8, "%3d", &temp);
if (temp < 2 && temp >= 0) if (temp <= 2 && temp >= 0)
{ nummems = temp * 2 + 1; } { nummems = temp * 2 + 1; }
else else
{ cmd_err = 1; } { cmd_err = 1; }
@ -535,26 +535,48 @@ int main(int argc, char *argv[])
*vfoAB[tmpvfo] = nvfo; *vfoAB[tmpvfo] = nvfo;
printf("modeA=%X, modeB=%X\n", vfoA->mode, vfoB->mode); printf("modeA=%X, modeB=%X\n", vfoA->mode, vfoB->mode);
} }
else if (strcmp(buf, "FR;") == 0)
{
snprintf(buf, sizeof(buf), "FR%d;", vfo_rx);
OUTPUT(buf);
}
else if (strncmp(buf, "FR", 2) == 0) else if (strncmp(buf, "FR", 2) == 0)
{ { // Receiver Function (VFO A / VFO B / Memory channel)
sscanf(buf, "FR%d", &vfo_rx); int idx;
}
else if (strcmp(buf, "FT;") == 0) if (buf[2] == ';')
{ { // Read
snprintf(buf, sizeof(buf), "FT%d;", vfo_tx); idx = sp && tfset;
OUTPUT(buf); snprintf(buf, sizeof(buf), "FR%d;", (*vfoLR[idx])->vfo);
OUTPUT(buf);
}
else
{ // Set
idx = buf[2] - '0';
if (idx == 3)
{ //TODO: Memory channels are a long way off
puts("Memory channels not implemented.\n");
cmd_err = 3;
continue;
}
if (idx < 0 || idx > 1) {cmd_err = 1; continue; }
sp = 0; // Turn off split
if ((*vfoLR[0])->vfo != idx) // If the selected vfo is not the operational one
{
swapvfos(vfoLR); // Make it so
}
}
} }
else if (strncmp(buf, "FT", 2) == 0) else if (strncmp(buf, "FT", 2) == 0)
{ { // Transmitter Function ( VFO A / VFO B )
sscanf(buf, "FT%d", &vfo_tx); int idx;
if (vfo_tx != vfo_rx)
{ if (buf[2] == ';')
sp = 1; { // Read
idx = sp && !tfset;
snprintf(buf, sizeof(buf), "FT%d;", (*vfoLR[idx])->vfo);
OUTPUT(buf);
}
else
{ // Set
idx = buf[2] - '0';
if (idx < 0 || idx > 1) {cmd_err = 1; continue; }
sp = idx != (*vfoLR[0])->vfo; // Turn split on if vfos differ, else off
} }
} }
else if (buf[0] == 'B' && (buf[1] == 'D' || buf[1] == 'U')) // BU/BD else if (buf[0] == 'B' && (buf[1] == 'D' || buf[1] == 'U')) // BU/BD
@ -678,7 +700,7 @@ int main(int argc, char *argv[])
/* This section needs a lot of work, and a lot /* This section needs a lot of work, and a lot
* of cooperation from other commands. * of cooperation from other commands.
* AFAICT the split freq can be set by spinning * AFAICT the split freq can be set by spinning
* the big knob, or by other means. When oper=1 * the big knob, or by other means. When oper=0
* is sent, the current freq is used as the split * is sent, the current freq is used as the split
* value. See page 5-1 of the IM, blinking SPLIT * value. See page 5-1 of the IM, blinking SPLIT
*/ */