Skip to content
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

does not compile under arduino 1.0 IDE #7

Closed
jmr13031 opened this issue Dec 18, 2011 · 27 comments
Closed

does not compile under arduino 1.0 IDE #7

jmr13031 opened this issue Dec 18, 2011 · 27 comments

Comments

@jmr13031
Copy link
Contributor

WProgram.h needs to be arduino.h in the 1.0 IDE, Needs something like this in _Spi.h ...

if defined(ARDUINO) && ARDUINO >= 100

include "Arduino.h"

else

include "WProgram.h"

endif

And for some reason, the overloads of "write" function are not working....

In file included from C:\arduino-1.0\libraries\WiFly/WiFly.h:4,
from WiFly_WebServer.cpp:9:
C:\arduino-1.0\libraries\WiFly/SpiUart.h:62: error: conflicting return type specified for 'virtual void SpiUartDevice::write(byte)'
C:\arduino-1.0\hardware\arduino\cores\arduino/Print.h:48: error: overriding 'virtual size_t Print::write(uint8_t)'
In file included from C:\arduino-1.0\libraries\WiFly/WiFly.h:8,
from WiFly_WebServer.cpp:9:
C:\arduino-1.0\libraries\WiFly/Client.h:21: error: conflicting return type specified for 'virtual void Client::write(byte)'
C:\arduino-1.0\hardware\arduino\cores\arduino/Print.h:48: error: overriding 'virtual size_t Print::write(uint8_t)'
C:\arduino-1.0\libraries\WiFly/Client.h:23: error: conflicting return type specified for 'virtual void Client::write(const uint8_t_, size_t)'
C:\arduino-1.0\hardware\arduino\cores\arduino/Print.h:50: error: overriding 'virtual size_t Print::write(const uint8_t_, size_t)'

@jmr13031
Copy link
Contributor Author

Ok, It looks like where you do a void write you need to replace it with a size_t write.
Also it looks like the .print(var,BYTE); needs to be replace with a .write(var); BYTE is not supported in 1.0.

@jmr13031
Copy link
Contributor Author

I got the WiFly_Webserver running on my 1.0 wifly board. How does one go about sending the changes to the group?
;-)

@DrGenetik
Copy link
Contributor

The usual process is to fork WiFly-Shield, make your changes to your fork, and then make a pull request. The pull request indicates that you want the maintainer of the WiFly-Shield to review your code and merge your branch from your fork into this fork. Btw, it's good practice to make a branch in your fork and have the changes for just this issue in that branch. Then issue the pull request for this branch into the parent's master and I think you can reference this issue in the pull request. Makes sense?

@jmr13031
Copy link
Contributor Author

@genetikayos,
Seeing that I am new to making changes to a git repo. I have cloned the tree, but I am confused on if I do a branch at this point. Guess it's time to "RTFM"
;-)

@DrGenetik
Copy link
Contributor

I suggest that, instead of cloning this project's tree, you first do project fork in github and then git clone your new fork. That will allow you to upload branches to your own fork and make a pull request from your fork to the parent project.

@DrGenetik
Copy link
Contributor

You know, on second thought, if your changes aren't extensive, just post a patch. The process I was suggesting is really more if you decide to be a regular contributor and contribute extensive changes over time. If your changes are simple, a patch is easy.

@jmr13031
Copy link
Contributor Author

I have the patch file, but I seem to be running into a timing issue in
the SpiUartDevice::available() function. Under Arduino 0.22 it works
fine on my boards. But when I load it under Arduino 1.0 I never see
the OPEN. When I put a Serial.print(readRegister(RXLVL)); above the
return. I seems to start to work.
I am going to hold on the patch file until I dig a little deeper. Time
to read the data sheet on the uart.....

On a side note, the shield will not work on a MEGA due to pin changes
(newbie issue on my part).

"On the Arduino Duemilanove and other ATmega168 / 328-based boards,
the SPI bus uses pins 10 (SS), 11 (MOSI), 12 (MISO), and 13 (SCK). On
the Arduino Mega, this is 50 (MISO), 51 (MOSI), 52 (SCK), and 53
(SS)."
-James

@rob100
Copy link

rob100 commented Jan 9, 2012

Any news about this?
I'm trying to convert my current project to 1.0 and everything except the wifly library works fine. I would be really great if you update the library to 1.0 compatibility.

@perezd
Copy link

perezd commented Feb 9, 2012

+1 on this

@krohling
Copy link

Yet another +1

@jmr13031
Copy link
Contributor Author

Been away from my arduino for a while. I will try to put together a patch. I hear your +1's ;-)
-James

@krohling
Copy link

I will send you beer :)

@DrGenetik
Copy link
Contributor

Yeah, I've been away from this and busy with life for a long while, too.

@jmr13031
Copy link
Contributor Author

Ok,
Here is the "VERY" early version of my patch. Please try it out and let me know issues that you are having.......
Tried to push the patch but the git server declined me so sorry for the long post.....
James

new file mode 100644
@@ -0,0 +1,272 @@
+From 1113203d3be429524e6390c0cb381191184a2b1f Mon Sep 17 00:00:00 2001
+From: unknown jmr13031@gmail.com
+Date: Wed, 21 Dec 2011 09:10:49 -0500
+Subject: [PATCH] Changes for the Arduino 1.0 library interface changes.

  • Changes for the .print BYTE to .write in the new IDE
    +
    +---
  • src/WiFly/Client.cpp | 24 ++++++++++++++--
  • src/WiFly/Client.h | 6 ++++
  • src/WiFly/SpiUart.cpp | 29 ++++++++++++++++---
  • src/WiFly/SpiUart.h | 12 +++++++-
  • src/WiFly/_Spi.h | 4 +++
  • .../HardwareFactoryReset/HardwareFactoryReset.pde | 14 +++++++++-
  • .../tools/SpiUartTerminal/SpiUartTerminal.pde | 8 +++++
  • 7 files changed, 87 insertions(+), 10 deletions(-)
    +
    +diff --git a/src/WiFly/Client.cpp b/src/WiFly/Client.cpp
    +index 098e46c..b4f91b6 100644
    +--- a/src/WiFly/Client.cpp
    ++++ b/src/WiFly/Client.cpp
    +@@ -35,25 +35,43 @@ Client::Client(const char* domain, uint16_t port) :
  • isOpen = false;
  • }
  • +-
    ++#if ARDUINO >= 100
    ++size_t Client::write(byte value) {
    ++#else
  • void Client::write(byte value) {
    ++#endif
  • /*
  • */
  • _WiFly.uart.write(value);
    ++#if ARDUINO >= 100
    ++ return (0);
    ++#endif
  • }
  • +-
    ++#if ARDUINO >= 100
    ++size_t Client::write(const char *str) {
    ++#else
  • void Client::write(const char *str) {
    ++#endif
  • /*
  • */
  • _WiFly.uart.write(str);
    ++#if ARDUINO >= 100
    ++ return (0);
    ++#endif
  • }
  • +-
    ++#if ARDUINO >= 100
    ++size_t Client::write(const uint8_t *buffer, size_t size) {
    ++#else
  • void Client::write(const uint8_t *buffer, size_t size) {
    ++#endif
  • /*
  • */
  • _WiFly.uart.write(buffer, size);
    ++#if ARDUINO >= 100
    ++ return (0);
    ++#endif
  • }
  • +diff --git a/src/WiFly/Client.h b/src/WiFly/Client.h
    +index 898532e..d164054 100644
    +--- a/src/WiFly/Client.h
    ++++ b/src/WiFly/Client.h
    +@@ -18,9 +18,15 @@ class Client : public Print {
  • boolean connect();
  • ++#if ARDUINO >= 100
    ++ size_t write(byte value);
    ++ size_t write(const char *str);
    ++ size_t write(const uint8_t *buffer, size_t size);
    ++#else
  • void write(byte value);
  • void write(const char *str);
  • void write(const uint8_t *buffer, size_t size);
    ++#endif
  • int available();
  • int read();
    +diff --git a/src/WiFly/SpiUart.cpp b/src/WiFly/SpiUart.cpp
    +index 309481c..ceccd7e 100644
    +--- a/src/WiFly/SpiUart.cpp
    ++++ b/src/WiFly/SpiUart.cpp
    +@@ -166,8 +166,8 @@ byte SpiUartDevice::available() {
  • */
  • // This alternative just checks if there's data but doesn't
  • // return how many characters are in the buffer:
    +- // readRegister(LSR) & 0x01
    +- return readRegister(RXLVL);
    ++ // readRegister(LSR) & 0x01
    ++ return (readRegister(RXLVL));
  • }
  • +@@ -188,8 +188,11 @@ int SpiUartDevice::read() {
  • return readRegister(RHR);
  • }
  • +-
    ++#if ARDUINO >= 100
    ++size_t SpiUartDevice::write(byte value) {
    ++#else
  • void SpiUartDevice::write(byte value) {
    ++#endif
  • /*
  • Write byte to UART.
    
    +@@ -198,11 +201,17 @@ void SpiUartDevice::write(byte value) {
  • while (readRegister(TXLVL) == 0) {
  • // Wait for space in TX buffer
    
  • };
    +- writeRegister(THR, value);
    ++ writeRegister(THR, value);
    ++#if ARDUINO >= 100
    ++ return (0);
    ++#endif
  • }
  • +-
    ++#if ARDUINO >= 100
    ++size_t SpiUartDevice::write(const char *str) {
    ++#else
  • void SpiUartDevice::write(const char *str) {
    ++#endif
  • /*
  • Write string to UART.
    
    +@@ -213,10 +222,17 @@ void SpiUartDevice::write(const char *str) {
  • // Wait for empty TX buffer (slow)
    
  • // (But apparently still not slow enough to ensure delivery.)
    
  • };
    ++#if ARDUINO >= 100
    ++ return (0);
    ++#endif
  • }
  • #if ENABLE_BULK_TRANSFERS
    ++#if ARDUINO >= 100
    ++size_t SpiUartDevice::write(const uint8_t *buffer, size_t size) {
    ++#else
  • void SpiUartDevice::write(const uint8_t *buffer, size_t size) {
    ++#endif
  • /*
  • Write buffer to UART.
    
    +@@ -233,6 +249,9 @@ void SpiUartDevice::write(const uint8_t *buffer, size_t size) {
  • transfer_bulk(buffer, size);
  • deselect();
    ++#if ARDUINO >= 100
    ++ return (0);
    ++#endif
  • }
  • #endif
  • +diff --git a/src/WiFly/SpiUart.h b/src/WiFly/SpiUart.h
    +index f00388a..91678f2 100644
    +--- a/src/WiFly/SpiUart.h
    ++++ b/src/WiFly/SpiUart.h
    +@@ -59,6 +59,15 @@ class SpiUartDevice : public SpiDevice, public Print {
  • void begin(unsigned long baudrate = BAUD_RATE_DEFAULT);
    
  • byte available();
    
  • int read();
    
    ++#if ARDUINO >= 100
    ++ size_t write(byte value);
    ++ size_t write(const char *str);
    ++#if ENABLE_BULK_TRANSFERS
    ++ size_t write(const uint8_t *buffer, size_t size);
    ++#else
    ++ using Print::write;
    ++#endif
    ++#else
  • void write(byte value);
    
  • void write(const char *str);
    
  • #if ENABLE_BULK_TRANSFERS
    +@@ -66,7 +75,8 @@ class SpiUartDevice : public SpiDevice, public Print {
  • #else
  • using Print::write;
    
  • #endif
    +- void flush();
    ++#endif
    ++ void flush();
  • // These are specific to the SPI UART
    
  • void ioSetDirection(unsigned char bits);
    
    +diff --git a/src/WiFly/_Spi.h b/src/WiFly/_Spi.h
    +index 82eac05..1b71851 100644
    +--- a/src/WiFly/_Spi.h
    ++++ b/src/WiFly/_Spi.h
    +@@ -5,7 +5,11 @@
  • #ifndef _SPI_H
  • #define _SPI_H
  • ++#if ARDUINO >= 100
    ++#include <Arduino.h>
    ++#else
  • #include <WProgram.h>
    ++#endif
  • #include <pins_arduino.h>
  • +diff --git a/src/WiFly/examples/tools/HardwareFactoryReset/HardwareFactoryReset.pde b/src/WiFly/examples/tools/HardwareFactoryReset/HardwareFactoryReset.pde
    +index f9a8797..a9dbfeb 100644
    +--- a/src/WiFly/examples/tools/HardwareFactoryReset/HardwareFactoryReset.pde
    ++++ b/src/WiFly/examples/tools/HardwareFactoryReset/HardwareFactoryReset.pde
    +@@ -54,7 +54,11 @@ void readResponse(int timeOut = 0 /* millisecond */) {
  • int target = millis() + timeOut;
  • while((millis() < target) || SpiSerial.available() > 0) {
  • if (SpiSerial.available()) {
    
    ++#if ARDUINO >= 100
    ++ Serial.write(SpiSerial.read());
    ++#else
  •   Serial.print(SpiSerial.read(), BYTE);
    
    ++#endif
  • }
    
  • }
  • }
    +@@ -158,10 +162,18 @@ void loop() {
  • // but note that this makes the terminal unresponsive
  • // while a response is being received.
  • while(SpiSerial.available() > 0) {
    ++#if ARDUINO >= 100
    ++ Serial.write(SpiSerial.read());
    ++#else
  • Serial.print(SpiSerial.read(), BYTE);
    
    ++#endif
  • }
  • if(Serial.available()) { // Outgoing data
    ++#if ARDUINO >= 100
    ++ SpiSerial.write(Serial.read());
    ++#else
  • SpiSerial.print(Serial.read(), BYTE);
    
    ++#endif
  • }
    +-}
    ++}
    +\ No newline at end of file
    +diff --git a/src/WiFly/examples/tools/SpiUartTerminal/SpiUartTerminal.pde b/src/WiFly/examples/tools/SpiUartTerminal/SpiUartTerminal.pde
    +index abb928f..5fec0d9 100644
    +--- a/src/WiFly/examples/tools/SpiUartTerminal/SpiUartTerminal.pde
    ++++ b/src/WiFly/examples/tools/SpiUartTerminal/SpiUartTerminal.pde
    +@@ -45,10 +45,18 @@ void loop() {
  • // but note that this makes the terminal unresponsive
  • // while a response is being received.
  • while(SpiSerial.available() > 0) {
    ++#if ARDUINO >= 100
    ++ Serial.write(SpiSerial.read());
    ++#else
  • Serial.print(SpiSerial.read(), BYTE);
    
    ++#endif
  • }
  • if(Serial.available()) { // Outgoing data
    ++#if ARDUINO >= 100
    ++ SpiSerial.write(Serial.read());
    ++#else
  • SpiSerial.print(Serial.read(), BYTE);
    
    ++#endif
  • }
  • }
    +--
    +1.7.8.msysgit.0
    +

@jmr13031
Copy link
Contributor Author

My system is using a version 1 of the shield. I seem to be getting a problem where the SPI_UART is hanging on the incoming serial stream from the shield.
Let me know if people are seeing something like this with the newer versions of the shield. The odd part is works under the old Arudion IDE. I hope it is not something with the compiler.......
Oh well, Time to RTFM....... ;-)
James

@jmr13031
Copy link
Contributor Author

Ok,
It looks like a timing issue going on. To get the webserver example to work.
I had to change the function available() in SpiUart.cpp and add delay(2); It now seems to work ok on my system.

  • James

    delay(2);
    return (readRegister(RXLVL));

@jmr13031
Copy link
Contributor Author

Just did a fork of the git repo, you can find my changes under the jmr13031 fork.......
-James

@bobbrez
Copy link
Contributor

bobbrez commented Feb 23, 2012

I submitted a pull request that will resolve this issue. Its currently pending.

@silentbicycle
Copy link

@jmr13031 : Your fork is working for me, thanks!

@daneo
Copy link

daneo commented May 17, 2012

jmr13031 fork is working for me too! many thanks. sparkfun needs to pull this...

@bobbrez
Copy link
Contributor

bobbrez commented Jun 18, 2012

I appreciate that. I've tried contacting them, but its been a bit hard, but if you let their customer service know, that would probably help.

Bob Breznak
617 863 0262

On Wednesday, May 16, 2012 at 8:43 PM, daneo wrote:

jmr13031 fork is working for me too! many thanks. sparkfun needs to pull this...


Reply to this email directly or view it on GitHub:
#7 (comment)

@jmr13031
Copy link
Contributor Author

I will give them a call....
-James
On Jun 18, 2012 5:32 AM, "Bob Breznak" <
reply@reply.github.com>
wrote:

I appreciate that. I've tried contacting them, but its been a bit hard,
but if you let their customer service know, that would probably help.

Bob Breznak
617 863 0262

On Wednesday, May 16, 2012 at 8:43 PM, daneo wrote:

jmr13031 fork is working for me too! many thanks. sparkfun needs to pull
this...


Reply to this email directly or view it on GitHub:
#7 (comment)


Reply to this email directly or view it on GitHub:
#7 (comment)

@wiesson
Copy link

wiesson commented Jun 22, 2012

Maybe you (@jmr13031) should do a pull-request from your commit? 311156a2ea1226562875e28b40a3d164caa45ada

@techdetect
Copy link

Just signed up! Hope you don't mind the questions. As I have nothing else to give for a first timer. I have the mega 1280, wifly 2.23 version and hope to connect to cosm. I have make huge progress, but totally need your help. I am using Arduino 1.0.1 but can use anything to get the wifly to work if you know what i mean. Hope you can all help. SO far it just fails to connect using the wifi _SPI library. I am over the most noobie issues such as the pin config and ssid, pphrase. Basically, i am looking for a mentor. Any help would be appreciated. Especially a tutorial.

@bobbrez
Copy link
Contributor

bobbrez commented Sep 17, 2012

I'm out of town. I'll try to take a look into this near the end of the
week.

Sent from my iPhone

On Sep 17, 2012, at 12:25 AM, techdetect notifications@github.com wrote:

Just signed up! Hope you don't mind the questions. As I have nothing else
to give for a first timer. I have the mega 1280, wifly 2.23 version and
hope to connect to cosm. I have make huge progress, but totally need your
help. I am using Arduino 1.0.1 but can use anything to get the wifly to
work if you know what i mean. Hope you can all help. SO far it just fails
to connect using the wifi _SPI library. I am over the most noobie issues
such as the pin config and ssid, pphrase. Basically, i am looking for a
mentor. Any help would be appreciated. Especially a tutorial.


Reply to this email directly or view it on
GitHubhttps://github.com//issues/7#issuecomment-8604129.

@techdetect
Copy link

Thanks for your reply.

Tonight i used arduino IDE 23 with mega 1280. I followed mgisolutions.blogspot.com/2012/05/arduino-wifly-shield-tutorial.html. I did the "send the following commands..." section and instead of using my home router ssid, i used the my_adhoc_network. I was able to see that on my internet connection display, yeah... prior to that i did the get everything and copied the ip address of the wifly. followed everything from there on. Uploaded the IDE code (compiled correctly Yeah) and tried to open a browser to get the LED on. NO go here. Some of my issues may be that i only have tx/rx pins, 10-13 pins vin pin and grd pin connected to the arduino and shield. I know that i am suppose to have the shield ontop without 10-13 conected but that was from an earlier tutorial. I am stuck at changing the ip address of my computer and net mask so that i can connect to the web server the wifly is at. Have some suggestions. I feel that i have broken some ground here on my problem. Thanks for your reply so quickly before. I hope your travel goes well. Take care. Tried to go with IDE 1.0 as well from the site. Maybe i am missing something on the webclient/webserver, it hangs on connecting.? Maybe i need to reset the wifly to factory and start over. Thanks again. Keep up the good work. Techdetect..

----- Original Message -----
From: "Bob Breznak" notifications@github.com
To: "sparkfun/WiFly-Shield" WiFly-Shield@noreply.github.com
Cc: "techdetect" williams_1114_eb@comcast.net
Sent: Monday, September 17, 2012 6:58:18 AM
Subject: Re: [WiFly-Shield] does not compile under arduino 1.0 IDE (#7)

I'm out of town. I'll try to take a look into this near the end of the
week.

Sent from my iPhone

On Sep 17, 2012, at 12:25 AM, techdetect notifications@github.com wrote:

Just signed up! Hope you don't mind the questions. As I have nothing else
to give for a first timer. I have the mega 1280, wifly 2.23 version and
hope to connect to cosm. I have make huge progress, but totally need your
help. I am using Arduino 1.0.1 but can use anything to get the wifly to
work if you know what i mean. Hope you can all help. SO far it just fails
to connect using the wifi _SPI library. I am over the most noobie issues
such as the pin config and ssid, pphrase. Basically, i am looking for a
mentor. Any help would be appreciated. Especially a tutorial.


Reply to this email directly or view it on
GitHubhttps://github.com//issues/7#issuecomment-8604129.


Reply to this email directly or view it on GitHub .

@ToniCorinne
Copy link
Contributor

I'm closing this particular issue as the library has been updated to compile under 1.0+. If you have any additional updates for the library, either submit a pull request or please open a new issue. Thanks all!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests