khoih-prog / Ethernet_Manager

Simple Ethernet Manager for Teensy, SAM DUE, SAMD21, SAMD51, nRF52, ESP32, ESP8266, etc. boards, with or without SSL, configuration data saved in ESP8266 LittleFS, SPIFFS, nRF52 LittleFS/InternalFS, EEPROM, DueFlashStorage or SAMD FlashStorage.
MIT License
15 stars 3 forks source link

More simpel way off adding the ethernetmanager to my code #1

Closed dyrvigk closed 3 years ago

dyrvigk commented 3 years ago

Hi Khoih

sorry to ask what maby a stupid question but i am not a very good code writer and i have made some code for reading some modbus registers and post them as mqtt it si running on a esp32 i used to use wifi and wifimanager and wifimanager is not so dificult to add but now i have made my code with w5500 ethernet due to instability on wifi and would like to be able to setup my mqtt credencials like in wifimanager and i found your ethernet manager but to dificult for me to add to my code to many if for all kind off mcu is there a simpel way off just adding it similar to wifimanager my ethernet is already running i actualy only need to setup mqtt server mqtt user and mqtt password mqtt port right now i am doing hardcoded w5500nilan.zip

i have added my code

khoih-prog commented 3 years ago

Thanks for your interests in the library which is a good choice for your use case.

I wish I had all the time in the world to help everybody, but in reality I don't have, So I'm sorry I can't spend time to help you to write the code.

This library is so simple to use, just have a look at the very similar examples to your case MQTT_ThingStream_Ethernet_Generic, and I think you can figure out how to modify your code by yourself.

If not successful, I suggest you ask for help from a forum or a professional code writer.

Good Luck,

dyrvigk commented 3 years ago

Ok Thanks for your response I will try to figure it out and see if I can get it simplied alittel

Kenn

man. 15. feb. 2021 22.25 skrev Khoi Hoang notifications@github.com:

Thanks for your interests in the library which is a good choice for your use case.

I wish I had all the time in the world to help everybody, but in reality I don't have, So I'm sorry I can't spend time to help you to write the code.

This library is so simple to use, just have a look at the very similar examples to your case MQTT_ThingStream_Ethernet_Generic https://github.com/khoih-prog/Ethernet_Manager/tree/main/examples/MQTT_ThingStream_Ethernet_Generic, and I think you can figure out how to modify your code by yourself.

If not successful, I suggest you ask for help from a forum or a professional code writer.

Good Luck,

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/khoih-prog/Ethernet_Manager/issues/1#issuecomment-779454467, or unsubscribe https://github.com/notifications/unsubscribe-auth/AG7RHTDX2WEIWU6BJPTIYODS7GGMBANCNFSM4XVGE3RQ .

dyrvigk commented 3 years ago

Hi Khoih

i am back asking for a littel help i have gotten my code implemented in your exampel code and i also have gotten it to compile but unfortnatly the esp just reboots all the time with some exception or do you have any idea who could help me

best regards kenn

khoih-prog commented 3 years ago

First, try to post the whole code and ask for help in Arduino Forum's Programming Questions where there are many good experts ready to help you out.

Finally, if you try without success, you can post the whole code here so I'll try to find the time to help.

Good Luck,

dyrvigk commented 3 years ago

Hi Khoih

thanks i have posted it on forum as you asked first response was that probably is because of last library installed ESP_doubleresetdetector was the last but if i compile just your example it runs if i compile just mine it runs but together i compiles but dont run so if you have 5 min to tell me if it is done totally wrong sorry to bather you with my ignorance i dont know much about coding got started in a late age but you have to learn as long as you live

i have attached the my code with ethernet thats is working but no ethernet manager and my code in your example ethernet_generic that gives this exception

Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled. Core 1 register dump: PC : 0x400d6689 PS : 0x00060f30 A0 : 0x800d7260 A1 : 0x3ffb1700 A2 : 0x3ffc0b70 A3 : 0x00000000 A4 : 0x0000075b A5 : 0x00000010 A6 : 0x00000011 A7 : 0x00000000 A8 : 0x800f58d4 A9 : 0x3ffb1f20 A10 : 0x00000000 A11 : 0x3ffb1f7c A12 : 0x00000003 A13 : 0x00000000 A14 : 0x00000000 A15 : 0x00000008 SAR : 0x00000020 EXCCAUSE: 0x0000001c EXCVADDR: 0x00000010 LBEG : 0x400dad7c LEND : 0x400dadde LCOUNT : 0x00000002

Backtrace: 0x400d6689:0x3ffb1700 0x400d725d:0x3ffb1720 0x400dc2d9:0x3ffb1fb0 0x40088215:0x3ffb1fd0

and the exeption decoder output

0x400d6689: Ethernet_Manager::run() at /home/kenn/Arduino/libraries/ESP_DoubleResetDetector/src/ESP_DoubleResetDetector.h line 184 0x400d725d: loop() at /home/kenn/Arduino/Ethernet_Generic_test/Ethernet_Generic_test.ino line 854 0x400dc2d9: loopTask(void*) at /home/kenn/.arduino15/packages/esp32/hardware/esp32/1.0.4/cores/esp32/main.cpp line 19 0x40088215: vPortTaskWrapper at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/port.c line 143

manny thanks in advance best regards kenn

Em dom., 23 de mai. de 2021 às 23:35, Khoi Hoang @.***> escreveu:

First, try to post the whole code and ask for help in Arduino Forum's Programming Questions https://forum.arduino.cc/c/using-arduino/programming-questions/20 where there are many good experts ready to help you out.

Finally, if you try without success, you can post the whole code here so I'll try to find the time to help.

Good Luck,

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/khoih-prog/Ethernet_Manager/issues/1#issuecomment-846627749, or unsubscribe https://github.com/notifications/unsubscribe-auth/AG7RHTADXWZO6PAYVKUKJ53TPFYJTANCNFSM4XVGE3RQ .

khoih-prog commented 3 years ago

HI,

I'm sorry I can't help you anything here.

I already tried to look at the code you post here as well as in Arduino Forum and even can't compile as well as understand anything there.

I estimate anybody working on your code must spend weeks to figure out, not 5 minutes as you expect. And not everybody has the same settings as you have.

I suggest that you start with a simple working example. Then add more code gradually, then test to see if OK, and moving forward, small steps by small steps.

If you still can't figure out, I suggest you hire some professional coder to write for you.

Good Luck,

dyrvigk commented 3 years ago

ok thanks anyway is there a way to use just the ethernetmanager likewith wifimanager without all the ethernet code since i already have that part running

kenn

Em seg., 24 de mai. de 2021 às 22:07, Khoi Hoang @.***> escreveu:

HI,

I'm sorry I can't help you anything here.

I already tried to look at the code you post here as well as in Arduino Forum https://forum.arduino.cc/t/esp32-with-ethernet-manager-and-mqtt-and-modbus/866069 and even can't compile as well as understand anything there.

I estimate anybody working on your code must spend weeks to figure out, not 5 minutes as you expect. And not everybody has the same settings as you have.

I suggest that you start with a simple working example. Then add more code gradually, then test to see if OK, and moving forward, small steps by small steps.

If you still can't figure out, I suggest you hire some professional coder to write for you.

Good Luck,

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/khoih-prog/Ethernet_Manager/issues/1#issuecomment-847301866, or unsubscribe https://github.com/notifications/unsubscribe-auth/AG7RHTG7NXD65MI4C4CNNPLTPKWXFANCNFSM4XVGE3RQ .

khoih-prog commented 3 years ago

is there a way to use just the ethernetmanager likewith wifimanager without all the ethernet code since i already have that part running

Yes. The example is written for too many kind of general Ethernet shields and boards. You just remove whatever not applicable to you to simplify the example when you know what Ethernet/board you're using.

dyrvigk commented 3 years ago

ok i am using esp32 and ethernet2

kenn

Em seg., 24 de mai. de 2021 às 22:56, Khoi Hoang @.***> escreveu:

is there a way to use just the ethernetmanager likewith wifimanager without all the ethernet code since i already have that part running

Yes. The example is written for too many kind of general Ethernet shields and boards. You just remove whatever not applicable to you to simplify the example when you know what Ethernet/board you're using.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/khoih-prog/Ethernet_Manager/issues/1#issuecomment-847328580, or unsubscribe https://github.com/notifications/unsubscribe-auth/AG7RHTBB4MZIKHXRLJ3HBJ3TPK4QJANCNFSM4XVGE3RQ .

khoih-prog commented 3 years ago

You have to do it by yourself, step by step through the target example. Sorry.

dyrvigk commented 3 years ago

Khoih

hi again sorry to bather you but maby you know how to fix this small problem i have i would like to use wifi and ethernet on esp32 but it is not possible because off server.h

* Server.h - Base class that provides Server Copyright (c) 2011 Adrian McEwen. All right reserved.

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */

ifndef server_h

define server_h

include "Print.h"

class Server: public Print { public: //virtual void begin(uint16_t port=0) =0; //wifi will only compile wifi with this setting virtual void begin() =0; //ethernet will only compile with this setting };

endif

i tryed on google and manny forums but no solution

kenn

Em seg., 24 de mai. de 2021 às 23:00, Khoi Hoang @.***> escreveu:

You have to do it by yourself, step by step through the target example. Sorry.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/khoih-prog/Ethernet_Manager/issues/1#issuecomment-847330788, or unsubscribe https://github.com/notifications/unsubscribe-auth/AG7RHTAXG3W64B5ATQ7NTSTTPK5ALANCNFSM4XVGE3RQ .

khoih-prog commented 3 years ago

Did you have a look at and try this For fixing ESP32 compile error


7. For fixing ESP32 compile error

To fix ESP32 compile error, just copy the following file into the ESP32 cores/esp32 directory (e.g. ./arduino-1.8.12/hardware/espressif/cores/esp32) to overwrite the old file:

dyrvigk commented 3 years ago

yes i did that but how do i get both options possible because with that change wifi wil not compile because uses same server.h

kenn

Em ter., 25 de mai. de 2021 às 16:43, Khoi Hoang @.***> escreveu:

Did you have a look at and try this For fixing ESP32 compile error https://github.com/khoih-prog/Ethernet_Manager#7-for-fixing-esp32-compile-error

  1. For fixing ESP32 compile error

To fix ESP32 compile error https://github.com/espressif/arduino-esp32, just copy the following file into the ESP32 https://github.com/espressif/arduino-esp32 cores/esp32 directory (e.g. ./arduino-1.8.12/hardware/espressif/cores/esp32) to overwrite the old file:

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/khoih-prog/Ethernet_Manager/issues/1#issuecomment-847929781, or unsubscribe https://github.com/notifications/unsubscribe-auth/AG7RHTGZX3IUJK6FMM256QDTPOZSXANCNFSM4XVGE3RQ .

khoih-prog commented 3 years ago

Post a MRE code here as well as on ESP32 forum to ask for help. Nobody can have a crystal ball good enough to guess and help you unless you post your MRE code.

If not, please work and solve the issue yourself.

Why don't you go back to a simplest working code, then move forward? Compile for both WiFi + Ethernet on ESP32 is not new.

dyrvigk commented 3 years ago

Hi Khoih

If compiling for both wifi and ethernet w5500 is not new could you please point me to a example because i have had trouble finding it

ETHERNET compile error when server.h is set for wifi

In file included from C:\Users\dyrvi\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4\cores\esp32/Arduino.h:152:0, from sketch\w5500nilan.ino.cpp:1: C:\Users\dyrvi\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4\cores\esp32/Server.h:28:18: note: virtual void Server::begin(uint16_t) virtual void begin(uint16_t port=0) =0; ^ exit status 1 cannot declare variable 'server' to be of abstract type 'EthernetServer'

WIFI compile error when server.h is set for ethernet

C:\Users\dyrvi\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4\cores\esp32/Server.h:28:18: note: virtual void Server::begin() virtual void begin() =0; ^ exit status 1 cannot declare variable 'server' to be of abstract type 'WiFiServer'

but thanks in advance i will not bother you anymore i will post on arduino forum my problem i dont know what is MRE code thats why

best regards

kenn

Em ter., 25 de mai. de 2021 às 17:11, Khoi Hoang @.***> escreveu:

Post a MRE code https://stackoverflow.com/help/minimal-reproducible-example here as well as on ESP32 forum to ask for help. Nobody can have a crystal ball good enough to guess and help you unless you post your MRE code.

If not, please work and solve the issue yourself.

Why don't you go back to a simplest working code, then move forward? Compile for both WiFi + Ethernet on ESP32 is not new.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/khoih-prog/Ethernet_Manager/issues/1#issuecomment-847946043, or unsubscribe https://github.com/notifications/unsubscribe-auth/AG7RHTFO3PFJQIDA57Y5SBLTPO42ZANCNFSM4XVGE3RQ .

dyrvigk commented 3 years ago

Hi Khoih

just a small update i finally found the solution using wifimanager to setup my mqtt credentials and using ethernet for the connection to mqtt server after long time looking i found this workaround for the server.h file /* Server.h - Base class that provides Server Copyright (c) 2011 Adrian McEwen. All right reserved.

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */

ifndef server_h

define server_h

include "Print.h"

class Server: public Print { public: void begin(uint16_t port = 0) {}; void begin() {}; };

endif

thanks for your time and for the push to look more unfortnatly the ethernet manager or some other libary needed is nor compatibel with my code or some off the libaryies needed

kenn

Em ter., 25 de mai. de 2021 às 17:34, kenn dyrvig @.***> escreveu:

Hi Khoih

If compiling for both wifi and ethernet w5500 is not new could you please point me to a example because i have had trouble finding it

ETHERNET compile error when server.h is set for wifi

In file included from C:\Users\dyrvi\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4\cores\esp32/Arduino.h:152:0, from sketch\w5500nilan.ino.cpp:1: C:\Users\dyrvi\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4\cores\esp32/Server.h:28:18: note: virtual void Server::begin(uint16_t) virtual void begin(uint16_t port=0) =0; ^ exit status 1 cannot declare variable 'server' to be of abstract type 'EthernetServer'

WIFI compile error when server.h is set for ethernet

C:\Users\dyrvi\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4\cores\esp32/Server.h:28:18: note: virtual void Server::begin() virtual void begin() =0; ^ exit status 1 cannot declare variable 'server' to be of abstract type 'WiFiServer'

but thanks in advance i will not bother you anymore i will post on arduino forum my problem i dont know what is MRE code thats why

best regards

kenn

Em ter., 25 de mai. de 2021 às 17:11, Khoi Hoang @.***> escreveu:

Post a MRE code https://stackoverflow.com/help/minimal-reproducible-example here as well as on ESP32 forum to ask for help. Nobody can have a crystal ball good enough to guess and help you unless you post your MRE code.

If not, please work and solve the issue yourself.

Why don't you go back to a simplest working code, then move forward? Compile for both WiFi + Ethernet on ESP32 is not new.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/khoih-prog/Ethernet_Manager/issues/1#issuecomment-847946043, or unsubscribe https://github.com/notifications/unsubscribe-auth/AG7RHTFO3PFJQIDA57Y5SBLTPO42ZANCNFSM4XVGE3RQ .

khoih-prog commented 3 years ago

That's good. But you waste your time by not looking at the link I gave you


7. For fixing ESP32 compile error

To fix ESP32 compile error, just copy the following file into the ESP32 cores/esp32 directory (e.g. ./arduino-1.8.12/hardware/espressif/cores/esp32) to overwrite the old file:

#ifndef server_h
#define server_h

#include "Print.h"

class Server: public Print
{
public:
    // KH, change to fix compiler error for EthernetWebServer
    // error: cannot declare field 'EthernetWebServer::_server' to be of abstract type 'EthernetServer'
    // virtual void begin(uint16_t port=0) =0;
    //virtual void begin() = 0;
    void begin() {};
};

#endif
khoih-prog commented 3 years ago

Another hint for you.

WiFi and Ethernet Bridge? #26

dyrvigk commented 3 years ago

actualy i did look at your file i even put it in but i had to add this line to get my code to compile

void begin(uint16_t port = 0) {};

i am not making a bridge just using wifimanager for setting my mqtt credentials via wifi ap

kenn

Em ter., 25 de mai. de 2021 às 19:45, Khoi Hoang @.***> escreveu:

That's good. But you waste your time by not looking at the link I gave you

ifndef server_h#define server_h

include "Print.h"

class Server: public Print{public: // KH, change to fix compiler error for EthernetWebServer // error: cannot declare field 'EthernetWebServer::_server' to be of abstract type 'EthernetServer' // virtual void begin(uint16_t port=0) =0; //virtual void begin() = 0; void begin() {};};

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/khoih-prog/Ethernet_Manager/issues/1#issuecomment-848082853, or unsubscribe https://github.com/notifications/unsubscribe-auth/AG7RHTEBHJI7GR2S7OXKEVTTPPOZXANCNFSM4XVGE3RQ .