Sprintf not working on develop

Using sprintf freeze system. This happened after I update to latest develop branch was working before.

sample:

char buf[20];
sprintf(buf, "Test %d", 1);
1 Like

Develop is constantly in motion - whenever you pull changes, it’s a good idea (and often necessary) to update the system firmware also.

Specifically, sprintf was moved to the system firmware so that we can re-instate floating point support (%f). Sprintf with floating point rather crazily requires 10k of flash to implement, so I didn’t want this overhead in every single user firmware image.

8 Likes

It would be great if you put some checks/warning/etc when you make such changes.

Plus I noticed that ADC setup is being touched after setup() before loop(). Meaning if I setup ADC in setup() somehow the setting will be touched by firmware before entering loop().

Better that we move off develop so that foks are building from scheduled releases rather than a continual moving target. The releases will bump the version number so then it is clear that the system firmware needs updating. (The system will then not crash but will simply not run the application until the system is updated.)

I’m wondering if we should already move to master and point core users that want 0.3.4 to a new release branch.

@mojtabacazi

I see a potential oversight in the code segment. : buf is an array of character pointers. buf as an array would have space allocated for the array elements which are pointers, but not the individual strings. The error may not show up in a smaller context, but may have issues in a larger context.

sample:

Your intention may be the folliowing

char buf[20];
sprintf(buf, "Test %d", 1);

Please ignore this comment, if the code include memory allocation for the buf array elements.

4 Likes

@TheVelozGroup Yea the * was left there from copy/past :wink: fixed now.