|
/**
|
|
* @brief testeur DCDC
|
|
* @date 17/10/2011
|
|
* @author F.BLANC LAAS-CNRS
|
|
*
|
|
*/
|
|
#include "asynctmr.h"
|
|
#include "var.h"
|
|
|
|
|
|
/**
|
|
* @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;
|
|
char message[256];
|
|
if(event==EVENT_COMMIT)
|
|
{
|
|
if(panel==T_panel[PANEL_TOP].panel)
|
|
{
|
|
|
|
}
|
|
if(panel==T_panel[PANEL_PORT].panel)
|
|
{
|
|
GetCtrlVal (panel,P_PORT_INSTRUM,&reponse);
|
|
switch (control)
|
|
{
|
|
case P_PORT_COM:
|
|
|
|
instrument[reponse].port.typeCOM=RS232;
|
|
check_type (panel,RS232);
|
|
break;
|
|
case P_PORT_USB:
|
|
|
|
instrument[reponse].port.typeCOM=USB;
|
|
check_type (panel,USB);
|
|
break;
|
|
case P_PORT_GPIB:
|
|
|
|
instrument[reponse].port.typeCOM=GPIB;
|
|
check_type (panel,GPIB);
|
|
break;
|
|
case P_PORT_ETH:
|
|
|
|
instrument[reponse].port.typeCOM=ETH;
|
|
check_type (panel,ETH);
|
|
break;
|
|
case P_PORT_OK :
|
|
HidePanel (panel);
|
|
get_panel_port(panel,&instrument[reponse].port);
|
|
GetCtrlVal (T_panel[PANEL_PORT].panel,P_PORT_INSTRUM,&reponse);
|
|
switch (reponse)
|
|
{
|
|
{
|
|
case INST_POWER :
|
|
init_POWER(INST_POWER);
|
|
break;
|
|
case INST_LOAD :
|
|
init_LOAD(INST_LOAD);
|
|
break;
|
|
case INST_SMU :
|
|
init_SMU(INST_SMU);
|
|
break;
|
|
case INST_SAS :
|
|
init_SAS(INST_SAS);
|
|
break;
|
|
case INST_PM :
|
|
init_PM(INST_PM);
|
|
break;
|
|
case INST_TEMP :
|
|
init_TEMP(INST_TEMP);
|
|
|
|
|
|
break;
|
|
}
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
if(panel==T_panel[PANEL_CYCLE].panel)
|
|
{
|
|
|
|
switch (control)
|
|
{
|
|
case P_CYCLE_OK:
|
|
HidePanel (panel);
|
|
GetCtrlVal (T_panel[PANEL_CYCLE].panel,P_CYCLE_H_CYCLE,&Ctrl.cycle);
|
|
Get_panel_cycle ();
|
|
break;
|
|
case P_CYCLE_RINGSLIDE:
|
|
Set_panel_cycle_mode ();
|
|
break;
|
|
case P_CYCLE_RINGSTOP:
|
|
Set_panel_cycle_mode ();
|
|
break;
|
|
case P_CYCLE_H_CYCLE:
|
|
Get_panel_cycle ();
|
|
GetCtrlVal (T_panel[PANEL_CYCLE].panel,P_CYCLE_H_CYCLE,&Ctrl.cycle);
|
|
if(Ctrl.cycle<1)
|
|
Ctrl.cycle=1;
|
|
if(Ctrl.cycle>Ctrl.nb_cycle)
|
|
Ctrl.cycle=Ctrl.nb_cycle;
|
|
Set_panel_cycle(Ctrl.cycle);
|
|
break;
|
|
case P_CYCLE_NB_CYCLE:
|
|
GetCtrlVal (T_panel[PANEL_CYCLE].panel,P_CYCLE_NB_CYCLE,&Ctrl.nb_cycle);
|
|
SetCtrlAttribute (T_panel[PANEL_CYCLE].panel,P_CYCLE_H_CYCLE,ATTR_MAX_VALUE, Ctrl.nb_cycle);
|
|
break;
|
|
case P_CYCLE_APPLY:
|
|
GetCtrlVal (T_panel[PANEL_CYCLE].panel,P_CYCLE_H_CYCLE,&Ctrl.cycle);
|
|
Get_panel_cycle ();
|
|
Set_panel_cycle(Ctrl.cycle);
|
|
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;
|
|
}
|
|
}
|
|
|
|
if(panel==T_panel[PANEL_BATT].panel)
|
|
{
|
|
switch (control)
|
|
{
|
|
case P_BATT_CHECKBOX_LOOP :
|
|
GetCtrlVal (T_panel[PANEL_BATT].panel,P_BATT_CHECKBOX_LOOP,&Ctrl.mode_loop);
|
|
SetCtrlAttribute (T_panel[PANEL_BATT].panel,P_BATT_NB_LOOP,ATTR_DIMMED, !Ctrl.mode_loop);
|
|
break;
|
|
case P_BATT_CHECKBOX_VMIN :
|
|
GetCtrlVal (T_panel[PANEL_BATT].panel,P_BATT_CHECKBOX_VMIN,&Ctrl.vminstop);
|
|
break;
|
|
case P_BATT_OK:
|
|
HidePanel (panel);
|
|
GetCtrlVal (T_panel[PANEL_BATT].panel,P_BATT_CHECKBOX_LOOP,&Ctrl.mode_loop);
|
|
GetCtrlVal (T_panel[PANEL_BATT].panel,P_BATT_NB_LOOP,&Ctrl.nb_loop);
|
|
GetCtrlVal (T_panel[PANEL_BATT].panel,P_BATT_CHECKBOX_VMIN,&Ctrl.vminstop);
|
|
GetCtrlVal (T_panel[PANEL_BATT].panel,P_BATT_ID,Ctrl.name_Batt);
|
|
if (Ctrl.mode_loop==0)
|
|
{
|
|
|
|
save_LOG("Mode LOOP OFF");
|
|
}else
|
|
{
|
|
sprintf(message,"Mode LOOP ON nb =%d ",Ctrl.nb_loop);
|
|
save_LOG( message);
|
|
}
|
|
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;
|
|
}
|
|
|