🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Code Generating Bug existing in the "Subscribe" Block of Software MQTT Module

    UiFlow 2.0
    2
    2
    348
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Z
      zxsoft
      last edited by

      When using Software MQTT Component, the code genrated is wrong. Because the "Subscribe" Block is not a "Statement" but a "Root" block, I can't change the subscribe action after mqtt successfully initialized. So the generated code looks like this:

      def setup():
        global kb, mqtt_client ......
      ==========BAD CODE HERE================
        mqtt_client.subscribe('/cardputer', mqtt__cardputer_event, qos=0)
      =====================================
      
        M5.begin()
        kb = MatrixKeyboard()
        kb.set_callback(kb_pressed_event)
        mqtt_client = MQTTClient('cardputer', 'xxx.xxx.xxx.xxx', port=1883, user='xxx', password='xxx', keepalive=0)
        mqtt_client.reconnect()
      
      .....
      

      Note that the subscribe code generated Even Before M5.begin()!

      You have to fix this BLOCKING Issue asap to make the block coding mqtt code useful. I can now only manually modify code to make sure the subscribe action works.

      1 Reply Last reply Reply Quote 0
      • lbuqueL
        lbuque
        last edited by

        Please use connect instead of reconnect.

        1 Reply Last reply Reply Quote 1
        • First post
          Last post