Reputation: 31
I have an ESP32-S3-Matrix and I've programmed it to display the number 99 and count down on button press to 0. The matrix is properly displaying the number 99 using the default font, but it is cut off the display (too big).
I want to swap the font to TomThumb.h since it's small (only 5x7) and would fix the issue but anytime I load this font, LEDs no longer appear. There are no reported errors or warnings. No fonts within GFX seem to work. Only the default. Any ideas?
Here is the relevant code:
#include <Adafruit_GFX.h>
#include <Adafruit_NeoMatrix.h>
#include <Fonts/TomThumb.h> // If this is commented out, display works fine. I have also tried other fonts.
// Define the matrix size and pin
#define MATRIX_WIDTH 8
#define MATRIX_HEIGHT 8
#define MATRIX_PIN 14 // Change this to your data pin
Adafruit_NeoMatrix matrix = Adafruit_NeoMatrix(MATRIX_WIDTH, MATRIX_HEIGHT, MATRIX_PIN,
NEO_MATRIX_TOP + NEO_MATRIX_RIGHT +
NEO_MATRIX_COLUMNS + NEO_MATRIX_PROGRESSIVE,
NEO_RGB + NEO_KHZ800);
int number = 99;
void setup() {
matrix.begin();
matrix.setBrightness(1); // Kept to 1 so it doesn't burn my eyes out
matrix.setTextWrap(false);
matrix.setFont(&TomThumb); // If this is commented out, display works fine.
matrix.setTextColor(matrix.Color(255, 0, 0)); // Red color for digits
// Set up the boot button as an input
pinMode(0, INPUT_PULLUP); // Assuming the boot button is connected to GPIO 0
}
...
Thanks!
Upvotes: 2
Views: 63
Reputation: 31
Answering my own question here. The issue was adjusting the cursor offset based on the font baseline. The default baseline is at the top, so a 0,0 works fine, but others align to the bottom, meaning you need to "push" it back onto the display. Thx!
Upvotes: 1