From dc61ac7f85e6f3788bce240f6a1a7f89fea02184 Mon Sep 17 00:00:00 2001 From: fruchti Date: Sat, 24 Aug 2024 20:51:17 +0200 Subject: [PATCH] Optionally print debug information --- build-number.txt | 2 +- src/config.h | 5 ++++- src/main.c | 18 ++++++++++++++++++ src/main.h | 1 + 4 files changed, 24 insertions(+), 2 deletions(-) diff --git a/build-number.txt b/build-number.txt index 3bfc51a..11a42ac 100644 --- a/build-number.txt +++ b/build-number.txt @@ -1 +1 @@ -562 +615 diff --git a/src/config.h b/src/config.h index 61e22c4..7a9b0db 100644 --- a/src/config.h +++ b/src/config.h @@ -15,4 +15,7 @@ #define CONFIG_MIN_FRAMES 2 // Maximum number of frames to wait. Capture even if it is not within tolerance. -#define CONFIG_MAX_FRAMES 15 \ No newline at end of file +#define CONFIG_MAX_FRAMES 15 + +// Print number of black pixels per captured frame +// #define CONFIG_PRINT_EXPOSURE_DEBUG_INFORMATION \ No newline at end of file diff --git a/src/main.c b/src/main.c index 2085066..108a766 100644 --- a/src/main.c +++ b/src/main.c @@ -22,6 +22,24 @@ int main(void) extern uint8_t ImageBuffer[CAMERA_IMAGE_WIDTH * CAMERA_IMAGE_HEIGHT / 8]; Print_Image(ImageBuffer, CAMERA_IMAGE_WIDTH, CAMERA_IMAGE_HEIGHT, 2); +#ifdef CONFIG_PRINT_EXPOSURE_DEBUG_INFORMATION + char buffer[32] = "Finished after lines: "; + itoa(Camera_FinalFrameCount, buffer + strlen(buffer), 10); + + Print_Text(buffer, &Arpegius_32); + Print_Text("Black pixel counts:", &Arpegius_32); + for(int i = 0; i < Camera_FinalFrameCount; i++) + { + if(i >= (int)(sizeof(Camera_BlackPixelCounts) + / sizeof(Camera_BlackPixelCounts[0]))) + { + break; + } + itoa(Camera_BlackPixelCounts[i], buffer, 10); + Print_Text(buffer, &Arpegius_32); + } +#endif + LTP1245_FeedPaper(100); BMP_Save(ImageBuffer, CAMERA_IMAGE_WIDTH, CAMERA_IMAGE_HEIGHT); diff --git a/src/main.h b/src/main.h index fd56361..532c2d3 100644 --- a/src/main.h +++ b/src/main.h @@ -16,6 +16,7 @@ #include "font_arpegius_16.h" #include "font_arpegius_32.h" #include "bmp.h" +#include "config.h" int main(void);