ToyKeeper / anduril

Anduril 2 Flashlight Firmware and FSM UI Toolkit
GNU General Public License v3.0
213 stars 52 forks source link

Abort compile if EEPROM_SIZE is exceeded #4

Closed DurvalMenezes closed 10 months ago

DurvalMenezes commented 10 months ago

As per the subject. Works automatically whenever the manufacturer's DFP include files define EEPROM_SIZE (it's not defined for all of them), so in case the EEPROM capacity is exceeded (ie, we try to store more code there than can fit), causes a compile-time error and at the same time has zero run-time overhead.

EDIT: has been extracted from my 8C-Quick_Aux_Switch mod, as they're completely independent of each other, and so they can be considered separately.

ToyKeeper commented 10 months ago

Thanks, that's a neat trick! :heart:

The patch here was an incomplete solution and in the wrong place though, so I applied it to a different part of the code to make it cleaner and more robust.

Fixed in e00326a6db6671414b43ee15e092c57ea976102f.

DurvalMenezes commented 9 months ago

Thanks, that's a neat trick! ❤️

Anytime. I'm glad I could contribute something of value.

The patch here was an incomplete solution and in the wrong place though, so I applied it to a different part of the code to make it cleaner and more robust.

I thought it was just perfect! :-) But seriously, I've just read through your commit (https://github.com/ToyKeeper/anduril/commit/e00326a6db6671414b43ee15e092c57ea976102f), compared it to mine (https://github.com/ToyKeeper/anduril/pull/4/commits/c4d6d744513f9da8caa0324607fe215fb28f4c8b) and I can see what you mean:

Thanks for your comment, now that I analyzed it I think I understand Anduril a little better.