Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/mesh/FloodingRouter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ void FloodingRouter::sniffReceived(const meshtastic_MeshPacket *p, const meshtas
}
if ((p->to != getNodeNum()) && (p->hop_limit > 0) && (getFrom(p) != getNodeNum())) {
if (p->id != 0) {
if (config.device.role != meshtastic_Config_DeviceConfig_Role_CLIENT_MUTE) {
if (config.device.role != meshtastic_Config_DeviceConfig_Role_CLIENT_MUTE &&
!(p->via_mqtt && config.lora.ignore_mqtt)) {
meshtastic_MeshPacket *tosend = packetPool.allocCopy(*p); // keep a copy because we will be sending it

tosend->hop_limit--; // bump down the hop count
Expand All @@ -53,7 +54,7 @@ void FloodingRouter::sniffReceived(const meshtastic_MeshPacket *p, const meshtas
// We are careful not to call our hooked version of send() - because we don't want to check this again
Router::send(tosend);
} else {
LOG_DEBUG("Not rebroadcasting. Role = Role_ClientMute\n");
LOG_DEBUG("Not rebroadcasting. Role = Role_ClientMute or packet came via MQTT with ignore MQTT set\n");
}
} else {
LOG_DEBUG("Ignoring a simple (0 id) broadcast\n");
Expand Down
2 changes: 1 addition & 1 deletion src/mesh/MeshService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ int MeshService::handleFromRadio(const meshtastic_MeshPacket *mp)
"Received telemetry response. Skip sending our NodeInfo because this potentially a Repeater which will ignore our "
"request for its NodeInfo.\n");
} else if (mp->which_payload_variant == meshtastic_MeshPacket_decoded_tag && !nodeDB->getMeshNode(mp->from)->has_user &&
nodeInfoModule) {
nodeInfoModule && !(mp->via_mqtt && config.lora.ignore_mqtt)) {
LOG_INFO("Heard a node on channel %d we don't know, sending NodeInfo and asking for a response.\n", mp->channel);
nodeInfoModule->sendOurNodeInfo(mp->from, true, mp->channel);
}
Expand Down
2 changes: 1 addition & 1 deletion src/mesh/NodeDB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ void NodeDB::installDefaultConfig()
config.lora.region = meshtastic_Config_LoRaConfig_RegionCode_UNSET;
config.lora.modem_preset = meshtastic_Config_LoRaConfig_ModemPreset_LONG_FAST;
config.lora.hop_limit = HOP_RELIABLE;
config.lora.ignore_mqtt = false;
config.lora.ignore_mqtt = true;
#ifdef PIN_GPS_EN
config.position.gps_en_gpio = PIN_GPS_EN;
#endif
Expand Down
13 changes: 12 additions & 1 deletion src/mesh/Router.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,18 @@ void Router::handleReceived(meshtastic_MeshPacket *p, RxSource src)
void Router::perhapsHandleReceived(meshtastic_MeshPacket *p)
{
// assert(radioConfig.has_preferences);
bool ignore = is_in_repeated(config.lora.ignore_incoming, p->from) || (config.lora.ignore_mqtt && p->via_mqtt);
bool ignore = is_in_repeated(config.lora.ignore_incoming, p->from);

if (p->via_mqtt && config.lora.ignore_mqtt) {
bool allow_mqtt = false;
// Check if this packet was received via MQTT on a channel we have downlink enabled (in that case packet is decoded here)
if (moduleConfig.mqtt.enabled && p->which_payload_variant == meshtastic_MeshPacket_decoded_tag) {
meshtastic_Channel channel = channels.getByIndex(p->channel);
if (channel.has_settings && channel.settings.downlink_enabled)
allow_mqtt = true;
}
ignore |= !allow_mqtt;
}

if (ignore) {
LOG_DEBUG("Ignoring incoming message, 0x%x is in our ignore list or came via MQTT\n", p->from);
Expand Down
4 changes: 1 addition & 3 deletions src/modules/AdminModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -452,9 +452,7 @@ void AdminModule::handleSetConfig(const meshtastic_Config &c)
if (isRegionUnset && config.lora.region > meshtastic_Config_LoRaConfig_RegionCode_UNSET) {
config.lora.tx_enabled = true;
initRegion();
if (myRegion->dutyCycle < 100) {
config.lora.ignore_mqtt = true; // Ignore MQTT by default if region has a duty cycle limit
}
config.lora.ignore_mqtt = true; // Ignore MQTT by default
if (strcmp(moduleConfig.mqtt.root, default_mqtt_root) == 0) {
sprintf(moduleConfig.mqtt.root, "%s/%s", default_mqtt_root, myRegion->name);
changes = SEGMENT_CONFIG | SEGMENT_MODULECONFIG;
Expand Down