Official reference client implementation for Cumulocity SmartREST on u-blox C027.
Dependencies: C027_Support C12832 LM75B MMA7660 MbedSmartRest mbed-rtos mbed
Fork of MbedSmartRestMain by
Diff: io/LCDDisplay.cpp
- Revision:
- 96:5dfdc8568e9f
- Parent:
- 93:0acd11870c6a
--- a/io/LCDDisplay.cpp Wed Apr 22 11:22:25 2015 +0000 +++ b/io/LCDDisplay.cpp Mon Apr 27 10:50:21 2015 +0000 @@ -1,3 +1,4 @@ +#include <ctype.h> #include "LCDDisplay.h" #include "logging.h" @@ -10,8 +11,14 @@ if (n == 0) { return ; } else if (src && src!=dest) { - strncpy(dest, src, n-1); + size_t j = 0; + for (size_t i = 0; src[i] && j<n; ++i) { + if (isprint(src[i])) + dest[j++] = src[i]; + } dest[n-1] = '\0'; + if (j < n) + dest[j] = '\0'; } } @@ -58,21 +65,16 @@ void LCDDisplay::lcdPrint(const char *l1, const char *l2, const char *l3) { - aDebug(GRE "io::lcdPrint" DEF "\r\n"); - lcdLock.lock(); _lcd.cls(); _lcd.locate(0, 0); _lcd.printf("%s\n", l1); - aDebug(GRE "> " CYA "%s\r\n" DEF, l1); - if (l2 != NULL) { + if (l2) { _lcd.printf("%s\n", l2); - aDebug(GRE "> " CYA "%s\r\n" DEF, l2); - if (l3 != NULL) { + if (l3) { _lcd.printf("%s\n", l3); - aDebug(GRE "> " CYA "%s\r\n" DEF, l3); } } lcdLock.unlock();