fredlcore / BSB-LAN

LAN/WiFi interface for Boiler-System-Bus (BSB) and Local Process Bus (LPB) and Punkt-zu-Punkt Schnittstelle (PPS) with a Siemens® controller used by Elco®, Brötje® and similar heating systems
222 stars 84 forks source link

replacing "%.1f" with "%g". Fix for /JC and ?JK commands #522

Closed dukess closed 1 year ago

dukess commented 1 year ago

"%.1f" was replaced with "%g". Code more readable, shorter (and faster?). Thanks to @DE-cr roundf() was replaced with (int)() where is it possible. Fix for /JC and /JK commands (additional condition in printToWebClient_prognrdescaddr() may block parameter name printing) Tested on ESP32.

fredlcore commented 1 year ago

Thanks!

fredlcore commented 1 year ago

We have a user reporting this behaviour where an unwanted parameter number appears after the parameter value: unwanted param numbers Is this related to this PR?

dukess commented 1 year ago

Yes, I ran into this problem too. In addition, rounding does not work correctly. Enrages. I think it's better that I cancel the commit (except for a minor fix) and leave everything as it was before. Less beautiful, but it worked.

fredlcore commented 1 year ago

Ok, could you do that because I don't know what minor fix should be kept? Thanks!

DE-cr commented 1 year ago

The %g part looks ok to me, but there seems to be one printFmtToWebClient() too many. (That is most of the changes could be kept, but something needs fixing.)

DE-cr commented 1 year ago

I don't know the code intimately enough, but could it be that desc in printToWebClient(cfg.desc); (BSB_LAN.ino line 2732) has (somewhere before) been created to contain one param_no too many? Since cfg here is set via memcpy(&cfg, &config[i], sizeof(cfg)); some lines before being used, that would mean config[] setting is the culprit. I have yet to figure out, where that happens.

DE-cr commented 1 year ago

Sorry, no: cfg here seems to be /C contents, not /Kx

dukess commented 1 year ago

Tried to save most of changes. Did PR.

fredlcore commented 1 year ago

Thanks!