OpenSprinkler › Forums › Comments, Suggestions, Requests › OpenSprinkler on ESP32
- This topic has 8 replies, 3 voices, and was last updated 5 years, 8 months ago by Ray.
August 14, 2017 at 2:11 am #47435
I have just uploaded on GitHub/pbecchi/Esp32-Sprinkler a branch of Esp8266 OpenSprinkler firmware ported to ESP32!
The code has been compiled and run on any ESP32 board and retain all features of Esp8266 version like been highly configurable and HW indipendent.
This is very first release intended and it is not debugged. I will appreciate any help on this : all your comments and remark here and on GitHub issue are welcome and will be rapidly answered!August 19, 2017 at 12:35 pm #47469
Hello, last two day i was trying compile code unfortunately without success 🙁 i’m using Ardunio IDE version 1.8.3 and latest espressif/arduino-esp32. I thing I’ve solved some issues but no i’m stack. Below summary of changes:
1. file Esp32-Sprinkler.ino – #include <Time/TimeLib.h> changed to #include <TimeLib.h>
2. I’ve got ‘File’ was not declared in this scope error so in EtherCardW5100.cpp i’ve added #include <SPIFFS.h> and downloaded SPIFFS.h library for ESP32
3. For some reason unclear for me #define MY_PING included in Pins.h did not work and I’ve got “‘Ping’ was not declared” error. Adding #define MY_PING in EtherCardW5100.cpp solved this problem.
4. Next i’ve got “‘SOCKET’ does not name a type” error so i’ve added #include <lwip/sockets.h> in EtherCardW5100.cpp
but now i’ve got several errors “macro “write” requires 3 arguments, but only 1 given”. I’m running out of ideas… do you have any ?
If I read this post correctly https://www.esp32.com/viewtopic.php?t=2317 my problem number 4 whit write macro is due Macro incompatibility between lwip/sockets.h and functional libraries. I do not know if this may be simple solved.
@pbecchi i see that you going to develop ping library, can you share time frame please? I’m also curious why we need ping at all. Can we checks for example WiFI connection status and/or NTP server using NTP library and if this fails reconnect network or reboot (after 6 attempts) ?
Attachments:August 24, 2017 at 2:19 am #47513
Thanks for trying!
Regarding libraries you have done it rigth, since esp32-arduino is far from beeing complete, you have to dig around the missing libraries.
I believe that most of your errors depend on setting you have on your pins.h file.
You should use define proto 12, on 12 you have all define I have used to compile the code.
This has been done for a bare devkit c board without any HW attached, but in this configuration the code compile and run!
You have to set in the code ethercard5100.cpp your SSID and password because WifiManager is not available!
Since the code is multiplatform and multihardware I put all define in the pins.h file , there if you want to add your configuration just add another proto number copying and pasting the lines of another proto the one most similar to your!!
I will try to avoid putting #define around in the code and I suggest you put all those in the pins.h file!
If you have problems just send a message with your pins setting and I will try to compile it myself!
I have just checked…. MY_PING has to be not DEFINEd otherwise you get all errors relative to Sockets …..!
Regarding ping,…I made a ping library but….yes you are right there are probably better way to check network status… I am already working on that!
PaoloAugust 31, 2017 at 4:52 am #47563
I just would like only report that I’ve successfully compiled a code. I had to only bypass Ping.ping function (now packetLoopIcmpCheckReply always returns 1) but this should be fine for test purpose. Additionally FS.h do not include Dir class so this part of code is commented now and need to be rewritten , Dir is used to print some DEBUG only anyway. Looks like you missed also some “&& !defined(ESP32)” in make_logfile_name function.
I will build test environment next week and immediately share an outcome.
I’ve also forked github repository to document all made changes. Link is https://github.com/JaCharer/Esp32-Sprinkler
CharerSeptember 6, 2017 at 8:51 am #47598
Are you sure that your ESP32-Sprinkler GitHub contain lattes code? it may opinion not as for example: definition of SDA_PIN and SDL_PIN are in ESP8266 naming (eg D6, D4) for ESP32 we need to have GPIO number. But this is easy to fix. I find additional part which prevent code to work. In function void GetWeather() is table declaration char weather_Url; where DEFAULT_WEATHER_URL is copied form EPPROM. But DEFAULT_WEATHER_URL is 25 chars long and event 40 chars declared in Define.h!
I’ve uploaded all my changes (most of them are DEBUG_PRINTs allowing me understand code) to my GitHub branch (pins.h is there too, my HW config is ESP32 + 2xPCF8574 + SSD1306OLED + RTC + I2C (SDA 26, SDL 25)) https://github.com/JaCharer/Esp32-Sprinkler/tree/Working-conde-v1 – can you please take a look on it
Now code, let say try to work, behave very unstable and unpredictable. Hangs very often in random times. I will upload some logs later and this may help find where problem is. For me all this b0 6 something are totally unknown 🙁
I do not this this is problem of dev environment (Visual studio versus Arduino IDE), so eider we do have different libraries? can you please share yours, or published code is not final one as maintained.
BDW and this is very strange as strcpy_P and strcat_P sims to crash code, change to strcpy or strcat fix problem. Additional fight i had whit I2C. Wire.begin() without SDA and SDL in i2crtc.cpp, PCF8574Mio.cpp and even Adafruit_SSD1306.cpp do not allows proper I2C initialization. Explicit I2C pin declaration in Wire.begin(SDA_PIN,SDL_PIN) make my LCD working.September 7, 2017 at 2:34 pm #47616
Thanks for your great work!
I have been out for a couple of week and for some reason I don’t get email notices of your posts!
I have found the same 2 bugs you have found and I have fixed those in my local code but not in the GitHub .
I will have a look to your GitHub code and your HW setup,I think it should be almost identical to mine.
When you say that the code is unstable and hang randomly, I would like to understand what you really mean :
It is during a web request , the code doesn’t reply ?
Or the Esp32 hang and you have to reset it?
The Esp32 library code is far from beeing fully tested and it is not reliable as the Esp8266 core library.
In theory the code running on Esp8266 using libraries ported to Esp32 should run on Esp32 with no changes, but this in not always true!
In particular all this PROGMEM related statements that are meaningless for Esp32 where accepted onEsp8266 but may cause problems on Esp32.
If you give me more details on your failures or hangs at run time I will try to do some test and to understand possible reasons.September 8, 2017 at 10:59 am #47630
After changing I2C pins to 5,4 (from 26,25) all seems to work perfectly and much much faster then on ESP8266. Why changing pins made a different I din’t know 🙁 I was trying to find anything in doc and forums but without success. Maybe this is related to my chip OLED build in esp32 development board.
Anyway. Now everything works maybe except logs, circle is spinning and spinning without any results. In debug info is also one error “wtopts.txt does not exist” this is related to weather options file but after changing API key weather is shown correctly. Another issue may by whit NTP synchronization. During startup looks like NTP client try connect several times but whit unknown result. I need to investigate this.
So to any interested. Looks like OpenSprinkler works on ESP32 (whit some limitation) Paolo great work !!!
BTW. Have you seen this https://github.com/zhouhan0126/WIFIMANAGER-ESP32 looks like WiFiManager is ported on ESP32 already.
Attachments:September 8, 2017 at 12:44 pm #47632
The error was to use 25 26 ….. I should have told you: the reasons is clear since on Esp8266 Max n. Of GPio is =16 in my code for all pin above 16 are redirected to expanders …..I have to change that ….but from the time beeing use GPio <16.
Regarding the other points I would like to keep interacting with you and try to fix all other bugs, some it is common to the Esp8266 version like the one relative to NPT time …it work but after several trials!
Esp32 library are progressing fast and I have to catch up with WiFiManager this is important I will do it next week.
Regarding logs it should work …. Check if log files are generated on Spiffs , if they are there logs normally work!
Thanks for all your contributions and …..keep in touch!September 18, 2017 at 8:52 am #47765
Thanks for the wonderful contributions! I’ve been keeping an eye on ESP32 — it’s a power horse, with dual processors, but at the moment I’ve decided that it’s more than what OpenSprinkler needs, so I will keep it as an option for the future.
- You must be logged in to reply to this topic.
OpenSprinkler › Forums › Comments, Suggestions, Requests › OpenSprinkler on ESP32