Commit 3d2d810d authored by Julio Tambara's avatar Julio Tambara
Browse files

LLDt refeito, começando a tratar os erros pelo programa em python

parent d00e9996
......@@ -135,15 +135,6 @@ int main(int argc, char **argv)
}
memset( histo_buff, 0, N957_MAX_HISTO_SAMPLES* sizeof( *histo_buff));
/*JULIO if( user_setting.m_log_to_file) {
if( ( out_file= fopen( user_setting.m_log_filename, "wt"))== NULL)
{
ret_val= -12;
goto exit_point;
}
}*/
do_exit= FALSE;
while( !do_exit) {
......@@ -181,7 +172,7 @@ int main(int argc, char **argv)
if( N957_GetScaler(user_setting.m_N957_handle, &data32))
{
TRACE("erro_5");
goto exit_point;
//goto exit_point;
}
......@@ -189,7 +180,7 @@ int main(int argc, char **argv)
if(N957_StartAcquire( user_setting.m_N957_handle, user_setting.m_mode))
{
TRACE("erro_6");
goto exit_point;
//goto exit_point;
}
if( user_setting.m_debug) {
......@@ -197,9 +188,10 @@ int main(int argc, char **argv)
{
TRACE("erro_7");
goto exit_point;
//goto exit_point;
}
}
TRACE("OK\n");
break;
case 'r':
......@@ -241,26 +233,26 @@ int main(int argc, char **argv)
if((N957_StartAcquire(user_setting.m_N957_handle,user_setting.m_mode)))
{
TRACE("erro_6");
TRACE("erro_6\n");
goto exit_point;
}
if( user_setting.m_debug) {
if((N957_SetSwConvFlag( user_setting.m_N957_handle, N957_TRUE)))
{
TRACE("erro_7");
TRACE("erro_7\n");
goto exit_point;
}
}
data_buff= malloc( user_setting.m_bldim* sizeof( N957_UINT16));
if( data_buff== NULL)
{
TRACE("erro_8");
TRACE("erro_8\n");
goto exit_point;
}
histo_buff= malloc( N957_MAX_HISTO_SAMPLES* sizeof( *histo_buff));
if( histo_buff== NULL)
{
TRACE("erro_8");
TRACE("erro_8\n");
goto exit_point;
}
memset( histo_buff, 0, N957_MAX_HISTO_SAMPLES* sizeof( *histo_buff));
......@@ -318,13 +310,15 @@ int main(int argc, char **argv)
TRACE1("%d\n",tamanho);*/ // mostra se quntas contagens tem no buffer
break;
case 'j': //
lldt = lldt + 1;
case 'j': // funcao testada
lldt= ((getchar())*10 + getchar());
N957_SetLLD( user_setting.m_N957_handle, lldt);
break;
case 'l':
N957_SetLLD( user_setting.m_N957_handle, lldt);
lldt=0;
//N957_SetLLD( user_setting.m_N957_handle, lldt);
//lldt=0;
break;
case 'z': // salva o arquivo em "save.dat" o qual vai ser renomeado pelo programa em python
log = fopen("save.dat", "w+");
......@@ -366,7 +360,7 @@ int main(int argc, char **argv)
// clear software convertion
if( N957_SetSwConvFlag( user_setting.m_N957_handle, N957_FALSE))
{
TRACE("erro_20");
TRACE("erro_20\n");
goto exit_point;
}
}
......
......@@ -26,9 +26,17 @@ sys.setrecursionlimit(5000)
def start():
global child
print 'teste'
child.send('s')
time.sleep(0.2)
if testeerro(child.readline()):
print 'True'
return True
else:
print 'false'
return False
def teste():
child.send('teste')
......@@ -199,28 +207,44 @@ def settime():
Interface['labels'][2].configure(text='Live Time: %ss' %str(Livetime['LiveTime']/1000))
def testeerro(Data):
if Data == 'error_1':
tkMessageBox.showinfo("Erro", "user_settings_open erro! ")
elif Data == 'erro_2':
tkMessageBox.showinfo("Erro", "user_settings_parse_input_param error!")
elif Data == 'erro_3':
tkMessageBox.showinfo("Erro", "N957_GetFWRelease error!")
elif Data == 'erro_4':
tkMessageBox.showinfo("Erro", "Problemas ao iniciar")
elif Data == 'erro_5':
tkMessageBox.showinfo("Erro", "N957_GetScaler")
elif Data == 'erro_6':
tkMessageBox.showinfo("Erro", "N957_StartAcquire")
elif Data == 'erro_7':
tkMessageBox.showinfo("Erro", "N957_SetSwConvFlag")
if not Data == 'OK':
if Data == 'error_1':
print 'erro_1'
tkMessageBox.showinfo("Erro", "user_settings_open erro! ")
return False
elif Data == 'erro_2':
print 'erro_2'
tkMessageBox.showinfo("Erro", "user_settings_parse_input_param error!")
return False
elif Data == 'erro_3':
print 'erro_3'
tkMessageBox.showinfo("Erro", "N957_GetFWRelease error!")
return False
elif Data == 'erro_4':
print 'erro_4'
tkMessageBox.showinfo("Erro", "Problemas ao iniciar")
return False
elif Data == 'erro_5':
print 'erro_5'
tkMessageBox.showinfo("Erro", "N957_GetScaler")
return False
elif Data == 'erro_6':
print 'erro_6'
tkMessageBox.showinfo("Erro", "N957_StartAcquire")
return False
elif Data == 'erro_7':
print 'erro_7'
tkMessageBox.showinfo("Erro", "N957_SetSwConvFlag")
return False
elif Data == 'erro_8':
tkMessageBox.showinfo("Erro", "Erro ao criar alocar memória ")
elif Data == 'erro_9':
tkMessageBox.showinfo("Erro", "N957_ReadData")
tkMessageBox.showinfo("Erro", "Erro ao criar alocar memória ")
return False
elif Data == 'erro_9':
tkMessageBox.showinfo("Erro", "N957_ReadData")
return False
else:
return True
def graphic2(Data): #Plot
temp.set_xdata(range(int(Interface['spinboxes'][0].get())))
temp.set_ydata(Data)
......@@ -245,7 +269,7 @@ def graphic2(Data): #Plot
def graphic(): # Le os dados
global child, Data
Data = eval(child.readline().strip("\r\n"))
testeerro(Data)
#testeerro(Data)
graphic2(Data)
settime()
......@@ -367,9 +391,9 @@ def lldt():
global child
if lldtent.get().isdigit():
if int(lldtent.get()) < 100: # Percentual
for k in arange(0, int(lldtent.get()), 1):
child.send('j')
child.send('l')
child.send('j')
child.send(chr(int(lldtent.get())/10))
child.send(chr(int(lldtent.get())%10))
lldtwin.destroy()
else:
tkMessageBox.showinfo("Error", "Invalid value; Percent based")
......
......@@ -192,11 +192,8 @@ BOOL parse_config_file( user_setting_data* p_data) {
fscanf(p_conf_file, "%d", &p_data->m_bd_num);
//
// init caen N957 lib
if( ( N957_error_code= N957_Init( (short)p_data->m_bd_num, &p_data->m_N957_handle))!= N957Success)
if( (N957_Init( (short)p_data->m_bd_num, &p_data->m_N957_handle)))
{
TRACE( "N957 : N957_Init : ");
TRACE( N957_DecodeError( N957_error_code));
TRACE( "\n");
ret_val= FALSE;
goto exit_point;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment