예제 #1
0
파일: ft991.c 프로젝트: DF4OR/hamlib
/*
 * rig_get_split_vfo*
 *
 * Get split mode status for a given VFO
 *
 * Parameter     | Type   | Accepted/Expected Values
 * -------------------------------------------------------------------------
 *   RIG *      | input  | pointer to private data
 *   vfo        | input  | currVFO, Main, VFO, VFOA, VFOB, MEM
 *   split *    | output | 0 = on, 1 = off
 *   tx_vfo *   | output | VFOA, VFOB
 * -------------------------------------------------------------------------
 * Returns RIG_OK on success or an error code on failure
 *
 * Comments: The passed value for the vfo is ignored since can only split one way
 */
int ft991_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo)
{
    struct newcat_priv_data *priv;
    int err;

    rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);

    if (!rig)
        return -RIG_EINVAL;

    rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);

    priv = (struct newcat_priv_data *)rig->state.priv;

    snprintf(priv->cmd_str, sizeof(priv->cmd_str), "FT;");
    if (RIG_OK != (err = newcat_get_cmd (rig)))
        return err;

    // Get split mode status
    *split = priv->ret_data[2]=='1'; // 1=VFOB TX so is in split mode
    rig_debug(RIG_DEBUG_TRACE, "%s: get split = 0x%02x\n", __func__, *split);

    *tx_vfo = RIG_VFO_A;
    if (*split) *tx_vfo = RIG_VFO_B;
    rig_debug(RIG_DEBUG_TRACE, "%s: get tx_vfo = 0x%02x\n", __func__, *tx_vfo);

    return RIG_OK;
}
예제 #2
0
파일: ft991.c 프로젝트: mdblack98/hamlib
int ft991_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode, pbwidth_t tx_width)
{
    struct newcat_priv_data *priv;
    struct rig_state *state;
    int err;
    char restore_commands[NEWCAT_DATA_LEN];

    rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);

    if (!rig)
        return -RIG_EINVAL;
    state = &rig->state;

    rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
    rig_debug(RIG_DEBUG_TRACE, "%s: passed mode = %i\n", __func__, tx_mode);
    rig_debug(RIG_DEBUG_TRACE, "%s: passed width = %li Hz\n", __func__, tx_width);

    priv = (struct newcat_priv_data *)state->priv;

    /* append VFO A mode restore command first as we want to minimize
       any Rx glitches */
    snprintf(priv->cmd_str, sizeof(priv->cmd_str), "MD0;");
    rig_debug(RIG_DEBUG_TRACE, "cmd_str = %s\n", priv->cmd_str);
    if (RIG_OK != (err = newcat_get_cmd (rig)))
      {
        return err;
      }
    snprintf(restore_commands, sizeof(restore_commands), "AB;%.*s",(int)sizeof(restore_commands)-4,priv->ret_data);

    /* append VFO B frequency restore command */
    snprintf(priv->cmd_str, sizeof(priv->cmd_str), "FB;");
    rig_debug(RIG_DEBUG_TRACE, "cmd_str = %s\n", priv->cmd_str);
    if (RIG_OK != (err = newcat_get_cmd (rig)))
      {
        return err;
      }
    strncpy(restore_commands, priv->ret_data, NEWCAT_DATA_LEN);

    /* Change mode on VFOA */
    if (RIG_OK != (err = newcat_set_mode (rig, RIG_VFO_A, tx_mode, RIG_PASSBAND_NOCHANGE)))
      {
        return err;
      }
    /* Send the copy VFO A to VFO B and restore commands */
    snprintf(priv->cmd_str, sizeof(priv->cmd_str), "%s", restore_commands);
    return newcat_set_cmd (rig);
}
예제 #3
0
파일: ft991.c 프로젝트: DF4OR/hamlib
int ft991_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
{
  struct newcat_priv_data *priv;
  int err;

  // FT991 can't set VFOB mode directly so we always set VFOA
  // We will always make VFOB match VFOA mode
  newcat_set_mode(rig, RIG_VFO_A, mode, width);

  priv = (struct newcat_priv_data *)rig->state.priv;

  // Copy A to B
  snprintf(priv->cmd_str, sizeof(priv->cmd_str), "AB;");
  if (RIG_OK != (err = newcat_get_cmd (rig)))
    return err;
  return RIG_OK;
}
예제 #4
0
파일: ft991.c 프로젝트: DF4OR/hamlib
int ft991_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode, pbwidth_t *tx_width)
{
    struct newcat_priv_data *priv;
    int err;

    rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);

    if (!rig)
        return -RIG_EINVAL;

    priv = (struct newcat_priv_data *)rig->state.priv;

    snprintf(priv->cmd_str, sizeof(priv->cmd_str), "OI;");
    if (RIG_OK != (err = newcat_get_cmd (rig)))
        return err;
    *tx_mode = priv->ret_data[22];

    return RIG_OK;
}
예제 #5
0
파일: ft991.c 프로젝트: DF4OR/hamlib
int ft991_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode, pbwidth_t tx_width)
{
    struct newcat_priv_data *priv;
    struct rig_state *state;
    int err;

    rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);

    if (!rig)
        return -RIG_EINVAL;
    state = &rig->state;

    rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
    rig_debug(RIG_DEBUG_TRACE, "%s: passed mode = %i\n", __func__, tx_mode);
    rig_debug(RIG_DEBUG_TRACE, "%s: passed width = %li Hz\n", __func__, tx_width);

    priv = (struct newcat_priv_data *)rig->state.priv;

    // Change mode on VFOA and make VFOB match VFOA
    if (RIG_OK != (err = newcat_set_mode(rig,RIG_VFO_A,tx_mode,tx_width))) {
        return err;
    }
    // Copy A to B
    snprintf(priv->cmd_str, sizeof(priv->cmd_str), "AB;");
    if (RIG_OK != (err = write_block(&state->rigport, priv->cmd_str, strlen(priv->cmd_str))))
      {
        rig_debug(RIG_DEBUG_VERBOSE, "%s:%d write_block err = %d\n", __func__, __LINE__, err);
        return err;
      }

#if 0
    if (RIG_OK != (err = newcat_get_cmd (rig)))
        return err;
#endif
    return RIG_OK;
}