From f3dadb3042c66df76ffa6d703119159e26447826 Mon Sep 17 00:00:00 2001 From: proddy Date: Tue, 29 Sep 2020 13:30:57 +0200 Subject: [PATCH] added renderer for char strings, like the boiler's service code text --- src/helpers.cpp | 6 ++++++ src/helpers.h | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/helpers.cpp b/src/helpers.cpp index 1d8080151..1eb195b84 100644 --- a/src/helpers.cpp +++ b/src/helpers.cpp @@ -134,6 +134,12 @@ char * Helpers::render_boolean(char * result, bool value) { return result; } +// render for native char strings +char * Helpers::render_value(char * result, const char * value, uint8_t format) { + strcpy(result, value); + return result; +} + // convert unsigned int (single byte) to text value and returns it // format: 255(0xFF)=boolean, 0=no formatting, otherwise divide by format char * Helpers::render_value(char * result, uint8_t value, uint8_t format) { diff --git a/src/helpers.h b/src/helpers.h index 521f178be..b84f4f699 100644 --- a/src/helpers.h +++ b/src/helpers.h @@ -40,7 +40,8 @@ class Helpers { static char * render_value(char * result, const uint16_t value, const uint8_t format); static char * render_value(char * result, const uint32_t value, const uint8_t format); static char * render_value(char * result, const int16_t value, const uint8_t format); - + static char * render_value(char * result, const char * value, uint8_t format); + static char * render_boolean(char * result, bool value); static char * smallitoa(char * result, const uint8_t value);