mardi 24 avril 2012

AsyncLabs WiShield Library problems solving 04/2012


AsyncLabs WiShield 2.0 with arduino Uno (rev3, atmega 328)
Troubleshooting : (i thoughy i could write about this in a blog, this way ... well firstly i won't forget about it, ... and secondly it will hopefully help others)

In file included from SimpleClient.cpp:6:
/Users/..../Arduino/libraries/asynclabsWiShield/WiServer.h:198: error: conflicting return type specified for 'virtual void Server::write(uint8_t)'

/Users/..../Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/Print.h:48: error:   overriding 'virtual size_t Print::write(uint8_t)'

SimpleClient.pde:-1: error: 'GETrequest' does not name a type
SimpleClient.cpp: In function 'void setup()':
SimpleClient.pde:-1: error: 'getWeather' was not declared in this scope
SimpleClient.cpp: In function 'void loop()':
SimpleClient.pde:-1: error: 'getWeather' was not declared in this scope

Ok so, i'm having a rough time here. lots of problems.
Gonna go step by step. So first: The two conflicts concerning the write(uint8_t) function.
Problem concerns the AsyncLabs WiShield library (2009, so a bit rusty), more specifically WiServer.h and Print.h

http://arduino.cc/forum/index.php/topic,101354.0.html  (forum about this matter, thanks PaulS, real life saver)

Since Print.h cannot be modified (Arduino Core), we will only be able to modify the WiServer.h file as follows (copied from the forum):

      virtual void write(uint8_t);  ==>       virtual size_t write(uint8_t);

Then, you'll need to change the implementation of the write() function in the cpp file, changing void write to size_t write AND adding a return statement to the write method.

So... in the WiServer.cpp file (took me some time to figure it out):
Function                              void Server::write(uint8_t b)
has to be replaced by           size_t Server::write(uint8_t b)
please correct me if i'm wrong..

Woooot, this error no longer shows----

 ok so Second part of my problem, the "   'GETrequest' does not name a type  " thing:
Problem concerns the library: the apps-conf.h file
in section:

//Here we include the header file for the application(s) we use in our project.
#define APP_WEBSERVER
//#define APP_WEBCLIENT
//#define APP_SOCKAPP
//#define APP_UDPAPP
//#define APP_WISERVER

Since i want to load the SimpleClient example from the library i have to adjust this:
comment ( // ) WEBSERVER  and remove comment from ( // )WISERVER as follows:

//#define APP_WEBSERVER
//#define APP_WEBCLIENT
//#define APP_SOCKAPP
//#define APP_UDPAPP
#define APP_WISERVER


Woooot, problem solved ----

Ok now i have a new problem:
Error compiling

/Users/..../Arduino/libraries/asynclabsWiShieldModified/clock-arch.c:44:20: error. wiring.h: No such file or directory


There seems to be a missing file.
Arduino.cc forums are really great:


answers point to replacing:     (files probably changed since 2009..)

#include "wiring.h"
with:
#include "Arduino.h"

and replaced:
#include "WProgram.h"
with:
#include "Arduino.h"

The proper solution is to edit the library, and change WProgram.h to Arduino.h.


So, in the Asynclabs Wishield library, i modified the clock-arch.c file as shown bellow:
Replacing             #include wiring.h            with             #include Arduino.h

And now i have a new problem:
Error compiling

/Users/..../Arduino/libraries/asynclabsWiShieldModified/WiServer.cpp:38:22: error: WProgram.h: No such file or directory

should have guessed this from the forum... 
it also shows a huge amount of errors, that come from this first error log (cannot find variables and functions and stuff)

So, within the library, in file WiServer.cpp i'm replacing:
    WProgram.h      with     Arduino.h

And again, a new problem arises:

Error compiling

/Users/..../Arduino/libraries/asynclabsWiShieldModified/WiShield.cpp:46:22: error: WProgram.h: No such file or directory 

It's the same problem as with the WiServer.cpp file, so i'm just gonna replace 
     WProgram.h     with     Arduino.h         in the WiShield.cpp file,
it also shows some logs of error that are linked to this first error (as before, not finding variables and functions and stuff)

Woot, no more error logs :D
Done compiling

Binary sketch size: 15550 bytes (of a 32256 byte maximum)


(SimpleClient example)

3 commentaires:

  1. Thanks for posting this. I had the same issues with a Asynclabs BlackWidow I just bought on eBay. This saved me a lot of headache and forum searching.

    RépondreSupprimer
  2. Hi! Quick question: Where did you put the return in the size_t Server::write(uint8_t b) { routine? Could you just paste the whole subroutine for me? I'm having trouble following what it is actually doing.
    Thank you!

    RépondreSupprimer
    Réponses
    1. I believe i do not know how to answer since i do not understand it :S

      Supprimer