Skip to content

Commit b332b06

Browse files
committed
techo_ui: some tweaks
1 parent e14b022 commit b332b06

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

examples/companion_radio/ui-new/UITask.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414

1515
#define LONG_PRESS_MILLIS 1200
1616

17+
#ifndef UI_RECENT_LIST_SIZE
18+
#define UI_RECENT_LIST_SIZE 4
19+
#endif
20+
1721
#define PRESS_LABEL "long press"
1822

1923
#include "icons.h"
@@ -79,7 +83,7 @@ class HomeScreen : public UIScreen {
7983
NodePrefs* _node_prefs;
8084
uint8_t _page;
8185
bool _shutdown_init;
82-
AdvertPath recent[4];
86+
AdvertPath recent[UI_RECENT_LIST_SIZE];
8387

8488
void renderBatteryIndicator(DisplayDriver& display, uint16_t batteryMilliVolts) {
8589
// Convert millivolts to percentage
@@ -156,10 +160,10 @@ class HomeScreen : public UIScreen {
156160
display.drawTextCentered(display.width() / 2, 43, tmp);
157161
}
158162
} else if (_page == HomePage::RECENT) {
159-
the_mesh.getRecentlyHeard(recent, 4);
163+
the_mesh.getRecentlyHeard(recent, UI_RECENT_LIST_SIZE);
160164
display.setColor(DisplayDriver::GREEN);
161165
int y = 20;
162-
for (int i = 0; i < 4; i++, y += 11) {
166+
for (int i = 0; i < UI_RECENT_LIST_SIZE; i++, y += 11) {
163167
auto a = &recent[i];
164168
if (a->name[0] == 0) continue; // empty slot
165169
display.setCursor(0, y);

src/helpers/ui/GxEPDDisplay.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ void GxEPDDisplay::turnOn() {
2929
if (!_init) begin();
3030
#if DISP_BACKLIGHT
3131
digitalWrite(DISP_BACKLIGHT, HIGH);
32-
_isOn = true;
3332
#endif
33+
_isOn = true;
3434
}
3535

3636
void GxEPDDisplay::turnOff() {
@@ -132,7 +132,7 @@ uint16_t GxEPDDisplay::getTextWidth(const char* str) {
132132
int16_t x1, y1;
133133
uint16_t w, h;
134134
display.getTextBounds(str, 0, 0, &x1, &y1, &w, &h);
135-
return w / SCALE_X;
135+
return ceil((w + 1) / SCALE_X);
136136
}
137137

138138
void GxEPDDisplay::endFrame() {

variants/techo/platformio.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ build_flags =
6868
-D BLE_DEBUG_LOGGING=1
6969
-D DISPLAY_CLASS=GxEPDDisplay
7070
-D OFFLINE_QUEUE_SIZE=256
71+
-D UI_RECENT_LIST_SIZE=9
7172
; -D MESH_PACKET_LOGGING=1
7273
; -D MESH_DEBUG=1
7374
build_src_filter = ${LilyGo_Techo.build_src_filter}

0 commit comments

Comments
 (0)