Open qrp73 opened 5 years ago
Thanks for your comment, your point out must be true.
But snprintf
needs to link stdio
and heap, and current firmware doesn't have heap and the shortage of flash or SRAM doesn't allow to use them.
As I know, HP8753 ought to use hexadecimal to read/write floating-point data. This is an available choice.
I implemented custom scanraw command which performs measurement for unlimited point count and uses snprintf and it works great. It needs a little more deep stack size. The max stack usage is 502 for my case, so I set 502+16=518 instead of 442.
But I'm using different compiler, not sure if it will works with gcc.
chprintf doesn't supports lossless floating point formats such as "%.9g". It seems that it has very basic support for floating points. As result, the floating point value is truncated with data loss, especially for very small floating point numbers.
I propose to use snprintf instead of chprintf and then put the buffer to the output stream.
For example: