Lüftergeschwindigkeit in Ist-Anzeige integriert.
This commit is contained in:
parent
03552cbae4
commit
3cc25b2cae
@ -48,6 +48,7 @@ static uint32_t dac_value;
|
||||
static uint32_t strom;
|
||||
static uint32_t spannung;
|
||||
static uint32_t temperatur;
|
||||
static uint32_t geschwindigkeit;
|
||||
|
||||
int main (void)
|
||||
{
|
||||
@ -80,6 +81,7 @@ int main (void)
|
||||
strom = adc.get_current();
|
||||
spannung = adc.get_voltage();
|
||||
temperatur = adc.get_temperature();
|
||||
geschwindigkeit = fan.get_speed();
|
||||
|
||||
serial_cyclic();
|
||||
}
|
||||
@ -120,7 +122,8 @@ uint16_t ist_werte(CLI_OutFunction pfvOutFunction, char *acCommands[], uint16_t
|
||||
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);
|
||||
snprintf(buffer, sizeof(buffer), "\rI: %5" PRIu32 " U: %5" PRIu32 " T: %5" PRIu32 " V: %5" PRIu32,
|
||||
strom, spannung, temperatur, geschwindigkeit);
|
||||
pfvOutFunction(buffer);
|
||||
last_call = systick;
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ extern "C" void TIM14_IRQHandler(void)
|
||||
{
|
||||
LL_TIM_ClearFlag_UPDATE(TIM14);
|
||||
|
||||
fan_speed = LL_TIM_GetCounter(TIM2) *60U / 2UL;
|
||||
fan_speed = LL_TIM_GetCounter(TIM2);
|
||||
LL_TIM_SetCounter(TIM2, 0UL);
|
||||
}
|
||||
extern "C" void FanControl_SetDuty(uint32_t d)
|
||||
@ -116,4 +116,17 @@ namespace ElektronischeLast
|
||||
this->compare_value = duty;
|
||||
LL_TIM_OC_SetCompareCH1(TIM3, this->compare_value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Lüftergeschwindigkeit in Umdrehungen pro Minute.
|
||||
* @details Das Tachosignal gibt zwei Impule pro Umdrehung heraus.
|
||||
* Die Messdauer der Pulsanzahl beträgt eine Miunute.
|
||||
* v = pulse / 2 * 60 => erst mal 60, damit es ganuer wird
|
||||
* wegen Datentyp ungenauigkeit beim Teilen.
|
||||
* @return
|
||||
*/
|
||||
std::uint32_t FanControl::get_speed(void)
|
||||
{
|
||||
return fan_speed *60UL / 2UL;
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ namespace ElektronischeLast
|
||||
FanControl(void);
|
||||
~FanControl(void);
|
||||
void run(std::uint32_t temp);
|
||||
std::uint32_t get_speed(void);
|
||||
private:
|
||||
std::uint32_t compare_value;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user