#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

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);