Local compile error Serial1.println function println could not be resolved(develop branch)


#1

So I was getting an error on Serial1.println when compiling based on the develop branch. I corrected this by changing line 34 of spark_wiring_usartserial.h from

class USARTSerial : public Stream
to
class USARTSerial : public Print

I was getting a semantic Error on that line of “Stream is ambiguous” It also caused the println function to be unresolved. This was the best way I could determine to fix the error but there may be a better way. Just sharing for future users. Probably not an issue for users compiling from WEB IDE Build but for anyone compiling from the latest develop branch locally it might be helpful.


#2

Interesting, I am not seeing this issue. Did you get the absolute latest from develop? We did rename some things, are you sure you are still on the correct branch?

What gcc version are you using? And what OS are you building on?

Anyone else seeing a similar issue? There was an issue with develop when we first merged where Serial would simply stop working, but that didn’t result in a compiler error, it just didn’t print anything.


#3

Hey @eric

Yes, I pulled the latest from the develop branch. Not sure what is causing that either.

I do most of my development through the C/C++ perspective in Eclipse. My gcc compiler version is 4.9.3 OS is Mac 10.11.4(El Capitan).

Error was Stream is ambiguous, after I resolved that it all works perfectly. Strange though that this does not through an error on spark_wiring_usbserial.h which seems to be formatted about the same way.


#4

Hey @eric

Ok so I ran into a problem with this. The .available() function does not seem to be working after my fix. This is probably do to the way I corrected the issue. I also can write to Serial1 but can’t read from it.

Any ideas on a proper fix? If you compile from the develop branch does everything work for you?


#5

This is the exact error I’m seeing in eclipse:
Stream’ is ambiguous ’ Candidates are: Stream(const Stream &) Stream()

This is the build error in the compiler:
In file included from src/system_setup.cpp:42:0:
…/wiring/inc/spark_wiring_usartserial.h:40:3: error: declaration does not declare anything [-fpermissive]
Stream;
^


#6

Hey @eric,

OK at this point best I can tell Serial1.read() and Serial1.available() flat do not work. I have tried compiling binaries locally from Git repos Develop, 1.0.47, and 1.1.47 I have also connected the module to the cloud through my phone acting as a gateway and flashed firmware over the air that way so I am using the latest recommended code I assume. I have tried 4 different modules and have tried them all fresh out of the box connected to the Build IDE.

Since I do this for work I have to stop working on this until it is resolved. Boss does not like us chasing rabbits down holes. Please try Serial1.available() and Serial1.read() and let me know if it works for anyone. I have tried all I can possibly think of.

Thanks,
Travis


#7

I will take a look a bit later this afternoon. We had a buffered approach originally which worked well, but then we switched out to a non-buffered version right before the last release. This may have caused a few issues and I think it makes sense to go back to the buffered approach.


#8

Hey @eric

No problem. In the mean time is there anything I can do to move forward? Is there a git repo prior to this like develop-legacy that will still work? At least with that I can get something done until you have a fix.


#9

I don’t think there is an easy way to get back to the buffered state unfortunately. It isn’t a very big change, we just use the FIFO driver from Nordic, but things have changed and the file has moved.

Sorry about that, I will try and get this fixed in develop as soon as I can.


#10

No problem @eric Just let me know when it’s ready. Also let me know if you have the same issue so I know I’m not crazy :slight_smile:


#11

@IOTrav I updated the develop branch to use the buffers again. With this change, things like available() and read() are working properly. This should hopefully fix the issues you had faced getting them to work.

I am still not seeing the issue of Serial.println not being resolved. I wonder if that could be an Eclipse issue? If you compile directly from the command line, do you see the same thing?


#12

Hey @eric

Thank you so much. Just pulled that change into my workspace. Performed make clean, build, flashed system part, then user part and I am getting an LED flash on Serial1.available(). using following code:

/* Includes ------------------------------------------------------------------*/
#include "application.h"
/* Function prototypes -------------------------------------------------------*/

SYSTEM_MODE(MANUAL);

int LED = D7;



/* This function is called once at start up ----------------------------------*/
void setup()
{
	Serial1.begin(115200);
	pinMode(LED, OUTPUT);
}

/* This function loops forever --------------------------------------------*/
void loop()
{
	if(Serial1.available() != 0){
		while(Serial1.available() != 0){
			Serial1.read();
		}
		digitalWrite(LED, HIGH);
		delay(200);
		digitalWrite(LED, LOW);
	}
} 

Will test Serial1.read() later to make sure that is working and report back.

Thanks again Eric!


#13

Just tested. Serial1.read() works as well. Thank you so much for getting this all resolved on the develop branch @eric!!