Logo Search packages:      
Sourcecode: hamlib version File versions  Download package

static int tt565_set_ant ( RIG rig,
vfo_t  vfo,
ant_t  ant 
)

Antenna selection for Orion.

Parameters:
rig!= NULL
vfo
antantenna identifier RIG_ANT_1 or RIG_ANT_2
Returns:
RIG_OK or < 0 We support Ant_1 and Ant_2 for M and S receivers.
Note that Rx-only antenna (Ant_3?) is not supported at this time.
Orion command assigns MSBN (main rtx, sub rx, both, or none) to each ant, but hamlib wants to assign an ant to rx/tx! The efficient way would be to keep current config in rig priv area, but we will ask the rig what its state is each time...

Definition at line 1717 of file orion.c.

References EOM, rig_debug(), RIG_DEBUG_ERR, RIG_EPROTO, RIG_OK, tt565_transaction(), and which_receiver().

{
        char respbuf[TT565_BUFSIZE];
        int resp_len, retval;
            ant_t main_ant, sub_ant;

            /* First, find out what antenna config is now. */
            resp_len = sizeof(respbuf);
            retval = tt565_transaction (rig, "?KA" EOM, 4, respbuf, &resp_len);
                if (retval != RIG_OK)
                                return retval;
            if (resp_len != 7 || respbuf[1] != 'K' || respbuf[2] != 'A') {
                  rig_debug(RIG_DEBUG_ERR,"%s; tt565_set_ant: ?KA NG %s\n", 
                        __FUNCTION__, respbuf);
                  return -RIG_EPROTO;
            }

            /* respbuf="@KAxxx"
             * x='M'|'S'|'B'|'N'=main/sub/both/none for ants 1,2,3. 
             * but hardware will not permit all combinations!
             * respbuf [3,4] can be MS, SM, BN, NB
             * decode to rx-centric view 
             */
            if (respbuf[3] == 'M' || respbuf[3] == 'B') main_ant = RIG_ANT_1;
                  else main_ant = RIG_ANT_2;
            if (respbuf[3] == 'S' || respbuf[3] == 'B') sub_ant = RIG_ANT_1;
                  else sub_ant = RIG_ANT_2;
            switch (which_receiver(rig,vfo)) {
                  case 'M':
                        main_ant = ant;
                        break;
                  case 'S':
                        sub_ant = ant;
                        break;
                  default: {
                        /* no change? */
                  }
            }
            /* re-encode ant. settings into command */
            if (main_ant == RIG_ANT_1) {
                  if (sub_ant == RIG_ANT_1) {
                              respbuf[3] = 'B';
                              respbuf[4] = 'N';
                  }
                        else {
                              respbuf[3] = 'M';
                              respbuf[4] = 'S';
                        }
            }
            else if (sub_ant == RIG_ANT_2) {
                              respbuf[3] = 'N';
                              respbuf[4] = 'B';
                  }
                        else {
                              respbuf[3] = 'S';
                              respbuf[4] = 'M';
                        }
            respbuf[0] = '*'; /* respbuf becomes a store command */
            respbuf[5] = 'N'; /* Force no rx on Ant 3 */
            respbuf[6] = EOM[0];
            respbuf[7] = 0;
                retval = tt565_transaction (rig, respbuf, 7, NULL, NULL); 
                if (retval != RIG_OK)
                                return retval;
                return RIG_OK;
}

Here is the call graph for this function:


Generated by  Doxygen 1.6.0   Back to index