-
Notifications
You must be signed in to change notification settings - Fork 9
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
Problems with MS5xxx.cpp when using Seeduino Zero #8
Comments
Hi, that's intersting. Can you give the line number of the error? Any special version of arduino or the compiler you are using? |
I am using the latest Arduino IDE 2.1.0. I also tried the old Arduino
1.8.9.
I used the MS5xxx.cpp and .h files and it gave me the following errors when
compiling using Seeduino Zero (or XIAO) boards:
C:\Users\johnr\OneDrive\Documents\Arduino\libraries\MS5xxx\src\MS5611.cpp:
In member function 'virtual void MS5611::Readout()':
C:\Users\johnr\OneDrive\Documents\Arduino\libraries\MS5xxx\src\MS5611.cpp:29:2:
error: expected primary-expression before 'unsigned'
unsigned long D1=0, D2=0;
^~~~~~~~
C:\Users\johnr\OneDrive\Documents\Arduino\libraries\MS5xxx\src\MS5611.cpp:35:51:
error: lvalue required as left operand of assignment
D2=read_adc(MS5xxx_CMD_ADC_D2+MS5xxx_CMD_ADC_4096);
^
C:\Users\johnr\OneDrive\Documents\Arduino\libraries\MS5xxx\src\MS5611.cpp:36:51:
error: lvalue required as left operand of assignment
D1=read_adc(MS5xxx_CMD_ADC_D1+MS5xxx_CMD_ADC_4096);
^
C:\Users\johnr\OneDrive\Documents\Arduino\libraries\MS5xxx\src\MS5xxx.cpp:
In member function 'void MS5xxx::Readout()':
C:\Users\johnr\OneDrive\Documents\Arduino\libraries\MS5xxx\src\MS5xxx.cpp:147:2:
error: expected primary-expression before 'unsigned'
unsigned long D1=0, D2=0;
^~~~~~~~
C:\Users\johnr\OneDrive\Documents\Arduino\libraries\MS5xxx\src\MS5xxx.cpp:153:51:
error: lvalue required as left operand of assignment
D2=read_adc(MS5xxx_CMD_ADC_D2+MS5xxx_CMD_ADC_4096);
^
C:\Users\johnr\OneDrive\Documents\Arduino\libraries\MS5xxx\src\MS5xxx.cpp:154:51:
error: lvalue required as left operand of assignment
D1=read_adc(MS5xxx_CMD_ADC_D1+MS5xxx_CMD_ADC_4096);
^
exit status 1
Compilation error: exit status 1
I have attached the .h and .cpp files. It works fine when compiling for a
simple Arduino Uno board.
…-John Ritz
On Mon, Jul 31, 2023 at 3:37 PM Roman Schmitz ***@***.***> wrote:
Hi, that's intersting. Can you give the line number of the error? Any
special version of arduino or the compiler you are using?
IMO it should be
https://github.com/Schm1tz1/arduino-ms5xxx/blob/master/src/MS5611.cpp#L29C18-L29C18
but trying to verify. That line is not best code style but should be valid
for Seeduino as far as I can see. Will need to look into this.
—
Reply to this email directly, view it on GitHub
<#8 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BBTGDND5ZDF2XJYH5PTOUKDXTACRDANCNFSM6AAAAAA243C67E>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Gotcha! Installed the boards according to https://wiki.seeedstudio.com/Seeed_Arduino_Boards/ and could reproduce the error. According to the docs, unsigned long is a valid type for Seeeduino so I tested that with a minimal example and it works. I found that Seeeduino is using global constants D1 and D2 and compile was crashing due to a conflict. I fixed it locally by renaming like this:
Will push a patch later so we have a working release online. |
Done, PR is #10 |
Great! So do I have to install a new MS5xxx.cpp and .h files or just do the
changes that you showed above? The lines in Readout():
unsigned long l_D1=0, l_D2=0;
double dT;
double OFF;
double SENS;
l_D2=read_adc(MS5xxx_CMD_ADC_D2+MS5xxx_CMD_ADC_4096);
l_D1=read_adc(MS5xxx_CMD_ADC_D1+MS5xxx_CMD_ADC_4096);
…-John
On Wed, Aug 2, 2023 at 6:54 AM Roman Schmitz ***@***.***> wrote:
Closed #8 <#8> as
completed via #10 <#10>.
—
Reply to this email directly, view it on GitHub
<#8 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BBTGDND3STTTJ2A3NCH2P5DXTIWWXANCNFSM6AAAAAA243C67E>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Ok, So everywhere the D1 and D2 is used has to be changed to l_D1 and l_D2
(Is it the letter l not 1, right?).
Because D1 and D2 are used later in computations throughout. Thanks again.
…-John
On Wed, Aug 2, 2023 at 6:27 AM Roman Schmitz ***@***.***> wrote:
Gotcha! Installed the boards according to
https://wiki.seeedstudio.com/Seeed_Arduino_Boards/ and could reproduce
the error. According to the docs, *unsigned long* is a valid type for
Seeeduino so I tested that with a minimal example and it works. I found
that Seeeduino is using global constants D1 and D2 and compile was crashing
due to a conflict. I fixed it locally by renaming like this:
void MS5611::Readout() {
unsigned long l_D1=0, l_D2=0;
double dT;
double OFF;
double SENS;
l_D2=read_adc(MS5xxx_CMD_ADC_D2+MS5xxx_CMD_ADC_4096);
l_D1=read_adc(MS5xxx_CMD_ADC_D1+MS5xxx_CMD_ADC_4096);
...
Will push a patch later so we have a working release online.
—
Reply to this email directly, view it on GitHub
<#8 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BBTGDNHCEWJZO7VA4NX4WVTXTITP3ANCNFSM6AAAAAA243C67E>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Yes, exactly, all occurrences in the code are renamed. |
Yes, I made the updates changing D1,D2 to l_D1,l_D2 and it now compiles
fine with Seeduino Zero. Thank you again!
…-John
On Wed, Aug 2, 2023 at 3:19 PM Roman Schmitz ***@***.***> wrote:
Yes, exactly. You can simply use the new release, it's already fixed ad
available.
—
Reply to this email directly, view it on GitHub
<#8 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BBTGDNCHJM2MPOCPVNWISM3XTKR4HANCNFSM6AAAAAA243C67E>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
When testing the MS5607 with the MS5xxx library it compiles fine with an Arduino uno but when I compile it with a Seeduino Zero I
get errors:
error: expected primary-expression before 'unsigned' unsigned long D1=0;
error: expected primary-expression before 'unsigned' unsigned long D2=0;
error: lvalue required as left operand of assignment D2=read_adc(MS5xxx_CMD_ADC_D2+MS5xxx_CMD_ADC_4096);
error: lvalue required as left operand of assignment D1=read_adc(MS5xxx_CMD_ADC_D1+MS5xxx_CMD_ADC_4096);
The text was updated successfully, but these errors were encountered: