SlashDevin / NeoGPS

NMEA and ublox GPS parser for Arduino, configurable to use as few as 10 bytes of RAM
GNU General Public License v3.0
702 stars 195 forks source link

NMEAdistance won't compile #142

Open mccgregory opened 3 years ago

mccgregory commented 3 years ago

Trying to use NMEAdistance with an ESP32 but it fails to compile with the following error: "NMEAdistance:54:51: error: call of overloaded 'Location_t(long int, long int)' is ambiguous"

It is referring to the line: NeoGPS::Location_t base( -253448688L, 1310324914L ); // Ayers Rock, AU

If anybody could give me a pointer?

mccgregory commented 3 years ago

The Latitude and Longitude in NMEAdistance are specified as LONG i.e. ( -253448688L, 1310324914L ) But in Location.h, Location_t is expecting two DOUBLEs. here: Location_t( double lat, double lon ) : _lat(lat / LOC_SCALE), _lon(lon / LOC_SCALE) {} Sorry, I'm not a programmer, how do I resolve this? I can get rid of the compilation error by "getting the L out of it" (so to speak) with: ( -253448688, 1310324914 ). But surely that will create a new problem?

bzroom commented 3 years ago

try this: //NeoGPS::Location_t base( -253448688L, 1310324914L ); // Ayers Rock, AU NeoGPS::Location_t base; base._lat = -253448688L; base._lon =1310324914L; // Ayers Rock, AU

Or this: NeoGPS::Location_t base( (int32_t)-253448688L, (int32_t)1310324914L ); // Ayers Rock, AU

Honestly i dunno which one is right, but they both compile for me.

mccgregory commented 3 years ago

HI, thanks for your time. Fails with:

NMEAdistance:56:1: error: 'base' does not name a type base._lat = -253448688L;

NMEAdistance:57:1: error: 'base' does not name a type base._lon = 1310324914L; // Ayers Rock, AU

Best regards Greg

bzroom commented 3 years ago

You need to put those lines in a function, maybe setup() function. Cannot put code outside of a function.

On Sun, Aug 2, 2020, 1:04 AM mccgregory notifications@github.com wrote:

HI, thanks for your time.

Fails with:

NMEAdistance:56:1: error: 'base' does not name a type

base._lat = -253448688L;

NMEAdistance:57:1: error: 'base' does not name a type

base._lon = 1310324914L; // Ayers Rock, AU

Best regards

Greg

From: bzroom notifications@github.com Sent: 02 August 2020 08:30 To: SlashDevin/NeoGPS NeoGPS@noreply.github.com Cc: mccgregory mccgregor.gm@gmail.com; Author <author@noreply.github.com

Subject: Re: [SlashDevin/NeoGPS] NMEAdistance won't compile (#142)

try this: //NeoGPS::Location_t base( -253448688L, 1310324914L ); // Ayers Rock, AU NeoGPS::Location_t base; base._lat = -253448688L; base._lon =1310324914L; // Ayers Rock, AU

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub < https://github.com/SlashDevin/NeoGPS/issues/142#issuecomment-667640110> , or unsubscribe < https://github.com/notifications/unsubscribe-auth/AKT2MCL7FB5PYKS4F3G62KDR6UIZBANCNFSM4PRVFQSQ> . < https://github.com/notifications/beacon/AKT2MCMIN53I27A5OJOEY63R6UIZBA5CNFSM4PRVFQS2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOE7FWCLQ.gif>

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/SlashDevin/NeoGPS/issues/142#issuecomment-667643120, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABKVCN3TVIDWSPXAABPHXXDR6UMZLANCNFSM4PRVFQSQ .

mccgregory commented 3 years ago

Sorry, I’m a bit dim, and again thanks for your rapid feedback.

I don’t really understand…

You commented on the code, suggesting I try this: showing the original line commented out, and three new lines.

I assumed I was just replacing that line with the three lines?

Are you suggesting I create another function to call the Location_t Function?

Apologies for my lack of understanding – I’m a bit old and thick! Best regards Greg

bzroom commented 3 years ago

Post your whole code

On Sun, Aug 2, 2020, 3:13 AM mccgregory notifications@github.com wrote:

Sorry, I’m a bit dim, and again thanks for your rapid feedback.

I don’t really understand…

You commented on the code, suggesting I try this:

showing the original line commented out, and three new lines.

I assumed I was just replacing that line with the three lines?

Are you suggesting I create another function to call the Location_t Function?

Apologies for my lack of understanding – I’m a bit old and thick!

Best regards

Greg

From: bzroom notifications@github.com Sent: 02 August 2020 11:06 To: SlashDevin/NeoGPS NeoGPS@noreply.github.com Cc: mccgregory mccgregor.gm@gmail.com; Author <author@noreply.github.com

Subject: Re: [SlashDevin/NeoGPS] NMEAdistance won't compile (#142)

You need to put those lines in a function, maybe setup() function. Cannot put code outside of a function.

On Sun, Aug 2, 2020, 1:04 AM mccgregory <notifications@github.com <mailto: notifications@github.com> > wrote:

HI, thanks for your time.

Fails with:

NMEAdistance:56:1: error: 'base' does not name a type

base._lat = -253448688L;

NMEAdistance:57:1: error: 'base' does not name a type

base._lon = 1310324914L; // Ayers Rock, AU

Best regards

Greg

From: bzroom <notifications@github.com mailto:notifications@github.com

Sent: 02 August 2020 08:30 To: SlashDevin/NeoGPS <NeoGPS@noreply.github.com <mailto: NeoGPS@noreply.github.com> > Cc: mccgregory <mccgregor.gm@gmail.com mailto:mccgregor.gm@gmail.com ; Author <author@noreply.github.com mailto:author@noreply.github.com%0b

Subject: Re: [SlashDevin/NeoGPS] NMEAdistance won't compile (#142)

try this: //NeoGPS::Location_t base( -253448688L, 1310324914L ); // Ayers Rock, AU NeoGPS::Location_t base; base._lat = -253448688L; base._lon =1310324914L; // Ayers Rock, AU

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub < https://github.com/SlashDevin/NeoGPS/issues/142#issuecomment-667640110> , or unsubscribe <

https://github.com/notifications/unsubscribe-auth/AKT2MCL7FB5PYKS4F3G62KDR6UIZBANCNFSM4PRVFQSQ

. <

https://github.com/notifications/beacon/AKT2MCMIN53I27A5OJOEY63R6UIZBA5CNFSM4PRVFQS2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOE7FWCLQ.gif

— You are receiving this because you commented. Reply to this email directly, view it on GitHub <https://github.com/SlashDevin/NeoGPS/issues/142#issuecomment-667643120 , or unsubscribe < https://github.com/notifications/unsubscribe-auth/ABKVCN3TVIDWSPXAABPHXXDR6UMZLANCNFSM4PRVFQSQ

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub < https://github.com/SlashDevin/NeoGPS/issues/142#issuecomment-667654136> , or unsubscribe < https://github.com/notifications/unsubscribe-auth/AKT2MCNRDUI2RZ7YZHO5M23R6U3ABANCNFSM4PRVFQSQ> . < https://github.com/notifications/beacon/AKT2MCJ54KNBQRPLMQAXMCDR6U3ABA5CNFSM4PRVFQS2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOE7FZP6A.gif>

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/SlashDevin/NeoGPS/issues/142#issuecomment-667654858, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABKVCN5V7WIJ5WSJXZAGUHLR6U353ANCNFSM4PRVFQSQ .

mccgregory commented 3 years ago

😊

My whole code is the NMEAdistance code.

At this stage I’m trying NeoGPS out, learning what I can and can’t do.

It is a mini project in a bigger project – I just wanted something to display the accuracy of RTK GPS by displaying the distance between the BASE and the ROVER. Regards Greg

bzroom commented 3 years ago

Can you figure out how not to copy the whole thread every time you reply?

You need to put code inside a function. Ask a c++ programmer.

You being dim is not an NeoGPS issue. Try some c++ forums or Discord.

bzroom commented 3 years ago

just use this one. FFS i gave you 2 examples: NeoGPS::Location_t base( (int32_t)-253448688L, (int32_t)1310324914L ); // Ayers Rock, AU

mccgregory commented 3 years ago

Thanks again.

just use this one. FFS i gave you 2 examples: NeoGPS::Location_t base( (int32_t)-253448688L, (int32_t)1310324914L ); // Ayers Rock, AU

Sorry, the thread shows you gave me one example, which I commented on.

And then, now a new example – which appears to effective, it certainly compiles past that original error.

I now need to read some more of the NeoGPS documentation to fill out the other variables before I can fully compile it and then upload it and try it out.

Thanks for your time – hope you are not too dislocated by your efforts.

Oh, and the answers to your previous questions:

Can you figure out how not to copy the whole thread every time you reply?

Sorry - Yes – how is this?

You need to put code inside a function. Ask a c++ programmer.

I sort of expected “Example Code” to work as is – more or less?

As far as I can see the NMEAdistance code, which after all, is meant to be example code, is calling an overloaded function Location_t with two long parameters. Location_t doesn’t seem to cope with longs.

You being dim is not an NeoGPS issue. Try some c++ forums or Discord.

I feel that the issue is probably that this code has been tested on a DUE or something like that not an ESP32, so that the variable type (float, double, long needs resolving)

I can probably resolve this myself – it just takes longer – I was merely reaching out… The reason I looked on this particular forum was perhaps to find out if other people had experienced this and I could then gently nudge me in the right direction.

Apologies if I upset you or wasted your time. Best regards Greg

techbv commented 3 years ago

Thank you very match, it help me.