Files
esp32-zigbee/main/device_config.h
T

83 lines
3.6 KiB
C
Executable File

/* Device Configuration - Permite configurar diferentes tipos de dispositivos Zigbee */
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
/* ========================= SELEÇÃO DO TIPO DE DISPOSITIVO ========================= */
/* Descomente APENAS UMA das opções abaixo para definir o tipo de dispositivo */
// #define DEVICE_TYPE_RELAY /* Relé controlável (on/off light) */
// #define DEVICE_TYPE_TEMP_SENSOR /* Sensor de temperatura e umidade */
// #define DEVICE_TYPE_DOOR_SENSOR /* Sensor de porta/janela */
// #define DEVICE_TYPE_MOTION_SENSOR /* Sensor de movimento */
#define DEVICE_TYPE_COMBO_RELAY_SENSOR /* Relé + Sensor de temperatura/umidade */
/* ========================= CONFIGURAÇÃO DE HARDWARE ========================= */
/* GPIOs comuns (usados por todos os tipos) */
#define GPIO_BUTTON_PAIRING 9 /* Botão para pareamento/factory reset */
#define GPIO_LED_RGB 8 /* LED RGB indicador de status */
/* GPIOs específicos por tipo de dispositivo */
#ifdef DEVICE_TYPE_RELAY
#define GPIO_OUTPUT_RELAY 4 /* Relé de saída */
#define HAS_BUTTON_TOGGLE 1 /* Botão também faz toggle do relé */
#endif
#ifdef DEVICE_TYPE_TEMP_SENSOR
#define GPIO_SENSOR_DHT11 5 /* GPIO para DHT11 (DATA pin) */
#define SENSOR_UPDATE_INTERVAL 10000 /* Intervalo de atualização em ms (mín. 1s para DHT11) */
#endif
#ifdef DEVICE_TYPE_DOOR_SENSOR
#define GPIO_SENSOR_REED 5 /* Reed switch para sensor de porta */
#define HAS_TAMPER_DETECTION 0 /* Detecção de violação (anti-tamper) */
#endif
#ifdef DEVICE_TYPE_MOTION_SENSOR
#define GPIO_SENSOR_PIR 5 /* Sensor PIR para detecção de movimento */
#define PIR_TIMEOUT_MS 60000 /* Timeout para resetar movimento detectado */
#endif
#ifdef DEVICE_TYPE_COMBO_RELAY_SENSOR
#define GPIO_OUTPUT_RELAY 4 /* Relé de saída */
#define GPIO_SENSOR_DHT11 5 /* GPIO para DHT11 (DATA pin) */
#define SENSOR_UPDATE_INTERVAL 10000 /* Intervalo de atualização em ms */
#define HAS_BUTTON_TOGGLE 1 /* Botão também faz toggle do relé */
#endif
/* ========================= FUNCIONALIDADES OPCIONAIS ========================= */
#define FEATURE_LED_INDICATOR 1 /* Habilita LED RGB indicador */
#define FEATURE_LONG_PRESS_RESET 1 /* Habilita factory reset por long press (5s) */
#define FEATURE_OTA_UPDATE 0 /* Habilita atualização Over-The-Air */
/* ========================= CONFIGURAÇÕES AVANÇADAS ========================= */
#define BUTTON_LONG_PRESS_MS 5000 /* Tempo para long press (factory reset) */
#define LED_BRIGHTNESS_NORMAL 50 /* Brilho normal do LED (0-255) */
#define LED_BRIGHTNESS_DIM 10 /* Brilho reduzido do LED (0-255) */
/* ========================= VALIDAÇÃO ========================= */
/* Verifica se pelo menos um tipo de dispositivo foi selecionado */
#if !defined(DEVICE_TYPE_RELAY) && !defined(DEVICE_TYPE_TEMP_SENSOR) && \
!defined(DEVICE_TYPE_DOOR_SENSOR) && !defined(DEVICE_TYPE_MOTION_SENSOR) && \
!defined(DEVICE_TYPE_COMBO_RELAY_SENSOR)
#error "Nenhum tipo de dispositivo selecionado! Defina um DEVICE_TYPE_* em device_config.h"
#endif
/* Verifica se mais de um tipo foi selecionado */
#if (defined(DEVICE_TYPE_RELAY) + defined(DEVICE_TYPE_TEMP_SENSOR) + \
defined(DEVICE_TYPE_DOOR_SENSOR) + defined(DEVICE_TYPE_MOTION_SENSOR) + \
defined(DEVICE_TYPE_COMBO_RELAY_SENSOR)) > 1
#error "Múltiplos tipos de dispositivo selecionados! Defina apenas um DEVICE_TYPE_*"
#endif
#ifdef __cplusplus
}
#endif