Fix unsupported %.2f (#21508)

This commit is contained in:
Theo Arends 2024-05-27 15:37:15 +02:00
parent 33f491a8e6
commit 0fe893b01d
4 changed files with 8 additions and 7 deletions

View File

@ -312,7 +312,7 @@ void ShowValues(void) {
ResponseAppend_P(PSTR("\"CycleTime\":%d,"),cycleTimes[i]);
ResponseAppend_P(PSTR("\"DeadTime\":%d,"),deadTimes[i]);
ResponseAppend_P(PSTR("\"OutputInvert\":%d,"),opInverts[i]);
ResponseAppend_P(PSTR("\"FallbackPower\":%.2f,"),fallbacks[i]);
ResponseAppend_P(PSTR("\"FallbackPower\":%2_f,"),&fallbacks[i]);
ResponseAppend_P(PSTR("\"MaxUpdateInterval\":%d"),maxIntervals[i]);
ResponseAppend_P(i<TIMEPROP_NUM_OUTPUTS-1 ? PSTR("},") : PSTR("}"));
}

View File

@ -1001,7 +1001,8 @@ void PIPSOLARShow(bool json)
PIPSOLARShowWeb(setting);
}
float percentError = 100.0 * PIPSOLAR.errorPoll / (PIPSOLAR.errorPoll + PIPSOLAR.successPoll);
WSContentSend_PD(PSTR("{s}<h2>ERROR</h2>{m}Success: %u<br>Error: %u<br>CurrentError: %u<br>Max CurrentError: %u<br>ErrorRate %.2f %%{e}"), PIPSOLAR.successPoll, PIPSOLAR.errorPoll, PIPSOLAR.currentErrorPoll, PIPSOLAR.maxCurrentErrorPoll, percentError);
WSContentSend_PD(PSTR("{s}<h2>ERROR</h2>{m}Success: %u<br>Error: %u<br>CurrentError: %u<br>Max CurrentError: %u<br>ErrorRate %2_f %%{e}"),
PIPSOLAR.successPoll, PIPSOLAR.errorPoll, PIPSOLAR.currentErrorPoll, PIPSOLAR.maxCurrentErrorPoll, &percentError);
#endif // USE_WEBSERVER
}
}

View File

@ -417,7 +417,7 @@ int MI32_decryptPacket(char * _buf, uint16_t _bufSize, uint8_t * _payload, uint3
br_ccm_run(&ctx, 0, _payload, dataLen);
if(br_ccm_check_tag(&ctx, &tag)) return 0;
// AddLog(LOG_LEVEL_DEBUG,PSTR("M32: decrypted in %.2f mSec"),enctime);
// AddLog(LOG_LEVEL_DEBUG,PSTR("M32: decrypted in %2_f mSec"), &enctime);
// AddLogBuffer(LOG_LEVEL_DEBUG,(uint8_t*) _payload, dataLen);
if(_version == 3 && _payload[1] == 0x10) return 0; // no known way to really verify decryption, but 0x10 is expected here for button events
return -1; // wrong key ... maybe corrupt data packet too

View File

@ -216,10 +216,10 @@ void Rg15Show(bool json) {
// if the parsing wasn't completely successful then skip the update
if( !isnan(Rg15.acc) && !isnan(Rg15.event) && !isnan(Rg15.total) && !isnan(Rg15.rate) ) {
ResponseAppend_P(PSTR(",\"" RG15_NAME "\":{"));
ResponseAppend_P(PSTR("\"%s\":%.2f, "), D_JSON_ACTIVE, Rg15.acc);
ResponseAppend_P(PSTR("\"%s\":%.2f, "), D_JSON_EVENT, Rg15.event);
ResponseAppend_P(PSTR("\"%s\":%.2f, "), D_JSON_TOTAL, Rg15.total);
ResponseAppend_P(PSTR("\"%s\":%.2f"), D_JSON_FLOWRATE, Rg15.rate);
ResponseAppend_P(PSTR("\"%s\":%2_f,"), D_JSON_ACTIVE, &Rg15.acc);
ResponseAppend_P(PSTR("\"%s\":%2_f,"), D_JSON_EVENT, &Rg15.event);
ResponseAppend_P(PSTR("\"%s\":%2_f,"), D_JSON_TOTAL, &Rg15.total);
ResponseAppend_P(PSTR("\"%s\":%2_f"), D_JSON_FLOWRATE, &Rg15.rate);
ResponseAppend_P(PSTR("}"));
}
#ifdef USE_WEBSERVER