it seems the field width no longer works on chprintf....
i.e.
in chibios 2.6 i used to display the time and date on the console like this
chprintf(chp, "Time : %.2d:%.2d:%.2d\r\n", gps->hrs, gps->min, gps->sec);
chprintf(chp, "Date : %.2d/%.2d/%.2d\r\n", gps->day, gps->mon, gps->year);
note the ".2" to ensure two chars are used, giving output of
01:02:03
04/05/06
using the same code on 16.1 you get this, seems to not work anymore ????
1:2:3
4/5/6
chprintf broken ???
Moderators: RoccoMarco, lbednarz, tfAteba
- Giovanni
- Site Admin
- Posts: 14895
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: chprintf broken ???
Hi,
The "." was not standard, now you can specify the size of the field as %02d
Giovanni
The "." was not standard, now you can specify the size of the field as %02d
Giovanni
Re: chprintf broken ???
Tabulous wrote:Giovanni wrote:Hi,
The "." was not standard, now you can specify the size of the field as %02d
Giovanni
cool thanks
so how do i go about displaying floats with varying lengths of precision ? as i see it the chprintf is set by define FLOAT_PRECISION and this is all you can do.
i.e. i have a GPS Lat/long that i want to 7 decimal places, but i have a voltage that i only need 1 or 2 decimal places ?
- Giovanni
- Site Admin
- Posts: 14895
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times