mirror of
https://github.com/RobTillaart/Arduino.git
synced 2024-09-20 00:55:58 -04:00
0.3.3 AGS02MA
This commit is contained in:
parent
2b5f49b2e3
commit
45f1941984
@ -6,7 +6,7 @@ jobs:
|
|||||||
lint:
|
lint:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- uses: arduino/arduino-lint-action@v1
|
- uses: arduino/arduino-lint-action@v1
|
||||||
with:
|
with:
|
||||||
library-manager: update
|
library-manager: update
|
||||||
|
@ -8,7 +8,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- uses: ruby/setup-ruby@v1
|
- uses: ruby/setup-ruby@v1
|
||||||
with:
|
with:
|
||||||
ruby-version: 2.6
|
ruby-version: 2.6
|
||||||
|
@ -10,7 +10,7 @@ jobs:
|
|||||||
test:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- name: json-syntax-check
|
- name: json-syntax-check
|
||||||
uses: limitusus/json-syntax-check@v1
|
uses: limitusus/json-syntax-check@v1
|
||||||
with:
|
with:
|
||||||
|
@ -2,15 +2,15 @@
|
|||||||
// FILE: AGS02MA.cpp
|
// FILE: AGS02MA.cpp
|
||||||
// AUTHOR: Rob Tillaart, Viktor Balint, Beanow
|
// AUTHOR: Rob Tillaart, Viktor Balint, Beanow
|
||||||
// DATE: 2021-08-12
|
// DATE: 2021-08-12
|
||||||
// VERSION: 0.3.2
|
// VERSION: 0.3.3
|
||||||
// PURPOSE: Arduino library for AGS02MA TVOC
|
// PURPOSE: Arduino library for AGS02MA TVOC sensor
|
||||||
// URL: https://github.com/RobTillaart/AGS02MA
|
// URL: https://github.com/RobTillaart/AGS02MA
|
||||||
|
|
||||||
|
|
||||||
#include "AGS02MA.h"
|
#include "AGS02MA.h"
|
||||||
|
|
||||||
|
|
||||||
// REGISTERS
|
// REGISTERS
|
||||||
#define AGS02MA_DATA 0x00
|
#define AGS02MA_DATA 0x00
|
||||||
#define AGS02MA_CALIBRATION 0x01
|
#define AGS02MA_CALIBRATION 0x01
|
||||||
#define AGS02MA_VERSION 0x11
|
#define AGS02MA_VERSION 0x11
|
||||||
@ -44,7 +44,7 @@ bool AGS02MA::begin(uint8_t dataPin, uint8_t clockPin)
|
|||||||
|
|
||||||
bool AGS02MA::begin()
|
bool AGS02MA::begin()
|
||||||
{
|
{
|
||||||
_startTime = millis(); // PREHEAT TIMING
|
_startTime = millis(); // PREHEAT TIMING
|
||||||
_wire->begin();
|
_wire->begin();
|
||||||
return isConnected();
|
return isConnected();
|
||||||
}
|
}
|
||||||
@ -53,14 +53,16 @@ bool AGS02MA::begin()
|
|||||||
bool AGS02MA::isConnected()
|
bool AGS02MA::isConnected()
|
||||||
{
|
{
|
||||||
#if defined (__AVR__)
|
#if defined (__AVR__)
|
||||||
// TWBR = 255; // == 30.4 KHz with TWSR = 0x00
|
// TWBR = 255; // == 30.4 KHz with TWSR = 0x00
|
||||||
TWBR = 78; // == 25.0 KHZ
|
TWBR = 78; // == 25.0 KHZ
|
||||||
TWSR = 0x01; // prescaler = 4
|
TWSR = 0x01; // prescaler = 4
|
||||||
#else
|
#else
|
||||||
_wire->setClock(AGS02MA_I2C_CLOCK);
|
_wire->setClock(AGS02MA_I2C_CLOCK);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
_wire->beginTransmission(_address);
|
_wire->beginTransmission(_address);
|
||||||
bool rv = ( _wire->endTransmission(true) == 0);
|
bool rv = ( _wire->endTransmission(true) == 0);
|
||||||
|
|
||||||
#if defined (__AVR__)
|
#if defined (__AVR__)
|
||||||
TWSR = 0x00;
|
TWSR = 0x00;
|
||||||
#endif
|
#endif
|
||||||
@ -136,7 +138,7 @@ uint32_t AGS02MA::getSensorDate()
|
|||||||
date += _bin2bcd(_buffer[1]);
|
date += _bin2bcd(_buffer[1]);
|
||||||
date <<= 8;
|
date <<= 8;
|
||||||
date += _bin2bcd(_buffer[2]);
|
date += _bin2bcd(_buffer[2]);
|
||||||
// version = _buffer[3];
|
// version = _buffer[3];
|
||||||
if (_CRC8(_buffer, 5) != 0)
|
if (_CRC8(_buffer, 5) != 0)
|
||||||
{
|
{
|
||||||
_error = AGS02MA_ERROR_CRC;
|
_error = AGS02MA_ERROR_CRC;
|
||||||
@ -266,6 +268,7 @@ bool AGS02MA::readRegister(uint8_t address, AGS02MA::RegisterData ®) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// PRIVATE
|
// PRIVATE
|
||||||
@ -299,12 +302,13 @@ bool AGS02MA::_readRegister(uint8_t reg)
|
|||||||
while (millis() - _lastRegTime < 30) yield();
|
while (millis() - _lastRegTime < 30) yield();
|
||||||
|
|
||||||
#if defined (__AVR__)
|
#if defined (__AVR__)
|
||||||
// TWBR = 255; // == 30.4 KHz with TWSR = 0x00
|
// TWBR = 255; // == 30.4 KHz with TWSR = 0x00
|
||||||
TWBR = 78; // == 25.0 KHZ
|
TWBR = 78; // == 25.0 KHZ
|
||||||
TWSR = 0x01; // prescaler = 4
|
TWSR = 0x01; // prescaler = 4
|
||||||
#else
|
#else
|
||||||
_wire->setClock(AGS02MA_I2C_CLOCK);
|
_wire->setClock(AGS02MA_I2C_CLOCK);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
_wire->beginTransmission(_address);
|
_wire->beginTransmission(_address);
|
||||||
_wire->write(reg);
|
_wire->write(reg);
|
||||||
_error = _wire->endTransmission(true);
|
_error = _wire->endTransmission(true);
|
||||||
@ -339,9 +343,9 @@ bool AGS02MA::_writeRegister(uint8_t reg)
|
|||||||
_lastRegTime = millis();
|
_lastRegTime = millis();
|
||||||
|
|
||||||
#if defined (__AVR__)
|
#if defined (__AVR__)
|
||||||
// TWBR = 255; // == 30.4 KHz with TWSR = 0x00
|
// TWBR = 255; // == 30.4 KHz with TWSR = 0x00
|
||||||
TWBR = 78; // == 25.0 KHZ
|
TWBR = 78; // == 25.0 KHZ
|
||||||
TWSR = 0x01; // prescaler = 4
|
TWSR = 0x01; // prescaler = 4
|
||||||
#else
|
#else
|
||||||
_wire->setClock(AGS02MA_I2C_CLOCK);
|
_wire->setClock(AGS02MA_I2C_CLOCK);
|
||||||
#endif
|
#endif
|
||||||
@ -359,16 +363,19 @@ bool AGS02MA::_writeRegister(uint8_t reg)
|
|||||||
return (_error == 0);
|
return (_error == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uint16_t AGS02MA::_getDataMSB()
|
uint16_t AGS02MA::_getDataMSB()
|
||||||
{
|
{
|
||||||
return (_buffer[0] << 8) + _buffer[1];
|
return (_buffer[0] << 8) + _buffer[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uint16_t AGS02MA::_getDataLSB()
|
uint16_t AGS02MA::_getDataLSB()
|
||||||
{
|
{
|
||||||
return (_buffer[2] << 8) + _buffer[3];
|
return (_buffer[2] << 8) + _buffer[3];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uint8_t AGS02MA::_CRC8(uint8_t * buf, uint8_t size)
|
uint8_t AGS02MA::_CRC8(uint8_t * buf, uint8_t size)
|
||||||
{
|
{
|
||||||
uint8_t crc = 0xFF; // start value
|
uint8_t crc = 0xFF; // start value
|
||||||
@ -391,4 +398,5 @@ uint8_t AGS02MA::_bin2bcd (uint8_t value)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// -- END OF FILE --
|
// -- END OF FILE --
|
||||||
|
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
// FILE: AGS02MA.h
|
// FILE: AGS02MA.h
|
||||||
// AUTHOR: Rob Tillaart, Viktor Balint, Beanow
|
// AUTHOR: Rob Tillaart, Viktor Balint, Beanow
|
||||||
// DATE: 2021-08-12
|
// DATE: 2021-08-12
|
||||||
// VERSION: 0.3.2
|
// VERSION: 0.3.3
|
||||||
// PURPOSE: Arduino library for AGS02MA TVOC
|
// PURPOSE: Arduino library for AGS02MA TVOC sensor
|
||||||
// URL: https://github.com/RobTillaart/AGS02MA
|
// URL: https://github.com/RobTillaart/AGS02MA
|
||||||
//
|
//
|
||||||
|
|
||||||
@ -13,7 +13,7 @@
|
|||||||
#include "Wire.h"
|
#include "Wire.h"
|
||||||
|
|
||||||
|
|
||||||
#define AGS02MA_LIB_VERSION (F("0.3.2"))
|
#define AGS02MA_LIB_VERSION (F("0.3.3"))
|
||||||
|
|
||||||
#define AGS02MA_OK 0
|
#define AGS02MA_OK 0
|
||||||
#define AGS02MA_ERROR -10
|
#define AGS02MA_ERROR -10
|
||||||
@ -142,4 +142,5 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// -- END OF FILE --
|
// -- END OF FILE --
|
||||||
|
|
||||||
|
34
libraries/AGS02MA/CHANGELOG.md
Normal file
34
libraries/AGS02MA/CHANGELOG.md
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
# Change Log AGS02MA
|
||||||
|
|
||||||
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
|
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
||||||
|
and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||||
|
|
||||||
|
|
||||||
|
## [0.3.3] - 2023-01-21
|
||||||
|
- update GitHub actions
|
||||||
|
- update license 2023
|
||||||
|
- update keywords
|
||||||
|
- minor edit readme.md
|
||||||
|
- minor edit code
|
||||||
|
- add CHANGELOG.md (for real)
|
||||||
|
|
||||||
|
|
||||||
|
## [0.3.2] - 2022-10-26
|
||||||
|
- add CHANGELOG.md
|
||||||
|
- add RP2040 in build
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
|
## no info
|
||||||
|
|
||||||
|
- 0.3.1
|
||||||
|
- 0.3.0
|
||||||
|
- 0.2.0
|
||||||
|
- 0.1.4
|
||||||
|
- 0.1.3
|
||||||
|
- 0.1.2
|
||||||
|
- 0.1.1
|
||||||
|
- 0.1.0
|
||||||
|
|
@ -1,6 +1,6 @@
|
|||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2021-2022 Rob Tillaart
|
Copyright (c) 2021-2023 Rob Tillaart
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -19,15 +19,15 @@ Since 0.3.1 this library uses 25 KHz.
|
|||||||
|
|
||||||
### PIN layout from left to right
|
### PIN layout from left to right
|
||||||
|
|
||||||
| Front L->R | Description |
|
| Front L->R | Description |
|
||||||
|:----------:|:------------|
|
|:------------:|:--------------|
|
||||||
| pin 1 | VDD + |
|
| pin 1 | VDD + |
|
||||||
| pin 2 | SDA data |
|
| pin 2 | SDA data |
|
||||||
| pin 3 | GND |
|
| pin 3 | GND |
|
||||||
| pin 4 | SCL clock |
|
| pin 4 | SCL clock |
|
||||||
|
|
||||||
|
|
||||||
### WARNING - LOW SPEED
|
#### WARNING - LOW SPEED
|
||||||
|
|
||||||
The sensor uses I2C at very low speed <= 30 KHz.
|
The sensor uses I2C at very low speed <= 30 KHz.
|
||||||
For an Arduino UNO the lowest speed supported is about 30.4KHz (TWBR = 255) which works.
|
For an Arduino UNO the lowest speed supported is about 30.4KHz (TWBR = 255) which works.
|
||||||
@ -58,7 +58,7 @@ My devices all report version 117 and this version is used to develop / test thi
|
|||||||
There are devices reported with version 118 which behave differently.
|
There are devices reported with version 118 which behave differently.
|
||||||
|
|
||||||
|
|
||||||
### ugM3 not supported
|
#### ugM3 not supported
|
||||||
|
|
||||||
See - https://github.com/RobTillaart/AGS02MA/issues/11
|
See - https://github.com/RobTillaart/AGS02MA/issues/11
|
||||||
|
|
||||||
@ -69,7 +69,7 @@ If you encounter similar problems with setting the mode (any version), please le
|
|||||||
That will help indicating if this is a "structural change" or incident.
|
That will help indicating if this is a "structural change" or incident.
|
||||||
|
|
||||||
|
|
||||||
### Calibrate problem!
|
#### Calibrate problem!
|
||||||
|
|
||||||
See - https://github.com/RobTillaart/AGS02MA/issues/13
|
See - https://github.com/RobTillaart/AGS02MA/issues/13
|
||||||
|
|
||||||
@ -85,7 +85,7 @@ Note: the version 0.2.0 determines the version in the calibration function so
|
|||||||
it won't calibrate any non 117 version.
|
it won't calibrate any non 117 version.
|
||||||
|
|
||||||
|
|
||||||
### Please report your experiences.
|
#### Please report your experiences.
|
||||||
|
|
||||||
If you have a AGS20MA device, version 117 or 118 or other,
|
If you have a AGS20MA device, version 117 or 118 or other,
|
||||||
please let me know your experiences
|
please let me know your experiences
|
||||||
@ -95,7 +95,7 @@ with the sensor and this (or other) library.
|
|||||||
## Interface
|
## Interface
|
||||||
|
|
||||||
|
|
||||||
### Constructor
|
#### Constructor
|
||||||
|
|
||||||
- **AGS02MA(uint8_t deviceAddress = 26, TwoWire \*wire = &Wire)** constructor, with default address and default I2C interface.
|
- **AGS02MA(uint8_t deviceAddress = 26, TwoWire \*wire = &Wire)** constructor, with default address and default I2C interface.
|
||||||
- **bool begin(uint8_t sda, uint8_t scl)** begin for ESP32 and ESP8266.
|
- **bool begin(uint8_t sda, uint8_t scl)** begin for ESP32 and ESP8266.
|
||||||
@ -104,7 +104,7 @@ with the sensor and this (or other) library.
|
|||||||
- **void reset()** reset internal variables.
|
- **void reset()** reset internal variables.
|
||||||
|
|
||||||
|
|
||||||
### Timing
|
#### Timing
|
||||||
|
|
||||||
- **bool isHeated()** returns true if 2 minutes have passed after startup (call of **begin()** ).
|
- **bool isHeated()** returns true if 2 minutes have passed after startup (call of **begin()** ).
|
||||||
Otherwise the device is not optimal ready.
|
Otherwise the device is not optimal ready.
|
||||||
@ -115,7 +115,7 @@ This function allows to implement sort of asynchronous wait.
|
|||||||
One must keep reads at least 1.5 seconds but preferred 3 seconds apart according to the datasheet.
|
One must keep reads at least 1.5 seconds but preferred 3 seconds apart according to the datasheet.
|
||||||
|
|
||||||
|
|
||||||
### Administration
|
#### Administration
|
||||||
|
|
||||||
- **bool setAddress(const uint8_t deviceAddress)** sets a new address for the sensor.
|
- **bool setAddress(const uint8_t deviceAddress)** sets a new address for the sensor.
|
||||||
If function succeeds the address changes immediately and will be persistent over a reboot.
|
If function succeeds the address changes immediately and will be persistent over a reboot.
|
||||||
@ -131,7 +131,7 @@ Serial.println(dd, HEX); // prints YYYYMMDD e.g. 20210203
|
|||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
### I2C clock speed
|
#### I2C clock speed
|
||||||
|
|
||||||
The library sets the clock speed to 25 KHz during operation
|
The library sets the clock speed to 25 KHz during operation
|
||||||
and resets it to 100 KHz after operation.
|
and resets it to 100 KHz after operation.
|
||||||
@ -142,7 +142,7 @@ The following function can change the I2C reset speed to e.g. 200 or 400 KHz.
|
|||||||
- **uint32_t getI2CResetSpeed()** returns the value set. Default is 100 KHz.
|
- **uint32_t getI2CResetSpeed()** returns the value set. Default is 100 KHz.
|
||||||
|
|
||||||
|
|
||||||
### setMode
|
#### setMode
|
||||||
|
|
||||||
The default mode at startup of the sensor is PPB = parts per billion.
|
The default mode at startup of the sensor is PPB = parts per billion.
|
||||||
|
|
||||||
@ -162,7 +162,7 @@ If the gas is unknown, PPB is in my opinion the preferred measurement.
|
|||||||
From an unverified source the following formula:
|
From an unverified source the following formula:
|
||||||
M = molecular weight of the gas.
|
M = molecular weight of the gas.
|
||||||
|
|
||||||
**μg/m3 = (ppb)\*(12.187)\*(M) / (273.15 + °C)**
|
**μg/m3 = ppb \* M \* 12.187 / (273.15 + °C)**
|
||||||
|
|
||||||
Simplified formula for 1 atm @ 25°C:
|
Simplified formula for 1 atm @ 25°C:
|
||||||
|
|
||||||
@ -170,17 +170,17 @@ Simplified formula for 1 atm @ 25°C:
|
|||||||
|
|
||||||
Some known gasses
|
Some known gasses
|
||||||
|
|
||||||
| gas | Common name | ratio ppb-μg/m3 | molecular weight M |
|
| gas | Common name | ratio ppb-μg/m3 | molecular weight M |
|
||||||
|:-----|:------------------|:--------------------|:------------------:|
|
|:-------|:--------------------|:----------------------|:--------------------:|
|
||||||
| SO2 | Sulphur dioxide | 1 ppb = 2.62 μg/m3 | 64 gr/mol |
|
| SO2 | Sulphur dioxide | 1 ppb = 2.62 μg/m3 | 64 gr/mol |
|
||||||
| NO2 | Nitrogen dioxide | 1 ppb = 1.88 μg/m3 | 46 gr/mol |
|
| NO2 | Nitrogen dioxide | 1 ppb = 1.88 μg/m3 | 46 gr/mol |
|
||||||
| NO | Nitrogen monoxide | 1 ppb = 1.25 μg/m3 | 30 gr/mol |
|
| NO | Nitrogen monoxide | 1 ppb = 1.25 μg/m3 | 30 gr/mol |
|
||||||
| O3 | Ozone | 1 ppb = 2.00 μg/m3 | 48 gr/mol |
|
| O3 | Ozone | 1 ppb = 2.00 μg/m3 | 48 gr/mol |
|
||||||
| CO | Carbon Monoxide | 1 ppb = 1.145 μg/m3 | 28 gr/mol |
|
| CO | Carbon Monoxide | 1 ppb = 1.145 μg/m3 | 28 gr/mol |
|
||||||
| C6H6 | Benzene | 1 ppb = 3.19 μg/m3 | 78 gr/mol |
|
| C6H6 | Benzene | 1 ppb = 3.19 μg/m3 | 78 gr/mol |
|
||||||
|
|
||||||
|
|
||||||
### Read the sensor
|
#### Read the sensor
|
||||||
|
|
||||||
WARNING: The datasheet advises to take 3 seconds between reads.
|
WARNING: The datasheet advises to take 3 seconds between reads.
|
||||||
Tests gave stable results at 1.5 second intervals.
|
Tests gave stable results at 1.5 second intervals.
|
||||||
@ -201,15 +201,15 @@ Typical value should be between 0.01 .. 999.99
|
|||||||
- **float readUGF3()** returns microgram per cubic feet.
|
- **float readUGF3()** returns microgram per cubic feet.
|
||||||
|
|
||||||
|
|
||||||
### Error Codes
|
#### Error Codes
|
||||||
|
|
||||||
| ERROR_CODES | value |
|
| ERROR_CODES | value |
|
||||||
|:---------------------------|:-----:|
|
|:----------------------------|:-------:|
|
||||||
| AGS02MA_OK | 0 |
|
| AGS02MA_OK | 0 |
|
||||||
| AGS02MA_ERROR | -10 |
|
| AGS02MA_ERROR | -10 |
|
||||||
| AGS02MA_ERROR_CRC | -11 |
|
| AGS02MA_ERROR_CRC | -11 |
|
||||||
| AGS02MA_ERROR_READ | -12 |
|
| AGS02MA_ERROR_READ | -12 |
|
||||||
| AGS02MA_ERROR_NOT_READY | -13 |
|
| AGS02MA_ERROR_NOT_READY | -13 |
|
||||||
|
|
||||||
|
|
||||||
#### Cached values
|
#### Cached values
|
||||||
@ -219,7 +219,7 @@ Typical value should be between 0.01 .. 999.99
|
|||||||
- **uint32_t lastUGM3()** returns last read UGM3 (microgram per cubic meter) value (cached).
|
- **uint32_t lastUGM3()** returns last read UGM3 (microgram per cubic meter) value (cached).
|
||||||
|
|
||||||
|
|
||||||
### Calibration
|
#### Calibration
|
||||||
|
|
||||||
- **bool zeroCalibration()** to be called after at least 5 minutes in fresh air.
|
- **bool zeroCalibration()** to be called after at least 5 minutes in fresh air.
|
||||||
See example sketch.
|
See example sketch.
|
||||||
@ -231,7 +231,7 @@ To be called after at least 5 minutes in fresh air.
|
|||||||
Returns true on success.
|
Returns true on success.
|
||||||
|
|
||||||
|
|
||||||
### Other
|
#### Other
|
||||||
|
|
||||||
- **bool readRegister(uint8_t address, RegisterData ®)** fills a data struct with the chip's register data at that address.
|
- **bool readRegister(uint8_t address, RegisterData ®)** fills a data struct with the chip's register data at that address.
|
||||||
Primarily intended for troubleshooting and analysis of the sensor. Not recommended to build applications on top of this method's raw data.
|
Primarily intended for troubleshooting and analysis of the sensor. Not recommended to build applications on top of this method's raw data.
|
||||||
@ -249,18 +249,33 @@ Read datasheet or table below for details. A new read is needed to update this.
|
|||||||
|:-----:|:------------------------------------|:--------|
|
|:-----:|:------------------------------------|:--------|
|
||||||
| 7-4 | internal use |
|
| 7-4 | internal use |
|
||||||
| 3-1 | 000 = PPB 001 = uG/M3 |
|
| 3-1 | 000 = PPB 001 = uG/M3 |
|
||||||
| 0 | RDY bit 0 = ready 1 = not ready | 1 == busy
|
| 0 | RDY bit 0 = ready 1 = not ready | 1 == busy
|
||||||
|
|
||||||
|
|
||||||
## Future
|
## Future
|
||||||
|
|
||||||
- test test test ...
|
#### Must
|
||||||
|
|
||||||
|
|
||||||
|
#### Should
|
||||||
|
|
||||||
- improve documentation
|
- improve documentation
|
||||||
- add indicative table for PPB health zone
|
- add indicative table for PPB health zone (source)
|
||||||
- check the mode bits of the status byte with internal \_mode.
|
|
||||||
- elaborate error handling.
|
|
||||||
- create an async interface for **readPPB()** if possible
|
|
||||||
- put the I2C speed code in 2 inline functions
|
- put the I2C speed code in 2 inline functions
|
||||||
- less repeating conditional code places
|
- less repeating conditional code places
|
||||||
- setLowSpeed() + setNormalSpeed()
|
- setLowSpeed() + setNormalSpeed()
|
||||||
|
- check the mode bits of the status byte with internal \_mode.
|
||||||
|
- maximize robustness of state
|
||||||
|
- test with hardware
|
||||||
|
- different gasses ?
|
||||||
|
|
||||||
|
#### Could
|
||||||
|
|
||||||
|
- elaborate error handling.
|
||||||
|
- create an async interface for **readPPB()** if possible
|
||||||
|
- delay(30) blocks performance ==> async version of **readRegister()**
|
||||||
|
- move code to .cpp?
|
||||||
|
|
||||||
|
|
||||||
|
#### Wont
|
||||||
|
|
||||||
|
@ -11,29 +11,41 @@ isConnected KEYWORD2
|
|||||||
reset KEYWORD2
|
reset KEYWORD2
|
||||||
|
|
||||||
isHeated KEYWORD2
|
isHeated KEYWORD2
|
||||||
lastRead KEYWORD2
|
|
||||||
|
|
||||||
setAddress KEYWORD2
|
setAddress KEYWORD2
|
||||||
getAddress KEYWORD2
|
getAddress KEYWORD2
|
||||||
|
|
||||||
getSensorVersion KEYWORD2
|
getSensorVersion KEYWORD2
|
||||||
|
getSensorDate KEYWORD2
|
||||||
|
|
||||||
|
setI2CResetSpeed KEYWORD2
|
||||||
|
getI2CResetSpeed KEYWORD2
|
||||||
|
|
||||||
|
zeroCalibration KEYWORD2
|
||||||
|
manualZeroCalibration KEYWORD2
|
||||||
|
getZeroCalibrationData KEYWORD2
|
||||||
|
|
||||||
setPPBMode KEYWORD2
|
setPPBMode KEYWORD2
|
||||||
setUGM3Mode KEYWORD2
|
setUGM3Mode KEYWORD2
|
||||||
getMode KEYWORD2
|
getMode KEYWORD2
|
||||||
|
|
||||||
readPPM KEYWORD2
|
|
||||||
readPPB KEYWORD2
|
readPPB KEYWORD2
|
||||||
readUGM3 KEYWORD2
|
readUGM3 KEYWORD2
|
||||||
|
readPPM KEYWORD2
|
||||||
|
readMGM3 KEYWORD2
|
||||||
|
readUGF3 KEYWORD2
|
||||||
|
|
||||||
lastPPM KEYWORD2
|
lastPPM KEYWORD2
|
||||||
lastPPB KEYWORD2
|
lastPPB KEYWORD2
|
||||||
lastUGM3 KEYWORD2
|
lastUGM3 KEYWORD2
|
||||||
|
|
||||||
zeroCalibration KEYWORD2
|
lastRead KEYWORD2
|
||||||
lastError KEYWORD2
|
lastError KEYWORD2
|
||||||
lastStatus KEYWORD2
|
lastStatus KEYWORD2
|
||||||
dataReady KEYWORD2
|
dataReady KEYWORD2
|
||||||
|
|
||||||
|
readRegister KEYWORD2
|
||||||
|
|
||||||
# Constants ( LITERAL1)
|
# Constants ( LITERAL1)
|
||||||
AGS02MA_LIB_VERSION LITERAL1
|
AGS02MA_LIB_VERSION LITERAL1
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/RobTillaart/AGS02MA.git"
|
"url": "https://github.com/RobTillaart/AGS02MA.git"
|
||||||
},
|
},
|
||||||
"version": "0.3.2",
|
"version": "0.3.3",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"frameworks": "arduino",
|
"frameworks": "arduino",
|
||||||
"platforms": "*",
|
"platforms": "*",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
name=AGS02MA
|
name=AGS02MA
|
||||||
version=0.3.2
|
version=0.3.3
|
||||||
author=Rob Tillaart <rob.tillaart@gmail.com>
|
author=Rob Tillaart <rob.tillaart@gmail.com>
|
||||||
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
|
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
|
||||||
sentence=Arduino library for AGS02MA - TVOC sensor
|
sentence=Arduino library for AGS02MA - TVOC sensor
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// FILE: unit_test_001.cpp
|
// FILE: unit_test_001.cpp
|
||||||
// AUTHOR: Rob Tillaart
|
// AUTHOR: Rob Tillaart
|
||||||
// DATE: 2021-08-12
|
// DATE: 2021-08-12
|
||||||
// PURPOSE: unit tests for the AGS02NA tvoc sensor
|
// PURPOSE: unit tests for the AGS02NA TVOC sensor
|
||||||
// https://github.com/RobTillaart/AGS02MA
|
// https://github.com/RobTillaart/AGS02MA
|
||||||
// https://github.com/Arduino-CI/arduino_ci/blob/master/REFERENCE.md
|
// https://github.com/Arduino-CI/arduino_ci/blob/master/REFERENCE.md
|
||||||
//
|
//
|
||||||
@ -29,6 +29,7 @@
|
|||||||
// as millis() function is not implemented in
|
// as millis() function is not implemented in
|
||||||
// the Arduino-CI environment
|
// the Arduino-CI environment
|
||||||
|
|
||||||
|
|
||||||
unittest_setup()
|
unittest_setup()
|
||||||
{
|
{
|
||||||
fprintf(stderr, "AGS02MA_LIB_VERSION: %s\n", (char *) AGS02MA_LIB_VERSION);
|
fprintf(stderr, "AGS02MA_LIB_VERSION: %s\n", (char *) AGS02MA_LIB_VERSION);
|
||||||
@ -97,4 +98,4 @@ unittest(test_mode)
|
|||||||
|
|
||||||
unittest_main()
|
unittest_main()
|
||||||
|
|
||||||
// --------
|
// -- END OF FILE --
|
||||||
|
Loading…
Reference in New Issue
Block a user