Browse Source

Fix several compiling issues

rfm69
Xose Pérez 6 years ago
parent
commit
475d1627ff
7 changed files with 3264 additions and 3285 deletions
  1. +4
    -4
      README.md
  2. +3
    -2
      code/espurna/config/prototypes.h
  3. BIN
      code/espurna/data/index.html.gz
  4. +28
    -35
      code/espurna/sensor.ino
  5. +12
    -8
      code/espurna/settings.ino
  6. +3217
    -3212
      code/espurna/static/index.html.gz.h
  7. +0
    -24
      code/platformio.ini

+ 4
- 4
README.md View File

@ -3,10 +3,10 @@
ESPurna ("spark" in Catalan) is a custom firmware for ESP8266 based smart switches and sensors. ESPurna ("spark" in Catalan) is a custom firmware for ESP8266 based smart switches and sensors.
It uses the Arduino Core for ESP8266 framework and a number of 3rd party libraries. It uses the Arduino Core for ESP8266 framework and a number of 3rd party libraries.
[![version](https://img.shields.io/badge/version-1.12.4a-brightgreen.svg)](CHANGELOG.md)
![branch](https://img.shields.io/badge/branch-sensors-orange.svg)
[![travis](https://travis-ci.org/xoseperez/espurna.svg?branch=sensors)](https://travis-ci.org/xoseperez/espurna)
[![codacy](https://img.shields.io/codacy/grade/c9496e25cf07434cba786b462cb15f49/sensors.svg)](https://www.codacy.com/app/xoseperez/espurna/dashboard)
[![version](https://img.shields.io/badge/version-1.12.5-brightgreen.svg)](CHANGELOG.md)
![branch](https://img.shields.io/badge/branch-dev-orange.svg)
[![travis](https://travis-ci.org/xoseperez/espurna.svg?branch=dev)](https://travis-ci.org/xoseperez/espurna)
[![codacy](https://img.shields.io/codacy/grade/c9496e25cf07434cba786b462cb15f49/dev.svg)](https://www.codacy.com/app/xoseperez/espurna/dashboard)
[![donate](https://img.shields.io/badge/donate-PayPal-blue.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=xose%2eperez%40gmail%2ecom&lc=US&no_note=0&currency_code=EUR&bn=PP%2dDonationsBF%3abtn_donate_LG%2egif%3aNonHostedGuest) [![donate](https://img.shields.io/badge/donate-PayPal-blue.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=xose%2eperez%40gmail%2ecom&lc=US&no_note=0&currency_code=EUR&bn=PP%2dDonationsBF%3abtn_donate_LG%2egif%3aNonHostedGuest)
[![twitter](https://img.shields.io/twitter/follow/xoseperez.svg?style=social)](https://twitter.com/intent/follow?screen_name=xoseperez) [![twitter](https://img.shields.io/twitter/follow/xoseperez.svg?style=social)](https://twitter.com/intent/follow?screen_name=xoseperez)


+ 3
- 2
code/espurna/config/prototypes.h View File

@ -67,10 +67,11 @@ void settingsRegisterCommand(const String& name, void (*call)(Embedis*));
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// I2C // I2C
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
unsigned char i2cFindAndLock(size_t size, unsigned char * addresses);
void i2cScan();
void i2cClearBus();
bool i2cGetLock(unsigned char address); bool i2cGetLock(unsigned char address);
bool i2cReleaseLock(unsigned char address); bool i2cReleaseLock(unsigned char address);
void i2cClearBus();
unsigned char i2cFindAndLock(size_t size, unsigned char * addresses);
void i2c_write_buffer(uint8_t address, uint8_t * buffer, size_t len); void i2c_write_buffer(uint8_t address, uint8_t * buffer, size_t len);
void i2c_write_uint8(uint8_t address, uint8_t value); void i2c_write_uint8(uint8_t address, uint8_t value);


BIN
code/espurna/data/index.html.gz View File


+ 28
- 35
code/espurna/sensor.ino View File

@ -511,7 +511,34 @@ void _sensorInit() {
} }
// Initialize magnitudes // Initialize magnitudes
_magnitudesInit(_sensors[i]);
for (unsigned char k=0; k<_sensors[i]->count(); k++) {
unsigned char type = _sensors[i]->type(k);
sensor_magnitude_t new_magnitude;
new_magnitude.sensor = _sensors[i];
new_magnitude.local = k;
new_magnitude.type = type;
new_magnitude.global = _counts[type];
new_magnitude.current = 0;
new_magnitude.filtered = 0;
new_magnitude.reported = 0;
new_magnitude.min_change = 0;
if (type == MAGNITUDE_DIGITAL) {
new_magnitude.filter = new MaxFilter();
} else if (type == MAGNITUDE_EVENTS) {
new_magnitude.filter = new MovingAverageFilter();
} else {
new_magnitude.filter = new MedianFilter();
}
new_magnitude.filter->resize(_sensor_report_every);
_magnitudes.push_back(new_magnitude);
DEBUG_MSG_P(PSTR("[SENSOR] -> %s:%d\n"), magnitudeTopic(type).c_str(), _counts[type]);
_counts[type] = _counts[type] + 1;
}
// Hook callback // Hook callback
_sensors[i]->onEvent([i](unsigned char type, const char * payload) { _sensors[i]->onEvent([i](unsigned char type, const char * payload) {
@ -565,40 +592,6 @@ void _sensorInit() {
} }
void _magnitudesInit(BaseSensor * sensor) {
for (unsigned char k=0; k<sensor->count(); k++) {
unsigned char type = sensor->type(k);
sensor_magnitude_t new_magnitude;
new_magnitude.sensor = sensor;
new_magnitude.local = k;
new_magnitude.type = type;
new_magnitude.global = _counts[type];
new_magnitude.current = 0;
new_magnitude.filtered = 0;
new_magnitude.reported = 0;
new_magnitude.min_change = 0;
if (type == MAGNITUDE_DIGITAL) {
new_magnitude.filter = new MaxFilter();
} else if (type == MAGNITUDE_EVENTS) {
new_magnitude.filter = new MovingAverageFilter();
} else {
new_magnitude.filter = new MedianFilter();
}
new_magnitude.filter->resize(_sensor_report_every);
_magnitudes.push_back(new_magnitude);
DEBUG_MSG_P(PSTR("[SENSOR] -> %s:%d\n"), magnitudeTopic(type).c_str(), _counts[type]);
_counts[type] = _counts[type] + 1;
}
}
void _sensorConfigure() { void _sensorConfigure() {
// General sensor settings // General sensor settings


+ 12
- 8
code/espurna/settings.ino View File

@ -218,15 +218,19 @@ void _settingsInitCommands() {
*((int*) 0) = 0; // see https://github.com/esp8266/Arduino/issues/1494 *((int*) 0) = 0; // see https://github.com/esp8266/Arduino/issues/1494
}); });
settingsRegisterCommand(F("I2C.SCAN"), [](Embedis* e) {
i2cScan();
DEBUG_MSG_P(PSTR("+OK\n"));
});
#if I2C_SUPPORT
settingsRegisterCommand(F("I2C.CLEAR"), [](Embedis* e) {
i2cClearBus();
DEBUG_MSG_P(PSTR("+OK\n"));
});
settingsRegisterCommand(F("I2C.SCAN"), [](Embedis* e) {
_settingsI2CScanCommand();
DEBUG_MSG_P(PSTR("+OK\n"));
});
settingsRegisterCommand(F("I2C.CLEAR"), [](Embedis* e) {
i2cClearBus();
DEBUG_MSG_P(PSTR("+OK\n"));
});
#endif
settingsRegisterCommand(F("FACTORY.RESET"), [](Embedis* e) { settingsRegisterCommand(F("FACTORY.RESET"), [](Embedis* e) {
_settingsFactoryResetCommand(); _settingsFactoryResetCommand();


+ 3217
- 3212
code/espurna/static/index.html.gz.h
File diff suppressed because it is too large
View File


+ 0
- 24
code/platformio.ini View File

@ -916,30 +916,6 @@ upload_flags = --auth=fibonacci --port 8266
monitor_baud = 115200 monitor_baud = 115200
extra_scripts = ${common.extra_scripts} extra_scripts = ${common.extra_scripts}
[env:magichome-led-controller-23]
platform = ${common.platform}
framework = arduino
board = esp01_1m
board_flash_mode = dout
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DMAGICHOME_LED_CONTROLLER_23
monitor_baud = 115200
extra_scripts = ${common.extra_scripts}
[env:magichome-led-controller-23-ota]
platform = ${common.platform}
framework = arduino
board = esp01_1m
board_flash_mode = dout
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DMAGICHOME_LED_CONTROLLER_23
upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266
monitor_baud = 115200
extra_scripts = ${common.extra_scripts}
[env:huacanxing-h801] [env:huacanxing-h801]
platform = ${common.platform} platform = ${common.platform}
framework = arduino framework = arduino


Loading…
Cancel
Save