Browse Source

Normalize code

i18n
Xose Pérez 6 years ago
parent
commit
e165c578a5
2 changed files with 14 additions and 13 deletions
  1. +13
    -12
      code/espurna/alexa.ino
  2. +1
    -1
      code/espurna/config/general.h

+ 13
- 12
code/espurna/alexa.ino View File

@ -9,19 +9,19 @@ Copyright (C) 2016-2018 by Xose Pérez <xose dot perez at gmail dot com>
#if ALEXA_SUPPORT
#include <fauxmoESP.h>
#include <queue>
fauxmoESP alexa;
// -----------------------------------------------------------------------------
// ALEXA
// -----------------------------------------------------------------------------
struct AlexaDevChange {
AlexaDevChange(unsigned char device_id, bool state) : device_id(device_id), state(state) {};
unsigned char device_id = 0;
bool state = false;
AlexaDevChange(unsigned char device_id, bool state) : device_id(device_id), state(state) {};
unsigned char device_id = 0;
bool state = false;
};
#include <queue>
static std::queue<AlexaDevChange> _alexa_dev_changes;
// -----------------------------------------------------------------------------
// ALEXA
// -----------------------------------------------------------------------------
void _alexaWebSocketOnSend(JsonObject& root) {
root["alexaVisible"] = 1;
root["alexaEnabled"] = getSetting("alexaEnabled", ALEXA_ENABLED).toInt() == 1;
@ -64,7 +64,7 @@ void alexaSetup() {
_alexa_dev_changes.push(change);
});
alexa.onGetState([relays](unsigned char device_id, const char * name) {
alexa.onGetState([](unsigned char device_id, const char * name) {
return relayStatus(device_id);
});
@ -75,11 +75,12 @@ void alexaLoop() {
alexa.handle();
while (!_alexa_dev_changes.empty()) {
AlexaDevChange& change = _alexa_dev_changes.front();
DEBUG_MSG_P(PSTR("[ALEXA] Device #%d state: %s\n"), change.device_id, change.state ? "ON" : "OFF");
relayStatus(change.device_id, change.state);
_alexa_dev_changes.pop();
AlexaDevChange& change = _alexa_dev_changes.front();
DEBUG_MSG_P(PSTR("[ALEXA] Device #%d state: %s\n"), change.device_id, change.state ? "ON" : "OFF");
relayStatus(change.device_id, change.state);
_alexa_dev_changes.pop();
}
}
#endif

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

@ -720,7 +720,7 @@ PROGMEM const char* const custom_reset_string[] = {
// This setting defines whether Alexa support should be built into the firmware
#ifndef ALEXA_SUPPORT
#define ALEXA_SUPPORT 1 // Enable Alexa support by default (9.5Kb)
#define ALEXA_SUPPORT 1 // Enable Alexa support by default (10.84Kb)
#endif
// This is default value for the alexaEnabled setting that defines whether


Loading…
Cancel
Save