Kalibrierung über Display hinzugefügt

This commit is contained in:
Carsten Keller 2024-06-09 17:58:27 +02:00
parent af780439b3
commit e068d199bb
Signed by: carsten
GPG Key ID: DF06343A3A9B8868
3 changed files with 157 additions and 7 deletions

View File

@ -166,6 +166,20 @@ void set_new_sollstrom(uint32_t soll)
i_soll = soll;
}
void start_icall(void)
{
spannung = 0UL;
strom = 0UL;
modus = icall;
}
void start_ucall(void)
{
spannung = 0UL;
strom = 0UL;
modus = ucall;
}
/**
* @brief Callback Function for Command Line
* @param [in] pfvOutFunction Function to Print Data to Output
@ -249,17 +263,13 @@ uint16_t set_dutyCyle (CLI_OutFunction pfvOutFunction, char *acCommands[], uint1
}
uint16_t set_ucall(CLI_OutFunction pfvOutFunction, char *acCommands[], uint16_t u16ArgCount)
{
spannung = 0UL;
strom = 0UL;
modus = ucall;
start_ucall();
return 0U;
}
uint16_t set_icall(CLI_OutFunction pfvOutFunction, char *acCommands[], uint16_t u16ArgCount)
{
spannung = 0UL;
strom = 0UL;
modus = icall;
start_icall();
return 0U;
}

View File

@ -13,5 +13,7 @@
void set_new_sollstrom(uint32_t soll);
uint32_t get_current_sollstrom(void);
void start_icall(void);
void start_ucall(void);
#endif /* ELEKTRONISCHELAST_HPP_ */
#endif

View File

@ -57,6 +57,13 @@ namespace ElektronischeLast
}
lcd.lcd_set_display(Display::eDispalyOn, Display::eCursorOff, Display::eCursorBlinkOff);
lcd.print(Display::Line1, "Elektronische Last");
up.cyclic();
down.cyclic();
if(up.isPressed() && down.isPressed())
{
menu_level = MenuLevel_Call;
}
}
void Menu::set_measurements(uint32_t spannung, uint32_t strom, uint32_t temperatur, uint32_t geschwindigkeit)
@ -143,22 +150,153 @@ namespace ElektronischeLast
void Menu::menu_call(void)
{
if(lcd.ready_for_data())
{
switch(this->configurations)
{
case 0UL:
lcd.print(Display::Line1, "Kalibrierung: I");
lcd.print(Display::Line2, "Kalibrierung: U");
this->configurations++;
break;
case 1UL:
lcd.lcd_set_display(Display::eDispalyOn, Display::eCursorOn, Display::eCursorBlinkOn);
this->configurations++;
break;
case 2UL:
lcd.set_cursor(Display::Line1, 15U);
this->configurations++;
this->cursor = 1UL;
break;
default:
break;
}
}
if(ok.isReleased())
{
if(this->cursor == 1UL)
{
this->menu_level = MenuLevel_ICallInit;
}
else if(this->cursor == 2UL)
{
this->menu_level = MenuLevel_UCallInit;
}
this->configurations = 0UL;
}
else if(up.isReleased())
{
if(this->cursor == 1UL)
{
this->cursor = 2UL;
lcd.set_cursor(Display::Line2, 15U);
}
else if(this->cursor == 2UL)
{
this->cursor = 1UL;
lcd.set_cursor(Display::Line1, 15U);
}
}
else if(down.isReleased())
{
if(this->cursor == 1UL)
{
this->cursor = 2UL;
lcd.set_cursor(Display::Line2, 15U);
}
else if(this->cursor == 2UL)
{
this->cursor = 1UL;
lcd.set_cursor(Display::Line1, 15U);
}
}
}
void Menu::menu_icall_init(void)
{
char data[17U];
if(lcd.ready_for_data())
{
switch(this->configurations)
{
case 0UL:
set_new_sollstrom(1000UL);
soll = get_current_sollstrom();
snprintf(data, sizeof(data), "iSoll: %5" PRIu32 "mA", soll);
lcd.print(Display::Line1, "Stelle 1A ein ");
lcd.print(Display::Line2, data);
this->configurations++;
break;
case 1UL:
lcd.set_cursor(Display::Line2, 13UL);
this->configurations++;
break;
default:
break;
}
}
if(ok.isReleased())
{
this->menu_level = MenuLevel_ICall;
this->configurations = 0UL;
}
else if(down.isReleased())
{
soll--;
set_new_sollstrom(soll);
snprintf(data, sizeof(data), "iSoll: %5" PRIu32 "mA", soll);
lcd.print(Display::Line2, data);
this->configurations = 1UL;
}
else if(up.isReleased())
{
soll++;
set_new_sollstrom(soll);
snprintf(data, sizeof(data), "iSoll: %5" PRIu32 "mA", soll);
lcd.print(Display::Line2, data);
this->configurations = 1UL;
}
}
void Menu::menu_icall(void)
{
if(this->configurations == 0UL)
{
start_icall();
lcd.print(Display::Line1, "Kalibrierung... ");
lcd.print(Display::Line2, " ");
this->configurations++;
}
}
void Menu::menu_ucall_init(void)
{
if(this->configurations == 0UL)
{
set_new_sollstrom(0UL);
lcd.print(Display::Line1, "Lege 15V an ");
lcd.print(Display::Line2, " ");
this->configurations++;
}
if(ok.isReleased())
{
this->menu_level = MenuLevel_UCall;
this->configurations = 0UL;
}
}
void Menu::menu_ucall(void)
{
if(this->configurations == 0UL)
{
start_ucall();
lcd.print(Display::Line1, "Kalibrierung... ");
lcd.print(Display::Line2, " ");
this->configurations++;
}
}
void Menu::menu_isoll(void)