Skip to content

File Alarma.h

FileList > firmware > Alarma.h

Go to the source code of this file

Header for timed alarm and data averaging management. More...

  • #include <Arduino.h>
  • #include "DS3231M.h"

Public Functions

Type Name
void acumular_datos (void)
Reads data from all sensors and accumulates them for averaging.
void check_alarma_10min (void)
Verifies if the 10-minute cycle has completed. If so, activates the alarma_10min flag.
void check_alarma_5s (void)
Checks if 5 seconds have passed using millis(). If so, activates the alarma_5s flag.
void promediar_datos (void)
Processes accumulated data to calculate averages and stores them.
void reset_acumuladores (void)
Resets counters and accumulators.
void rtc_alarma_inicializar (void)
Initializes the RTC module and configures the first 10-minute alarm.

Detailed Description

Declares functions and global variables to control periodic tasks (e.g., every 5s, every 10min) and to handle sensor data.

Author:

[ALD-DSL/ATARI_RESEARCH_LAB]

Date:

[2024-07-22/2025-10-15]

Version:

2.0

Copyright:

GNU General Public License version 3 or later

Public Functions Documentation

function acumular_datos

Reads data from all sensors and accumulates them for averaging.

void acumular_datos (
    void
) 

Calls the reading functions of the SEN55 and T6793 modules and adds their values to the corresponding sum_* accumulators. Increments the averaging counters.


function check_alarma_10min

Verifies if the 10-minute cycle has completed. If so, activates the alarma_10min flag.

void check_alarma_10min (
    void
) 

Checks the RTC time to see if the next 10-minute interval has been reached (e.g., 12:10, 12:20).

Note:

Must be called continuously in the main loop.


function check_alarma_5s

Checks if 5 seconds have passed using millis(). If so, activates the alarma_5s flag.

void check_alarma_5s (
    void
) 

Note:

Must be called continuously in the main loop.


function promediar_datos

Processes accumulated data to calculate averages and stores them.

void promediar_datos (
    void
) 

This function is called at the end of each averaging period (e.g., every 10 minutes) and the averages are stored in the corresponding avg_* variables.


function reset_acumuladores

Resets counters and accumulators.

void reset_acumuladores (
    void
) 


function rtc_alarma_inicializar

Initializes the RTC module and configures the first 10-minute alarm.

void rtc_alarma_inicializar (
    void
) 

Configures the RTC with initial date and time if necessary, or synchronizes it. This function must be called in 'setup()'.



The documentation for this class was generated from the following file firmware/Alarma.h