From 1d09beb8a78b39181083bf6236f4efc2ee1c1242 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Thu, 6 Oct 2022 18:40:31 +0200 Subject: [PATCH] word wrap long input and fix compiler warnings --- src/input/kbI2cBase.cpp | 2 +- src/modules/CannedMessageModule.cpp | 2 +- variants/m5stack_core/platformio.ini | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/input/kbI2cBase.cpp b/src/input/kbI2cBase.cpp index 2066e12ad..332dfde0d 100644 --- a/src/input/kbI2cBase.cpp +++ b/src/input/kbI2cBase.cpp @@ -17,7 +17,7 @@ uint8_t read_from_14004(uint8_t reg, uint8_t *data, uint8_t length) Wire.write(reg); Wire.endTransmission(); // stop transmitting delay(20); - Wire.requestFrom(CARDKB_ADDR, length); + Wire.requestFrom(CARDKB_ADDR, (int)length); int i = 0; while ( Wire.available() ) // slave may send less than requested { diff --git a/src/modules/CannedMessageModule.cpp b/src/modules/CannedMessageModule.cpp index a24e9585d..1df8d2604 100644 --- a/src/modules/CannedMessageModule.cpp +++ b/src/modules/CannedMessageModule.cpp @@ -385,7 +385,7 @@ void CannedMessageModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *st char buffer[9]; sprintf(buffer, "%d left", Constants_DATA_PAYLOAD_LEN - this->freetext.length()); display->drawString(x + display->getWidth() - display->getStringWidth(buffer), y + 0, buffer); - display->drawString(0 + x, 0 + y + FONT_HEIGHT_SMALL, cannedMessageModule->drawWithCursor(cannedMessageModule->freetext, cannedMessageModule->cursor)); + display->drawStringMaxWidth(0 + x, 0 + y + FONT_HEIGHT_SMALL, x + display->getWidth(), cannedMessageModule->drawWithCursor(cannedMessageModule->freetext, cannedMessageModule->cursor)); } else { display->setTextAlignment(TEXT_ALIGN_LEFT); display->setFont(FONT_SMALL); diff --git a/variants/m5stack_core/platformio.ini b/variants/m5stack_core/platformio.ini index dd9bd0f71..d1cda8fd8 100644 --- a/variants/m5stack_core/platformio.ini +++ b/variants/m5stack_core/platformio.ini @@ -23,6 +23,7 @@ build_flags = -DTFT_BL=32 -DSPI_FREQUENCY=40000000 -DSPI_READ_FREQUENCY=16000000 + -DDISABLE_ALL_LIBRARY_WARNINGS lib_ignore = m5stack-core lib_deps =