Browse Source

compat: c++ alternative to the UNUSED / void-cast macro

mcspr-patch-1
Maxim Prokhorov 4 years ago
parent
commit
0f11b662a1
7 changed files with 5 additions and 16 deletions
  1. +0
    -2
      code/espurna/compat.h
  2. +1
    -4
      code/espurna/sensors/ECH1560Sensor.h
  3. +1
    -2
      code/espurna/sensors/EmonADC121Sensor.h
  4. +1
    -2
      code/espurna/sensors/EmonADS1X15Sensor.h
  5. +1
    -2
      code/espurna/sensors/EmonAnalogSensor.h
  6. +0
    -2
      code/espurna/sensors/EventSensor.h
  7. +1
    -2
      code/espurna/sensors/GeigerSensor.h

+ 0
- 2
code/espurna/compat.h View File

@ -111,5 +111,3 @@ namespace std {
#endif #endif
#define UNUSED(x) (void)(x)

+ 1
- 4
code/espurna/sensors/ECH1560Sensor.h View File

@ -123,10 +123,7 @@ class ECH1560Sensor : public BaseEmonSensor {
return 0; return 0;
} }
void ICACHE_RAM_ATTR handleInterrupt(unsigned char gpio) {
UNUSED(gpio);
void ICACHE_RAM_ATTR handleInterrupt(unsigned char) {
// if we are trying to find the sync-time (CLK goes high for 1-2ms) // if we are trying to find the sync-time (CLK goes high for 1-2ms)
if (_dosync == false) { if (_dosync == false) {


+ 1
- 2
code/espurna/sensors/EmonADC121Sensor.h View File

@ -143,8 +143,7 @@ class EmonADC121Sensor : public EmonSensor {
i2c_write_uint8(_address, ADC121_REG_CONFIG, 0); i2c_write_uint8(_address, ADC121_REG_CONFIG, 0);
} }
unsigned int readADC(unsigned char channel) {
UNUSED(channel);
unsigned int readADC(unsigned char) {
unsigned int value = i2c_read_uint16(_address, ADC121_REG_RESULT) & 0x0FFF; unsigned int value = i2c_read_uint16(_address, ADC121_REG_RESULT) & 0x0FFF;
return value; return value;
} }


+ 1
- 2
code/espurna/sensors/EmonADS1X15Sensor.h View File

@ -336,8 +336,7 @@ class EmonADS1X15Sensor : public EmonSensor {
} }
unsigned int readADC(unsigned char channel) {
UNUSED(channel);
unsigned int readADC(unsigned char) {
unsigned int value = i2c_read_uint16(_address, ADS1X15_REG_POINTER_CONVERT); unsigned int value = i2c_read_uint16(_address, ADS1X15_REG_POINTER_CONVERT);
if (_type == ADS1X15_CHIP_ADS1015) value >>= ADS1015_BIT_SHIFT; if (_type == ADS1X15_CHIP_ADS1015) value >>= ADS1015_BIT_SHIFT;
delayMicroseconds(500); delayMicroseconds(500);


+ 1
- 2
code/espurna/sensors/EmonAnalogSensor.h View File

@ -117,8 +117,7 @@ class EmonAnalogSensor : public EmonSensor {
protected: protected:
unsigned int readADC(unsigned char channel) {
UNUSED(channel);
unsigned int readADC(unsigned char) {
return analogRead(0); return analogRead(0);
} }


+ 0
- 2
code/espurna/sensors/EventSensor.h View File

@ -138,8 +138,6 @@ class EventSensor : public BaseSensor {
// Handle interrupt calls from isr[GPIO] functions // Handle interrupt calls from isr[GPIO] functions
void ICACHE_RAM_ATTR handleInterrupt(unsigned char gpio) { void ICACHE_RAM_ATTR handleInterrupt(unsigned char gpio) {
UNUSED(gpio);
// clock count in 32bit value, overflowing: // clock count in 32bit value, overflowing:
// ~53s when F_CPU is 80MHz // ~53s when F_CPU is 80MHz
// ~26s when F_CPU is 160MHz // ~26s when F_CPU is 160MHz


+ 1
- 2
code/espurna/sensors/GeigerSensor.h View File

@ -169,8 +169,7 @@ double value(unsigned char index) {
// Handle interrupt calls // Handle interrupt calls
void handleInterrupt(unsigned char gpio) {
UNUSED(gpio);
void handleInterrupt(unsigned char) {
static unsigned long last = 0; static unsigned long last = 0;
if (millis() - last > _debounce) { if (millis() - last > _debounce) {
_events = _events + 1; _events = _events + 1;


Loading…
Cancel
Save