From 0d2fe3c97d4a63a786f7dbadbd4ef8515a92af60 Mon Sep 17 00:00:00 2001 From: Thomas Venries Date: Wed, 23 Nov 2016 20:33:28 +0100 Subject: [PATCH] misc: Homogenize output for display info --- src/config/config.c | 1 - src/config/raster.c | 4 ++-- src/draw/draw.c | 4 ++-- src/main.c | 6 ++++-- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/config/config.c b/src/config/config.c index 7d08c2b..f72dfff 100644 --- a/src/config/config.c +++ b/src/config/config.c @@ -117,7 +117,6 @@ int pfan_read_dir(char *path, } } - fprintf(stdout, "\n"); closedir(dir); return n; } diff --git a/src/config/raster.c b/src/config/raster.c index 0df4b4f..c112b80 100644 --- a/src/config/raster.c +++ b/src/config/raster.c @@ -66,6 +66,7 @@ uint8_t **pfan_create_img_rasters(char img_paths[PFAN_MAX_DISPLAY][MAX_PATH], FILE *img = NULL; + fprintf(stdout, "\nDisplays:\n"); for (int i = 0; i < n; ++i) { img = pm_openr(img_paths[i]); if (!img) { @@ -74,11 +75,10 @@ uint8_t **pfan_create_img_rasters(char img_paths[PFAN_MAX_DISPLAY][MAX_PATH], return NULL; } rasters[i] = create_img_raster(img); - fprintf(stdout, "raster: '%s'\n", img_paths[i]); + fprintf(stdout, "%d: '%s'\n", i + 1, img_paths[i]); pm_close(img); } - fprintf(stdout, "\n"); return rasters; } diff --git a/src/draw/draw.c b/src/draw/draw.c index b99e937..c0f5735 100644 --- a/src/draw/draw.c +++ b/src/draw/draw.c @@ -107,7 +107,7 @@ int pfan_draw_paragraph(char *text, int chars = 0; char *itr = text; - fprintf(stdout, "Displays:\n\n"); + fprintf(stdout, "\nDisplays:\n"); for (i = 0; i < PFAN_MAX_DISPLAY; ++i) { if (*itr == '\0') break; @@ -142,7 +142,7 @@ int pfan_draw_paragraph(char *text, break; } pfan_draw_text(itr - count, count, PFAN_LSPACE, display[i]); - fprintf(stdout, "%d: [%.*s%*s]\n\n", i + 1, count, itr - count, + fprintf(stdout, "%d: [%.*s%*s]\n", i + 1, count, itr - count, PFAN_MAX_CHAR - count, ""); count = 0; } diff --git a/src/main.c b/src/main.c index 49bd51f..e75cd8d 100644 --- a/src/main.c +++ b/src/main.c @@ -83,6 +83,8 @@ int main(int argc, char **argv) if (opts.fflag) memset(effects, 0x06, sizeof(effects)); + fprintf(stdout, "\n"); + libusb_device_handle *usb_handle = NULL; if (libusb_init(NULL) < 0) { @@ -101,7 +103,7 @@ int main(int argc, char **argv) } fprintf(stdout, "Device found.\n"); - fprintf(stdout, "Transfer is starting.\n"); + fprintf(stdout, "Transfer started.\n"); int expected_transfer = 320 * img_nbr; int bytes = pfan_send(usb_handle, img_nbr, effects, displays); @@ -117,7 +119,7 @@ int main(int argc, char **argv) } fprintf(stdout, "Transfer is complete.\n\n"); - fprintf(stdout, "( %d / %d bytes)\n\n", bytes, expected_transfer); + pfan_close(usb_handle); if (rasters) pfan_free_rasters(rasters, img_nbr);