Merge branch 'meshtastic:master' into master

This commit is contained in:
Mictronics 2024-12-25 15:36:52 +01:00 committed by GitHub
commit c2992db955
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 12 additions and 9 deletions

View File

@ -9,11 +9,11 @@ jobs:
test-simulator:
runs-on: ubuntu-latest
steps:
- name: Install libbluetooth
- name: Install libs needed for native build
shell: bash
run: |
sudo apt-get update --fix-missing
sudo apt-get install -y libbluetooth-dev libgpiod-dev libyaml-cpp-dev openssl libssl-dev libulfius-dev liborcania-dev
sudo apt-get install -y libbluetooth-dev libgpiod-dev libyaml-cpp-dev openssl libssl-dev libulfius-dev liborcania-dev libusb-1.0-0-dev libi2c-dev
- name: Checkout code
uses: actions/checkout@v4

View File

@ -318,7 +318,7 @@ bool Channels::anyMqttEnabled()
{
#if USERPREFS_EVENT_MODE
// Don't publish messages on the public MQTT broker if we are in event mode
if (strcmp(moduleConfig.mqtt.address, default_mqtt_address) == 0) {
if (mqtt && mqtt.isUsingDefaultServer()) {
return false;
}
#endif

View File

@ -324,9 +324,10 @@ MQTT::MQTT() : concurrency::OSThread("mqtt"), mqttQueue(MAX_MQTT_QUEUE)
moduleConfig.mqtt.map_report_settings.publish_interval_secs, default_map_publish_interval_secs);
}
String host = parseHostAndPort(moduleConfig.mqtt.address).first;
isConfiguredForDefaultServer = host.length() == 0 || host == default_mqtt_address;
IPAddress ip;
isMqttServerAddressPrivate =
ip.fromString(parseHostAndPort(moduleConfig.mqtt.address).first.c_str()) && isPrivateIpAddress(ip);
isMqttServerAddressPrivate = ip.fromString(host.c_str()) && isPrivateIpAddress(ip);
#if HAS_NETWORKING
if (!moduleConfig.mqtt.proxy_to_client_enabled)
@ -633,9 +634,8 @@ void MQTT::onSend(const meshtastic_MeshPacket &mp_encrypted, const meshtastic_Me
return;
}
if (strcmp(moduleConfig.mqtt.address, default_mqtt_address) == 0 &&
(mp_decoded.decoded.portnum == meshtastic_PortNum_RANGE_TEST_APP ||
mp_decoded.decoded.portnum == meshtastic_PortNum_DETECTION_SENSOR_APP)) {
if (isConfiguredForDefaultServer && (mp_decoded.decoded.portnum == meshtastic_PortNum_RANGE_TEST_APP ||
mp_decoded.decoded.portnum == meshtastic_PortNum_DETECTION_SENSOR_APP)) {
LOG_DEBUG("MQTT onSend - Ignoring range test or detection sensor message on public mqtt");
return;
}

View File

@ -79,6 +79,8 @@ class MQTT : private concurrency::OSThread
void start() { setIntervalFromNow(0); };
bool isUsingDefaultServer() { return isConfiguredForDefaultServer; }
protected:
struct QueueEntry {
std::string topic;
@ -87,6 +89,7 @@ class MQTT : private concurrency::OSThread
PointerQueue<QueueEntry> mqttQueue;
int reconnectCount = 0;
bool isConfiguredForDefaultServer = true;
virtual int32_t runOnce() override;

View File

@ -1,4 +1,4 @@
[VERSION]
major = 2
minor = 5
build = 17
build = 18