Bug: "Recent adverts" screen lists the same node multiple times (one entry per received advert, not per node)
Maintainer thường phản hồi trong vòng 2 ngày
Chưa có ai nhận issue này.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
Please note that this was written with the help of a LLM ; however- the bug is verified by my own mark 1 eyeball with my own T-ECHO.
Summary
The RECENT page of the companion UI (e.g. on the LilyGo T-Echo) lists a node once per received advert instead of once per unique node. A node heard repeatedly occupies several rows of the list, each with a different timestamp, while genuinely distinct nodes are pushed out of the fixed-size list. The list size is UI_RECENT_LIST_SIZE (default 4, 9 on the T-Echo build), so duplicate rows consume slots that unique nodes should occupy.
Steps to reproduce
- Flash the companion firmware (e.g. env
LilyGo_T-Echo_companion_radio_ble) and pair it with a companion app. - Ensure at least two distinct nodes (e.g. two repeaters with different names, or one repeater and one node) are within range and advertising.
- Open the RECENT page.
Expected behaviour
One row per unique node (keyed by its public key), showing the most recent advert timestamp.
Actual behaviour
One row per received advert. Observed on the device (T-Echo, 9-row list):
ldti SW Repeater 2h
ldti Room 1h
ldti NE Repeater 1h
ldti SW Repeater 1h
ldti Room 56m
Re Peter & The 32m
ldti NE Repeater 28m
BBC Repeater 22m
ldti SW Repeater 2m
The same node appears up to 3 times in a 9-slot list.
Root cause
src/helpers/ui/companion-new/UITask.cpp:
void addToRecents(ContactInfo &contact) {
auto p = &recent[recent_next_idx];
recent_next_idx = (recent_next_idx + 1) % UI_RECENT_LIST_SIZE;
StrHelper::strncpy(p->name, contact.name, sizeof(p->name));
p->recv_timestamp = _rtc->getCurrentTime();
}
addToRecents() (called from UITask::onDiscoveredContact()) unconditionally appends to a circular buffer (AdvertPath recent[UI_RECENT_LIST_SIZE]). There is no dedup by node identity: every advert from an already-listed node consumes a new slot, and the AdvertPath struct (name + recv_timestamp) carries no public key, so dedup would not even be possible without a struct change.
Secondary issue (latent bug)
StrHelper::strncpy(p->name, contact.name, sizeof(p->name)) does not null-terminate the destination on truncation (32-byte name buffer). A name longer than the buffer would render an unterminated string to drawTextEllipsized/getTextWidth.
Suggested fix
Key the recents list by public key:
- Add the pubkey to the entry:
struct AdvertPath {
uint8_t pub_key[PUB_KEY_SIZE];
char name[32];
uint32_t recv_timestamp;
};
- In
addToRecents(), scan for an existing entry with the same pubkey and refresh its timestamp; only allocate a new circular-buffer slot if the node is not present:
void addToRecents(ContactInfo &contact) {
for (int i = 0; i < UI_RECENT_LIST_SIZE; i++) {
if (recent[i].name[0] != 0 &&
memcmp(recent[i].pub_key, contact.id.pub_key, PUB_KEY_SIZE) == 0) {
recent[i].recv_timestamp = _rtc->getCurrentTime();
return;
}
}
auto p = &recent[recent_next_idx];
recent_next_idx = (recent_next_idx + 1) % UI_RECENT_LIST_SIZE;
memcpy(p->pub_key, contact.id.pub_key, PUB_KEY_SIZE);
StrHelper::strncpy(p->name, contact.name, sizeof(p->name) - 1);
p->name[sizeof(p->name) - 1] = 0;
p->recv_timestamp = _rtc->getCurrentTime();
}
(An LRU-style eviction — replacing the slot with the oldest recv_timestamp instead of the rotation index — would also be a reasonable alternative, but that changes more behaviour.)
Environment
- Firmware: meshcore
v1.19.0(build date "3 Dec 2026", commit tree from themeshcore-dev/meshcoremain branch) - Hardware: LilyGo T-Echo (nRF52840,
env:LilyGo_T-Echo_companion_radio_ble,UI_RECENT_LIST_SIZE=9) - The same code path affects the other board UIs (
companion-orig,companion-tiny) where the append-per-advert logic exists.
- Ngôn ngữ chính
- C
- Star
- 3.9k
- Fork
- 1.5k
- Merge trung bình
- 2 ngày 19 giờ
- Pull request đã merge (30 ngày)
- 61
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của meshcore-dev/MeshCore
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
meshcore-dev/MeshCore#4015 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
CMD_SET_DEFAULT_FLOOD_SCOPE leaves an older, longer name's tail after the new nameCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
meshcore-dev/MeshCore#3891 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
meshcore-dev/MeshCore#3826 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
App Preset Australia: NTĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
meshcore-dev/MeshCore#3825 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
meshcore-dev/MeshCore#3781 ·
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của meshcore-dev/MeshCore
Issue tương tự
-
CF_CFDP_S_SendFileData computes the file checksum from the SB buffer after CFE_SB_TransmitBufferĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
needs triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
389ds/389-ds-base#8251 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug data-types
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
ClickHouse/clickhouse-cpp#645 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
ROCm/hrx-system#3628 ·
Maintainer thường phản hồi trong vòng 1 ngày