Skip to content

Commit

Permalink
Merge pull request #748 from tschaban/T0-3.0.2.ESP32
Browse files Browse the repository at this point in the history
T0-3.1.0
  • Loading branch information
tschaban authored Sep 12, 2021
2 parents f31e505 + fec9375 commit 8df0b38
Show file tree
Hide file tree
Showing 100 changed files with 5,965 additions and 4,018 deletions.
320 changes: 233 additions & 87 deletions core/include/config/AFE-Configuration.h

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions core/include/data/AFE-ADC-INPUT-Structure.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ struct ADCINPUT {
#ifdef AFE_CONFIG_FUNCTIONALITY_BATTERYMETER
BATTERY_METER battery;
#endif

#ifdef AFE_ESP32
char name[17];
#endif
};

#endif // AFE_CONFIG_HARDWARE_ADC_VCC
Expand Down
3 changes: 3 additions & 0 deletions core/include/data/AFE-BH1750-Sensor-Structure.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
struct BH1750 {
char name[17];
uint32_t interval;
#ifdef AFE_ESP32
uint8_t wirePortId;
#endif
uint8_t i2cAddress;
uint8_t mode;
#ifdef AFE_CONFIG_API_DOMOTICZ_ENABLED
Expand Down
3 changes: 3 additions & 0 deletions core/include/data/AFE-BMEX80-Sensor-Structure.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ struct BMEX80 {
char name[17];
uint8_t type;
uint32_t interval;
#ifdef AFE_ESP32
uint8_t wirePortId;
#endif
uint8_t i2cAddress;
uint8_t resolution; // for BMP180 only
AIR_ITEM_SETTING temperature;
Expand Down
30 changes: 30 additions & 0 deletions core/include/data/AFE-CLED-Structure.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,27 @@
#include <AFE-Configuration.h>
#ifdef AFE_CONFIG_HARDWARE_CLED

#ifdef AFE_CONFIG_API_DOMOTICZ_ENABLED
#include <AFE-DOMOTICZ-Structure.h>
#endif
#include <AFE-MQTT-Structure.h>


#include <arduino.h>

struct CLED {
uint8_t gpio;
uint8_t colorOrder;
uint8_t chipset;
int ledNumber;
#ifdef AFE_CONFIG_API_DOMOTICZ_ENABLED
DOMOTICZ_BASIC_CONFIG domoticz;
#else
MQTT_BASIC_CONFIG mqtt;
#endif
};

#if defined(AFE_CONFIG_HARDWARE_CLED_ACCESS_CONTROL_EFFECT) || defined(AFE_CONFIG_HARDWARE_CLED_BACKLIGHT_EFFECT)
struct CLED_EFFECT {
uint32_t color;
uint16_t time;
Expand All @@ -25,5 +37,23 @@ struct CLED_EFFECTS {
CLED_EFFECT effect[AFE_CONFIG_HARDWARE_NUMBER_OF_CLED_EFFECTS];
};

#ifdef AFE_CONFIG_HARDWARE_CLED_BACKLIGHT_EFFECT
struct CLED_BACKLIGHT_CONFIG {

uint32_t luxLevel;
uint32_t color;
uint8_t brightness;
};

struct CLED_BACKLIGHT {
uint8_t lightSensorId;
CLED_BACKLIGHT_CONFIG config[AFE_CONFIG_HARDWARE_NUMBER_OF_CLED_BACKLIGHT_LEVELS];
};
#endif // AFE_CONFIG_HARDWARE_CLED_BACKLIGHT_EFFECT


#endif // AFE_CONFIG_HARDWARE_CLED_ACCESS_CONTROL_EFFECT AFE_CONFIG_HARDWARE_CLED_BACKLIGHT_EFFECT


#endif // AFE_CONFIG_HARDWARE_CLED
#endif // _AFE_CLED_Structure_h
82 changes: 14 additions & 68 deletions core/include/data/AFE-DEVICE-Structure.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ struct DEVICE {
uint8_t noOfLEDs;
#endif
#ifdef AFE_CONFIG_HARDWARE_ADC_VCC
#ifndef AFE_ESP32
boolean isAnalogInput;
#else
uint8_t noOfAnalogInputs;
#endif // AFE_ESP32
#endif
#ifdef AFE_CONFIG_HARDWARE_GATE
uint8_t noOfGates;
Expand Down Expand Up @@ -70,83 +74,25 @@ struct DEVICE {
#ifdef AFE_CONFIG_HARDWARE_BINARY_SENSOR
uint8_t noOfBinarySensors;
#endif
#ifdef AFE_CONFIG_HARDWARE_TLS2561
uint8_t noOfTLS2561s;
#endif
#ifdef AFE_CONFIG_HARDWARE_PN532_SENSOR
uint8_t noOfPN532Sensors;
uint8_t noOfMiFareCards;
#endif
#ifdef AFE_CONFIG_HARDWARE_CLED
uint8_t noOfCLEDs;
boolean effectPN532;
#endif
};
#endif // AFE_CONFIG_HARDWARE_PN532_SENSOR

/* Custom DEVICE structure definition
struct DEVICE {
char name[33];
AFE_DEVICE_API api;
#if defined(T0_CONFIG)
uint8_t noOfSwitches;
uint8_t noOfRelays;
uint8_t noOfLEDs;
#ifdef AFE_CONFIG_HARDWARE_ADC_VCC
boolean isAnalogInput;
#endif
#elif defined(T1_CONFIG)
boolean isLED[2];
boolean isRelay[1];
boolean isSwitch[2];
boolean isDS18B20;
#ifdef AFE_CONFIG_HARDWARE_ADC_VCC
boolean isAnalogInput;
#endif
#elif defined(T2_CONFIG)
boolean isLED[2];
boolean isRelay[1];
boolean isSwitch[2];
boolean isDHT;
#ifdef AFE_CONFIG_HARDWARE_ADC_VCC
boolean isAnalogInput;
#endif
#elif defined(T3_CONFIG)
boolean isLED[5];
boolean isRelay[4];
boolean isSwitch[5];
boolean isPIR[4];
#ifdef AFE_CONFIG_HARDWARE_ADC_VCC
boolean isAnalogInput;
#endif
#elif defined(T4_CONFIG)
boolean isLED[5];
boolean isSwitch[5];
boolean isRelay[4];
#ifdef AFE_CONFIG_HARDWARE_ADC_VCC
boolean isAnalogInput;
#endif
#elif defined(T5_CONFIG)
uint8_t noOfGates;
uint8_t noOfContactrons;
uint8_t noOfSwitches;
uint8_t noOfRelays;
uint8_t noOfLEDs;
#ifdef AFE_CONFIG_HARDWARE_BMEX80
uint8_t noOfBMEX80s;
#endif
#ifdef AFE_CONFIG_HARDWARE_ADC_VCC
boolean isAnalogInput;
#endif
#elif defined(T6_CONFIG)
uint8_t noOfSwitches;
uint8_t noOfRelays;
uint8_t noOfLEDs;
uint8_t noOfHPMA115S0s;
uint8_t noOfBMEX80s;
uint8_t noOfBH1750s;
uint8_t noOfAS3935s;
#ifdef AFE_CONFIG_HARDWARE_ADC_VCC
boolean isAnalogInput;
#ifdef AFE_CONFIG_HARDWARE_CLED
boolean effectDeviceLight;
#endif

#ifdef AFE_CONFIG_HARDWARE_I2C
uint8_t noOfI2Cs;
#endif
};
*/

#ifdef T0_CONFIG
/* Old structure of DEVICE required for upgrade from T0 2.0.0, 2.0.1, 2.0.2 */
Expand Down
6 changes: 5 additions & 1 deletion core/include/data/AFE-Data-Structures.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,8 @@
#include <AFE-CLED-Structure.h>
#endif

#endif
#ifdef AFE_CONFIG_HARDWARE_TLS2561
#include <AFE-TLS2561-Sensor-Structure.h>
#endif

#endif // _AFE_Data_Structures_h
4 changes: 4 additions & 0 deletions core/include/data/AFE-I2C-Structure.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@
#ifndef _AFE_I2C_Structure_h
#define _AFE_I2C_Structure_h


struct I2CPORT {
uint8_t SDA;
uint8_t SCL;
#ifdef AFE_ESP32
uint32_t frequency;
#endif
};

#endif
9 changes: 9 additions & 0 deletions core/include/data/AFE-MQTT-Structure.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,15 @@ typedef enum {
#ifdef AFE_CONFIG_HARDWARE_BINARY_SENSOR
AFE_MQTT_DEVICE_BINARY_SENSOR = 15,
#endif
#ifdef AFE_CONFIG_HARDWARE_CLED_BACKLIGHT_EFFECT
AFE_MQTT_DEVICE_CLED_EFFECT_DEVICE_LIGHT = 16,
#endif
#ifdef AFE_CONFIG_HARDWARE_CLED_ACCESS_CONTROL_EFFECT
AFE_MQTT_DEVICE_CLED_EFFECT_PN532_SENSOR = 17,
#endif
#ifdef AFE_CONFIG_HARDWARE_TLS2561
AFE_MQTT_DEVICE_TLS2561 = 18,
#endif
} afe_mqtt_standard_device_type_t;

/* MQTT Topics cache structure */
Expand Down
4 changes: 4 additions & 0 deletions core/include/data/AFE-NETWORK-Structure.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ struct NETWORK {
uint8_t waitTimeSeries;
char ssidBackup[33];
char passwordBackup[33];
uint8_t isDHCPBackup;
char ipBackup[16];
char gatewayBackup[16];
char subnetBackup[16];
uint8_t noFailuresToSwitchNetwork;
};

Expand Down
5 changes: 4 additions & 1 deletion core/include/data/AFE-PN532-Sensor-Structure.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ struct PN532_SENSOR {
uint8_t interface;
uint8_t tx;
uint8_t rx;
#ifdef AFE_ESP32
uint8_t wirePortId;
#endif
uint8_t i2cAddress;
uint16_t requestProcessingTime;
uint16_t listenerTimeout;
Expand All @@ -36,7 +39,7 @@ struct PN532_TAGS {
};

struct MIFARE_CARD {
char cardId[16];
char cardId[17];
uint8_t relayId;
uint8_t action;
boolean sendAsSwitch;
Expand Down
27 changes: 27 additions & 0 deletions core/include/data/AFE-TLS2561-Sensor-Structure.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/* AFE Firmware for smart home devices, Website: https://afe.smartnydom.pl/ */

#ifndef _AFE_TLS2561_Structure_h
#define _AFE_TLS2561_Structure_h

#ifdef AFE_CONFIG_API_DOMOTICZ_ENABLED
#include <AFE-DOMOTICZ-Structure.h>
#endif
#include <AFE-MQTT-Structure.h>

struct TLS2561 {
char name[17];
uint32_t interval;
#ifdef AFE_ESP32
uint8_t wirePortId;
#endif
uint8_t i2cAddress;
uint8_t sensitiveness;
uint8_t gain;
#ifdef AFE_CONFIG_API_DOMOTICZ_ENABLED
DOMOTICZ_BASIC_CONFIG domoticz;
#else
MQTT_BASIC_CONFIG mqtt;
#endif
};

#endif // _AFE_TLS2561_Structure_h
Loading

0 comments on commit 8df0b38

Please sign in to comment.