Menu

Howto reset Attenuator?

Help
2006-10-14
2013-01-15
  • Goran Sandin (SM6PPS)

    Hi,

    the rig in question have 10 and 20 as defined values.

    Code below is from aor.c

    rigctl works if I change 'L ATT' and gives 10 or 20. But I can't figure out what parameter to give to reset attenuator to 0dB.

    If I give 0 as value, then it is caught by the last IF-case and an error is returned.

    Have I missed something obvious here?

    /Göran

        switch (level) {
        case RIG_LEVEL_ATT:
            {
            unsigned att = 0;
            for (i=0; i<MAXDBLSTSIZ && !RIG_IS_DBLST_END(rs->attenuator[i]); i++) {
                if (rs->attenuator[i] == val.i) {
                    att = i+1;
                    break;
                }
            }

            /* should be catched by the front end */
            if (i>=MAXDBLSTSIZ || RIG_IS_DBLST_END(rs->attenuator[i]))
                return -RIG_EINVAL;

            lvl_len = sprintf(lvlbuf, "AT%u" EOM, att);
            break;
            }

     
    • Alexandru Csete

      Alexandru Csete - 2006-10-15

      I'd say it is a bug in the backend since there is no  other way to reset ATT or PREAMP other than passing 0 as parameter.

      Alex

       
    • Martin Ewing, AA6E

      Yes, there is an error.  The second if (error check) does not allow the valid case val.i ==0.

      A correct test would (probably) be

      if ( (val.i>0) & (i >= ...) ) return -RIG_EINVAL;

      Who is the maintainer of aor.c?

      -73 Martin AA6E

       
    • Martin Ewing, AA6E

      I made a fix and updated CVS. Please test it.

      73 Martin AA6E

       
    • Goran Sandin (SM6PPS)

      I will test it. When/if I can figure out how to use CVS to retreive the code.

      A hint on this would be appreciated. I'm using linux and compiled the hamlib-1.2.5 release.

      I am playing a little with an AR5000A version. I don't have any specs on the AR5000 (without A) so I don't know what the differences are except the frequency range.

      73 de SM6PPS /Göran

       
      • Martin Ewing, AA6E

        As you may have discovered, the procedure for anonymous CVS access is given under the "CVS" tab at hamlib.sourceforge.net.  There is a lot more info on CVS provided on sourceforge.net's help system, if you need it.

        73 Martin AA6E

         
    • Goran Sandin (SM6PPS)

      Hi Martin,

      I have tested your change now. It looks like it works OK :-)

      Thanks for you help.

      73 de SM6PPS /Göran

       
    • Goran Sandin (SM6PPS)

      Yes I found this http://cvsbook.red-bean.com/cvsbook.html page and took it from there. Didn't read all of it at this time though :-)

      How do I contribute with more?  It looked very easy for you to apply this minor change.

      I don't know how far I will come, but I started to work on code for an AR5000A. This requied some changes in a few other file according to #3 in README.developer.

      In the not yet release ar5000a.c I found an error that for sure also will affect users of ar5000.c

      The aor.c as you changed have a function called aor_get_level with three possible cases.

      This patch can/should(?) be applied on ar5000.c

      37c37
      < #define AR5000_LEVEL (RIG_LEVEL_ATT|RIG_LEVEL_AGC|RIG_LEVEL_SQL|RIG_LEVEL_RAWSTR)
      ---
      > #define AR5000_LEVEL (RIG_LEVEL_ATT|RIG_LEVEL_AGC|RIG_LEVEL_RAWSTR)

      grig-0.7.1 tried to use the RIG_LEVEL_SQL parameter and spitted out errors about this quite often :-)  Looks better now. But since I haven't seen what it tried to do I don't know how it should work instead. I.e. 'grig' should probably try to use the get_dcd function instead...

      73 de SM6PPS /Göran

       
      • Martin Ewing, AA6E

        Göran -

        It might be better to use the sourceforge.net documentation about CVS, because their material describes the actual services available on their servers.

        If you want to participate more, I recommend you join the hamlib-developers mail list (via hamlib.sourceforge.net).  That's where most of the discussion happens.

        I will apply your suggested patch.

        73 Martin AA6E

         

Log in to post a comment.