Browse Source

Merge branch 'dev' into power

Conflicts:
	code/espurna/data/index.html.gz
	code/espurna/emon.ino
	code/espurna/hlw8012.ino
	code/espurna/static/index.html.gz.h
	code/espurna/v9261f.ino
fastled
Xose Pérez 7 years ago
parent
commit
65c4164b79
8 changed files with 3550 additions and 3575 deletions
  1. +0
    -3
      code/espurna/config/general.h
  2. BIN
      code/espurna/data/index.html.gz
  3. +2
    -2
      code/espurna/dht.ino
  4. +2
    -2
      code/espurna/ds18b20.ino
  5. +3543
    -3548
      code/espurna/static/index.html.gz.h
  6. +3
    -5
      code/espurna/web.ino
  7. +0
    -2
      code/espurna/wifi.ino
  8. +0
    -13
      code/html/index.html

+ 0
- 3
code/espurna/config/general.h View File

@ -262,9 +262,6 @@ PROGMEM const char* const custom_reset_string[] = {
#define WIFI_RECONNECT_INTERVAL 120000 // If could not connect to WIFI, retry after this time in ms #define WIFI_RECONNECT_INTERVAL 120000 // If could not connect to WIFI, retry after this time in ms
#define WIFI_MAX_NETWORKS 5 // Max number of WIFI connection configurations #define WIFI_MAX_NETWORKS 5 // Max number of WIFI connection configurations
#define WIFI_AP_MODE AP_MODE_ALONE #define WIFI_AP_MODE AP_MODE_ALONE
#ifndef WIFI_GAIN
#define WIFI_GAIN 0 // WiFi gain in dBm from 0 (normal) to 20.5 (max power and consumption)
#endif
// Optional hardcoded configuration (up to 2 different networks) // Optional hardcoded configuration (up to 2 different networks)
//#define WIFI1_SSID "..." //#define WIFI1_SSID "..."


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


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

@ -34,7 +34,7 @@ void dhtSetup() {
#if WEB_SUPPORT #if WEB_SUPPORT
apiRegister(DHT_TEMPERATURE_TOPIC, DHT_TEMPERATURE_TOPIC, [](char * buffer, size_t len) { apiRegister(DHT_TEMPERATURE_TOPIC, DHT_TEMPERATURE_TOPIC, [](char * buffer, size_t len) {
dtostrf(_dhtTemperature, len-1, 1, buffer);
dtostrf(_dhtTemperature, 1-len, 1, buffer);
}); });
apiRegister(DHT_HUMIDITY_TOPIC, DHT_HUMIDITY_TOPIC, [](char * buffer, size_t len) { apiRegister(DHT_HUMIDITY_TOPIC, DHT_HUMIDITY_TOPIC, [](char * buffer, size_t len) {
snprintf_P(buffer, len, PSTR("%d"), _dhtHumidity); snprintf_P(buffer, len, PSTR("%d"), _dhtHumidity);
@ -68,7 +68,7 @@ void dhtLoop() {
char temperature[6]; char temperature[6];
char humidity[6]; char humidity[6];
dtostrf(t, 4, 1, temperature);
dtostrf(t, 1-sizeof(temperature), 1, temperature);
itoa((unsigned int) h, humidity, 10); itoa((unsigned int) h, humidity, 10);
DEBUG_MSG_P(PSTR("[DHT] Temperature: %s%s\n"), temperature, (tmpUnits == TMP_CELSIUS) ? "ºC" : "ºF"); DEBUG_MSG_P(PSTR("[DHT] Temperature: %s%s\n"), temperature, (tmpUnits == TMP_CELSIUS) ? "ºC" : "ºF");


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

@ -40,7 +40,7 @@ void dsSetup() {
#if WEB_SUPPORT #if WEB_SUPPORT
apiRegister(DS18B20_TEMPERATURE_TOPIC, DS18B20_TEMPERATURE_TOPIC, [](char * buffer, size_t len) { apiRegister(DS18B20_TEMPERATURE_TOPIC, DS18B20_TEMPERATURE_TOPIC, [](char * buffer, size_t len) {
dtostrf(_dsTemperature, len-1, 1, buffer);
dtostrf(_dsTemperature, 1-len, 1, buffer);
}); });
#endif #endif
@ -89,7 +89,7 @@ void dsLoop() {
else else
_dsIsConnected = true; _dsIsConnected = true;
dtostrf(t, 5, 1, _dsTemperatureStr);
dtostrf(t, 1-sizeof(_dsTemperatureStr), 1, _dsTemperatureStr);
DEBUG_MSG_P(PSTR("[DS18B20] Temperature: %s%s\n"), DEBUG_MSG_P(PSTR("[DS18B20] Temperature: %s%s\n"),
getDSTemperatureStr(), getDSTemperatureStr(),


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


+ 3
- 5
code/espurna/web.ino View File

@ -642,7 +642,6 @@ void _wsStart(uint32_t client_id) {
} }
#endif #endif
root["wifiGain"] = getSetting("wifiGain", WIFI_GAIN).toFloat();
root["maxNetworks"] = WIFI_MAX_NETWORKS; root["maxNetworks"] = WIFI_MAX_NETWORKS;
JsonArray& wifi = root.createNestedArray("wifi"); JsonArray& wifi = root.createNestedArray("wifi");
for (byte i=0; i<WIFI_MAX_NETWORKS; i++) { for (byte i=0; i<WIFI_MAX_NETWORKS; i++) {
@ -820,7 +819,6 @@ ArRequestHandlerFunction _bindAPI(unsigned int apiID) {
// Get response from callback // Get response from callback
char value[API_BUFFER_SIZE]; char value[API_BUFFER_SIZE];
(api.getFn)(value, API_BUFFER_SIZE); (api.getFn)(value, API_BUFFER_SIZE);
char *p = ltrim(value);
// The response will be a 404 NOT FOUND if the resource is not available // The response will be a 404 NOT FOUND if the resource is not available
if (!value) { if (!value) {
@ -828,15 +826,15 @@ ArRequestHandlerFunction _bindAPI(unsigned int apiID) {
request->send(404); request->send(404);
return; return;
} }
DEBUG_MSG_P(PSTR("[API] Sending response '%s'\n"), p);
DEBUG_MSG_P(PSTR("[API] Sending response '%s'\n"), value);
// Format response according to the Accept header // Format response according to the Accept header
if (_asJson(request)) { if (_asJson(request)) {
char buffer[64]; char buffer[64];
snprintf_P(buffer, sizeof(buffer), PSTR("{ \"%s\": %s }"), api.key, p);
snprintf_P(buffer, sizeof(buffer), PSTR("{ \"%s\": %s }"), api.key, value);
request->send(200, "application/json", buffer); request->send(200, "application/json", buffer);
} else { } else {
request->send(200, "text/plain", p);
request->send(200, "text/plain", value);
} }
}; };


+ 0
- 2
code/espurna/wifi.ino View File

@ -47,8 +47,6 @@ bool createAP() {
void wifiConfigure() { void wifiConfigure() {
WiFi.setOutputPower(getSetting("wifiGain", WIFI_GAIN).toFloat());
jw.setHostname(getSetting("hostname").c_str()); jw.setHostname(getSetting("hostname").c_str());
jw.setSoftAP(getSetting("hostname").c_str(), getSetting("adminPass", ADMIN_PASS).c_str()); jw.setSoftAP(getSetting("hostname").c_str(), getSetting("adminPass", ADMIN_PASS).c_str());
jw.setConnectTimeout(WIFI_CONNECT_TIMEOUT); jw.setConnectTimeout(WIFI_CONNECT_TIMEOUT);


+ 0
- 13
code/html/index.html View File

@ -387,19 +387,6 @@
<div class="pure-u-1 pure-u-sm-1-4"><input type="checkbox" name="alexaEnabled" tabindex="11" /></div> <div class="pure-u-1 pure-u-sm-1-4"><input type="checkbox" name="alexaEnabled" tabindex="11" /></div>
</div> </div>
<div class="pure-g">
<label class="pure-u-1 pure-u-md-1-4" for="wifiGain">WiFi gain</label>
<div class="pure-u-1 pure-u-md-3-4">
<select name="wifiGain" class="pure-u-3-4" tabindex="3">
<option value="0">Normal</a>
<option value="10">High</a>
<option value="20.5">Highest</a>
</select>
</div>
<div class="pure-u-0 pure-u-md-1-4">&nbsp;</div>
<div class="pure-u-1 pure-u-md-3-4 hint">More gain means better range but also more power consumption. Might not work equally on all devices.</div>
</div>
<div class="pure-g module module-ha"> <div class="pure-g module module-ha">
<label class="pure-u-1 pure-u-md-1-4" for="haPrefix">Home Assistant Prefix</label> <label class="pure-u-1 pure-u-md-1-4" for="haPrefix">Home Assistant Prefix</label>
<input class="pure-u-1 pure-u-md-1-2" name="haPrefix" type="text" tabindex="31" /> <input class="pure-u-1 pure-u-md-1-2" name="haPrefix" type="text" tabindex="31" />


Loading…
Cancel
Save