cud-iot-v3/src/config.hpp

91 lines
3.1 KiB
C++

#pragma once
#include "constants.hpp"
/***********************************************
* Variants *
***********************************************/
// @note You can use -D flag to define the variant and comment out the line below
#define AC_TYPE AC_TYPE_M3M4M5M6
/***********************************************
* Pin Definitions *
***********************************************/
// There are 4 rows of lights
#define LIGHT_ROW_1_PIN 0
#define LIGHT_ROW_2_PIN 1
#define LIGHT_ROW_3_PIN 2
#define LIGHT_ROW_4_PIN 3
// There are 3 rows of fans
#define FAN_ROW_1_PIN 4
#define FAN_ROW_2_PIN 5
#define FAN_ROW_3_PIN 6
// There are one power relay for the air purifier
#define AIR_PURIFIER_PIN 7
// There are one power relay for the mosquito zapper
#define MOSQUITO_ZAPPER_PIN 8
// There are one power relay for the socket
#define SOCKET_CONTACTOR_PIN 9
/***********************************************
* Air Conditioner *
***********************************************/
// @note The infrared codes are defined in ir_codes.hpp and ir_codes.cpp
// Air Conditioner Type for First and Second Year Classrooms
#if AC_TYPE == AC_TYPE_M1M2
#define AC_MIN_TEMP 15
#define AC_MAX_TEMP 30
#define AC_MODES 3
#define AC_FAN_SPEEDS 4
#define AC_MODE_NAMES {"off", "fan_only", "cool"}
#define AC_FAN_SPEED_NAMES {"auto", "high", "medium", "low"}
#endif
// Air Conditioner Type for Third, Fourth, Fifth, and Sixth Year Classrooms
#if AC_TYPE == AC_TYPE_M3M4M5M6
#define AC_MIN_TEMP 16
#define AC_MAX_TEMP 32
#define AC_MODES 3
#define AC_FAN_SPEEDS 4
#define AC_MODE_NAMES {"off", "fan_only", "cool"}
#define AC_FAN_SPEED_NAMES {"auto", "high", "medium", "low"}
#endif
#define AC_IR_TX_PIN 12 // GP Type
#define AC_IR_CHANNEL RMT_CHANNEL_0
#define AC_SENSOR_TYPE AC_SENSOR_TYPE_DHT22
#define AC_SENSOR_PIN 32 // GP Type
/***********************************************
* Display Configuration *
***********************************************/
// UART Configuration
#define INTERNAL_DISPLAY_UART Serial
#define INTERNAL_DISPLAY_BAUDRATE 115200
#define DISPLAY_UART Serial1
#define DISPLAY_TX 4
#define DISPLAY_RX 17
#define DISPLAY_COMMUNICATION_BAUDRATE 115200
#define DISPLAY_OTA_BAUDRATE 921600
#define DEFAULT_TEMP_LOWER_BOUND 18
#define DEFAULT_TEMP_UPPER_BOUND 30
#define AC_TEMP_PRESS_DELAY 500 // ms
/***********************************************
* Persistent Storage Configuration *
***********************************************/
#define AC_FRAM_ADDR 10000 // 3 bytes
#define AC_LOCK_FRAM_ADDR 10010 // 10 byte
#define AC_DISPLAY_MODE_FRAM_ADDR 10020 // 1 byte
#define AC_DISPLAY_TEMP_LOWER_BOUND_ADDR 10030 // 6 byte
#define AC_DISPLAY_TEMP_UPPER_BOUND_ADDR 10040 // 6 byte
/***********************************************
* Remote Variables & Smart Variables *
***********************************************/
#define AQI_STATE_TOPIC "/iqair/usaqi"
#define AQI_REQUEST_TOPIC "/iqair/request"
#define AC_LOCK_RELATIVE_TOPIC "/ac/lock"
#define AC_TEMP_LOWER_BOUND_RELATIVE_TOPIC "/ac/temp_bound/lower"
#define AC_TEMP_UPPER_BOUND_RELATIVE_TOPIC "/ac/temp_bound/upper"