summaryrefslogtreecommitdiff
path: root/Layout/Layout.cpp
diff options
context:
space:
mode:
authorMike Fiore <mfiore@multitech.com>2015-11-17 13:04:00 -0600
committerMike Fiore <mfiore@multitech.com>2015-11-17 13:04:00 -0600
commit11ac166f3476116b08eeaffc25d80b163573089b (patch)
tree0675e50c2377dbffc37ce3906967b17478f225c0 /Layout/Layout.cpp
parentb86c62d46385ff454a939f23277761b8ee6b8a0d (diff)
downloadmtdot-box-evb-factory-firmware-11ac166f3476116b08eeaffc25d80b163573089b.tar.gz
mtdot-box-evb-factory-firmware-11ac166f3476116b08eeaffc25d80b163573089b.tar.bz2
mtdot-box-evb-factory-firmware-11ac166f3476116b08eeaffc25d80b163573089b.zip
join works, but only once - added object for running LoRa operations in a thread, lots of misc updates
Diffstat (limited to 'Layout/Layout.cpp')
-rw-r--r--Layout/Layout.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/Layout/Layout.cpp b/Layout/Layout.cpp
index a38cc4f..7b0c375 100644
--- a/Layout/Layout.cpp
+++ b/Layout/Layout.cpp
@@ -46,6 +46,7 @@ bool Layout::writeField(const Field& field, const std::string& value, bool apply
if (apply)
startUpdate();
+ // fill the whole length with blank space in case the previous value was longer than this one
while (v.size() < field._maxSize)
v += " ";
@@ -57,6 +58,27 @@ bool Layout::writeField(const Field& field, const std::string& value, bool apply
return true;
}
+bool Layout::writeField(const Field& field, const char* value, size_t size, bool apply) {
+ bool ret;
+ char buf[32];
+ size_t s = (field._maxSize > size) ? size : field._maxSize;
+
+ // fill the whole length with blank space in case the previous value was longer than this one
+ memset(buf, 0x20, sizeof(buf));
+
+ if (apply)
+ startUpdate();
+
+ snprintf(buf, s, "%s", value);
+
+ ret = writeText(field._col, field._row, value, field._maxSize);
+
+ if (apply)
+ endUpdate();
+
+ return true;
+}
+
bool Layout::writeImage(const Image& image, bool apply) {
bool ret;
@@ -71,6 +93,13 @@ bool Layout::writeImage(const Image& image, bool apply) {
return ret;
}
+void Layout::removeField(const Field& field) {
+ startUpdate();
+ std::string s(' ', field._maxSize);
+ writeText(field._row, field._col, s.c_str(), s.size());
+ endUpdate();
+}
+
bool Layout::writeText(uint8_t col, uint8_t row, const char* value, size_t size) {
_lcd->writeText(col*6, row, font_6x8, value, size);