Commit 96eeb4e9 authored by Arnaud Blanchard's avatar Arnaud Blanchard
Browse files

Fix diaplay of one value, Fix bug when 64 values

parent 252fec05
......@@ -67,6 +67,7 @@ void create_graph(blc_channel *input, char const *title, int refresh_period, flo
init_term(pipef, title, verbatim);
if (min!=max) fprintf(pipef, "set yrange [%f:%f]\n", min, max);
if (columns_nb==1) xmin=-1;
if (xmin!=xmax) fprintf(pipef, "set xrange [%f:%f]\n", xmin, xmax);
if (input->dims_nb==2){
......@@ -74,9 +75,6 @@ void create_graph(blc_channel *input, char const *title, int refresh_period, flo
fprintf(pipef, "set yrange [%f:%f]\n", 0.f, 10.f);
fprintf(pipef, "set zrange [%f:%f]\n", min, max);
fprintf(pipef, "set view 30,190\n");
offset=snprintf(command, LINE_MAX, "splot '-' binary format='%s' array=%dx%d title 'values' with pm3d ", gnuplot_format, columns_nb, rows_nb);
}
else{
......@@ -92,8 +90,6 @@ void create_graph(blc_channel *input, char const *title, int refresh_period, flo
buffer=MANY_ALLOCATIONS(input->size, char);
blc_loop_try_add_waiting_semaphore(input->sem_new_data);
BLC_COMMAND_LOOP(refresh_period){
memcpy(buffer, input->data, input->size);
if (input->sem_ack_data) SYSTEM_ERROR_CHECK(sem_post(input->sem_ack_data), -1, NULL);
......
......@@ -95,7 +95,7 @@ static void *refresh_history_cb(void *history_pt){
void create_history_graph(blc_channel *input, char const *title, int history_length, int refresh_period, int sampling_period, float min, float max, char const *verbatim){
char const *gnuplot_format=NULL;
char command[LINE_MAX];
char command[ARG_MAX];
char code;
int i, offset, columns_nb=0;
......@@ -147,7 +147,7 @@ void create_history_graph(blc_channel *input, char const *title, int history_len
else if (i==62) code='[';
else if (i==63) code=']';
else EXIT_ON_ERROR("Too many columns. You have '%d' max is 64", columns_nb);
offset+=snprintf(command+offset, LINE_MAX-offset, ", '-' binary format='%s' record=%d u ($0*%f):1 t '%c' w %s", gnuplot_format, history_length, sampling_period/1000000.f, code, with_option);
offset+=snprintf(command+offset, ARG_MAX-offset, ", '-' binary format='%s' record=%d u ($0*%f):1 t '%c' w %s", gnuplot_format, history_length, sampling_period/1000000.f, code, with_option);
}
history.init(input->type, input->format, 2, columns_nb, history_length);
......
......@@ -46,28 +46,10 @@ int main(int argc, char *argv[]){
blc_program_add_option(&refresh_string, 'P', "period", "UI32", "graph refresh period in ms", "100");
blc_program_add_parameter(&channel_name, "blc_channel", 1, "channel you want to graph", NULL);
// blc_program_add_option(&size_str, 's', "size", "UI32[xUI32]", "size of the matrix", NULL);
blc_program_init(&argc, &argv, blc_quit);
blc_command_forward_blc_channels();
/*
if (size_str){
dims_nb=blc_sscan_dims(&lengths, size_str);
switch(dims_nb){
case 1: final_columns_nb=lengths[0];
final_rows_nb=1;
break;
case 2:final_columns_nb=lengths[0];
final_rows_nb=lengths[1];
break;
default:EXIT_ON_ERROR("Size of dim %d is not yet managed in size '%s'.", dims_nb, size_str);
}
FREE(lengths);
}*/
input.open(channel_name, BLC_CHANNEL_READ);
if (min_str) min=strtof(min_str, NULL);
else switch (input.type){
case 'UIN8':case 'UI16':case 'UI32':case 'IN16':case 'IN32':case 'IN64':case 'FL32':case'FL64':min=0.0;break;
......@@ -108,10 +90,3 @@ int main(int argc, char *argv[]){
return (status);
}
Supports Markdown
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