26/5/16
1.1018 - tcp fix included for FIN packets potentially causing excessive resends
		fixed a bug in number_format with numbers between 0 and -1

30/5/16
1.1019 - fixed issue in fwrite and fgets that now return -1 instead when the socket it reset
		 requires a fix to ip.cgi to update this.


02/6/16
1.1020	- added support for WattmonOS2.12 actions which have changed format to reduce memory

19/7/16 - 
1.1021	- added a reboot in multiple var_dup

21/7/16
1.1023	- added reset_level to uphp.ini [debug].  Default value is 1, means it will reset when a close context happens and in future it
could be used to control how often Wattmon reboots in more mission critical setups.

29/7/16
1.1024 - critical bug fix in we server that caused pages to become unresponsive until a reboot in certain conditions

10/8/16
1.1025 - wireless function getwlstat added for wireless version (without onewire)
		modified the onewire task handler to initiate a onewire transfer for all devices once, to speed up the reading

12/8/16
1.1025 - added SMTP log message if SSL 3 not supported
	 	- added correct Date header to SMTP
		- fixed issue that time zone was not properly loaded at startup

31/8/16
1.1026  - added stats to debug script issue (number of scripts not decrementing)
		- modifed TCPSend with possible patch for data upload issues


15/8/16
1.1027	- bug fix that prevented actions that were to run a specific time of day from executing after the first run

10/10/16
1.1028  - fixed a couple of possible memory leaks in the cron schedule in low memory conditions
		- updated TCP stack to send a RST in FIN_WAIT_2 instead of ACK to properly close the connection

25/11/16
1.1030	- modbus TCP support for single device
		- updated the mb_add_device to allow bus specification
		- added getmbstat() to get modbus details

30/11/16
1.1031  - Modbus TCP support but NO Onewire support
		- at startup, only a single script (runonce) is allowed to run until completion before allowing multiple concurrent
			tasks, since this can sometimes lead to a race condition that causes the device to reboot
30/11/16
1.1032  - NO modbus TCP support, but Onewire support
		- at startup, only a single script (runonce) is allowed to run until completion before allowing multiple concurrent
			tasks, since this can sometimes lead to a race condition that causes the device to reboot

7/12/16
1.034 	- solved session bug that redirected to the login page occassionally
		- changed the way HTTP sessions are aborted, resulting in smoother inter-page loads
		- fixed a memory leak for long-running HTTP connections

7/12/16
1.1035	- modified the way interval variables are passed to avoid duplication allowing for scripts to run at lower memory levels

10/12/16
1.1036	- important bug fix introduced in 1.1035 involving custom modbus commands

12/12/16
1.1037  - fixed is_array function, version with Modbus TCP support

13/12/16
1.1038	- fixed is_array function, version without Modbus TCP but with Onewire support

22/12/16
1.1039  - modbus TCP support and fix of important bug in actions

22/12/16
1.1040  - onewire support and fix of important bug in actions

23/12/16
1.1041 - same as 1039 but with 35 roles per device for larger modbus TCP devices

6/1/17
1.1042 - clear modbus buffer before sending custom commands 

## [1.1043] - 2017-01-10
### Added 
- Added action type Alert. 
- Added Set Role from Global.

### Changed
- Modifed format for changelog.

### Fixed
Fixed bug in actions causing execute script to hang in certain cases.

## [1.1044] - 2017-01-16

### Fixed
Fixed bug where log() not working introduced in 1.1043

## [1.1045] - 2017-01-18
### Supports ONEWIRE and not MODBUS TCP
### Fixed
Fixed memory leak introduced in 1.1043 - it would not release memory for a one-shot task such as exec()

## [1.1046] - 2017-01-19
### Supports MODBUS TCP, no ONEWIRE
### Fixed
Fixed memory leak introduced in 1.1043 - it would not release memory for a one-shot task such as exec()

## [1.1047] - 2017-01-20
### Supports ONEWIRE and not MODBUS TCP
### Fixed
- Fixed implode() function that was causing Unreachable devices to show as -1
### Added
- Added current(), next(), prev() functions for array manipulation

## [1.1048] - 2017-01-24
### Supports ONEWIRE and not MODBUS TCP
### Fixed
- Fixed bug in the modbus subsystem where adding certain devices would hang the system

## [1.1053] - 2017-03-06
### Supports ONEWIRE and not MODBUS TCP
### Fixed
- Fixed issues introduced in 1.1052 with dongles.  Added debugging and increased delay times in custom modbus commands

## [1.1054] - 2017-03-21
### Supports ONEWIRE
### Fixed
- Fixed an issue when adding certain modbus devices that would cause a reboot

## [1.1055] - 2017-04-07
### Supports ONEWIRE
### Fixed
### Added fix that will ignore roles in mb_get_val_by_role for disabled devices
### Fixed an issue where the USB power on the MINI was not being properly controlled
### Fixed the reset button to restore default IP.  If you press for 5-10 seconds, it will set the IP to 192.168.0.55.  If you press for 10s or more,
it will set Wattmon to DHCP mode.

## [1.1057] - 2017-04-19
### Supports ONEWIRE
### Fixed
- Fixed an issue causing a memory leak when exec() was called.  This would cause the device to run out of memory when buffer_interval was non-zero in
backlogged data was being uploaded.  Also, terminated one-shot scripts were not properly being freed from the task queue.
- Added a lock to memory error counting when in fgets() to prevent unnecessary reboots if connectivity issues cause slow reads
#### Removed
Removed next() current() and key() funct
ions to save memory in WMPRO.  They are still in the MEGA.

## [1.1058] - 2017-04-21
Changed uphp.c to 16 bit mips except for some functions
Fixes ini_get_array function to handle low memory conditions better
Modified the scheduler so that a process with the same name cannot run more than once simultaneously to prevent memory lock ups.
Readded next() current() and key() functions to save memory in WMPRO.  They are still in the MEGA.
Added an auto power restart for the dongle if more than 20 unsuccessful attempts to connect were made

## [1.1059] - 2017-05-09
Minor fix ini ini_get_array for scripts that require more memory to run.  To enable locking of other script, set max_mem=1 in [debug] in uphp.ini.  The default value is 0

## [1.1060] - 2017-05-14
### Fixes
- Fixed ord() function bug
- Fixed spi_setcs and spi_clearcs() functions
- Fixed an issue where the data coming from a USB dongle was not being properly checksummed.

## [2.1065] - 2017-06-23
- Fixed dump memory function
- Removed the limitation on the mega that prevented two scripts with identical names from running simultaneously

## [2.1066] - 2017-06-24
- Added access violation address for debugging

## [2.1069] - 2017-06-30
- Fixed delay issue 

## [2.1070] - 2017-07-04
- Fixed bug with numbers longer than 5 characters that would randomly produce incorrect results

## [2.1072] - 2017-08-04
### Added checks to reboot if max number of scripts is reached for too long

## [2.1073] - 2017-08-08
### Attempted fixes for psosbile upload issues with 3G connections

## [2.1074] - 2017-08-21
### Additional fixes for 3G dongles

## [2.1075] - 2017-08-23
- Fixed a bug in Modbus TCP

## [2.1076] - 2017-08-25
- Fixed an issue with 3G dongles

## [2.1077] - 2017-08-29
- Fixed an issue with 3G dongles that prevented reconnections in some cases

## [2.1078] - 2017-09-01
- Bug fixes for digital inputs, outputs and onewire sensor

## [2.1078] - 2017-09-01
- Bug fixes for digital inputs, outputs and onewire sensor

## [2.1079] - 2017-09-12
- Increased the number of roles allowed
- Removed limitation of more than 1 HTTP script running

## [2.1080] - 2017-09-14
- Removed a bug patch that was causing erratic loading of pages on LAN
- Fixed bug in actions related to system variables

## [2.1081] - 2017-09-15
- Fixed LAN issues still occuring when accessed via the proxy

## [2.1082] - 2017-10-06
- Fixed Onewire Temperature Sensing issue

## [2.1083] - 2017-10-10
- Fixed LAN connectivity issue over proxy server

## [2.1084] - 2017-10-12
- Support for up to 10 Modbus TCP devices

## [2.1085] - 2017-10-17
- Bug fixes for floating point modbus and math functions

## [2.1086] - 2017-10-30
- Removed a check that could cause an infinite loop, hanging the device

## [2.1087] - 2017-11-03
- Bug fixes for modbus TCP devices

## [2.1088] - 2017-11-13
- Bug fix for longer role names in device drivers

## [2.1090] - 2017-12-08
- Integrated bug fixes from WattmonPRO

## [2.1091] - 2018-01-05
- Bug fixes in 4G connection

## [2.1093] - 2018-02-05
- Added send_sms function
- Fixed MQTT memory leak
- Added features to support new E3531 dongle

## [2.1094] - 2018-02-16
- Added disk sector caching to speed up read operations - resulting in performance gains of up to 300% in some cases.

## [2.1095] - 2018-02-23
- Bug fix in ini_get returning wrong number for larger integers
- Solves issue of delays in calling modbus commands

## [2.1096] - 2018-02-27
- Reduced disk cache to 20 sectors
- Added json_decode function

## [2.1098] - 2018-03-13
- fixed an issue where blank block ({}) would cause erros
- fixed the print() function to report errors when multiple parameters are passed
- fixed an issue where expressions assigning variables inside function calls caused a lockup (i.e func($i.='x') )

## [2.1099] - 2018-03-22
- fixed a bug in the modbus TCP implementation

## [2.1100] - 2018-03-24
- fixed an issue with role scaling

## [2.1101] - 2018-03-30
- fixed an issue with invalid closing brackets in a function

## [2.1103] - 2018-04-16
- fixed modbus TCP communication issues

## [2.1104] - 2018-04-17
- fixed modbus issue with holding registers returning 0

## [2.1105] - 2018-04-20
- fixed bug with Onewire sensors not detecting

## [2.1106] - 2018-05-10
- integrated TLS 
- secure SMTP
- secure MQTT

## [2.1107] - 2018-06-18
- added support for XML, MP3 and CGX file types
- fixed a bug in MQTT

## [2.1108] - 20180-06-19
- fixed for 3G dongles not connecting properly

## [2.1109] - 20180-07-13
- recompiled with latest compiler and added some more memory checks and SVG mime support

## [2.1110] - 20180-07-16
- Updated the caching engine to solve a bug that caused reboots

## [2.1111] - 2018-07-27
- Bug fixes for improved stability and added software watchdog functionality

## [2.1112] - 2018-07-31
- Fixed buffer overrun in string manipulation routines and removed stack overlow checkign to improve speed

## [2.1113] - 2018-08-02
- fixed leak in cached files used by ini_get
- re-enabled disk cache sectors to optimize speed

## [2.1115] - 2018-08-27
- fixed an issue with nvram

## [2.1116] -
- fixed randon number generator
- fixed issue with certain get parameters not being properly parsed if nothing was passed after the =

## [2.1117] -
- fixed issue with MQTT
- added virtual device support
- added support for RS-232 Modbus RTU

## [2.1118] 
- fixed issue with roles numbers over 128 linked to global variables
- fixed and issue with NVRAM defragrmentation

## [2.1119]
- fixed a modbus poll issue introduced in 2.1118

## [2.1120]
- fixed a modbus bug where the last register in a driver is not read

## [2.1121]
- added floating point role scaling in device drivers

## [2.1122] - 2018-10-22
- changed role timeout

## [2.1123] - 2018-11-02
- added category to the device array for easier processing of device types
- updated virtual driver settings (read-only roles in virtual drivers can be modified)

## [2.1125] - 2018-11-29
- Increased roles to 40 in devices
- Changed the serial number read timeout from 30 to 60s and fixed an issue with 0-based characters

## [2.1126] - 2018-12-20
- Added unsigned holding register and unsigned read-only register types to roles
- fixed a bug in Modbus TCP polling

## [2.1127] - 2018-12-27
- Fixed an important issue where assigning a string to an indexed array caused a memory leak

## [2.1128] - 2019-01-05
- Added some more parsing to uPHP to ensure certain conditions do not cause a crash
- fixed a bug in json_encode which added a comma in some instances forming an invalid JSON object

## [2.1129] - 2019-03-27
- Fixed NVRAM corruption bug
- Increased TCP Sockets to try to solve TCP connection issue with modbus
- Fixed but in disk free calculation

## [2.1130] - 2019-04-15
- Watchdog timeout issue due to low memory resolved

## [2.1132] - 2019-04-22
- Fixed TLS issues
- Fixed a memory leak in code execution
- added a hash_hmac() function for encrytion
- Fixed a bug in conversion in inttoieee754()

## [2.1133] - 2019-04-30
- Added ability to set role variables in devices using mb_set_dev_var
- added array_merge() function
- added unsigned long low first RW variable type (33)
- native_mb_poll_time has a channel parameter on M2


## [2.1135] - 2019-05-15
- Fixed bug in role setting

## [2.1137] - 2019-06-15
- Initial FTP support

## [2.1138] - 2019-07-01
- Fixed issue with DHCP on LAN introduced in 2.1130

## [2.1139] - 2019-07-03
- Functional FTP support for FTP and SFTP in passive mode

## [2.1140] - 2019-07-06
- Updated FTP code and changed max roles per device to 60

## [2.1141] - 2019-07-20
- Bug fix that caused watchdog timeouts with some sites


## [2.1143] - 2019-07-29
- Fix for NVRAM bug and fixes for FTP download


## [3.1145] - 2019-08-02
- Fix for cellular data corruption on uploading of firmwares

## [3.1146] - 2019-08-02
- Fixed an issue with script syntax and missing } messages

## [3.1157] - 2019-10-05
- Merged all changed in the mega stream

## [3.1172] - 2020-07-30
- Merged all changes from Mega stream

## [2,3.1175] - 2020-10-22
- Fixed a sync issue in the modbus command algorithm that was causing unwanted reboots
- Added SNMP support
- Increased HTTP Post variable length from 256 to 512 for EZConfig that has more roles
- Increased MQTT Buffer from 2048 to 4096

## [x.1177] - 2020-11-17
- added Time protocol to sync across 3G/4G dongles
- updated socket code to log Tx/Rx for connections
- updated netstat() function to provide more detailed connection info 


## [3.1177] - 2020-11-24
- fixed issue with onewire sensors on roles above 255
