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: test-simulator:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Install libbluetooth - name: Install libs needed for native build
shell: bash shell: bash
run: | run: |
sudo apt-get update --fix-missing 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 - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4

View File

@ -318,7 +318,7 @@ bool Channels::anyMqttEnabled()
{ {
#if USERPREFS_EVENT_MODE #if USERPREFS_EVENT_MODE
// Don't publish messages on the public MQTT broker if we are in 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; return false;
} }
#endif #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); 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; IPAddress ip;
isMqttServerAddressPrivate = isMqttServerAddressPrivate = ip.fromString(host.c_str()) && isPrivateIpAddress(ip);
ip.fromString(parseHostAndPort(moduleConfig.mqtt.address).first.c_str()) && isPrivateIpAddress(ip);
#if HAS_NETWORKING #if HAS_NETWORKING
if (!moduleConfig.mqtt.proxy_to_client_enabled) if (!moduleConfig.mqtt.proxy_to_client_enabled)
@ -633,8 +634,7 @@ void MQTT::onSend(const meshtastic_MeshPacket &mp_encrypted, const meshtastic_Me
return; return;
} }
if (strcmp(moduleConfig.mqtt.address, default_mqtt_address) == 0 && if (isConfiguredForDefaultServer && (mp_decoded.decoded.portnum == meshtastic_PortNum_RANGE_TEST_APP ||
(mp_decoded.decoded.portnum == meshtastic_PortNum_RANGE_TEST_APP ||
mp_decoded.decoded.portnum == meshtastic_PortNum_DETECTION_SENSOR_APP)) { mp_decoded.decoded.portnum == meshtastic_PortNum_DETECTION_SENSOR_APP)) {
LOG_DEBUG("MQTT onSend - Ignoring range test or detection sensor message on public mqtt"); LOG_DEBUG("MQTT onSend - Ignoring range test or detection sensor message on public mqtt");
return; return;

View File

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

View File

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