Refactor GPS and MQ7 sensor implementations: update function signatures, improve initialization, and streamline data reading logic
This commit is contained in:
@@ -9,4 +9,5 @@ struct GPSData_t
|
||||
float lon;
|
||||
};
|
||||
|
||||
void GPS_Init();
|
||||
GPSData_t GPS_Read();
|
||||
@@ -1,23 +1,15 @@
|
||||
#include <Arduino.h>
|
||||
|
||||
#define MQ7_PIN 34
|
||||
#define VCC 5.0
|
||||
#define ADC_RES 1023.0
|
||||
#define RL 10000.0 // 10kΩ
|
||||
#define RO 10000.0 // Resistencia del aire limpio
|
||||
#define RELAY_CONTROL_PIN 2
|
||||
#define MAX_SAMPLES 90
|
||||
|
||||
enum MQ7State_t
|
||||
{
|
||||
HEATING, SAMPLING
|
||||
};
|
||||
#define MQ7_A0 34
|
||||
#define MQ7_D0 35
|
||||
#define R0 20000
|
||||
#define RL 10000
|
||||
|
||||
struct MQ7Data_t
|
||||
{
|
||||
float co;
|
||||
bool threshold;
|
||||
};
|
||||
|
||||
void MQ7_Init();
|
||||
bool MQ7_Update();
|
||||
MQ7Data_t MQ7_Read();
|
||||
@@ -4,6 +4,11 @@
|
||||
#define REST_PORT 443
|
||||
#define MQTT_PORT 1883
|
||||
|
||||
#define MQ7_ID 1
|
||||
#define BME280_ID 2
|
||||
#define GPS_ID 3
|
||||
#define MAX7219_ID 1
|
||||
|
||||
#include "JsonTools.hpp"
|
||||
#include "RestClient.hpp"
|
||||
#include "WifiConnection.hpp"
|
||||
@@ -28,7 +33,7 @@ enum AirQualityStatus {
|
||||
BAD
|
||||
};
|
||||
|
||||
void processMQ7();
|
||||
void readMQ7();
|
||||
void readBME280();
|
||||
void readGPS();
|
||||
void writeMatrix(const char* message);
|
||||
|
||||
Reference in New Issue
Block a user