Over a year ago I released my first Arduino library, not knowing if anyone would care. The good news is that they do: people have been using ESP_8_BIT_Composite to drive composite video devices. The bad news is that they have been filing issues for me to fix. This backlog has piled up over several months and long overdue for me to go in and get things fixed up.
Two of the issues were merely compiler warnings, but I should still address them to minimize noise. What was weird to me that I didn’t see either of those warnings myself in the Arduino IDE. I had to switch over to using PlatformIO under Visual Studio Code, where I learned I could edit my
platformio.ini file to add
build_flags = […] to enable warnings of my choosing. Issue #24 was a
printf() formatting issue that I couldn’t see until I added
-Wformat, and issue #35 was invisible to me until I added
Since I was on the subject anyway, I executed a build with all warnings turned on. (
-Wall) This gave me far too many warnings to review. Not only did this slow down compilation to a snail’s pace, most of the hits were outside my code. Of items in my code, some appear to be overzealous rules giving me false positives. But I did see a few valid complaints of unused variables (
-Wunused-variable) and I removed them.
Issue #27 took a bit more work, mostly because I started out “knowing” things that were later proven to be wrong. I had added support for
setRotation() and I tested it with some text drawn via the AdafruitGFX library. (This test code became my example project
GFX_RotatedText) I didn’t explicitly test drawing rectangles because when I reviewed code for
Adafruit_GFX::drawChar() I saw that they use
writePixel() for text size 1 and
fillRect() for text sizes greater than one. So when my rotated text sample code worked correctly, I inferred that meant
fillRect() was correct as well.
That was wrong, and because I didn’t know it was wrong, I kept looking in wrong places. Not realizing that my coordinate transform math for
drawRect()) were fundamentally broken. These APIs passed in X/Y coordinates for the rectangle’s upper-left corner, and my mistake was forgetting that drawing commands are always in the original non-rotated orientation. When the rectangles are rotated, their upper-left corner is no longer the upper-left for the actual low-level drawing operations.
My incorrect foundation blinded me to the real problem, even though I saw failures across multiple test programs. Test programs evolved until one drew four rectangles every frame, one in each supported orientation, and cycle through modifying one of four parameters in a one-second-long animation. Only then could I see a pattern in the error and realize my mistake. This test code became my new example project
Finally, I had no luck with issue #23. I was not able to reproduce the compilation error myself and therefore I could not diagnose it. I reluctantly closed it out as “unable to reproduce” before tagging version 1.3.2 for release.