ise-iot-oop-v2/src/main.hpp
2024-04-01 22:20:26 +07:00

62 lines
No EOL
1.7 KiB
C++

#pragma once
#include <ESPMegaProOS.hpp>
SET_LOOP_TASK_STACK_SIZE(32*1024);
#include <ise_display.hpp>
#include <ir_codes_daikin.hpp>
#include <ir_codes_york.hpp>
#include <CurrentTransformerCard.hpp>
/***********************************************
* Begin Configuration *
************************************************/
// Display Configuration
#define iseDisplayAdapter Serial2
#define ISE_DISPLAY_BAUD_RATE 115200
#define ISE_DISPLAY_TX_PIN 4
#define ISE_DISPLAY_RX_PIN 17
// Air Conditioner Configuration
#define AIR_CONDITIONER_SENSOR_TYPE AC_SENSOR_TYPE_DHT22
#define AIR_CONDITIONER_SENSOR_PIN 32
#define AIR_CONDITIONER_DAIKIN_IR_PIN 5
#define AIR_CONDITIONER_YORK_IR_PIN 15
#define AIR_CONDITIONER_RMT_CHANNEL0 RMT_CHANNEL_0
#define AIR_CONDITIONER_RMT_CHANNEL1 RMT_CHANNEL_1
// CT Configuration
#define CT_FORCE_ENABLE true
#define CT_RMS_VOLTAGE 1.0
#define CT_PIN_LIGHT_PHASE1 0
#define CT_PIN_LIGHT_PHASE2 1
#define CT_PIN_SOCKET 2
#define CT_PIN_AC_PHASE1 3
#define CT_PIN_AC_PHASE2 4
#define CT_PIN_AC_PHASE3 5
void handleMqttMessage(char *topic, char *payload);
void subscribeToMqttTopics();
void handlePageChange(uint8_t page);
void sendStopBytes();
void sendExtStopBytes();
void setup();
void loop();
void on_pin_change(uint8_t pin, uint8_t value);
uint16_t get_pm25_out();
uint16_t get_pm25_in();
float get_temp_out();
void toggle_pm_switch();
void set_pm_fanspeed(uint8_t speed);
void display_update();
void pm25outupdatedisplay(char* value);
void pm25inupdatedisplay(char* value);
void tempoutupdatedisplay(char* value);
void weatherupdatedisplay(char* value);
void pmfanspeedupdatedisplay(char* value);
void pmswitchupdatedisplay(char* value);
float adc2current(uint16_t adc_val);