Widgets not compiling, new API


#1

New API is awesome, liking it so far.

I did notice that some examples don’t compile. Let me know what you think.

For example, when I try to compile Widgets, I get this:

Arduino: 1.8.7 (Mac OS X), Board: “Blink”

/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/…/lib/gcc/avr/5.4.0/…/…/…/…/avr/bin/ld: Widgets.ino.elf section .text' will not fit in regiontext’
/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/…/lib/gcc/avr/5.4.0/…/…/…/…/avr/bin/ld: region `text’ overflowed by 722 bytes
collect2: error: ld returned 1 exit status
exit status 1
Error compiling for board Blink.

This report would have more information with
“Show verbose output during compilation”
option enabled in File -> Preferences.


#2

This part shows that the sketch is too big of a game, 722 bytes over. Trying to figure out if we axe the Rock, Paper, Scissors part of the Widgets or try to rewrite the application to get it in with space saving.

We created a branch, noRPS, that can fit the Widgets into the new codebase.


#3

Got it.

Looking at the code, it seems like there might be an opportunity to save space by replacing a lot of the CASE statements that set displays with just lookup tables.

There is a pattern where you dim all the LEDs, then light up selected LEDs. You might replace this with a function that does setPattern(c1, c2, c3, c4, c5, c6) where those are all colors.

Or you could even do setPattern(pattern) where pattern is an array of color and brightness settings, and you set those up at the beginning.


#4

Thanks @gpvillamil, these are good suggestions and worth a try, I am curious to know how much space those simple changes save, could be enough on its own :slight_smile: