Skip to content

Conversation

@BrynM
Copy link

@BrynM BrynM commented Sep 28, 2025

Font storage in PROGMEM example.

I'm working on a project where memory is a premium, but still wanted to use the simple font you'd created. Thus, I moved the font to PROGMEM. I thought others might make use of it too and wanted to contrib something back to you.

I collapsed both draw functions into a single drawPMem() function to make for less index juggling (the call to pgm_read_byte_near() needs full indices). Yes, that makes for a deep nested for, but it was cleaner to read for noobs than the index juggling.

Thanks for the library!

@BrynM
Copy link
Author

BrynM commented Sep 28, 2025

Sorry for the force push to my fork. I wanted to squash the commits so your review would be cleaner.

correct to pin used in other examples
grammar fixes
missed a const
@bartoszbielawski
Copy link
Owner

Hi,

Thanks for the extra code. Your approach makes sense on the memory limited device.
Since you're using AVR specific functions, would you mind adding some #ifs and #errors to print messages if the CPU is not AVR?

Cheers,
Bartosz

@BrynM
Copy link
Author

BrynM commented Sep 29, 2025

Sure. Do you have any examples I can look at for what to flag or how you'd like it handled? I hadn't considered it being AVR-specific, but it indeed is.

@bartoszbielawski
Copy link
Owner

bartoszbielawski commented Sep 30, 2025

I think there's an __AVR__ #define while using avr-gcc. Could you check it? I suggest just raising an error if the MCU is NOT AVR.

@BrynM
Copy link
Author

BrynM commented Oct 5, 2025

Sorry for the wait. I ordered an ESP32 to test with since I found out there's some support for a PROGMEM concept there. If I can get that to work, I'll include it as a possibility too.

@bartoszbielawski
Copy link
Owner

Don't worry, we're not in a hurry :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants