Sensor float variable convert to SPI char buffer

I have a multiple sensors which I am reading using an arduino micro, sensor data is a mix of floats I.e temperature 10.5. I will read all the sensor data from another board using the spi.

I am going around in circles on converting the float to an spi char buffer. I am using dtostr to convert the float to a string, but then just cannot work out the conversion to spi char which will need to be ASCII characters.

So if the temperature is 23.55 the spi buffer will be

Spi_buf[0] = 0x50; // ASCII 2

Spi_buf[1] = 0x51; // ASCII 3

Spi_buf[2] = 0x46; // ASCII .

Spi_buf[3] = 0x53; // ASCII 5

Spi_buf[4] = 0x53; // ASCII 5

So on the SPI transfer I will end up with this string on master device.

I am going around in circles on converting the float to an spi char buffer.

You mean "trying to re-invent dtostrf()", don't you? Why?

Is the issue that you've mixed up hex and decimal notation? ASCII digit '5' is decimal 53 i.e. 0x35.

Sorry I was not reading the ascii table correctly and I will have a look at the dtostrf again.

So should I be able to a

char tmp_buf[50];

dtostrf(temp, 1, 2, tmp_buf);

tmp_buf[0] // is the first char?

tmp_buf[0] // is the first char?

Yes.

dtostrf(temp, 1, 2, tmp_buf);

So, two characters after the decimal point plus the decimal point, for a total of not less that one character. No problem.