Added clang-format (#623)
* added .clang-format * added names to travis jobs removed deprecated travis option * check github action * added .gitignore
This commit is contained in:
1 parent
661ef9c55e
commit
10a9d00aaf
59 files changed
+2892
-3640
No files matched your search
+14
-30
@@ -39,11 +39,10 @@
|
||||
#include "User_config.h"
|
||||
|
||||
#ifdef ZsensorBH1750
|
||||
#include "math.h" // Library for trig and exponential functions
|
||||
#include "Wire.h" // Library for communication with I2C / TWI devices
|
||||
# include "Wire.h" // Library for communication with I2C / TWI devices
|
||||
# include "math.h" // Library for trig and exponential functions
|
||||
|
||||
void setupZsensorBH1750()
|
||||
{
|
||||
void setupZsensorBH1750() {
|
||||
Log.notice(F("Setup BH1750 on adress: %H" CR), BH1750_i2c_addr);
|
||||
Wire.begin();
|
||||
Wire.beginTransmission(BH1750_i2c_addr);
|
||||
@@ -52,14 +51,11 @@ void setupZsensorBH1750()
|
||||
delay(300);
|
||||
}
|
||||
|
||||
// void loop()
|
||||
void MeasureLightIntensity()
|
||||
{
|
||||
if (millis() > (timebh1750 + TimeBetweenReadingBH1750))
|
||||
{ //retrieving value of Lux, FtCd and Wattsm2 from BH1750
|
||||
void MeasureLightIntensity() {
|
||||
if (millis() > (timebh1750 + TimeBetweenReadingBH1750)) { //retrieving value of Lux, FtCd and Wattsm2 from BH1750
|
||||
Log.trace(F("Creating BH1750 buffer" CR));
|
||||
StaticJsonBuffer<JSON_MSG_BUFFER> jsonBuffer;
|
||||
JsonObject &BH1750data = jsonBuffer.createObject();
|
||||
JsonObject& BH1750data = jsonBuffer.createObject();
|
||||
|
||||
timebh1750 = millis();
|
||||
unsigned int i = 0;
|
||||
@@ -72,12 +68,9 @@ void MeasureLightIntensity()
|
||||
|
||||
// Check if reads failed and exit early (to try again).
|
||||
Wire.requestFrom(BH1750_i2c_addr, 2);
|
||||
if (Wire.available() != 2)
|
||||
{
|
||||
if (Wire.available() != 2) {
|
||||
Log.error(F("Failed to read from LightSensor BH1750!" CR));
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
i = Wire.read();
|
||||
i <<= 8;
|
||||
i |= Wire.read();
|
||||
@@ -88,32 +81,23 @@ void MeasureLightIntensity()
|
||||
Wattsm2 = Lux / 683.0;
|
||||
|
||||
// Generate Lux
|
||||
if (Lux != persistedll || bh1750_always)
|
||||
{
|
||||
if (Lux != persistedll || bh1750_always) {
|
||||
BH1750data.set("lux", (unsigned int)Lux);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
Log.trace(F("Same lux don't send it" CR));
|
||||
}
|
||||
|
||||
// Generate FtCd
|
||||
if (ftcd != persistedlf || bh1750_always)
|
||||
{
|
||||
if (ftcd != persistedlf || bh1750_always) {
|
||||
BH1750data.set("ftcd", (unsigned int)ftcd);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
Log.trace(F("Same ftcd don't send it" CR));
|
||||
}
|
||||
|
||||
// Generate Watts/m2
|
||||
if (Wattsm2 != persistedlw || bh1750_always)
|
||||
{
|
||||
if (Wattsm2 != persistedlw || bh1750_always) {
|
||||
BH1750data.set("wattsm2", (unsigned int)Wattsm2);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
Log.trace(F("Same wattsm2 don't send it" CR));
|
||||
}
|
||||
if (BH1750data.size() > 0)
|
||||
|
||||
Reference in new issue
Block a user