Chat freely about anything...

User avatar
By McChubby007
#78330
sh4d0w wrote:Thanks, that is awesome!
Well the function is awesome, but the fact that we need to write our own function is less awesome.

Thanks again.

printf family float support is deliberately excluded as it consumes large amounts of flash. You will see similar design decisions with other mcu architectures and arduino also has a choice of whether to include support or not.

Generally, I question anyone using float in embedded code unless essential. I understand that some APIs and some devices provide data as a float and so that is necessary, but it can sometimes be worthwhile storing this data as a scaled int or using fixed-point variables. This might seem like a lot of extra work, but you will see that use of even the occasional float will consume 1000s of bytes of flash space (a big issue of you are trying to write generic code that will work across different processors, such as armega328 as well as the more forgiving esp8266). Obviously using up lots more flash space also equates to a big runtime/execution performance hit which is of course anathema to embedded systems.
User avatar
By McChubby007
#78331 In order to provide a more complete answer, I should also add that there are other printf family format specifiers omitted as well from the huge list of possibles in the GNU version I.e. only the 'commonly-used' formats are provided.