B4R Question ESP32 & MQTT Connect and reconnect

viriato

Member
Licensed User
Longtime User
Dear All,
I am using this example https://www.b4x.com/android/forum/threads/mqtt.65669/#content as a starting point and I added a Timer to blink a LED , publish the ESP32 internal temperature and also detect PIN change state , example attached
But I have an issue with scenario 3 when disconnecting the MQTT broker , timer is not working anymore and the pin event is not working either (hang-up about every 40 seconds)
Tests done :
1- Program start and everything is connected - OK works fine
2- Program running disconnect network , router (WiFi OFF) - "Disconnected" , "Trying to connect again", TIMER and PIN Change state are OK, Work fine during the reconnect process ,
then re-connect network router (Wifi ON)- program reconnect again everything works fine
3 - Program running everything OK, disconnect MQTT Broker (Mosquitto on Raspi ,unplug network cable ) - "Disconnected" , "Trying to connect again" , TIMER is blocked ~ 40 secondes ,PIN Change state is not active ,detected only ~40 seconds after switch pushed, then re-connect MQTT Broker (plug cable) - program reconnect again everything works fine.

Any idea about why Timer is blocked ? Any suggestion to make it working ?

Thanks a lot
 

Attachments

  • TEST-CR.zip
    1.7 KB · Views: 294

viriato

Member
Licensed User
Longtime User
Hi Erel,
Thanks for the feedback
I tried the ping example but I am using ESP32 not sure it works and got an error , see below


Kind regards



ResolveLibrary(ping.h)
-> candidates: []
Multiple libraries were found for "WiFi.h"
Used: C:\Users\fvict\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4\libraries\WiFi
Not used: C:\Program Files (x86)\Arduino\libraries\WiFi
In file included from C:\Users\fvict\Desktop\HOMEDO~1\LESPRO~1\1-EXAM~1\CONNEC~2\testping\Objects\bin\sketch\rESP8266Ping.h:3:0,
from C:\Users\fvict\Desktop\HOMEDO~1\LESPRO~1\1-EXAM~1\CONNEC~2\testping\Objects\bin\sketch\B4RDefines.h:26,
from C:\Users\fvict\Desktop\HOMEDO~1\LESPRO~1\1-EXAM~1\CONNEC~2\testping\Objects\src\src.ino:1:
ESP8266Ping.h:27:20: fatal error: ping.h: No such file or directory
compilation terminated.
Using library WiFi at version 1.0 in folder: C:\Users\fvict\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4\libraries\WiFi
Using library WiFiClientSecure at version 1.0 in folder: C:\Users\fvict\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4\libraries\WiFiClientSecure
exit status 1
DEBUG StatusLogger Stopping LoggerContext[name=1e6f5c3, org.apache.logging.log4j.core.LoggerContext@10399f4]
DEBUG StatusLogger Stopping LoggerContext[name=1e6f5c3, org.apache.logging.log4j.core.LoggerContext@10399f4]...
TRACE StatusLogger Unregistering 1 MBeans: [org.apache.logging.log4j2:type=1e6f5c3]
TRACE StatusLogger Unregistering 1 MBeans: [org.apache.logging.log4j2:type=1e6f5c3,component=StatusLogger]
TRACE StatusLogger Unregistering 1 MBeans: [org.apache.logging.log4j2:type=1e6f5c3,component=ContextSelector]
TRACE StatusLogger Unregistering 1 MBeans: [org.apache.logging.log4j2:type=1e6f5c3,component=Loggers,name=]
TRACE StatusLogger Unregistering 2 MBeans: [org.apache.logging.log4j2:type=1e6f5c3,component=Appenders,name=RollingFile, org.apache.logging.log4j2:type=1e6f5c3,component=Appenders,name=Console]
TRACE StatusLogger Unregistering but no MBeans found matching 'org.apache.logging.log4j2:type=1e6f5c3,component=AsyncAppenders,name=*'
TRACE StatusLogger Unregistering but no MBeans found matching 'org.apache.logging.log4j2:type=1e6f5c3,component=AsyncLoggerRingBuffer'
TRACE StatusLogger Unregistering but no MBeans found matching 'org.apache.logging.log4j2:type=1e6f5c3,component=Loggers,name=*,subtype=RingBuffer'
TRACE StatusLogger Stopping XmlConfiguration[location=jar:file:/C:/Program%20Files%20(x86)/Arduino/lib/pde.jar!/log4j2.xml]...
TRACE StatusLogger XmlConfiguration notified 2 ReliabilityStrategies that config will be stopped.
TRACE StatusLogger XmlConfiguration stopping 1 LoggerConfigs.
TRACE StatusLogger XmlConfiguration stopping root LoggerConfig.
TRACE StatusLogger XmlConfiguration notifying ReliabilityStrategies that appenders will be stopped.
TRACE StatusLogger XmlConfiguration stopping remaining Appenders.
DEBUG StatusLogger Shutting down RollingFileManager C:\Users\fvict\AppData\Local\Arduino15/logs/application.log
 
Upvote 0

thetahsk

Active Member
Licensed User
Longtime User
Hi ,
It looks like there is a different ping version for ESP32 https://github.com/marian-craciunescu/ESP32Ping
Can this be implemented into B4R ?
Thanks
Et voilà
 
Upvote 1
Cookies are required to use this site. You must accept them to continue using the site. Learn more…