mirror of
https://github.com/meshtastic/firmware.git
synced 2025-09-10 13:13:27 +00:00
Merge branch 'master' into master
This commit is contained in:
commit
39f4df7eb8
@ -62,7 +62,11 @@ static void onNetworkConnected()
|
|||||||
LOG_INFO("Start WiFi network services");
|
LOG_INFO("Start WiFi network services");
|
||||||
|
|
||||||
// start mdns
|
// start mdns
|
||||||
if (!MDNS.begin("Meshtastic")) {
|
if (
|
||||||
|
#ifdef ARCH_RP2040
|
||||||
|
!moduleConfig.mqtt.enabled && // MDNS is not supported when MQTT is enabled on ARCH_RP2040
|
||||||
|
#endif
|
||||||
|
!MDNS.begin("Meshtastic")) {
|
||||||
LOG_ERROR("Error setting up MDNS responder!");
|
LOG_ERROR("Error setting up MDNS responder!");
|
||||||
} else {
|
} else {
|
||||||
LOG_INFO("mDNS Host: Meshtastic.local");
|
LOG_INFO("mDNS Host: Meshtastic.local");
|
||||||
|
@ -77,9 +77,10 @@ meshtastic_MeshPacket *DeviceTelemetryModule::allocReply()
|
|||||||
// Check for a request for device metrics
|
// Check for a request for device metrics
|
||||||
if (decoded->which_variant == meshtastic_Telemetry_device_metrics_tag) {
|
if (decoded->which_variant == meshtastic_Telemetry_device_metrics_tag) {
|
||||||
LOG_INFO("Device telemetry reply to request");
|
LOG_INFO("Device telemetry reply to request");
|
||||||
|
return allocDataProtobuf(getDeviceTelemetry());
|
||||||
meshtastic_Telemetry telemetry = getDeviceTelemetry();
|
} else if (decoded->which_variant == meshtastic_Telemetry_local_stats_tag) {
|
||||||
return allocDataProtobuf(telemetry);
|
LOG_INFO("Device telemetry reply w/ LocalStats to request");
|
||||||
|
return allocDataProtobuf(getLocalStatsTelemetry());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -112,7 +113,7 @@ meshtastic_Telemetry DeviceTelemetryModule::getDeviceTelemetry()
|
|||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeviceTelemetryModule::sendLocalStatsToPhone()
|
meshtastic_Telemetry DeviceTelemetryModule::getLocalStatsTelemetry()
|
||||||
{
|
{
|
||||||
meshtastic_Telemetry telemetry = meshtastic_Telemetry_init_zero;
|
meshtastic_Telemetry telemetry = meshtastic_Telemetry_init_zero;
|
||||||
telemetry.which_variant = meshtastic_Telemetry_local_stats_tag;
|
telemetry.which_variant = meshtastic_Telemetry_local_stats_tag;
|
||||||
@ -142,7 +143,12 @@ void DeviceTelemetryModule::sendLocalStatsToPhone()
|
|||||||
LOG_INFO("num_packets_tx=%i, num_packets_rx=%i, num_packets_rx_bad=%i", telemetry.variant.local_stats.num_packets_tx,
|
LOG_INFO("num_packets_tx=%i, num_packets_rx=%i, num_packets_rx_bad=%i", telemetry.variant.local_stats.num_packets_tx,
|
||||||
telemetry.variant.local_stats.num_packets_rx, telemetry.variant.local_stats.num_packets_rx_bad);
|
telemetry.variant.local_stats.num_packets_rx, telemetry.variant.local_stats.num_packets_rx_bad);
|
||||||
|
|
||||||
meshtastic_MeshPacket *p = allocDataProtobuf(telemetry);
|
return telemetry;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeviceTelemetryModule::sendLocalStatsToPhone()
|
||||||
|
{
|
||||||
|
meshtastic_MeshPacket *p = allocDataProtobuf(getLocalStatsTelemetry());
|
||||||
p->to = NODENUM_BROADCAST;
|
p->to = NODENUM_BROADCAST;
|
||||||
p->decoded.want_response = false;
|
p->decoded.want_response = false;
|
||||||
p->priority = meshtastic_MeshPacket_Priority_BACKGROUND;
|
p->priority = meshtastic_MeshPacket_Priority_BACKGROUND;
|
||||||
|
@ -42,6 +42,8 @@ class DeviceTelemetryModule : private concurrency::OSThread, public ProtobufModu
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
meshtastic_Telemetry getDeviceTelemetry();
|
meshtastic_Telemetry getDeviceTelemetry();
|
||||||
|
meshtastic_Telemetry getLocalStatsTelemetry();
|
||||||
|
|
||||||
void sendLocalStatsToPhone();
|
void sendLocalStatsToPhone();
|
||||||
uint32_t sendToPhoneIntervalMs = SECONDS_IN_MINUTE * 1000; // Send to phone every minute
|
uint32_t sendToPhoneIntervalMs = SECONDS_IN_MINUTE * 1000; // Send to phone every minute
|
||||||
uint32_t sendStatsToPhoneIntervalMs = 15 * SECONDS_IN_MINUTE * 1000; // Send stats to phone every 15 minutes
|
uint32_t sendStatsToPhoneIntervalMs = 15 * SECONDS_IN_MINUTE * 1000; // Send stats to phone every 15 minutes
|
||||||
|
@ -545,9 +545,11 @@ void MQTT::onSend(const meshtastic_MeshPacket &mp_encrypted, const meshtastic_Me
|
|||||||
|
|
||||||
// mp_decoded will not be decoded when it's PKI encrypted and not directed to us
|
// mp_decoded will not be decoded when it's PKI encrypted and not directed to us
|
||||||
if (mp_decoded.which_payload_variant == meshtastic_MeshPacket_decoded_tag) {
|
if (mp_decoded.which_payload_variant == meshtastic_MeshPacket_decoded_tag) {
|
||||||
|
// For uplinking other's packets, check if it's not OK to MQTT or if it's an older packet without the bitfield
|
||||||
|
bool dontUplink = !mp_decoded.decoded.has_bitfield ||
|
||||||
|
(mp_decoded.decoded.has_bitfield && !(mp_decoded.decoded.bitfield & BITFIELD_OK_TO_MQTT_MASK));
|
||||||
// check for the lowest bit of the data bitfield set false, and the use of one of the default keys.
|
// check for the lowest bit of the data bitfield set false, and the use of one of the default keys.
|
||||||
if (!isFromUs(&mp_decoded) && !isMqttServerAddressPrivate && mp_decoded.decoded.has_bitfield &&
|
if (!isFromUs(&mp_decoded) && !isMqttServerAddressPrivate && dontUplink &&
|
||||||
!(mp_decoded.decoded.bitfield & BITFIELD_OK_TO_MQTT_MASK) &&
|
|
||||||
(ch.settings.psk.size < 2 || (ch.settings.psk.size == 16 && memcmp(ch.settings.psk.bytes, defaultpsk, 16)) ||
|
(ch.settings.psk.size < 2 || (ch.settings.psk.size == 16 && memcmp(ch.settings.psk.bytes, defaultpsk, 16)) ||
|
||||||
(ch.settings.psk.size == 32 && memcmp(ch.settings.psk.bytes, eventpsk, 32)))) {
|
(ch.settings.psk.size == 32 && memcmp(ch.settings.psk.bytes, eventpsk, 32)))) {
|
||||||
LOG_INFO("MQTT onSend - Not forwarding packet due to DontMqttMeBro flag");
|
LOG_INFO("MQTT onSend - Not forwarding packet due to DontMqttMeBro flag");
|
||||||
|
Loading…
Reference in New Issue
Block a user