hi,
added 2 new operators for calculations:
!: Logical NOT:
returns 1 if operand is = 0
returns 0 if operand is != 0
%: MOD:
converts operands in integers and calculates the remainder of the division
When the node gets locked in a boot loop, the only recovery is to erase it and start all over.
This fix will count the number of failed boots and above a certain threshold it will start disabling plugin, then controller and then notification.
Only one will be disabled at once, so the user can see which one is giving issues.
The disabled state will not be saved, so make sure to save the failing part when it is accessible again.
Hi,
adding the possibility to have 3 parameters when calling an event:
event,eventname=p1,p2,p3
The variable name are:
param 1: %eventvalue% or %eventvalue1%
param 2: %eventvalue2%
param 3: %eventvalue3%
Hi,
here is a PR for using parameters when calling commands from inside the rules.
The scope is to be able to use formulas instead of an integer when calling a command inside the rules.
Example:
taskvalueset,1,%eventvalue%+65,[Relay1#r1]+1
Usage could be:
Assuming you have a PCF8574 with ports from 65 to 72.
You can write a rule:
on turnOnRelay do
pcfgpio,%eventvalue%+64,0
endon
And to turn on port65, the rule can be called like this:
event,turnOn=1
Write the log lines to a std::deque and write that buffer to the serial port without overflow of the Serial buffer.
This flushing is done during background task.
Depending on the type of controller, the queued messages can be quite big.
This means the queue limit set can cause the memory to fill up.
This commit adds another check. If the free memory is less than 5000 bytes, it will consider the queue being full.
It will then also log the actual memory usage of the queue.
`bla@bla.com` will be set as `nodename <bla@bla.com>` in the mail header as from part.
`John Doe <bla@bla.com>` will now be used like that in the mail header.
N.B. `<` is actually the separator, so as long as that character is being used to separate the name and mail address, it will work. (see #1714 )
Make sure only enabled devices are used for checking. (see #1702)
Do a full erase of the task settings when deleting a plugin. Just to make sure no obsolete settings may corrupt behaviour of new settings.
It looks like the check for `client->connected()` may return false positives.
This means the MQTT client may assume the connection is still active, while it isn't.
These structs to keep track of available plugins and controllers were fixed in size and also the member variables were not ordered in the most optimum way.
Also the name of the nodes always used 26 Bytes and would impose a memory leak when deleted.
As suggested here: https://github.com/letscontrolit/ESPEasy/pull/1669#issuecomment-414434578
This plugin is not using the Queue yet, but only had some duplicate code moved to a helper class.
I now removed the port number from the HTTP header, since I am not really sure if the standard demands it or only for the connect part.
Also changed the HTTP command to use the code that has the port in the header, just to check if that will break now compared to older builds.
Added some simplifications to the code by creating one big macro in `_CPlugin_Helper.h` that does all the work and defines.
This will reduce the chance of typo errors a lot.
MQTT messages are queued and processed at set pace to not overload the broker.
N.B. other controllers still need a similar queue to process. Current interval for those is now probably too low.
Also initial queue parameters must still be corrected when set to 0.
For example `%syshour%` to `%syshour_0%`
Both variables are now supported.
The ones without leading zero can be used in rules.
The ones with leading zero will probably be used on displays.
At this moment it is just using the same static configuration as P150 from the playground.
It is not yet using the settings. This will have to be changed later on.
As a NTP client, you don't need to send requests from port 123. Some internet providers even block ports below 1024. So try to use a random port for outgoing requests.
Also added some checks and increased buffer on the receiving end of UDP packets.
When using C013, the size of infoStruct is copied from that buffer and the size is about 137 bytes, which may lead to Exception crashes.
Add a duplicate call for changing the address. This is required by the new sensor firmware version 2.6. This is to avoid a stry address change command that happens during hotplugging of the sensor
also see here: https://github.com/Apollon77/I2CSoilMoistureSensor/pull/17
Scheduled commands are blocking when run all after another at highest priority.
This removes the scheduled commands from the scheduler and the scheduler will now process the next queued command when no other scheduled task has to run.
Also made some optimizations to reduce memory usage.
Controller C011 (Advanced HTTP) uses all of the available `ExtraControllerSettings`.
Now the last byte of those arrays is set to 0, just to make sure they will not read beyond the range of those arrays when using as a string.
The controller still causes crashes, bit it is a start.
New timing was only allowed after MessageDelay seconds. (default was 1000, which is about 20 minutes)
It should use `TaskDeviceTimer`.
BME280 can now schedule itself to perform a read-update as soon as a measurement has completed.
Then it schedules itself to perform a new measurement at set interval time.
When sending command request from the Tools tab in the web interface, the command will be executed immediately.
In other situations it will use the scheduler to run commands async.
Commands will now be buffered and processed in order.
This will also speed-up rules which do a publish.
- Save RAM, move constants to flash (CharTableTM1637, CharTableMAX7219)
- Remove unnecessary parameter passing (the interface pins do not change during operation for one instance)
The existing implementation was a bit sparse in returned info.
Now each command can return a useful string to display in the command output window in the webinterface. (or whatever the source of the command is)
We need to find the xth command, so we need to find the position of the (X-1)th separator.
Too bad the rest of the world (other than programmers) do not start counting at 0 :(
Apparently it is called 1.4 million times in 30 seconds and takes 8.5 CPU cycles on average (about 50'000 calls per second)
So maybe this function can benefit from some optimisation?
All enabled plugins have their own timer added to the scheduler.
The `PLUGIN_INIT` function call is used to reschedule when it was added, or enabled.
The set interval for the plugin will be used to set the new entry in the scheduler.
And fix longpulse command
With other plugins active, like the OLED Framed, the set period of `longpulse_ms` may fluctuate and durations below 100 msec are quite useless.
However, when running just a few sensors, the set pulse width is quite accurate.
Must still check a few other plugins.
`%sunrise%` and `%sunset%` were already available.
Now it is also possible to get some time before or after those times.
For example `%sunrise+10m%` or `%sunset-1h%`
The offset must be an integer (including + or -) and can have a postfix of "m" or "h".
Default is "s", for seconds.
some code rearrangements and improvements:
- fix a rare buffer overflow
- only update variables when new (correct) values are received
- little speed-up
- correct code indentations...
`ParseString` and `getParamStartPos` made (lots of) copies of the strings.
Also the result of `getParamStartPos` was not checked, which can result in crashes.
As being described a few times and a screenshot shown here: https://github.com/letscontrolit/ESPEasy/issues/1302#issuecomment-393631572
It looks like a DHCP request may fail resulting in a cleared IP setup. The web server then still replies to requests, but no new connections can be made then.
This patch should detect such a situation and then reset the wifi and make a new connection.
The lookup of a function call based on a command string is known at compile time, so no need to keep track of this in memory.
This saves about 2200 bytes of RAM.
The strings alone account for close to 800 bytes (not using F() macro) and they are also being stored in the map.
So that's about 1600 bytes.
The extra 400 bytes are probably the pointers being stored in the map.
For .h files, it is common practice to add #ifndef #def statements around the implementation to prevent compiler issues when a file might be included twice.
VScode + PlatformIO needs the monitor_speed setting to be able to monitor the connected node. (default 9600 baud)
Also set the ESP8266 code base to 1.7.2
This plugin works on my test setup for more than 6 months and is by far the most stable node. (system uptimes of > 110 days)
So this may be considered stable.
The Json data has more items at the level of `data.Sensors[c]` thus must check if it is a TaskValues item.
Otherwise the values shown on Device page will not be updated.
With the newer Platform IO versions, builds failed because of wrong size set in board definition of ESP8285 board.
The PlatformIO settings labels have changed.
A failing ping may also halt the ESP node and some services may not return a ping, or ICMP packets may be filtered out on some connections.
See issue #1494.
Ammended central I2C functions with 16bit write and 32 bit read.
also added "false" parameter to wire.endTransmission before wire.request form
all as discussed in #1417
The plugin BMx280 can handle BMP280 and BME280.
The BMP version has no humidity sensor.
For Domoticz you have to send the data formatted differently.
Now the same plugin can be used for both BME280 and BMP280 and the settings in Domoticz can be set accordingly.
Previously the I2C registers containing measurement data was read per address at once.
Now all are read in one I2C command and then processed.
Also changed the source to be able to support multiple instances of the same task.
This should also fix #1381.
There is something strange about the handling of micros() timers in `NewPingESP8266`.
For this reason I added also a timeout based on `millis()`.
Adding an existing and proven I2C library.
Will need to test if this is working fine on ESP32 too and try to move I2C functionality to use these functions.
In order to semplify the setup of new units, I have added the following commands for modifying settings though serial port:
gateway (x.x.x.x)
dns (x.x.x.x)
subnet (x.x.x.x)
dst (0 or 1)
mqttretainflag (0 or 1)
messagedelay (ms)
ntphost (url)
timezone (minutes)
udpport (port number)
usentp (0 or 1)
work in serial and rules
Suppose you have two oled task with name FrontPanel and BackPanel. If you want turn off FrontPanel and print on BackPanel "Hi" at posintion 0,0 you must use the following instructions:
frontpanel.oledcmd off
backpanel.oled 0,0,Hi
if task name have space you must surround with square brackets. es: [task with space].oledcmd off
The /json page now also supports a limited view for the device page sensor updates.
The supported URLs for the json page are:
- `/json` All information in JSON format.
- `/json?view=sensorupdate` Limited view only for auto update on Devices tab.
- `/json?tasknr=N` with N being the task number, just outputs the information for the given task number.
N.B. these parameters can be combined, like: `/json?tasknr=1&view=sensorupdate`
Not sure how, but the headers of new JSON message can corrupt the buffer in the web log buffer.
In this attempt the log buffer lines are now moved to heap instead of stack.
Also the streaming webserver is given a bit more time to handle requests.
Steps to reproduce:
Set web log level to maximum and open web log viewer.
Then wait a few seconds to minutes to let the JSON stream stop and look at the last sent Json message. This will contain some typical Json web headers and thus no valid Json anymore.
Also added a quick fix for #1419
Previously I thought the body wasn't working correctly in email, however it was, with the exception of line breaks for text/html that have to be rewritten.
In communicating with the server, the sender and receiver needed to be surrounded by <> to be RFC2821 compliant.
The message body was coming out blank as an empty string was being sent instead of the correct string.
New Transformations:
#H: Hot/Cold
#A: Man/Auto
#a: M/A
New Justifications:
#Lx: Left (x=number of chars)
#Rx: Right (x=number of chars)
#Ux.y: Substring (x=first char; y=number of chars)
Plugin_041_update was being called before the plugin has been initialized, this resulted in an exception 28 type crash. Plugin_041_update clears the display and isn't required at the time of webform save.
This one is not yet complete, way more features and improvements are coming.
But for now it is already much much better than the old log viewer :)
So I'll merge it now and we'll see what it will become.
See #1351
Whenever a plugin_write returns success = true, the execute command will no longer be called.
It doesn't matter whether the plugin is enabled or present.
It should only return success = true when the command was actually meant for this plugin.
Previously the moment a timed function was called, the new timer was set. That would make the timer interval to be the minimum interval, with quite some margin of error.
Now the timers are at a more strict interval, unless the device cannot keep up.
See #1296
Rules got truncated when trying to save rules > 1520 Bytes.
Also added a bit more log information and some details about the used libraries in the sysinfo page and json output.
The reason is that inside PLUGIN_WRITE the variable [event->BaseVarIndex] is not set and is always = 0.
So actually this PR modifies the 1st value of task 1 and not the encoder counter.
Line 183 of P059_Encoder.ino should be removed:
UserVar[event->BaseVarIndex] = (float) event->Par1;
Apparently static IP needs to have IP config set before and after connection has been made.
The beginning is needed to make sure no DHCP client is started.
The second one is needed to make sure the wifi status is correct in the core library.
Many self compilers are reporting stuff, it's near to impossible to also support these since the different environments are so hard to set up for us developers to test.
I noticed that my latest commit introduced a small issue with Transformations:
The previous transformations were right justified. The new ones are left justified.
To maintain backwards compatibility I have modified the code.
- Reset wifi when DNS lookup returns *.0.0.0 (NTP lookup sometimes returns like these)
- Accept Wifi events out of order.
- Remove CRC from settings struct
- Patch settings with last few added items initialized
- Changed red question mark to white questionmark, for links to wiki.
Add core information to the log and info page
Add "more info" button to main page
Add question mark link button to sysinfo section describing wifi. This links to the wifi page on the wiki.
Message is sent to provide feedback on pressing the 'submit' button.
At that moment, it is not yet clear the data will be saved successful.
To prevent "Settings Saved" and "Error writing to..." to show on the same page, this text was changed.
See [this bug report](https://github.com/esp8266/Arduino/issues/4114), which is not fixed in 2.4.0.
This work-around will make sure no dhcp-client will be started when connecting to a network.
The active DHCP client could result in IP conflicts, difficulty in reconnect and other strange issues.
Sending LOG_LEVEL_ERROR as syslog error, LOG_LEVEL_INFO as syslog notice, and everything else as syslog deug
Also added Settings.Syslogfacility setting to be able to choose kernel (still default), user, daemon, message and local0-local7
Added Nextion plugin for testing from the Playground.
It is not yet tested on real hardware, but it has been in development for a while on the forum and playground.
Also requested in issue #1256 and by several others.
When a fixed IP setting is used, there will be no "Got IP" event, which will lead to a timeout and thus reconnect.
As a fix, the "Connected" event will also act like when a "Got IP" event was received when configured to use static IP.
A lot of issue reports do not include information about the used version of the core libraries and 'normal', 'dev', etc.
Since this information helps narrowing down the possible causes of the reported issues, it is best to add them in the general log.
I finally have one node acting as described by others and this one reported a disconnect before a connect attempt was made.
Now forcing the wifi in STA mode, should resolve this issue.
WiFi persistent settings were disabled after initialisation of the event handler.
This allowed the firmware to start WiFi connection with settings stored in the flash (not our settings, the settings kept by the core library). If these fail, then a connection failed event would occur before a connect attempt was started from ESPeasy, which would lead to strange results on some nodes while others work just fine.
A lot of functions in Webserver.ino were just appending to a ever increasing string. These strings were eventually sent to TXBuffer of the Webinterface.
So why not directly send them to the streaming buffer and thus reduce memory usage and gain speed.
A lot of functions in Webserver.ino were just appending to a ever increasing string. These strings were eventually sent to TXBuffer of the Webinterface.
So why not directly send them to the streaming buffer and thus reduce memory usage and gain speed.
The settings had 2 new values which would be overwriten by the checksum and there was still some issue about when to save the settings.
Also added a check to only save changed settings.
Known issue:
Sometimes after initial setup of wifi credentials, it is best to perform a reset.
Still existing problems:
- Credentials are not being saved from web interface and thus connection doesn't work from setup page.
- First time connect to SoftAP takes a lot of attempts, when the wifi was searching for an existing accesspoint. This searching does prevent the SoftAP to form a stable connection to the client.
Maybe the entire wifi stack has to be reset before switching to SoftAP. Now it is near to impossible to recover from incorrect settings or a changes accesspoint.
Still under investigation.
It looks to be a problem with the
Since event based wifi, it became more apparent the ESP8266 has some issues with running AP and STA mode simultaneous.
It appears this can only work when the channel remains constant. But when trying to connect to an accesspoint that channel will change.
This means Soft AP and STA cannot be active at the same time when searching for an accesspoint to connect to. For example login to the Soft AP to correct some settings or replace an accesspoint would not be possible.
This fix deals with all of these issues and keeps the fast try/fail connection attempts offered by the event based wifi.
In short:
- 3x attempt to connect to AP1 (each attempt takes about 2.5 seconds when failing)
- 3x attempt to connect to AP2
- Enable accesspoint
When accesspoint is active, the connect attempts will be done at a slower pace and STA mode is disabled. STA mode is also disabled as soon as someone connects to the Soft AP.
When the settings are saved, a retry to connect like normal is started almost immediately. N.B. This will result in a disconnect of the connected users to the Soft AP.
So the connection time is:
- AP1 is valid: 4 - 10 seconds
- AP1 is not valid, AP2 is: 12 - 20 seconds
- AP1 and AP2 are not valid: +/- 18 seconds before activating Soft AP
Since event based wifi, it became more apparent the ESP8266 has some issues with running AP and STA mode simultaneous.
It appears this can only work when the channel remains constant. But when trying to connect to an accesspoint that channel will change.
This means Soft AP and STA cannot be active at the same time when searching for an accesspoint to connect to. For example login to the Soft AP to correct some settings or replace an accesspoint would not be possible.
This fix deals with all of these issues and keeps the fast try/fail connection attempts offered by the event based wifi.
In short:
- 3x attempt to connect to AP1 (each attempt takes about 2.5 seconds when failing)
- 3x attempt to connect to AP2
- Enable accesspoint
When accesspoint is active, the connect attempts will be done at a slower pace and STA mode is disabled. STA mode is also disabled as soon as someone connects to the Soft AP.
When the settings are saved, a retry to connect like normal is started almost immediately. N.B. This will result in a disconnect of the connected users to the Soft AP.
So the connection time is:
- AP1 is valid: 4 - 10 seconds
- AP1 is not valid, AP2 is: 12 - 20 seconds
- AP1 and AP2 are not valid: +/- 18 seconds before activating Soft AP
In Deepsleep mode the wifi connect time is now minimum of 6 seconds.
Also the first loop after connect, the 'awake' timer will reset and start over. Without WiFi connection the set 'awake' timer starts at the moment the node boots.
While looking for issues regarding DeepSleep + MQTT and issue #1195, I came across a number of other issues related to high CPU load and WiFi disconnects when a MQTT controller cannot reach the MQTT broker or is set to be no longer enabled.
These fixes improve CPU load and WiFi stability and also send the following events:
- `MQTT#Connected`
- `MQTT#Disconnected`
- `MQTTimport#Connected`
- `MQTTimport#Disconnected`
The MQTTimport plugin still has some major issues which have to be taken care of, so #1195 is not fixed yet.
There is a problem with the PlatformIO builder since the last update of @mvdbro
It's an issue with the parsing of `#ifdef ESP32`.
It is very well explained here: [platformio/platformio-core#801 (comment)](https://github.com/platformio/platformio-core/issues/801#issuecomment-252447178)
In short, the event handling functions for the wifi have been moved to a separate .h file, since those files will be parsed properly by the Library Dependency Finder (LDF) in PlatformIO 3.x
While looking for issues regarding DeepSleep + MQTT and issue #1195, I came across a number of other issues related to high CPU load and WiFi disconnects when a MQTT controller cannot reach the MQTT broker or is set to be no longer enabled.
These fixes improve CPU load and WiFi stability and also send the following events:
- `MQTT#Connected`
- `MQTT#Disconnected`
- `MQTTimport#Connected`
- `MQTTimport#Disconnected`
The MQTTimport plugin still has some major issues which have to be taken care of, so #1195 is not fixed yet.
* Initial re-organisation of plugin sets (#1019)
* 12bit ADC values acceted up to 4095
MCP3221 is a 12bit ADC so accepted values should be up to 40195 not 1024
* automaticly updated release notes for v2.0-20180313
* - move all structs from ESPEasy.ino into header file
- add some fix for headers
- add const to rtttl notes array
* [issue #1066] Fix Webserver handle_control
There wasn't a proper start/end for the streaming webserver.
See discussion on issue #1066
* automaticly updated release notes for mega-20180314
* Custom controller GUI option
* Fixed #433
Not tested!
* #893, part 2 receiving
* Merge branch 'mega' of github.com:letscontrolit/ESPEasy into mega
# Conflicts:
# src/ESPEasy.ino
* Rules fix
* #893 part1, send messages
* Custom controller GUI option
* #893, part 2 receiving
* Rules fix
* automaticly updated release notes for mega-20180315
* - move all structs from ESPEasy.ino into header file
- add some fix for headers
- add const to rtttl notes array
* Merge branch 'mega' of github.com:letscontrolit/ESPEasy into mega
# Conflicts:
# src/ESPEasy.ino
* [v2.0 split globals] Base split on v2.0 version of ESPEasy.ino
* MCP3221 allow values for calibration (#1073)
MCP3221 allow values for calibration
* [issue #1066] Fix Webserver handle_control (#1079)
[issue #1066] Fix Webserver handle_control
* Fixed multi instance problem on SHT3x #433 (#1081)
Fixed multi instance problem on SHT3x #433
* [issue #1057] AM PM display issue
X:XX PM (for hours 1...9)
X:XX AM (for hours 1...9)
XX:XX PM (for hours 10...12)
XX:XX AM (for hours 10...12)
Added for H:MM (without seconds) notations:
- `%systm_hm%`
-`%systm_hm_am%`
* [issue #993] variable in MQTT subscribe topic
As [noted](https://github.com/letscontrolit/ESPEasy/issues/993#issuecomment-373140135) by @kluszcyn
* [issue #951] Changed System#Initialized => System#Wake
Changed System#Initialized => System#Wake
New event name makes more sense and Initialized may be used later to indicate all needed connections, etc. are ready.
* [issue #1057] AM PM display issue
X:XX PM (for hours 1...9)
X:XX AM (for hours 1...9)
XX:XX PM (for hours 10...12)
XX:XX AM (for hours 10...12)
Added for H:MM (without seconds) notations:
- `%systm_hm%`
-`%systm_hm_am%`
* [issue #993] variable in MQTT subscribe topic
As [noted](https://github.com/letscontrolit/ESPEasy/issues/993#issuecomment-373140135) by @kluszcyn
* [issue #951] Changed System#Initialized => System#Wake
Changed System#Initialized => System#Wake
New event name makes more sense and Initialized may be used later to indicate all needed connections, etc. are ready.
* automaticly updated release notes for mega-20180316
* automaticly updated release notes for v2.0-20180316
* Add download button for current rule set
* - add encoder write #1086
* changed memory tracker to uint64_t for the ESP32
* Changed so that running all tasks immediately with deep sleep enabled only happens on first iteration after wake up
* Keep uint. Just change the init value.
* [WiFi] Try to minimize effect of WiFi interruptions
And send event when connected to a different accesspoint.
Currently the impact on WiFi reconnects is enorm. The ESP stalls, won't react on events, etc.
* - fix success setting
* - fix P073 success setting in PLUGIN_WRITE callback
* - initialize pointer in P073
* [Relaxed WiFi] Perform WiFi initialization in steps
Doing WiFi initialization in multiple steps, will reduce boot time a lot.
For deepsleep the Setup is waiting for wifi initialization to complete, but for normal use the wifi connection is initiated during setup and checked on regular intervals to see if it is available.
The same for WiFi reconnect, which will hopefully not affect the performance of the ESP module during reconnects.
Also added a check + event when connected to another accesspoint with different BSSID (MAC address of accesspoint). Also the last used BSSID is used to reconnect to try to connect to the same device over and over, which may be useful with WiFi repeaters.
* [Travis error] Some #include test that wasn't meant to be included
... in the commit.
* [JSON] Add uint name (#1099) and WiFi information (PR #1113)
As suggested by @Grovkillen on PR #1113.
* [issue #1007] Allow user specific data in separate file
File will be ignored by git and can be simply included using `-D USE_OWN_DEFAULTS` in the build
* #ifndef instead of #ifdef
* [issue #1007] Add other defines as suggested by @uzi18
* [Memory] parseTemplate did not check if markers were found
"Free Mem" reported this function to be using quite a lot of memory.
Maybe that was related to parsing texts without matching ']' or '#'
Just added some checks to see if they were found.
* [issue #1097] MQTT publish after deep sleep
The MQTTConnect was only called after a while. This is a problem for deepsleep.
So now the MQTT connect is done at the first loop when deep sleep is enabled.
* Add download button for current rule set (#1102)
Add download button for current rule set
* - add encoder write command #1086 (#1103)
- add encoder write command #1086
* Changed so that running all tasks immediately with deep sleep enabled… (#1110)
Changed so that running all tasks immediately with deep sleep enabled only happens on first iteration after wake up
* Merge pull request #1112 from uzi18/fix-p073
Fix p073 - #1111
* Merge pull request #1114 from TD-er/feature/wifi_details_json
[JSON] Add uint name (#1099) and WiFi information (PR #1113)
* Merge pull request #1113 from TD-er/feature/reduce_impact_wifi_disconnect
[Relaxed WiFi] Perform WiFi initialization in steps
* Merge pull request #1116 from TD-er/feature/allow_own_defaults
[issue #1007] Allow user specific data in separate file
* Merge pull request #1118 from TD-er/bugfix/mqtt_publish_after_deep_sleep
[issue #1097] MQTT publish after deep sleep
* [merge] MIssing #endif due to merging.
* automaticly updated release notes for mega-20180319
* automaticly updated release notes for v2.0-20180319
* Fix wiring description for SN75176 transceiver
* Revert "Merge pull request #1116 from TD-er/feature/allow_own_defaults"
This reverts commit 8ccbdcadf0.
* Fix wiring description for SN75176 transceiver
* Revert "Merge pull request #1116 from TD-er/feature/allow_own_defaults"
This reverts commit 8ccbdcadf0.
* [issue #1097] WiFi connect with deepsleep enabled trigger watchdog reset
Did not allow for enough time to do background tasks while waiting for wifi connect with DeepSleep enabled.
* [issue #1097] WiFi connect with deepsleep enabled trigger watchdog reset
Did not allow for enough time to do background tasks while waiting for wifi connect with DeepSleep enabled.
* automaticly updated release notes for mega-20180320
* automaticly updated release notes for v2.0-20180320
* [wifi] Setup with factory settings could not complete
* [wifi] Setup with factory settings could not complete
* [merge issue] Forgotten #endif in merge
* - P012 fix command interpretation
* - P023 fix command interpretation
* - P035 move strings to flash
* - P048 fetch params only when needed
* automaticly updated release notes for mega-20180321
* automaticly updated release notes for v2.0-20180321
* Serial WD crash
* [wifi] Make more robust checks and increase timeout
See #1145
* - P012 fix command interpretation
* - P023 fix command interpretation
* - P035 move strings to flash
* - P048 fetch params only when needed
* Serial WD crash
* [wifi] Make more robust checks and increase timeout
See #1145
* [Memory] parseTemplate did not check if markers were found
"Free Mem" reported this function to be using quite a lot of memory.
Maybe that was related to parsing texts without matching ']' or '#'
Just added some checks to see if they were found.
* [WiFi] Take much more time for initial WiFi connect during setup
Accesspoint is still active, so it may take a lot more time to make the initial connection
* [WiFi] Take much more time for initial WiFi connect during setup
Accesspoint is still active, so it may take a lot more time to make the initial connection
* automaticly updated release notes for mega-20180322
* ESP32 fix
* [Command] Parsing improvement for commands
Use more intelligent parsing of commands and switch statement to improve speed
* automaticly updated release notes for mega-20180323
* [WiFi] Reverted those temp String uses for ssid/pass
Was introduced due to misunderstanding of reported issues with WiFi.
* [issue #1131] Add %unixtime%
Show the current time as [Unix time](https://en.wikipedia.org/wiki/Unix_time) (numbers of seconds that have elapsed since midnight 1970-01-01, UTC)
* [issue #1097] Call MQTTclient.loop() during deepsleep
The `MQTTclient.loop()` function should be called quite often.
This does the actual MQTT handling.
In normal operations, this is called quite frequently, but it should also be called when deepsleep is active and right before deepsleep is activated again.
* [P1] Support for latest standard
* [wifi] Event based connect/reconnect
Now using the core WiFiEvents to act on:
- connect
- disconnect
- gotIP
This will make polling for a status no longer needed.
It also allows to get a better understanding in why diconnects happen, since the disconnect reason is given in the events.
This extra information is also present on the information panel on the webinterface and also in the JSON output.
The entire connect/disconnect/reconnect is now done completely asynchronous and thus takes much less resources from the ESP.
A disconnect will now also send an event: "WiFi#Disconnected"
For deepsleep this means there has to be a minimum awake time set and perhaps use rules to set the ESP into sleep again when done.
Typical connection times to an accesspoint are about 3 seconds + about 1 second for DHCP.
This also resolves the issues where services my try to connect while there is a WiFi connection, but not yet an IP address set.
I already noticed a lot of NTP servers from pool.ntp.org are non responsive the last few weeks, so that may still take some time, but that's another issue.
* automaticly updated release notes for mega-20180324
* [NTP] Speedup NTP again with async WiFi
Previously it would only start calling "now" when the WiFi was already setup.
And in calling `now()`, a call to an NTP server is being made. When this fails, retry again in a minute.
But now the WiFi initialization is asynchronous, so the first NTP query was already failing and thus the retry is already set to a minute.
This is fixed now and also the pool.ntp.org will pick a random one from 0...3 (.pool.ntp.org).
The DNS queries from this pool change about every minute, so if you want to retry because one of the servers is offline, you should try one from the other `N.pool.ntp.org` or else you have to wait for another minute.
* - fix for #1170 - uservar not setted on encwrite
* automaticly updated release notes for mega-20180326
* [issue #1174] Show degree sign via external writes to LCD
Fix suggested by [elmicha](https://github.com/letscontrolit/ESPEasy/issues/1174#issuecomment-376244766)
* [ESP32] Event driven WiFi for ESP32
Not tested, just got some inspiration by these files:
- https://github.com/espressif/arduino-esp32/blob/master/libraries/WiFi/examples/WiFiClientEvents/WiFiClientEvents.ino
- https://github.com/espressif/arduino-esp32/blob/master/libraries/WiFi/src/WiFiGeneric.cpp
- https://github.com/espressif/arduino-esp32/blob/master/tools/sdk/include/esp32/esp_event.h
* automaticly updated release notes for mega-20180327
* Fix nesting level check
* [Build] Cleanup/split builds using defines
See PR #1034 and #1040 made by @soif
* [build] Disabled a few PlatformIO profiles for now.
There were way too many.
Just placed them in comments and Travis had already built them all to test first.
* automaticly updated release notes for mega-20180328
* [Arduino IDE] Revert changes in include paths
Were changed to be able to test the PlatformIO feature to compile only files that are actually used.
Apparently the Arduino IDE cannot find the files anymore because that IDE needs the parent directory to be named as the main project file, not "src"
* automaticly updated release notes for mega-20180329
Were changed to be able to test the PlatformIO feature to compile only files that are actually used.
Apparently the Arduino IDE cannot find the files anymore because that IDE needs the parent directory to be named as the main project file, not "src"
Previously it would only start calling "now" when the WiFi was already setup.
And in calling `now()`, a call to an NTP server is being made. When this fails, retry again in a minute.
But now the WiFi initialization is asynchronous, so the first NTP query was already failing and thus the retry is already set to a minute.
This is fixed now and also the pool.ntp.org will pick a random one from 0...3 (.pool.ntp.org).
The DNS queries from this pool change about every minute, so if you want to retry because one of the servers is offline, you should try one from the other `N.pool.ntp.org` or else you have to wait for another minute.
Now using the core WiFiEvents to act on:
- connect
- disconnect
- gotIP
This will make polling for a status no longer needed.
It also allows to get a better understanding in why diconnects happen, since the disconnect reason is given in the events.
This extra information is also present on the information panel on the webinterface and also in the JSON output.
The entire connect/disconnect/reconnect is now done completely asynchronous and thus takes much less resources from the ESP.
A disconnect will now also send an event: "WiFi#Disconnected"
For deepsleep this means there has to be a minimum awake time set and perhaps use rules to set the ESP into sleep again when done.
Typical connection times to an accesspoint are about 3 seconds + about 1 second for DHCP.
This also resolves the issues where services my try to connect while there is a WiFi connection, but not yet an IP address set.
I already noticed a lot of NTP servers from pool.ntp.org are non responsive the last few weeks, so that may still take some time, but that's another issue.
The `MQTTclient.loop()` function should be called quite often.
This does the actual MQTT handling.
In normal operations, this is called quite frequently, but it should also be called when deepsleep is active and right before deepsleep is activated again.
According to the MH-Z19B data sheet version 1.2, valid from: 2017.03.22 (received 2018-03-07), the offset should be [6]..[7] instead.
Fixing the implementation accordingly.
For ways to *support* us, see [this announcement on the forum](https://www.letscontrolit.com/forum/viewtopic.php?f=14&t=5787), or have a look at the [Patreon](https://www.patreon.com/GrovkillenTDer), [Ko-Fi](https://ko-fi.com/grovkillentder) or [PayPal](https://www.paypal.me/espeasy) links above.
// hoher Bereich, 1 lx Modus, normale Empfindlichkeit. Der Wert von 60000 ist mehr oder weniger zufällig, es mus einfach ein hoher Wert, nah an der Grenze sein.
* Made sure we don't read more that necessary (issue #422)
* Fixed error when the key of a `JsonObject` is a `char[]` (issue #423)
* Reduced code size when using `const` references
* Fixed error with string of type `unsigned char*` (issue #428)
* Added `deprecated` attribute on `asArray()`, `asObject()` and `asString()` (issue #420)
v5.8.1
------
* Fixed error when assigning a `volatile int` to a `JsonVariant` (issue #415)
* Fixed errors with Variable Length Arrays (issue #416)
* Fixed error when both `ARDUINOJSON_ENABLE_STD_STREAM` and `ARDUINOJSON_ENABLE_ARDUINO_STREAM` are set to `1`
* Fixed error "Stream does not name a type" (issue #412)
v5.8.0
------
* Added operator `==` to compare `JsonVariant` and strings (issue #402)
* Added support for `Stream` (issue #300)
* Reduced memory consumption by not duplicating spaces and comments
> ### BREAKING CHANGES :warning:
>
> `JsonBuffer::parseObject()` and `JsonBuffer::parseArray()` have been pulled down to the derived classes `DynamicJsonBuffer` and `StaticJsonBufferBase`.
>
> This means that if you have code like:
>
> ```c++
> void myFunction(JsonBuffer& jsonBuffer);
> ```
>
> you need to replace it with one of the following:
* Added an `printTo(char[N])` and `prettyPrintTo(char[N])` (issue #292)
* Added ability to set a nested value like this: `root["A"]["B"] = "C"` (issue #352)
* Renamed `*.ipp` to `*Impl.hpp` because they were ignored by Arduino IDE (issue #396)
v5.7.2
------
* Made PROGMEM available on more platforms (issue #381)
* Fixed PROGMEM causing an exception on ESP8266 (issue #383)
v5.7.1
------
* Added support for PROGMEM (issue #76)
* Fixed compilation error when index is not an `int` (issue #381)
v5.7.0
------
* Templatized all functions using `String` or `std::string`
* Removed `ArduinoJson::String`
* Removed `JsonVariant::defaultValue<T>()`
* Removed non-template `JsonObject::get()` and `JsonArray.get()`
* Fixed support for `StringSumHelper` (issue #184)
* Replaced `ARDUINOJSON_USE_ARDUINO_STRING` by `ARDUINOJSON_ENABLE_STD_STRING` and `ARDUINOJSON_ENABLE_ARDUINO_STRING` (issue #378)
* Added example `StringExample.ino` to show where `String` can be used
* Increased default nesting limit to 50 when compiled for a computer (issue #349)
> ### BREAKING CHANGES :warning:
>
> The non-template functions `JsonObject::get()` and `JsonArray.get()` have been removed. This means that you need to explicitely tell the type you expect in return.
* Fixed `array[idx].as<JsonVariant>()` and `object[key].as<JsonVariant>()`
* Fixed return value of `JsonObject::set()` (issue #350)
* Fixed undefined behavior in `Prettyfier` and `Print` (issue #354)
* Fixed parser that incorrectly rejected floats containing a `+` (issue #349)
v5.6.6
------
* Fixed `-Wparentheses` warning introduced in v5.6.5 (PR #335 by @nuket)
* Added `.mbedignore` for ARM mbdeb (PR #334 by @nuket)
* Fixed `JsonVariant::success()` which didn't propagate `JsonArray::success()` nor `JsonObject::success()` (issue #342).
v5.6.5
------
*`as<char*>()` now returns `true` when input is `null` (issue #330)
v5.6.4
------
@@ -71,8 +335,9 @@ v5.1.0
* Added support of `long long` (issue #171)
* Moved all build settings to `ArduinoJson/Configuration.hpp`
**BREAKING CHANGE**:
If you defined `ARDUINOJSON_ENABLE_STD_STREAM`, you now need to define it to `1`.
> ### BREAKING CHANGE :warning:
>
> If you defined `ARDUINOJSON_ENABLE_STD_STREAM`, you now need to define it to `1`.
v5.0.8
------
@@ -86,9 +351,10 @@ v5.0.7
* Made library easier to use from a CMake project: simply `add_subdirectory(ArduinoJson/src)`
* Changed `String` to be a `typedef` of `std::string` (issues #142 and #161)
**BREAKING CHANGES**:
-`JsonVariant(true).as<String>()` now returns `"true"` instead of `"1"`
-`JsonVariant(false).as<String>()` now returns `"false"` instead of `"0"`
> ### BREAKING CHANGES :warning:
>
> - `JsonVariant(true).as<String>()` now returns `"true"` instead of `"1"`
> - `JsonVariant(false).as<String>()` now returns `"false"` instead of `"0"`
v5.0.6
------
@@ -142,10 +408,11 @@ v5.0.0
* Redesigned `JsonVariant` to leverage converting constructors instead of assignment operators (issue #66)
* Switched to new the library layout (requires Arduino 1.0.6 or above)
**BREAKING CHANGES**:
-`JsonObject::add()` was renamed to `set()`
-`JsonArray::at()` and `JsonObject::at()` were renamed to `get()`
- Number of digits of floating point value are now set with `double_with_n_digits()`
> ### BREAKING CHANGES :warning:
>
> - `JsonObject::add()` was renamed to `set()`
> - `JsonArray::at()` and `JsonObject::at()` were renamed to `get()`
> - Number of digits of floating point value are now set with `double_with_n_digits()`
**Personal note about the `String` class**:
Support of the `String` class has been added to the library because many people use it in their programs.
@@ -198,106 +465,7 @@ v4.0
* Unified parser and generator API (issue #23)
* Updated library layout, now requires Arduino 1.0.6 or newer
**BREAKING CHANGE**: API changed significantly, see [Migrating code to the new API](https://github.com/bblanchon/ArduinoJson/wiki/Migrating-code-to-the-new-API).
> ### BREAKING CHANGES :warning:
>
> API changed significantly since v3, see [Migrating code to the new API](https://arduinojson.org/doc/migration/).
v3.4
----
* Fixed escaped char parsing (issue #16)
v3.3
----
* Added indented output for the JSON generator (issue #11), see example bellow.
* Added `IndentedPrint`, a decorator for `Print` to allow indented output
Example:
JsonOject<2> json;
json["key"] = "value";
json.prettyPrintTo(Serial);
v3.2
----
* Fixed a bug when adding nested object in `JsonArray` (bug introduced in v3.1).
v3.1
----
* Calling `Generator::JsonObject::add()` twice with the same `key` now replaces the `value`
* Added `Generator::JsonObject::operator[]`, see bellow the new API
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
See the [tutorial on arduinojson.org](https://arduinojson.org/doc/encoding/?utm_source=github&utm_medium=readme)
Documentation
-------------
## Documentation
The documentation is available online in the [Arduino JSON wiki](https://github.com/bblanchon/ArduinoJson/wiki)
The documentation is available on [arduinojson.org](https://arduinojson.org/?utm_source=github&utm_medium=readme), here are some shortcuts:
Testimonials
------------
From Arduino's Forum user `jflaplante`:
> I tried aJson json-arduino before trying your library. I always ran into memory problem after a while.
> I have no such problem so far with your library. It is working perfectly with my web services.
From Arduino's Forum user `gbathree`:
> Thanks so much - this is an awesome library! If you want to see what we're doing with it - the project is located at www.photosynq.org.
From StackOverflow user `thegreendroid`:
> It has a really elegant, simple API and it works like a charm on embedded and Windows/Linux platforms. We recently started using this on an embedded project and I can vouch for its quality.
From GitHub user `zacsketches`:
> Thanks for a great library!!!
> I've been watching you consistently develop this library over the past six months, and I used it today for a publish and subscribe architecture designed to help hobbyists move into more advanced robotics. Your library allowed me to implement remote subscription in order to facilitate multi-processor robots.
> ArduinoJson saved me a week's worth of time!!
[From Reddit user `erm_what_`](https://www.reddit.com/r/arduino/comments/3jj6ep/announcing_arduinojson_50/cusjk8c):
> This is a great library and I wouldn't be able to do the project I'm doing without it. I completely recommend it.
[From Reddit user `makerhacks`](https://www.reddit.com/r/arduino/comments/3jj6ep/announcing_arduinojson_50/cusqg7b):
> I am just starting an ESP8266 clock project and now I can output JSON from my server script and interpret it painlessly.
[From Twitter user `@hemalchevli`](https://twitter.com/hemalchevli/status/715788439397011456):
> ArduinoJson library should be used as a benchmark/reference for making libraries. Truly elegant.
Donators
--------
Special thanks to the following persons and companies who made generous donations to the library author:
* Robert Murphy <img alt='USA' src='https://cdnjs.cloudflare.com/ajax/libs/emojione/2.1.4/assets/svg/1f1fa-1f1f8.svg' width='18' height='18'>
* Martijn van den Burg <img alt='Netherlands' src='https://cdnjs.cloudflare.com/ajax/libs/emojione/2.1.4/assets/svg/1f1f3-1f1f1.svg' width='18' height='18'>
* Nick Koumaris <img alt='Greece' src='https://cdnjs.cloudflare.com/ajax/libs/emojione/2.1.4/assets/svg/1f1ec-1f1f7.svg' width='18' height='18'>
* Jon Williams <img alt='USA' src='https://cdnjs.cloudflare.com/ajax/libs/emojione/2.1.4/assets/svg/1f1fa-1f1f8.svg' width='18' height='18'>
* The [Examples](https://arduinojson.org/example/?utm_source=github&utm_medium=readme) show how to use the library in various situations.
* The [API Reference](https://arduinojson.org/api/?utm_source=github&utm_medium=readme) contains the description of each class and function.
* The [FAQ](https://arduinojson.org/faq/?utm_source=github&utm_medium=readme) has the answer to virtually every question.
* The [ArduinoJson Assistant](https://arduinojson.org/assistant/?utm_source=github&utm_medium=readme) writes programs for you!
---
Found this library useful? Please star this project or [help me back with a donation!](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=donate%40benoitblanchon%2efr&lc=GB&item_name=Benoit%20Blanchon&item_number=Arduino%20JSON¤cy_code=EUR&bn=PP%2dDonationsBF%3abtn_donate_LG%2egif%3aNonHosted) :smile:
Do you like this library? Please [star this project on GitHub](https://github.com/bblanchon/ArduinoJson/stargazers)!
What? You don't like it but you *love* it?
We don't take donations anymore, but [we sell a book](https://arduinojson.org/book/?utm_source=github&utm_medium=readme), so you can help and learn at the same time!
sentence=An efficient and elegant JSON library for Arduino.
paragraph=Like this project? Please star it on GitHub!
paragraph=ArduinoJson supports ✔ serialization, ✔ deserialization, ✔ fixed allocation, ✔ zero-copy, ✔ streams, and more. It is the most popular Arduino library on GitHub ❤❤❤❤❤. Check out arduinojson.org for a comprehensive documentation.
FILES=$(find include src test -regex ".*\.[ch]pp$")
clang-format -style=Google -i $FILES
# insert newline at end of file
sed -i -e '$a\'$FILES
Some files were not shown because too many files have changed in this diff
Show More
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.