kopia lustrzana https://github.com/Hamlib/Hamlib
rodzic
df95e93940
commit
debcc2f565
|
@ -13,18 +13,19 @@ struct ip_mreq
|
|||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include "../include/hamlib/rig.h"
|
||||
//#include "../include/hamlib/rig.h"
|
||||
|
||||
#define BUFSIZE 256
|
||||
|
||||
float freqA = 14074000;
|
||||
float freqB = 14074500;
|
||||
char tx_vfo = '0';
|
||||
char rx_vfo = '0';
|
||||
char modeA = '1';
|
||||
char modeB = '1';
|
||||
/* In hono(u)r of the 10Hz resolution of the FT-847, vfo frequencies
|
||||
* are stored in decaHertz(daHz)
|
||||
*/
|
||||
int freqs[4] = {1407400, 43510000, 43720000, 0};
|
||||
int modes[4] = {0x01, 0x02, 0x02, 0};
|
||||
char *vfoNames[4] = {"Main", "SAT Rx", "SAT Tx", "Bogus"};
|
||||
int width_main = 500;
|
||||
int width_sub = 700;
|
||||
int vfo;
|
||||
|
||||
|
||||
int
|
||||
|
@ -89,7 +90,7 @@ int openPort(char *comport) // doesn't matter for using pts devices
|
|||
int main(int argc, char *argv[])
|
||||
{
|
||||
unsigned char buf[256];
|
||||
int n;
|
||||
int freq, i, n;
|
||||
|
||||
|
||||
again:
|
||||
|
@ -109,6 +110,7 @@ again:
|
|||
{
|
||||
printf("Not 5 bytes? bytes=%d\n", bytes);
|
||||
}
|
||||
n = 0;
|
||||
|
||||
switch (buf[4])
|
||||
{
|
||||
|
@ -120,7 +122,11 @@ again:
|
|||
|
||||
case 0x88: printf("PTT OFF\n"); break;
|
||||
|
||||
case 0x07: printf("MODE\n"); break;
|
||||
case 0x07:
|
||||
case 0x17:
|
||||
case 0x27:
|
||||
modes[(buf[4] & 0x30) >> 4] = buf[0];
|
||||
printf("MODE\n"); break;
|
||||
|
||||
case 0x05: printf("CLAR ON\n"); break;
|
||||
|
||||
|
@ -148,13 +154,33 @@ again:
|
|||
|
||||
case 0xF7: printf("READ TX STATUS\n"); break;
|
||||
|
||||
case 0x01:
|
||||
case 0x11:
|
||||
case 0x21:
|
||||
freq = 0;
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
freq = freq * 100 + (((buf[i] & 0xf0) * 5) / 8) + (buf[i] & 0x0f);
|
||||
}
|
||||
freqs[(buf[4] & 0x30) >> 4] = freq;
|
||||
printf("FREQ SET = %d\n", freq * 10);
|
||||
break;
|
||||
|
||||
case 0x03:
|
||||
case 0x13:
|
||||
case 0x23:
|
||||
printf("READ RX STATUS\n");
|
||||
buf[0] = 0x01;
|
||||
buf[1] = 0x40;
|
||||
buf[2] = 0x74;
|
||||
buf[3] = 0x00;
|
||||
buf[4] = 0x03; n = write(fd, buf, 5);
|
||||
vfo = (buf[4] & 0x30) >> 4;
|
||||
freq = freqs[vfo];
|
||||
for (i = 3; i >= 0; i--)
|
||||
{
|
||||
buf[i] = freq % 10;
|
||||
freq /= 10;
|
||||
buf[i] += (freq % 10) << 4;
|
||||
freq /= 10;
|
||||
}
|
||||
buf[4] = modes[vfo];
|
||||
n = write(fd, buf, 5);
|
||||
break;
|
||||
|
||||
case 0xbb: buf[0] = buf[1] = 0; printf("READ EPROM\n"); n = write(fd, buf, 2);
|
||||
|
@ -162,6 +188,7 @@ again:
|
|||
|
||||
default: printf("Unknown cmd=%02x\n", buf[4]);
|
||||
}
|
||||
if (n < 0) {printf("Write failed - n = %d\n", n); }
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
Ładowanie…
Reference in New Issue