OpenSprinkler Forums Comments, Suggestions, Requests OpenSprinkler on ESP32

  • This topic has 8 replies, 3 voices, and was last updated 5 years ago by Ray.
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #47435

    pbecchi
    Participant

    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!

    #47469

    ja.charer
    Participant

    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 ?

    EDIT:
    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:
    #47513

    pbecchi
    Participant

    Hi
    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!
    Paolo

    #47563

    ja.charer
    Participant

    Hi again,
    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

    Regards
    Charer

    #47598

    ja.charer
    Participant

    Hi Paolo
    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[15]; 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.

    #47616

    pbecchi
    Participant

    Hi Charger
    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.

    #47630

    ja.charer
    Participant

    Success !!!

    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:
    #47632

    pbecchi
    Participant

    Yes
    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!

    #47765

    Ray
    Keymaster

    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.

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.

OpenSprinkler Forums Comments, Suggestions, Requests OpenSprinkler on ESP32