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

Problems with MS5xxx.cpp when using Seeduino Zero #8

Closed
jritz1349 opened this issue Jul 30, 2023 · 8 comments · Fixed by #10
Closed

Problems with MS5xxx.cpp when using Seeduino Zero #8

jritz1349 opened this issue Jul 30, 2023 · 8 comments · Fixed by #10
Assignees
Labels

Comments

@jritz1349
Copy link

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);

@Schm1tz1
Copy link
Owner

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.

@jritz1349
Copy link
Author

jritz1349 commented Aug 1, 2023 via email

@Schm1tz1
Copy link
Owner

Schm1tz1 commented Aug 2, 2023

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.

@Schm1tz1
Copy link
Owner

Schm1tz1 commented Aug 2, 2023

Done, PR is #10

@Schm1tz1 Schm1tz1 linked a pull request Aug 2, 2023 that will close this issue
@Schm1tz1 Schm1tz1 added the bug label Aug 2, 2023
@Schm1tz1 Schm1tz1 self-assigned this Aug 2, 2023
@jritz1349
Copy link
Author

jritz1349 commented Aug 2, 2023 via email

@jritz1349
Copy link
Author

jritz1349 commented Aug 2, 2023 via email

@Schm1tz1
Copy link
Owner

Schm1tz1 commented Aug 2, 2023

Yes, exactly, all occurrences in the code are renamed.
You can simply use the new release, it's already fixed in 1.1.1 and available in Arduino librararies. Just update it in your IDE and it should work.

@jritz1349
Copy link
Author

jritz1349 commented Aug 3, 2023 via email

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

Successfully merging a pull request may close this issue.

2 participants