Lüfter-Stuerung eingebaut
Min-Max-Bestimmung entfernt
This commit is contained in:
parent
d609bdfe24
commit
9fb30d640f
@ -15,6 +15,7 @@
|
|||||||
#include "ADC.hpp"
|
#include "ADC.hpp"
|
||||||
#include "serial.hpp"
|
#include "serial.hpp"
|
||||||
#include "PID.h"
|
#include "PID.h"
|
||||||
|
#include "FanControl.hpp"
|
||||||
|
|
||||||
using namespace ElektronischeLast;
|
using namespace ElektronischeLast;
|
||||||
|
|
||||||
@ -31,16 +32,6 @@ static PIDController pid =
|
|||||||
.T = 0.001f,
|
.T = 0.001f,
|
||||||
};
|
};
|
||||||
static uint32_t dac_value;
|
static uint32_t dac_value;
|
||||||
static struct
|
|
||||||
{
|
|
||||||
uint32_t current_min;
|
|
||||||
uint32_t current_max;
|
|
||||||
} current_spitze;
|
|
||||||
static struct
|
|
||||||
{
|
|
||||||
uint32_t voltage_min;
|
|
||||||
uint32_t voltage_max;
|
|
||||||
} voltage_spitze;
|
|
||||||
|
|
||||||
int main (void)
|
int main (void)
|
||||||
{
|
{
|
||||||
@ -50,6 +41,7 @@ int main (void)
|
|||||||
LED led = LED(500U);
|
LED led = LED(500U);
|
||||||
iDAC dac = iDAC();
|
iDAC dac = iDAC();
|
||||||
iADC adc = iADC();
|
iADC adc = iADC();
|
||||||
|
FanControl fan = FanControl();
|
||||||
std::uint32_t last_tick = systick;
|
std::uint32_t last_tick = systick;
|
||||||
|
|
||||||
printf("\r\nElektronische Last\r\n");
|
printf("\r\nElektronische Last\r\n");
|
||||||
@ -64,14 +56,10 @@ int main (void)
|
|||||||
if(last_tick != systick)
|
if(last_tick != systick)
|
||||||
{
|
{
|
||||||
last_tick = systick;
|
last_tick = systick;
|
||||||
uint32_t tmp = adc.get_current();
|
|
||||||
if(tmp > current_spitze.current_max) current_spitze.current_max = tmp;
|
|
||||||
if(tmp < current_spitze.current_min) current_spitze.current_min = tmp;
|
|
||||||
tmp = adc.get_voltage();
|
|
||||||
if(tmp > voltage_spitze.voltage_max) voltage_spitze.voltage_max = tmp;
|
|
||||||
if(tmp < voltage_spitze.voltage_min) voltage_spitze.voltage_min = tmp;
|
|
||||||
dac_value = (uint32_t)PIDController_Update(&pid, i_soll, adc.get_current());
|
dac_value = (uint32_t)PIDController_Update(&pid, i_soll, adc.get_current());
|
||||||
dac.write(iDAC::CHANNEL_1, dac_value);
|
dac.write(iDAC::CHANNEL_1, dac_value);
|
||||||
|
|
||||||
|
fan.run(adc.get_temperature());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user