RobTillaart / AGS02MA

Arduino library for AGS02MA TVOC sensor
MIT License
14 stars 3 forks source link

Register dumping feature #16

Closed Beanow closed 2 years ago

Beanow commented 2 years ago

In a somewhat similar way to the proposed calibration feature, here's an idea for a minimal register dumping function. If you're not using this, it only adds a small amount of code to the actual library, offloading all speculative interpretation of register data to the example sketch.

Sample output:

REG[0x0]    0   0   0   166 C: 141      Sensor data:    0   166
REG[0x1]    0   125 6   252 C: 96       Calibration:    125 1788
REG[0x2]    0   100 2   126 C: 75       Calibration:    100 638
REG[0x3]    3   232 0   227 C: 213      Calibration:    1000    227
REG[0x4]    39  16  0   81  C: 222      Calibration:    10000   81
REG[0x5]    238 72  35  40  C: 205  
REG[0x6]    26  0   0   18  C: 213  
REG[0x7]    2   92  132 29  C: 82   
REG[0x8]    211 118 0   28  C: 214  
REG[0x11]   21  2   3   118 C: 133      Version:    118
REG[0x20]   0   2   92  211 C: 95   
REG[0x21]   26  229 26  229 C: 113      I2C address:    0x1A
Beanow commented 2 years ago

We could even put this behind a #if defined (AGS02MA_READ_REGISTERS) or similar, so extra code isn't included for normal use at all.

RobTillaart commented 2 years ago

You need to merge the new master into this branche.

Beanow commented 2 years ago

Things have been updated. Not entirely sure how long for (auto address : addresses) has been present in compilers arduino uses, but the CI seems to build anyway. And it's in the example rather than library itself. :shrug:

RobTillaart commented 2 years ago

@beanow

Not entirely sure how long for (auto address : addresses) has been present in compilers arduino uses

What you can do is uncomment all platforms in the .arduino-ci.yml that would let the build CI at least test all supported platforms. That would be max you can test, if the test not fails you can roll back to minimize the build CI effort.

RobTillaart commented 2 years ago

oops wrong button 😎

Beanow commented 2 years ago

@Beanow

Not entirely sure how long for (auto address : addresses) has been present in compilers arduino uses

What you can do is uncomment all platforms in the .arduino-ci.yml that would let the build CI at least test all supported platforms. That would be max you can test, if the test not fails you can roll back to minimize the build CI effort.

I don't think that'll add much insight. It's compiler support, not board support I was thinking about. Looked it up and I think we're fine.

auto type keyword and for (x : y) "range based for statements" are part of the C++11 standard. Which is allegedly available by default from v1.6.6 of the Arduino IDE. https://www.arduino.cc/en/software/ReleaseNotes#arduino-166---20151103 released 2015.

For an example sketch, 2015 seems plenty compatible to me.

RobTillaart commented 2 years ago

lgtm, going to merge into master