Browse Source

Check defiitions in migrate.ino

v2
Xose Pérez 6 years ago
parent
commit
cc601c8d73
12 changed files with 1526 additions and 1034 deletions
  1. +0
    -1
      code/espurna/config/arduino.h
  2. +18
    -13
      code/espurna/config/hardware.h
  3. +9
    -0
      code/espurna/config/types.h
  4. +1
    -1
      code/espurna/config/version.h
  5. +6
    -0
      code/espurna/debug.ino
  6. +6
    -0
      code/espurna/ir.ino
  7. +1447
    -1005
      code/espurna/migrate.ino
  8. +11
    -0
      code/espurna/rf.ino
  9. +7
    -0
      code/espurna/rfbridge.ino
  10. +11
    -1
      code/espurna/sensor.ino
  11. +8
    -0
      code/espurna/uartmqtt.ino
  12. +2
    -13
      code/platformio.ini

+ 0
- 1
code/espurna/config/arduino.h View File

@ -61,7 +61,6 @@
//#define ARILUX_AL_LC01
//#define ARILUX_AL_LC11
//#define ARILUX_AL_LC02
//#define WEMOS_D1_TARPUNA_SHIELD
//#define GIZWITS_WITTY_CLOUD
//#define EUROMATE_WIFI_STECKER_SCHUKO
//#define TONBUX_POWERSTRIP02


+ 18
- 13
code/espurna/config/hardware.h View File

@ -70,12 +70,6 @@
#define LED1_PIN 2
#define LED1_PIN_INVERSE 1
#elif defined(NODEMCU_BASIC)
// Info
// Generic NodeMCU Board without any buttons or relays connected.
#define MANUFACTURER "NODEMCU"
#define DEVICE "BASIC"
#elif defined(WEMOS_D1_MINI_RELAYSHIELD)
// Info
@ -102,12 +96,6 @@
#define I2C_SDA_PIN 12 // D6
#define I2C_SCL_PIN 14 // D5
#elif defined(WEMOS_D1_TARPUNA_SHIELD)
// Info
#define MANUFACTURER "WEMOS"
#define DEVICE "D1_TARPUNA_SHIELD"
// -----------------------------------------------------------------------------
// ESPurna
// -----------------------------------------------------------------------------
@ -130,7 +118,7 @@
#define RELAY1_TYPE RELAY_TYPE_INVERSE
// LEDs
#define LED1_PIN 2
#define LED1_PIN 5
#define LED1_PIN_INVERSE 1
// HLW8012
@ -2359,6 +2347,23 @@
#define HLW8012_POWER_RATIO 3414290
#define HLW8012_INTERRUPT_ON FALLING
// -----------------------------------------------------------------------------
// Generic board with Geiger Counter
// -----------------------------------------------------------------------------
#elif defined(GENERIC_GEIGER_COUNTER)
// Info
#define MANUFACTURER "GENERIC"
#define DEVICE "GEIGER_COUNTER"
// Enable Geiger Counter
#define GEIGER_SUPPORT 1
// Disable uneeded modules
#define ALEXA_SUPPORT 0
#define SCHEDULER_SUPPORT 0
// -----------------------------------------------------------------------------
// TEST boards (do not use!!)
// -----------------------------------------------------------------------------


+ 9
- 0
code/espurna/config/types.h View File

@ -300,3 +300,12 @@
#define MAGNITUDE_GEIGER_SIEVERT 24
#define MAGNITUDE_MAX 25
//--------------------------------------------------------------------------------
// GPIO
//--------------------------------------------------------------------------------
#define GPIO_INVALID 0xFF
#define GPIO_LOGIC_DIRECT 0
#define GPIO_LOGIC_INVERSE 1

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

@ -3,4 +3,4 @@
#define APP_REVISION "d543fee"
#define APP_AUTHOR "xose.perez@gmail.com"
#define APP_WEBSITE "http://tinkerman.cat"
#define CFG_VERSION 3
#define CFG_VERSION 4

+ 6
- 0
code/espurna/debug.ino View File

@ -157,6 +157,10 @@ void debugWebSetup() {
#endif // DEBUG_WEB_SUPPORT
bool _debugKeyCheck(const char * key) {
return (strncmp(key, "dbg", 3) == 0);
}
void debugSetup() {
#if DEBUG_SERIAL_SUPPORT
@ -166,6 +170,8 @@ void debugSetup() {
#endif
#endif
settingsRegisterKeyCheck(_debugKeyCheck);
}
// -----------------------------------------------------------------------------


+ 6
- 0
code/espurna/ir.ino View File

@ -99,6 +99,9 @@ void _irProcessCode(unsigned long code) {
}
bool _irKeyCheck(const char * key) {
return (strncmp(key, "ir", 2) == 0);
}
// -----------------------------------------------------------------------------
// PUBLIC API
@ -109,6 +112,9 @@ void irSetup() {
_ir_recv = new IRrecv(IR_PIN);
_ir_recv->enableIRIn();
// Key Check
settingsRegisterKeyCheck(_irKeyCheck);
// Register loop
espurnaRegisterLoop(irLoop);


+ 1447
- 1005
code/espurna/migrate.ino
File diff suppressed because it is too large
View File


+ 11
- 0
code/espurna/rf.ino View File

@ -89,10 +89,16 @@ bool _rfMatch(unsigned long code, unsigned char& relayID, unsigned char& value)
}
bool _rfKeyCheck(const char * key) {
return (strncmp(key, "rfb", 3) == 0);
}
// -----------------------------------------------------------------------------
// WEB
// -----------------------------------------------------------------------------
#if WEB_SUPPORT
void _rfWebSocketOnSend(JsonObject& root) {
char buffer[20];
root["rfbVisible"] = 1;
@ -115,6 +121,8 @@ void _rfWebSocketOnAction(uint32_t client_id, const char * action, JsonObject& d
if (strcmp(action, "rfbsend") == 0) _rfStore(data["id"], data["status"], data["data"].as<long>());
}
#endif
// -----------------------------------------------------------------------------
void rfLoop() {
@ -186,6 +194,9 @@ void rfSetup() {
wsOnActionRegister(_rfWebSocketOnAction);
#endif
// Key Check
settingsRegisterKeyCheck(_rfKeyCheck);
// Register loop
espurnaRegisterLoop(rfLoop);


+ 7
- 0
code/espurna/rfbridge.ino View File

@ -518,6 +518,10 @@ void _rfbMqttCallback(unsigned int type, const char * topic, const char * payloa
}
#endif
bool _rfbKeyCheck(const char * key) {
return (strncmp(key, "rfb", 3) == 0);
}
// -----------------------------------------------------------------------------
// PUBLIC
// -----------------------------------------------------------------------------
@ -624,6 +628,9 @@ void rfbSetup() {
DEBUG_MSG_P(PSTR("[RFBRIDGE] RF transmitter on GPIO %u\n"), RFB_TX_PIN);
#endif
// Key Check
settingsRegisterKeyCheck(_rfbKeyCheck);
// Register loop
espurnaRegisterLoop(rfbLoop);


+ 11
- 1
code/espurna/sensor.ino View File

@ -4,7 +4,9 @@ SENSOR MODULE
Copyright (C) 2016-2018 by Xose Pérez <xose dot perez at gmail dot com>
Module key prefix: sns pwr ene cur vol tmp hum
Module key prefix: sns
Magnitude-based key prefix: pwr ene cur vol tmp hum
Sensor-based key previs: hlw bme dht ds cse v92 pze ech gei
*/
@ -842,7 +844,15 @@ bool _sensorKeyCheck(const char * key) {
if (strncmp(key, "tmp", 3) == 0) return true;
if (strncmp(key, "hum", 3) == 0) return true;
if (strncmp(key, "bme", 3) == 0) return true;
if (strncmp(key, "dht", 3) == 0) return true;
if (strncmp(key, "ds" , 2) == 0) return true;
if (strncmp(key, "hlw", 3) == 0) return true;
if (strncmp(key, "cse", 3) == 0) return true;
if (strncmp(key, "v92", 3) == 0) return true;
if (strncmp(key, "ech", 3) == 0) return true;
if (strncmp(key, "gei", 3) == 0) return true;
if (strncmp(key, "pze", 3) == 0) return true;
return false;
}


+ 8
- 0
code/espurna/uartmqtt.ino View File

@ -82,6 +82,11 @@ void _uartmqttMQTTCallback(unsigned int type, const char * topic, const char * p
}
bool _uartmqttKeyCheck(const char * key) {
return (strncmp(key, "u2m", 3) == 0);
}
// -----------------------------------------------------------------------------
// SETUP & LOOP
// -----------------------------------------------------------------------------
@ -99,6 +104,9 @@ void uartmqttSetup() {
// Register MQTT callbackj
mqttRegister(_uartmqttMQTTCallback);
// Register key check
settingsRegisterKeyCheck(_uartmqttKeyCheck);
// Register loop
espurnaRegisterLoop(_uartmqttLoop);


+ 2
- 13
code/platformio.ini View File

@ -327,17 +327,6 @@ build_flags = ${common.build_flags_4m1m} -DTINKERMAN_ESPURNA_SWITCH
monitor_speed = ${common.monitor_speed}
extra_scripts = ${common.extra_scripts}
[env:wemos-d1-tarpunashield]
platform = ${common.platform}
framework = ${common.framework}
board = ${common.board_4m}
board_build.flash_mode = ${common.flash_mode}
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_4m1m} -DWEMOS_D1_TARPUNA_SHIELD
monitor_speed = ${common.monitor_speed}
extra_scripts = ${common.extra_scripts}
# ------------------------------------------------------------------------------
[env:itead-sonoff-basic]
@ -2278,7 +2267,7 @@ board = ${common.board_4m}
board_build.flash_mode = ${common.flash_mode}
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m0m} -DNODEMCU_BASIC -DGEIGER_SUPPORT=1 -DEVENTS_SUPPORT=0 -DINFLUXDB_SUPPORT=1 -DALEXA_SUPPORT=0 -DALEXA_ENABLED=0
build_flags = ${common.build_flags_1m0m} -DGENERIC_GEIGER_COUNTER
upload_speed = ${common.upload_speed_fast}
monitor_speed = ${common.monitor_speed}
extra_scripts = ${common.extra_scripts}
@ -2290,7 +2279,7 @@ board = ${common.board_4m}
board_build.flash_mode = ${common.flash_mode}
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m0m} -DNODEMCU_BASIC -DGEIGER_SUPPORT=1 -DEVENTS_SUPPORT=0 -DINFLUXDB_SUPPORT=1 -DALEXA_SUPPORT=0 -DALEXA_ENABLED=0
build_flags = ${common.build_flags_1m0m} -DGENERIC_GEIGER_COUNTER
upload_speed = ${common.upload_speed_fast}
monitor_speed = ${common.monitor_speed}
upload_port = ${common.upload_port}


Loading…
Cancel
Save