Datenausgabe über Display eingebaut
This commit is contained in:
		| @@ -23,6 +23,7 @@ | ||||
| #include "CLI.h" | ||||
| #include "I2C.hpp" | ||||
| #include "Display.hpp" | ||||
| #include "Timer.hpp" | ||||
|  | ||||
| using namespace ElektronischeLast; | ||||
|  | ||||
| @@ -49,6 +50,7 @@ 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(); | ||||
| @@ -84,6 +86,7 @@ int main (void) | ||||
|   lcd.init(); | ||||
|   fan.init(); | ||||
|   eeprom.init(); | ||||
|   timer.start(500U); | ||||
|  | ||||
|   float voltage_gain = NAN; | ||||
|   float current_gain = NAN; | ||||
| @@ -110,7 +113,27 @@ int main (void) | ||||
|  | ||||
|   PIDController_Init(&pid); | ||||
|  | ||||
|   lcd.print("Miep Miep"); | ||||
|   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("Elektronische Last"); | ||||
|  | ||||
|   while(1) | ||||
|   { | ||||
| @@ -118,6 +141,7 @@ int main (void) | ||||
|  | ||||
|     if(last_tick != systick) | ||||
|     { | ||||
|       timer.tick(); | ||||
|       last_tick = systick; | ||||
|       switch(modus) | ||||
|       { | ||||
| @@ -147,7 +171,33 @@ int main (void) | ||||
|           temperatur = adc.get_temperature(); | ||||
|           geschwindigkeit = fan.get_speed(); | ||||
|  | ||||
|           if(timer.elapsed()) | ||||
|           { | ||||
|             if(lcd.ready_for_data()) | ||||
|             { | ||||
|               timer.start(500U); | ||||
|  | ||||
|               char data[17U]; | ||||
|  | ||||
|               lcd.set_cursor(Display::Line1, 0U); | ||||
|               int32_t len = snprintf(data, sizeof(data) - 1, "U:%" PRIu32 ".%02" PRIu32 "V", | ||||
|                                      spannung / 1000U, spannung % 1000U / 10U); | ||||
|               std::memset(&data[len], (int)' ', 16U - len); | ||||
|               snprintf(&data[10], sizeof(data) - 10, "T:%" PRIu32 "%cC", temperatur, 0x1); | ||||
| 							data[16] = '\0'; | ||||
| 							lcd.print(data); | ||||
| #if 0 | ||||
| 							lcd.set_cursor(Display::Line2, 0U); | ||||
| 							len = snprintf(data, sizeof(data) - 1, "I:%" PRIu32 ".%02" PRIu32 "A", | ||||
| 															strom / 1000U, strom % 1000U / 10U); | ||||
| 							std::memset(&data[len], (int)' ', 16U - len); | ||||
| 							snprintf(&data[10], sizeof(data) - 10, "S:%" PRIu32 "W", geschwindigkeit); | ||||
| 							data[16] = '\0'; | ||||
| 							lcd.print(data); | ||||
| #endif | ||||
|             } | ||||
|             lcd.run(); | ||||
|           } | ||||
|           break; | ||||
|       } | ||||
|       serial_cyclic(); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user