ist Befehl um möglichkeit zur Ausgabefrequenz erweitert. Mit Frequenz wird immer eine neue Zeile angefangen

This commit is contained in:
Carsten Keller 2024-06-09 17:58:12 +02:00
parent 19b2a3f088
commit c69973ae62
Signed by: carsten
GPG Key ID: DF06343A3A9B8868

View File

@ -114,14 +114,25 @@ uint16_t ist_werte(CLI_OutFunction pfvOutFunction, char *acCommands[], uint16_t
{ {
static uint32_t last_call = 0U; static uint32_t last_call = 0U;
uint16_t recall = 0U; uint16_t recall = 0U;
if(u16ArgCount == 1U) int32_t recall_time = 999;
bool newline = false;
if(u16ArgCount >= 1U)
{ {
recall = (acCommands[0][0] == '-' && acCommands[0][1] == 'r' && acCommands[0][2] == '\0'); recall = (acCommands[0][0] == '-' && acCommands[0][1] == 'r' && acCommands[0][2] == '\0');
} }
if(u16ArgCount >= 2U)
{
recall_time = strtol(acCommands[1], NULL, 10);
newline = true;
}
if(((recall == 1U) && ((int32_t)(systick - last_call) > 999)) || recall == 0U) if(((recall == 1U) && ((int32_t)(systick - last_call) > recall_time)) || recall == 0U)
{ {
char buffer[64]; char buffer[64];
if(newline)
{
pfvOutFunction("\n");
}
snprintf(buffer, sizeof(buffer), "\rI: %5" PRIu32 " U: %5" PRIu32 " T: %5" PRIu32 " V: %5" PRIu32, snprintf(buffer, sizeof(buffer), "\rI: %5" PRIu32 " U: %5" PRIu32 " T: %5" PRIu32 " V: %5" PRIu32,
strom, spannung, temperatur, geschwindigkeit); strom, spannung, temperatur, geschwindigkeit);
pfvOutFunction(buffer); pfvOutFunction(buffer);