ise-iot-oop-v2/src/main.hpp

59 lines
No EOL
1.5 KiB
C++

#pragma once
#include <ESPMegaProOS.hpp>
SET_LOOP_TASK_STACK_SIZE(32*1024);
#include <ise_display.hpp>
#include <ir_codes.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_IR_PIN 5
#define AIR_CONDITIONER_RMT_CHANNEL RMT_CHANNEL_0
// CT Configuration
#define CT_FORCE_ENABLE false
#define CT_RMS_VOLTAGE 220.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 adcToCurrent(uint16_t adc_value);