ESP compilation fixed

This commit is contained in:
2019-04-30 15:12:41 +03:00
parent 7cb0492a30
commit bd47e11a47
3 changed files with 21 additions and 12 deletions

View File

@@ -115,13 +115,16 @@ void Input::setup()
if (!isValid() || (!root)) return; if (!isValid() || (!root)) return;
#ifndef CSSHDC_DISABLE #ifndef CSSHDC_DISABLE
in_ccs811 ccs811(this);
in_hdc1080 hdc1080(this);
if (inType == IN_CCS811) if (inType == IN_CCS811)
{
in_ccs811 ccs811(this);
ccs811.Setup(pin); ccs811.Setup(pin);
}
else if (inType == IN_HDC1080) else if (inType == IN_HDC1080)
{
in_hdc1080 hdc1080(this);
hdc1080.Setup(pin); hdc1080.Setup(pin);
}
// TODO rest types setup // TODO rest types setup
#endif #endif

View File

@@ -7,6 +7,9 @@ CCS811 ccs811(CCS811_ADDR);
ClosedCube_HDC1080 hdc1080; ClosedCube_HDC1080 hdc1080;
long ccs811Baseline; long ccs811Baseline;
bool CCS811ready = false;
bool HDC1080ready = false;
int in_ccs811::Setup(int addr) int in_ccs811::Setup(int addr)
{ {
#ifdef WAK_PIN #ifdef WAK_PIN
@@ -15,7 +18,7 @@ int in_ccs811::Setup(int addr)
#endif #endif
Serial.println("CCS811 Init"); Serial.println("CCS811 Init");
if (CCS811ready) return 0;
Wire.begin(); //Inialize I2C Harware Wire.begin(); //Inialize I2C Harware
//It is recommended to check return status on .begin(), but it is not //It is recommended to check return status on .begin(), but it is not
@@ -28,11 +31,13 @@ Wire.begin(); //Inialize I2C Harware
return 0; return 0;
} }
ccs811.setBaseline(62000); ccs811.setBaseline(62000);
CCS811ready = true;
return 1; return 1;
} }
int in_hdc1080::Setup(int addr) int in_hdc1080::Setup(int addr)
{ {
if (HDC1080ready) return 0;
Serial.println("HDC1080 Init "); Serial.println("HDC1080 Init ");
Wire.begin(); //Inialize I2C Harware Wire.begin(); //Inialize I2C Harware
// Default settings: // Default settings:
@@ -44,6 +49,7 @@ Serial.println(hdc1080.readManufacturerId(), HEX); // 0x5449 ID of Texas Instrum
Serial.print("Device ID=0x"); Serial.print("Device ID=0x");
Serial.println(hdc1080.readDeviceId(), HEX); // 0x1050 ID of the device Serial.println(hdc1080.readDeviceId(), HEX); // 0x1050 ID of the device
printSerialNumber(); printSerialNumber();
HDC1080ready = true;
return 1; return 1;
} }
@@ -60,7 +66,7 @@ int in_hdc1080::Poll()
{ {
float h,t; float h,t;
int reg; int reg;
if (!HDC1080ready) return 0;
Serial.print("HDC Status="); Serial.print("HDC Status=");
Serial.println(reg=hdc1080.readRegister().rawData,HEX); Serial.println(reg=hdc1080.readRegister().rawData,HEX);
if (reg!=0xff) if (reg!=0xff)
@@ -84,6 +90,7 @@ return 1;
int in_ccs811::Poll() int in_ccs811::Poll()
{ {
if (!CCS811ready) return 0;
#ifdef WAK_PIN #ifdef WAK_PIN
digitalWrite(WAK_PIN,LOW); digitalWrite(WAK_PIN,LOW);
#endif #endif

View File

@@ -16,9 +16,9 @@ env_default =
; megaatmega2560-net ; megaatmega2560-net
; due ; due
; esp8266 ; esp8266
; esp32 ; esp32
; megaatmega2560-5500 ; megaatmega2560-5500
due-5500 ; due-5500
; controllino ; controllino
; stm32 ; stm32
; nrf52840 ; nrf52840
@@ -93,18 +93,15 @@ lib_ignore =
Ethernet Ethernet
Ethernet2 Ethernet2
Ethernet3 Ethernet3
HTTPClient
httpClient
EEPROM EEPROM
Artnet Artnet
HTTPClient
UIPEthernet UIPEthernet
ESP_EEPROM ESP_EEPROM
EEPROM HttpClient_ID66
HttpClient
lib_deps = lib_deps =
https://github.com/ebenolson/WIFIMANAGER-ESP32.git https://github.com/ebenolson/WIFIMANAGER-ESP32.git
https://github.com/zhouhan0126/WebServer-esp32.git https://github.com/zhouhan0126/WebServer-esp32.git
ArduinoHttpClient
https://github.com/anklimov/aJson https://github.com/anklimov/aJson
https://github.com/anklimov/CmdArduino https://github.com/anklimov/CmdArduino
https://github.com/knolleary/pubsubclient.git https://github.com/knolleary/pubsubclient.git
@@ -214,6 +211,8 @@ lib_ignore =
SdFat SdFat
httpClient httpClient
HTTPClient HTTPClient
HttpClient_ID66
HttpClient
ArduinoHttpClient ArduinoHttpClient
Ethernet3 Ethernet3
Ethernet2 Ethernet2