Added nullptr check in EmotibitEda_cpp#296
Conversation
pulling latest FileTransfer into EmotiBitEda fix
Pulling latest feat_fileTransfer
produceconsumerobot
left a comment
There was a problem hiding this comment.
@nitin710 review complete
EmotiBitEda.cpp
Outdated
|
|
||
| if (_emotibitVersion >= EmotiBitVersionController::EmotiBitVersion::V04A) | ||
| { | ||
| if(_edlOversampBuffer == nullptr || _edlBuffer == nullptr) return 16; // BufferFloat::ERROR_PTR_NULL = 16. But, any non-zero value sohuld work. |
There was a problem hiding this comment.
Is there a reason we wouldn't return (uint8_t) BufferFloat::ERROR_PTR_NULL to avoid magic numbers?
There was a problem hiding this comment.
I thought it needs a EmotiBitEda::NULL_PTR_ERROR. So i just added a number, with a comment explaining it.
But since, the buffers are BufferFloat under the hood, we could use BufferFloat::NULL_PTR anyway.
Changing it to (uint8_t) BufferFloat::ERROR_PTR_NULL
EmotiBitEda.cpp
Outdated
| { | ||
| // Reads EDA data from ADC | ||
|
|
||
| if(_edlOversampBuffer == nullptr || _edrOversampBuffer == nullptr || _edlBuffer == nullptr || _edrBuffer == nullptr) return 16; // BufferFloat::ERROR_PTR_NULL = 16. But, any non-zero value sohuld work. |
There was a problem hiding this comment.
Is there a reason we wouldn't return (uint8_t) BufferFloat::ERROR_PTR_NULL to avoid magic numbers?
There was a problem hiding this comment.
EmotiBitEda.cpp
Outdated
| } | ||
| else | ||
| { | ||
| if(_edlBuffer == nullptr || _edrBuffer == nullptr || _edaBuffer == nullptr) return false; |
There was a problem hiding this comment.
Does _edrOversampBuffer need checking here too?
There was a problem hiding this comment.
Added this check in the OR statement.
|
Changes made, as requested. |
|
@nitin710 Looks good |
Description
Requirements
Issues Referenced
Documentation update
Testing
setup()and the oscilloscope continued set up and continued normal function + recording without eda (which was previously crashing for the agave board)
