Skip to content

File Alarma.cpp

FileList > firmware > Alarma.cpp

Go to the source code of this file

Implementation of functions for alarm management and data averaging. More...

  • #include "Alarma.h"
  • #include "Configuracion.h"
  • #include "Debug.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.

Public Static Functions

Type Name
void imprimir_hora (void)
Prints the current time to the serial port (for debugging).

Detailed Description

Author:

[ALD-DSL/ATARI_RESEARCH_LAB]

Date:

[2025-07-22]

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()'.


Public Static Functions Documentation

function imprimir_hora

Prints the current time to the serial port (for debugging).

static inline void imprimir_hora (
    void
) 

Note:

Private function (no prototype).



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