* refactored the UI_DISCOVER_* feature

This commit is contained in:
Scott Powell
2026-09-17 13:45:33 +10:00
parent 3caf033de2
commit 5c3d9281ff
8 changed files with 112 additions and 108 deletions
+9 -3
View File
@@ -139,15 +139,18 @@ void UITask::clearMsgPreview() {
_need_refresh = true;
}
void UITask::onMessageRecv(uint8_t path_len, const char* from_name, const char* text) {
void UITask::onMessageRecv(const ContactInfo &from, uint8_t txt_type, uint32_t sender_timestamp, uint8_t path_len, const char* text) {
// we only want to show text messages on display, not cli data
if (!(txt_type == TXT_TYPE_PLAIN || txt_type == TXT_TYPE_SIGNED_PLAIN)) return;
#ifdef HAS_DRV2605
vibration.trigger(); // vibrate even while the app is connected (honors quiet + cooldown)
#endif
if (path_len == 0xFF) {
sprintf(_origin, "(F) %s", from_name);
sprintf(_origin, "(F) %s", from.name);
} else {
sprintf(_origin, "(%d) %s", (uint32_t) path_len, from_name);
sprintf(_origin, "(%d) %s", (uint32_t) path_len, from.name);
}
StrHelper::strncpy(_msg, text, sizeof(_msg));
@@ -197,6 +200,9 @@ void UITask::onDiscoveredContact(ContactInfo &contact, bool is_new, uint8_t path
}
}
void UITask::onControlDataRecv(const mesh::Packet* packet) {
}
void UITask::renderBatteryIndicator(uint16_t batteryMilliVolts) {
// Convert millivolts to percentage
#ifndef BATT_MIN_MILLIVOLTS
+2 -1
View File
@@ -71,10 +71,11 @@ public:
void clearMsgPreview();
// MyMesh::Listener
void onMessageRecv(uint8_t path_len, const char* from_name, const char* text) override;
void onMessageRecv(const ContactInfo &from, uint8_t txt_type, uint32_t sender_timestamp, uint8_t path_len, const char* text) override;
void onChannelMsgRecv(ChannelDetails& channel_details, uint8_t path_len, const char* text) override;
void onQueueSizeChanged(int offline_queue_size) override;
void onDiscoveredContact(ContactInfo &contact, bool is_new, uint8_t path_len, const uint8_t* path) override;
void onControlDataRecv(const mesh::Packet* packet) override;
// from AbstractUITask
void notify(UIEventType t = UIEventType::none) override;