Kleines Post-Script eingebaut, was RAM und ROM Auslastung mittels einfacher Grafik darstellt.
This commit is contained in:
@@ -22,8 +22,7 @@
|
||||
#include "FanControl.hpp"
|
||||
#include "CLI.h"
|
||||
#include "I2C.hpp"
|
||||
#include "Display.hpp"
|
||||
#include "Timer.hpp"
|
||||
#include "Menu.hpp"
|
||||
|
||||
using namespace ElektronischeLast;
|
||||
|
||||
@@ -50,13 +49,12 @@ static CLI_Command_t commands[] =
|
||||
{ "reboot", "System neu starten", reboot },
|
||||
};
|
||||
|
||||
static Timer timer = Timer();
|
||||
static LED led = LED(500U);
|
||||
static Display lcd = Display();
|
||||
static FanControl fan = FanControl();
|
||||
static iI2C eeprom = iI2C(0xA0U);
|
||||
static iDAC dac = iDAC();
|
||||
static iADC adc = iADC();;
|
||||
static Menu menu = Menu();
|
||||
static std::uint32_t i_soll = 0U;
|
||||
static PIDController pid =
|
||||
{
|
||||
@@ -83,10 +81,9 @@ int main (void)
|
||||
printf("\r\nElektronische Last\r\n");
|
||||
CLI_Init(commands, sizeof(commands)/sizeof(commands[0]));
|
||||
led.init();
|
||||
lcd.init();
|
||||
fan.init();
|
||||
eeprom.init();
|
||||
timer.start(500U);
|
||||
menu.init();
|
||||
|
||||
float voltage_gain = NAN;
|
||||
float current_gain = NAN;
|
||||
@@ -113,35 +110,14 @@ int main (void)
|
||||
|
||||
PIDController_Init(&pid);
|
||||
|
||||
while(lcd.ready_for_data() == false)
|
||||
{
|
||||
lcd.run();
|
||||
}
|
||||
uint8_t degreeSymbol[] = {
|
||||
0x0E,
|
||||
0x0A,
|
||||
0x0E,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00
|
||||
};
|
||||
lcd.lcd_set_user_chars(Display::SecondSign, degreeSymbol);
|
||||
while(lcd.ready_for_data() == false)
|
||||
{
|
||||
lcd.run();
|
||||
}
|
||||
lcd.lcd_set_display(Display::eDispalyOn, Display::eCursorOff, Display::eCursorBlinkOff);
|
||||
lcd.print(Display::Line1, "Elektronische Last");
|
||||
|
||||
while(1)
|
||||
{
|
||||
led.blink();
|
||||
|
||||
menu.run();
|
||||
|
||||
if(last_tick != systick)
|
||||
{
|
||||
timer.tick();
|
||||
last_tick = systick;
|
||||
switch(modus)
|
||||
{
|
||||
@@ -171,37 +147,8 @@ int main (void)
|
||||
temperatur = adc.get_temperature();
|
||||
geschwindigkeit = fan.get_speed();
|
||||
|
||||
if(timer.elapsed())
|
||||
{
|
||||
if(lcd.ready_for_data())
|
||||
{
|
||||
timer.start(500U);
|
||||
menu.set_measurements(spannung, strom, temperatur, geschwindigkeit);
|
||||
|
||||
char data[17U];
|
||||
|
||||
int32_t len = snprintf(data, sizeof(data) - 1, "%2" PRIu32 ".%02" PRIu32 "V",
|
||||
spannung / 1000U, spannung % 1000U / 10U);
|
||||
std::memset(&data[len], (int)' ', 16U - len);
|
||||
snprintf(&data[12], sizeof(data) - 12, "%2" PRIu32 "%cC", temperatur, 0x1);
|
||||
data[16] = '\0';
|
||||
lcd.print(Display::Line1, data);
|
||||
|
||||
if(strom < 1000UL)
|
||||
{
|
||||
len = snprintf(data, sizeof(data) - 1, "%3" PRIu32 "mA", strom);
|
||||
}
|
||||
else
|
||||
{
|
||||
len = snprintf(data, sizeof(data) - 1, "%" PRIu32 ".%02" PRIu32 "A",
|
||||
strom / 1000U, strom % 1000U / 10U);
|
||||
}
|
||||
std::memset(&data[len], (int)' ', 16U - len);
|
||||
snprintf(&data[9], sizeof(data) - 9, "%4" PRIu32 "RPM", geschwindigkeit);
|
||||
data[16] = '\0';
|
||||
lcd.print(Display::Line2, data);
|
||||
}
|
||||
}
|
||||
lcd.run();
|
||||
break;
|
||||
}
|
||||
serial_cyclic();
|
||||
@@ -209,6 +156,16 @@ int main (void)
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t get_current_sollstrom(void)
|
||||
{
|
||||
return i_soll;
|
||||
}
|
||||
|
||||
void set_new_sollstrom(uint32_t soll)
|
||||
{
|
||||
i_soll = soll;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Callback Function for Command Line
|
||||
* @param [in] pfvOutFunction Function to Print Data to Output
|
||||
|
Reference in New Issue
Block a user