Add OTA and change IR Codes
This commit is contained in:
parent
b4afcd58f8
commit
6d635c3140
6 changed files with 140 additions and 108 deletions
25
src/main.cpp
25
src/main.cpp
|
@ -8,11 +8,11 @@ ESPMegaPRO espmega = ESPMegaPRO();
|
|||
const char *mode_names[] = AC_MODE_NAMES;
|
||||
const char *fan_speed_names[] = AC_FAN_SPEED_NAMES;
|
||||
AirConditioner ac_config = {
|
||||
.max_temperature = 32,
|
||||
.min_temperature = 16,
|
||||
.modes = 4,
|
||||
.max_temperature = AC_MAX_TEMP,
|
||||
.min_temperature = AC_MIN_TEMP,
|
||||
.modes = AC_MODES,
|
||||
.mode_names = mode_names,
|
||||
.fan_speeds = 4,
|
||||
.fan_speeds = AC_FAN_SPEEDS,
|
||||
.fan_speed_names = fan_speed_names,
|
||||
.getInfraredCode = &getInfraredCode};
|
||||
|
||||
|
@ -33,6 +33,9 @@ cud_display_conf_t cud_display_conf = {
|
|||
|
||||
CUDDisplay cudDisplay = CUDDisplay(&cud_display_conf);
|
||||
|
||||
ESPMegaDisplayOTA cudDisplayOTA = ESPMegaDisplayOTA();
|
||||
ESPMegaDisplayOTA internalDisplayOTA = ESPMegaDisplayOTA();
|
||||
|
||||
/************************************************
|
||||
* End of Global Variables *
|
||||
************************************************/
|
||||
|
@ -107,9 +110,12 @@ void setup()
|
|||
.outputCard = &espmega.outputs,
|
||||
.ac = &ac,
|
||||
.fram = &espmega.fram,
|
||||
.iot = espmega.iot,};
|
||||
.iot = espmega.iot,
|
||||
};
|
||||
cudDisplay.begin(cards);
|
||||
espmega.iot->registerMqttCallback(handle_mqtt_message);
|
||||
cudDisplayOTA.begin("/cuddisp", &cudDisplay, espmega.webServer);
|
||||
internalDisplayOTA.begin("/intdisp", espmega.display, espmega.webServer);
|
||||
ESP_LOGI("CUD IoT OS", "Initialization Complete");
|
||||
}
|
||||
|
||||
|
@ -126,13 +132,16 @@ void send_stop_bytes(HardwareSerial &uart)
|
|||
uart.write(0xFF);
|
||||
}
|
||||
|
||||
void handle_input_change(uint8_t pin, bool state) {
|
||||
void handle_input_change(uint8_t pin, bool state)
|
||||
{
|
||||
// When input pin 0 - 6 changes, toggle the corresponding output pin
|
||||
if (pin >= 0 && pin <= 6) {
|
||||
if (pin >= 0 && pin <= 6)
|
||||
{
|
||||
espmega.outputs.setState(pin, !espmega.outputs.getState(pin));
|
||||
}
|
||||
}
|
||||
|
||||
void handle_mqtt_message(char *topic, char *payload) {
|
||||
void handle_mqtt_message(char *topic, char *payload)
|
||||
{
|
||||
ESP_LOGD("CUD IoT OS", "MQTT Message Received: %s, %s", topic, payload);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue