Refactor includes
This commit is contained in:
@ -1,10 +1,5 @@
|
|||||||
#ifndef __MGOS_PROMETHEUS_SENSORS_H
|
#pragma once
|
||||||
#define __MGOS_PROMETHEUS_SENSORS_H
|
|
||||||
|
|
||||||
#include "mgos.h"
|
#include "mgos.h"
|
||||||
#include "mgos_gpio.h"
|
#include "mgos_config.h"
|
||||||
|
#include "mgos_prometheus_metrics.h"
|
||||||
float mgos_prometheus_sensors_dht_get_temp(uint8_t idx);
|
|
||||||
float mgos_prometheus_sensors_dht_get_humidity(uint8_t idx);
|
|
||||||
|
|
||||||
#endif // __MGOS_PROMETHEUS_SENSORS_H
|
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
#ifdef MGOS_HAVE_BAROMETER
|
#ifdef MGOS_HAVE_BAROMETER
|
||||||
#include "mgos_barometer.h"
|
#include "mgos_barometer.h"
|
||||||
#include "mgos_config.h"
|
|
||||||
#include "mgos_prometheus_metrics.h"
|
|
||||||
#include "mgos_prometheus_sensors.h"
|
#include "mgos_prometheus_sensors.h"
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
#ifdef MGOS_HAVE_BME280
|
#ifdef MGOS_HAVE_BME280
|
||||||
#include "mgos_bme280.h"
|
#include "mgos_bme280.h"
|
||||||
#include "mgos_config.h"
|
|
||||||
#include "mgos_prometheus_metrics.h"
|
|
||||||
#include "mgos_prometheus_sensors.h"
|
#include "mgos_prometheus_sensors.h"
|
||||||
|
|
||||||
static struct mgos_bme280 * s_bme280;
|
static struct mgos_bme280 * s_bme280;
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
#ifdef MGOS_HAVE_CCS811_I2C
|
#ifdef MGOS_HAVE_CCS811_I2C
|
||||||
#include "mgos_ccs811.h"
|
#include "mgos_ccs811.h"
|
||||||
#include "mgos_config.h"
|
|
||||||
#include "mgos_prometheus_metrics.h"
|
|
||||||
#include "mgos_prometheus_sensors.h"
|
#include "mgos_prometheus_sensors.h"
|
||||||
|
|
||||||
static struct mgos_ccs811 *s_ccs811;
|
static struct mgos_ccs811 *s_ccs811;
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
#ifdef MGOS_HAVE_DHT
|
#ifdef MGOS_HAVE_DHT
|
||||||
#include "mgos_dht.h"
|
#include "mgos_dht.h"
|
||||||
#include "mgos_config.h"
|
|
||||||
#include "mgos_prometheus_metrics.h"
|
|
||||||
#include "mgos_prometheus_sensors.h"
|
#include "mgos_prometheus_sensors.h"
|
||||||
|
|
||||||
#define MAX_DHT 8
|
#define MAX_DHT 8
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
#ifdef MGOS_HAVE_HTU21DF_I2C
|
#ifdef MGOS_HAVE_HTU21DF_I2C
|
||||||
#include "mgos_htu21df.h"
|
#include "mgos_htu21df.h"
|
||||||
#include "mgos_config.h"
|
|
||||||
#include "mgos_prometheus_metrics.h"
|
|
||||||
#include "mgos_prometheus_sensors.h"
|
#include "mgos_prometheus_sensors.h"
|
||||||
|
|
||||||
static struct mgos_htu21df *s_htu21df;
|
static struct mgos_htu21df *s_htu21df;
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
#ifdef MGOS_HAVE_MCP9808_I2C
|
#ifdef MGOS_HAVE_MCP9808_I2C
|
||||||
#include "mgos_mcp9808.h"
|
#include "mgos_mcp9808.h"
|
||||||
#include "mgos_config.h"
|
|
||||||
#include "mgos_prometheus_metrics.h"
|
|
||||||
#include "mgos_prometheus_sensors.h"
|
#include "mgos_prometheus_sensors.h"
|
||||||
|
|
||||||
static struct mgos_mcp9808 *s_mcp9808;
|
static struct mgos_mcp9808 *s_mcp9808;
|
||||||
|
@ -1,16 +1,4 @@
|
|||||||
#include "mgos_config.h"
|
#include "mgos_prometheus_sensors_internal.h"
|
||||||
#include "mgos_prometheus_metrics.h"
|
|
||||||
#include "mgos_prometheus_sensors.h"
|
|
||||||
|
|
||||||
void dht_drv_init();
|
|
||||||
void veml6075_drv_init();
|
|
||||||
void bme280_drv_init();
|
|
||||||
void sht31_drv_init();
|
|
||||||
void si7021_drv_init();
|
|
||||||
void htu21df_drv_init();
|
|
||||||
void mcp9808_drv_init();
|
|
||||||
void ccs811_drv_init();
|
|
||||||
void barometer_drv_init();
|
|
||||||
|
|
||||||
static void pushgateway_timer(void *user_data) {
|
static void pushgateway_timer(void *user_data) {
|
||||||
mgos_prometheus_metrics_push(MGOS_APP, mgos_sys_config_get_device_id());
|
mgos_prometheus_metrics_push(MGOS_APP, mgos_sys_config_get_device_id());
|
||||||
|
14
src/mgos_prometheus_sensors_internal.h
Normal file
14
src/mgos_prometheus_sensors_internal.h
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "mgos.h"
|
||||||
|
#include "mgos_prometheus_sensors.h"
|
||||||
|
|
||||||
|
void dht_drv_init();
|
||||||
|
void veml6075_drv_init();
|
||||||
|
void bme280_drv_init();
|
||||||
|
void sht31_drv_init();
|
||||||
|
void si7021_drv_init();
|
||||||
|
void htu21df_drv_init();
|
||||||
|
void mcp9808_drv_init();
|
||||||
|
void ccs811_drv_init();
|
||||||
|
void barometer_drv_init();
|
@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
#ifdef MGOS_HAVE_SHT31_I2C
|
#ifdef MGOS_HAVE_SHT31_I2C
|
||||||
#include "mgos_sht31.h"
|
#include "mgos_sht31.h"
|
||||||
#include "mgos_config.h"
|
|
||||||
#include "mgos_prometheus_metrics.h"
|
|
||||||
#include "mgos_prometheus_sensors.h"
|
#include "mgos_prometheus_sensors.h"
|
||||||
|
|
||||||
static struct mgos_sht31 *s_sht31;
|
static struct mgos_sht31 *s_sht31;
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
#ifdef MGOS_HAVE_SI7021_I2C
|
#ifdef MGOS_HAVE_SI7021_I2C
|
||||||
#include "mgos_si7021.h"
|
#include "mgos_si7021.h"
|
||||||
#include "mgos_config.h"
|
|
||||||
#include "mgos_prometheus_metrics.h"
|
|
||||||
#include "mgos_prometheus_sensors.h"
|
#include "mgos_prometheus_sensors.h"
|
||||||
|
|
||||||
static struct mgos_si7021 *s_si7021;
|
static struct mgos_si7021 *s_si7021;
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
#ifdef MGOS_HAVE_VEML6075_I2C
|
#ifdef MGOS_HAVE_VEML6075_I2C
|
||||||
#include "mgos_veml6075.h"
|
#include "mgos_veml6075.h"
|
||||||
#include "mgos_config.h"
|
|
||||||
#include "mgos_prometheus_metrics.h"
|
|
||||||
#include "mgos_prometheus_sensors.h"
|
#include "mgos_prometheus_sensors.h"
|
||||||
|
|
||||||
static struct mgos_veml6075 *s_veml6075;
|
static struct mgos_veml6075 *s_veml6075;
|
||||||
|
Reference in New Issue
Block a user