Closed Andy2051 closed 1 year ago
Hi Andy, Please share all your code, and we try to check It. Thanks Renzo
Renzo, Thanks for replying and offering to have a look. It is nearly a year since I last asked you a question. I had to put the project on hold because other things took priority. Attached project files zipped up.
You will need to amend myAPs at line 75 in wifi.cpp to add your access point and password.
You will need to amend the email details at lines 22-24 in email.cpp, provide gmail account details and the email address you want emails sent to.
I have also attached a pdf that gives you the circuit diagram - for information and background. The areas of interest to you:
setup() in the main code (oilsensor7.ino) that calls StartupEmail()
the function StartupEmail() in email.cpp - line 56.
You can ignore all the other email functions in email.cpp, I am not using them yet and email without attachments works fine. Symptoms, as described on github.
When it tries to send an email it hangs for a period before reporting the errors as shown in my github post. Then checking the filesystem with filezilla, all the files are gone. Comment out sending the email, re-compile, upload, reboot. The files re-appear - some are automatically created, but files such as settings.txt (tank dimensions) and ssids.txt (SSIDs and passwords) are not there, they have to be uploaded again with filezilla.
Trying to send an email with an attachment deletes all files in the LittleFS filesystem.
StartupEmail() works fine without an attachment.
The main loop reads the sensor, The JSN-SRO4 ultra sonic sensor is not particularly consistent (or reliable) so it takes lots of readings. It then goes to sleep for an hour before repeating. If you try to run the code, as you will have no sensor attached, you may get a lot of errors reported in the log file sensor.log. Grateful for any input you can provide, sending an attachment is "nice to have" not essential. It is a case of: have I done something obviously wrong? regards Andy
Hi Andy,
Please share all your code, and we try to check It.
Thanks Renzo
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: < @.***>
On Tue, 2023-01-17 at 22:53 -0800, Renzo Mischianti wrote:
Hi, It's seems no file is attached. Bye Renzo
Obviously got stripped from the email. :( email-problems.zip tank-sensor.pdf
Hi Andy, It seems all ok, I must reproduce the project entirely, but from the close, I think that the problem can be a memory leak. The Ftp server and Email get a lot of memory; try to add some checks on the memory usage. Bye RM
Thanks for the pointer, I will investigate.
Arduino 1.8.9 compiler, esp8266 and LittleFS.
When I attempt to add an attachment to an email, it deletes all the files in the file system. I have done this several times. emails without attachments work fine.
Files before sending email (also visible in filezilla), generated as output at the beginning of setup:
after attempting to send email
filezilla also shows the root directory empty.
The email is run as a function at the end of setup for testing:
Where
StartupEmail()
is:Output generated is:
It hangs for some time, maybe 30 seconds or longer between echoing
START EMAIL
and the other output. Without the code for the attachment, it works and the email is delivered, email body:17 Jan 2023, 12:21 - Oil sensor restarted.
I can live without email attachments but it would be nice to find out what is going wrong.
thanks
Andy