Skip to content

Commit

Permalink
misc: Homogenize output for display info
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Venries committed Nov 24, 2016
1 parent 2d3bb31 commit 0d2fe3c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
1 change: 0 additions & 1 deletion src/config/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ int pfan_read_dir(char *path,
}
}

fprintf(stdout, "\n");
closedir(dir);
return n;
}
4 changes: 2 additions & 2 deletions src/config/raster.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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;
}

Expand Down
4 changes: 2 additions & 2 deletions src/draw/draw.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down
6 changes: 4 additions & 2 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit 0d2fe3c

Please sign in to comment.