TX power control does not work

txPower

The only problem is that TX power control does not work.

The echo back comes back, but it contains only 6 bytes instead of 9 bytes. The remaining 3 bytes are received with the next read command, with which an “FB” response is expected.

txPower2

TX power control works fine with Flrig, and if I change the subcommand from “0A” to “09” or “0B”, the echo back is OK.

txPower3

Because “0x0a” is a Line Feed character, or a New Line, and has a meaning of End Of Line (EOL) by default, some care might be required.

void serial_init(void) {
  struct termios tio;
  memset(&tio, 0, sizeof(tio));
  tio.c_cflag     = CS8 | CLOCAL | CREAD;
  tio.c_cc[VTIME] = 0;
  tio.c_cc[VEOL ] = 0xfd; /* IC-7410 postamble */
  tio.c_lflag     = ICANON; 
  tio.c_iflag     = IGNPAR | ICRNL;
  cfsetispeed(&tio, BAUDRATE);
  cfsetospeed(&tio, BAUDRATE);
  tcsetattr  (fd, TCSANOW, &tio);
}

I thought setting a VEOL character overrides the existing EOL character, 0x0a, but it seems not. There should be some way to treat 0x0a as a normal character, but in the meanwhile, here is a dirty hack.

 n_echoback = read(fd, echoback, 255); /* get echo back */
 if(echoback[n_echoback-1] == 0x0a) {  /* if it ends with "0x0a" */
  n_echoback2 = read(fd, echoback2, 255); /* get the rest */
  for(int i=0;i<n_echoback2;i++) {
   echoback[n_echoback+i]=echoback2[i];   /* and append */
  }
  n_echoback += n_echoback2;
 }

DSP Filters and 1st IF Filters

dspfilter

With IC-7410, we have three DSP filters with different settings of passband width and three 1st IF filters. The “IF FIL1 (15kHz)” is always there, but other two (6kHz and 3kHz) are optional, and I only have the narrower one (FL-431) for my CW operations.

FL-431_500x623

http://www.icomuk.co.uk/categoryRender.asp?categoryID=3764&productID=1145&tID=673

So it is quite right that I receive an “FA” instead of an “FB” message, when I selected “IF FIL2”, which is now written in small letters so that I will remember that I do not have one.

opMode

Since there is only one command for setting both the operating mode and the (DSP) filter, the code becomes somthing like:

  if(g_strcmp0((char *) data, "CW") == 0) {
   operating_mode = 3;
   set_operating_mode();
  }

  if(g_strcmp0((char *) data, "DSP FIL1") == 0) {
   dsp_filter = 1;
   set_operating_mode();
  }

void set_operating_mode(void) {
  static unsigned char command1 [8] = {0xfe, 0xfe, 0x80, 0xe0, 0x06, 0x03, 0x01, 0xfd};

  command1[5] = operating_mode;
  command1[6] = dsp_filter;;
  send_command(command1);
  receive_fb();
}