ttrftech / NanoVNA

Very Tiny Palmtop Vector Network Analyzer
1.06k stars 296 forks source link

Huge rework chsnprintf function #119

Closed DiSlord closed 4 years ago

DiSlord commented 4 years ago

I can`t upload my version chprintf.c to ChibiOS\os\hal\lib\streams upload it to root :(

Huge rework chsnprintf function (basic functional more compact and faster): now support print float and Suffix if use example %.1F on 1.234e-3 print 1.234m, %F print 1.23m now support + flag %+d on 8 print +8, %+d on -8 print -8 now support freq output if use %q example %q on 1234567890 print 1.234 567 890 GHz, %.8q print 1.234567GHz fix rounding errors on print float example if print use %.2f on 2.199 print 2.20 (before 2.19) Use it in code - made more compact (save about 2k bytes) and easy display values (set output more digits after . for some values) Made some font glyph more compact, allow 3px glyph

More correct create frequencies table on big span (not use float operations), also produce more compact code Use double value input from keyboard (not lost Hz on input) Set sweep_points as uint Optimize set_sweep_frequency size

Fix freq commands broken after freq set as uint32 (add str to uint32 functions for freq bigger then 2 147 483 647): cmd_freq cmd_offset cmd_threshold cmd_scan cmd_sweep

Define _isdigit macro (replace isdigit() function, its too big)

Rewrite std universal atoi() to more compact my_atoi and write new unsigned variant my_atoui