From c40930537ad29183c1f3289eff59bf6bb03351f7 Mon Sep 17 00:00:00 2001 From: Anton Jacker Date: Thu, 13 Jun 2024 14:06:55 +0200 Subject: [PATCH] add print int function to display --- src/display/Display.cpp | 12 ++++++++++++ src/display/Display.h | 15 +++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/src/display/Display.cpp b/src/display/Display.cpp index 9fe39da..9e687d5 100644 --- a/src/display/Display.cpp +++ b/src/display/Display.cpp @@ -137,6 +137,18 @@ void Display::println(String value){ this->println(msgBuffer); }; +void Display::print(int value){ + char cstr[16]; + + this->print(itoa(value, cstr, 10)); +}; + +void Display::println(int value){ + char cstr[16]; + + this->println(itoa(value, cstr, 10)); +}; + void Display::println(char *value){ this ->print(value); this->print("\n"); diff --git a/src/display/Display.h b/src/display/Display.h index 6cdc230..15774a4 100644 --- a/src/display/Display.h +++ b/src/display/Display.h @@ -86,6 +86,21 @@ class Display{ * @param value the string that should be printed */ void println(String value); + + /** + * @brief prints the passed string right behind the current displaycontent + * the sequence "\n" can be used to make a linebreak on the display + * + * @param value the string "xyz" that should be printed to the display + */ + void print(int value); + + /** + * @brief same as the print method, but after the string a line break is inserted + * + * @param value the string that should be printed + */ + void println(int value); /** * @brief string to char