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

DHT Task Implementation File. More...

#include "tasks/dhtTask.h"
#include "SensorData.h"
#include "sensors/dht22.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
 
#define DHT_MIN_TEMP   -40.0f
 
#define DHT_MAX_TEMP   80.0f
 
#define DHT_MIN_HUM   0.0f
 
#define DHT_MAX_HUM   100.0f
 

Functions

bool isValidDHTReading (float temp, float hum)
 Check if DHT reading is valid.
 
void sendDHTData (const sensor_message_t &msg)
 
void dhtTask (void *parameter)
 DHT Task function.
 

Variables

QueueHandle_t dataQueue
 
EventGroupHandle_t networkEventGroup
 
SemaphoreHandle_t networkEventMutex
 

Detailed Description

DHT Task Implementation File.

This file contains the implementation of the dhtTask function, which is used to handle DHT sensor operations in a FreeRTOS task. The task is responsible for reading temperature and humidity data from the DHT sensor and sending it to a queue for processing.

Function Documentation

◆ dhtTask()

void dhtTask ( void * parameter)

DHT Task function.

This function handles DHT sensor operations in a FreeRTOS task. It reads temperature and humidity data from the DHT 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.

◆ isValidDHTReading()

bool isValidDHTReading ( float temp,
float hum )

Check if DHT reading is valid.

Parameters
temp
hum
Returns
true
false