Ausgabe des aktuell einsgestellten Soll-Stroms und Ausgabe fomratierung

This commit is contained in:
Carsten Keller 2024-06-09 17:57:56 +02:00
parent 8dd488eb28
commit 50ea6e4a74
Signed by: carsten
GPG Key ID: DF06343A3A9B8868

View File

@ -94,11 +94,15 @@ int main (void)
uint16_t set_solltrom(CLI_OutFunction pfvOutFunction, char *acCommands[], uint16_t u16ArgCount) uint16_t set_solltrom(CLI_OutFunction pfvOutFunction, char *acCommands[], uint16_t u16ArgCount)
{ {
char buf[40]; char buf[40];
uint32_t in = strtoul(acCommands[0], NULL, 10);
uint32_t cur = i_soll; uint32_t cur = i_soll;
snprintf(buf, sizeof(buf), "\r\nAktueller Soll-Strom: %" PRIu32 ", Neu: %" PRIu32, cur, in); int32_t pos = snprintf(buf, sizeof(buf), "\r\nAktueller Soll-Strom: %" PRIu32, cur);
pfvOutFunction(buf); if(u16ArgCount == 1U)
{
uint32_t in = strtoul(acCommands[0], NULL, 10);
snprintf(&buf[pos], sizeof(buf) - pos, " Neu: %" PRIu32, in);
i_soll = in; i_soll = in;
}
pfvOutFunction(buf);
return 0; return 0;
} }