clonified, should be faster too bc we're avoiding copying

This commit is contained in:
2026-01-01 19:24:41 +01:00
parent 03328693e0
commit 12fdf93377
2 changed files with 28 additions and 29 deletions

View File

@@ -20,11 +20,11 @@ class LCDDisplay {
void close();
// we avoid using these, use buffer (even if these are faster for small writes, perhaps a rewrite is in order)
void writeStr(std::string str);
void writeStr(uint8_t row, uint8_t col, std::string str);
void writeStr(const std::string& str);
void writeStr(uint8_t row, uint8_t col, const std::string& str);
public:
explicit LCDDisplay(std::string dev, uint32_t baud = 0010002); // from termios-baud.h, B115200
explicit LCDDisplay(const std::string& dev, uint32_t baud = 0010002); // from termios-baud.h, B115200
~LCDDisplay();
void clear();
@@ -34,13 +34,13 @@ class LCDDisplay {
void setCursor(uint8_t row, uint8_t col);
void setCustomChar(uint8_t index, std::array<uint8_t, 8> cchar);
void writeBuf(uint8_t row, uint8_t col, std::string str);
void writeBuf(uint8_t row, uint8_t col, const std::string& str);
void clearBuf();
void flushBuf();
char bar(uint8_t char_id, double value);
// returns custom char no. c, small enough to define in header
static constexpr char cc(const uint8_t c) { return c % 8; }
static constexpr char cc(const uint8_t c) { return static_cast<char>(c % 8); }
};
#endif