Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix superfluous whitespaces and line endings #2310

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ It uses the Arduino Core for ESP8266 framework and a number of 3rd party librari

## Collaborators

Since November 2018, Max Prokhorov (**@mcspr**) is also actively working as a collaborator of the project.
Since November 2018, Max Prokhorov (**@mcspr**) is also actively working as a collaborator of the project.

## Contributors

Expand All @@ -35,10 +35,10 @@ Since November 2018, Max Prokhorov (**@mcspr**) is also actively working as a co

> Please use the [gitter ESPurna channel](https://gitter.im/tinkerman-cat/espurna) for support and questions, you have better chances to get fast answers from me or other ESPurna users. Open an issue here only if you feel there is a bug or you want to request an enhancement. Thank you.

> Process of building ESPurna from source is documented in the Wiki:
[Using PlatformIO IDE for VSCode](https://github.com/xoseperez/espurna/wiki/Build-and-update-from-Visual-Studio-Code-using-PlatformIO)
[Using PlatformIO CLI](https://github.com/xoseperez/espurna/wiki/PlatformIO)
[Using Arduino IDE](https://github.com/xoseperez/espurna/wiki/ArduinoIDE)
> Process of building ESPurna from source is documented in the Wiki:
[Using PlatformIO IDE for VSCode](https://github.com/xoseperez/espurna/wiki/Build-and-update-from-Visual-Studio-Code-using-PlatformIO)
[Using PlatformIO CLI](https://github.com/xoseperez/espurna/wiki/PlatformIO)
[Using Arduino IDE](https://github.com/xoseperez/espurna/wiki/ArduinoIDE)
Comment on lines +38 to +41
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pls take a look at the resulting render
<double-space> is intentional to create separate lines


> If you want to try out latest changes from **dev** branch without building the firmware yourself or if you are having problems with the stable release, please visit [**espurna-nightly-builder** releases page](https://github.com/mcspr/espurna-nightly-builder/releases).

Expand Down
12 changes: 6 additions & 6 deletions code/espurna/config/buildtime.h
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
/*
/*
*
* Created: 29.03.2018
*
* Authors:
*
*
* Assembled from the code released on Stackoverflow by:
* Dennis (instructable.com/member/nqtronix) | https://stackoverflow.com/questions/23032002/c-c-how-to-get-integer-unix-timestamp-of-build-time-not-string
* and
* Alexis Wilke | https://stackoverflow.com/questions/10538444/do-you-know-of-a-c-macro-to-compute-unix-time-and-date
*
* Assembled by Jean Rabault
*
*
* UNIX_TIMESTAMP gives the UNIX timestamp (unsigned long integer of seconds since 1st Jan 1970) of compilation from macros using the compiler defined __TIME__ macro.
* This should include Gregorian calendar leap days, in particular the 29ths of February, 100 and 400 years modulo leaps.
*
*
* Careful: __TIME__ is the local time of the computer, NOT the UTC time in general!
*
*
*/

#ifndef COMPILE_TIME_H_
Expand Down Expand Up @@ -94,4 +94,4 @@
// the UNIX timestamp
#define __UNIX_TIMESTAMP__ (_UNIX_TIMESTAMP(__TIME_YEAR__, __TIME_MONTH__, __TIME_DAY__, __TIME_HOUR__, __TIME_MINUTE__, __TIME_SECOND__))

#endif
#endif
16 changes: 8 additions & 8 deletions code/espurna/config/custom.h.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ------------------------------------------------------------------------------
// Example file for custom.h
// Example file for custom.h
// Either copy and paste this file then rename removing the .example or create your
// own file: 'custom.h'
// This file allows users to create their own configurations.
Expand All @@ -24,7 +24,7 @@
#define DOMOTICZ_SUPPORT 0
#define HOMEASSISTANT_SUPPORT 0
#define THINGSPEAK_SUPPORT 0

// Buttons
#define BUTTON1_PIN 0
#define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
Expand Down Expand Up @@ -58,8 +58,8 @@
#define DOMOTICZ_SUPPORT 0
#define HOMEASSISTANT_SUPPORT 0
#define THINGSPEAK_SUPPORT 0


// Buttons
#define BUTTON_MQTT_SEND_ALL_EVENTS 1
#define BUTTON1_PIN 0 // Built in button.
Expand All @@ -70,7 +70,7 @@
#define BUTTON1_DBLCLICK BUTTON_MODE_NONE
#define BUTTON1_LNGCLICK BUTTON_MODE_OFF
#define BUTTON1_LNGLNGCLICK BUTTON_MODE_NONE
#define BUTTON2_PIN 2 // External push button connected between IO2 and GND.
#define BUTTON2_PIN 2 // External push button connected between IO2 and GND.
#define BUTTON2_CONFIG BUTTON_PUSHBUTTON | BUTTON_SET_PULLUP | BUTTON_DEFAULT_HIGH
#define BUTTON2_RELAY 1
#define BUTTON2_PRESS BUTTON_MODE_NONE
Expand All @@ -86,11 +86,11 @@
// LEDs
#define LED1_PIN 13
#define LED1_PIN_INVERSE 1
// Extras

// Extras
#define BMX280_SUPPORT 1
#define BMX280_ADDRESS 0x76
#define I2C_SDA_PIN 1 //TX PIN **DISABLE DEBUG_SERIAL_SUPPORT**
#define I2C_SCL_PIN 3 //RX PIN **DISABLE DEBUG_SERIAL_SUPPORT**

#endif
18 changes: 9 additions & 9 deletions code/espurna/config/sensors.h
Original file line number Diff line number Diff line change
Expand Up @@ -782,39 +782,39 @@
// LDR sensor
// Enable support by passing LDR_SUPPORT=1 build flag
//------------------------------------------------------------------------------

#ifndef LDR_SUPPORT
#define LDR_SUPPORT 0
#endif

#ifndef LDR_SAMPLES
#define LDR_SAMPLES 10 // Number of samples
#endif

#ifndef LDR_DELAY
#define LDR_DELAY 0 // Delay between samples in micros
#endif

#ifndef LDR_TYPE
#define LDR_TYPE LDR_GL5528
#endif

#ifndef LDR_ON_GROUND
#define LDR_ON_GROUND true
#endif

#ifndef LDR_RESISTOR
#define LDR_RESISTOR 10000 // Resistance
#endif

#ifndef LDR_MULTIPLICATION
#define LDR_MULTIPLICATION 32017200
#endif

#ifndef LDR_POWER
#define LDR_POWER 1.5832
#endif

//------------------------------------------------------------------------------
// MHZ19 CO2 sensor
// Enable support by passing MHZ19_SUPPORT=1 build flag
Expand Down
2 changes: 0 additions & 2 deletions code/espurna/libs/AsyncClientHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,3 @@ enum class AsyncClientState {
Connected,
Disconnecting
};


2 changes: 1 addition & 1 deletion code/espurna/libs/BasePin.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Copyright (C) 2020 by Maxim Prokhorov <prokhorov dot max at outlook dot com>
#include <cstdint>
#include "config/types.h"

// base interface for generic pin handler.
// base interface for generic pin handler.
struct BasePin {
explicit BasePin(unsigned char pin) :
pin(pin)
Expand Down
2 changes: 1 addition & 1 deletion code/espurna/libs/DebounceEvent.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*

Original code:

Debounce buttons and trigger events
Expand Down
8 changes: 4 additions & 4 deletions code/espurna/libs/Encoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@
* Version 1.2 - fix -2 bug in C-only code
* Version 1.1 - expand to support boards with up to 60 interrupts
* Version 1.0 - initial release
*
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
Expand All @@ -38,7 +38,7 @@

#pragma once

// _______ _______
// _______ _______
// Pin1 ______| |_______| |______ Pin1
// negative <--- _______ _______ __ --> positive
// Pin2 __| |_______| |_______| Pin2
Expand Down
4 changes: 2 additions & 2 deletions code/espurna/ntp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ String _ntpGetServer() {

void _ntpReport() {
if (!ntpSynced()) {
DEBUG_MSG_P(PSTR("[NTP] Not synced\n"));
DEBUG_MSG_P(PSTR("[NTP] Not synced\n"));
return;
}

Expand Down Expand Up @@ -214,7 +214,7 @@ void _ntpConfigure() {
setenv("TZ", cfg_tz.c_str(), 1);
tzset();
}

const auto cfg_server = getSetting("ntpServer", F(NTP_SERVER));
const auto active_server = _ntpGetServer();
if (cfg_tz != active_tz) {
Expand Down
10 changes: 5 additions & 5 deletions code/espurna/sensors/BMP180Sensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ class BMP180Sensor : public I2CSensor<> {
_bmp180_calib.ac1 = i2c_read_int16(_address, BMP180_REGISTER_CAL_AC1);
_bmp180_calib.ac2 = i2c_read_int16(_address, BMP180_REGISTER_CAL_AC2);
_bmp180_calib.ac3 = i2c_read_int16(_address, BMP180_REGISTER_CAL_AC3);

_bmp180_calib.ac4 = i2c_read_uint16(_address, BMP180_REGISTER_CAL_AC4);
_bmp180_calib.ac5 = i2c_read_uint16(_address, BMP180_REGISTER_CAL_AC5);
_bmp180_calib.ac6 = i2c_read_uint16(_address, BMP180_REGISTER_CAL_AC6);
Expand All @@ -157,9 +157,9 @@ class BMP180Sensor : public I2CSensor<> {
_bmp180_calib.md = i2c_read_int16(_address, BMP180_REGISTER_CAL_MD);

}

// Compute B5 coefficient used in temperature & pressure calcs.
// Based on Adafruit_BMP085_Unified library
// Based on Adafruit_BMP085_Unified library
long _computeB5(unsigned long t) {
long X1 = (t - (long)_bmp180_calib.ac6) * ((long)_bmp180_calib.ac5) >> 15;
long X2 = ((long)_bmp180_calib.mc << 11) / (X1+(long)_bmp180_calib.md);
Expand Down Expand Up @@ -234,11 +234,11 @@ class BMP180Sensor : public I2CSensor<> {

int16_t b1;
int16_t b2;

int16_t mb;
int16_t mc;
int16_t md;

} bmp180_calib_t;

bmp180_calib_t _bmp180_calib;
Expand Down
34 changes: 17 additions & 17 deletions code/espurna/sensors/DallasSensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,31 +33,31 @@
#define DS2406_CHANNEL_ACCESS 0xF5;

// CHANNEL CONTROL BYTE
// 7 6 5 4 3 2 1 0
// 7 6 5 4 3 2 1 0
// ALR IM TOG IC CHS1 CHS0 CRC1 CRC0
// 0 1 0 0 0 1 0 1 0x45

// CHS1 CHS0 Description
// 0 0 (not allowed)
// 0 1 channel A only
// 1 0 channel B only
// 1 1 both channels interleaved
// CHS1 CHS0 Description
// 0 0 (not allowed)
// 0 1 channel A only
// 1 0 channel B only
// 1 1 both channels interleaved

// TOG IM CHANNELS EFFECT
// 0 0 one channel Write all bits to the selected channel
// 0 1 one channel Read all bits from the selected channel
// 1 0 one channel Write 8 bits, read 8 bits, write, read, etc. to/from the selected channel
// 1 1 one channel Read 8 bits, write 8 bits, read, write, etc. from/to the selected channel
// 0 0 two channels Repeat: four times (write A, write B)
// 0 1 two channels Repeat: four times (read A, read B)
// 1 0 two channels Four times: (write A, write B), four times: (readA, read B), write, read, etc.
// 0 0 one channel Write all bits to the selected channel
// 0 1 one channel Read all bits from the selected channel
// 1 0 one channel Write 8 bits, read 8 bits, write, read, etc. to/from the selected channel
// 1 1 one channel Read 8 bits, write 8 bits, read, write, etc. from/to the selected channel
// 0 0 two channels Repeat: four times (write A, write B)
// 0 1 two channels Repeat: four times (read A, read B)
// 1 0 two channels Four times: (write A, write B), four times: (readA, read B), write, read, etc.
// 1 1 two channels Four times: (read A, read B), four times: (write A, write B), read, write, etc.

// CRC1 CRC0 Description
// 0 0 CRC disabled (no CRC at all)
// 0 1 CRC after every byte
// 1 0 CRC after 8 bytes
// 1 1 CRC after 32 bytes
// 1 1 CRC after 32 bytes
#define DS2406_CHANNEL_CONTROL_BYTE 0x45;

#define DS2406_STATE_BUF_LEN 7
Expand Down Expand Up @@ -165,7 +165,7 @@ class DallasSensor : public BaseSensor {
_devices[index].data[0] = _devices[index].data[0] + 1;
return;
}

_wire->select(_devices[index].address);

data[0] = DS2406_CHANNEL_ACCESS;
Expand Down Expand Up @@ -261,8 +261,8 @@ class DallasSensor : public BaseSensor {
return MAGNITUDE_DIGITAL;
} else {
return MAGNITUDE_TEMPERATURE;
}
}
}
}
return MAGNITUDE_NONE;
}

Expand Down
10 changes: 5 additions & 5 deletions code/espurna/sensors/PZEM004TV30Sensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -342,11 +342,11 @@ class PZEM004TV30Sensor : public BaseEmonSensor {

// Quoting the README.md of the original library repo and datasheet, we have:
// (name, measuring range, resolution, accuracy)
// 1. Voltage 80~260V 0.1V 0.5%
// 2. Current 0~10A or 0~100A* 0.01A or 0.02A* 0.5%
// 3. Active power 0~2.3kW or 0~23kW* 0.1W 0.5%
// 4. Active energy 0~9999.99kWh 1Wh 0.5%
// 5. Frequency 45~65Hz 0.1Hz 0.5%
// 1. Voltage 80~260V 0.1V 0.5%
// 2. Current 0~10A or 0~100A* 0.01A or 0.02A* 0.5%
// 3. Active power 0~2.3kW or 0~23kW* 0.1W 0.5%
// 4. Active energy 0~9999.99kWh 1Wh 0.5%
// 5. Frequency 45~65Hz 0.1Hz 0.5%
// 6. Power factor 0.00~1.00 0.01 1%
void parseMeasurements(buffer_type&& buffer, size_t size) {
if (25 != size) {
Expand Down