kopia lustrzana https://github.com/meshtastic/firmware
Ignore MQTT by default and then don't transmit downlink over LoRa
rodzic
250cf16bf8
commit
0162a56a11
|
@ -44,7 +44,8 @@ void FloodingRouter::sniffReceived(const meshtastic_MeshPacket *p, const meshtas
|
||||||
}
|
}
|
||||||
if ((p->to != getNodeNum()) && (p->hop_limit > 0) && (getFrom(p) != getNodeNum())) {
|
if ((p->to != getNodeNum()) && (p->hop_limit > 0) && (getFrom(p) != getNodeNum())) {
|
||||||
if (p->id != 0) {
|
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
|
meshtastic_MeshPacket *tosend = packetPool.allocCopy(*p); // keep a copy because we will be sending it
|
||||||
|
|
||||||
tosend->hop_limit--; // bump down the hop count
|
tosend->hop_limit--; // bump down the hop count
|
||||||
|
@ -54,7 +55,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
|
// We are careful not to call our hooked version of send() - because we don't want to check this again
|
||||||
Router::send(tosend);
|
Router::send(tosend);
|
||||||
} else {
|
} 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 {
|
} else {
|
||||||
LOG_DEBUG("Ignoring a simple (0 id) broadcast\n");
|
LOG_DEBUG("Ignoring a simple (0 id) broadcast\n");
|
||||||
|
|
|
@ -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 "
|
"Received telemetry response. Skip sending our NodeInfo because this potentially a Repeater which will ignore our "
|
||||||
"request for its NodeInfo.\n");
|
"request for its NodeInfo.\n");
|
||||||
} else if (mp->which_payload_variant == meshtastic_MeshPacket_decoded_tag && !nodeDB->getMeshNode(mp->from)->has_user &&
|
} 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);
|
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);
|
nodeInfoModule->sendOurNodeInfo(mp->from, true, mp->channel);
|
||||||
}
|
}
|
||||||
|
|
|
@ -243,7 +243,7 @@ void NodeDB::installDefaultConfig()
|
||||||
config.lora.region = meshtastic_Config_LoRaConfig_RegionCode_UNSET;
|
config.lora.region = meshtastic_Config_LoRaConfig_RegionCode_UNSET;
|
||||||
config.lora.modem_preset = meshtastic_Config_LoRaConfig_ModemPreset_LONG_FAST;
|
config.lora.modem_preset = meshtastic_Config_LoRaConfig_ModemPreset_LONG_FAST;
|
||||||
config.lora.hop_limit = HOP_RELIABLE;
|
config.lora.hop_limit = HOP_RELIABLE;
|
||||||
config.lora.ignore_mqtt = false;
|
config.lora.ignore_mqtt = true;
|
||||||
#ifdef PIN_GPS_EN
|
#ifdef PIN_GPS_EN
|
||||||
config.position.gps_en_gpio = PIN_GPS_EN;
|
config.position.gps_en_gpio = PIN_GPS_EN;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -486,7 +486,18 @@ void Router::handleReceived(meshtastic_MeshPacket *p, RxSource src)
|
||||||
void Router::perhapsHandleReceived(meshtastic_MeshPacket *p)
|
void Router::perhapsHandleReceived(meshtastic_MeshPacket *p)
|
||||||
{
|
{
|
||||||
// assert(radioConfig.has_preferences);
|
// 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) {
|
if (ignore) {
|
||||||
LOG_DEBUG("Ignoring incoming message, 0x%x is in our ignore list or came via MQTT\n", p->from);
|
LOG_DEBUG("Ignoring incoming message, 0x%x is in our ignore list or came via MQTT\n", p->from);
|
||||||
|
|
|
@ -394,9 +394,7 @@ void AdminModule::handleSetConfig(const meshtastic_Config &c)
|
||||||
if (isRegionUnset && config.lora.region > meshtastic_Config_LoRaConfig_RegionCode_UNSET) {
|
if (isRegionUnset && config.lora.region > meshtastic_Config_LoRaConfig_RegionCode_UNSET) {
|
||||||
config.lora.tx_enabled = true;
|
config.lora.tx_enabled = true;
|
||||||
initRegion();
|
initRegion();
|
||||||
if (myRegion->dutyCycle < 100) {
|
config.lora.ignore_mqtt = true; // Ignore MQTT by default
|
||||||
config.lora.ignore_mqtt = true; // Ignore MQTT by default if region has a duty cycle limit
|
|
||||||
}
|
|
||||||
if (strcmp(moduleConfig.mqtt.root, default_mqtt_root) == 0) {
|
if (strcmp(moduleConfig.mqtt.root, default_mqtt_root) == 0) {
|
||||||
sprintf(moduleConfig.mqtt.root, "%s/%s", default_mqtt_root, myRegion->name);
|
sprintf(moduleConfig.mqtt.root, "%s/%s", default_mqtt_root, myRegion->name);
|
||||||
changes = SEGMENT_CONFIG | SEGMENT_MODULECONFIG;
|
changes = SEGMENT_CONFIG | SEGMENT_MODULECONFIG;
|
||||||
|
|
Ładowanie…
Reference in New Issue