Browse Source

Merge branch 'dev' into ascheduler

i18n
Xose Pérez 6 years ago
parent
commit
9d719421ba
6 changed files with 77 additions and 15 deletions
  1. +1
    -1
      code/espurna/config/version.h
  2. +2
    -1
      code/espurna/mqtt.ino
  3. +15
    -10
      code/espurna/settings.ino
  4. +44
    -2
      code/espurna/wifi.ino
  5. +5
    -1
      code/ota.py
  6. +10
    -0
      code/platformio.ini

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

@ -1,5 +1,5 @@
#define APP_NAME "ESPURNA" #define APP_NAME "ESPURNA"
#define APP_VERSION "1.11.4"
#define APP_VERSION "1.11.5a"
#define APP_AUTHOR "xose.perez@gmail.com" #define APP_AUTHOR "xose.perez@gmail.com"
#define APP_WEBSITE "http://tinkerman.cat" #define APP_WEBSITE "http://tinkerman.cat"
#define CFG_VERSION 3 #define CFG_VERSION 3

+ 2
- 1
code/espurna/mqtt.ino View File

@ -508,8 +508,9 @@ void mqttSetBrokerIfNone(IPAddress ip, unsigned int port) {
void mqttSetup() { void mqttSetup() {
DEBUG_MSG_P(PSTR("[MQTT] Async %s, Autoconnect %s\n"),
DEBUG_MSG_P(PSTR("[MQTT] Async %s, SSL %s, Autoconnect %s\n"),
MQTT_USE_ASYNC ? "ENABLED" : "DISABLED", MQTT_USE_ASYNC ? "ENABLED" : "DISABLED",
ASYNC_TCP_SSL_ENABLED ? "ENABLED" : "DISABLED",
MQTT_AUTOCONNECT ? "ENABLED" : "DISABLED" MQTT_AUTOCONNECT ? "ENABLED" : "DISABLED"
); );


+ 15
- 10
code/espurna/settings.ino View File

@ -308,6 +308,14 @@ void settingsSetup() {
}); });
#endif #endif
#if MQTT_SUPPORT
Embedis::command( F("MQTT.RESET"), [](Embedis* e) {
mqttConfigure();
mqttDisconnect();
DEBUG_MSG_P(PSTR("+OK\n"));
});
#endif
#if NOFUSS_SUPPORT #if NOFUSS_SUPPORT
Embedis::command( F("NOFUSS"), [](Embedis* e) { Embedis::command( F("NOFUSS"), [](Embedis* e) {
DEBUG_MSG_P(PSTR("+OK\n")); DEBUG_MSG_P(PSTR("+OK\n"));
@ -337,22 +345,19 @@ void settingsSetup() {
deferredReset(100, CUSTOM_RESET_TERMINAL); deferredReset(100, CUSTOM_RESET_TERMINAL);
}); });
#if MQTT_SUPPORT
Embedis::command( F("RESET.MQTT"), [](Embedis* e) {
mqttConfigure();
mqttDisconnect();
DEBUG_MSG_P(PSTR("+OK\n"));
});
#endif
Embedis::command( F("UPTIME"), [](Embedis* e) {
DEBUG_MSG_P(PSTR("Uptime: %d seconds\n"), getUptime());
DEBUG_MSG_P(PSTR("+OK\n"));
});
Embedis::command( F("RESET.WIFI"), [](Embedis* e) {
Embedis::command( F("WIFI.RESET"), [](Embedis* e) {
wifiConfigure(); wifiConfigure();
wifiDisconnect(); wifiDisconnect();
DEBUG_MSG_P(PSTR("+OK\n")); DEBUG_MSG_P(PSTR("+OK\n"));
}); });
Embedis::command( F("UPTIME"), [](Embedis* e) {
DEBUG_MSG_P(PSTR("Uptime: %d seconds\n"), getUptime());
Embedis::command( F("WIFI.SCAN"), [](Embedis* e) {
wifiScan();
DEBUG_MSG_P(PSTR("+OK\n")); DEBUG_MSG_P(PSTR("+OK\n"));
}); });


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

@ -111,8 +111,7 @@ void wifiConfigure() {
} }
} }
// Scan for best network only if we have more than 1 defined
jw.scanNetworks(i>1);
jw.scanNetworks(true);
} }
@ -144,12 +143,55 @@ void wifiStatus() {
DEBUG_MSG_P(PSTR("[WIFI] DNS %s\n"), WiFi.dnsIP().toString().c_str()); DEBUG_MSG_P(PSTR("[WIFI] DNS %s\n"), WiFi.dnsIP().toString().c_str());
DEBUG_MSG_P(PSTR("[WIFI] MASK %s\n"), WiFi.subnetMask().toString().c_str()); DEBUG_MSG_P(PSTR("[WIFI] MASK %s\n"), WiFi.subnetMask().toString().c_str());
DEBUG_MSG_P(PSTR("[WIFI] HOST %s\n"), WiFi.hostname().c_str()); DEBUG_MSG_P(PSTR("[WIFI] HOST %s\n"), WiFi.hostname().c_str());
DEBUG_MSG_P(PSTR("[WIFI] RSSI %d\n"), WiFi.RSSI());
} }
DEBUG_MSG_P(PSTR("[WIFI] ----------------------------------------------\n")); DEBUG_MSG_P(PSTR("[WIFI] ----------------------------------------------\n"));
} }
void wifiScan() {
DEBUG_MSG_P(PSTR("[WIFI] Start scanning\n"));
unsigned char result = WiFi.scanNetworks();
if (result == WIFI_SCAN_FAILED) {
DEBUG_MSG_P(PSTR("[WIFI] Scan failed\n"));
} else if (result == 0) {
DEBUG_MSG_P(PSTR("[WIFI] No networks found\n"));
} else {
DEBUG_MSG_P(PSTR("[WIFI] %d networks found:\n"), result);
// Populate defined networks with scan data
for (int8_t i = 0; i < result; ++i) {
String ssid_scan;
int32_t rssi_scan;
uint8_t sec_scan;
uint8_t* BSSID_scan;
int32_t chan_scan;
bool hidden_scan;
WiFi.getNetworkInfo(i, ssid_scan, sec_scan, rssi_scan, BSSID_scan, chan_scan, hidden_scan);
DEBUG_MSG_P(PSTR("[WIFI] - BSSID: %02X:%02X:%02X:%02X:%02X:%02X SEC: %s RSSI: %3d CH: %2d SSID: %s\n"),
BSSID_scan[1], BSSID_scan[2], BSSID_scan[3], BSSID_scan[4], BSSID_scan[5], BSSID_scan[6],
(sec_scan != ENC_TYPE_NONE ? "YES" : "NO "),
rssi_scan,
chan_scan,
(char *) ssid_scan.c_str()
);
}
}
WiFi.scanDelete();
}
bool wifiClean(unsigned char num) { bool wifiClean(unsigned char num) {
bool changed = false; bool changed = false;


+ 5
- 1
code/ota.py View File

@ -183,9 +183,13 @@ if __name__ == '__main__':
# Look for sevices # Look for sevices
zeroconf = Zeroconf() zeroconf = Zeroconf()
browser = ServiceBrowser(zeroconf, "_arduino._tcp.local.", handlers=[on_service_state_change]) browser = ServiceBrowser(zeroconf, "_arduino._tcp.local.", handlers=[on_service_state_change])
sleep(1)
sleep(5)
zeroconf.close() zeroconf.close()
if len(devices) == 0:
print "Nothing found!\n"
sys.exit(0)
# Sort list # Sort list
field = args.sort.lower() field = args.sort.lower()
if field not in devices[0]: if field not in devices[0]:


+ 10
- 0
code/platformio.ini View File

@ -167,6 +167,16 @@ upload_flags = --auth=fibonacci --port 8266
monitor_baud = 115200 monitor_baud = 115200
extra_scripts = ${common.extra_scripts} extra_scripts = ${common.extra_scripts}
[env:tinkerman-espurna-switch]
platform = ${common.platform}
framework = arduino
board = esp12e
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags} -DTINKERMAN_ESPURNA_SWITCH
monitor_baud = 115200
extra_scripts = ${common.extra_scripts}
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
[env:itead-sonoff-basic] [env:itead-sonoff-basic]


Loading…
Cancel
Save