-
-
Notifications
You must be signed in to change notification settings - Fork 28
[AE-13] Add CO2 and IAQ data from SensorBSEC class #83
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
base: main
Are you sure you want to change the base?
Conversation
Memory usage change @ d494cf5
Click for full report table
Click for full report CSV
|
Memory usage change @ 896d7db
Click for full report table
Click for full report CSV
|
Serial.println(String("co2: ") + String(bsec.co2_eq(),3)); | ||
Serial.println(String("iaq: ") + String(bsec.iaq(),3)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Following @alrvid 's comment, the following two lines are problematic. The data types of the SenseBSEC class are not uniform and are either unit8_t
, unit16_t
, unit32_t
or float
. See here.
uint16_t iaq() {return _data.iaq;}
uint16_t iaq_s() {return _data.iaq_s;}
float b_voc_eq() {return _data.b_voc_eq;}
uint32_t co2_eq() {return _data.co2_eq;}
uint8_t accuracy() {return _data.accuracy;}
float comp_t() {return _data.comp_t;}
float comp_h() {return _data.comp_h;}
uint32_t comp_g() {return _data.comp_g;}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
String(val, decimalPlaces)
can only be used for certain data types:
`val`: a variable to format as a String - *Allowed data types:* string, char, byte, int, long, unsigned int, unsigned long, float, double +
So unit8_t
, unit16_t
and unit32_t
are illegal.
The problem isn't with the val parameter - it's with the second parameter you pass to String(), called decimalPlaces. That parameter can only be used when the first parameter (val) is a float or double. In your case, you pass a uint32_t as the first parameter (the value), so you can't pass a second parameter at all. So, of these four lines, the first two are illegal: Serial.println(String("co2: ") + String(bsec.co2_eq(),3)); The last two should work. It's not a problem that co2_eq() returns uint32_t, because the Arm GCC compiler carries with it this typedef in a header file: typedef UINT32_TYPE __uint32_t; And UINT32_TYPE is a built-in macro in GCC that's defined as the underlying 32-bit unsigned data type of the platform. And as you noted, unsigned int is a valid type for val, and it is also an unsigned 32-bit data type on the Cortex-M platform. So you should be able to pass a uint32_t as the first parameter. The problem is that you can't do this: Serial.println(String("co2: ") + String(bsec.co2_eq(),3)); Only this is valid: Serial.println(String(bsec.co2_eq())); |
Remove 'decimalPlaces' parameter
Memory usage change @ 5835471
Click for full report table
Click for full report CSV
|
Description
Added CO2 and IAQ output to the Serial Monitor based on the
SensorBSEC
class to theStandalone.ino
test sketch.Note: Do not merge, until #82 is resolved.
Pull request type