From c69973ae6214843b07449eed36fd43d75634f78a Mon Sep 17 00:00:00 2001 From: Carsten Keller Date: Sun, 9 Jun 2024 17:58:12 +0200 Subject: [PATCH] =?UTF-8?q?ist=20Befehl=20um=20m=C3=B6glichkeit=20zur=20Au?= =?UTF-8?q?sgabefrequenz=20erweitert.=20Mit=20Frequenz=20wird=20immer=20ei?= =?UTF-8?q?ne=20neue=20Zeile=20angefangen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/ElektronischeLast.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Source/ElektronischeLast.cpp b/Source/ElektronischeLast.cpp index a17ee80..c5aee9c 100644 --- a/Source/ElektronischeLast.cpp +++ b/Source/ElektronischeLast.cpp @@ -114,14 +114,25 @@ uint16_t ist_werte(CLI_OutFunction pfvOutFunction, char *acCommands[], uint16_t { static uint32_t last_call = 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'); } + 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]; + if(newline) + { + pfvOutFunction("\n"); + } snprintf(buffer, sizeof(buffer), "\rI: %5" PRIu32 " U: %5" PRIu32 " T: %5" PRIu32 " V: %5" PRIu32, strom, spannung, temperatur, geschwindigkeit); pfvOutFunction(buffer);