Sentinel
Loading...
Searching...
No Matches
gasTask.cpp File Reference

Gas Task Implementation File. More...

#include "tasks/gasTask.h"
#include "SensorData.h"
#include "sensors/mq2.h"
#include "utils/threadsafe_serial.h"
#include <Arduino.h>
#include <cmath>
#include <cstring>

Macros

#define QUEUE_SEND_TIMEOUT_MS   1000
 
#define NETWORK_CONNECTED_BIT   BIT0
 

Functions

void sendGasData (const sensor_message_t &msg)
 Send Gas Data.
 
void gasTask (void *parameter)
 Gas Task function.
 

Variables

QueueHandle_t dataQueue
 
EventGroupHandle_t networkEventGroup
 
SemaphoreHandle_t networkEventMutex
 

Detailed Description

Gas Task Implementation File.

This file contains the implementation of the gasTask function, which is used to handle gas sensor operations in a FreeRTOS task. The task is responsible for reading gas concentration data from the MQ2 sensor and sending it to a queue for processing.

Function Documentation

◆ gasTask()

void gasTask ( void * parameter)

Gas Task function.

This function handles gas sensor operations in a FreeRTOS task. It reads gas concentration data from the MQ2 sensor and sends it to a queue for processing. The task runs in an infinite loop, waiting for data to be available in the queue. When data is received, it is sent to the network for processing. The task uses the MQ2 sensor to measure gas concentration in parts per million (PPM) and sends the data to a queue.

Parameters
parameter

◆ sendGasData()

void sendGasData ( const sensor_message_t & msg)

Send Gas Data.

Parameters
msg