I am using the mqtt library under UIFlow V1.7.5 to publish the IMU data from an M5STickC Plus and also from M5Stack Fire.
On both devices I cannot publish more than about 9 mqtt messages per second, even if I make the delay between the publish-commands to less than 100 ms, say 50 ms or even no delay at all.
Why is this so slow? When I use C++ directly on an ESP32 I can easily publish several 100 msgs per second.
Is there a way to speed this up?
The way it is now the incoming data is too granular and not useful.
Posts made by mattack65
-
No more than 10 mqtt publish messages per second possible
-
Using MQTT deletes UI elements on M5StickC Plus
I am using UI Flow V 1.7.5 in the browser.
I am using an M5StickC Plus with the newest UI Firmware V1.7.5-plusWhen I use the M5mqtt - Library all my UI elements like labels disappear.
When I switch from blockly to python code and move the UI-elements AFTER the mqtt block, this does not happen. That change gets lost every time I change back to blockly.I run very similar code on the M5Stack Fire and the problem does not appear there.
Example 1: This is the generated code and it makes the three labels disappear
from m5stack import *
from m5ui import *
from uiflow import *
import wifiCfg
from m5mqtt import M5mqttsetScreenColor(0x111111)
wifiCfg.autoConnect(lcdShow=False)
button_a = M5TextBox(45, 213, "Mqtt D", lcd.FONT_Default, 0xFFFFFF, rotate=0)
mqtt_msg = M5TextBox(33, 84, "...", lcd.FONT_DejaVu72, 0xFFFFFF, rotate=0)
button_b = M5TextBox(86, 35, "Mqtt E", lcd.FONT_Default, 0xFFFFFF, rotate=0)def fun_mirror_cmd_(topic_data):
mqtt_msg.setText(str(topic_data))
passdef buttonA_wasPressed():
m5mqtt.publish(str('mirror/cmd'),str('D'))
pass
btnA.wasPressed(buttonA_wasPressed)def buttonB_wasPressed():
m5mqtt.publish(str('mirror/cmd'),str('E'))
pass
btnB.wasPressed(buttonB_wasPressed)m5mqtt = M5mqtt('m5StickC', '192.168.1.106', 1883, '', '', 300)
m5mqtt.subscribe(str('mirror/cmd'), fun_mirror_cmd_)
m5mqtt.start()Example 2: This is the slightly altered code (the UI-Elements have been moved to the end) and the labels stay
from m5stack import *
from m5ui import *
from uiflow import *
import wifiCfg
from m5mqtt import M5mqttsetScreenColor(0x111111)
wifiCfg.autoConnect(lcdShow=False)
def fun_mirror_cmd_(topic_data):
mqtt_msg.setText(str(topic_data))
passdef buttonA_wasPressed():
m5mqtt.publish(str('mirror/cmd'),str('D'))
pass
btnA.wasPressed(buttonA_wasPressed)def buttonB_wasPressed():
m5mqtt.publish(str('mirror/cmd'),str('E'))
pass
btnB.wasPressed(buttonB_wasPressed)m5mqtt = M5mqtt('m5StickC', '192.168.1.106', 1883, '', '', 300)
m5mqtt.subscribe(str('mirror/cmd'), fun_mirror_cmd_)
m5mqtt.start()button_a = M5TextBox(45, 213, "Mqtt D", lcd.FONT_Default, 0xFFFFFF, rotate=0)
mqtt_msg = M5TextBox(33, 84, "...", lcd.FONT_DejaVu72, 0xFFFFFF, rotate=0)
button_b = M5TextBox(86, 35, "Mqtt E", lcd.FONT_Default, 0xFFFFFF, rotate=0)