Commit 6c90251c authored by Arnaud Blanchard's avatar Arnaud Blanchard

Add command to send generic command to gnuplot and change ranges

parent 5c9fdbdd
......@@ -104,7 +104,25 @@ void create_graph(deque <blc_channel>&inputs, const char *title, int refresh_per
blc_loop_try_add_waiting_semaphore(inputs[i].sem_new_data);
blc_loop_try_add_posting_semaphore(inputs[i].sem_ack_data);
}
blc_command_add("c", [](char *argument, void *pipef ) -> void {
fprintf((FILE*)pipef, "\n%s\n", argument);
}, "string", "send command to gnuplot", pipef);
blc_command_add("x", [](char *argument, void *pipef ) -> void {
fprintf((FILE*)pipef, "\nset xrange [%s:]\n", argument);
}, "real", "min x value", pipef);
blc_command_add("X", [](char *argument, void *pipef ) -> void {
fprintf((FILE*)pipef, "\nset xrange [:%s]\n", argument);
}, "real", "max x value", pipef);
blc_command_add("m", [](char *argument, void *pipef ) -> void {
fprintf((FILE*)pipef, "\nset yrange [%s:]\n", argument);
}, "real", "min y value", pipef);
blc_command_add("M", [](char *argument, void *pipef ) -> void {
fprintf((FILE*)pipef, "\nset yrange [:%s]\n", argument);
}, "real", "max y value", pipef);
BLC_COMMAND_LOOP(refresh_period){
fprintf(pipef, "\n%s\n", command);
for (i=0;i<inputs.size();i++) {
SYSTEM_SUCCESS_CHECK(fwrite(inputs[i].data, element_size, columns_nb*rows_nb, pipef), columns_nb*rows_nb, NULL);
......
......@@ -39,12 +39,12 @@ int main(int argc, char *argv[]){
int dims_nb;
blc_program_set_description("Display the content of the blc_channel depending on its type and format");
blc_program_add_option(&verbatim, 'c', "command", "string", "command directly send to gnuplot", NULL);
blc_program_add_option(&ymin_str, 'm', "min", "FL32", "minimal value", NULL);
blc_program_add_option(&ymax_str, 'M', "max", "FL32", "maximal value", NULL);
blc_program_add_option(&sample_string, 'p', "period", "UI32", "sampling period in ms or history", "10");
blc_program_add_option(&style_option, 's', "style", "string", "gnuplot option set option (style, boxwidth, ...)", "fill solid");
blc_program_add_option(&surface_option, 'S', "surface", nullptr, "use splot", nullptr);
blc_program_add_option(&verbatim, 't', "text", "string", "text directly put on the gnuplot set commandline", NULL);
blc_program_add_option(&with_option, 'w', "with", "string", "gnuplot option with (lines, boxes, dots,...)", nullptr);
blc_program_add_option(&xmin_str, 'x', "xmin", "FL32", "minimal abscissa value", NULL);
blc_program_add_option(&xmax_str, 'X', "xmax", "FL32", "maximal abscissa value", NULL);
......@@ -110,6 +110,7 @@ int main(int argc, char *argv[]){
fprintf(stderr, "min(%.3lf), max(%.2lf) === \n", ymin, ymax);
blc_command_add("p", refresh_period_cb, "ms", "sampling period", NULL);
if (history_str) create_history_graph(inputs, (char const*)inputs[0].name+1, strtol(history_str, NULL, 10), sampling_period, strtol(sample_string, NULL, 10)*1000, ymin, ymax, verbatim);
else create_graph(inputs, inputs[0].name+1, sampling_period, ymin, ymax, xmin, xmax, lmax, verbatim);
......
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