first prototype
This commit is contained in:
parent
40f8799a05
commit
2ca65ec643
3 changed files with 349 additions and 5 deletions
36
src/main.cpp
36
src/main.cpp
|
|
@ -1,9 +1,21 @@
|
|||
#include <main.hpp>
|
||||
#include <cud_display.hpp>
|
||||
|
||||
ESPMegaPRO espmega = ESPMegaPRO();
|
||||
CUDDisplay external_display = CUDDisplay();
|
||||
/***********************************************
|
||||
* Begin Configuration *
|
||||
************************************************/
|
||||
|
||||
// Display Configuration
|
||||
#define cudDisplayAdapter Serial2
|
||||
#define CUD_DISPLAY_BAUD_RATE 115200
|
||||
#define CUD_DISPLAY_TX_PIN 16
|
||||
#define CUD_DISPLAY_RX_PIN 17
|
||||
|
||||
//Air Conditioner Configuration
|
||||
#define AIR_CONDITIONER_SENSOR_TYPE AC_SENSOR_TYPE_DHT22
|
||||
#define AIR_CONDITIONER_SENSOR_PIN 4
|
||||
#define AIR_CONDITIONER_IR_PIN 5
|
||||
#define AIR_CONDITIONER_RMT_CHANNEL RMT_CHANNEL_0
|
||||
|
||||
const char *mode_names[] = {"off", "fan_only", "cool"};
|
||||
const char *fan_speed_names[] = {"auto", "high", "medium", "low"};
|
||||
|
|
@ -18,6 +30,17 @@ AirConditioner ac = {
|
|||
.getInfraredCode = &getInfraredCode
|
||||
};
|
||||
|
||||
/***********************************************
|
||||
* End Configuration *
|
||||
***********************************************/
|
||||
|
||||
ESPMegaPRO espmega = ESPMegaPRO();
|
||||
CUDDisplay cudDisplay = CUDDisplay();
|
||||
|
||||
ClimateCard climateCard = ClimateCard(AIR_CONDITIONER_IR_PIN, ac,
|
||||
AIR_CONDITIONER_SENSOR_TYPE, AIR_CONDITIONER_SENSOR_PIN,
|
||||
AIR_CONDITIONER_RMT_CHANNEL);
|
||||
|
||||
void setup() {
|
||||
espmega.begin();
|
||||
espmega.enableIotModule();
|
||||
|
|
@ -30,6 +53,15 @@ void setup() {
|
|||
espmega.enableInternalDisplay(&Serial);
|
||||
espmega.enableWebServer(80);
|
||||
espmega.inputs.registerCallback(on_pin_change);
|
||||
espmega.outputs.setAutoSaveToFRAM(true);
|
||||
espmega.installCard(3, &climateCard);
|
||||
climateCard.bindFRAM(&espmega.fram, 5000);
|
||||
climateCard.loadStateFromFRAM();
|
||||
climateCard.setFRAMAutoSave(true);
|
||||
espmega.iot->registerCard(3);
|
||||
cudDisplayAdapter.begin(CUD_DISPLAY_BAUD_RATE, SERIAL_8N1, CUD_DISPLAY_RX_PIN, CUD_DISPLAY_TX_PIN);
|
||||
auto bindedGetTime = std::bind(&ESPMegaPRO::getTime, &espmega);
|
||||
cudDisplay.begin(bindedGetTime, &cudDisplayAdapter, &espmega.inputs, &espmega.outputs, &climateCard);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue