-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ESP32 support and easy import as library #118
Conversation
One addition: btw.: Can it be configured from the main.cpp, so i don't have to login, set wifi etc.? |
In PlatformIO, when you have the PlatformIO menu up (click the alien head), there is an option to "Erase Flash". That erases the program, but not the wifi credentials. (I think.) In order to erase the wifi credentials, you bring up the ESP by typing its IP address into a browser, then choose "Reset Device."
No, but once the ESP boots up, if it has no wifi credentials, it will broadcast a wifi SSID called "Configure sensesp". Connect to it from your phone or computer, then go to 192.168.4.1 and enter your wifi name and password, and name your device (like "ESP_GPS"). When you save it, and it connects, you shouldn't ever have to do that again. |
After your previous PR to add some libraries to So your modifications to |
The way I do it is directly in the terminal with this command "pio run -t erase" (the -t is for target) |
Ok, thanks for the answers. I erased my esp32 chip and flashed again. But i do not get any of the data after this in the signalk server.
|
In my case, as soon as the the security access request is approved, I immediately start seeing the data in Instrument Panel. When you approved the security request, did you change the permissions from the default "read only" to "read/write"? In the Server UI, go to Security - Devices and you can check the Permissions for each device. |
Yes, i activated security level read & write. |
@gzahl - I have not yet tested THIS Pull Request at all. I did test PR #115 with a Wemos D1 Mini ESP8266, and it compiled and uploaded my four different projects (4 different ESP8266's around my boat), and they're all running that version now. Before I do any testing on this PR, I want to test #115 with at least one of my ESP32's. |
I only have problems with my ESP32. @loopsmark tested #115 with his ESP32 as i understand. I have to check for differencees again. |
I have made one fix to my PR and now it works fine with my ESP32 and my ESP8266. |
There still seems to be a problem. Sometimes it works without problems, but sometimes and then after every reboot my esp32 crashes directly after connecting to the wifi. It still manages to get some data through to signalk. Backtrace: 0x401b7402:0x3ffb1ea0 0x401691f7:0x3ffb1ec0 0x400d96e3:0x3ffb1ee0 0x400d1fab:0x3ffb1f00 0x400d21c0:0x3ffb1f20 0x400d20bd:0x3ffb1f50 0x400d20dd:0x3ffb1f70 0x400d20ed:0x3ffb1f90 0x400de009:0x3ffb1fb0 0x40088f69:0x3ffb1fd0 Rebooting...` |
Sorry - I've been at sea for 72 hours, just now seeing this. I should be able to provide a better comment later today. |
@gzahl - I'm not much good at reading a stack trace, but the second-to-last line says
Does that mean that the problem came from line 19 of your main.cpp? If so - what is that line doing? |
Hi, no problem, i had not much time myself, but our sailing vessel is now afloat :). edit: After updating platformio and some libraries everything worked smooth this evening. I guess i will go on developing and see if the issue comes back. Otherwise it might have been fixed in the update. |
Didn't work for me. I'm using the GEEEKNET32 ESP32 v1.04 board that uses the WROOM-32 chip (https://www.seeedstudio.com/GeeekNET-ESP32-Development-Board-p-2945.html). The board I'm using in PlatformIO is esp32dev, which was suggested on the PIO forum for any board not specifically defined that uses the WROOM-32 chip.
I was able to get the captive portal, configure my wifi credentials, give the ESP32 a hostname, then it restarted and connected to my wifi, and enabled all sensors and transforms. But then it shows "Initiating connection" (which is at line 115 in ws_client.cpp)
And then, I get this:
and then it keeps going through the above over and over. I have your latest code, so in library.json is this:
which is what you recently changed that fixed your problem. But it doesn't fix mine. Now what? Any ideas? |
Hi, it does also still crash for me. But it does some crash->reboot->crash->reboot->.. etc and sometimes doesn't crash when initiating the connection and then it works. Of course we have to sort this out... |
At this page (https://github.com/me-no-dev/EspExceptionDecoder/blob/master/src/EspExceptionDecoder.java), I find that "LoadProhibited" means "A load referenced a page mapped with an attribute that does not permit loads". But that doesn't mean anything to me. I'm still trying to track this down, but I'm pretty sure it has to do with |
It seems to work for me, if i don't actually load/use any sensors. So only calling |
I finally got past the errors, but I'm not sure what caused them. Initially, my SK Server wasn't actually ready for sensors to connect to it, so while SensESP was waiting for mDNS, it would fail and restart, over and over. When I restarted SK Server, then it got past the mDNS problem, and then it submitted a request for security authorization. Since it was waiting for the request to be approved (on the Server), it kept failing and restarting. When I approved it on the Server, then it worked - started sending data to the Server. I'm using the AnalogInput example (which had to be modified to allow a different input pin, since ESP32 has more than one AnalogIn), and it's reading values on pin 34 (one of the pins that can be used with AnalogRead), and it's working fine. So - it seems that in at least some cases, when waiting for the SK Server to reply to something, it fails and restarts, but I don't know why. Tomorrow I will try several other examples, and will connect actual sensors for as many of them as I can. |
I've been able to compile my three actual programs (the ones I use on my boat), and most of the ones in /examples. (The ones that don't compile are missing files that are specific to the example, and I haven't tried to resolve those.) My three actual programs run on the ESP32 I have (GEEEKNET32 ESP32 v1.04, and use One of my actual programs uses 1-Wire temp sensors, and the sensors are NOT recognized. However, running a simple Sketch from the Arduino IDE that's supposed to find the addresses of 1-Wire sensors doesn't work on my ESP32, either. So I can't blame ESP for that. I want to test my three actual ESP8266's with this code next. |
1-Wire update: I found this (below), that suggested some ESP32's don't work with the DallasTemperature::getDeviceCount(), always returning 0, but that the sensors are recognized and temps can be retrieved the normal way. So I hardcoded Or maybe take this approach - another way to count sensors that should work with ESP8266 and ESP32: milesburton/Arduino-Temperature-Control-Library#141 |
I found out that a change to the OneWire library (sometime after v 2.3.3) broke the DallasTemperature::getDeviceCount() method for ESP32. So I'll just redo how sensors are registered that won't rely on that method. |
I've tested this PR with an ESP32 with some actual sensors, connecting to the SK Server and sending data properly (displays in Instrument Panel). I've tested it with my three "installed on the boat" Wemos D1 Mini's, getting data from DigitalInputValue, AnalogInput, OneWire, ADS1115 ADC, and DigitalInputCounter. I see no change in behavior, so I'm going to merge this, and then fix a small number of issues I found with the ESP32, in another PR. |
I was working in parallel to @loopsmark on ESP32 support. The code changes are very similar, but i still post my work, since it differs in two import points:
As an example you can look at https://github.com/gzahl/SensGPS, which compiles for ESP8226 and ESP32 from the same sources. Both only depend explicitly on https://github.com/gzahl/SensESP#esp32
Please feel free to pull either my work or @loopsmark work. But it would be really nice to be able to simply import the upstream version of SensESP into new projects.
On a sidenode: