T_WiFi_TXPCL.cpp
上传用户:gelin96
上传日期:2017-01-08
资源大小:20993k
文件大小:50k
- /*****************************************************************************
- * Copyright Statement:
- * --------------------
- * This software is protected by Copyright and the information contained
- * herein is confidential. The software may not be copied and the information
- * contained herein may not be used or disclosed except with the written
- * permission of MediaTek Inc. (C) 2001
- *
- *****************************************************************************/
- /*****************************************************************************
- *
- * Filename:
- * ---------
- * T_WiFi_TXPCL.cpp
- *
- * Project:
- * --------
- * Maui META APP
- *
- * Description:
- * ------------
- * WiFi TXPCL calibration source
- *
- * Author:
- * -------
- * Andy Ueng (mtk00490)
- *
- *============================================================================
- * HISTORY
- * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
- *------------------------------------------------------------------------------
- * $Revision$
- * $Modtime$
- * $Log$
- *
- *------------------------------------------------------------------------------
- * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
- *============================================================================
- ****************************************************************************/
- #include <assert.h>
- #include <math.h>
- #pragma hdrstop
- #ifndef _T_META_FACTORY_CALIBRATION_H_
- #include "T_META_factory_calibration.H"
- #endif
- #ifndef _CAL_COMMON_H_
- #include "cal_common.h"
- #endif
- // form
- #ifndef _META_FACTORY_H_
- #include "META_Factory.h"
- #endif
- #ifndef _FORM_MAIN_H_
- #include "form_Main.h"
- #endif
- // misc
- #ifndef _TIME_UTILS_H_
- #include "time_utils.h"
- #endif
- #ifndef _MISC_WIFI_H_
- #include "misc_wifi.h"
- #endif
- #ifndef _FT_UTILS_H_
- #include "ft_utils.h"
- #endif
- // callback
- #ifndef _MF_WIFI_NVRAM_CB_H_
- #include "mf_wifi_nvram_cb.h"
- #endif
- #ifndef _MF_WIFI_RF_CB_H_
- #include "mf_wifi_rf_cb.h"
- #endif
- //----------------------------------------------------------------------------
- extern bool is_suspend_cal; // in T_META_factory_calibration.cpp
- //----------------------------------------------------------------------------
- bool __fastcall T_META_factory_calibration::WiFiTxPclCal_cal(void)
- {
- char tempbuf[256];
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " ====================== WiFi TX power calibration begin ===================== "
- );
- PostMessage(
- ctrl.hPostMsgDestHandle,
- WM_MF_WIFI_TX_POWER_BEGIN,
- 0,
- 0
- );
- // m_pWft->rx.gain = -60;
- if( IQVIEW == m_pWft->device_type )
- {
- m_pWft->iqv.p_handle->tx.rf_enabled = IQV_RF_DISABLED;
- m_pWft->iqv.p_handle->rx.rf_enabled = IQV_RF_ENABLED;
- m_pWft->iqv.p_handle->rx.rf_port = IQV_PORT_LEFT;
- m_pWft->iqv.p_handle->rx.vsa_type = 1;
- }
- S_WIFICPT wifi_cpt;
- double virTX;
- WiFi_TestPktTx_Ex_S pkt_tx_ex;
- WiFi_TxStatus_Ex_S pkt_tx_ex_status;
- wifi_cpt.wifi_id = m_pCal->s_wifi_cap.rf_chip_id;
- wifi_cpt.reg_domain.country_code[0] = 'U';
- wifi_cpt.reg_domain.country_code[1] = 'S';;
- wifi_cpt.pkt_length = 1024;
- wifi_cpt.pkt_count = 0;
- wifi_cpt.pkt_interval = 100;
- wifi_cpt.pattern = WIFI_TX_PSEUDO_RANDOM;
- wifi_cpt.is_short_preamble = 0;
- wifi_cpt.s_mac_header.frame_ctrl[0] = 0x02;
- wifi_cpt.s_mac_header.frame_ctrl[1] = 0x08;
- wifi_cpt.s_mac_header.duration[0] = 0x00;
- wifi_cpt.s_mac_header.duration[1] = 0x00;
- wifi_cpt.s_mac_header.address1[0] = 0xFF;
- wifi_cpt.s_mac_header.address1[1] = 0xFF;
- wifi_cpt.s_mac_header.address1[2] = 0xFF;
- wifi_cpt.s_mac_header.address1[3] = 0xFF;
- wifi_cpt.s_mac_header.address1[4] = 0xFF;
- wifi_cpt.s_mac_header.address1[5] = 0xFF;
- wifi_cpt.s_mac_header.address2[0] = 0x01;
- wifi_cpt.s_mac_header.address2[1] = 0x00;
- wifi_cpt.s_mac_header.address2[2] = 0x00;
- wifi_cpt.s_mac_header.address2[3] = 0x22;
- wifi_cpt.s_mac_header.address2[4] = 0x08;
- wifi_cpt.s_mac_header.address2[5] = 0x00;
- wifi_cpt.s_mac_header.address3[0] = 0xFF;
- wifi_cpt.s_mac_header.address3[1] = 0xFF;
- wifi_cpt.s_mac_header.address3[2] = 0xFF;
- wifi_cpt.s_mac_header.address3[3] = 0xFF;
- wifi_cpt.s_mac_header.address3[4] = 0xFF;
- wifi_cpt.s_mac_header.address3[5] = 0xFF;
- wifi_cpt.s_mac_header.seq_ctrl[0] = 0x00;
- wifi_cpt.s_mac_header.seq_ctrl[1] = 0x00;
- pkt_tx_ex.pktCount = wifi_cpt.pkt_count;
- pkt_tx_ex.pktInterval = wifi_cpt.pkt_interval;
- pkt_tx_ex.pktLength = wifi_cpt.pkt_length;
- pkt_tx_ex.pattern = wifi_cpt.pattern;
- pkt_tx_ex.is_short_preamble = wifi_cpt.is_short_preamble;
- int max_ch_num;
- AnsiString as_cal_channel;
- int nvram_ch_idx;
- S_WIFI_CH_FREQ_MHZ s_cal_ch_freq_mhz;
- double d_max_p;
- double d_min_p;
- double d_WANTED_P;
- double d_Delta;
- double d_CL;
- double d_n4010a_power_range;
- int i_C;
- E_WIFI_MOD mod;
- E_WIFI_GENERATION e_802_11_idx = WIFI_802_11A_IDX;
- while (e_802_11_idx <= WIFI_802_11G_IDX)
- {
- switch(e_802_11_idx)
- {
- case WIFI_802_11A_IDX:
- {
- if (! IsWiFiSupported( m_asWiFi_Support, e_802_11_idx) )
- {
- e_802_11_idx++;
- continue;
- }
- as_cal_channel = m_as802_11G_CAL_CHANNEL;
- max_ch_num = NUM_TX_POWER_5000M_CH;
- d_WANTED_P = m_dOFDM_WANTED_P;
- d_max_p = m_dOFDM_MAX_P;
- d_min_p = m_dOFDM_MIN_P;
- d_Delta = m_dOFDM_Delta;
- i_C = m_iOFDM_C;
- mod = WIFI_MOD_OFDM;
- if( IQVIEW == m_pWft->device_type )
- {
- d_CL = m_pWft->iqv.d_5g_cl;
- m_pWft->iqv.p_handle->rx.ampl = m_dOFDM_WANTED_P + 10;
- m_pWft->iqv.p_handle->adc.sampling_time = 0.001;
- }
- else
- {
- d_CL = m_pWft->s_age_n4010a.d_5g_cl;
- d_n4010a_power_range = m_dOFDM_WANTED_P + 5;
- }
- wifi_cpt.tx_rate = m_eOFDM_CAL_RATE;
- }
- break;
- case WIFI_802_11B_IDX:
- {
- if (! IsWiFiSupported( m_asWiFi_Support, e_802_11_idx) )
- {
- e_802_11_idx++;
- continue;
- }
- as_cal_channel = m_as802_11B_CAL_CHANNEL;
- max_ch_num = NUM_TX_POWER_2400M_CH;
- d_WANTED_P = m_dCCK_WANTED_P;
- d_max_p = m_dCCK_MAX_P;
- d_min_p = m_dCCK_MIN_P;
- d_Delta = m_dCCK_Delta;
- i_C = m_iCCK_C;
- mod = WIFI_MOD_CCK;
- if( IQVIEW == m_pWft->device_type )
- {
- d_CL = m_pWft->iqv.d_2_4g_cl;
- m_pWft->iqv.p_handle->rx.ampl = m_dCCK_WANTED_P + 2;
- m_pWft->iqv.p_handle->adc.sampling_time = 0.005;
- }
- else
- {
- d_CL = m_pWft->s_age_n4010a.d_2_4g_cl;
- d_n4010a_power_range = m_dCCK_WANTED_P + 5;
- }
- wifi_cpt.tx_rate = m_eCCK_CAL_RATE;
- }
- break;
- case WIFI_802_11G_IDX:
- {
- if (! IsWiFiSupported( m_asWiFi_Support, e_802_11_idx) )
- {
- e_802_11_idx++;
- continue;
- }
- as_cal_channel = m_as802_11G_CAL_CHANNEL;
- max_ch_num = NUM_TX_POWER_2400M_CH;
- d_WANTED_P = m_dOFDM_WANTED_P;
- d_max_p = m_dOFDM_MAX_P;
- d_min_p = m_dOFDM_MIN_P;
- d_Delta = m_dOFDM_Delta;
- i_C = m_iOFDM_C;
- mod = WIFI_MOD_OFDM;
- if( IQVIEW == m_pWft->device_type )
- {
- d_CL = m_pWft->iqv.d_2_4g_cl;
- m_pWft->iqv.p_handle->rx.ampl = m_dOFDM_WANTED_P + 10;
- m_pWft->iqv.p_handle->adc.sampling_time = 0.001;
- }
- else
- {
- d_CL = m_pWft->s_age_n4010a.d_2_4g_cl;
- d_n4010a_power_range = m_dOFDM_WANTED_P + 5;
- }
- wifi_cpt.tx_rate = m_eOFDM_CAL_RATE;
- }
- break;
- default:
- assert(false);
- break;
- } // switch
- log->Add( "n" + DateToStr(Date()) + " " + CurrentTimeStr() +
- " ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
- );
- if( ! m_wft_ctrl.WFT_SetTriggerStyle( m_pWft ) )
- {
- PostMessage(
- ctrl.hPostMsgDestHandle,
- WM_MF_WIFI_SET_TRIGGER_STYLE_FAIL,
- 0,
- 0
- );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " WiFi tester sets trigger style fail "
- );
- return false;
- }
-
- if( ! m_wft_ctrl.WFT_SetPowerRange( m_pWft, d_n4010a_power_range ) )
- {
- PostMessage(
- ctrl.hPostMsgDestHandle,
- WM_MF_WIFI_SET_POWER_RANGE_FAIL,
- 0,
- 0
- );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " WiFi tester < power range = " + Double_To_AnsiString( d_n4010a_power_range ) + " dBm fail"
- );
- return false;
- }
- s_cal_ch_freq_mhz.ch_num = String_To_Array_UnsignedInteger(as_cal_channel.c_str(), s_cal_ch_freq_mhz.ch_freq_MHz, max_ch_num);
- for (int cal_ch_idx=0; cal_ch_idx<s_cal_ch_freq_mhz.ch_num; cal_ch_idx++ )
- {
- log->Add( "n" + DateToStr(Date()) + " " + CurrentTimeStr() +
- " ------------------------------------------------------------------ "
- );
- unsigned int freq_khz = s_cal_ch_freq_mhz.ch_freq_MHz[cal_ch_idx]*1000;
- nvram_ch_idx = GetWiFiNVRAMChannelIndex(e_802_11_idx, s_cal_ch_freq_mhz.ch_freq_MHz[cal_ch_idx]);
- if ((int)NOT_FOUND == nvram_ch_idx)
- {
- PostMessage(ctrl.hPostMsgDestHandle,
- WM_MF_WIFI_CHANNEL_INDEX_NOT_FOUND_FAIL,
- 0,
- 0
- );
- log->Add(DateToStr(Date()) + " " + CurrentTimeStr() +
- " WiFi Channel index not found fail, channel = " + IntToStr(s_cal_ch_freq_mhz.ch_freq_MHz[cal_ch_idx]) + " MHz fail"
- );
- return false;
- }
- // m_pWft->iqv.p_handle->rx.freq = 1000*freq_khz;
- if (!m_wft_ctrl.WFT_SetCentralFreq( m_pWft, (double) s_cal_ch_freq_mhz.ch_freq_MHz[cal_ch_idx]) )
- {
- PostMessage(
- ctrl.hPostMsgDestHandle,
- WM_MF_WIFI_SET_CENTRAL_FREQ_FAIL,
- 0,
- 0
- );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " WiFi tester < RX channel frequency = " + IntToStr(s_cal_ch_freq_mhz.ch_freq_MHz[cal_ch_idx]) + " MHz fail"
- );
- return false;
- }
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " WiFi tester < RX channel frequency = " + IntToStr(s_cal_ch_freq_mhz.ch_freq_MHz[cal_ch_idx]) + " MHz"
- );
- if( ! m_wft_ctrl.WFT_ApplyChange( m_pWft ) )
- {
- PostMessage(
- ctrl.hPostMsgDestHandle,
- WM_MF_WIFI_APPLY_CHANGE_FAIL,
- 0,
- 0
- );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " WiFi tester applies change value fail "
- );
- return false;
- }
- wifi_cpt.channel_freq = freq_khz;
- for( int iRealRecursiveTimes=0; iRealRecursiveTimes<m_iWiFiTxPRecursive_Times;
- iRealRecursiveTimes++)
- {
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " RecursiveTimes = " + IntToStr(iRealRecursiveTimes)
- );
- wifi_cpt.tx_pwr_dac = m_pCal->s_cal_obj.pc_WIFI_APC_Obj->Get_TxPowerDac(e_802_11_idx, mod, nvram_ch_idx);
- if (wifi_cpt.tx_pwr_dac > WIFI_MAX_APC_VALUE )
- {
- wifi_cpt.tx_pwr_dac = WIFI_MAX_APC_VALUE;
- }
- pkt_tx_ex.ch_freq = wifi_cpt.channel_freq;
- pkt_tx_ex.tx_rate = wifi_cpt.tx_rate;
- pkt_tx_ex.tx_gain_dac = wifi_cpt.tx_pwr_dac;
- pkt_tx_ex.txAnt = 0;
- pkt_tx_ex.txFlags = 0;
- pkt_tx_ex.targetAlc = 0;
- log->Add(DateToStr(Date()) + " " + CurrentTimeStr() +
- " Dac[" + IntToStr(nvram_ch_idx) + "] = " + IntToStr(m_pCal->s_cal_obj.pc_WIFI_APC_Obj->Get_TxPowerDac(e_802_11_idx, mod, nvram_ch_idx))
- );
- META_RESULT MetaResult = META_WiFi_Stop_r(m_pCal->i_MainMETAHandle, 500);
- if( META_SUCCESS != MetaResult )
- {
- CalErrorHandler( WM_MF_WIFI_CPT_FAIL );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL: Target > WiFi stop fail."
- );
- return false;
- }
- Sleep(50);
- MetaResult = META_WiFi_SetRegDomain_r( m_pCal->i_MainMETAHandle, 500, &wifi_cpt.reg_domain );
- if( META_SUCCESS != MetaResult )
- {
- CalErrorHandler( WM_MF_WIFI_CPT_FAIL );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL: Target < WiFi set reg domain fail."
- );
- return false;
- }
- WiFi_TestPktTx_S pkt_tx;
- m_cWIFI_CPT_Obj.Compose_MacHeader(wifi_cpt.s_mac_header, pkt_tx_ex.mac_header);
- if (m_pCal->b_WiFiAlcSupport)
- {
- MetaResult = META_WiFi_ContPktTx_Ex_r(m_pCal->i_MainMETAHandle, 500, &pkt_tx_ex);
- if (META_SUCCESS != MetaResult)
- {
- CalErrorHandler(WM_MF_WIFI_CPT_FAIL);
- log->Add(DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL: Target < WiFi continuous packet TX fail."
- );
- return false;
- }
- }
- else
- {
- pkt_tx.ch_freq = pkt_tx_ex.ch_freq;
- pkt_tx.tx_rate = pkt_tx_ex.tx_rate;
- pkt_tx.tx_gain_dac = pkt_tx_ex.tx_gain_dac;
- pkt_tx.pktCount = pkt_tx_ex.pktCount;
- pkt_tx.pktInterval = pkt_tx_ex.pktInterval;
- pkt_tx.pktLength = pkt_tx_ex.pktLength;
- pkt_tx.pattern = pkt_tx_ex.pattern;
- pkt_tx.txAnt = pkt_tx_ex.txAnt;
- pkt_tx.is_short_preamble = pkt_tx_ex.is_short_preamble;
- for (int i=0; i<24; i++)
- {
- pkt_tx.mac_header[i] = pkt_tx_ex.mac_header[i];
- }
- MetaResult = META_WiFi_ContPktTx_r(m_pCal->i_MainMETAHandle, 500, &pkt_tx);
- }
- if( META_SUCCESS != MetaResult )
- {
- CalErrorHandler( WM_MF_WIFI_CPT_FAIL );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL: Target > WiFi continuous packet TX fail."
- );
- return false;
- }
- Sleep(100);
- if (!m_wft_ctrl.WFT_DataCapture(m_pWft))
- {
- PostMessage(
- ctrl.hPostMsgDestHandle,
- WM_MF_WIFI_APPLY_CHANGE_FAIL,
- 0,
- 0
- );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " WiFi tester applies change value fail "
- );
- return false;
- }
- if (!m_wft_ctrl.WFT_PowerAnalyze(m_pWft))
- {
- PostMessage(
- ctrl.hPostMsgDestHandle,
- WM_MF_WIFI_ANALYZE_POWER_FAIL,
- 0,
- 0
- );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " WiFi tester analyzes TX power fail "
- );
- return false;
- }
- if (!m_wft_ctrl.WFT_ReadPower(m_pWft, virTX))
- {
- PostMessage(
- ctrl.hPostMsgDestHandle,
- WM_MF_WIFI_READ_POWER_FAIL,
- 0,
- 0
- );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " WiFi tester reads TX power fail "
- );
- return false;
- }
- virTX = virTX - d_CL;
- log->Add(DateToStr(Date()) + " " + CurrentTimeStr() +
- " WiFi tester > read TX power = "+ Double_To_AnsiString(virTX)
- );
- signed short ss1;
- double d1;
- unsigned char new_dac;
- if (iRealRecursiveTimes != m_iWiFiTxPRecursive_Times-1) //iteration
- {
- if ( virTX > (d_WANTED_P + d_Delta) ||
- virTX < (d_WANTED_P - d_Delta)
- )
- {
- d1 = i_C * ( d_WANTED_P - virTX );
- ss1 = (signed short) (d1>0) ? floor(d1+1.0): ceil(d1-1.0);
- new_dac = m_pCal->s_cal_obj.pc_WIFI_APC_Obj->Get_TxPowerDac(e_802_11_idx, mod, nvram_ch_idx)+ ss1;
- if(new_dac > WIFI_MAX_APC_VALUE)
- {
- m_pCal->s_cal_obj.pc_WIFI_APC_Obj->Set_TxPowerDac(e_802_11_idx, mod, nvram_ch_idx, WIFI_MAX_APC_VALUE);
- }
- else
- {
- m_pCal->s_cal_obj.pc_WIFI_APC_Obj->Set_TxPowerDac(e_802_11_idx, mod, nvram_ch_idx, new_dac);
- }
- log->Add(DateToStr(Date()) + " " + CurrentTimeStr() +
- " delta s = "+
- AnsiString(ss1)
- );
- }
- else
- {
- // log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- // " delta s = 0 "
- // );
- break; // for iRealRecursiveTimes
- }
- } // if no iteration
- else if( iRealRecursiveTimes == m_iWiFiTxPRecursive_Times-1 )
- {
- if ( virTX > d_max_p || virTX < d_min_p )
- {
- CalErrorHandler( WM_MF_WIFI_TX_POWER_CHECK_FAIL );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " WiFi test < read TX power = "+ Double_To_AnsiString( virTX ) +
- " ( Out of Range ), min TX power = " + Double_To_AnsiString( d_min_p ) + ", max TX power = " + Double_To_AnsiString( d_max_p )
- );
- return false;
- }
- else
- {
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " Agilent 8960> read TX power = "+ Double_To_AnsiString( virTX ) +
- " ( Pass ), min TX power = " + Double_To_AnsiString( d_min_p ) + ", max TX power = " + Double_To_AnsiString( d_max_p )
- );
- }
- }
- if ( this->Terminated )
- {
- this->OnTerminate = neByUser;
- return false;
- }
- } // for (iRealRecursiveTimes)
- sprintf(tempbuf, "%2.1f", virTX);
- m_pCal->as_ResultBuf = m_pCal->as_ResultBuf + tempbuf + ", ";
- // get ALC value
- if (m_pCal->b_WiFiAlcSupport)
- {
- MetaResult = META_WiFi_QueryTxStatus_Ex_r(m_pCal->i_MainMETAHandle, 5000, &pkt_tx_ex_status);
- if (META_SUCCESS != MetaResult)
- {
- CalErrorHandler(WM_MF_WIFI_CPT_FAIL);
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL: Target > Query WiFi ALC fail."
- );
- return false;
- }
- if (WIFI_MOD_CCK == mod)
- {
- m_pCal->s_cal_obj.pc_WIFI_ALC_Obj->Set_AlcPower2400MAlc(mod, nvram_ch_idx, (WiFi_TestRate_E) 0, pkt_tx_ex_status.avgAlc);
- }
- else
- {
- for (int rate = 0; rate < WIFI_ALC_2400M_TX_RATE_NUM; rate++)
- {
- m_pCal->s_cal_obj.pc_WIFI_ALC_Obj->Set_AlcPower2400MAlc(mod, nvram_ch_idx, (WiFi_TestRate_E) rate, pkt_tx_ex_status.avgAlc);
- }
- }
- }
- } // for (ch_idx)
- // interpolate not calibrated channel
- S_WIFI_CH_FREQ_MHZ s_remain_ch_freq_mhz;
- int remain_ch_num = GetWiFiRemainChannels(e_802_11_idx, s_cal_ch_freq_mhz, s_remain_ch_freq_mhz);
- if (remain_ch_num > 0)
- {
- log->Add( "n" +DateToStr(Date()) + " " + CurrentTimeStr() +
- " --------------------- Evaluate WiFi TX power DAC value begin --------------------- "
- );
- for (int i=0; i<remain_ch_num; i++)
- {
- int first_ch_index;
- int second_ch_index;
- double d_slope;
- double d_offset;
- nvram_ch_idx = GetWiFiNVRAMChannelIndex(e_802_11_idx, s_remain_ch_freq_mhz.ch_freq_MHz[i]);
- if ((int)NOT_FOUND == nvram_ch_idx)
- {
- PostMessage(ctrl.hPostMsgDestHandle,
- WM_MF_WIFI_CHANNEL_INDEX_NOT_FOUND_FAIL,
- 0,
- 0
- );
- log->Add(DateToStr(Date()) + " " + CurrentTimeStr() +
- " WiFi Channel index not found fail, channel = " + IntToStr(s_remain_ch_freq_mhz.ch_freq_MHz[i]) + " MHz fail"
- );
- return false;
- }
- if (!GetWiFiTwoClosetNVRAMChannelIndex(e_802_11_idx, s_remain_ch_freq_mhz.ch_freq_MHz[i], s_cal_ch_freq_mhz, first_ch_index, second_ch_index))
- {
- PostMessage(ctrl.hPostMsgDestHandle,
- WM_MF_WIFI_CHANNEL_INDEX_NOT_FOUND_FAIL,
- 0,
- 0
- );
- log->Add(DateToStr(Date()) + " " + CurrentTimeStr() +
- " Two closest WiFi Channel index not found fail, channel = " + IntToStr(s_remain_ch_freq_mhz.ch_freq_MHz[i]) + " MHz fail"
- );
- return false;
- }
- unsigned char uc_first_dac = m_pCal->s_cal_obj.pc_WIFI_APC_Obj->Get_TxPowerDac(e_802_11_idx, mod, first_ch_index);
- unsigned char uc_second_dac = m_pCal->s_cal_obj.pc_WIFI_APC_Obj->Get_TxPowerDac(e_802_11_idx, mod, second_ch_index);
- double d_data;
- unsigned char uc_target_dac;
- d_slope = (double) (uc_first_dac - uc_second_dac)/(double)(first_ch_index - second_ch_index);
- d_offset = (double) uc_first_dac - (d_slope * first_ch_index);
- d_data = d_slope * nvram_ch_idx + d_offset;
- d_data += (d_data>=0) ? 0.5 : -0.5 ;
- uc_target_dac = (unsigned char) d_data;
- m_pCal->s_cal_obj.pc_WIFI_APC_Obj->Set_TxPowerDac(e_802_11_idx, mod, nvram_ch_idx, uc_target_dac);
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " slope = " + Double_To_AnsiString(d_slope) +
- ", offset = " + Double_To_AnsiString(d_offset)
- );
- log->Add(DateToStr(Date()) + " " + CurrentTimeStr() +
- " channel index = " + IntToStr(nvram_ch_idx) +
- ", WiFi TX power DAC = " + IntToStr(uc_target_dac)
- );
- // evaluate remain channel ALC vaue
- if (m_pCal->b_WiFiAlcSupport)
- {
- unsigned char uc_first_alc = m_pCal->s_cal_obj.pc_WIFI_ALC_Obj->Get_AlcPower2400MAlc(mod, first_ch_index, (WiFi_TestRate_E) 0);
- unsigned char uc_second_alc = m_pCal->s_cal_obj.pc_WIFI_ALC_Obj->Get_AlcPower2400MAlc(mod, second_ch_index, (WiFi_TestRate_E) 0);
- double d_data;
- unsigned char uc_target_alc;
- d_slope = (double) (uc_first_alc - uc_second_alc)/(double)(first_ch_index - second_ch_index);
- d_offset = (double) uc_first_alc - (d_slope * first_ch_index);
- d_data = d_slope * nvram_ch_idx + d_offset;
- d_data += (d_data>=0) ? 0.5 : -0.5 ;
- uc_target_alc = (unsigned char) d_data;
- if (WIFI_MOD_CCK == mod)
- {
- m_pCal->s_cal_obj.pc_WIFI_ALC_Obj->Set_AlcPower2400MAlc(mod, nvram_ch_idx, (WiFi_TestRate_E) 0, uc_target_alc);
- }
- else
- {
- for (int rate = 0; rate < WIFI_ALC_2400M_TX_RATE_NUM; rate++)
- {
- m_pCal->s_cal_obj.pc_WIFI_ALC_Obj->Set_AlcPower2400MAlc(mod, nvram_ch_idx, (WiFi_TestRate_E) rate, uc_target_alc);
- }
- }
- log->Add(DateToStr(Date()) + " " + CurrentTimeStr() +
- " slope = " + Double_To_AnsiString(d_slope) +
- ", offset = " + Double_To_AnsiString(d_offset)
- );
- log->Add(DateToStr(Date()) + " " + CurrentTimeStr() +
- " channel index = " + IntToStr(nvram_ch_idx) +
- ", WiFi ALC = " + IntToStr(uc_target_alc)
- );
- }
- } // for(i)
- log->Add("n" +DateToStr(Date()) + " " + CurrentTimeStr() +
- " -------------------- Evaluate WiFi TX power DAC value end ------------------ "
- );
- }
- // write to NVRAM
- m_pCal->s_cal_obj.pc_WIFI_APC_Obj->ConfirmCallback = ::CNF_MF_WriteToNVRAM;
- if( WIFI_802_11A_IDX == e_802_11_idx )
- {
- m_pCal->s_cal_obj.pc_WIFI_APC_Obj->REQ_Write_TxPower5000M_To_NVRAM_Start();
- }
- else
- {
- m_pCal->s_cal_obj.pc_WIFI_APC_Obj->REQ_Write_TxPower2400M_To_NVRAM_Start();
- }
- RestartTimerCal( WM_MF_NVRAM_WIFI_APC_WRITE_FAIL );
- SUSPEND_CAL_THREAD
- CHECK_TERMINATE_BY_USER
- E_METAAPP_RESULT_T state = m_pCal->s_cal_obj.pc_WIFI_APC_Obj->Get_ConfirmState();
- if (state != METAAPP_SUCCESS)
- {
- if (METAAPP_NVRAM_LID_VER_NOT_SUPPORT == state)
- {
- CalErrorHandler(WM_MF_NVRAM_EF_WNDRV_TX_POWER_xxx_LID_VERNO_FAIL);
- log->Add(DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL : NVRAM_EF_WNDRV_TX_POWER_xxx_LID version is not support, please update META to latest version. "
- );
- }
- else
- {
- CalErrorHandler(WM_MF_NVRAM_WIFI_APC_WRITE_FAIL);
- log->Add(DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL: Target < write WiFi 2.4G TX power to NVRAM fail."
- );
- }
- return false;
- }
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " Target < write WiFi 2.4G TX power to NVRAM."
- );
- if ( this->Terminated )
- {
- this->OnTerminate = neByUser;
- return false;
- }
- WriteWiFiAPCCalResultToFile(as_ID+".cal",Application->ExeName, m_pCal->b_CalResultPath, e_802_11_idx );
- e_802_11_idx++;
- } // while
- if (m_pCal->b_WiFiAlcSupport)
- {
- // CCK
- for (int ch_idx=0; ch_idx<max_ch_num; ch_idx++)
- {
- m_pCal->s_cal_obj.pc_WIFI_ALC_Obj->Set_AlcPower2400MPowerDB(WIFI_MOD_CCK, ch_idx, (WiFi_TestRate_E) 0, m_dCCK_WANTED_P);
- }
- // OFDM
- for (int rate = 0; rate < WIFI_ALC_2400M_TX_RATE_NUM; rate++)
- {
- for (int ch_idx = 0; ch_idx < max_ch_num; ch_idx++)
- {
- m_pCal->s_cal_obj.pc_WIFI_ALC_Obj->Set_AlcPower2400MPowerDB(WIFI_MOD_OFDM, ch_idx, (WiFi_TestRate_E) rate, m_dOFDM_WANTED_P);
- }
- }
- // write to NVRAM
- m_pCal->s_cal_obj.pc_WIFI_ALC_Obj->ConfirmCallback = ::CNF_MF_WriteToNVRAM;
- m_pCal->s_cal_obj.pc_WIFI_ALC_Obj->REQ_Write_To_NVRAM_Start();
- RestartTimerCal(WM_MF_NVRAM_WIFI_ALC_WRITE_FAIL);
- SUSPEND_CAL_THREAD
- CHECK_TERMINATE_BY_USER
- E_METAAPP_RESULT_T state = m_pCal->s_cal_obj.pc_WIFI_ALC_Obj->Get_ConfirmState();
- if (state != METAAPP_SUCCESS)
- {
- if (METAAPP_NVRAM_LID_VER_NOT_SUPPORT == state)
- {
- CalErrorHandler(WM_MF_NVRAM_EF_WNDRV_TX_ALC_POWER_LID_VERNO_FAIL);
- log->Add(DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL : NVRAM_EF_WNDRV_TX_ALC_POWER_LID version is not support, please update META to latest version. "
- );
- }
- else
- {
- CalErrorHandler(WM_MF_NVRAM_WIFI_ALC_WRITE_FAIL);
- log->Add(DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL: Target < write WiFi 2.4G ALC to NVRAM fail."
- );
- }
- return false;
- }
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " Target < write WiFi 2.4G TX power to NVRAM."
- );
- }
- frmFatcory->DisableAllCalTimer();
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " ====================== WiFi TX power calibration end ===================== "
- );
- return true;
- }
- //----------------------------------------------------------------------------
- bool __fastcall T_META_factory_calibration::WiFiTxPclCal_check( void )
- {
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " ====================== WiFi TX power check begin ===================== "
- );
- if( IQVIEW == m_pWft->device_type )
- {
- m_pWft->iqv.p_handle->tx.rf_enabled = IQV_RF_DISABLED;
- m_pWft->iqv.p_handle->rx.rf_enabled = IQV_RF_ENABLED;
- m_pWft->iqv.p_handle->rx.rf_port = IQV_PORT_LEFT;
- m_pWft->iqv.p_handle->rx.vsa_type = 1;
- }
- WiFi_TestPktTx_Ex_S pkt_tx_ex;
- S_WIFICPT wifi_cpt;
- double virTX;
- wifi_cpt.wifi_id = m_pCal->s_wifi_cap.rf_chip_id;
- wifi_cpt.reg_domain.country_code[0] = 'U';
- wifi_cpt.reg_domain.country_code[1] = 'S';;
- // wifi_cpt.tx_rate = WIFI_TEST_RATE_5_5M;
- wifi_cpt.pkt_length = 1024;
- wifi_cpt.pkt_count = 0;
- wifi_cpt.pkt_interval = 100;
- wifi_cpt.pattern = WIFI_TX_PSEUDO_RANDOM;
- wifi_cpt.is_short_preamble = 0;
- wifi_cpt.s_mac_header.frame_ctrl[0] = 0x02;
- wifi_cpt.s_mac_header.frame_ctrl[1] = 0x08;
- wifi_cpt.s_mac_header.duration[0] = 0x00;
- wifi_cpt.s_mac_header.duration[1] = 0x00;
- wifi_cpt.s_mac_header.address1[0] = 0xFF;
- wifi_cpt.s_mac_header.address1[1] = 0xFF;
- wifi_cpt.s_mac_header.address1[2] = 0xFF;
- wifi_cpt.s_mac_header.address1[3] = 0xFF;
- wifi_cpt.s_mac_header.address1[4] = 0xFF;
- wifi_cpt.s_mac_header.address1[5] = 0xFF;
- wifi_cpt.s_mac_header.address2[0] = 0x01;
- wifi_cpt.s_mac_header.address2[1] = 0x00;
- wifi_cpt.s_mac_header.address2[2] = 0x00;
- wifi_cpt.s_mac_header.address2[3] = 0x22;
- wifi_cpt.s_mac_header.address2[4] = 0x08;
- wifi_cpt.s_mac_header.address2[5] = 0x00;
- wifi_cpt.s_mac_header.address3[0] = 0xFF;
- wifi_cpt.s_mac_header.address3[1] = 0xFF;
- wifi_cpt.s_mac_header.address3[2] = 0xFF;
- wifi_cpt.s_mac_header.address3[3] = 0xFF;
- wifi_cpt.s_mac_header.address3[4] = 0xFF;
- wifi_cpt.s_mac_header.address3[5] = 0xFF;
- wifi_cpt.s_mac_header.seq_ctrl[0] = 0x00;
- wifi_cpt.s_mac_header.seq_ctrl[1] = 0x00;
- pkt_tx_ex.pktCount = wifi_cpt.pkt_count;
- pkt_tx_ex.pktInterval = wifi_cpt.pkt_interval;
- pkt_tx_ex.pktLength = wifi_cpt.pkt_length;
- pkt_tx_ex.pattern = wifi_cpt.pattern;
- pkt_tx_ex.is_short_preamble = wifi_cpt.is_short_preamble;
- int max_ch_num;
- int tx_power_ch_num;
- AnsiString as_check_channel;
- int nvram_ch_idx;
- S_WIFI_CH_FREQ_MHZ s_check_ch_freq_mhz;
- double d_max_p;
- double d_min_p;
- double d_CL;
- double d_n4010a_power_range;
- E_WIFI_MOD mod;
- bool out_of_range_flag = false; // set initial value
- E_WIFI_GENERATION e_802_11_idx = WIFI_802_11A_IDX;
- while (e_802_11_idx <= WIFI_802_11G_IDX)
- {
- switch( e_802_11_idx )
- {
- case WIFI_802_11A_IDX:
- {
- if (! IsWiFiSupported( m_asWiFi_Support, e_802_11_idx) )
- {
- e_802_11_idx++;
- continue;
- }
- as_check_channel = m_as802_11G_CHECK_CHANNEL;
- max_ch_num = NUM_TX_POWER_5000M_CH;
- d_max_p = m_dOFDM_MAX_P;
- d_min_p = m_dOFDM_MIN_P;
- mod = WIFI_MOD_OFDM;
- if (IQVIEW == m_pWft->device_type)
- {
- d_CL = m_pWft->iqv.d_5g_cl;
- m_pWft->iqv.p_handle->rx.ampl = m_dOFDM_WANTED_P + 10;
- m_pWft->iqv.p_handle->adc.sampling_time = 0.001;
- }
- else
- {
- d_CL = m_pWft->s_age_n4010a.d_5g_cl;
- d_n4010a_power_range = m_dOFDM_WANTED_P + 5;
- }
- wifi_cpt.tx_rate = m_eOFDM_CHECK_RATE;
- }
- break;
- case WIFI_802_11B_IDX:
- {
- if (!IsWiFiSupported(m_asWiFi_Support, e_802_11_idx))
- {
- e_802_11_idx++;
- continue;
- }
- as_check_channel = m_as802_11B_CHECK_CHANNEL;
- max_ch_num = NUM_TX_POWER_2400M_CH;
- d_max_p = m_dCCK_MAX_P;
- d_min_p = m_dCCK_MIN_P;
- mod = WIFI_MOD_CCK;
- if (IQVIEW == m_pWft->device_type)
- {
- d_CL = m_pWft->iqv.d_2_4g_cl;
- m_pWft->iqv.p_handle->rx.ampl = m_dCCK_WANTED_P + 2;
- m_pWft->iqv.p_handle->adc.sampling_time = 0.005;
- }
- else
- {
- d_CL = m_pWft->s_age_n4010a.d_2_4g_cl;
- d_n4010a_power_range = m_dCCK_WANTED_P + 5;
- }
- wifi_cpt.tx_rate = m_eCCK_CHECK_RATE;
- }
- break;
- case WIFI_802_11G_IDX:
- {
- if (!IsWiFiSupported(m_asWiFi_Support, e_802_11_idx))
- {
- e_802_11_idx++;
- continue;
- }
- as_check_channel = m_as802_11G_CHECK_CHANNEL;
- max_ch_num = NUM_TX_POWER_2400M_CH;
- d_max_p = m_dOFDM_MAX_P;
- d_min_p = m_dOFDM_MIN_P;
- mod = WIFI_MOD_OFDM;
- if (IQVIEW == m_pWft->device_type)
- {
- d_CL = m_pWft->iqv.d_2_4g_cl;
- m_pWft->iqv.p_handle->rx.ampl = m_dOFDM_WANTED_P + 10;
- m_pWft->iqv.p_handle->adc.sampling_time = 0.001;
- }
- else
- {
- d_CL = m_pWft->s_age_n4010a.d_2_4g_cl;
- d_n4010a_power_range = m_dOFDM_WANTED_P + 5;
- }
- wifi_cpt.tx_rate = m_eOFDM_CHECK_RATE;
- }
- break;
- default:
- assert(false);
- break;
- } // switch
- log->Add( "n" + DateToStr(Date()) + " " + CurrentTimeStr() +
- " ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
- );
- if( ! m_wft_ctrl.WFT_SetTriggerStyle( m_pWft ) )
- {
- PostMessage(
- ctrl.hPostMsgDestHandle,
- WM_MF_WIFI_SET_TRIGGER_STYLE_FAIL,
- 0,
- 0
- );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " WiFi tester sets trigger style fail "
- );
- return false;
- }
- if (!m_wft_ctrl.WFT_SetPowerRange(m_pWft, d_n4010a_power_range))
- {
- PostMessage(ctrl.hPostMsgDestHandle,
- WM_MF_WIFI_SET_POWER_RANGE_FAIL,
- 0,
- 0
- );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " WiFi tester < power range = " + Double_To_AnsiString(d_n4010a_power_range) + " dBm fail"
- );
- return false;
- }
- s_check_ch_freq_mhz.ch_num = String_To_Array_UnsignedInteger(as_check_channel.c_str(), s_check_ch_freq_mhz.ch_freq_MHz, max_ch_num);
- for (int check_ch_idx=0; check_ch_idx<s_check_ch_freq_mhz.ch_num; check_ch_idx++)
- {
- unsigned int freq_khz = s_check_ch_freq_mhz.ch_freq_MHz[check_ch_idx] * 1000;
- // m_pWft->iqv.p_handle->rx.freq = 1000*freq_khz;
- if (!m_wft_ctrl.WFT_SetCentralFreq(m_pWft, (double) s_check_ch_freq_mhz.ch_freq_MHz[check_ch_idx]))
- {
- PostMessage(
- ctrl.hPostMsgDestHandle,
- WM_MF_WIFI_SET_CENTRAL_FREQ_FAIL,
- 0,
- 0
- );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " WiFi tester < RX channel frequency = " + Double_To_AnsiString(s_check_ch_freq_mhz.ch_freq_MHz[check_ch_idx]) + " MHz fail"
- );
- return false;
- }
- log->Add(DateToStr(Date()) + " " + CurrentTimeStr() +
- " WiFi tester < RX channel frequency = " + Double_To_AnsiString(s_check_ch_freq_mhz.ch_freq_MHz[check_ch_idx]) + " MHz"
- );
- if (!m_wft_ctrl.WFT_ApplyChange(m_pWft))
- {
- PostMessage(
- ctrl.hPostMsgDestHandle,
- WM_MF_WIFI_APPLY_CHANGE_FAIL,
- 0,
- 0
- );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " WiFi tester applies change value fail "
- );
- return false;
- }
- wifi_cpt.channel_freq = freq_khz;
- nvram_ch_idx = GetWiFiNVRAMChannelIndex(e_802_11_idx, s_check_ch_freq_mhz.ch_freq_MHz[check_ch_idx]);
- wifi_cpt.tx_pwr_dac = m_pCal->s_cal_obj.pc_WIFI_APC_Obj->Get_TxPowerDac(e_802_11_idx, mod, nvram_ch_idx);
- pkt_tx_ex.ch_freq = wifi_cpt.channel_freq;
- pkt_tx_ex.tx_rate = wifi_cpt.tx_rate;
- pkt_tx_ex.tx_gain_dac = wifi_cpt.tx_pwr_dac;
- pkt_tx_ex.txAnt = 0;
- pkt_tx_ex.txFlags = 0;
- pkt_tx_ex.targetAlc = 0;
- log->Add(DateToStr(Date()) + " " + CurrentTimeStr() +
- " Dac[" + IntToStr(nvram_ch_idx) + "] = " + IntToStr(wifi_cpt.tx_pwr_dac)
- );
- // stop continuous packet TX
- META_RESULT MetaResult = META_WiFi_Stop_r(m_pCal->i_MainMETAHandle, 500);
- if (META_SUCCESS != MetaResult)
- {
- CalErrorHandler(WM_MF_WIFI_CPT_FAIL);
- log->Add(DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL: Target > WiFi stop fail."
- );
- return false;
- }
- Sleep(50);
- // start continuos packet TX
- MetaResult = META_WiFi_SetRegDomain_r(m_pCal->i_MainMETAHandle, 500, &wifi_cpt.reg_domain );
- if (META_SUCCESS != MetaResult)
- {
- CalErrorHandler(WM_MF_WIFI_CPT_FAIL);
- log->Add(DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL: Target > WiFi set reg domain fail."
- );
- return false;
- }
- WiFi_TestPktTx_S pkt_tx;
- m_cWIFI_CPT_Obj.Compose_MacHeader(wifi_cpt.s_mac_header, pkt_tx_ex.mac_header);
- if (m_pCal->b_WiFiAlcSupport)
- {
- MetaResult = META_WiFi_ContPktTx_Ex_r(m_pCal->i_MainMETAHandle, 500, &pkt_tx_ex);
- }
- else
- {
- pkt_tx.ch_freq = pkt_tx_ex.ch_freq;
- pkt_tx.tx_rate = pkt_tx_ex.tx_rate;
- pkt_tx.tx_gain_dac = pkt_tx_ex.tx_gain_dac;
- pkt_tx.pktCount = pkt_tx_ex.pktCount;
- pkt_tx.pktInterval = pkt_tx_ex.pktInterval;
- pkt_tx.pktLength = pkt_tx_ex.pktLength;
- pkt_tx.pattern = pkt_tx_ex.pattern;
- pkt_tx.txAnt = pkt_tx_ex.txAnt;
- pkt_tx.is_short_preamble = pkt_tx_ex.is_short_preamble;
- for (int i=0; i<24; i++)
- {
- pkt_tx.mac_header[i] = pkt_tx_ex.mac_header[i];
- }
- MetaResult = META_WiFi_ContPktTx_r(m_pCal->i_MainMETAHandle, 500, &pkt_tx);
- }
- if (META_SUCCESS != MetaResult)
- {
- CalErrorHandler(WM_MF_WIFI_CPT_FAIL);
- log->Add(DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL: Target > WiFi continuous packet TX fail."
- );
- return false;
- }
- Sleep(100);
- if (! m_wft_ctrl.WFT_DataCapture(m_pWft))
- {
- PostMessage(
- ctrl.hPostMsgDestHandle,
- WM_MF_WIFI_APPLY_CHANGE_FAIL,
- 0,
- 0
- );
- log->Add(DateToStr(Date()) + " " + CurrentTimeStr() +
- " WiFi tester applies change value fail "
- );
- return false;
- }
- if (!m_wft_ctrl.WFT_PowerAnalyze(m_pWft))
- {
- PostMessage(
- ctrl.hPostMsgDestHandle,
- WM_MF_WIFI_ANALYZE_POWER_FAIL,
- 0,
- 0
- );
- log->Add(DateToStr(Date()) + " " + CurrentTimeStr() +
- " WiFi tester analyzes TX power fail "
- );
- return false;
- }
- if (!m_wft_ctrl.WFT_ReadPower(m_pWft, virTX))
- {
- PostMessage(
- ctrl.hPostMsgDestHandle,
- WM_MF_WIFI_READ_POWER_FAIL,
- 0,
- 0
- );
- log->Add(DateToStr(Date()) + " " + CurrentTimeStr() +
- " WiFi tester reads TX power fail "
- );
- return false;
- }
- virTX = virTX - d_CL;
- if (virTX > d_max_p || virTX < d_min_p)
- {
- log->Add(DateToStr(Date()) + " " + CurrentTimeStr() +
- " WiFi tester > read TX power = "+ Double_To_AnsiString( virTX ) +
- " ( Out of Range ), min TX power = " + Double_To_AnsiString( d_min_p ) + ", max TX power = " + Double_To_AnsiString( d_max_p )
- );
- out_of_range_flag = true;
- }
- else
- {
- log->Add(DateToStr(Date()) + " " + CurrentTimeStr() +
- " WiFi tester > read TX power = "+ Double_To_AnsiString( virTX ) +
- " ( Pass ), min TX power = " + Double_To_AnsiString( d_min_p ) + ", max TX power = " + Double_To_AnsiString( d_max_p )
- );
- }
- } // for(ch_idx)
- e_802_11_idx++;
- } // while
- META_RESULT MetaResult = META_WiFi_Stop_r( m_pCal->i_MainMETAHandle, 500 );
- if (META_SUCCESS != MetaResult)
- {
- CalErrorHandler(WM_MF_WIFI_CPT_FAIL);
- log->Add(DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL: Target > WiFi stop fail."
- );
- return false;
- }
- if (out_of_range_flag)
- {
- CalErrorHandler(WM_MF_RF_TX_LEVEL_CHECK_FAIL );
- log->Add(DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL : WiFi TX power check " + "n"
- );
- return false;
- }
- if (m_pCal->b_WiFiAlcSupport)
- {
- WriteWiFiALCCalResultToFile(as_ID+".cal",Application->ExeName, m_pCal->b_CalResultPath);
- }
- frmFatcory->DisableAllCalTimer();
- PostMessage(ctrl.hPostMsgDestHandle,
- WM_MF_WIFI_TX_POWER_CALIBRATION_DONE,
- 0,
- 0
- );
- log->Add(DateToStr(Date()) + " " + CurrentTimeStr() +
- " ====================== WiFi TX power check end ===================== "
- );
- return true;
- }