* Anzeige der aktuelle Werte mit "ist" oder "ist -r"
* Ausgabe formatierung
This commit is contained in:
parent
b9984fd788
commit
8dd488eb28
@ -22,10 +22,12 @@
|
|||||||
using namespace ElektronischeLast;
|
using namespace ElektronischeLast;
|
||||||
|
|
||||||
uint16_t set_solltrom (CLI_OutFunction pfvOutFunction, char *acCommands[], uint16_t u16ArgCount);
|
uint16_t set_solltrom (CLI_OutFunction pfvOutFunction, char *acCommands[], uint16_t u16ArgCount);
|
||||||
|
uint16_t ist_werte(CLI_OutFunction pfvOutFunction, char *acCommands[], uint16_t u16ArgCount);
|
||||||
|
|
||||||
static CLI_Command_t commands[] =
|
static CLI_Command_t commands[] =
|
||||||
{
|
{
|
||||||
{ "isoll", "Zielstrom für Last", set_solltrom }
|
{ "isoll", "Zielstrom für Last", set_solltrom },
|
||||||
|
{ "ist", "Zeige Istwerte an [-r für wiederholende Anzeige]", ist_werte }
|
||||||
};
|
};
|
||||||
|
|
||||||
static std::uint32_t i_soll = 0U;
|
static std::uint32_t i_soll = 0U;
|
||||||
@ -41,6 +43,9 @@ static PIDController pid =
|
|||||||
.T = 0.001f,
|
.T = 0.001f,
|
||||||
};
|
};
|
||||||
static uint32_t dac_value;
|
static uint32_t dac_value;
|
||||||
|
static uint32_t strom;
|
||||||
|
static uint32_t spannung;
|
||||||
|
static uint32_t temperatur;
|
||||||
|
|
||||||
int main (void)
|
int main (void)
|
||||||
{
|
{
|
||||||
@ -70,6 +75,10 @@ int main (void)
|
|||||||
|
|
||||||
fan.run(adc.get_temperature());
|
fan.run(adc.get_temperature());
|
||||||
|
|
||||||
|
strom = adc.get_current();
|
||||||
|
spannung = adc.get_voltage();
|
||||||
|
temperatur = adc.get_temperature();
|
||||||
|
|
||||||
serial_cyclic();
|
serial_cyclic();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -87,8 +96,28 @@ uint16_t set_solltrom (CLI_OutFunction pfvOutFunction, char *acCommands[], uint1
|
|||||||
char buf[40];
|
char buf[40];
|
||||||
uint32_t in = strtoul(acCommands[0], NULL, 10);
|
uint32_t in = strtoul(acCommands[0], NULL, 10);
|
||||||
uint32_t cur = i_soll;
|
uint32_t cur = i_soll;
|
||||||
snprintf(buf, sizeof(buf), "Aktueller Soll-Strom: %" PRIu32 ", Neu: %" PRIu32, cur, in);
|
snprintf(buf, sizeof(buf), "\r\nAktueller Soll-Strom: %" PRIu32 ", Neu: %" PRIu32, cur, in);
|
||||||
pfvOutFunction(buf);
|
pfvOutFunction(buf);
|
||||||
i_soll = in;
|
i_soll = in;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint16_t ist_werte(CLI_OutFunction pfvOutFunction, char *acCommands[], uint16_t u16ArgCount)
|
||||||
|
{
|
||||||
|
static uint32_t last_call = 0U;
|
||||||
|
uint16_t recall = 0U;
|
||||||
|
if(u16ArgCount == 1U)
|
||||||
|
{
|
||||||
|
recall = (acCommands[0][0] == '-' && acCommands[0][1] == 'r' && acCommands[0][2] == '\0');
|
||||||
|
}
|
||||||
|
|
||||||
|
if(((recall == 1U) && ((int32_t)(systick - last_call) > 999)) || recall == 0U)
|
||||||
|
{
|
||||||
|
char buffer[64];
|
||||||
|
snprintf(buffer, sizeof(buffer), "\rI: %5" PRIu32 " U: %5" PRIu32 " T: %5" PRIu32, strom, spannung, temperatur);
|
||||||
|
pfvOutFunction(buffer);
|
||||||
|
last_call = systick;
|
||||||
|
}
|
||||||
|
|
||||||
|
return recall;
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user