chunkysteveo / OctoPrintAPI

Library for use with Arduino compatible micro controllers (web enabled) to access the Octoprint API on Raspberry Pi's running the Octoprint 3D printer web server by the brilliant Gina Häußge, aka @foosel.
GNU General Public License v2.0
42 stars 24 forks source link

Work on removing ESP8266HTTPClient for regular client #3

Closed witnessmenow closed 6 years ago

witnessmenow commented 6 years ago

Steve, don't merge yet! Still a WIP

chunkysteveo commented 6 years ago

Great updates Brian, very informative and worthwhile implementing at this stage and switching to the standard clients. Like the debug flags too - saves me un-commenting and commenting as I release updates!

Agree point about IP - I connect to my printer locally, and when at work, so it uses a host name and custom port - so the host will need to be able to be either an IP address, or string host name.

witnessmenow commented 6 years ago

Have updated the PR @chunkysteveo , probably still needs some work though (need to fix the other example for the ESP8266, and need to add that same example for ESP32)

I have put in a solution for using a URL or an IP address, I'm not sure if there is any other way around this, maybe there is a way to convert the string into an IP address, I'm not too sure. Note: I have not tested the URL way as I don't have Url setup for my Octoprint server. (I have tested that it fails to connect :) )

Here is the basic example running on an ESP32, I've added that example into the PR too octoprintesp32

chunkysteveo commented 6 years ago

Many thanks Brian. Will take a look in the morning and merge. I can test the url version. I am sure i saw a script that split an IP string into IP, I may look around too.

Thanks again.

Steve

witnessmenow commented 6 years ago

As far as I know its a generic arduino class, same as client. It worked OK for me on the esp32 and you see it in examples using the Ethernet shield too

On 14 Feb 2018 10:21, "Stephen Ludgate" notifications@github.com wrote:

@chunkysteveo commented on this pull request.

Isn't "IPAddress" an ESP8266 only class?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/chunkysteveo/OctoPrintAPI/pull/3#pullrequestreview-96446072, or mute the thread https://github.com/notifications/unsubscribe-auth/ABfXwsNfbL0gwKZ0-aKYivlEF5-AnQ-Rks5tUrO-gaJpZM4SC_yz .

chunkysteveo commented 6 years ago

OK great. I did look up some examples of converting an IP String to an IP address and checking this with "fromString", but people have said this expands your source so much it won't fit on an UNO using the String class. I think your solution of having two checks to see if it connects with IP and then host works well! :)

witnessmenow commented 6 years ago

Cool!

I'll try get am example of the uno added this week, Wednesday is "date night" for us so strictly no arduino stuff allowed , so it won't be today!

I do have my doubts about it running on an uno (the memory required for arduino json is quite high) but we'll see!

On 14 Feb 2018 10:43, "Stephen Ludgate" notifications@github.com wrote:

OK great. I did look up some examples of converting an IP String to an IP address and checking this with "fromString", but people have said this expands your source so much it won't fit on an UNO using the String class. I think your solution of having two checks to see if it connects with IP and then host works well! :)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/chunkysteveo/OctoPrintAPI/pull/3#issuecomment-365564567, or mute the thread https://github.com/notifications/unsubscribe-auth/ABfXwpyIjcqJLC20wDOD04Y7x1SQ-Jf2ks5tUrjlgaJpZM4SC_yz .

chunkysteveo commented 6 years ago

ppfftt... date night, what is it - some kind of special "love day"??! ...oh wait!!

I was looking to buy one of the Ethernet boards (not a shield) to add to an UNO to see how well it worked, if at all. After getting an issue raised about connecting in a secure network (University), I did think about possible industrial and commercial uses where WiFi is a no-go, so Ethernet may be pretty useful to some... may be...!? But like you said - UNO is limited, but there may be other Arduino boards that work well, such as a MEGA and LAN port.

That would be cool though if you have an UNO and Ethernet. Thumbs up!

I will add in these changes, thanks!