Beispiel #1
0
        public void KeyThread()
        {
            //SetThreadAffinity(1);
            bool extkey_dash, extkey_dot, keyprog;

            do
            {
                DttSP.KeyerStartedWait();
                for (; DttSP.KeyerRunning();)
                {
                    keyprog = false;
                    timer.Start();
                    DttSP.PollTimerWait();
                    switch (primary_conn_port)
                    {
                    case "SDR":
                        byte b = hw.StatusPort();
                        extkey_dash = ((b & (byte)StatusPin.Dash) != 0);
                        extkey_dot  = ((b & (byte)StatusPin.Dot) != 0);
                        break;

                    case "Radio":
                        extkey_dot  = fwc_dot;
                        extkey_dash = fwc_dash;
                        break;

                    default:                             // COM port
                        extkey_dash = sp.CtsHolding;
                        extkey_dot  = sp.DsrHolding;
                        break;
                    }

                    // handle CWX
                    if (!extkey_dash && !extkey_dot)
                    {
                        if (memoryptt)
                        {
                            //console ptt on
                            keyprog    = true;
                            extkey_dot = extkey_dash = memorykey;
                        }
                        else
                        {
                            //console ptt off
                            keyprog = false;
                        }
                    }

                    if (!extkey_dash && !extkey_dot)                     // don't override primary
                    {
                        switch (secondary_conn_port)
                        {
                        case "None":
                            break;

                        case "CAT":
                            switch (secondary_ptt_line)
                            {
                            case KeyerLine.NONE:
                                if (sp2dotkey)
                                {
                                    extkey_dash = siolisten.SIO.isDSR();
                                }
                                else
                                {
                                    extkey_dot = siolisten.SIO.isCTS();
                                }
                                break;

                            case KeyerLine.DTR:                                     // look at DSR since we are on the other side of the null modem cable
                                keyerptt = siolisten.SIO.isDSR();
                                //										extkey_dot = System.Convert.ToByte(sp2.CtsHolding);
                                break;

                            case KeyerLine.RTS:                                     // look at CTS since we are on the other side of the null modem cable
                                keyerptt = siolisten.SIO.isCTS();
                                //										extkey_dash  = System.Convert.ToByte(sp2.DsrHolding);
                                break;
                            }

                            switch (secondary_key_line)
                            {
                            case KeyerLine.NONE:
                                if (sp2dotkey)
                                {
                                    extkey_dash = siolisten.SIO.isDSR();
                                }
                                else
                                {
                                    extkey_dot = siolisten.SIO.isCTS();
                                }
                                break;

                            case KeyerLine.DTR:                                     // look at DSR since we are on the other side of the null modem cable
                                extkey_dot = siolisten.SIO.isDSR();
                                //										Debug.WriteLine("extkey_dot: "+extkey_dot);
                                break;

                            case KeyerLine.RTS:                                     // look at CTS since we are on the other side of the null modem cable
                                extkey_dash = siolisten.SIO.isCTS();
                                break;
                            }

                            //								if (extkey_dash || extkey_dot)
                            //									keyprog = true;
                            //								else keyprog = false;
                            //								//Debug.WriteLine("keyprog: "+keyprog);
                            break;

#if false
                        // wjtFIXME!! - merged from KD5TFD's HPSDR 1.6.3 tree - sr xmit
                        case "BB-PTT":
                            Console c = Console.getConsole();


                            if ((extkey_dash == 0) && (extkey_dot == 0))                           // don't override primary
                            {
                                switch (secondary_ptt_line)
                                {
                                case KeyerLine.NONE:
                                    if (sp2dotkey)
                                    {
                                        extkey_dash = System.Convert.ToByte(c.serialPTT.isDSR());
                                    }
                                    else
                                    {
                                        extkey_dot = System.Convert.ToByte(c.serialPTT.isCTS());
                                    }
                                    break;

                                case KeyerLine.DTR:                                         // look at DSR since we are on the other side of the null modem cable
                                    keyerptt = c.serialPTT.isDSR();
                                    //										extkey_dot = System.Convert.ToByte(sp2.CtsHolding);
                                    break;

                                case KeyerLine.RTS:                                         // look at CTS since we are on the other side of the null modem cable
                                    keyerptt = c.serialPTT.isCTS();
                                    //										extkey_dash  = System.Convert.ToByte(sp2.DsrHolding);
                                    break;
                                }

                                switch (secondary_key_line)
                                {
                                case KeyerLine.NONE:
                                    if (sp2dotkey)
                                    {
                                        extkey_dash = System.Convert.ToByte(c.serialPTT.isDSR());
                                    }
                                    else
                                    {
                                        extkey_dot = System.Convert.ToByte(c.serialPTT.isCTS());
                                    }
                                    break;

                                case KeyerLine.DTR:                                         // look at DSR since we are on the other side of the null modem cable
                                    extkey_dot = System.Convert.ToByte(c.serialPTT.isDSR());
                                    //										Debug.WriteLine("extkey_dot: "+extkey_dot);
                                    break;

                                case KeyerLine.RTS:                                         // look at CTS since we are on the other side of the null modem cable
                                    extkey_dash = System.Convert.ToByte(c.serialPTT.isCTS());
                                    break;
                                }

                                if ((extkey_dash + extkey_dot) != 0)
                                {
                                    keyprog = 1;
                                }
                                else
                                {
                                    keyprog = 0;
                                }
                                //								Debug.WriteLine("keyprog: "+keyprog);
                            }
                            else
                            {
                                keyprog = 0;
                            }
                            break;
#endif

                        default:                                 // comm port
                            switch (secondary_ptt_line)
                            {
                            case KeyerLine.NONE:
                                if (sp2dotkey)
                                {
                                    extkey_dash = sp2.DsrHolding;
                                }
                                else
                                {
                                    extkey_dot = sp2.CtsHolding;
                                }
                                break;

                            case KeyerLine.DTR:                                     // look at DSR since we are on the other side of the null modem cable
                                keyerptt = sp2.DsrHolding;
                                break;

                            case KeyerLine.RTS:                                     // look at CTS since we are on the other side of the null modem cable
                                keyerptt = sp2.CtsHolding;
                                break;
                            }

                            switch (secondary_key_line)
                            {
                            case KeyerLine.NONE:
                                if (sp2dotkey)
                                {
                                    extkey_dash = sp2.DsrHolding;
                                }
                                else
                                {
                                    extkey_dot = sp2.CtsHolding;
                                }
                                break;

                            case KeyerLine.DTR:                                     // look at DSR since we are on the other side of the null modem cable
                                extkey_dot = sp2.DsrHolding;
                                //										Debug.WriteLine("extkey_dot: "+extkey_dot);
                                break;

                            case KeyerLine.RTS:                                     // look at CTS since we are on the other side of the null modem cable
                                extkey_dash = sp2.CtsHolding;
                                break;
                            }

                            break;
                        }
                        if (extkey_dash || extkey_dot)
                        {
                            keyprog = true;
                        }
                        else
                        {
                            keyprog = false;
                        }
                        //Debug.WriteLine("keyprog: "+keyprog);
                    }
                    timer.Stop();
                    msdel = (float)timer.DurationMsec;
                    //Debug.WriteLine("Dash: "+extkey_dash+" Dot: "+extkey_dot);
                    DttSP.KeyValue(msdel, extkey_dash, extkey_dot, keyprog);
                }
            } while(threads_running);
        }
Beispiel #2
0
        public void KeyThread()
        {
            byte extkey_dash, extkey_dot;

            do
            {
                DttSP.KeyerStartedWait();
                for (; DttSP.KeyerRunning() != 0;)
                {
                    byte keyprog = 0;
                    timer.Start();
                    DttSP.PollTimerWait();
                    switch (primary_conn_port)
                    {
                    case "SDR":
                        byte b = hw.StatusPort();
                        extkey_dash = (byte)(((b & (byte)StatusPin.Dash) != 0) ? 1:0);
                        extkey_dot  = (byte)(((b & (byte)StatusPin.Dot) != 0) ? 1:0);
                        break;

                    default:                             // COM port
                        extkey_dash = System.Convert.ToByte(sp.CtsHolding);
                        extkey_dot  = System.Convert.ToByte(sp.DsrHolding);
                        break;
                    }

                    // [patch_16
                    // M0PUB : also allow keying via USB-connected AVR processor, running DG8SAQ firmware
                    if ((extkey_dash == 0) && (extkey_dot == 0))                     // don't override primary
                    {
                        extkey_dot = extkey_dash = Console.GetDG8SAQkeyStatus();
                    }
                    // patch_16]

                    if (memoryptt)
                    {
                        //console ptt on
                        keyprog    = 1;
                        extkey_dot = extkey_dash = System.Convert.ToByte(memorykey);
                    }
                    else
                    {
                        keyprog = 0;
                        //console ptt off
                    }
                    switch (secondary_conn_port)
                    {
                    case "None":
                        break;

                    case "CAT":
                        if ((extkey_dash == 0) && (extkey_dot == 0))                               // don't override primary
                        {
                            switch (secondary_ptt_line)
                            {
                            case KeyerLine.NONE:
                                if (sp2dotkey)
                                {
                                    extkey_dash = System.Convert.ToByte(siolisten.SIO.isDSR());
                                }
                                else
                                {
                                    extkey_dot = System.Convert.ToByte(siolisten.SIO.isCTS());
                                }
                                break;

                            case KeyerLine.DTR:                                             // look at DSR since we are on the other side of the null modem cable
                                keyerptt = siolisten.SIO.isDSR();
                                //										extkey_dot = System.Convert.ToByte(sp2.CtsHolding);
                                break;

                            case KeyerLine.RTS:                                             // look at CTS since we are on the other side of the null modem cable
                                keyerptt = siolisten.SIO.isCTS();
                                //										extkey_dash  = System.Convert.ToByte(sp2.DsrHolding);
                                break;
                            }

                            switch (secondary_key_line)
                            {
                            case KeyerLine.NONE:
                                if (sp2dotkey)
                                {
                                    extkey_dash = System.Convert.ToByte(siolisten.SIO.isDSR());
                                }
                                else
                                {
                                    extkey_dot = System.Convert.ToByte(siolisten.SIO.isCTS());
                                }
                                break;

                            case KeyerLine.DTR:                                             // look at DSR since we are on the other side of the null modem cable
                                extkey_dot = System.Convert.ToByte(siolisten.SIO.isDSR());
                                //										Debug.WriteLine("extkey_dot: "+extkey_dot);
                                break;

                            case KeyerLine.RTS:                                             // look at CTS since we are on the other side of the null modem cable
                                extkey_dash = System.Convert.ToByte(siolisten.SIO.isCTS());
                                break;
                            }

                            if ((extkey_dash + extkey_dot) != 0)
                            {
                                keyprog = 1;
                            }
                            else
                            {
                                keyprog = 0;
                            }
                            //								Debug.WriteLine("keyprog: "+keyprog);
                        }
                        else
                        {
                            keyprog = 0;
                        }

                        break;

                    default:                                         // comm port
                        if ((extkey_dash == 0) && (extkey_dot == 0)) // don't override primary
                        {
                            switch (secondary_ptt_line)
                            {
                            case KeyerLine.NONE:
                                if (sp2dotkey)
                                {
                                    extkey_dash = System.Convert.ToByte(sp2.DsrHolding);
                                }
                                else
                                {
                                    extkey_dot = System.Convert.ToByte(sp2.CtsHolding);
                                }
                                break;

                            case KeyerLine.DTR:                                             // look at DSR since we are on the other side of the null modem cable
                                keyerptt = sp2.DsrHolding;
//										extkey_dot = System.Convert.ToByte(sp2.CtsHolding);
                                break;

                            case KeyerLine.RTS:                                             // look at CTS since we are on the other side of the null modem cable
                                keyerptt = sp2.CtsHolding;
//										extkey_dash  = System.Convert.ToByte(sp2.DsrHolding);
                                break;
                            }

                            switch (secondary_key_line)
                            {
                            case KeyerLine.NONE:
                                if (sp2dotkey)
                                {
                                    extkey_dash = System.Convert.ToByte(sp2.DsrHolding);
                                }
                                else
                                {
                                    extkey_dot = System.Convert.ToByte(sp2.CtsHolding);
                                }
                                break;

                            case KeyerLine.DTR:                                             // look at DSR since we are on the other side of the null modem cable
                                extkey_dot = System.Convert.ToByte(sp2.DsrHolding);
//										Debug.WriteLine("extkey_dot: "+extkey_dot);
                                break;

                            case KeyerLine.RTS:                                             // look at CTS since we are on the other side of the null modem cable
                                extkey_dash = System.Convert.ToByte(sp2.CtsHolding);
                                break;
                            }

                            if ((extkey_dash + extkey_dot) != 0)
                            {
                                keyprog = 1;
                            }
                            else
                            {
                                keyprog = 0;
                            }
//								Debug.WriteLine("keyprog: "+keyprog);
                        }
                        else
                        {
                            keyprog = 0;
                        }

                        break;
                    }
                    timer.Stop();
                    msdel = (float)timer.DurationMsec;
                    DttSP.KeyValue(msdel, extkey_dash, extkey_dot, keyprog);
                }
            } while(true);
        }