static void OnActiveFreq(WndButton* pWnd){
TCHAR	szFreq[8];
_stprintf(szFreq, _T("%7.3f"),RadioPara.ActiveFrequency);
 TCHAR	Name[30] = _T("  ???   ");
    dlgNumEntryShowModal(szFreq,8,false);
    double Frequency = StrToDouble(szFreq,NULL);
    while(Frequency > 1000.0)
 	   Frequency /=10;
    if(ValidFrequency(Frequency))
    {
      _stprintf( RadioPara.ActiveName,_T(" "));
      int iIdx = SearchStation(Frequency);
      if(iIdx != 0)
      {
    	_stprintf(Name,_T("%s"),WayPointList[iIdx].Name);
    	_stprintf( RadioPara.ActiveName,_T("%s"),WayPointList[iIdx].Name);
    	ActiveRadioIndex = iIdx;

      }
      devPutFreqActive(devA(), Frequency,Name);
      devPutFreqActive(devB(), Frequency,Name);
 	  RadioPara.ActiveFrequency = Frequency;

      RadioPara.Changed =TRUE;
 //	 OnRemoteUpdate();
      OnUpdate();
    }
    OnUpdate();
}
static void OnActiveButton(WndButton* pWnd){

  if (HoldOff ==0)
  {
    int res = dlgWayPointSelect(0, 90.0, 1, 3);
    if(res > RESWP_END )
    if(ValidWayPoint(res))
    {
      double  Frequency = StrToDouble(WayPointList[res].Freq,NULL);
      if(!ValidFrequency(Frequency))
      {
   // 	DoStatusMessage(_T("No valid Frequency!") );
    	return;
      }
      devPutFreqActive(devA(), Frequency, WayPointList[res].Name);
      devPutFreqActive(devB(), Frequency, WayPointList[res].Name);
      _stprintf(RadioPara.ActiveName,_T("%s"), WayPointList[res].Name);
      RadioPara.ActiveFrequency = Frequency;

      ActiveRadioIndex = res;
    }
    OnUpdate();
    HoldOff = HOLDOFF_TIME;
  }
}
Exemple #3
0
static void OnSetFrequency(WndButton* pWnd){
(void)pWnd;
#ifdef RADIO_ACTIVE
TCHAR Tmp[255];
 if(RadioPara.Enabled)
 {
   double ASFrequency = ExtractFrequency((TCHAR*)airspace_copy.Name());
   if(!ValidFrequency(ASFrequency))
   {
	 ASFrequency = ExtractFrequency((TCHAR*)airspace_copy.Comment());
   }
   if(ValidFrequency(ASFrequency))
   {
     _stprintf(Tmp,_T("%7.3fMHz"),ASFrequency);
     devPutFreqActive(ASFrequency, (TCHAR*)airspace_copy.Name());
     DoStatusMessage(_T(""), Tmp );
   }
 }
#endif  // RADIO_ACTIVE        
  if(pWnd) {
    WndForm * pForm = pWnd->GetParentWndForm();
    if(pForm) {
      pForm->SetModalResult(mrOK);
    }
  }
} 
Exemple #4
0
static void OnRadioFrequencyClicked(WndButton* pWnd){
#ifdef RADIO_ACTIVE

  TCHAR szFreq[300];

  double Ferquency;
  LKASSERT(SelectedWaypoint>=0);
  LKASSERT(ValidWayPointFast(SelectedWaypoint));
  Ferquency = StrToDouble(WayPointList[SelectedWaypoint].Freq,NULL);

  devPutFreqActive(devA(), Ferquency, WayPointList[SelectedWaypoint].Name);
  devPutFreqActive(devB(), Ferquency, WayPointList[SelectedWaypoint].Name);

  _stprintf(szFreq,_T(" %6.3fMHz ") ,Ferquency);

  DoStatusMessage(_T(""), WayPointList[SelectedWaypoint].Name );  
  DoStatusMessage(_T("RADIO:"), szFreq );
  retStatus=3;
  wf->SetModalResult(mrOK);
#endif  // RADIO_ACTIVE        
}
static int OnRemoteUpdate(void)
{
int Idx=0;
  if(RadioPara.Changed)
  {
    RadioPara.Changed =FALSE;
    TCHAR Name[250];
    if(_tcscmp(_T("        "), RadioPara.ActiveName ) == 0)
      Idx = SearchStation(RadioPara.ActiveFrequency);
    if(Idx !=0)
    {
        _stprintf(RadioPara.ActiveName,_T("%s"),WayPointList[Idx].Name);
        ActiveRadioIndex = Idx;
        if( HoldOff ==0)
        {
          HoldOff = HOLDOFF_TIME;
          devPutFreqActive(devA(), RadioPara.ActiveFrequency, WayPointList[Idx].Name);
          devPutFreqActive(devB(), RadioPara.ActiveFrequency, WayPointList[Idx].Name);
        }
    }
    _stprintf(Name,_T("[%s]"),RadioPara.ActiveName);
    if(wpnewActive)
      wpnewActive->SetCaption(Name);
    _stprintf(Name,_T("%6.03f"),RadioPara.ActiveFrequency);
    if(wpnewActiveFreq)
      wpnewActiveFreq->SetCaption(Name);


    if(_tcscmp(_T("        "), RadioPara.PassiveName ) == 0)
    Idx = SearchStation(RadioPara.PassiveFrequency);
    if(Idx !=0)
    {
        _stprintf(RadioPara.PassiveName,_T("%s"),WayPointList[Idx].Name);
        PassiveRadioIndex = Idx;
        if( HoldOff ==0)
        {
          HoldOff = HOLDOFF_TIME;
          devPutFreqStandby(devA(), RadioPara.PassiveFrequency, WayPointList[Idx].Name);
          devPutFreqStandby(devB(), RadioPara.PassiveFrequency, WayPointList[Idx].Name);
        }
    }
    _stprintf(Name,_T("[%s]"),RadioPara.PassiveName);
    if(wpnewPassive)
     wpnewPassive->SetCaption(Name);
    _stprintf(Name,_T("%6.03f"),RadioPara.PassiveFrequency);
    if(wpnewPassiveFreq)
     wpnewPassiveFreq->SetCaption(Name);
/*
        if( lSquelch !=  RadioPara.Squelch)
        {
              VolMode = SQL;
              SqCnt =0;
        }
*/
        if( lVolume !=  RadioPara.Volume)
              VolMode = VOL;
        lSquelch =  RadioPara.Squelch;
        lVolume =  RadioPara.Volume;
        if(wpnewVol)
        {
      if(VolMode == VOL)
            _stprintf(Name,_T("V[%i]"),RadioPara.Volume);
      else
        _stprintf(Name,_T("S [%i]"),RadioPara.Squelch);
          wpnewVol->SetCaption(Name);
        }

        if(RadioPara.Dual)
          _stprintf(Name,_T("[Dual Off]"));
        else
          _stprintf(Name,_T("[Dual On]"));
        if(wpnewDual)
              wpnewDual->SetCaption(Name);
      return 1;
    }
    return 0;
}