Skip to content
Snippets Groups Projects
Commit 38d90a17 authored by francois's avatar francois
Browse files

update

parent 0774e3bf
No related branches found
No related tags found
No related merge requests found
......@@ -22,7 +22,7 @@ function boards_install() {
SDK_DIR="~/.arduino15/packages/${ARCH,,}/hardware/${ARCH,,}/${SDK_REV}"
eval SDK_DIR=${SDK_DIR}
[ -d ${SDK_DIR} ] || { echo -e "unable to find dir '${SDK_DIR}' ... aborting" >&2; return 1; }
[ -d ${SDK_DIR} ] || { echo -e "unable to find ${ARCH,,} SDK dir '${SDK_DIR}' ... wrong revision ??" >&2; return 1; }
echo -e "# Detected ${ARCH,,} SDK dir:"
printf "%-80s\n" "${SDK_DIR}"
......
......@@ -37,7 +37,7 @@
*/
#define BOARD_NAME "neOSensor"
#define BOARD_REVISION 1.1
#define BOARD_FWREV 200901 // Firmware revision <year><month><day> in 2 digits each
#define BOARD_FWREV 201001 // Firmware revision <year><month><day> in 2 digits each
/* #############################################################################
......
......@@ -30,7 +30,7 @@
*/
#define BOARD_NAME "AirQuality" // no more than 10 chars
#define BOARD_REVISION 1.0
#define BOARD_FWREV 200901 // Firmware revision <year><month><day> in 2 digits each
#define BOARD_FWREV 201002 // Firmware revision <year><month><day> in 2 digits each
// define what is an invalid gpio
......
......@@ -26,7 +26,11 @@
#include <Arduino.h>
#include <ArduinoJson.h>
#include "WiFi.h"
#if defined(ESP8266)
#include <ESP8266WiFi.h>
#elif defined(ESP32)
#include <WiFi.h>
#endif
#include "neocampus.h"
#include "PubSubClient.h"
......
......@@ -553,8 +553,7 @@ bool neOSensor_reset( void ) {
*/
const char *_prefix = PSTR(MCFG_FILE_PREFIX);
const char *_suffix = PSTR(MCFG_FILE_SUFFIX);
#ifdef ESP8266
#warning "code not tested!"
#if defined(ESP8266)
Dir dir = SPIFFS.openDir("/");
while( dir.next() ) {
log_debug(F("\n[reset] found file: "));log_debug(dir.fileName());log_flush();
......@@ -562,7 +561,7 @@ bool neOSensor_reset( void ) {
if( not strstr_P( dir.fileName().c_str(), _suffix ) ) continue;
// delete matching file
log_debug(F("\n[reset] deleting file : "));log_debug(dir.fileName());log_flush();
if( !SPIFFS.remove(dir.filename()) ) {
if( !SPIFFS.remove(dir.fileName()) ) {
log_warning(F("\n[reset] failed to delete file: "));log_warning(dir.fileName());log_flush();
}
}
......
......@@ -20,14 +20,15 @@
/*
* ESP8266 advanced ops
*/
#ifdef ESP8266
#if defined(ESP8266)
extern "C" {
#include "user_interface.h" // wifi_station_dhcpc_start, ...
}
#include <ESP8266WiFi.h>
#elif defined(ESP32)
#include <WiFi.h>
#endif /* ESP8266 */
#include "WiFi.h"
#include "neocampus.h"
#include "neocampus_debug.h"
......@@ -204,7 +205,10 @@ bool wifiParametersMgt::saveConfigFile( void ) {
*/
bool wifiParametersMgt::_getWIFIsettings( void ) {
// grab WIFI station connexion parameters from current connexion ...
#ifdef ESP8266
/*
* [sep.20] ESP8266 DEPRECATED CODE
*
struct station_config _conf;
if( wifi_station_get_config(&_conf) and strlen(reinterpret_cast<const char*>(_conf.ssid)) ) {
......@@ -225,7 +229,8 @@ bool wifiParametersMgt::_getWIFIsettings( void ) {
log_debug(F("\n[wifiParams] no SSID / PASS found neither in config file nor struct station ... probably first time connect ...")); log_flush();
return false;
}
#elif defined(ESP32)
*/
log_debug(F("\n[wifiParams] retrieved current ssid = ")); log_debug(WiFi.SSID());
log_debug(F("\n[wifiParams] retrieved current pass = ")); log_debug(WiFi.psk());
log_flush();
......@@ -241,7 +246,6 @@ bool wifiParametersMgt::_getWIFIsettings( void ) {
else {
log_debug(F("\n[wifiParams] already matching wifi credentials thus nothing todo !")); log_flush();
}
#endif
return true;
}
......
......@@ -17,7 +17,11 @@
#include <Arduino.h>
#include <ArduinoJson.h>
#include "WiFi.h"
#if defined(ESP8266)
#include <ESP8266WiFi.h>
#elif defined(ESP32)
#include <WiFi.h>
#endif
#include "neocampus.h"
#include "PubSubClient.h" // MQTT client with some definitions from neocampus.h
......
......@@ -60,7 +60,11 @@
#include <Arduino.h>
#include <Wire.h>
#include <Ticker.h>
#include <WiFi.h>
#if defined(ESP8266)
#include <ESP8266WiFi.h>
#elif defined(ESP32)
#include <WiFi.h>
#endif
#include <lwipopts.h> // for ESP32 max tcp connections CONFIG_LWIP_MAX_ACTIVE_TCP
/* As of esp8266 arduino lib >=2.4.0, time is managed via local or sntp along with TZ support :) */
......@@ -69,7 +73,6 @@
#include <coredecls.h> // settimeofday_cb(), tune_timeshift64()
#include <sntp.h>
//#include <lwipopts.h> // for SNTP_UPDATE_DELAY (1 hour default, it's ok :) )
#elif defined(ESP32)
#include "lwip/apps/sntp.h"
#endif
......@@ -606,7 +609,7 @@ void earlySetup( void ) {
#endif /* MAX_TCP_CONNECTIONS */
// WiFi.disconnect(true); // to erase default credentials
WiFi.setAutoConnect(false);
WiFi.setAutoReconnect(false);
// Disable sleep modes
#ifdef ESP8266
......@@ -650,8 +653,7 @@ void lateSetup( void ) {
log_info(F("\n# current time is ")); log_info(getCurTime());
}
// for the (future) loop mode ...
WiFi.setAutoConnect(true);
WiFi.setAutoReconnect(true);
#if ESP32
// switch back POWER MODES to auto
......
/* This example demonstrates the different low-power modes of the ESP8266
The initial setup was a WeMos D1 Mini with 3.3V connected to the 3V3 pin through a meter
so that it bypassed the on-board voltage regulator and USB chip. There's still about
0.3 mA worth of leakage amperage due to the unpowered chips. These tests should work with
any module, although on-board components will affect the actual current measurement.
While the modem is turned on the amperage is > 67 mA or changing with a minimum value.
To verify the 20 uA Deep Sleep amperage the voltage regulator and USB chip were removed.
This test series requires an active WiFi connection to illustrate two tests. If you
have problems with WiFi, uncomment the #define DEBUG for additional WiFi error messages.
The test requires a pushbutton switch connected between D3 and GND to advance the tests.
You'll also need to connect D0/GPIO16 to RST for the Deep Sleep tests. If you forget to
connect D0 to RST it will hang after the first Deep Sleep test. D0 is driven high during
Deep Sleep, so you should use a Schottky diode between D0 and RST if you want to use a
reset switch; connect the anode of the diode to RST, and the cathode to D0.
Additionally, you can connect an LED from any free pin through a 1K ohm resistor to the
3.3V supply, though preferably not the 3V3 pin on the module or it adds to the measured
amperage. When the LED blinks you can proceed to the next test. When the LED is lit
continuously it's connecting WiFi, and when it's off the CPU is asleep. The LED blinks
slowly when the tests are complete. Test progress can also be shown on the serial monitor.
WiFi connections will be made over twice as fast if you can use a static IP address.
This example is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This example is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this example; if not, write to the Free Software Foundation, Inc.,
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
#include <ESP8266WiFi.h>
void setup() {
} // end of setup()
void loop() {
WiFi.setAutoReconnect(true);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment