#include #include #include "Helpers.h" #include "Logs.h" void Helpers::tempToStr( char* out , temp_t temp , signed char width ) { LOG_FN_BEGIN(2); LOG(5, "%s: temp=%i", __FUNCTION__, (int) temp); if (temp == TEMP_T_INVALID) { for (int i = 0; i < width - 4; ++i) { out[i] = ' '; } strcpy(&out[width - 4], "--.-"); } else { dtostrf((float) temp / 10.0f, width, 1, out); } LOG_FN_END(2); } void Helpers::fillLine( char* line , int length , char c ) { int i = 0; while (line[i] && i < length) { ++i; } while (i < length) { line[i] = c; ++i; } line[length] = 0; } void Helpers::center( char* line , const char* text , int length , char c ) { auto cCount = (length - strlen(text)) / 2; for (int i = 0; i < cCount; ++i) { line[i] = c; } strcpy(&line[cCount], text); fillLine(line, length, c); }