From 9fb30d640fa8b48c60721429e2e29d892326c753 Mon Sep 17 00:00:00 2001 From: Carsten Keller Date: Sun, 9 Jun 2024 17:57:52 +0200 Subject: [PATCH] =?UTF-8?q?L=C3=BCfter-Stuerung=20eingebaut=20Min-Max-Best?= =?UTF-8?q?immung=20entfernt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/ElektronischeLast.cpp | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/Source/ElektronischeLast.cpp b/Source/ElektronischeLast.cpp index 74dea1a..8a4b2cd 100644 --- a/Source/ElektronischeLast.cpp +++ b/Source/ElektronischeLast.cpp @@ -15,6 +15,7 @@ #include "ADC.hpp" #include "serial.hpp" #include "PID.h" +#include "FanControl.hpp" using namespace ElektronischeLast; @@ -31,16 +32,6 @@ static PIDController pid = .T = 0.001f, }; 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) { @@ -50,6 +41,7 @@ int main (void) LED led = LED(500U); iDAC dac = iDAC(); iADC adc = iADC(); + FanControl fan = FanControl(); std::uint32_t last_tick = systick; printf("\r\nElektronische Last\r\n"); @@ -64,14 +56,10 @@ int main (void) if(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.write(iDAC::CHANNEL_1, dac_value); + + fan.run(adc.get_temperature()); } } }