enhancement: more print format constants defined; function printNumber(..) adapted.#621
enhancement: more print format constants defined; function printNumber(..) adapted.#621TobiasKnauss wants to merge 1 commit intoarduino:masterfrom
Conversation
- HEX2, HEX4, HEX8 - BIN2, BIN4, BIN8, BIN16, BIN32 The number represents the minimum digit count for printing, i.e. adding leading zeros.
|
Memory usage change @ 41883e6
Click for full report table
Click for full report CSV |
per1234
left a comment
There was a problem hiding this comment.
Thanks for your pull request @TobiasKnauss!
Something important to understand is that the goal is for every Arduino boards platform to implement a standardized API, as described by the Arduino Language Reference:
https://docs.arduino.cc/language-reference/
Standardization is important for the sake of portability. If all cores implement a standardized API, then sketches and libraries that only use that API will work with every one of the diverse array of boards in the Arduino hardware ecosystem. Conversely, if we only implement a capability one core, then users will find that code utilizing that capability won't compile for boards of any other platform.
In order to facilitate standardization of cores, Arduino has created a reusable codebase that defines a standardized API, as well as provides the implementations of all components that are not architecture-specific:
https://github.com/arduino/ArduinoCore-API
You are proposing an expansion of the standardized core API. It is true that, if accepted, this should be implemented in the core of the "Arduino AVR Boards" platform hosted in this repository, but the same should also be done in the core of every other platform. For this reason, it is best to start by proposing the addition of the new capability in the arduino/ArduinoCore-API repository. If the maintainers of that project accept your proposal, then it will be clear that the introduction into the individual cores is appropriate.
So the procedure for proposing changes to the core API should be:
- Submission of proposal to the
arduino/ArduinoCore-APIrepository. - Review of proposal.
- Adjustment of proposal as needed to resolve review.
- Acceptance and implementation of proposal.
- Propagate change to cores.
This pull request is needed to complete the final step in that procedure, so it is valuable and appreciated. However, the other steps in the procedure must be completed first.
The number represents the minimum digit count for printing, i.e. adding leading zeros.
This enhancement was inspired by https://forum.arduino.cc/t/serial-print-value-hex/463868/5
It can be tested with the code example from https://docs.arduino.cc/language-reference/en/functions/communication/serial/print/ enhanced like this: