As promised last week, here’s an inflight update for this week. It’s been a busy week as we get further along in the preparations for tcMenu 2.0, and try to bring mbed further into the fold.
First of the bat this week was to fix the last of the bugs we knew about in tcMenu 2.0 development branch, so as far as we know, anything outstanding is now fixed, and we are ready to do the final testing!!
We’ve finally got around to add that missing feature in task manager, to be able to schedule captured lambdas, but we can only do it on 32-bit boards, because there’s no support for it on some platforms. What does this mean, lets take a quick example below:
void setup() {
int someValue = 42;
taskManager.scheduleFixedRate(1000, [someValue]() {
// someValue is available here - only on 32-bit boards
});
}
In IoAbstraction 1.8 we’ll support the battery backed RAM on STM32F4 and above devices as an EepromAbstraction. This means that it can be used directly with tcMenu just like any other EEPROM. The only thing to remember is that the values are cached just like ESP EEPROM class, so you need to call initialise(startingOffset)
before use, and use commit()
to make it write back to backed up RAM.
We’ve also backpedalled on list, it used to be a fully templated class, but this caused around 10-15K of additional code in tcMenu, even in production builds that were optimized. We considered this unacceptable and went about converting it into a semi template class, I’m pleased to say this has taken nearly all of that overhead away, leaving about 1.5K. It should be 100% compatible with any current usage.
We are still not 100% happy with memory usage in TcMenu 2.0, but for what’s essentially a skinnable UI, it’s still pretty good, although I think there is a very small amount of room for further improvement.
You can still build a menu on an Uno, it takes about 24K of FLASH, and generally less than 1K of RAM. To do this just use a directly connected LiquidCrystal unit (such as DfRobot), and select the build for Uno option in code generator.
Below we now go into detail of the allocation for graphical boards with ethernet control, these are obviously much larger and deserve a breakdown.
A moderate to large menu with graphical color display (AdaFruit_GFX), rotary encoder, and ethernet control(Ethernet2) on SAMD:
Actual production build size:
Debug build breakdown - these numbers are much larger than production and don’t match the above:
Component | Flash Use |
---|---|
Internal / std | 1K |
SAMD Arduino framework | 16.7K |
Adafruit Graphics | 10.2K |
Ethernet2 | 8.4K |
TaskManagerIO | 3K |
IoAbstraction | 4.4K |
tcMenu core & remote | 20.0K |
tcMenu graphics | 7.5K |
Example sketch code | 5.7K |
A fully fledged menu running on a mega 2560 with graphical display (AdaFruit_GFX Nokia 5110), rotary encoder and UIP Ethernet as follows:
Actual production build size:
Debug build breakdown - these numbers are much larger than production and don’t match the above:
Component | Flash Use |
---|---|
AVR core functions | 6.9K |
Arduino AVR core | 4.5K |
UIP Ethernet | 20.3K |
AdaFruit Graphics | 8.8K |
TaskManagerIO | 3.9K |
IoAbstraction | 4.9K |
tcMenu core & remote | 28.4K |
tcMenu graphics | 12.6K |
Example sketch code | 5.2K |
Unfortunately, the LTDC framebuffer support stays in BETA for now. There are some occasional rendering issues that look like either we are calling something with a bad parameter, or doing something that’s causing the framebuffer to misbehave, more on this once 2.0 is released.
So in summary a busy week so far, so much so that I need an extra mid-week update to avoid the weekly one becoming too big. Removing the template code shaved 10K off TcMenu, and looking around I think there’s another few kilobytes could be shaved off over time. There’s always going to be an overhead to using a general purpose library, but we want to make that as small as possible.