digital output card
This commit is contained in:
parent
85f789e216
commit
09aee8d5f8
|
@ -32,7 +32,7 @@ DigitalOutputCard::DigitalOutputCard(uint8_t address) : change_callbacks(){
|
|||
* @param bit4 The position of the fifth switch on the dip switch
|
||||
*/
|
||||
DigitalOutputCard::DigitalOutputCard(bool bit0, bool bit1, bool bit2, bool bit3, bool bit4) :
|
||||
DigitalOutputCard(0x20+bit0+bit1*2+bit2*4+bit3*8+bit4*16)
|
||||
DigitalOutputCard(0x40+bit0+bit1*2+bit2*4+bit3*8+bit4*16)
|
||||
{
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* @file main.cpp
|
||||
* @brief Test firmware for the ESPMegaPRO OOP library
|
||||
*/
|
||||
*/
|
||||
#include <ESPMegaProOS.hpp>
|
||||
#include <InternalDisplay.hpp>
|
||||
#include <ETH.h>
|
||||
|
@ -17,20 +17,24 @@
|
|||
// #define FRAM_DEBUG
|
||||
// #define MQTT_DEBUG
|
||||
// #define RTC_DEBUG
|
||||
//#define WRITE_DEFAULT_NETCONF
|
||||
//#define CLIMATE_CARD_ENABLE
|
||||
//#define MQTT_CARD_REGISTER
|
||||
// #define WRITE_DEFAULT_NETCONF
|
||||
// #define CLIMATE_CARD_ENABLE
|
||||
#define MQTT_CARD_REGISTER
|
||||
// #define DISPLAY_ENABLE
|
||||
//#define WEB_SERVER_ENABLE
|
||||
//#define LCD_OTA_ENABLE
|
||||
// #define REMOTE_VARIABLE_ENABLE
|
||||
// #define CT_ENABLE
|
||||
// #define SMART_VARIABLE_ENABLE
|
||||
|
||||
#define WEB_SERVER_ENABLE
|
||||
// #define LCD_OTA_ENABLE
|
||||
// #define REMOTE_VARIABLE_ENABLE
|
||||
// #define CT_ENABLE
|
||||
// #define SMART_VARIABLE_ENABLE
|
||||
#define EXTERNAL_DIGITAL_OUTPUT_CARD_ENABLE
|
||||
// Demo PLC firmware using the ESPMegaPRO OOP library
|
||||
|
||||
ESPMegaPRO espmega = ESPMegaPRO();
|
||||
|
||||
#ifdef EXTERNAL_DIGITAL_OUTPUT_CARD_ENABLE
|
||||
DigitalOutputCard externalDigitalOutputCard = DigitalOutputCard(1, 0, 1, 1, 0);
|
||||
#endif
|
||||
|
||||
// Remote Variable
|
||||
#ifdef REMOTE_VARIABLE_ENABLE
|
||||
RemoteVariable testVar = RemoteVariable();
|
||||
|
@ -166,6 +170,9 @@ void setup()
|
|||
{
|
||||
ESP_LOGI("Initializer", "Starting ESPMegaPRO OOP demo");
|
||||
espmega.begin();
|
||||
#ifdef EXTERNAL_DIGITAL_OUTPUT_CARD_ENABLE
|
||||
espmega.installCard(6, &externalDigitalOutputCard);
|
||||
#endif
|
||||
espmega.setTimezone("UTC-7");
|
||||
ESP_LOGI("Initializer", "Enabling IOT module");
|
||||
espmega.enableIotModule();
|
||||
|
@ -205,6 +212,10 @@ void setup()
|
|||
espmega.iot->registerCard(0);
|
||||
ESP_LOGI("Initializer", "Registering cards 1");
|
||||
espmega.iot->registerCard(1);
|
||||
#ifdef EXTERNAL_DIGITAL_OUTPUT_CARD_ENABLE
|
||||
ESP_LOGI("Initializer", "Registering cards 6");
|
||||
espmega.iot->registerCard(6);
|
||||
#endif
|
||||
#endif
|
||||
ESP_LOGI("Initializer", "Registering Input change callback");
|
||||
espmega.inputs.registerCallback(input_change_callback);
|
||||
|
@ -240,7 +251,7 @@ void setup()
|
|||
#endif
|
||||
#ifdef REMOTE_VARIABLE_ENABLE
|
||||
ESP_LOGI("Initializer", "Initializing testvar");
|
||||
testVar.begin(32, "/xm/fan_speed", espmega.iot, true,"/pm/request_fan_speed");
|
||||
testVar.begin(32, "/xm/fan_speed", espmega.iot, true, "/pm/request_fan_speed");
|
||||
testVar.enableSetValue("/pm/request_switch_state");
|
||||
#endif
|
||||
#ifdef CT_ENABLE
|
||||
|
|
Loading…
Reference in New Issue