Browse Source

Fix compiler warnings

Add button definitions to the travis02 and travis03
IR_BUTTON should be uint32_t to properly work with new macro
eepromRotate return value is not used
ech1560
Maxim Prokhorov 6 years ago
parent
commit
8a0b3bca42
10 changed files with 25 additions and 17 deletions
  1. +1
    -1
      code/espurna/config/general.h
  2. +10
    -0
      code/espurna/config/hardware.h
  3. +1
    -1
      code/espurna/eeprom.ino
  4. +2
    -2
      code/espurna/i2c.ino
  5. +1
    -1
      code/espurna/ir.ino
  6. +1
    -1
      code/espurna/relay.ino
  7. +5
    -7
      code/espurna/sensor.ino
  8. +1
    -1
      code/espurna/sensors/DHTSensor.h
  9. +2
    -2
      code/espurna/sensors/EmonSensor.h
  10. +1
    -1
      code/espurna/ssdp.ino

+ 1
- 1
code/espurna/config/general.h View File

@ -1080,7 +1080,7 @@
#define IR_BUTTON_COUNT 24 #define IR_BUTTON_COUNT 24
const unsigned long IR_BUTTON[IR_BUTTON_COUNT][3] PROGMEM = {
const uint32_t IR_BUTTON[IR_BUTTON_COUNT][3] PROGMEM = {
{ 0xFF906F, IR_BUTTON_MODE_BRIGHTER, 1 }, { 0xFF906F, IR_BUTTON_MODE_BRIGHTER, 1 },
{ 0xFFB847, IR_BUTTON_MODE_BRIGHTER, 0 }, { 0xFFB847, IR_BUTTON_MODE_BRIGHTER, 0 },


+ 10
- 0
code/espurna/config/hardware.h View File

@ -2555,6 +2555,11 @@
#define MANUFACTURER "TravisCI" #define MANUFACTURER "TravisCI"
#define DEVICE "Virtual board 02" #define DEVICE "Virtual board 02"
// Some buttons - pin 0
#define BUTTON1_PIN 0
#define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON1_RELAY 1
// A bit of CSE7766 - pin 1 // A bit of CSE7766 - pin 1
#ifndef CSE7766_SUPPORT #ifndef CSE7766_SUPPORT
#define CSE7766_SUPPORT 1 #define CSE7766_SUPPORT 1
@ -2622,6 +2627,11 @@
#define MANUFACTURER "TravisCI" #define MANUFACTURER "TravisCI"
#define DEVICE "Virtual board 03" #define DEVICE "Virtual board 03"
// Some buttons - pin 0
#define BUTTON1_PIN 0
#define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON1_RELAY 1
// MY9231 Light - pins 1,2 // MY9231 Light - pins 1,2
#define RELAY_PROVIDER RELAY_PROVIDER_LIGHT #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT
#define LIGHT_PROVIDER LIGHT_PROVIDER_MY92XX #define LIGHT_PROVIDER LIGHT_PROVIDER_MY92XX


+ 1
- 1
code/espurna/eeprom.ino View File

@ -8,7 +8,7 @@ EEPROM MODULE
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
bool eepromRotate(bool value) {
void eepromRotate(bool value) {
// Enable/disable EEPROM rotation only if we are using more sectors than the // Enable/disable EEPROM rotation only if we are using more sectors than the
// reserved by the memory layout // reserved by the memory layout
if (EEPROMr.size() > EEPROMr.reserved()) { if (EEPROMr.size() > EEPROMr.reserved()) {


+ 2
- 2
code/espurna/i2c.ino View File

@ -230,7 +230,7 @@ uint16_t i2c_read_uint16(uint8_t address, uint8_t reg) {
void i2c_read_buffer(uint8_t address, uint8_t * buffer, size_t len) { void i2c_read_buffer(uint8_t address, uint8_t * buffer, size_t len) {
Wire.beginTransmission((uint8_t) address); Wire.beginTransmission((uint8_t) address);
Wire.requestFrom(address, (uint8_t) len); Wire.requestFrom(address, (uint8_t) len);
for (int i=0; i<len; i++) buffer[i] = Wire.read();
for (size_t i=0; i<len; i++) buffer[i] = Wire.read();
Wire.endTransmission(); Wire.endTransmission();
} }
@ -332,7 +332,7 @@ unsigned char i2cFind(size_t size, unsigned char * addresses) {
unsigned char i2cFindAndLock(size_t size, unsigned char * addresses) { unsigned char i2cFindAndLock(size_t size, unsigned char * addresses) {
unsigned char start = 0; unsigned char start = 0;
unsigned char address = 0; unsigned char address = 0;
while (address = i2cFind(size, addresses, start)) {
while ((address = i2cFind(size, addresses, start))) {
if (i2cGetLock(address)) break; if (i2cGetLock(address)) break;
start++; start++;
} }


+ 1
- 1
code/espurna/ir.ino View File

@ -34,7 +34,7 @@ void _irProcessCode(unsigned long code) {
for (unsigned char i = 0; i < IR_BUTTON_COUNT ; i++) { for (unsigned char i = 0; i < IR_BUTTON_COUNT ; i++) {
unsigned long button_code = pgm_read_dword(&IR_BUTTON[i][0]);
uint32_t button_code = pgm_read_dword(&IR_BUTTON[i][0]);
if (code == button_code) { if (code == button_code) {
unsigned long button_mode = pgm_read_dword(&IR_BUTTON[i][1]); unsigned long button_mode = pgm_read_dword(&IR_BUTTON[i][1]);


+ 1
- 1
code/espurna/relay.ino View File

@ -99,7 +99,7 @@ void _relayProviderStatus(unsigned char id, bool status) {
if (_relays.size() == lightChannels()) { if (_relays.size() == lightChannels()) {
lightState(id, status); lightState(id, status);
lightState(true); lightState(true);
} else if (_relays.size() == lightChannels() + 1) {
} else if (_relays.size() == (lightChannels() + 1u)) {
if (id == 0) { if (id == 0) {
lightState(status); lightState(status);
} else { } else {


+ 5
- 7
code/espurna/sensor.ino View File

@ -720,7 +720,7 @@ void _sensorConfigure() {
double value; double value;
EmonAnalogSensor * sensor = (EmonAnalogSensor *) _sensors[i]; EmonAnalogSensor * sensor = (EmonAnalogSensor *) _sensors[i];
if (value = getSetting("pwrExpectedP", 0).toInt()) {
if ((value = getSetting("pwrExpectedP", 0).toInt())) {
sensor->expectedPower(0, value); sensor->expectedPower(0, value);
setSetting("pwrRatioC", sensor->getCurrentRatio(0)); setSetting("pwrRatioC", sensor->getCurrentRatio(0));
} }
@ -807,17 +807,17 @@ void _sensorConfigure() {
double value; double value;
CSE7766Sensor * sensor = (CSE7766Sensor *) _sensors[i]; CSE7766Sensor * sensor = (CSE7766Sensor *) _sensors[i];
if (value = getSetting("pwrExpectedC", 0).toFloat()) {
if ((value = getSetting("pwrExpectedC", 0).toFloat())) {
sensor->expectedCurrent(value); sensor->expectedCurrent(value);
setSetting("pwrRatioC", sensor->getCurrentRatio()); setSetting("pwrRatioC", sensor->getCurrentRatio());
} }
if (value = getSetting("pwrExpectedV", 0).toInt()) {
if ((value = getSetting("pwrExpectedV", 0).toInt())) {
sensor->expectedVoltage(value); sensor->expectedVoltage(value);
setSetting("pwrRatioV", sensor->getVoltageRatio()); setSetting("pwrRatioV", sensor->getVoltageRatio());
} }
if (value = getSetting("pwrExpectedP", 0).toInt()) {
if ((value = getSetting("pwrExpectedP", 0).toInt())) {
sensor->expectedPower(value); sensor->expectedPower(value);
setSetting("pwrRatioP", sensor->getPowerRatio()); setSetting("pwrRatioP", sensor->getPowerRatio());
} }
@ -1034,12 +1034,10 @@ void sensorLoop() {
current = _magnitudeProcess(magnitude.type, current); current = _magnitudeProcess(magnitude.type, current);
_magnitudes[i].current = current; _magnitudes[i].current = current;
unsigned char decimals = _magnitudeDecimals(magnitude.type);
// Debug // Debug
#if SENSOR_DEBUG #if SENSOR_DEBUG
{ {
dtostrf(current, 1-sizeof(buffer), decimals, buffer);
dtostrf(current, 1-sizeof(buffer), _magnitudeDecimals(magnitude.type), buffer);
DEBUG_MSG_P(PSTR("[SENSOR] %s - %s: %s%s\n"), DEBUG_MSG_P(PSTR("[SENSOR] %s - %s: %s%s\n"),
magnitude.sensor->slot(magnitude.local).c_str(), magnitude.sensor->slot(magnitude.local).c_str(),
magnitudeTopic(magnitude.type).c_str(), magnitudeTopic(magnitude.type).c_str(),


+ 1
- 1
code/espurna/sensors/DHTSensor.h View File

@ -221,7 +221,7 @@ class DHTSensor : public BaseSensor {
} }
unsigned long _signal(int usTimeOut, bool state) {
unsigned long _signal(unsigned long usTimeOut, bool state) {
unsigned long uSec = 1; unsigned long uSec = 1;
while (digitalRead(_gpio) == state) { while (digitalRead(_gpio) == state) {
if (++uSec > usTimeOut) return 0; if (++uSec > usTimeOut) return 0;


+ 2
- 2
code/espurna/sensors/EmonSensor.h View File

@ -154,8 +154,8 @@ class EmonSensor : public I2CSensor {
unsigned int s = 1; unsigned int s = 1;
unsigned int i = 1; unsigned int i = 1;
unsigned int m = s * i;
unsigned int multiplier;
unsigned int m = 1;
unsigned int multiplier = 1;
while (m * _current_factor[channel] < 1) { while (m * _current_factor[channel] < 1) {
multiplier = m; multiplier = m;
i = (i == 1) ? 2 : (i == 2) ? 5 : 1; i = (i == 1) ? 2 : (i == 2) ? 5 : 1;


+ 1
- 1
code/espurna/ssdp.ino View File

@ -46,7 +46,7 @@ void ssdpSetup() {
char response[strlen_P(_ssdp_template) + 100]; char response[strlen_P(_ssdp_template) + 100];
snprintf_P(response, sizeof(response), _ssdp_template, snprintf_P(response, sizeof(response), _ssdp_template,
WiFi.localIP().toString().c_str(), // ip
ip.toString().c_str(), // ip
webPort(), // port webPort(), // port
SSDP_DEVICE_TYPE, // device type SSDP_DEVICE_TYPE, // device type
getSetting("hostname").c_str(), // friendlyName getSetting("hostname").c_str(), // friendlyName


Loading…
Cancel
Save