sanity check

This commit is contained in:
Drath
2025-09-11 18:22:41 +02:00
parent 6d0492fcb7
commit 5bdc33bc95

View File

@@ -80,8 +80,8 @@ void LCDDisplay::writeLines(std::array<std::string, 4> lines) {
/* writes string to line buffer at given pos*/
void LCDDisplay::writeBuf(uint8_t row, uint8_t col, std::string str) {
// size_t max_copy = std::min(str.size(), sizeof(linebuf[row]) - col - 1);
std::memcpy(&linebuf[row][col], str.c_str(), str.size()); // will overflow
size_t len = std::min(str.size(), sizeof(linebuf[row]) - col);
std::memcpy(&linebuf[row][col], str.c_str(), len); // will overflow
}
/* hyper optimized buffer flush command, writes whole disp with a single write */