Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By jarnoldbrown
#71728 I am trying to use an ESP8266 module to talk to an MQTT server and Google Sheets. I have experienced some flakiness, but I'm not sure why. The MQTT stuff I've had running (use PubSub library) for months, and it seems rock solid. The Google Sheets stuff(using the HTTPSRedirect library) seems fairly solid, but only if the debugging is enabled, which causes a bunch of stuff to be printed on the serial terminal(I'm assuming the extra delays this incurs "fix" some problem?) . So is there any reason why the PubSub client and the HTTPSRedirect client could or should not co-exist? Apparently the HTTPSRedirect libray uses the WiFiClientSecure lib, whereas the PuSub does not(as far as I know).

Maybe I should investigat using the latest HTTPSRedirect library, but I wanted to check that I'm not trying to do something monumentally stupid before throwing more effort at this(the main effort is endless testing for reliablity).
User avatar
By mrburnette
#71743
jarnoldbrown wrote:<...>
seems fairly solid, but only if the debugging is enabled, which causes a bunch of stuff to be printed on the serial terminal(I'm assuming the extra delays this incurs "fix" some problem?) .
<...>


If extra delays, code based or I/O based, then the issue could be that the task switcher non-OS is not being serviced within the max recommended timeframe, 50mS. You can force Arduino to release to the native RF section using yield(), delay(0), or delay(1) ... note that users have reported that delay(0) and delay(1) do not have the same entry point and some folk swear by one or the other... personally, I think yield() is more appropriate.

Point is, if the Arduino loop() function is not automatically repeated in 50mS you must make some provision via your code to switch to the RF side for servicing the protocol stack, etc.

Ray
User avatar
By jarnoldbrown
#71747 Thanks, but not sure if I made myself clear. I'm not adding any extra delays, as such, but speculating that the delays introduced by enabling the debugging, which prints out loads of stuff to the serial port, are what makes the code work reliably, as opposed to having debugging turned off, when the code seems flakey.

My main loop has no delays in it, but obviously I don't know exactly waht is going on in the functions I'm calling in the HTTPSRedirect library.

On the other hand, it could just be sod's law, in that it won't malfunction when debugging is enabled, as that would help me to understand where the problem is..
User avatar
By philbowles
#71750 Define "some flakiness" - if you are talking about "random" WDT resets, then there are several answers that may be relevant. Unfortunately they may involve re-structuring your code and making it "asynchronous" or "event-driven" to allows the two requirements to run "at the same time".

It does sound a little like a "timing error" at the moment, but once we hear what "flakiness" is exactly (with a copy of the code and the diagnostic output messages) then I'm sure someone here will be able to nail the problem failry rapidly. Be warned that the solution may not be as easy! :)