2024-02-03 10:46:26 +07:00
|
|
|
#ifndef _AIR_GRADIENT_H_
|
|
|
|
#define _AIR_GRADIENT_H_
|
|
|
|
|
2024-02-17 13:17:45 +07:00
|
|
|
#include "Display/Display.h"
|
|
|
|
#include "Main/BoardDef.h"
|
|
|
|
#include "Main/HardwareWatchdog.h"
|
|
|
|
#include "Main/LedBar.h"
|
|
|
|
#include "Main/PushButton.h"
|
|
|
|
#include "Main/StatusLed.h"
|
|
|
|
#include "PMS/PMS5003.h"
|
|
|
|
#include "PMS/PMS5003T.h"
|
|
|
|
#include "S8/S8.h"
|
|
|
|
#include "Sgp41/Sgp41.h"
|
|
|
|
#include "Sht/Sht.h"
|
2024-02-03 10:46:26 +07:00
|
|
|
|
2024-03-30 19:33:03 +07:00
|
|
|
/**
|
|
|
|
* @brief RGB LED bar mode for ONE_INDOOR board
|
|
|
|
*/
|
2024-04-03 07:04:55 +07:00
|
|
|
enum LedBarMode {
|
|
|
|
/** Don't use LED bar */
|
|
|
|
LedBarModeOff,
|
|
|
|
|
|
|
|
/** Use LED bar for show PM2.5 value level */
|
|
|
|
LedBarModePm,
|
|
|
|
|
|
|
|
/** Use LED bar for show CO2 value level */
|
|
|
|
LedBarModeCO2,
|
2024-03-30 19:33:03 +07:00
|
|
|
};
|
|
|
|
|
2024-04-01 09:15:10 +07:00
|
|
|
enum ConfigurationControl {
|
2024-04-03 07:04:55 +07:00
|
|
|
/** Allow set configuration from local over device HTTP server */
|
|
|
|
ConfigurationControlLocal,
|
|
|
|
|
|
|
|
/** Allow set configuration from Airgradient cloud */
|
|
|
|
ConfigurationControlCloud,
|
|
|
|
|
|
|
|
/** Allow set configuration from Local and Cloud */
|
|
|
|
ConfigurationControlBoth
|
|
|
|
};
|
|
|
|
|
|
|
|
enum AgFirmwareMode {
|
|
|
|
FW_MODE_I_9PSL, /** ONE_INDOOR */
|
|
|
|
FW_MODE_O_1PST, /** PMS5003T, S8 and SGP41 */
|
|
|
|
FW_MODE_O_1PPT, /** PMS5003T_1, PMS5003T_2, SGP41 */
|
|
|
|
FW_MODE_O_1PP, /** PMS5003T_1, PMS5003T_2 */
|
|
|
|
FW_MDOE_O_1PS /** PMS5003T, S8 */
|
2024-04-01 09:15:10 +07:00
|
|
|
};
|
2024-04-03 07:04:55 +07:00
|
|
|
const char* AgFirmwareModeName(AgFirmwareMode mode);
|
2024-04-01 09:15:10 +07:00
|
|
|
|
2024-02-04 15:04:38 +07:00
|
|
|
/**
|
|
|
|
* @brief Class with define all the sensor has supported by Airgradient. Each
|
|
|
|
* sensor usage must be init before use.
|
|
|
|
*/
|
2024-02-03 10:46:26 +07:00
|
|
|
class AirGradient {
|
|
|
|
public:
|
|
|
|
AirGradient(BoardType type);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Plantower PMS5003 sensor
|
|
|
|
*/
|
|
|
|
PMS5003 pms5003;
|
2024-02-04 15:04:38 +07:00
|
|
|
/**
|
2024-02-04 15:22:06 +07:00
|
|
|
* @brief Plantower PMS5003T sensor: connect to PM1 connector on
|
|
|
|
* OPEN_AIR_OUTDOOR.
|
2024-02-04 15:04:38 +07:00
|
|
|
*/
|
2024-02-03 10:46:26 +07:00
|
|
|
PMS5003T pms5003t_1;
|
2024-02-04 15:04:38 +07:00
|
|
|
/**
|
2024-02-04 15:22:06 +07:00
|
|
|
* @brief Plantower PMS5003T sensor: connect to PM2 connector on
|
|
|
|
* OPEN_AIR_OUTDOOR.
|
2024-02-04 15:04:38 +07:00
|
|
|
*/
|
2024-02-03 10:46:26 +07:00
|
|
|
PMS5003T pms5003t_2;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief SenseAirS8 CO2 sensor
|
|
|
|
*/
|
|
|
|
S8 s8;
|
|
|
|
|
|
|
|
/**
|
2024-02-10 21:14:27 +07:00
|
|
|
* @brief Temperature and humidity sensor supported SHT3x and SHT4x
|
|
|
|
*
|
2024-02-06 09:38:37 +07:00
|
|
|
*/
|
2024-02-10 21:14:27 +07:00
|
|
|
Sht sht;
|
2024-02-03 10:46:26 +07:00
|
|
|
|
|
|
|
/**
|
2024-02-04 15:04:38 +07:00
|
|
|
* @brief SGP41 TVOC and NOx sensor
|
2024-02-03 10:46:26 +07:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
Sgp41 sgp41;
|
|
|
|
|
|
|
|
/**
|
2024-02-04 15:04:38 +07:00
|
|
|
* @brief OLED Display
|
2024-02-03 10:46:26 +07:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
Display display;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Push Button
|
|
|
|
*/
|
|
|
|
PushButton button;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief LED
|
|
|
|
*/
|
|
|
|
StatusLed statusLed;
|
2024-02-04 15:04:38 +07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief RGB LED array
|
2024-02-04 15:22:06 +07:00
|
|
|
*
|
2024-02-04 15:04:38 +07:00
|
|
|
*/
|
2024-02-03 10:46:26 +07:00
|
|
|
LedBar ledBar;
|
|
|
|
|
|
|
|
/**
|
2024-02-04 15:04:38 +07:00
|
|
|
* @brief External hardware watchdog
|
2024-02-03 10:46:26 +07:00
|
|
|
*/
|
|
|
|
HardwareWatchdog watchdog;
|
|
|
|
|
2024-02-04 15:04:38 +07:00
|
|
|
/**
|
|
|
|
* @brief Get I2C SDA pin has of board supported
|
2024-02-04 15:22:06 +07:00
|
|
|
*
|
2024-02-04 15:04:38 +07:00
|
|
|
* @return int Pin number if -1 invalid
|
|
|
|
*/
|
2024-02-03 10:46:26 +07:00
|
|
|
int getI2cSdaPin(void);
|
2024-02-04 15:04:38 +07:00
|
|
|
/**
|
|
|
|
* @brief Get I2C SCL pin has of board supported
|
2024-02-04 15:22:06 +07:00
|
|
|
*
|
2024-02-04 15:04:38 +07:00
|
|
|
* @return int Pin number if -1 invalid
|
|
|
|
*/
|
2024-02-03 10:46:26 +07:00
|
|
|
int getI2cSclPin(void);
|
|
|
|
|
2024-02-04 15:04:38 +07:00
|
|
|
/**
|
|
|
|
* @brief Get the Board Type
|
2024-02-04 15:22:06 +07:00
|
|
|
*
|
2024-02-04 15:04:38 +07:00
|
|
|
* @return BoardType @ref BoardType
|
|
|
|
*/
|
2024-02-03 10:46:26 +07:00
|
|
|
BoardType getBoardType(void);
|
|
|
|
|
2024-02-04 15:04:38 +07:00
|
|
|
/**
|
|
|
|
* @brief Get the library version string
|
2024-02-04 15:22:06 +07:00
|
|
|
*
|
|
|
|
* @return String
|
2024-02-04 15:04:38 +07:00
|
|
|
*/
|
2024-02-03 10:46:26 +07:00
|
|
|
String getVersion(void);
|
|
|
|
|
2024-02-29 10:22:05 +07:00
|
|
|
/**
|
|
|
|
* @brief Get the Board Name object
|
2024-03-30 19:33:03 +07:00
|
|
|
*
|
|
|
|
* @return String
|
2024-02-29 10:22:05 +07:00
|
|
|
*/
|
|
|
|
String getBoardName(void);
|
|
|
|
|
2024-02-17 12:47:51 +07:00
|
|
|
/**
|
|
|
|
* @brief Round double value with for 2 decimal
|
2024-03-30 19:33:03 +07:00
|
|
|
*
|
2024-02-17 12:47:51 +07:00
|
|
|
* @param valuem Round value
|
2024-03-30 19:33:03 +07:00
|
|
|
* @return double
|
2024-02-17 12:47:51 +07:00
|
|
|
*/
|
|
|
|
double round2(double value);
|
|
|
|
|
2024-02-03 10:46:26 +07:00
|
|
|
private:
|
|
|
|
BoardType boardType;
|
|
|
|
};
|
|
|
|
|
2024-04-03 11:40:46 +07:00
|
|
|
#include "AgConfigure.h"
|
|
|
|
#include "AgApiClient.h"
|
|
|
|
#include "AgSchedule.h"
|
|
|
|
#include "MqttClient.h"
|
|
|
|
#include "AgStateMachine.h"
|
|
|
|
|
2024-02-03 10:46:26 +07:00
|
|
|
#endif /** _AIR_GRADIENT_H_ */
|