Skip to content

TinyMeasurement CONFIGURATION

Info

This header file configures the entire TinyMeasurement module, and each submodule includes this header file. It defines the configuration options and macros for TinyMeasurement, allowing users to customize settings as needed. By modifying the configuration options in this header file, users can easily adjust the behavior and functionality of TinyMeasurement to meet specific requirements. The documentation update speed is slow and may not be consistent with the actual code, please refer to the actual code.

Overview

The tiny_measurement_config.h header file contains all configuration macros for the TinyMeasurement middleware. All configuration options use the #ifndef pattern, which means you can override any default value by defining the macro before including this header file.

Configuration Categories

Online Sensing Configuration

These macros control the default behavior of online sensing operations:

  • Sampling Frequency: Default rate for continuous data acquisition (0.1 - 300 Hz, default: 1.0 Hz, practical limit: ~200 Hz, primarily constrained by MQTT transmission bandwidth)
  • MQTT Transmission: Enable/disable automatic MQTT data transmission
  • Serial Output: Enable/disable console output via printf and ESP_LOG
  • LCD Display: Optional LCD display support (requires compilation flag)

Offline Sensing Configuration

These macros control high-frequency batch data collection:

  • Sampling Frequency: Higher default rate for offline collection (1 - 4000 Hz)
  • Sampling Duration: How long to collect data (0.1 - 3600 seconds)
  • Storage Options: Enable/disable SD card and memory buffer storage
  • MQTT Report: Enable/disable MQTT reporting after sampling completes

Customization

To customize any default value, define the macro before including the header:

// Override default online sensing frequency
#define TINY_MEASUREMENT_ONLINE_SENSING_DEFAULT_FREQ_HZ 10.0f

#include "tiny_measurement.h"
/**
 * @file tiny_measurement_config.h
 * @author SHUAIWEN CUI (SHUAIWEN001@e.ntu.edu.sg)
 * @brief The configuration file for the tiny_measurement middleware.
 * @version 1.0
 * @date 2025-12-17
 * @copyright Copyright (c) 2025
 *
 */

#pragma once

/* DEPENDENCIES */

// lower level dependencies
#include "tiny_ai.h"

#ifdef __cplusplus
extern "C"
{
#endif

/* ============================================================================
 * ONLINE SENSING CONFIGURATION MACROS
 * ============================================================================ */

/**
 * @brief Default sampling frequency for online sensing (Hz)
 * @note Valid range: 0.1 - 300 Hz
 * @note Default: 1.0 Hz
 */
#ifndef TINY_MEASUREMENT_ONLINE_SENSING_DEFAULT_FREQ_HZ
#define TINY_MEASUREMENT_ONLINE_SENSING_DEFAULT_FREQ_HZ 1.0f
#endif

/**
 * @brief Default MQTT transmission enable state for online sensing
 * @note true: Enable MQTT transmission
 * @note false: Disable MQTT transmission
 * @note Default: true
 */
#ifndef TINY_MEASUREMENT_ONLINE_SENSING_DEFAULT_ENABLE_MQTT
#define TINY_MEASUREMENT_ONLINE_SENSING_DEFAULT_ENABLE_MQTT true
#endif

/**
 * @brief Default serial output enable state for online sensing
 * @note true: Enable serial output (printf and ESP_LOG)
 * @note false: Disable serial output
 * @note Default: true
 */
#ifndef TINY_MEASUREMENT_ONLINE_SENSING_DEFAULT_ENABLE_SERIAL
#define TINY_MEASUREMENT_ONLINE_SENSING_DEFAULT_ENABLE_SERIAL true
#endif

/* ============================================================================
 * LCD DISPLAY FEATURE COMPILATION CONTROL
 * ============================================================================ */

/**
 * @brief Enable LCD display feature compilation
 * @note Define this macro to enable LCD display support in online sensing
 * @note If not defined, all LCD-related code will be excluded from compilation
 * @note Default: NOT DEFINED (LCD feature disabled by default)
 * @note To enable: Add -DTINY_MEASUREMENT_ENABLE_LCD to compiler flags
 */
#ifdef TINY_MEASUREMENT_ENABLE_LCD
/**
 * @brief Default LCD display enable state for online sensing
 * @note Only available when TINY_MEASUREMENT_ENABLE_LCD is defined
 * @note true: Enable LCD display output
 * @note false: Disable LCD display output
 * @note Default: false
 */
#ifndef TINY_MEASUREMENT_ONLINE_SENSING_DEFAULT_ENABLE_LCD
#define TINY_MEASUREMENT_ONLINE_SENSING_DEFAULT_ENABLE_LCD true
#endif
#endif /* TINY_MEASUREMENT_ENABLE_LCD */

/* ============================================================================
 * OFFLINE SENSING CONFIGURATION MACROS
 * ============================================================================ */

/**
 * @brief Default sampling frequency for offline sensing (Hz)
 * @note Valid range: 1 - 4000 Hz (higher than online sensing for offline data collection)
 * @note Default: 100.0 Hz (high frequency for offline sensing)
 */
#ifndef TINY_MEASUREMENT_OFFLINE_SENSING_DEFAULT_FREQ_HZ
#define TINY_MEASUREMENT_OFFLINE_SENSING_DEFAULT_FREQ_HZ 100.0f
#endif

/**
 * @brief Default sampling duration for offline sensing (seconds)
 * @note Valid range: 0.1 - 3600 seconds
 * @note Default: 10.0 seconds
 */
#ifndef TINY_MEASUREMENT_OFFLINE_SENSING_DEFAULT_DURATION_SEC
#define TINY_MEASUREMENT_OFFLINE_SENSING_DEFAULT_DURATION_SEC 10.0f
#endif

/**
 * @brief Default SD card storage enable state for offline sensing
 * @note true: Enable SD card storage
 * @note false: Disable SD card storage (only memory buffer)
 * @note Default: true
 */
#ifndef TINY_MEASUREMENT_OFFLINE_SENSING_DEFAULT_ENABLE_SD
#define TINY_MEASUREMENT_OFFLINE_SENSING_DEFAULT_ENABLE_SD true
#endif

/**
 * @brief Default memory buffer storage enable state for offline sensing
 * @note true: Enable memory buffer storage
 * @note false: Disable memory buffer storage (only SD card)
 * @note Default: true
 */
#ifndef TINY_MEASUREMENT_OFFLINE_SENSING_DEFAULT_ENABLE_MEMORY
#define TINY_MEASUREMENT_OFFLINE_SENSING_DEFAULT_ENABLE_MEMORY true
#endif

/**
 * @brief Default MQTT report enable state for offline sensing
 * @note true: Enable MQTT report after sampling
 * @note false: Disable MQTT report
 * @note Default: true
 */
#ifndef TINY_MEASUREMENT_OFFLINE_SENSING_DEFAULT_ENABLE_MQTT_REPORT
#define TINY_MEASUREMENT_OFFLINE_SENSING_DEFAULT_ENABLE_MQTT_REPORT true
#endif

#ifdef __cplusplus
}
#endif