Project

General

Profile

Files » CVI_panel.c

Frédéric Blanc, 2016-01-29 09:57

 
/**
* @brief testeur DCDC
* @date 17/10/2011
* @author F.BLANC LAAS-CNRS
*
*/
#include "asynctmr.h"
#include "var.h"

/**
* @brief fonction de control du panel control
* @param CVI
* @return CVI
* @date 25/02/2010
*
*/
int CVICALLBACK fnct_ctrl (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
switch (event)
{
case EVENT_COMMIT:
SetCtrlAttribute (T_panel[PANEL_MEASURE].panel,P_MEASURE_START,ATTR_DIMMED, 1);
break;
}
return 0;
}
/**
* @brief fermeture panel
* @param CVI
* @return CVI
* @date 25/02/2010
*
*/
int CVICALLBACK CVI_close (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
switch (event)
{
case EVENT_COMMIT:
if (panel==T_panel[PANEL_TOP].panel)
{
QuitUserInterface (0);
}
else
{
HidePanel (panel);
}
break;
}
return 0;
}

/**
* @brief gestion du resize
* @param CVI
* @return CVI
* @date 25/02/2010
*
*/
int CVICALLBACK CVI_panel_size(int panel, int event, void *callbackData, int eventData1, int eventData2)
{

if(event==EVENT_PANEL_SIZE)
{
if(panel==T_panel[PANEL_LOG].panel)
{
GetPanelAttribute (T_panel[PANEL_LOG].panel, ATTR_TOP, &T_panel[PANEL_LOG].top);
GetPanelAttribute (T_panel[PANEL_LOG].panel, ATTR_LEFT,&T_panel[PANEL_LOG].left);
GetPanelAttribute (T_panel[PANEL_LOG].panel, ATTR_HEIGHT, &T_panel[PANEL_LOG].height);
GetPanelAttribute (T_panel[PANEL_LOG].panel, ATTR_WIDTH,&T_panel[PANEL_LOG].width);
SetCtrlAttribute (T_panel[PANEL_LOG].panel, P_LOG_TXT, ATTR_HEIGHT, T_panel[PANEL_LOG].height-10);
SetCtrlAttribute (T_panel[PANEL_LOG].panel, P_LOG_TXT, ATTR_WIDTH,T_panel[PANEL_LOG].width-5);
SetCtrlVal (T_panel[PANEL_LOG].panel,P_LOG_TXT,"");
}
}
return 0;
}

/**
* @brief gestion des bouton
* @param CVI
* @return CVI
* @date 25/02/2010
*
*/
int CVICALLBACK CVI_button(int panel, int control, int event, void *callbackData, int eventData1, int eventData2)

{
char reponse;
int i,ch,test;
int ctrlarray;
if(event==EVENT_PANEL_SIZE)
{
if(panel==T_panel[PANEL_LOG].panel)
{
GetPanelAttribute (T_panel[PANEL_LOG].panel, ATTR_TOP, &T_panel[PANEL_LOG].top);
GetPanelAttribute (T_panel[PANEL_LOG].panel, ATTR_LEFT,&T_panel[PANEL_LOG].left);
GetPanelAttribute (T_panel[PANEL_LOG].panel, ATTR_HEIGHT, &T_panel[PANEL_LOG].height);
GetPanelAttribute (T_panel[PANEL_LOG].panel, ATTR_WIDTH,&T_panel[PANEL_LOG].width);
SetCtrlAttribute (T_panel[PANEL_LOG].panel, P_LOG_TXT, ATTR_HEIGHT, T_panel[PANEL_LOG].height-10);
SetCtrlAttribute (T_panel[PANEL_LOG].panel, P_LOG_TXT, ATTR_WIDTH,T_panel[PANEL_LOG].width-5);

}
}
if(event==EVENT_COMMIT)
{
if(panel==T_panel[PANEL_TOP].panel)
{

}
if(panel==T_panel[PANEL_PORT].panel)
{
switch (control)
{
case P_PORT_COM:
GetCtrlVal (panel,P_PORT_INSTRUM,&reponse);
instrument[reponse].port.typeCOM=RS232;
check_type (panel,RS232);
break;
case P_PORT_USB:
GetCtrlVal (panel,P_PORT_INSTRUM,&reponse);
instrument[reponse].port.typeCOM=USB;
check_type (panel,USB);
break;
case P_PORT_GPIB:
GetCtrlVal (panel,P_PORT_INSTRUM,&reponse);
instrument[reponse].port.typeCOM=GPIB;
check_type (panel,GPIB);
break;
case P_PORT_ETH:
GetCtrlVal (panel,P_PORT_INSTRUM,&reponse);
instrument[reponse].port.typeCOM=ETH;
check_type (panel,ETH);
break;
case P_PORT_OK :
HidePanel (panel);
GetCtrlVal (panel,P_PORT_INSTRUM,&reponse);
get_panel_port(panel,&instrument[reponse].port);
break;
}
}
if(panel==T_panel[PANEL_CONTROL].panel)
{
switch (control)
{
case P_CONTROL_OK:
Get_panel_control();
Set_panel_measure_time_total();
SetCtrlVal(T_panel[PANEL_MEASURE].panel,P_MEASURE_FREQ,consigne[0].freq/1000);
SetCtrlVal(T_panel[PANEL_MEASURE].panel,P_MEASURE_PWM,consigne[0].pwm);
SetCtrlAttribute (T_panel[PANEL_MEASURE].panel,P_MEASURE_INTER,ATTR_DIMMED, !consigne[0].interleaving);
init_phase();
for(i=INST_AFG;i<=INST_AFG_2;++i)
for(ch=1;ch<=2;++ch)
{
cmd_AFG_freq(i,ch);
cmd_AFG_delay(i,ch);
}
SetCtrlAttribute (T_panel[PANEL_MEASURE].panel,P_MEASURE_START,ATTR_DIMMED, 0);
break;
case P_CONTROL_V3:
GetCtrlVal(T_panel[PANEL_CONTROL].panel,P_CONTROL_V3,&Ctrl.m_V3);
SetCtrlAttribute (T_panel[PANEL_MEASURE].panel,P_MEASURE_V3,ATTR_VISIBLE, Ctrl.m_V3);
if(Ctrl.m_V3)
save_LOG("Voltage measurement V3 ON");
else
save_LOG("Voltage measurement V3 OFF");
break;
case P_CONTROL_V4:
GetCtrlVal(T_panel[PANEL_CONTROL].panel,P_CONTROL_V4,&Ctrl.m_V4);
SetCtrlAttribute (T_panel[PANEL_MEASURE].panel,P_MEASURE_V4,ATTR_VISIBLE, Ctrl.m_V4);
if(Ctrl.m_V4)
save_LOG("Voltage measurement V4 ON");
else
save_LOG("Voltage measurement V4 OFF");
break;
case P_CONTROL_I3:
GetCtrlVal(T_panel[PANEL_CONTROL].panel,P_CONTROL_I3,&Ctrl.m_I3);
SetCtrlAttribute (T_panel[PANEL_MEASURE].panel,P_MEASURE_I3,ATTR_VISIBLE, Ctrl.m_I3);
if(Ctrl.m_I3)
save_LOG("Current measurement I3 ON");
else
save_LOG("Current measurement I3 OFF");
break;
case P_CONTROL_I4:
GetCtrlVal(T_panel[PANEL_CONTROL].panel,P_CONTROL_I4,&Ctrl.m_I4);
SetCtrlAttribute (T_panel[PANEL_MEASURE].panel,P_MEASURE_I4,ATTR_VISIBLE, Ctrl.m_I4);
if(Ctrl.m_I4)
save_LOG("Current measurement I4 ON");
else
save_LOG("Current measurement I4 OFF");
break;
case P_CONTROL_P3:
GetCtrlVal(T_panel[PANEL_CONTROL].panel,P_CONTROL_P3,&Ctrl.m_P3);
SetCtrlAttribute (T_panel[PANEL_MEASURE].panel,P_MEASURE_P3,ATTR_VISIBLE, Ctrl.m_P3);
if(Ctrl.m_P3)
save_LOG("Current measurement P3 ON");
else
save_LOG("Current measurement P3 OFF");
break;
case P_CONTROL_P4:
GetCtrlVal(T_panel[PANEL_CONTROL].panel,P_CONTROL_P4,&Ctrl.m_P4);
SetCtrlAttribute (T_panel[PANEL_MEASURE].panel,P_MEASURE_P4,ATTR_VISIBLE, Ctrl.m_P4);
if(Ctrl.m_P4)
save_LOG("Current measurement P4 ON");
else
save_LOG("Current measurement P4 OFF");
break;
//a modifier
case P_CONTROL_RINGMODE:
GetCtrlVal(T_panel[PANEL_CONTROL].panel,P_CONTROL_RINGMODE,&Ctrl.Iout);
consigne[0].Pout_START=0;
consigne[0].Pout_STOP=0;
consigne[0].Pout_STEP=0;
consigne[0].Vout_START=0;
consigne[0].Vout_STOP=0;
consigne[0].Vout_STEP=0;
Set_panel_control();
break;
case P_CONTROL_CANCEL:
Set_panel_control();
break;
}
}
if(panel==T_panel[PANEL_MEASURE].panel)
{
switch (control)
{
case P_MEASURE_START:
fnct_start ();
break;
case P_MEASURE_STOP:
Ctrl.stop=1;
fnct_stop ();
break;
}
}
}
return 0;
}

/**
* @brief validationSETUP
* @param [in] type
* @return 0
* @date 13/12/2010
*
*/
int validationSETUP(int instrum)
{
int click,click_panel;
int lock;

SetCtrlVal(T_panel[PANEL_PORT].panel,P_PORT_INSTRUM,instrum);
check_type (T_panel[PANEL_PORT].panel,instrument[instrum].port.typeCOM);
set_panel_port(T_panel[PANEL_PORT].panel,&instrument[instrum].port);
DisplayPanel (T_panel[PANEL_PORT].panel);
lock=1;
while(lock)
{
GetUserEvent (1,&click_panel ,&click );
if(click_panel==T_panel[PANEL_PORT].panel)
{
switch (click)
{
case P_PORT_OK:
lock=0;
break;
case P_PORT_CANCEL:
lock=0;
break;
}
}

}

return 0;
}
/**
* @brief gestion des ring
* @param CVI
* @return CVI
* @date 25/02/2010
*
*/

int CVICALLBACK CVI_ring (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
if(event==EVENT_COMMIT)
{
GetCtrlVal (T_panel[PANEL_CONTROL].panel,P_CONTROL_RINGPHAS,&consigne[0].phase);
init_phase();
}
return 0;
}
(8-8/25)