initial commit
This commit is contained in:
commit
dbfb1f5a0f
11 changed files with 466 additions and 0 deletions
4
src/cud_display.cpp
Normal file
4
src/cud_display.cpp
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
#include <cud_display.hpp>
|
||||
|
||||
CUDDisplay::CUDDisplay() : ESPMegaDisplay(&Serial2) {
|
||||
}
|
||||
10
src/cud_display.hpp
Normal file
10
src/cud_display.hpp
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
#include <ESPMegaDisplay.hpp>
|
||||
class CUDDisplay : public ESPMegaDisplay {
|
||||
public:
|
||||
CUDDisplay();
|
||||
void begin();
|
||||
void handleTouch(uint8_t page, uint8_t component, uint8_t event);
|
||||
void handlePWMChange(uint8_t pin, uint8_t value);
|
||||
void handleACChange(uint8_t mode, uint8_t fan_speed, uint8_t temperature);
|
||||
void sendClock();
|
||||
};
|
||||
31
src/main.cpp
Normal file
31
src/main.cpp
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
#include <main.h>
|
||||
#include <cud_display.hpp>
|
||||
|
||||
ESPMegaPRO espmega = ESPMegaPRO();
|
||||
CUDDisplay external_display = CUDDisplay();
|
||||
|
||||
void setup() {
|
||||
espmega.begin();
|
||||
espmega.enableIotModule();
|
||||
ETH.begin();
|
||||
espmega.iot->bindEthernetInterface(Ð);
|
||||
espmega.iot->loadNetworkConfig();
|
||||
espmega.iot->connectNetwork();
|
||||
espmega.iot->loadMqttConfig();
|
||||
espmega.iot->connectToMqtt();
|
||||
espmega.enableInternalDisplay(&Serial);
|
||||
espmega.enableWebServer(80);
|
||||
espmega.inputs.registerCallback(on_pin_change);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
espmega.loop();
|
||||
}
|
||||
|
||||
void on_pin_change(uint8_t pin, uint8_t value) {
|
||||
// For pin 0-6, when the pin value changes, toggle the corresponding PWM pin
|
||||
if (pin < 7) {
|
||||
bool new_value = !espmega.outputs.getState(pin);
|
||||
espmega.outputs.digitalWrite(pin, new_value);
|
||||
}
|
||||
}
|
||||
7
src/main.h
Normal file
7
src/main.h
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
#pragma once
|
||||
#include <ESPMegaProOS.hpp>
|
||||
|
||||
void setup();
|
||||
void loop();
|
||||
|
||||
void on_pin_change(uint8_t pin, uint8_t value);
|
||||
Loading…
Add table
Add a link
Reference in a new issue