Skip to content

Feature request: printf padding/floating point  #361

Closed
@adamgarbo

Description

@adamgarbo

Hi there,

In v2.x of the Apollo3 Core, Mbed OS is responsible for managing sprintf/printf (#239). However, it appears that padding is no longer enabled. A simple example code snippet to print the date and time:

Serial.printf("20%02d-%02d-%02d %02d:%02d:%02d.%03d\n",
    RTC.year, RTC.month, RTC.dayOfMonth,
    RTC.hour, RTC.minute, RTC.seconds, RTC.hundredths);

Produces the following output:

  • 2020-6-3 13:9:3.1

But should have a number of zeros padding the values:

  • 2020-06-03 13:09:03.100

From what I can gather, this is due to the fact the Mbed core by default uses the minimal printf library to increase memory savings:
https://github.com/ARMmbed/mbed-os/blob/master/platform/source/minimal-printf/README.md#usage

It would be great to have padding reenabled, as well as the ability to print floating-point values. Given the specifications of the Artemis, I believe the additional Flash/RAM requirements should be trivial?

Cheers,
Adam

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions