Compare commits

...
Author SHA1 Message Date
ESPEasy release bot ca0a16fb9c automatically updated release notes for mega-20181111 2018-11-11 04:00:06 +01:00
Gijs NoorlanderandGitHub 6f895c2e2e Merge pull request #2033 from uzi18/patch12
Webserver content-type set fix for /control handler
2018-11-11 00:18:25 +01:00
Gijs NoorlanderandGitHub 8912ef845c Merge pull request #2038 from TD-er/bugfix/embedded_javascript
[JavaScript] Append zero termination to embedded progmem data
2018-11-10 23:51:26 +01:00
TD-er 1231c6a9c2 [JavaScript] Append zero termination to embedded progmem data 2018-11-10 23:43:52 +01:00
ESPEasy release bot 6313d4344d automatically updated release notes for mega-20181110 2018-11-10 04:00:08 +01:00
Bartlomiej Zimon 6dcfc9e2a1 Webserver optimize /control early handled commands 2018-11-09 23:17:54 +00:00
Bartlomiej Zimon 2e9e1e480f Webserver /control proper Content type
it sets printToWebJSON during PLUGIN_WRITE/SendStatus
fix for #2018
2018-11-09 23:13:28 +00:00
Gijs NoorlanderandGitHub d7dcd9cff0 Merge pull request #2017 from TD-er/feature/upgrade_ESP32_1.5.0
[ESP32] Upgrade core lib to espressif32@1.5.0
2018-11-09 11:39:19 +01:00
Gijs NoorlanderandGitHub bdf0e6e05c Merge pull request #2021 from TD-er/bugfix/wifi_disconnect_handling
[WiFi] Improve disconnect detection and run delay(1) when not connected
2018-11-09 11:37:30 +01:00
Gijs NoorlanderandGitHub 75e411f458 Merge pull request #2025 from uzi18/patch14
[Eastron] remove old duplicate code
2018-11-09 11:02:45 +01:00
Gijs NoorlanderandGitHub bc9a697792 Merge pull request #2022 from uzi18/patch12
HTTP responses have duplicate Content-Types
2018-11-09 10:00:03 +01:00
ESPEasy release bot dfe90363b7 automatically updated release notes for mega-20181109 2018-11-09 04:00:10 +01:00
Bartlomiej Zimon d8dd25593e properly send content-type header
fix for #2022
2018-11-09 00:17:06 +00:00
Bartlomiej Zimon 38d08d6902 remove old duplication 2018-11-08 10:42:36 +00:00
Gijs NoorlanderandGitHub a7b32273ae Merge pull request #2023 from uzi18/patch14
add p078_dev_id to form save
2018-11-08 10:24:58 +01:00
ESPEasy release bot 5ccbdfff11 automatically updated release notes for mega-20181108 2018-11-08 04:00:09 +01:00
Bartlomiej Zimon 4ff3de5482 add p078_dev_id to form save 2018-11-08 00:44:54 +00:00
Bartlomiej Zimon d52435264d remove double strings for contenttype 2018-11-07 23:34:39 +00:00
Bartlomiej Zimon cd76c88860 HTTP responses have duplicate Content-Types
fix for #2018
2018-11-07 23:18:00 +00:00
TD-er 429fa31ee5 [WiFi] Improve disconnect detection and run delay(1) when not connected
Make sure disconnects will not be missed.
Give background tasks more time when not connected to WiFi.
This may help lowering power consumption and improve chance of getting connected.
2018-11-07 23:03:41 +01:00
Gijs NoorlanderandGitHub 6b33cee8ea Merge pull request #2015 from clumsy-stefan/amend_system_nosleep
Amend nosleep command to accept awake time
2018-11-07 21:23:01 +01:00
Gijs NoorlanderandGitHub a182ca8097 Merge pull request #2016 from giig1967g/bug/p001
BUG fix in P001 - switchstate was referred but not set yet in PLUGIN_INIT
2018-11-07 20:22:24 +01:00
stefan f7feeff9b4 Add System#NoSleep=<time> event
Add a System#NoSleep event which returns the amount of seconds fow which the unit will be awake (at least). However this time can change within the delay or even disabled (by rules, commands, etc.)
2018-11-07 16:53:08 +01:00
Plebs a5cfa1713d BUG fix
in P001 switchstate was referred before setting its value.
2018-11-07 15:34:06 +01:00
TD-er 04edfae8de [ESP32] Upgrade core lib to espressif32@1.5.0 2018-11-07 15:33:00 +01:00
stefan 1e9debf67c Merge branch 'mega' into amend_system_nosleep 2018-11-07 14:39:48 +01:00
stefan 250d8aca59 Amend nosleep command to accept awake time
Amend system command "nosleep" to accept a parameter that sets the awake time (eg. nosleep for <time>).
like this it's possible to send a "nosleep" command to the unit immediately after it awakes, do whatever needed and then reset the awake time with "nosleep,<time>" instead of having to go via web-page.
2018-11-07 14:33:54 +01:00
Gijs NoorlanderandGitHub 19ec7a90cf Merge pull request #2014 from TD-er/bugfix/PUYA_build_v3patch
Bugfix/puya build v3patch
2018-11-07 12:48:35 +01:00
TD-er 74e591ac81 [PUYA] Fix typo in patch 2018-11-07 12:43:43 +01:00
TD-er 29fb32225a [PUYA] share static flash_chip_id among functions 2018-11-07 12:41:32 +01:00
TD-er f90f97e3d0 [PUYA] Fix patch v3 for PUYA support 2018-11-07 12:36:23 +01:00
Gijs NoorlanderandGitHub fd634a12a1 Merge pull request #2005 from TD-er/bugfix/uzi18_puya_patch
[PUYA] Apply generic patch on all builds checking for PUYA flash
2018-11-07 12:13:09 +01:00
TD-er 19b59359e0 [PUYA] Add PUYA patch v3 to check if patch is applied
See: https://github.com/letscontrolit/ESPEasy/pull/2005#issuecomment-436442587
Made by @uzi18
2018-11-07 11:25:12 +01:00
Gijs NoorlanderandGitHub 0fe9566d14 Merge pull request #2010 from uzi18/patch11
Sysinfo update to 4 values
2018-11-07 11:01:54 +01:00
Gijs NoorlanderandGitHub 9e49f6f7b1 Merge pull request #2004 from giig1967g/bug/1977-others
bug fixes
2018-11-07 11:01:34 +01:00
Gijs NoorlanderandGitHub 660377ea02 Merge pull request #2009 from uzi18/patch9
Eastron: Add optional DE PIN configuration
2018-11-07 10:13:30 +01:00
ESPEasy release bot 4e171993ff automatically updated release notes for mega-20181107 2018-11-07 04:00:09 +01:00
Bartlomiej Zimon dfdaa831d5 Sysinfo update to 4 values 2018-11-07 00:52:54 +00:00
Bartlomiej Zimon 946c1a8390 Add optional DE PIN configuration
Add gpio names to form
fix for #1684
2018-11-06 23:51:43 +00:00
TD-er f7c7d176f1 [Travis] Update platformIO packages before build
Since this directory is cached, updates must be applied before building.
2018-11-06 16:58:10 +01:00
TD-er 0a72b711f9 [PUYA] Apply generic patch on all builds checking for PUYA flash
Applied this patch made by @uzi18
https://github.com/esp8266/Arduino/issues/4061#issuecomment-368273656
It is now included in all builds
2018-11-06 15:56:36 +01:00
Gijs NoorlanderandGitHub 2f8962ec52 Merge pull request #1989 from TD-er/cleanup/reduce_flashStrings
[Cleanup] Reduce binary size to allow 1M OTA with minimal plugin set
2018-11-06 12:30:46 +01:00
Plebs b68d91fc58 final cleanup 2018-11-06 11:27:28 +01:00
Gijs NoorlanderandGitHub a8c565ee5f Merge branch 'mega' into cleanup/reduce_flashStrings 2018-11-06 11:27:21 +01:00
Plebs 6f06b57d14 cleaned if from addLog as per uzi18 comment 2018-11-06 11:20:24 +01:00
ESPEasy release bot cf949ab167 automatically updated release notes for mega-20181106 2018-11-06 04:00:10 +01:00
Plebs 21cc1faf25 bug fixes
- Fix for bug #1977 for serial and web sources
- Fix for Publish command not evaluating Formulas
- Fixed addlog commands only when needed
- Fixed logEntry command not showing command line
Fixed nit value of pinstate in P001, P009 and P019
2018-11-05 20:03:33 +01:00
TD-er 99030621b7 [timingstats] Show stats in msec instead of usec. 2018-11-05 17:18:25 +01:00
TD-er 33199ceb12 [timingstats] Improve table layout of timing stats
Highlighting when a timing value exceeds 100 msec.
2018-11-05 16:35:18 +01:00
GrovkillenandGitHub 6175adddd1 [Flasher] fixed ip bug fixed 2018-11-05 12:04:53 +01:00
ESPEasy release bot 35461643ff automatically updated release notes for mega-20181105 2018-11-05 04:00:10 +01:00
TD-er 9397f560dc [timingstats] Disable timing stats in log 2018-11-05 02:00:24 +01:00
TD-er 6de76f8817 [timingstats] Implement HTML table of timing stats
And move to `/timingstats`
All links in the menu use relative paths, so do not use URLs with more than 1 level deep.
2018-11-05 01:53:32 +01:00
Gijs NoorlanderandGitHub ae9deeb702 Merge pull request #1979 from clumsy-stefan/check_client_send
Add sent/return value check to client.print()
2018-11-05 01:21:36 +01:00
Gijs NoorlanderandGitHub 1bdbc97d33 Merge pull request #1992 from Grovkillen/fix_memanalyzer.py
[Memanalyzer] Fix memanalyzer.py
2018-11-05 01:21:08 +01:00
Gijs NoorlanderandGitHub bec97768f4 Merge pull request #1996 from kpalczewski/PioneerSupport
update lib IRremoteESP8266 and add send Pioneer support
2018-11-05 01:20:55 +01:00
TD-er abdc9a0454 [timing stats] Add http://<ip>/stat/timing/json to view timing stats 2018-11-05 01:17:59 +01:00
Gijs NoorlanderandGitHub c9bb2750a3 Merge pull request #1994 from uzi18/patch9
fix for #1986
2018-11-04 21:09:41 +01:00
Bartlomiej Zimon eda3326615 Eastron - save modbus id and enable SDM630 model
partial fix for #1684
2018-11-04 19:05:41 +00:00
TD-er d2644b2da7 [Cleanup] Do not use F-macro for short strings
Got rid of a few kB in the binary image by removing F-macro from numerous 1 or 2 character flash strings.
These very short strings take more space in flash and memory when using the F-macro.

Also appending to a string using a `'a'` character definition takes less resources compared to a one-character string `"a"`.
2018-11-04 01:27:42 +01:00
TD-er 8650bc6aa3 [Cleanup] Increase load speed and lower memory usage rendering web page
The (large) template string was reduced over and over again while parsing for strings to replace.

Now it is using one big string in memory which is not reduced. (and thus taking twice the amount of memory)
2018-11-03 23:39:24 +01:00
TD-er dee5f6df1a [Cleanup] Strip HTML templates into sections to remove duplicate strings 2018-11-03 22:40:57 +01:00
TD-er 0085986701 [OTA] Add ESP8285 1M OTA minimal build 2018-11-03 01:37:42 +01:00
TD-er 7a72836d0f [Cleanup] Make single definition for pin description
- ESP32 could not select GPIO-0 in plugins.
- Only usable pins will be selectable
- Arrow icon will show if GPIO is input or output only
- Added warning sign for pins affecting boot.
- Added RX0/TX0 indicator for GPIO-1 and -3 when serial is enabled.
- Added GPIO-1 and -3 to boot pin state setup, but only selectable when Serial disabled.
- Reduce number of flash strings.
2018-11-03 01:20:50 +01:00
TD-er cec830fe83 [1MB OTA] Add small build to allow for 1MB OTA
Using 128k SPIFFS and 2-step OTA image, it is possible to perform an OTA update on 1 MB nodes.
This 2-step image does not have the ArduinoOTA service running, but does allow for manual upload using web interface.
ArduinoOTA needs 8 kB more, which will not work at the moment.
2018-11-02 09:57:00 +01:00
kpalczewski 894a59e10b bump lib IRremoteESP8266 to 2.5.2 and add send Pioneer support for 035 IR plugin. 2018-11-01 17:24:14 +01:00
stefan e28f46697a Add comment why we check for %256
Added comment to explain why the comparison is done to the length%256
2018-11-01 15:47:54 +01:00
GrovkillenandGitHub 14ced058b5 [Memanalyzer] cmd args are back (un-commented) 2018-11-01 10:09:47 +01:00
Bartlomiej Zimon fabc514f8e fix for #1986 2018-11-01 07:49:45 +00:00
stefan 4ae5e2ce7b Merge remote-tracking branch 'origin/mega' into check_client_send 2018-11-01 08:31:28 +01:00
ESPEasy release bot 0585d48ffa automatically updated release notes for mega-20181101 2018-11-01 04:00:08 +01:00
GrovkillenandGitHub be9a5d622a Merge pull request #1991 from Grovkillen/Flashtool002003
[Flasher] updated flasher (some minor error)
2018-10-31 22:38:20 +01:00
GrovkillenandGitHub 821fcb9e54 [README] removed IRC link... we're not there. 2018-10-31 21:15:14 +01:00
Jimmy Westberg 1a9584134a [Memanalyzer] try to fix the memanalyzer not analyzing all plugins 2018-10-31 20:34:42 +01:00
Jimmy Westberg d2e9337d76 Revert "[Flasher] updated flasher (some minor error)"
This reverts commit 6c5c12a6f2.
2018-10-31 20:29:47 +01:00
Jimmy Westberg 6c5c12a6f2 [Flasher] updated flasher (some minor error) 2018-10-31 20:00:48 +01:00
TD-er 9eb2ebe210 [Cleanup] Minify JavaScript and CSS to reduce sketch size
Sketch size is reduced by 5 - 6 kB
Files are extracted from original source and moved to `static` directory.
2018-10-31 16:25:42 +01:00
Gijs NoorlanderandGitHub 1d5fbd926e Merge pull request #1986 from giig1967g/new/playground
Fixed some bugs and added the possibility to read the user variables with parameter
2018-10-31 12:16:38 +01:00
Gijs NoorlanderandGitHub 4d3ac95e5a Merge pull request #1985 from uzi18/patch-3
BlynkGet add timeout 1,5s.
2018-10-31 12:16:13 +01:00
TD-er 1f1e47530a [Cleanup] Reduce length HTML form data IDs to reduce sketch size
To allow OTA again on 1MB flash units.
2018-10-31 12:08:17 +01:00
TD-er 3b1d26b541 [Cleanup] Reduce build image size by 2k by wrapping flash strings
Only in WebServer.ino.
Looked for the most frequently used strings.
2018-10-31 11:44:51 +01:00
Plebs 8a86ee9b89 Update src/Misc.ino 2018-10-31 09:54:23 +01:00
GrovkillenandGitHub ed592a3a0a [Deploy] "source" folder was named "Source" 2018-10-31 08:53:02 +01:00
GrovkillenandGitHub f2b330424c [README] fixed some \r\n 2018-10-31 08:29:14 +01:00
GrovkillenandGitHub 542a758fde [README] added more info about ESP.Easy.Flasher 2018-10-31 08:28:10 +01:00
stefan 11e4addb41 Merge remote-tracking branch 'origin/mega' into check_client_send 2018-10-31 08:13:39 +01:00
ESPEasy release bot 8921ebbcaa automatically updated release notes for mega-20181031 2018-10-31 04:00:10 +01:00
Plebs d05d669284 Update src/Misc.ino 2018-10-30 23:54:27 +01:00
Bartłomiej ZimońandGitHub 71a6b344e7 BlynkGet add timeout 1,5s. 2018-10-30 23:15:33 +01:00
Gijs NoorlanderandGitHub c67becac0c Merge pull request #1981 from TD-er/feature/ota_warning
[OTA] Add OTA info and disable when not enough space
2018-10-30 22:56:11 +01:00
Gijs NoorlanderandGitHub 0ec06161c5 Merge pull request #1984 from uzi18/patch-2
BlynkGet fix loop #1951
2018-10-30 22:55:40 +01:00
Gijs NoorlanderandGitHub a2b2cd857a Merge pull request #1983 from Grovkillen/UpdateFlashTool
[Flasher] Updated to 0.02.002
2018-10-30 22:49:40 +01:00
Bartłomiej ZimońandGitHub 0e581f0288 BlynkGet fix loop #1951
this commit fix #1951
2018-10-30 22:47:32 +01:00
Jimmy Westberg fffcd0f2a4 [Path] folder rename 2 2018-10-30 22:45:10 +01:00
Jimmy Westberg 1d923a527f [Path] folder rename 1 2018-10-30 22:44:40 +01:00
Jimmy Westberg 356ebbc875 [Flasher] Updated to 0.02.002
Spelling error
2018-10-30 22:35:42 +01:00
Jimmy Westberg 25fadfc1ed [Deploy] small letters are the standard 2018-10-30 22:29:56 +01:00
Jimmy Westberg 54d892e162 [Flasher] Updated to 0.02.001 2018-10-30 22:27:53 +01:00
Jimmy Westberg 007ef78f2b [Deploy] Added sub folder for BIN files
I moved the compiled files to a sub folder (BIN) which makes it auto load if using the ESP.Easy.Flasher.exe
2018-10-30 21:05:09 +01:00
Jimmy Westberg d16daeca56 [Flasher] Added ESP.Easy.Flasher.exe
And moved the bin files to sub folder "BIN"
2018-10-30 20:52:46 +01:00
TD-er 90fdb8f809 [OTA] Add OTA info and disable when not enough space 2018-10-30 15:58:46 +01:00
stefan 383206b149 Add sent/return value check to client.print()
Add a check and debug to client.print() in send_via_http() on sent bytes and fail if not all (or nothing) could be sent to the wifi client
2018-10-30 13:23:32 +01:00
ESPEasy release bot ac20349854 automatically updated release notes for mega-20181030 2018-10-30 04:00:07 +01:00
Gijs NoorlanderandGitHub 1a972d61a6 Merge pull request #1619 from jamestutton/mega
Added Special Case to allow Servo to be disabled
2018-10-30 01:01:17 +01:00
Gijs NoorlanderandGitHub d6cf2e141b Merge pull request #1944 from svmac/mega
P022_PCA9685 Enhancements
2018-10-30 01:00:35 +01:00
Gijs NoorlanderandGitHub 7a2e9ba203 Merge pull request #1978 from TD-er/feature/core_2_4_2
[Core 2.4.2] Set core 2.4.2 as default platform
2018-10-30 00:58:46 +01:00
TD-er e3591aceb2 [Core 2.4.2] Set core 2.4.2 as default platform
Also added separate build using core 2.4.1 for those with PWM issues.
2018-10-30 00:23:36 +01:00
ESPEasy release bot ad3514e765 automatically updated release notes for mega-20181029 2018-10-29 04:00:08 +01:00
Gijs NoorlanderandGitHub f543995d86 Merge pull request #1968 from TD-er/bugfix/increase_ntp_accuracy
[NTP] Improve NTP accuracy
2018-10-29 01:02:09 +01:00
Gijs NoorlanderandGitHub 97ccb8eca1 Merge pull request #1975 from uzi18/patch9
Dallas: use reset timming from OneWire lib
2018-10-29 01:01:51 +01:00
Bartlomiej Zimon f291c9d25a Dallas: use reset timming from OneWire lib 2018-10-28 14:59:50 +00:00
Gijs NoorlanderandGitHub bd9ead3851 Merge pull request #1974 from uzi18/patch9
Dallas: add ScratchPad to debug log
2018-10-28 14:48:29 +01:00
Bartlomiej Zimon 43ea0039fd Dallas: add ScratchPad to debug log - OK suffix means data integrity ok (no communication problems) 2018-10-28 12:50:34 +00:00
ESPEasy release bot 74eb638bcb automatically updated release notes for mega-20181028 2018-10-28 04:00:09 +01:00
TD-er c87b035908 [NTP] Change log level for NTP success to INFO 2018-10-28 01:10:11 +02:00
TD-er 0f450eaa3d [NTP] Improve NTP accuracy
Use fractional part of TX section in NTP packet.
Also compensate for total delay to retrieve answer.

More possibilities for improvement of NTP, see https://github.com/lettier/ntpclient/issues/4#issuecomment-360703503
2018-10-28 00:22:39 +02:00
Gijs NoorlanderandGitHub 02df033fc6 Merge pull request #1967 from TD-er/bugfix/1684_Eastron
[Eastron] Make configurable and allow for multiple values read (#1684)
2018-10-28 00:07:57 +02:00
Gijs NoorlanderandGitHub 74d05e58f0 Merge pull request #1768 from workgroupengineering/feature/cron
[Feature] [Plugin] Cron
2018-10-28 00:07:31 +02:00
ESPEasy release bot 3d88537677 automatically updated release notes for mega-20181027 2018-10-27 04:00:12 +02:00
Gijs NoorlanderandGitHub 95b0a7bed9 Merge pull request #1784 from jazzgil/add-raw-ir-reading
Add IR RAW2 Reading / Transmitting.
2018-10-27 02:45:26 +02:00
Gijs NoorlanderandGitHub bc3434532e Merge pull request #1942 from giig1967g/new/doubleclick-pcf
doubleclick and longpress for PCF and MCP
2018-10-27 02:41:12 +02:00
TD-er 1f7639cb42 [Eastron] Make configurable and allow for multiple values read (#1684)
See #1684
It should now be possible to actually select parameters and configure it from the frontend.

N.B. Not yet tested on real hardware.
2018-10-27 00:49:52 +02:00
Gijs NoorlanderandGitHub 923642bb27 Merge pull request #1966 from uzi18/patch9
CSE7766 - fix stats plus add buffer fill level, #1934
2018-10-26 23:25:21 +02:00
Bartlomiej Zimon a09cb906eb CSE7766 - fix stats plus add buffer fill level 2018-10-26 20:43:31 +00:00
Saverio Cisternino 72b0a32839 [CRON] Fixed Daily flash write rate exceeded! 2018-10-26 09:51:41 +02:00
TD-erandSaverio Cisternino e279e5504b [Cron] Rename plugin name to match naming convention 2018-10-26 09:51:41 +02:00
Saverio Cisternino 6d5ddf06ce [CRON] Intercept event PLUGIN_TIME_CHANGE 2018-10-26 09:51:41 +02:00
Saverio Cisternino 7f544b7a10 [CRON] Add event PLUGIN_TIME_CHANGE 2018-10-26 09:51:41 +02:00
Saverio Cisternino fc407e86e1 [CRON] Plugin 2018-10-26 09:51:41 +02:00
Saverio Cisternino a35c3051df [CRON] Replace timeStruct with standard tm 2018-10-26 09:51:41 +02:00
ESPEasy release bot f8f2ddd33b automatically updated release notes for mega-20181026 2018-10-26 04:00:22 +02:00
Gijs NoorlanderandGitHub 6592b57615 Merge pull request #1934 from uzi18/patch9
fix for #1920
2018-10-25 23:52:04 +02:00
Bartlomiej Zimon 6e8e8214b2 CSE7766 - add some stats to debug log 2018-10-25 20:47:36 +00:00
Gijs NoorlanderandGitHub 24b6611c54 Merge pull request #1956 from workgroupengineering/BugFix/Issue_1995
Fixed plugin timer processing do not start, when call setPluginTaskTimer in PLUGIN_TIMER_IN
2018-10-25 21:37:07 +02:00
Gijs NoorlanderandGitHub 8135defa6f Merge pull request #1957 from TD-er/bugfix/c009_reduce_memory
[C009] Reduce memory usage for C009 controller.
2018-10-25 21:27:18 +02:00
Bartlomiej Zimon d5e9cfb081 Merge branch 'mega' of github.com:letscontrolit/ESPEasy into patch9 2018-10-25 18:17:10 +00:00
TD-er ffc8e1fb97 [C009] Reduce memory usage for C009 controller. 2018-10-25 12:09:49 +02:00
Saverio Cisternino 0255f41897 Fixed plugin timer processing do not start, when call setPluginTaskTimer in PLUGIN_TIMER_IN 2018-10-25 10:24:09 +02:00
ESPEasy release bot e88973861f automatically updated release notes for mega-20181025 2018-10-25 04:00:13 +02:00
Gijs NoorlanderandGitHub d6ec7aa736 Merge pull request #1941 from workgroupengineering/feature/Issue_1794
Added auto redirect to home after run reboot command from web page.
2018-10-25 02:12:08 +02:00
Gijs NoorlanderandGitHub 8aa5866dd9 Merge pull request #1954 from TD-er/bugfix/replace_yield_delay_0
[WDT] Replace yield() with delay(0)  & add Sonoff POW R2 build
2018-10-25 02:11:15 +02:00
TD-er 0c384c332e [Travis] Use variables even when no predefined plugins are added. 2018-10-25 01:54:00 +02:00
TD-er 7a4f3b15b3 [Info] Remove MD5 check fail on self-built images
And add in bold a statement it is self built.
2018-10-25 01:43:26 +02:00
TD-er c38e532e67 [Sonoff] Add pre-defined switch and relay + rules on factory reset
Define `GPIO_KEY1` containing GPIO number to get a pre-configured button input on factory reset.

Define `GPIO_REL1` containing GPIO number to get a pre-configured relay on factory reset.

When couple of `GPIO_KEY1` and `GPIO_REL1` is defined, a rule matching both will be added.
This is defined for 1...4
2018-10-25 01:28:25 +02:00
TD-er f983dd924d [Build] Add Sonoff POW R2 (4MB)
Sonoff POW R2 has 4 MB flash. So this needs a separate build, compared to the regular POW.
2018-10-24 20:44:48 +02:00
TD-er f0ff52b76b [WDT] Change yield() to delay(0)
`delay(0)` is a special case of delay, which also calls the system scheduler, `yield()` does not call.
It may interrupt a bit more than `yield()` 

See #1950
2018-10-24 13:25:36 +02:00
Plebs 3c0e5d1965 fixed as requested
- Fixed bootstate logic and inversed logic
- added selected events for doubleclick and longpress
- fixed log messages
- cleaned code
2018-10-23 23:45:23 +02:00
Bartlomiej Zimon 14489a2e98 optimization - remove double checksum check 2018-10-23 19:53:36 +00:00
Bartlomiej Zimon a920b95cfb move to PLUGIN_SERIAL_IN from PLUGIN_TEN_PER_SECOND - serial commandline uses our data 2018-10-23 15:52:27 +00:00
Saverio Cisternino a111175a8f Added auto redirect to home after run reboot command from web page. 2018-10-23 09:14:31 +02:00
svmac 4fd2166b5e P022_PCA9685 Enhancements
Added freq setting
Added mode2 command and setting
Added range command and setting
2018-10-23 05:06:23 +02:00
ESPEasy release bot db76aeb959 automatically updated release notes for mega-20181023 2018-10-23 04:00:14 +02:00
Gijs NoorlanderandGitHub b313957311 Merge pull request #1943 from TD-er/bugfix/pubsubclient_fixes
Bugfix/pubsubclient fixes
2018-10-23 02:09:38 +02:00
TD-er 9d0f741e84 [Docs] Add some WiFi related information to docs
Last week I added this text in a discussion on an issue.
It is also useful in the documentation so keep a copy there.
2018-10-23 01:48:26 +02:00
TD-er 7c0f1551b8 [WiFi timeout] Set default to 1000 msec again
Lower values might give strange issues
2018-10-23 01:45:33 +02:00
TD-er 8a59811392 [PubSubClient] Add delay when waiting for data and flush on disconnect
Applied suggestions:
- https://github.com/knolleary/pubsubclient/pull/472
- https://github.com/knolleary/pubsubclient/pull/495
2018-10-23 01:44:22 +02:00
Plebs e2e715d7de final fixes 2018-10-22 23:31:49 +02:00
Bartlomiej Zimon ccb4cf6a7a move to PLUGIN_TEN_PER_SECOND
update comments
2018-10-22 21:19:00 +00:00
Plebs 1b4a217bc9 fixed a display bug 2018-10-22 23:07:00 +02:00
Plebs 19ecf36358 doubleclick and longpress for PCF and MCP
Added doubleclick and longpress events for PCF (P019) and MCP (P009)
2018-10-22 22:30:20 +02:00
Bartlomiej Zimon bdea34a583 CSE7766 add online checksumming, autosyncing without data loos 2018-10-22 19:54:58 +00:00
Gijs NoorlanderandGitHub b7b5028c0c Merge branch 'mega' into add-raw-ir-reading 2018-10-22 20:05:59 +02:00
Gijs NoorlanderandGitHub c519d887db Merge pull request #1932 from TD-er/bugfix/1486_rotary_encoder
[#1486] Allow multiple instances of rotary encoder
2018-10-22 19:58:07 +02:00
Gijs NoorlanderandGitHub 29c8b850ba Merge pull request #1930 from Kurairaito/patch-1
Allow multiple instances of _P067_HX711_Load_Cell
2018-10-22 13:01:09 +02:00
Gijs NoorlanderandGitHub d01cb9b9a2 Merge pull request #1933 from TD-er/bugfix/Javascript_update_device_values
[JavaScript] Fix update values on Devices tab
2018-10-22 10:59:29 +02:00
ESPEasy release bot 9d894d7c83 automatically updated release notes for mega-20181022 2018-10-22 04:00:15 +02:00
Bartlomiej Zimon a418cb2bd0 Ser2Net catch serial data only if plugin used 2018-10-21 18:51:43 +00:00
Bartlomiej Zimon 907a672fa0 CSE7766 uses 8E1 serial connection 2018-10-21 18:50:57 +00:00
TD-er 2f10274da2 [JavaScript] Cleanup some code duplication 2018-10-21 17:01:55 +02:00
TD-er 399b344779 [JavaScript] Fix update values on Devices tab
Not all plugins have all values.
Now the JavaScript code checks if a DOM element exists before updating its value.
2018-10-21 16:47:06 +02:00
TD-er 2e06ed14c0 [#1486] Allow multiple instances of rotary encoder
Used same procedure as for P013 ultrasonic
See #1486
2018-10-21 15:51:36 +02:00
KurairaitoandGitHub b0032bebdb Update _P067_HX711_Load_Cell.ino
Reduce Ram footprint by using map vector instead of array
2018-10-21 13:41:40 +02:00
KurairaitoandGitHub a525ec34b0 Update _P067_HX711_Load_Cell.ino
Make it compatible when instantiated multiple time
2018-10-21 12:46:26 +02:00
Gijs NoorlanderandGitHub 024ec7b727 Merge pull request #1928 from TD-er/bugfix/reduce_webserver_strings
Reduce webserver strings
2018-10-21 11:12:52 +02:00
ESPEasy release bot 1ff0141e38 automatically updated release notes for mega-20181021 2018-10-21 04:00:16 +02:00
Gijs NoorlanderandGitHub 125db8046b Merge pull request #1927 from TD-er/feature/1870_build_sysino
[#1870] Feature request build date as system info
2018-10-21 01:20:51 +02:00
TD-er 720317c829 [Webserver] Uniform row labels to reduce flash string size 2018-10-21 01:18:43 +02:00
TD-er bbe9005a32 [Webserver] Generate copyText id names
Reduce amount of flash strings to reduce build file size
2018-10-21 00:05:31 +02:00
Gijs NoorlanderandGitHub afa16e80b6 Merge pull request #1923 from TD-er/bugfix/wifi_stability
Various network stability fixes and reduce memory usage when saving settings
2018-10-20 23:09:50 +02:00
Gijs NoorlanderandGitHub 37f5c92aa7 Merge pull request #1926 from TD-er/bugfix/1891_multiple_values
[#1891] Send all values for Generic UDP controller
2018-10-20 23:08:05 +02:00
TD-er 684b89ae4c [#1870] Feature request build date as system info
See #1870
Added:
- %sysbuild_date%
- %sysbuild_time%
2018-10-20 23:05:59 +02:00
TD-er 8c4612c300 [#1891] Send all values for Generic UDP controller
See https://github.com/letscontrolit/ESPEasy/issues/1891#issuecomment-431612051

A copy of the element from the queue was used, not a reference to it.
Therefore increasing the internal counter to send the next value was only executed on the copy, not the element in the list.
2018-10-20 22:34:11 +02:00
Gijs NoorlanderandGitHub 0afab53659 Merge pull request #1925 from TD-er/revert/1924_pull_request
Revert "fix for #1920"
2018-10-20 20:05:22 +02:00
Bartlomiej ZimonandTD-er e6e98345fe Revert "fix for #1920"
This reverts commit 3f84c35014.
2018-10-20 20:03:56 +02:00
Gijs NoorlanderandGitHub 2394e4a75f Merge pull request #1924 from uzi18/patch9
fix for #1920
2018-10-20 18:51:05 +02:00
ESPEasy release bot e1c4691325 automatically updated release notes for mega-20181020 2018-10-20 04:00:16 +02:00
Bartlomiej Zimon 3f84c35014 fix for #1920
fix for out of sync, check both header bytes
proper check for abnormal state
2018-10-19 22:40:11 +00:00
TD-er bc0bafa96b [#1910] Notification settings extra strings on stack
See #1910
Added a lot more of these changes and changed the input fields of the Notification Settings to be the same as all input fields in other places.
2018-10-20 00:20:58 +02:00
TD-er 4e7e66822d [Rules] Early exit on rules processing when rules not enabled 2018-10-20 00:20:58 +02:00
TD-er 6f226e6d65 Proper look for connection.
See discussion here: https://github.com/esp8266/Arduino/issues/5257
2018-10-20 00:20:58 +02:00
TD-er a50a035238 [stack usage] Allocate temp char array on heap for parsing arguments
These char arrays were rather large, so allocate on heap instead of char[240] on the stack.
Also re-order elements in not stored structs to reduce memory usage
2018-10-20 00:20:58 +02:00
Gijs NoorlanderandGitHub d560c635f5 Merge pull request #1922 from kpalczewski/mega
add support for 64bit IR codes.
2018-10-20 00:05:31 +02:00
kpalczewski f8db0c0a05 add support for 64bit IR codes. 2018-10-19 22:34:04 +02:00
Gijs NoorlanderandGitHub 79616022df Merge pull request #1919 from giig1967g/new/statusvariables
added 4 variables to verify the system status
2018-10-19 22:15:26 +02:00
Gijs NoorlanderandGitHub 559d294607 Merge branch 'mega' into new/statusvariables 2018-10-19 21:36:45 +02:00
Gijs NoorlanderandGitHub d2588c5e01 Merge pull request #1848 from giig1967g/new/plugin_pcf
Added [plugin#pcfgpio#pinstate#xx] and [plugin#mcpgpio#pinstate#xx]
2018-10-19 21:34:18 +02:00
Gijs NoorlanderandGitHub ba45a51576 Merge pull request #1884 from giig1967g/new/uservars
added Global Variables for rules
2018-10-19 21:33:10 +02:00
Gijs NoorlanderandGitHub 8321caaeed Merge branch 'mega' into new/statusvariables 2018-10-19 21:31:18 +02:00
Gijs NoorlanderandGitHub b35ed7d809 Merge pull request #1880 from giig1967g/doubleclick
DEBOUNCE, DOUBLECLICK and LONGPRESS events for PLUGIN001
2018-10-19 21:23:22 +02:00
Plebs a4583d150e added 4 variables to verify the system status
4 new system variables:
%iswifi% (=1 if wifi is connected)
%isntp% (=1 if NTP has been initialized)
%ismqtt% (=1 if mqtt is connected)
%ismqttimp% (=1 if mqtt import is connected)

Example:
if %isntp%=1 and %systime%>%sunset% do
....
endif
2018-10-18 17:44:05 +02:00
ESPEasy release bot cadc0a885d automatically updated release notes for mega-20181017 2018-10-17 04:00:18 +02:00
Gijs NoorlanderandGitHub 061eb20ae5 Merge pull request #1914 from TD-er/bugfix/reduce_stack
[#1906] Move Notification and Controller settings to heap
2018-10-17 00:40:30 +02:00
TD-er 9a9799eee7 [Stack] Add Free Stack to System Info plugin 2018-10-17 00:04:22 +02:00
Gijs NoorlanderandGitHub f4615bb76b Added checklist to the Issue_template
Lately a lot of new issues were non-descriptive and the same basic questions were to be asked over and over again.
These are now included in this template.
2018-10-16 23:02:33 +02:00
TD-er ecc498c359 [#1906] Allocate ControllerSettings on the heap
See #1906
2018-10-16 12:24:06 +02:00
TD-er e0e10fa6c8 [#1906] Allocate NotificationSettings on the heap
See #1906
2018-10-16 11:47:46 +02:00
ESPEasy release bot 228f09f394 automatically updated release notes for mega-20181016 2018-10-16 04:00:06 +02:00
Gijs NoorlanderandGitHub 19ac19778b Merge pull request #1909 from giig1967g/bug/toggle
Fix for "togglegpio" without gpio initialization
2018-10-16 01:11:46 +02:00
Gijs NoorlanderandGitHub 5e2d517ba2 Merge pull request #1913 from TD-er/bugfix/revert_safe_strncpy
[Revert] Safe_strncpy cannot be used as generic strncpy replacement
2018-10-16 01:09:59 +02:00
TD-er 7a4b17983e [Revert] Safe_strncpy cannot be used as generic strncpy replacement
It does do more. So only use it to convert Strings to single char arrays.
2018-10-16 00:11:17 +02:00
Plebs 6eba74ccc1 Fix for togglegpio without gpio initialization 2018-10-15 17:34:35 +02:00
ESPEasy release bot 27a05b674c automatically updated release notes for mega-20181015 2018-10-15 04:00:10 +02:00
Gijs NoorlanderandGitHub 4a66bbf081 Merge pull request #1905 from TD-er/bugfix/safe_strncpy
[safe strncpy] Add warning when entered string is too large
2018-10-15 00:52:34 +02:00
TD-er 109bddb5c3 [safe strncpy] Add warning when entered string is too large
Started with this issue:
"Framed Oled Display mixing up multiple values in different lines" #1904

Now almost all calls to `strncpy` are replaced with this safe variant which does some checking and zero-ing the buffer.
2018-10-15 00:24:57 +02:00
Gijs NoorlanderandGitHub 8158a919d8 Merge pull request #1879 from giig1967g/bug/1864
fix for bug #1864
2018-10-14 10:35:19 +02:00
ESPEasy release bot 706b91168b automatically updated release notes for mega-20181014 2018-10-14 04:00:13 +02:00
Gijs NoorlanderandGitHub d047999c5e Merge pull request #1901 from TD-er/bugfix/warn_incomplete_IPsettings
[UX] Warn user for incomplete network IP settings
2018-10-14 00:59:37 +02:00
Gijs NoorlanderandGitHub 42f361aacd Merge pull request #1902 from TD-er/bugfix/1895_I2C
[#1895] Incorrect number bytes read I2C_read32_reg
2018-10-14 00:43:15 +02:00
TD-er 3dd076cf25 [#1895] Incorrect number bytes read I2C_read32_reg
See #1895
2018-10-14 00:42:03 +02:00
TD-er c0d155dd99 [UX] Warn user for incomplete network IP settings
Was a left-over remark in #1291
2018-10-14 00:22:46 +02:00
Gijs NoorlanderandGitHub c433174d71 Merge pull request #1900 from TD-er/bugfix/time_initialized_event
Time#Initialized event in rules before %syshour% is set
2018-10-13 23:37:04 +02:00
Gijs NoorlanderandGitHub b805b59baf Merge pull request #1899 from TD-er/bugfix/controller_check_reply
Fix send only first value by controller (#1891 #1892 #1835)
2018-10-13 23:07:32 +02:00
Gijs NoorlanderandGitHub 9fae0477d8 Merge pull request #1894 from letscontrolit/feature/1799_SSID_mainpage
[#1799] Add SSID to main page
2018-10-13 23:06:55 +02:00
TD-er f7ac04dc96 Time#Initialized event in rules before %syshour% is set
See [forum](http://www.letscontrolit.com/forum/viewtopic.php?f=6&t=5819&p=31376&hilit=Initialized#p31376) and [other report of same issue](https://www.letscontrolit.com/forum/viewtopic.php?t=5925)
2018-10-13 23:05:35 +02:00
TD-er d50e661efb [Controller] Fix send only first value
See #1891 #1892 #1835
Added an extra option to explicitly check the reply  on sent messages by a controller.
2018-10-13 22:21:36 +02:00
Plebs 57b5338af6 Update src/StringConverter.ino 2018-10-12 15:00:58 +02:00
Plebs bd035c8f81 optimizations 2018-10-12 12:52:22 +02:00
Plebs ac63d93e1a Update src/_P001_Switch.ino 2018-10-12 12:10:10 +02:00
Plebs 4cff0d0e02 Update src/_P001_Switch.ino 2018-10-12 10:16:54 +02:00
TD-er ca83983fd2 [#1891] Generic UPD controller - send only first value from sensor
See #1891
2018-10-12 01:04:46 +02:00
Gijs NoorlanderandGitHub d808f7e79b [#1799] Add SSID to main page
See #1799
2018-10-12 00:57:08 +02:00
Plebs e469350ad9 modified command and variable name 2018-10-11 19:23:42 +02:00
Plebs 60536b1a93 some optimizations 2018-10-11 12:23:08 +02:00
Plebs b9e45bd515 fixed length check 2018-10-11 12:16:55 +02:00
Plebs a0992b8383 fixes 2018-10-11 11:50:37 +02:00
Plebs 9315581858 some fixes 2018-10-11 11:37:15 +02:00
ESPEasy release bot 9a763303ca automatically updated release notes for mega-20181011 2018-10-11 04:00:24 +02:00
Gijs NoorlanderandGitHub 7df9379f47 Merge pull request #1886 from TD-er/bugfix/reduce_memory_usage
Bugfix/reduce memory usage & improve load ExtraTaskSettings check
2018-10-11 01:48:31 +02:00
Plebs c32fe50521 Update src/_P023_OLED.ino 2018-10-10 23:28:34 +02:00
Plebs e4569b26f7 added global variables for rules
Added a new command:
customvar,x,y
that stores in a system variable %customvarx% the value 'y'.

Values are float
2018-10-10 23:19:09 +02:00
TD-er 48998886fe [WebLog] Disable weblog when it is not being read
This will prevent log items being generated when web log level is the highest level and it will clear the web log buffer to free memory.
2018-10-10 20:23:10 +02:00
Plebs 36f97d7909 some fixes 2018-10-10 19:24:45 +02:00
TD-er 0e3b9c9e47 [Travis Doc] Remove building documentation by Travis
It seems to break the nightly builds, so remove for now.
2018-10-10 15:54:34 +02:00
ESPEasy release bot acecff4108 automatically updated release notes for mega-20181010 2018-10-10 04:00:09 +02:00
TD-er 3322b954a7 Make sure to load ExtraTaskSettings when needed
There is only 1 `ExtraTaskSettings` object, so make sure it is always in sync.
2018-10-10 01:29:38 +02:00
TD-er 4c4b844a4d [Controller] Set default timeout to 300 msec (was 100 msec)
300 msec should be enough for most online services like `cloudmqtt.com`
2018-10-10 00:19:26 +02:00
Gijs NoorlanderandGitHub cf4d28eb4f Merge pull request #1877 from giig1967g/new/pcfinvertstate
Fix for #1767
2018-10-10 00:05:11 +02:00
TD-er 555b5386ae [C009] Reduce memory usage of FHEM HTTP delay queue
The entire JSON string was stored in the queue element, but lot of it can be computed later.
2018-10-09 23:52:46 +02:00
Plebs 1903fdc7f2 fix for bug #1864
Removed '.' check
2018-10-09 18:16:15 +02:00
Plebs 918353461e Update src/_P001_Switch.ino 2018-10-09 16:31:55 +02:00
Plebs e648a20fd0 Update src/_P019_PCF8574.ino 2018-10-09 16:24:13 +02:00
Plebs 1d7ea5e129 Update src/_P001_Switch.ino 2018-10-09 14:58:21 +02:00
Plebs 6ce5240dd7 few changes 2018-10-09 09:34:50 +02:00
ESPEasy release bot 692fb248ce automatically updated release notes for mega-20181009 2018-10-09 04:00:18 +02:00
Gijs NoorlanderandGitHub 5a87397ee0 Merge pull request #1872 from TD-er/bugfix/JSON_newline
Bugfix/json newline and memory allocation optimizations.
2018-10-09 01:14:50 +02:00
TD-er 99ba09b024 [StringConverter] Some optimisations to reduce memory allocation 2018-10-09 01:11:45 +02:00
Plebs 3dea091d21 small fixes 2018-10-09 00:20:27 +02:00
Plebs ca13317cbd Update src/_P001_Switch.ino 2018-10-09 00:12:50 +02:00
TD-er f68516d5bb [LWIP1.4] Move back to LWIP1.4
The combination LWIP1.4 and core 2.4.1 were used until begin of May and those were considered stable.
2018-10-08 23:56:55 +02:00
TD-er 8102a0096d [JSON] Replace \n and \r in text fields
Those are not allowed in strings in JSON.
This leads to (web) log viewer crashing.
2018-10-08 23:44:44 +02:00
Plebs 73cec59bd5 Update src/_P001_Switch.ino 2018-10-08 22:30:02 +02:00
Gijs NoorlanderandGitHub 96ecf9bf29 Merge pull request #1871 from TD-er/bugfix/travis_check_for_docs
[Docs] Disable travis_terminate for now
2018-10-08 21:05:55 +02:00
TD-er ef1e371514 [Docs] Disable travis_terminate for now
Apparently `travis_terminate` does not exist anymore as a command to stop the script without failing.
2018-10-08 19:29:56 +02:00
Gijs NoorlanderandGitHub 45d67292a3 Merge pull request #1869 from TD-er/feature/travis_build_docs
Feature/travis build docs
2018-10-08 16:38:16 +02:00
TD-er b5662baad4 [Docs] Run Travic documentation check before compiling project 2018-10-08 16:04:12 +02:00
TD-er 12c3e5f81f [Docs] Add Travis check for documentation and stop build for docs only
Let Travis build the documentation and prevent full build when only documentation changed.
2018-10-08 15:34:02 +02:00
TD-er dececf24ee [Docs] Add favicon to documentation 2018-10-08 15:31:48 +02:00
ESPEasy release bot 3fb6dec382 automatically updated release notes for mega-20181008 2018-10-08 04:00:09 +02:00
Gijs NoorlanderandGitHub cef962c5f1 Added link to ReadTheDocs 2018-10-08 00:05:58 +02:00
Gijs NoorlanderandGitHub cca2335070 Merge pull request #1868 from TD-er/feature/update_sphinx_docs
[Docs] Added some directory structure and template
2018-10-08 00:01:07 +02:00
TD-er ffd0d26ed3 [Docs] Added some directory structure and template 2018-10-08 00:00:27 +02:00
Plebs 9b457ed77b some code optimizations 2018-10-07 23:12:23 +02:00
GrovkillenandGitHub f787a9a9a6 [Sphinx] added extension "sphinx.ext.imgconverter" 2018-10-07 19:11:49 +02:00
Gijs NoorlanderandGitHub a0ae104794 Merge pull request #1865 from TD-er/feature/sphinx_docs
Feature/sphinx docs
2018-10-07 18:26:06 +02:00
TD-er 2b78810457 [Docs] First ESPEasy documentation (Controllers) 2018-10-07 18:23:25 +02:00
TD-er 43081c3ac8 [Sphinx] Initial setup for Sphinx documentation 2018-10-07 17:09:52 +02:00
ESPEasy release bot 33281c08c2 automatically updated release notes for mega-20181007 2018-10-07 04:00:09 +02:00
Gijs NoorlanderandGitHub 461aee26ad Merge pull request #1861 from TD-er/feature/debug_esp32_wrover_kit
Move stack to user memory space and close file handles + Add WROVER dev kit debug support
2018-10-06 23:19:18 +02:00
Gijs NoorlanderandGitHub 2b0b14b2e8 Merge pull request #1853 from blenk92/XSS
Fix XSS-Vulnerabilites on wifi configuration pages
2018-10-06 22:56:47 +02:00
Gijs NoorlanderandGitHub b7404666b1 Merge pull request #1851 from blenk92/mega
Force slash to be converted in htmlEscape
2018-10-06 22:56:37 +02:00
Gijs NoorlanderandGitHub da25aa87dd Merge pull request #1733 from giig1967g/new/invertvalue
Add four new TOGGLE commands
2018-10-06 22:55:57 +02:00
TD-er 10a1e634e2 [SPIFFS] Make sure to close open files on SPIFFS 2018-10-06 22:36:41 +02:00
TD-er 83f86449b9 [Stack] Move Arduino 'cont' stack into user RAM
As suggested [here](https://github.com/letscontrolit/ESPEasy/pull/1858#issuecomment-427578956) the previous used flag may also enable WPS.
So I used [this suggestion](https://github.com/esp8266/Arduino/issues/5148#issuecomment-424334261) to only re-allocate the stack at link time.
2018-10-06 20:01:39 +02:00
TD-er eee337d3e3 [ESP32] Allow Wrover dev kit to be used for PIO debug
Initial setup to be able to debug ESP32 Wrover dev kit from within Visual Studio Code + PIO plus.
2018-10-06 18:31:17 +02:00
ESPEasy release bot c549ecd329 automatically updated release notes for mega-20181006 2018-10-06 04:00:13 +02:00
Gijs NoorlanderandGitHub d9e682668d Merge pull request #1858 from TD-er/bugfix/increase_stack_5k
[Stack] Increase stack to 5k and reduce stack allocations in rules
2018-10-06 00:57:31 +02:00
TD-er e38072ac24 [Build flags] Remove NO_EXTRA_4K_HEAP
Core is now set to 2.4.1 again, so this flag is not needed anymore.
Also not sure if it did fix something in 2.4.2 core.
2018-10-06 00:53:53 +02:00
TD-er 6aebeba5dc [WiFi] Add delay to connection attempts in ControllerSettings
As suggested by @s0170071 [here](https://github.com/letscontrolit/ESPEasy/issues/1774#issuecomment-425038026)
2018-10-06 00:50:43 +02:00
TD-er da01c8f469 [Stack] Increase stack to 5k and reduce stack allocations in rules
Removed some unneeded stack allocations of 240 bytes in the rules processing.

Also gave the `process_system_event_queue()` a bit more priority to make sure it will be looked at at least once every 500 msec.
2018-10-05 00:52:22 +02:00
Plebs d3c86b9824 code optimization 2018-10-04 12:07:32 +02:00
Plebs 9621a91d90 added [plugin#mcpgpio#pinstate#xx] 2018-10-04 11:31:49 +02:00
ESPEasy release bot b3b68856f0 automatically updated release notes for mega-20181004 2018-10-04 04:00:08 +02:00
Max bec5cb5334 Fix XSS-Vulnerabilites on wifi configuration pages
Add escaping of wifi network names that can be discovered using the search
functionality of for instantce the /setup page. As these names are also used
inside an html tag, a stronger html encoding variant has been added.
2018-10-04 03:19:09 +02:00
Gijs NoorlanderandGitHub bda6011390 Merge pull request #1852 from TD-er/bugfix/wificlient_timeout
[#1830] WiFi client timeout & back to core 2.4.1
2018-10-04 00:56:09 +02:00
Gijs NoorlanderandGitHub f3fdb93a52 Merge pull request #1831 from JojoS62/mega
[P013_HCSR04] added error checking and logging
2018-10-04 00:54:02 +02:00
Gijs NoorlanderandGitHub 200b060b15 Merge pull request #1846 from thomastech/mega
Update _P075_Nextion.ino
2018-10-04 00:51:44 +02:00
Gijs NoorlanderandGitHub ff41cb2f94 Merge pull request #1849 from uzi18/patch9
- partial fix for #1723
2018-10-04 00:51:03 +02:00
TD-er c134eb6d13 [Core 2.4.1] Move back to core 2.4.1 from 2.4.2
PlatformIO `espressif8266@1.7.3` instead of `espressif8266@1.8.0`
2.4.2 has a lot of improvements like 4k of extra free memory.
But also the number of hardware watchdog reboots has increased a lot and the PWM related code no longer seems to work on 2.4.2
So for now, back to 2.4.1 library.
2018-10-04 00:24:28 +02:00
TD-er f9e2a211e1 [WiFiClient] Set timeout and make it configurable for controllers
The default timeout for wificlient is 1000 msec. This may cause all kind of strange effects when the node is being blocked for so long.
2018-10-04 00:21:00 +02:00
Max bd3d3f66f4 Force slash to be converted in htmlEscape
According to the owasp XSS prevention cheat sheet it is also necessary to encode / as it may helps to end html entities
(Source https://www.owasp.org/index.php/XSS_(Cross_Site_Scripting)_Prevention_Cheat_Sheet#RULE_.231_-_HTML_Escape_Before_Inserting_Untrusted_Data_into_HTML_Element_Content)
2018-10-03 23:58:24 +02:00
Bartlomiej Zimon 3bad683211 - partial fix for #1723 2018-10-03 21:13:56 +00:00
TD-er 68f6e913a2 [sendHttp] #1830 Set timeout and early exit on timeout reached
See #1830
2018-10-03 23:10:47 +02:00
Plebs 0b9c550fd7 Added [plugin#pcfgpio#pinstate#xx]
Added [plugin#pcfgpio#pinstate#xx] variable for rules
2018-10-03 22:49:11 +02:00
Plebs 96420faa2f added "mcpgpiotoggle" command 2018-10-03 22:07:42 +02:00
ThomasandGitHub 8eea77e4ed Update _P075_Nextion.ino (#1)
Added DEBUG_LOG define to reduce info log messages and prevent serial log flooding.
Added SendStatus() to post log message on browser to acknowledge HTTP write.
Added reserve() to minimize string memory allocations.
2018-10-03 09:02:02 -07:00
JojoS62 3d1f723787 Merge branch 'mega' of https://github.com/letscontrolit/ESPEasy into mega 2018-10-03 15:27:40 +02:00
JojoS62 5d459003e4 fixed 'unused variable' warning 2018-10-03 15:19:19 +02:00
JojoS62 ad208c357c code clean up
added default for filter size = 5.
clode clieanup: using constants, read setting into local vars for better readability,
2018-10-03 14:33:17 +02:00
ESPEasy release bot b1c777e6fd automatically updated release notes for mega-20181003 2018-10-03 04:00:18 +02:00
JojoS62 f5ab15c255 max distance depends on measurement unit
setting is in user units, ping function needs cm. Conversion added.
added unit to log output.
2018-10-02 17:41:23 +02:00
JojoS62 001ec6dcd2 added more settings: unit, filtertype and size
Measuring unit can be changed bewtween metric/imperial
Filtertype can none or median. If median a filtersize can be set.
Meauring value time to distance conversion now as float division, resulting in a higher resolution output.
2018-10-02 17:00:22 +02:00
JojoS62 15e5edccd8 added float calculation for time to distance conversion
returns higher resolution, especially for measuring in inches the integer resolution was low.
2018-10-02 16:57:33 +02:00
Gijs NoorlanderandGitHub 651353cc99 Merge pull request #1842 from crankyoldgit/patch-2
Acknowledge credit & origin of code used in _P016IR.ino
2018-10-02 13:41:35 +02:00
Gijs NoorlanderandGitHub 85f97551c5 Merge pull request #1841 from crankyoldgit/patch-1
Acknowledge credit & origin of code used in IRTX
2018-10-02 13:41:23 +02:00
David ConranandGitHub 6a158f68f5 Acknowledge credit & origin of code used in _P016IR.ino
FYI @TD-er

Ref: https://github.com/letscontrolit/ESPEasy/pull/1645#issuecomment-422253497
2018-10-02 21:36:18 +10:00
David ConranandGitHub 1933714de5 Acknowledge credit & origin of code used in IRTX
FYI @TD-er

Ref: https://github.com/letscontrolit/ESPEasy/pull/1645#issuecomment-422253497
2018-10-02 21:29:57 +10:00
ESPEasy release bot 545117ddf7 automatically updated release notes for mega-20181002 2018-10-02 04:00:29 +02:00
Gijs NoorlanderandGitHub 8eb479c411 Merge pull request #1837 from TD-er/bugfix/schedule_commands_yield
[Stack] Report stack usage on ESP32 and increase stack for ESP8266normal
2018-10-01 23:27:07 +02:00
TD-er b39f51ca3c [Stack] Report stack usage on ESP32 and increase stack for ESP8266normal
Stack usage on ESP32 is querying current stack, not statistics per RTOS task.
2018-10-01 22:15:32 +02:00
Gijs NoorlanderandGitHub 4511e08d3c Merge pull request #1805 from giig1967g/new/parse
split parseTemplate function
2018-10-01 17:12:21 +02:00
Gijs NoorlanderandGitHub 086e836956 Merge pull request #1836 from TD-er/feature/esp32_pio_1_4_0
[ESP32] Update to platform espressif32@1.4.0
2018-10-01 17:10:45 +02:00
Gijs NoorlanderandGitHub 3e20f617ea Merge pull request #1827 from TD-er/bugfix/DTH_Si7021_reading_stability
[#1798] Bugfix Sonoff Si7021 stability
2018-10-01 17:10:23 +02:00
TD-er 8d9aacb6a4 [ESP32] Update to PIO espressif32@1.4.0
[ESP32 IDF 3.1](https://github.com/espressif/esp-idf/releases/tag/v3.1)
[ESP32 PIO 1.4.0](https://github.com/platformio/platform-espressif32/releases/tag/v1.4.0)
2018-10-01 16:34:21 +02:00
TD-er 0670fa98a6 [ESP32] Add default partition table for reference 2018-10-01 16:32:20 +02:00
ESPEasy release bot 2b3d1517c9 automatically updated release notes for mega-20181001 2018-10-01 13:13:13 +02:00
Gijs NoorlanderandGitHub 0be79759d1 Merge pull request #1834 from TD-er/bugfix/detect_large_stack_allocs
[Stack] Move Arduino stack back to top of System stack instead of overlap
2018-10-01 01:25:38 +02:00
TD-er d47bede215 [Stack] Revert move Settings from stack to heap
Apparently the settings are allocated on the system stack and not on the Arduino stack.
This means it takes a lot of ram when allocated on the heap. So move it back to the system stack.
2018-10-01 00:51:04 +02:00
TD-er 2988a244b2 [Stack] Check if a block sent to save on SPIFFS is stack allocated 2018-10-01 00:42:01 +02:00
TD-er 8d87dc0175 [Heap] Use NO_EXTRA_4K_HEAP to get old stack address space
Originally the Arduino stack was placed on top of the system stack.
But since the system stack is mostly empty, it was decided to shift the Arduino stack to overlap the system stack to save an extra 4k of memory.

However, since a lot of Watchdog timer reboots are reported lately, this optimisation will now be reverted to see if it will improve stability.
This will use about 4k more RAM.
2018-10-01 00:40:55 +02:00
Gijs NoorlanderandGitHub 21c86e666a Merge pull request #1829 from TD-er/feature/1824_stack_stats
[#1824] Show stack size on main page
2018-09-30 19:37:16 +02:00
JojoS e6fdd3380a added error checking and logging
there were several errors that all resulted in a distance value reading of 0. Added an errorState that is printed to the log and helps troubleshooting.
Max. Distance checking can be turned off by setting max distance to 0 cm. If max. distance is used, exceeding the range will return a distance of 0 cm and print this to the log.
2018-09-30 15:23:36 +02:00
TD-er e04f71ab47 [#1824] Show stack size on main page
See #1824
2018-09-30 09:32:01 +02:00
ESPEasy release bot 90ae0720cf automatically updated release notes for mega-20180930 2018-09-30 04:00:24 +02:00
Gilad Raz 4ec2af24a3 Increased buffer size. Added constants. 2018-09-30 01:10:55 +03:00
TD-er c8ecd8d374 [#1798] Bugfix Sonoff Si7021 stability
See #1798
2018-09-29 22:50:24 +02:00
Gijs NoorlanderandGitHub 7a451dd672 Merge pull request #1825 from TD-er/bugfix/proper_default_settings
Bugfix/proper default settings
2018-09-29 15:39:21 +02:00
Gijs NoorlanderandGitHub b06f6aa360 Merge pull request #1823 from JojoS62/mega
minor change: unit was missing for threshold in 'state' mode
2018-09-29 15:06:36 +02:00
TD-er 6b67415c71 [Defaults] Other default initializations 2018-09-29 15:05:10 +02:00
JojoS b095465d3a minor change: unit was missing for threshold in 'state' mode 2018-09-29 14:09:03 +02:00
Gijs NoorlanderandGitHub 81a5d911ba Merge pull request #1809 from JojoS62/mega
fixed distance reading
2018-09-29 13:38:44 +02:00
TD-er 48060d8d99 [Default Settings] Properly clear settings when reset to default 2018-09-29 12:40:29 +02:00
JojoS d303fa023f changed implementation to use shared_ptr instead of helper structure
this makes it easier to use this as a template for other sensors. No additional helper class/structure is needed.
2018-09-29 11:58:57 +02:00
JojoS 29b0cc1b32 removed sensordefs helper structure
to simplify the code
2018-09-27 22:00:01 +02:00
JojoS 584abd1e75 on INIT, delete sensordef before adding new 2018-09-27 14:19:54 +02:00
JojoS b4d8be0e59 fixed distance reading
the P_013_sensordef object was created on the stack and the destructor was called after leaving the PLUGIN_INIT. That deleted the included NewPingESP8266 object and using this object failed.
2018-09-27 11:56:31 +02:00
ESPEasy release bot 30f5c5cb7d automatically updated release notes for mega-20180927 2018-09-27 04:00:17 +02:00
Plebs 6e7286c6fb split parseTemplate function
simplifying code
2018-09-26 23:40:01 +02:00
Gijs NoorlanderandGitHub ae1db543ce Merge pull request #1804 from TD-er/bugfix/ESP32_partition_build
[ESP32] Split new partition layout to separate build
2018-09-26 22:52:30 +02:00
TD-er 947e1e0343 [Build] Add esp32test_1M8_partition build and warning on ESP32 partition 2018-09-26 22:49:30 +02:00
TD-er 0578d720f4 [ESP32] Split new partition layout to separate build
See "ESP32 not start after last upgrade" #1802
2018-09-26 21:55:02 +02:00
Gilad Raz 3fee6794f2 Merge branch 'mega' of https://github.com/letscontrolit/ESPEasy into add-raw-ir-reading 2018-09-26 19:03:47 +03:00
Gilad Raz 019e33331b Merge branch 'mega' into add-raw-ir-reading
# Conflicts:
#	src/_P016_IR.ino
#	src/_P035_IRTX.ino
2018-09-26 19:01:50 +03:00
Gijs NoorlanderandGitHub 211d79bbd5 Merge pull request #1792 from TD-er/feature/ESP32_partition_table
[ESP32] Change partition size (will clear all settings) and add plugins
2018-09-26 09:05:44 +02:00
Gilad 8a751a0922 Merge branch 'mega' of https://github.com/letscontrolit/ESPEasy into mega 2018-09-25 18:43:37 +03:00
Gilad 450eca8dc5 Fixed warnings... 2018-09-25 03:13:14 +03:00
Gilad ce0bfbf717 Fixed warnings... 2018-09-25 02:30:20 +03:00
Gilad bb316bbd30 Improved IR RAW2 format to support RLE. 2018-09-25 01:42:45 +03:00
TD-er 91c5d60af9 [Info] Add board name to the sysinfo page. 2018-09-25 00:19:17 +02:00
TD-er 0d9bc8027d [ESP32] RTOS move handle_schedule() to core1 and increase stack
Enable RTOS flag in advanced settings (and reboot) to create separate threads on the 2nd ESP32 core, which will handle the scheduler.
This lowers stack usage and CPU load.
Also the ESP will no longer crash when saving large settings like for the Framed OLED plugin.
2018-09-25 00:18:46 +02:00
TD-er bd2bdab95c [Stack] Move Settings from stack to heap 2018-09-24 22:08:02 +02:00
TD-er c4f98fbc8e [Travis] Uninitialized variable in P073_7DGT 2018-09-24 20:13:24 +02:00
ESPEasy release bot b332a513b5 automatically updated release notes for mega-20180924 2018-09-24 04:00:20 +02:00
TD-er e36bb714f1 [ESP32] Change partition size (will clear all settings) and add plugins
The last update to > 0.12 increased the binary size a lot. This is mainly due to the added BLE support.
This makes it almost impossible to use the default partition table layout.

This changes the app partitions to 1.8 MB and reduces the SPIFFS to 320 k.
Changing the partition table will clear all settings, so make a backup of the settings.

Also added all plugins that would compile (not tested) for ESP32.

Known issue:
ESP32 might crash due to stack overflow when saving settings of plugins. (e.g. OLED framed plugin)
2018-09-24 00:23:45 +02:00
Gijs NoorlanderandGitHub 6e1cde343f Merge pull request #1791 from TD-er/bugfix/ESP32_I2C
[ESP32] Fix I2C handling to allow I2C devices to work
2018-09-23 22:14:43 +02:00
TD-er cce9ddd2dc [ESP32] Fix I2C handling to allow I2C devices to work
See this issue: [I2C repeated start broken](https://github.com/platformio/platform-espressif32/issues/126)
2018-09-23 21:17:55 +02:00
Gijs NoorlanderandGitHub 51be17a436 Merge pull request #1780 from clumsy-stefan/sensor_type_change
Change type of sensor for MCP and PCF devices
2018-09-23 20:18:38 +02:00
Gijs NoorlanderandGitHub 66d27a6697 Merge pull request #1776 from beigenmann/mega
Fix platformio
2018-09-23 20:17:33 +02:00
Gijs NoorlanderandGitHub a033e458fb Merge pull request #1782 from TD-er/bugfix/MQTT_reconnect_name
[MQTT] Work around for lost MQTT connection
2018-09-23 20:17:07 +02:00
Gijs NoorlanderandGitHub 494436bbff Merge pull request #1789 from sakinit/ESP32-to-core_esp32_1_3_0
ESP32: change to platform version core_esp32_1_3_0
2018-09-23 20:16:52 +02:00
sakinit 23bacd0762 change to platform version core_esp32_1_3_0 2018-09-23 17:49:47 +02:00
Gilad 9bdfab3fa2 Add IR RAW2 Reading / Transmitting - added a safety check. 2018-09-23 15:49:26 +03:00
Gilad 9d446745cc Add IR RAW2 Reading / Transmitting - fixed ambiguity. 2018-09-23 14:38:36 +03:00
Gilad d2ab946d17 Add IR RAW2 Reading / Transmitting. 2018-09-23 12:44:56 +03:00
Gilad fcc71a56b6 Add IR RAW2 Reading / Transmitting. 2018-09-23 12:40:52 +03:00
ESPEasy release bot f131254853 automatically updated release notes for mega-20180923 2018-09-23 04:00:12 +02:00
TD-er 657d15d962 [MQTT] Work around for lost MQTT connection
Maybe a fix for #1525
Meant to be a fix for #1530

It looks like the MQTT broker is refusing to accept a new connection from a specific client ID, as long as the broker thinks a client with that ID is still connected.
This work around adds the number of wifi reconnects to the clientID, to make the ID unique when a reconnect has to be made.
2018-09-23 00:54:55 +02:00
Gijs NoorlanderandGitHub 60910da48d Merge pull request #1749 from sakinit/ESP32-P1WifiGateway-updates
Esp32 p1 wifi gateway updates
2018-09-22 20:59:32 +02:00
Gijs NoorlanderandGitHub 6cee2d0f32 Merge pull request #1779 from TD-er/bugfix/BME280_slow_reading
[BME280] Fix slow reading of BME280 causing watchdog resets
2018-09-22 20:45:20 +02:00
stefan 533cb88a64 Change type of sensor for MCP and PCF devices
MCP and PCF devices should be of type SWNSOR_TYPE_SWITCH instead of SENSOR_TYPE_SINGLE so that the controllers can identify them correctly as switches (for GPIO related functions)
2018-09-22 20:41:53 +02:00
TD-er ffa32fe851 [BME280] Fix slow reading of BME280 causing watchdog resets
The plugin still had some delay and an active polling to see if the reading was ready.
This  took more than 1.5 sec per reading, which could trigger a Watchdog reset.
2018-09-22 20:34:56 +02:00
Gijs NoorlanderandGitHub b900cc9389 Merge pull request #1777 from TD-er/bugfix/MQTTimport
[MQTT import] Fix crash at boot when plugin is enabled
2018-09-22 19:13:25 +02:00
TD-er 8e11c19af6 [MQTT import] Fix crash at boot when plugin is enabled
See #1722
Inspired by [this comment](https://github.com/letscontrolit/ESPEasy/issues/1722#issuecomment-422191721) of @kainhofer
2018-09-22 16:39:16 +02:00
Benno Eigenmann f33ca6df78 Fix platformio 2018-09-22 15:57:09 +02:00
ESPEasy release bot 194a230d20 automatically updated release notes for mega-20180922 2018-09-22 04:00:22 +02:00
Gijs NoorlanderandGitHub 7a5a432016 Merge pull request #1773 from TD-er/reapply_reverts
Reapply reverts
2018-09-22 02:04:30 +02:00
TD-er 07511fe144 Revert "Revert "Fix elseif & Add if-elseif-else nesting levels""
This reverts commit a4fe8d42d2.
2018-09-21 22:15:13 +02:00
Gijs Noorlander 9a390136f9 Revert "Revert "Added 2 new operators in Calculate() function""
This reverts commit fa42cadfa1.
2018-09-21 22:14:30 +02:00
Gijs NoorlanderandGitHub 27a03f166a Merge pull request #1770 from TD-er/bugfix/revert_disable_command_scheduler_0915
Revert "[Scheduler] Disable command scheduler"
2018-09-21 22:10:50 +02:00
TD-er 0a63aeb8f0 Revert "[Scheduler] Disable command scheduler"
This reverts commit 38af765935.
2018-09-20 23:20:19 +02:00
sakinit 22c10ac615 ESP32 platform updated to 1.2.0; Webserver replaced by platform one 2018-09-16 16:44:25 +02:00
ESPEasy release bot ac83cfa249 automatically updated release notes for mega-20180916 2018-09-16 04:00:11 +02:00
Gijs NoorlanderandGitHub 6ef0c08bc4 Merge pull request #1754 from TD-er/bugfix/backgroundtasks_rules
[HW Watchdog] Backgroundtasks instead of yield during rules handling
2018-09-16 01:19:47 +02:00
TD-er 1ee965067d [HW Watchdog] Backgroundtasks instead of yield during rules handling 2018-09-16 01:19:14 +02:00
Gijs NoorlanderandGitHub e46a873fce Merge pull request #1753 from letscontrolit/revert-1641-mega
Revert "Fix elseif & Add if-elseif-else nesting levels"
2018-09-16 01:15:04 +02:00
Gijs NoorlanderandGitHub 784e956c96 Merge pull request #1752 from letscontrolit/revert-1742-new/not
Revert "Added 2 new operators in Calculate() function"
2018-09-16 01:14:32 +02:00
Gijs NoorlanderandGitHub b6eebb330a Added warning to release notes 20180915 2018-09-16 01:13:49 +02:00
Gijs NoorlanderandGitHub a4fe8d42d2 Revert "Fix elseif & Add if-elseif-else nesting levels" 2018-09-16 01:08:42 +02:00
Gijs NoorlanderandGitHub fa42cadfa1 Revert "Added 2 new operators in Calculate() function" 2018-09-16 01:04:37 +02:00
sakinit 17dc6fa859 Reverted Webserver change 2018-09-15 16:22:58 +02:00
sakinit 1432726dec ESP32: Split webserver spiffs filelist into pages 2018-09-15 12:14:33 +02:00
sakinit 7ba6ffa407 Fix ESP32 stack overflow in addPinSelect when called from P1WifiGateway
In addFormPinSelect move local variables from the stack to the heap
because when it is called from the P1WifiGateway there is not enough
stack space resulting in a stack overflow.
2018-09-15 12:14:27 +02:00
sakinit ab555e4d6b ESP32 build issues fixed
- Compiler issue of comment within comment
 - ESP32Webserver renamed to Webserver in ESP32 Arduino library
2018-09-15 12:14:22 +02:00
ESPEasy release bot d4259f4e23 automatically updated release notes for mega-20180915 2018-09-15 04:00:15 +02:00
Gijs NoorlanderandGitHub aef45c06f6 Merge pull request #1747 from TD-er/bugfix/sunrise
[#1698] Incorrect sunrise value southern hemisphere
2018-09-15 00:19:42 +02:00
Gijs NoorlanderandGitHub 828f9e6a30 Merge pull request #1746 from TD-er/feature/hostname_settings
Validate settings + hostname format option
2018-09-15 00:14:30 +02:00
TD-er e79d778cf4 [#1698] Incorrect sunrise value southern hemisphere
See #1698
2018-09-15 00:10:45 +02:00
TD-er 965eb2d994 [#1713] Make hostname-unitnumber optional & validate settings
See #1713
Also added validation check for some values in the settings at load/save of settings.
This could be extended later on for task settings.
2018-09-14 23:44:58 +02:00
Gijs NoorlanderandGitHub 657fccf49f Merge pull request #1641 from svmac/mega
Fix elseif & Add if-elseif-else nesting levels
2018-09-14 23:27:00 +02:00
Gijs NoorlanderandGitHub 228b41a1ac Merge pull request #1742 from giig1967g/new/not
Added 2 new operators in Calculate() function
2018-09-14 23:26:25 +02:00
Gijs NoorlanderandGitHub 3bba294eb7 Merge pull request #1745 from TD-er/bugfix/commands_not_using_scheduler
[Scheduler] Disable command scheduler
2018-09-14 23:22:21 +02:00
TD-er 0254181b3e [Controller settings] Validate settings on load/save
Make sure new values are set to proper defaults and within valid range.
2018-09-14 22:54:23 +02:00
Gijs NoorlanderandGitHub 3b67282abb Merge branch 'mega' into mega 2018-09-14 21:26:21 +02:00
TD-er 38af765935 [Scheduler] Disable command scheduler
For now the commands will no longer use the scheduler.
Commands running asynchronous is causing too much issues.
2018-09-14 21:23:09 +02:00
Plebs ff180b085c Added 2 new operators in Calculate
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
2018-09-14 16:44:11 +02:00
ESPEasy release bot e0785eb796 automatically updated release notes for mega-20180914 2018-09-14 04:00:17 +02:00
Gijs NoorlanderandGitHub 75a83787a4 Merge pull request #1740 from TD-er/bugfix/disable_failing_plugin
[CrashRecover] Disable failing step based on failed boot count
2018-09-14 00:18:48 +02:00
Gijs NoorlanderandGitHub 65bea6343c Merge pull request #1734 from giig1967g/new/eventvalue
adding more parameters to EVENT
2018-09-14 00:15:41 +02:00
Gijs NoorlanderandGitHub 6fe61411a0 Added PayPal link 2018-09-14 00:10:48 +02:00
Gijs NoorlanderandGitHub 4552e91022 Merge pull request #1731 from giig1967g/new/calculate
Use parameters inside rules when calling commands
2018-09-14 00:06:13 +02:00
Gijs NoorlanderandGitHub cc94d70e6c Merge pull request #1730 from sakinit/feature-webserver-spiffs-filelist-multiple-pages
Feature: Split webserver spiffs filelist into pages
2018-09-13 23:50:11 +02:00
Gijs NoorlanderandGitHub 2435078f76 Merge pull request #1732 from TD-er/feature/flash_tools
[Flash tools] Add blank files and README.txt to dist folder
2018-09-13 23:49:43 +02:00
Gijs NoorlanderandGitHub dd2cd50d4b Merge pull request #1738 from giddyhup/mega
Fix IR plugin passing received code
2018-09-13 23:48:46 +02:00
TD-er fe38eb629d [CrashRecover] Disable failing step based on failed boot count
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.
2018-09-13 23:44:24 +02:00
Plebs e961507456 added %eventvalue4% 2018-09-13 19:14:13 +02:00
Plebs e5ee5644bf final version with '=' sign as a prefix to identify the formula in rules 2018-09-12 22:48:44 +02:00
Gijs NoorlanderandGitHub ac6d85e214 Merge branch 'mega' into mega 2018-09-12 21:54:50 +02:00
Markus Gloede 39c2d54aee Fix IR plugin passing received code 2018-09-12 21:09:05 +02:00
Plebs 68efd5ff9e adding more parameters to EVENT
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%
2018-09-11 17:38:47 +02:00
Plebs 627f516f85 fixed calls to F-macro 2018-09-11 16:03:35 +02:00
Plebs a45fadf42e fixed ESP32 compatibility issue 2018-09-11 14:38:14 +02:00
Plebs 2ae52b849c few changes
optimized the call to CALCULATE only when needed and description of error codes.
2018-09-11 13:10:00 +02:00
Plebs 639685ea0d fixed float to int conversion 2018-09-11 10:16:44 +02:00
Plebs 867209de6d Add three new TOGGLE commands
Added three new commands to toggle the pins from 0 to 1 or viceversa and to toggle the task value:

Command: taskvaluetoggle
P001: gpiotoggle
P019:pcfgpiotoggle
2018-09-11 00:38:55 +02:00
TD-er 1d8b6d346b [Flash tools] Add blank files and README.txt 2018-09-10 23:02:38 +02:00
Plebs 2a5ac327d3 Use parameters inside rules when calling commands
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
2018-09-10 22:59:50 +02:00
sakinit 886101d4d4 Feature: Split webserver spiffs filelist into pages 2018-09-10 17:37:05 +02:00
ESPEasy release bot 8fc6486855 automatically updated release notes for mega-20180910 2018-09-10 04:00:23 +02:00
Gijs NoorlanderandGitHub eeb1cc71b3 Merge pull request #1728 from TD-er/bugfix/command_send_http
Bugfix/command SendToHTTP  & Domoticz IDX > 9999
2018-09-10 01:02:58 +02:00
TD-er 13837830e8 [Domoticz IDX] Allow for IDX of > 9999 2018-09-09 23:00:16 +02:00
Gijs NoorlanderandGitHub f86ff46a82 Merge pull request #1727 from sakinit/P1WifiGatewayModuleBufSize
Reduced buffer size to prevent stack overflow
2018-09-09 22:53:23 +02:00
TD-er e901bc957a [HTTP] Command SendToHttp cannot connect
Incorrect check for return value.
As suggested via the [forum](https://www.letscontrolit.com/forum/viewtopic.php?f=6&t=5794&p=31203#p31181)
2018-09-09 21:58:14 +02:00
sakinit e7e10c5305 Reduced buffer size to prevent stack overflow 2018-09-09 19:54:23 +02:00
ESPEasy release bot 466ddfbe88 automatically updated release notes for mega-20180909 2018-09-09 04:00:14 +02:00
Gijs NoorlanderandGitHub c8f02d2a4c Merge pull request #1721 from TD-er/bugfix/wifi_connection_slow_server
[#1720] WiFi read all lines from slow servers
2018-09-08 23:14:33 +02:00
TD-er af1d9b38c9 [Serial log] Use buffer to prevent Serial buffer to overflow
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.
2018-09-08 20:48:29 +02:00
Gijs NoorlanderandGitHub 7294217489 Revert [WDT] Add watchdog feed to backgroundtasks()
See comment: https://github.com/letscontrolit/ESPEasy/issues/1722#issuecomment-419659193
2018-09-08 20:31:16 +02:00
TD-er 208fa8a3aa [ESP32] Fix Build, ESP32 doesn't have the availableForWrite 2018-09-08 18:24:48 +02:00
TD-er b3b8eff127 [Serial Log] Limit serial log to prevent buffer overflow
As suggested here: https://github.com/letscontrolit/ESPEasy/issues/1625#issuecomment-411558353 by @thomastech
2018-09-08 16:19:58 +02:00
TD-er c6a90ab2d0 Add forward declaration for void backgroundtasks() 2018-09-08 16:00:06 +02:00
TD-er e7d28e8576 [#1720] WiFi read all lines from slow servers
See #1720
2018-09-08 15:20:39 +02:00
ESPEasy release bot efa27dc01d automatically updated release notes for mega-20180908 2018-09-08 04:00:20 +02:00
Gijs NoorlanderandGitHub 7c7b81911d Merge pull request #1669 from TD-er/bugfix/buffer_send_controller
Use queue to manage controllers and add timing settings per controller
2018-09-07 23:31:55 +02:00
Gijs NoorlanderandGitHub c2962d7337 Update README.md 2018-09-07 23:30:33 +02:00
TD-er e2e2059ff0 [Queue] Add memory check to determine full queue
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.
2018-09-07 22:32:17 +02:00
TD-er 4e95bbef7f [Scheduler] Do not schedule task device timer for tasks without interval
See #1709
2018-09-06 22:21:39 +02:00
TD-er b0a90b5b14 [#1714] Parse notification sender to allow some sender formatting
`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 )
2018-09-05 23:20:49 +02:00
TD-er c8ac1bbd59 [#1707] Getting logs from the /log even when password is not entered
See #1707
2018-09-05 22:49:38 +02:00
TD-er e6105bfe71 [WDT] Add yield() and runbackgroundtasks() when parsing rules
Rules parsing may take some time, so perform some yields to prevent watchdog triggers.
2018-09-04 22:48:07 +02:00
ESPEasy release bot 1bb8669ed2 automatically updated release notes for mega-20180904 2018-09-04 04:00:34 +02:00
Gijs NoorlanderandGitHub 34f4a9a8e0 Merge pull request #1704 from TD-er/bugfix/duplicate_names_check
[#1702] Check for duplicate names bug
2018-09-04 00:22:30 +02:00
TD-er a517f3471c [#1702] Check for duplicate names bug
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.
2018-09-03 21:25:07 +02:00
ESPEasy release bot 9c706b7b0e automatically updated release notes for mega-20180903 2018-09-03 04:01:13 +02:00
TD-er f2b4e17e2a [MQTT] Force MQTT client reconnect when wifi reconnects
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.
2018-09-02 23:01:36 +02:00
TD-er 6f62ba0f9b [Watchdog] Add watchdog feed to backgroundtasks() function
A lot of reports recently about resets by the Hardware Watchdog.
So maybe this timer is not reset as often as before.
2018-09-02 23:01:36 +02:00
TD-er 36c6fd4bf7 [SPIFFS] Add SPIFFS size + usage to sysinfo page 2018-09-02 23:01:36 +02:00
TD-er 4446d76c83 [MQTT] Give MQTT state in log when connect state changes. 2018-09-02 23:01:36 +02:00
TD-er f354b05b07 [Nodes] Fix String copy to properly read node names 2018-09-02 23:01:36 +02:00
TD-er 467df9dde2 [Cleanup] Memory optimisation in available controllers and plugins
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.
2018-09-02 23:01:36 +02:00
TD-er dac243cc82 [Nodes] Highlight current node in the list of nodes 2018-09-02 23:01:36 +02:00
TD-er 3d1be96f8a [Nodes] Make Nodes list a map with dynamic size
Nodes list is now a std::map, which may contain up-to 254 nodes (1...254), since 255 is reserved for broadcast and 0 for "all known".
2018-09-02 23:01:36 +02:00
TD-er 0dd53e38d7 [C013] Remove some obsolete function
`C013_Send` did actually only call another function and some other bogus object loading without using the data.
2018-09-02 23:01:36 +02:00
TD-er df6338dfee [C012] Controller C012 now also uses Delay Queue 2018-09-02 23:01:36 +02:00
TD-er 1bab99de40 [Controller] Moved the 'magic' default and max values to defines
The Max and Default values for the Controller Delay Queue are now set in the `ESPEasy-Globals.h` file.
2018-09-02 23:01:36 +02:00
TD-er ec44efb59f [C011] Controller C011 now also uses Delay Queue
And some code cleanup of shared code in C001 and C003.
Also fixed an issue in C011, where the result was not returned when sending a value.
2018-09-02 23:01:36 +02:00
TD-er 202a6fd1f7 [Cleanup] Merge code duplication between C008 and C010
Both use the same Queue Element class.
2018-09-02 23:01:36 +02:00
TD-er dc7828d343 [C010] Controller C010 now also uses Delay Queue 2018-09-02 23:01:36 +02:00
TD-er 5c92731b41 [HTTP] Add user agent in request header
Should make this optional later
2018-09-02 23:01:36 +02:00
TD-er 8c34067d9c [HTTP Auth] Now using proper index for retrieving credentials
I was using the controller number and not the controller index to get the user credentials.
Should now work for FHEM.
2018-09-02 23:01:36 +02:00
TD-er 92025249fc [C009] Remove 'no port' option in HTTP packet
As tested by @clumsy-stefan, it didn't make a difference.
2018-09-02 23:01:36 +02:00
TD-er dd5b5bb7c3 [Client Connect] Check for success on connecting with client.
In case of domain name resolution error result can be negative.
See [Dns.cpp](https://github.com/esp8266/Arduino/blob/18f643c7e2d6a0da9d26ff2b14c94e6536ab78c1/libraries/Ethernet/src/Dns.cpp#L44)

Thus must match the result with 1.
2018-09-02 23:01:36 +02:00
TD-er 03bc2f34f6 [C009] Controller C009 now also uses Delay Queue
Also fixed an issue where sending some value to a controller would fail when the buffer is full and the settings set to "Delete Oldest".
2018-09-02 23:01:36 +02:00
TD-er a19b59e184 [C009] Removed port number from HTTP host header
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.
2018-09-02 23:01:36 +02:00
TD-er 861bc64ce3 [#1666] Moved code duplication for HTTP requests to special functions
The controller source files are now much cleaner and all use the same code.
So it is easier to fix issues and add features and checks.
2018-09-02 23:01:36 +02:00
TD-er 7428b03e18 [C008] Let C008 use queue and some bugfixes
Also added statistics
And some optimizations
2018-09-02 23:01:36 +02:00
TD-er 54a6ecac7d [Webserver] Add fields for new Controller settings
Make sure all new settings are configurable for all controllers.
2018-09-02 23:01:36 +02:00
TD-er ec4aa627bb [MQTT] Use set controller settings on MQTT controllers 2018-09-02 23:01:36 +02:00
TD-er 0dc47bc04c [C007] Let C007 controller use queue 2018-09-02 23:01:36 +02:00
TD-er 5f029c59d2 Added USES_Cxxx checks
functions may not be mentioned in the scheduler when the controller is not included in the build.
2018-09-02 23:01:36 +02:00
TD-er 8beeeaf7fa [C004] Let C004 controller use queue and simplify using macros
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.
2018-09-02 23:01:36 +02:00
TD-er 293b63e654 [C003] Let C003 controller use queue 2018-09-02 23:01:36 +02:00
TD-er 734150e87b [C001] Let C001 controller use queue 2018-09-02 23:01:36 +02:00
TD-er 6bb1b4086c [Controller] Make ControllerDelayHandler templated and comment
Added recognisable comments throughout the `ESPEasy-Globals.h` file and made ControllerDelayHandler templated to be used for other controllers to use.
2018-09-02 23:01:36 +02:00
TD-er 9cd2d2d843 [MQTT] Add controller delay queue for MQTT
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.
2018-09-02 23:01:36 +02:00
TD-er 02c022d7d5 [controller delay] Let controllers handle their own delay and buffer 2018-09-02 23:01:36 +02:00
Gijs NoorlanderandGitHub b1c8346700 Merge pull request #1700 from TD-er/feature/Shelly_support
[Shelly1] Add first test build for Shelly1 nodes
2018-09-02 22:58:30 +02:00
TD-er 272ed8c578 [Shelly1] Add first test build for Shelly1 nodes
[Shelly1 Open Source (ESP8266-2MB)](https://shelly.cloud/shelly1-open-source/)
This is a preliminary test version as I have not yet received my ordered modules.
Also there is a [feature request](https://github.com/esp8266/Arduino/issues/5096#issuecomment-417942708) out for adding proper flash layout for these 2M flash modules which allow proper OTA.
2018-09-02 22:31:05 +02:00
Gijs NoorlanderandGitHub a9e473dbc6 Merge pull request #1697 from TD-er/feature/1688_dewpoint
[#1688] Add dew point computation as standard conversion
2018-09-02 20:31:37 +02:00
TD-er 4baccf5863 [#1688] Add dew point computation as standard conversion
Dew point(T,H): `%c_dew_th%(18.6,67)` will be replaced with `12.31`
See #1688
2018-09-02 20:30:42 +02:00
Gijs NoorlanderandGitHub ad84eb8b8a Merge pull request #1696 from TD-er/feature/leading_zero_sysvars
[sysvar] rename vars with leading zero to %..._0%
2018-09-02 18:35:07 +02:00
TD-er 23f2bfc6d8 [sysvar] rename vars with leading zero 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.
2018-09-02 18:34:33 +02:00
Gijs NoorlanderandGitHub 34d2f25652 Merge pull request #1695 from TD-er/feature/sysparam_webpage
[#1549] Add page showing all system variables
2018-09-02 15:59:50 +02:00
Gijs NoorlanderandGitHub 294683ece1 Merge pull request #1694 from TD-er/bugfix/notification_mail
[#1692] Add 2nd Receiver for Email notification
2018-09-02 15:59:35 +02:00
Gijs NoorlanderandGitHub 56bd1cb19c Merge pull request #1686 from TD-er/bugfix/build_issues
[Pio] Build issue P016_IR and add PIO flags
2018-09-02 15:59:15 +02:00
TD-er 812f530c4b [#1549] Add page showing all system variables
Via Tools => System Variables.
2018-09-02 13:47:18 +02:00
TD-er 97258a531d Forgot to save before commit
Forgot to increase to next address.
2018-09-02 00:08:06 +02:00
TD-er 7d2ef727a7 [#1692] Add 2nd Receiver for Email notification
Implementation suggested by @dwarf2k See: https://github.com/letscontrolit/ESPEasy/issues/1692#issuecomment-417887364
2018-09-02 00:02:50 +02:00
TD-er 9e83213a13 [Pio] Build issues
Redefine of `TIMEOUT` in P016_IR.
Add option to set CPU frequency and flags undef per build
2018-08-28 00:10:27 +02:00
ESPEasy release bot ecb5ca9306 automatically updated release notes for mega-20180826 2018-08-26 04:00:20 +02:00
Gijs NoorlanderandGitHub edb6178ae2 Merge pull request #1682 from TD-er/bugfix/P080
[Build Travis] "Scratchpad was set but never used"
2018-08-26 00:32:18 +02:00
TD-er b8894efc57 [Build Travis] "Scratchpad was set but never used"
Build error with Travis.
2018-08-26 00:31:49 +02:00
Gijs NoorlanderandGitHub 970181d8c7 Merge pull request #1681 from TD-er/bugfix/P078_P080
Bugfix/p078 p080
2018-08-26 00:12:53 +02:00
TD-er 9d2fad783f [Build] Add "[TESTING]" labels to P078 and P080 2018-08-26 00:12:13 +02:00
jimmys01andGitHub 9d42e83314 Merge pull request #1 from letscontrolit/mega
test
2018-08-26 01:01:41 +03:00
Gijs NoorlanderandGitHub 0005915c5c Upgrade IR lib and move IR code to separate build
IR TX and RX enhancements and split to a special build, due to the resources needed for the IR library and code.
2018-08-25 23:29:17 +02:00
Gijs NoorlanderandGitHub eb78bc3e03 Merge pull request #1468 from henfri/patch-1
Create _P080_DallasIButton.ino
2018-08-25 23:27:11 +02:00
Gijs NoorlanderandGitHub 17777698cd Merge pull request #1679 from TD-er/feature/Eastron
[#205] Initial port of Playground P150 to Mega (Eastron)
2018-08-25 23:23:09 +02:00
Gijs NoorlanderandGitHub d091148dfc Merge branch 'mega' into feature/Eastron 2018-08-25 23:22:42 +02:00
Gijs NoorlanderandGitHub fcb25a2aec Merge pull request #1492 from TungstenE2/mega
added new Plugin for Wemos Motorshield P_079
2018-08-25 23:21:18 +02:00
TD-er a7d90a33a0 [Dallas iButton] Change VType to SENSOR_TYPE_LONG 2018-08-25 23:18:00 +02:00
TD-er 3a68ff8f9d [P080] Dallas iButton Rename P078 to P80 2018-08-25 22:51:43 +02:00
henfriandTD-er 3b45e200a7 Update _P078_DallasIButton.ino
empty lines removed
2018-08-25 22:51:43 +02:00
henfriandTD-er b724c22c80 Create _P078_DallasIButton.ino
Plugin for reading the Dallas iButton
2018-08-25 22:51:43 +02:00
TD-er b810e34b74 [MotorShield] Added comments in the code and fixes
Frequency was not using the upper 4 bits of the values.
Changed delay to yield.
2018-08-25 22:39:36 +02:00
TD-er c70ffd735c [MotorShield] Cleanup code layout
Indentation was hard to read, so ran code beautify.
2018-08-25 21:03:02 +02:00
TD-er 604c58a290 [MotorShield] Rename P078 to P079 2018-08-25 21:03:02 +02:00
TungstenE2andTD-er 1d1b69b1ce Added Wemos Motorshield Plugin (No. 78) 2018-08-25 21:03:02 +02:00
TungstenE2andTD-er bd2cc4138b Added Wemos Motorshield Plugin (No. 78) 2018-08-25 21:03:02 +02:00
Gijs NoorlanderandGitHub ca5f2815bc Merge pull request #1631 from GHolli/mega
Optimisations
2018-08-25 12:31:58 +02:00
Gijs NoorlanderandGitHub f67bf51606 Merge pull request #1672 from TD-er/bugfix/network_mqtt_issues
[MQTT] Check connection and specific check for success when connect.
2018-08-25 12:31:20 +02:00
Gijs NoorlanderandGitHub e1f0badd92 Merge pull request #1678 from Feuerreiter/mega
Add overview of known espeasy nodes to json
2018-08-25 12:30:57 +02:00
jimmys01 b9ea66037c Small correction 2018-08-25 13:15:41 +03:00
TD-er 62a196d398 [JSON] Only show node information when generic info is requested
This extra node information is not needed when values of a specific task is requested, so only output when other generic information is shown.
2018-08-25 12:09:00 +02:00
jimmys01 d4ee74297b IR RX updated
The IRrecvDumpV2.ino functionality added to the RX module.
Let me know for a good way to display the RAW values.
2018-08-25 12:53:42 +03:00
TD-er d0d95e221b [JSON] Fix issue when UDP port not set
With no nodes to display, the generated JSON was not valid.
Also removed some duplicate F() macro strings.
2018-08-25 11:49:54 +02:00
TD-er 7ad8880651 [IR/IRTX] For PullReq #1645 split IR/IRTX to a separate build
The new library takes a lot of resources.
2018-08-25 01:01:48 +02:00
TD-er f46a6c3414 [Eastron] Add missing SDM_Config_User.h 2018-08-24 23:48:20 +02:00
TD-er ab0ed4b5ca [Eastron] Make P078 Eastron compile, serial settings do not yet work
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.
2018-08-24 23:16:33 +02:00
TD-er b1fb308646 [SDM] Update library to latest version
Latest version requires a Software Serial object for the constructor.
2018-08-24 22:55:13 +02:00
feuerreiter 79ee397e8e Adds a overview of known espeasy nodes to the json response. I think this can be useful for own webinterfaces etc. 2018-08-24 17:20:17 +02:00
TD-er 56569374f3 [Eastron] Add P078 plugin from the Playground (was P150)
Still problems using the Software Serial
2018-08-24 01:29:55 +02:00
TD-er 41b13f6797 [Client Connect] Check for success on connecting with client.
In case of domain name resolution error result can be negative.
See [Dns.cpp](https://github.com/esp8266/Arduino/blob/18f643c7e2d6a0da9d26ff2b14c94e6536ab78c1/libraries/Ethernet/src/Dns.cpp#L44)

Thus must match the result with 1.
2018-08-22 21:58:34 +02:00
TD-er 8f23048f18 [MQTT] PubSubClient Add checks for connectivity
Taken from master branch of PubSubClient
2018-08-22 21:56:05 +02:00
ESPEasy release bot a123dbf37f automatically updated release notes for mega-20180822 2018-08-22 04:00:15 +02:00
Gijs NoorlanderandGitHub 6b65e90ddf Merge pull request #1664 from TD-er/bugfix/UDP_checks
[UDP] Use random outgoing port for NTP and check return values
2018-08-21 23:46:12 +02:00
Gijs NoorlanderandGitHub 890db55197 Changed INPUT_COMMAND_SIZE from 80 to 240
The default of 80 was too short for commands using an url like `sendtohttp`
Changed it to 240 to allow for some longer commands.
2018-08-21 23:44:58 +02:00
TD-er 514800433f [UDP] Use random outgoing port for NTP and check return values
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.
2018-08-19 00:51:21 +02:00
ESPEasy release bot deb18d2391 automatically updated release notes for mega-20180818 2018-08-18 04:00:17 +02:00
Edwin Eefting e18d069171 fixed network config for newer versions 2018-08-17 17:14:03 +02:00
Gijs NoorlanderandGitHub b63c375793 Merge pull request #1657 from TD-er/bugfix/web_menu_ios11
[#1650] Use icons in tabs on web page on small screens
2018-08-17 00:09:47 +02:00
TD-er f906e9173c [#1650] Use icons in tabs on web page on small screens
See #1650
2018-08-17 00:08:08 +02:00
jimmys01 c444022f5f Travis please be happy :-) 2018-08-16 11:35:36 +03:00
svmac 5511ee9f38 fix mistake 2018-08-15 05:22:27 +02:00
svmac 427a22d23b some code optimization 2018-08-15 04:54:29 +02:00
ESPEasy release bot 306cbf3107 automatically updated release notes for mega-20180815 2018-08-15 04:00:13 +02:00
Gijs NoorlanderandGitHub 458f672744 Merge pull request #1649 from TD-er/bugfix/1487_tone_PIO_update_180
[core 2.4.2] Update to PlatformIO espressif8266@1.8.0
2018-08-15 00:55:44 +02:00
Gijs NoorlanderandGitHub dee1ee6f32 Merge pull request #1648 from krikk/patch-1
Update _P047_i2c-soil-moisture-sensor.ino - Address change on new sensor firmware
2018-08-15 00:54:13 +02:00
TD-er 8930e331d3 [core 2.4.2] Update to PlatformIO espressif8266@1.8.0
Latest version would not build due to conflicting function definition for tone. See #1487
2018-08-15 00:42:41 +02:00
krikkandGitHub 6033990767 Update _P047_i2c-soil-moisture-sensor.ino
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
2018-08-15 00:30:57 +02:00
svmac d271898968 reenabled code about ! 2018-08-14 03:52:29 +02:00
jimmys01 f261e6a5ea commented out more unused code 2018-08-13 17:10:57 +03:00
jimmys01 ff160f386e Travis build complaining about unused vars 2018-08-13 13:02:21 +03:00
jimmys01 ef92e7ae4f IR library added 2018-08-13 12:18:01 +03:00
svmac 4051f0bd2e Fix elseif & Add if-elseif-else nesting levels
- The implementation of elseif is not correct. See this example:

Rule:
On SYSVAL do
if %syssec% < 10
publish %sysname%/IP,%ip%
elseif %syssec% < 20
publish %sysname%/Uptime/min,%uptime%
elseif %syssec% < 30
publish %sysname%/Systime/time,%systime%
elseif %syssec% < 40
publish %sysname%/RSSI/dB,%rssi%
elseif %syssec% < 50
publish %sysname%/Sunrise/time,%sunrise%
else
publish %sysname%/Sunset/time,%sunset-30m%
endif
endon

Result:
109360661 : EVENT: SYSVAL
109360668 : [if 11 < 10]=false
109360675 : [elseif 11 < 20]=true //THIS IS CORRECT
109360677 : ACT : publish Wemos51/Uptime/min,1823
109360686 : Command: publish
109360692 : [elseif 11 < 30]=false
109360697 : [elseif 11 < 40]=false
109360703 : [elseif 11 < 50]=false
109360705 : ReplacementString SunTime: %sunrise% offset: 0
109360708 : else = true //THIS IS NOT CORRECT
109360710 : ReplacementString SunTime: %sunset-30m% offset: -1800
109360712 : ACT : publish Wemos51/Sunset/time,20:46
109360723 : Command: publish
109360729 : EVENT: SYSVAL Processing time:68 milliSeconds

- Added also nesting levels to if-elseif-else clausules define in RULES_IF_MAX_NESTING_LEVEL declaration. Example:

Rule:
On SYSVAL do
if %eventvalue% > 1
publish %sysname%/Sunrise/time,%sunrise+1h%
else
if %syssec% < 10
publish %sysname%/IP,%ip%
elseif %syssec% < 20
publish %sysname%/Uptime/min,%uptime%
elseif %syssec% < 30
publish %sysname%/Systime/time,%systime%
elseif %syssec% < 40
publish %sysname%/eventvalue,%eventvalue%
elseif %syssec% < 50
publish %sysname%/Sunrise/time,%sunrise%
else
publish %sysname%/Sunset/time,%sunset-30m%
endif
endif
endon

Result:
>event,SYSVAL=-5
4977875 : Command: event
4977876 : EVENT: SYSVAL=-5
4977883 : Lev.1: [if -5 > 1]=false
4977886 : ReplacementString SunTime: %sunrise+1h% offset: 3600
4977889 : Lev.1: [else]=true
4977893 : Lev.2: [if 30 < 10]=false
4977900 : Lev.2: [elseif 30 < 20]=false
4977906 : Lev.2: [elseif 30 < 30]=false
4977913 : Lev.2: [elseif 30 < 40]=true
4977916 : ACT : publish Wemos49/eventvalue,-5
4977932 : ReplacementString SunTime: %sunrise% offset: 0
4977935 : Lev.2: [else]=false
4977938 : ReplacementString SunTime: %sunset-30m% offset: -1800
4977944 : EVENT: SYSVAL=-5 Processing time:67 milliSeconds

- Finally, the substitution of %eventvalue% is done earlier so that it can be used in if sentence too.
2018-08-11 16:51:56 +02:00
ESPEasy release bot 93105200d7 automatically updated release notes for mega-20180809 2018-08-09 04:00:06 +02:00
Gijs NoorlanderandGitHub f48ede5d7e Merge pull request #1637 from TD-er/bugfix/send_deepsleep
[deepsleep] Send values immediately after connections are made
2018-08-09 00:39:41 +02:00
TD-er b73181487c [deepsleep] Send values immediately after connections are made
Known issue:
The value of the first task is not sent via MQTT right after waking up from deep sleep.
2018-08-09 00:27:34 +02:00
Gijs NoorlanderandGitHub caee2892c4 Merge pull request #1636 from TD-er/bugfix/timing_issues
Bugfix: Several timing issues
2018-08-08 23:00:05 +02:00
Gijs NoorlanderandGitHub 432bd32967 Merge pull request #1635 from uzi18/patch9
small fix for #702
2018-08-08 22:24:30 +02:00
Gijs NoorlanderandGitHub 235bc0a598 Merge pull request #1634 from letscontrolit/bugfix/Blynk_command
[Blynk] Command handling was not active
2018-08-08 22:22:15 +02:00
TD-er f0cf26baec [Scheduler] Remove scheduled commands from scheduler to run in idle time
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.
2018-08-08 22:19:49 +02:00
TD-er fffccd3787 [C011] Make sure the loaded extra controller settings end with 0
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.
2018-08-08 22:16:21 +02:00
TD-er 5cfbac5eba [#1621] Timing interval of BME280 incorrect
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.
2018-08-08 22:12:43 +02:00
Gijs NoorlanderandGitHub 2bce3f8d02 Merge branch 'mega' into patch9 2018-08-08 22:02:12 +02:00
Bartlomiej Zimon e210722e0e fix for #702, setup propper gpio state before send into PCF8574 for pcfpulse,pcflongpulse 2018-08-08 19:17:58 +00:00
Gijs NoorlanderandGitHub 909d9a4fd1 [Blynk] Change define to allow blynkget command 2018-08-08 19:41:36 +02:00
Gijs NoorlanderandGitHub c8b57cf9e0 [Blynk] Command handling was not active
It was blocked by an old `#define`
2018-08-08 19:39:06 +02:00
ESPEasy release bot d74493ced0 automatically updated release notes for mega-20180808 2018-08-08 04:00:13 +02:00
Gijs NoorlanderandGitHub 7783cf4ce5 Merge pull request #1627 from TD-er/bugfix/MQTT_yield
[#1625] Bugfix/mqtt yield
2018-08-07 20:37:40 +02:00
Gijs NoorlanderandGitHub 27e07d1f67 Merge pull request #1630 from letscontrolit/bugfix/1612_rfid
[#1612] Make P008_RFID using new functions
2018-08-07 20:37:20 +02:00
TD-er 40857cc57c [Schedule] Run command from webpage immediately
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.
2018-08-06 23:12:26 +02:00
TD-er 4f764d6101 [Schedule] Scheduled command timer
Run commands async. The result is now not displayed in the web page anymore.
2018-08-06 08:22:08 +02:00
Gerald Hollweger 49e98f2f8b Optimisations
- Save RAM, move constants to flash (CharTableTM1637, CharTableMAX7219)
- Remove unnecessary parameter passing (the interface pins do not change during operation for one instance)
2018-08-05 19:19:04 +02:00
Gijs NoorlanderandGitHub ddad026a2b [#1612] Make P008_RFID using new functions
See #1612
2018-08-05 15:05:20 +02:00
TD-er b8df55ef36 [Commands] Return String output per command
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)
2018-08-05 14:46:31 +02:00
TD-er be7724d8c7 [Rules] Split processing matched rule in a separate function
Just to get rules processing readable
2018-08-05 03:10:26 +02:00
TD-er c5c1c92cfb [Rules] Split parsing single line from rulesProcessingFile
The function `rulesProcessingFile` is way too long to understand.
First step in making those functions readable.
2018-08-05 01:45:34 +02:00
ESPEasy release bot e6b219a182 automatically updated release notes for mega-20180804 2018-08-04 04:00:23 +02:00
TD-er d2d03358ef [MQTT] Schedule from callback functions
To make sure execution of these functions is called from the `loop()` and not from a callback function.
2018-08-04 01:37:05 +02:00
TD-er a4d751b40f [Notifications] Schedule NPlugin_ptr calls async
To make sure execution of these functions is called from the `loop()` and not from a callback function.
2018-08-04 01:35:54 +02:00
TD-er 1c73cacc82 [Scheduler] Rename some functions and clean-up 2018-08-04 01:34:02 +02:00
Gijs NoorlanderandGitHub 23bfa54ec4 Merge pull request #1626 from thomastech/mega
Update _P075_Nextion.ino [TESTING]
2018-08-03 23:37:49 +02:00
ThomasandGitHub 95138489cd Update _P075_Nextion.ino 2018-08-03 13:46:34 -07:00
Gijs NoorlanderandGitHub c9ec69d30c Merge pull request #1623 from TD-er/bugfix/set_event_taskindex
[#1574] Set event->TaskIndex
2018-08-03 22:25:19 +02:00
TD-er 0e4cabeb17 [Cleanup] Replace a lot of TR TD with function
Flash strings are not checked for duplication by the compiler, so they make the resulting firmware binary larger.
2018-08-03 00:34:14 +02:00
TD-er 19961198fb [Settings file] Include SettingsStruct in the view
And made the `HumanReadable` format a bit more verbose by stripping trailing ".00" when needed.
2018-08-02 23:27:31 +02:00
TD-er c705c570db [ESP32] Small fix building ESP32 2018-08-02 22:40:25 +02:00
TD-er 34d48adb4a [Settings File] Show settings file layout
Run `meminfodetail` command once (can be done via Tools page) and then open the system info page.
2018-08-02 22:30:30 +02:00
ESPEasy release bot fda973bb78 automatically updated release notes for mega-20180802 2018-08-02 04:00:14 +02:00
TD-er c5bfd67d6d [#1574] Set event->TaskIndex
See discussion: https://github.com/letscontrolit/ESPEasy/issues/1574#issuecomment-409677981
2018-08-02 00:34:17 +02:00
GrovkillenandGitHub 402de69fd5 Added extra info to self compilers 2018-08-01 14:22:27 +02:00
ESPEasy release bot 41341b46de automatically updated release notes for mega-20180801 2018-08-01 04:00:18 +02:00
Gijs NoorlanderandGitHub 3574517014 Merge pull request #1618 from TD-er/bugfix/storage_task_settings
[#1574] Stability improvements on ExtraTaskSettings
2018-07-31 20:31:21 +02:00
Edwin Eefting cca785e1f0 Power down PN532 after reading. Saves power and reduces interference with Wifi. 2018-07-31 16:53:32 +02:00
TD-er 4215e058d0 [#1306] Added %R% and %N% for literals \r and \n 2018-07-30 22:41:25 +02:00
James TuttonandGitHub 60925778c6 Fixed missing ;
Fixed missing ;
2018-07-30 14:19:56 +01:00
James TuttonandGitHub 15233bf100 Added Special Case to allow Servo to be disabled
Servo Motors by default forcefully hold the desired position.  This consumes power.  In some cases for example to turn a value or open a latch once the position is set  there may be no need to hold the new position.  With this update users can pass a special case value above >9000 which is out of normal range 0-180 or 365. when this value is passed the servo is detached and is free to move.
2018-07-30 14:10:22 +01:00
TD-er 2f91fbe931 [#1379] Check for "forbidden" characters in names. 2018-07-29 21:59:27 +02:00
TD-er 90febfd46f [#882] Add checks on names in task setup
When saving a task, a warning or error is displayed (when appropriate) when the settings are saved.
2018-07-29 21:59:18 +02:00
TD-er ccc5b68111 [Storage] Simplify settings I/O error handling
Remove a lot of code duplication
2018-07-29 21:59:13 +02:00
TD-er 07f6b86138 [Storage] Split storage related functions to new file
Only moved the storage related functions from `Misc.ino` to the new `ESPEasyStorage.ino`
2018-07-29 21:59:08 +02:00
TD-er 7b2667feaa [compiler fix] Forgot to declare String 2018-07-29 21:59:02 +02:00
TD-er 48bd7b334d [FileHandling] Write some log indicating file operation
Add some log line indicating what setting is read of written.
2018-07-29 21:58:57 +02:00
TD-er 9dd4242590 [meminfodetail] Add command meminfodetail
This command `meminfodetail` does output the detailed structure of the settings stored.
See for an example:
https://github.com/letscontrolit/ESPEasy/issues/1574#issuecomment-408641424
2018-07-29 21:58:51 +02:00
TD-er ac8c29e9c5 [ExtraTaskSettings] Keep ExtraTaskSettings actualized for plugin calls 2018-07-29 21:58:45 +02:00
TD-er 387b0f68a8 [ExtraTaskSettings] Added extra clear functions and checks
Mainly reading and writing files / settings now perform a lot more checks.
2018-07-29 21:58:38 +02:00
TD-er fa130bf649 [ExtraTaskSettings] Added some comments & clarifications 2018-07-29 21:58:31 +02:00
ESPEasy release bot e596403c0a automatically updated release notes for mega-20180723 2018-07-23 04:00:09 +02:00
Gijs NoorlanderandGitHub 1030bd0b0f Merge pull request #1603 from TD-er/bugfix/commands_with_space
[parseString] Some fixes and checks added + quotes in parameters possible
2018-07-23 01:09:52 +02:00
TD-er 985e463ddf [GetArgv] Add some C-array size checks
There was no check in size of the given C-array to write into.
2018-07-23 01:08:45 +02:00
TD-er 3787fa637a [Compiler warning] Initialize the matching_parenthesis to something
The variable is not used uninitialised, but still the compiler gives a warning which may trip Travis.
2018-07-22 23:47:18 +02:00
TD-er ac62eb40a0 [WebLogViewer] Removed reRunCount as quick fix for web log viewer 2018-07-22 23:41:32 +02:00
TD-er b9e883beba [GetArgv] Make sure only matching ", ' or [ is allowed
Added `'` as allowed "parenthesis" and make sure only the matching character is allowed as end of the string match.
2018-07-22 23:40:49 +02:00
TD-er 6281c002e0 [Travis CI] Signed/unsigned compare fix 2018-07-22 21:36:26 +02:00
TD-er 4e8a3cab2f [parseString] Add checks when command parameters used as int
Several usages of `parseString` were directly converted to int, without proper checking.
2018-07-22 17:23:29 +02:00
TD-er 423b90a661 [parseString] Use quotes to use special characters in command parameters
A command parameter may now allow for spaces or comma when the String is wrapped with either ' ' or " ".
2018-07-22 16:07:23 +02:00
TD-er 63fc99dd34 [parseString] Fix 1-of error in getParamStartPos
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 :(
2018-07-22 11:34:11 +02:00
ESPEasy release bot 71caf09c70 automatically updated release notes for mega-20180722 2018-07-22 04:00:08 +02:00
Gijs NoorlanderandGitHub ee3164a8f6 Merge pull request #1602 from TD-er/feature/LogLevelCheck
Feature/log level check
2018-07-22 02:58:21 +02:00
TD-er 3d5f612ac9 [Scheduler] Call yield() when idle
This makes the ESP do a lot more background tasks, which makes each yield() call shorter on average.
This makes the ESP feel more snappy.
2018-07-22 02:53:49 +02:00
TD-er 79f2eaf808 [Scheduler] Keep statistics on timeDiff computations
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?
2018-07-22 02:39:02 +02:00
TD-er 1806a1438a [LogLevel] Added extra checks and make sure loglevel cache is up to date 2018-07-22 02:34:36 +02:00
TD-er 5108967c35 [LogLevel] Add checks for LOG_LEVEL_DEBUG_DEV 2018-07-22 01:31:14 +02:00
TD-er d0f1014bef [LogLevel] Add checks for LOG_LEVEL_DEBUG_MORE
Do not create Strings when not needed.
Highest level of checks added: LOG_LEVEL_DEBUG_MORE
2018-07-22 00:52:58 +02:00
TD-er 2afc143051 [LogLevel] Check loglevel before sending to log
Using template to do the check to prevent creation of Strings when required log level is higher than anyone is reading.
2018-07-21 23:54:51 +02:00
TD-er b2bf70e4ce [LogLevel] Use function to set loglevel and keep track of max log level 2018-07-21 23:32:37 +02:00
TD-er 6a5f090198 [LogLevel] LoadFromFile log to LOG_LEVEL_DEBUG_DEV 2018-07-21 22:56:08 +02:00
Gijs NoorlanderandGitHub 92c0543743 Merge pull request #1601 from TD-er/bugfix/logviewer_JavaScript
[Log Viewer] Fix a 1-off error when parsing logs
2018-07-21 21:29:30 +02:00
TD-er 1859aaad7d [Log Viewer] Fix a 1-off error when parsing logs 2018-07-21 21:27:23 +02:00
Gijs NoorlanderandGitHub 7e67ce536d Merge pull request #1594 from TD-er/bugfix/longpulse
[#1591] Move system timers to main scheduler
2018-07-21 21:19:32 +02:00
TD-er 2bd573963a [#1596] Remove timerSensor and make it set its own interval.
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.
2018-07-21 01:28:14 +02:00
TD-er 447e958e74 [#1592] Remove systemCMDTimers
These timers were not used.
2018-07-20 21:52:49 +02:00
ESPEasy release bot 43908b37cd automatically updated release notes for mega-20180720 2018-07-20 04:00:16 +02:00
TD-er 04b631e4c9 [#1591] Move system timers to main 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.
2018-07-20 02:17:00 +02:00
Gijs NoorlanderandGitHub 2e8fc777d2 Merge pull request #1568 from TD-er/bugfix/1556_change_parse_params
[ParseString] Make ParseString more efficient and check results when used
2018-07-19 18:43:49 +02:00
ESPEasy release bot e060c83cf8 automatically updated release notes for mega-20180719 2018-07-19 04:00:14 +02:00
Gijs NoorlanderandGitHub 5480af2d5d Merge pull request #1587 from TD-er/feature/sunrise_sunset_offset
[sunrise/sunset] Allow offset from sunrise/sunset
2018-07-19 01:07:39 +02:00
TD-er ff28605d39 [sunrise/sunset] Allow offset from sunrise/sunset
`%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.
2018-07-19 01:06:06 +02:00
Gijs NoorlanderandGitHub fe0ca9b9a3 Merge pull request #1584 from denisfrench/enable_clientid_is_name_without_unit
When clientid = %sysname%, only add %unit% if non-zero (#1155)
2018-07-18 21:17:06 +02:00
Gijs NoorlanderandGitHub 54ef70aee9 Merge pull request #1586 from beigenmann/mega
lib_archive already exists & Implicit dependency not found
2018-07-18 21:16:03 +02:00
Gijs NoorlanderandGitHub e24d077061 Merge pull request #1583 from clumsy-stefan/P077_fix
Fix for P077 crashes
2018-07-18 21:15:44 +02:00
Benno Eigenmann 7ebf29d857 lib_archive already exists & Implicit dependency not found 2018-07-18 14:02:01 +02:00
denisfrench 33c6925376 When clientid = %sysname%, only add %unit% if non-zero 2018-07-17 19:35:17 +10:00
stefan 0b383a1f3b Fix for P077 crashes
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...
2018-07-16 13:39:51 +02:00
stefan 70d1b0807c Merge remote-tracking branch 'origin/mega' into mega 2018-07-16 07:22:31 +02:00
ESPEasy release bot 8e1f4d628b automatically updated release notes for mega-20180716 2018-07-16 04:00:09 +02:00
Gijs NoorlanderandGitHub ef29603f05 Merge pull request #1581 from TD-er/feature/ESP32_partitiontable
[ESP32] Show partition table on sysinfo page
2018-07-16 00:59:50 +02:00
Gijs NoorlanderandGitHub 71b27d95fa Merge pull request #1562 from TD-er/bugfix/wifi_reset_empty_IP
[WiFi] Reset wifi when IP is set to 0.0.0.0
2018-07-16 00:58:31 +02:00
Gijs NoorlanderandGitHub 787c1c6c39 Merge pull request #1579 from TD-er/bugfix/scheduler_rewrite
[Scheduler] Complete rewrite of time based scheduling
2018-07-16 00:58:02 +02:00
Gijs NoorlanderandGitHub 74e4848edc Merge pull request #1578 from TD-er/bugfix/JSON_device_info
[JSON] Fixed broken JSON output on /json URL
2018-07-16 00:57:41 +02:00
TD-er 9a7690473a [ESP32] Show partition table on sysinfo page
Graphical display of partition table.
2018-07-16 00:49:30 +02:00
TD-er c401edde6b [ParseString] Fix getting the right part of the command line
Fix several 1-off errors.
Should drink more coffee ;)
2018-07-15 21:34:29 +02:00
TD-er 3fc1ba27e5 [JSON] Fixed broken JSON output on /json URL
This bug also broke the auto update of the sensor values on the device tab.
2018-07-15 20:23:11 +02:00
TD-er b2212d2edb [Scheduler] Complete rewrite of time based scheduling
All scheduled operations are now handled by a time scheduler.
Also the CPU load is now based entirely on the idle time found by this scheduler.
2018-07-15 20:21:37 +02:00
stefan 76f7dc82fc Merge branch 'bugfix/wifi_reset_empty_IP' into mega 2018-07-15 11:07:47 +02:00
TD-er 00683a38c5 [ParseString] Make ParseString more efficient and check results before use
`ParseString` and `getParamStartPos` made (lots of) copies of the strings.
Also the result of `getParamStartPos` was not checked, which can result in crashes.
2018-07-13 08:09:42 +02:00
TD-er ad06cbc835 [WiFi] Reset wifi when IP is set to 0.0.0.0
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.
2018-07-12 00:20:55 +02:00
380 changed files with 61494 additions and 10886 deletions
+24
View File
@@ -1,9 +1,33 @@
### Checklist
- [ ] The title of this issue is "to the point" and descriptive.
- [ ] This issue describes what is happening.
- [ ] This issue describes what components are affected (e.g. name of plugin/controller)
- [ ] This issue describes how to reproduce it.
- [ ] This issue describes when it was introduced (when known) and what version is now showing the problem.
### I have...
- [ ] searched the [issue tracker](https://github.com/letscontrolit/ESPEasy/issues) or the [forum](https://www.letscontrolit.com/forum/viewforum.php?f=1) for a similar issue. (include links when applicable)
- [ ] entered a system description using "Copy info to clipboard" on the sysinfo page. (when possible)
- [ ] entered the full filename of the used version (e.g. `ESP_Easy_mega-20181001_test_ESP8266_4096_VCC.bin` )
- [ ] given a list of active plugins or controllers when applicable.
- [ ] filled out all applicable fields below.
### Steps already tried...
- [ ] Tried a clean install (empty `.bin` files are included in the ZIP)
- [ ] Tested previous/other build (mention which one already tested)
- [ ] Tested on other node to make sure hardware isn't defective.
- [ ] Verified if the problem is limited to a single plugin/controller
### If you self compile, please state this and PLEASE try to ONLY REPORT ISSUES WITH OFFICIAL BUILDS! ###
<!--- If you self compile, please state this and PLEASE try to ONLY REPORT ISSUES WITH OFFICIAL BUILDS! --->
<!--- NOTE: This is not a support forum! For questions and support go here: --->
<!--- https://www.letscontrolit.com/forum/viewforum.php?f=1 --->
<!--- Remove topics that are not applicable to your feature request of issue --->
<!--- Remember to have a "to the point" TITLE --->
### Summarize of the problem/feature request
<!--- Describe the problem or feature request --->
YOUR TEXT GOES HERE
+6
View File
@@ -18,3 +18,9 @@ lib/readme.txt
src/Custom.h
/ESPEasy
test/output_export.cpp
.vscode
.vscode/.browse.c_cpp.db*
.vscode/c_cpp_properties.json
.vscode/launch.json
docs/build/
+6 -7
View File
@@ -22,20 +22,19 @@ addons:
install:
- pip install -U platformio
- pip install -U platformio sphinx recommonmark sphinx_bootstrap_theme
script:
- platformio update
# patch platformio core libs for PUYA bug (https://github.com/letscontrolit/ESPEasy/issues/650)
- cd patches; ./check_puya_patch; cd ..
# - bash ./preflight.sh # make sure input files are OK before wasting time with prereqs
# - cppcheck --enable=warning src/*.ino -q --force -I src --include=src/ESPEasy.ino --error-exitcode=1
# - ./memanalyzer.py ~/.platformio/packages/toolchain-xtensa/bin/xtensa-lx106-elf-objdump
- PLATFORMIO_BUILD_FLAGS="-D CONTINUOUS_INTEGRATION" platformio run
- PLATFORMIO_BUILD_FLAGS="-D CONTINUOUS_INTEGRATION" platformio run
# patch platformio core libs for PUYA bug (https://github.com/letscontrolit/ESPEasy/issues/650)
- cd patches; ./check_puya_patch; cd ..
- PLATFORMIO_BUILD_FLAGS="-D CONTINUOUS_INTEGRATION" platformio run -s --environment dev_ESP8266PUYA_1024
- PLATFORMIO_BUILD_FLAGS="-D CONTINUOUS_INTEGRATION" platformio run -s --environment dev_ESP8266PUYA_1024
before_deploy:
- ./before_deploy
- export RELEASE_FILE=$(ls ESPEasy*.zip)
+7 -5
View File
@@ -1,9 +1,11 @@
|Latest Nightly | Build Status | Patreon | Ko-Fi | PayPal |
|-------|-------|-------|-------|-------|
| [![GitHub version](https://img.shields.io/github/release/letscontrolit/ESPEasy/all.svg)](https://github.com/letscontrolit/ESPEasy/releases/latest) | [![Build Status](https://travis-ci.org/letscontrolit/ESPEasy.svg?branch=mega)](https://travis-ci.org/letscontrolit/ESPEasy) | [![donate](https://img.shields.io/badge/donate-Patreon-blue.svg)](https://www.patreon.com/GrovkillenTDer) | [![donate](https://img.shields.io/badge/donate-KoFi-blue.svg)](https://ko-fi.com/grovkillentder) | [![donate](https://img.shields.io/badge/donate-PayPal-blue.svg)](https://www.paypal.me/espeasy) |
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.
# ESPEasy (development branch)
Badge | Info |
-------|-------|
[![Build Status](https://travis-ci.org/letscontrolit/ESPEasy.svg?branch=mega)](https://travis-ci.org/letscontrolit/ESPEasy) | build status |
[![GitHub version](https://img.shields.io/github/release/letscontrolit/ESPEasy/all.svg)](https://github.com/letscontrolit/ESPEasy/releases/latest) | latest nightly |
Introduction and wiki: https://www.letscontrolit.com/wiki/index.php/ESPEasy#Introduction
@@ -39,4 +41,4 @@ ESPEasy_mega-20180102_dev_ESP8285_1024.bin | ESP8285 with 1Mb flash | Stabl
Details and discussion are on the Experimental forum: https://www.letscontrolit.com/forum/viewforum.php?f=18
We're also on IRC: #ESPEasy @freenode
Automated builds of the (new) documentation can be found at [ESPEasy.readthedocs.io](https://espeasy.readthedocs.io/en/latest/)
+18 -9
View File
@@ -10,6 +10,9 @@ for ENV in \
normal_ESP8266_1024 \
normal_ESP8266_4096 \
normal_ESP8285_1024 \
normal_IR_ESP8266_4096 \
normal_core_241_ESP8266_1024 \
normal_core_241_ESP8266_4096 \
test_ESP8266_1024\
test_ESP8266_4096\
test_ESP8266_4096_VCC\
@@ -17,26 +20,32 @@ for ENV in \
dev_ESP8266_1024\
dev_ESP8266_4096\
dev_ESP8285_1024\
dev_ESP8266PUYA_1024\
dev_ESP8266PUYA_1024_VCC\
hard_SONOFF_POW\
esp32dev;\
hard_SONOFF_POW_R2_4M\
minimal_ESP8266_1024_OTA\
minimal_ESP8285_1024_OTA\
esp32dev\
esp32test_1M8_partition;\
do
echo
echo "### Deploying environment $ENV for version $VERSION"
BIN=.pioenvs/${ENV}/ESP_Easy_${VERSION}_${ENV}.bin
cp .pioenvs/${ENV}/firmware.bin $BIN
python2 crc2.py $BIN
mv $BIN "dist/ESP_Easy_${VERSION}_${ENV}.bin"
mv $BIN "dist/bin/ESP_Easy_${VERSION}_${ENV}.bin"
done
#create a source structure that is the same as the original ESPEasy project (and works with the howto on the wiki)
rm -rf dist/Source 2>/dev/null
mkdir dist/Source
cp -r lib dist/Source/
cp -r src dist/Source/
cp platformio.ini dist/Source/
#rm -rf dist/Source 2>/dev/null
rm -rf dist/Docs 2>/dev/null
mkdir -p dist/source
#mkdir -p dist/docs
cp -r lib dist/source/
cp -r src dist/source/
#cp -r docs/build/ dist/docs/
cp platformio.ini dist/source/
cd dist
BIN
View File
Binary file not shown.
+66
View File
@@ -0,0 +1,66 @@
_____ ____ ____
| ____/ ___|| _ \ ___ __ _ ___ _ _
| _| \___ \| |_) / _ \/ _` / __| | | |
| |___ ___) | __/ __/ (_| \__ \ |_| |
|_____|____/|_| \___|\__,_|___/\__, |
|___/
This is the distribution folder for ESPeasy.
In here you will find a flash tool to program the ESP module.
Also a number of binary images is included.
The filename is quite descriptive:
ESP_Easy_mega-<date>_<buildType>_<chip>_<memorySize>.bin
Build type can be: (differ in included plugins)
- normal => Only Stable plugins and controllers
- test => Stable + Testing
- dev => Stable + Testing + Development
There is also a number of special builds:
- normal_IR => "Normal" + IR receiver/transmitter plugins and library
- hard_xxxxx => Special builds for some off-the-shelf hardware.
- normal_core_241 => "Normal" using core 2.4.1, since 2.4.2 has issues with PWM
- minimal_ESP82xx_1024_OTA => Minimum number of plugins and a limited set of controllers included to be able to perform a 2-step OTA on 1 MB flash nodes.
Chip can be:
- ESP8266 => Most likely option
- ESP8285 => Used in some Sonoff modules
- ESP32 => Experimental support at this moment
MemorySize can be:
- 1024 => 1 MB flash modules (e.g. almost all Sonoff modules)
- 2048 => 2 MB flash modules (e.g. Shelly1/WROOM02)
- 4096 => 4 MB flash modules (e.g. NodeMCU/ESP32)
ESP32 now has 2 builds:
- esp32dev Using the default partition layout (1.4 MB for the sketch)
- esp32test_1M8_partition Larger sketch partition (1.8MB) smaller SPIFFS (316 kB)
Please note that changing between those versions will destroy the settings!
The SPIFFS partition will be lost and that contains all settings.
To help recover from a bad flash, there are also blank images included.
- blank_1MB.bin
- blank_2MB.bin
- blank_4MB.bin
When the wrong image is flashed, or the module behaves unstable, or is in a reboot loop,
flash these images first and then the right image for the module.
ESP.Easy.Flasher.exe...
... is the new flashing tool for ESP Easy. You need to run it in elevated mode (as admin)
for it to fetch the COM ports correctly. If you want you may save YOUR settings using the
"Save as default settings" button in the lower left corner. If the window is too big or
too small you can experiment with the "Pixels Per Inch" variable in the
..\Settings\Default.ini file. Setting it to =96 is working for most users but the
application will try to find the most optimal value by default. Sometimes it fails to
do that. More information about the tool is found here:
https://github.com/Grovkillen/ESP_Easy_Flasher
Further reading:
For more information, see: https://github.com/letscontrolit/ESPEasy
Or our forum: https://www.letscontrolit.com/forum/
+1109
View File
File diff suppressed because it is too large Load Diff
Binary file not shown.
+1
View File
File diff suppressed because one or more lines are too long
+1
View File
File diff suppressed because one or more lines are too long
+1
View File
File diff suppressed because one or more lines are too long
+19
View File
@@ -0,0 +1,19 @@
# Minimal makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
SOURCEDIR = source
BUILDDIR = build
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.PHONY: help Makefile
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
+35
View File
@@ -0,0 +1,35 @@
@ECHO OFF
pushd %~dp0
REM Command file for Sphinx documentation
if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=build
if "%1" == "" goto help
%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.http://sphinx-doc.org/
exit /b 1
)
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
goto end
:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
:end
popd
+3
View File
@@ -0,0 +1,3 @@
recommonmark
Sphinx
sphinx-bootstrap-theme
+66
View File
@@ -0,0 +1,66 @@
Controller
**********
A controller is a component to enable a plugin to send data elsewhere.
- Up-to 3 controllers can be active in ESPEasy.
- Per plugin up-to 3 active controllers can be selected.
- For some controllers an additional parameter can be given.
For example, Domoticz needs an 'IDX' value to identify the configured entry in
Domoticz for which new data is sent.
Controller Parameters
=====================
Generic fields
--------------
- **Protocol** - The type of controller (e.g. ThingSpeak/OpenHAB MQTT/etc.)
- **Locate Controller** - Selection between hostname/IP
- **Controller Hostname/IP** - The address to reach the selected service
- **Controller Port** - TCP/UDP Port number (0...65536)
- **Enabled** - Whether or not the controller is active.
Send queue parameters
---------------------
Controllers have a queue to keep unsent messages.
This queue is used to handle message bursts and also store messages which are recorded
before WiFi connection is made or during lost connection.
- **Minimum Send Interval** - Minimum time between two messages in msec.
- **Max Queue Depth** - Maximum length of the buffer queue to keep unsent messages.
- **Max Retries** - Maximum number of retries to send a message.
- **Full Queue Action** - How to handle when queue is full, ignore new or delete oldest message.
- **Client Timeout** - Timeout in msec for an network connection used by the controller.
- **Check Reply** - When set to false, a sent message is considered always successful.
Sample ThingSpeak configuration
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Some controllers, like ThingSpeak, need a specific configuration.
ThingSpeak only allows a message every 15 seconds for the free accounts.
- **Minimum Send Interval** - 15000 msec
- **Max Queue Depth** - 1 (only report the last value)
- **Max Retries** - 2
- **Full Queue Action** - Delete Oldest
- **Client Timeout** - 500 msec (server is online, so timeout must be a bit longer)
Controller user credentials
---------------------------
- **Controller User** - User name (optional)
- **Controller Password** - Password (optional)
MQTT related settings
---------------------
- **Controller Subscribe** - Subscribe to the given topic.
- **Controller Publish** - Publish to the given topic.
- **Controller lwl topic** - Topic to which LWT (Last Will Testament) messages should be sent.
- **LWT Connect Message** - Connection established message.
- **LWT Disconnect Message** - Connection lost message (sent to broker during connect and published by broker when connection is lost)
+2
View File
@@ -0,0 +1,2 @@
About Us
********
+2
View File
@@ -0,0 +1,2 @@
ESPEasy Function Blocks
***********************
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

+35
View File
@@ -0,0 +1,35 @@
Documentation
*************
For documentation we use Sphinx and this will be read by ReadTheDocs.
We use the `Sphinx Bootstrap Theme <https://github.com/ryan-roemer/sphinx-bootstrap-theme>`_
This documentation is included in the GitHub repository.
It allows us to create documentation per version of ESPEasy.
See also the `ESPEasy wiki <https://www.letscontrolit.com/wiki/index.php/ESPEasy>`_
for more documentation which has not been moved here.
Needed Python packages::
pip install sphinx recommonmark sphinx_bootstrap_theme
PlatformIO with Atom
====================
With the ESPEasy project open in Atom, open the PIO terminal in Atom.
Install dependencies::
cd docs
pip install ... (see needed Python packages above)
Build on Windows::
cd docs
.\make.bat html
Build on Linux/Mac::
cd docs
./make html
+2
View File
@@ -0,0 +1,2 @@
Plugins
*******
+2
View File
@@ -0,0 +1,2 @@
Command Reference
*****************
+2
View File
@@ -0,0 +1,2 @@
System Variables
****************
+2
View File
@@ -0,0 +1,2 @@
Rules
*****
+25
View File
@@ -0,0 +1,25 @@
WiFi
****
WiFi disconnect reasons
=======================
Beacon timeout (200)
--------------------
For more information on the Beacon frame, see `Wikipedia <https://en.wikipedia.org/wiki/Beacon_frame>`_.
In short, the access point sends periodically a packet containing information about the network.
This interval is typically 100 TU (102.4 msec).
The ESP module is trying to listen to this beacon every time, but for a number of reasons it may
miss a beacon frame.
The timeout is longer than 100 TU, so it must miss a number of these beacon frames
to report a beacon timeout.
Reasons to miss such a beacon frame are:
- too busy processing other blocking tasks (very likely)
- access point not sending a beacon due to high traffic demands of others (depending on brand/model/settings)
- RF disturbances (not likely given how often this occurs)
- clock drift (not really likely)
So the "beacon timeout" is happening every now and then on the ESP nodes and ESPeasy will try to reconnect.
+286
View File
@@ -0,0 +1,286 @@
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup --------------------------------------------------------------
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))
from recommonmark.parser import CommonMarkParser
import sphinx_bootstrap_theme
# -- Project information -----------------------------------------------------
project = u'ESPEasy'
copyright = u'2018, ESPEasy'
author = u'Many'
# The short X.Y version
version = u''
# The full version, including alpha/beta/rc tags
release = u'2.1b1'
# -- General configuration ---------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#
# needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
'sphinx.ext.todo',
'sphinx.ext.imgmath',
'sphinx.ext.imgconverter',
]
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
source_parsers = {
'.md': CommonMarkParser,
}
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
source_suffix = ['.rst', '.md']
#source_suffix = '.rst'
# The master toctree document.
master_doc = 'index'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = []
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = None
# -- Options for HTML output -------------------------------------------------
html_logo = 'ESPEasy/espeasy_logo.png'
html_favicon = 'ESPEasy/favicon.ico'
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
#html_theme = 'sphinx_rtd_theme'
html_theme = 'bootstrap'
html_theme_path = sphinx_bootstrap_theme.get_html_theme_path()
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#
# html_theme_options = {}
#html_theme_options = {
# 'canonical_url': '',
# 'analytics_id': '',
# 'logo_only': False,
# 'display_version': True,
# 'prev_next_buttons_location': 'bottom',
# 'style_external_links': False,
# # Toc options
# 'collapse_navigation': True,
# 'sticky_navigation': True,
# 'navigation_depth': 4,
# 'includehidden': True,
# 'titles_only': False
#}
html_theme_options = {
# Navigation bar title. (Default: ``project`` value)
'navbar_title': "ESPEasy",
# Tab name for entire site. (Default: "Site")
'navbar_site_name': "Site",
# A list of tuples containing pages or urls to link to.
# Valid tuples should be in the following forms:
# (name, page) # a link to a page
# (name, "/aa/bb", 1) # a link to an arbitrary relative url
# (name, "http://example.com", True) # arbitrary absolute url
# Note the "1" or "True" value above as the third argument to indicate
# an arbitrary url.
'navbar_links': [
("Rules", "rules"),
("Forum", "https://www.letscontrolit.com/forum/viewforum.php?f=1", True),
],
# Render the next and previous page links in navbar. (Default: true)
'navbar_sidebarrel': True,
# Render the current pages TOC in the navbar. (Default: true)
'navbar_pagenav': True,
# Tab name for the current pages TOC. (Default: "Page")
'navbar_pagenav_name': "Page",
# Global TOC depth for "site" navbar tab. (Default: 1)
# Switching to -1 shows all levels.
'globaltoc_depth': 2,
# Include hidden TOCs in Site navbar?
#
# Note: If this is "false", you cannot have mixed ``:hidden:`` and
# non-hidden ``toctree`` directives in the same page, or else the build
# will break.
#
# Values: "true" (default) or "false"
'globaltoc_includehidden': "true",
# HTML navbar class (Default: "navbar") to attach to <div> element.
# For black navbar, do "navbar navbar-inverse"
'navbar_class': "navbar navbar-inverse",
# Fix navigation bar to top of page?
# Values: "true" (default) or "false"
'navbar_fixed_top': "true",
# Location of link to source.
# Options are "nav" (default), "footer" or anything else to exclude.
'source_link_position': "none",
# Bootswatch (http://bootswatch.com/) theme.
#
# Options are nothing (default) or the name of a valid theme
# such as "cosmo" or "sandstone".
#
# The set of valid themes depend on the version of Bootstrap
# that's used (the next config option).
#
# Currently, the supported themes are:
# - Bootstrap 2: https://bootswatch.com/2
# - Bootstrap 3: https://bootswatch.com/3
'bootswatch_theme': "cerulean",
# Choose Bootstrap version.
# Values: "3" (default) or "2" (in quotes)
'bootstrap_version': "3",
}
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
#
# The default sidebars (for documents that don't match any pattern) are
# defined by theme itself. Builtin themes are using these templates by
# default: ``['localtoc.html', 'relations.html', 'sourcelink.html',
# 'searchbox.html']``.
#
# html_sidebars = {}
# -- Options for HTMLHelp output ---------------------------------------------
# Output file base name for HTML help builder.
htmlhelp_basename = 'ESPEasydoc'
# -- Options for LaTeX output ------------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',
# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'ESPEasy.tex', u'ESPEasy Documentation',
u'Many', 'manual'),
]
# -- Options for manual page output ------------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'espeasy', u'ESPEasy Documentation',
[author], 1)
]
# -- Options for Texinfo output ----------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'ESPEasy', u'ESPEasy Documentation',
author, 'ESPEasy', 'ESP82xx/ESP32 firmware to connect people with any level of experience to system automation.',
'Miscellaneous'),
]
# -- Options for Epub output -------------------------------------------------
# Bibliographic Dublin Core info.
epub_title = project
# The unique identifier of the text. This can be a ISBN number
# or the project homepage.
#
# epub_identifier = ''
# A unique identification for the text.
#
# epub_uid = ''
# A list of files that should not be packed into the epub file.
epub_exclude_files = ['search.html']
# -- Extension configuration -------------------------------------------------
# -- Options for intersphinx extension ---------------------------------------
# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {'https://docs.python.org/': None}
# -- Options for todo extension ----------------------------------------------
# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = True
+39
View File
@@ -0,0 +1,39 @@
.. ESPEasy documentation master file, created by
sphinx-quickstart on Sat Oct 06 22:34:34 2018.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to ESPEasy's documentation!
===================================
.. toctree::
:maxdepth: 2
:caption: Table of Contents
ESPEasy/AboutUs.rst
ESPEasy/FunctionBlocks.rst
Controller/Controller.rst
Plugin/Plugin.rst
Rules/Rules.rst
WiFi/WiFi.rst
.. raw:: latex
\appendix
.. toctree::
:caption: Appendix
Participate/Documentation.rst
Reference/Command.rst
Reference/SystemVariable.rst
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
+82
View File
@@ -0,0 +1,82 @@
#!/bin/bash
#
# This script walks through the assets folder and minifys all JS, HTML, CSS and SVG files. It also generates
# the corresponding constants that are added to the data.h file on esp8266_deauther folder.
#
# @Author Erick B. Tedeschi < erickbt86 [at] gmail [dot] com >
# @Author Wandmalfarbe https://github.com/Wandmalfarbe
#
# See: https://github.com/letscontrolit/ESPEasy/issues/1671#issuecomment-415144898
outputfile="$(pwd)/data_h_temp"
rm $outputfile
function minify_html_css {
file=$1
curl -X POST -s --data-urlencode "input@$file" http://html-minifier.com/raw > /tmp/converter.temp
}
function minify_js {
file=$1
curl -X POST -s --data-urlencode "input@$file" https://javascript-minifier.com/raw > /tmp/converter.temp
}
function minify_svg {
file=$1
svgo -i /Users/User/Desktop/icons/tools.svg -o - > /tmp/converter.temp
}
function ascii2hexCstyle {
file_name=$(constFileName $1)
result=$(cat /tmp/converter.temp | hexdump -ve '1/1 "0x%.2x,"')
result=$(echo $result | sed 's/,$//')
echo "const char DATA_${file_name}[] PROGMEM = {$result};"
}
function constFileName {
extension=$(echo $1 | egrep -io "(json|svg|css|js|html)$" | tr "[:lower:]" "[:upper:]")
file=$(echo $1 | sed 's/\.json//' | sed 's/\.svg//' | sed 's/\.css//' | sed 's/\.html//' | sed 's/\.js//' | sed 's/\.\///' | tr '/' '_' | tr '.' '_' | tr '-' '_' | tr "[:lower:]" "[:upper:]")
underscore="_"
echo $file$underscore$extension
}
cd static
file_list=$(find . -type f)
for file in $file_list; do
echo "Processing: $file"
file_name=$(constFileName $file)
echo " Array Name: $file_name"
if [[ "$file" == *.min.js ]]; then
echo " JS already minified"
cat $file > /tmp/converter.temp
ascii2hexCstyle $file >> $outputfile
elif [[ "$file" == *.js ]]; then
echo " JS minify"
minify_js $file
ascii2hexCstyle $file >> $outputfile
elif [[ "$file" == *.min.css ]]; then
echo " CSS already minified"
cat $file > /tmp/converter.temp
ascii2hexCstyle $file >> $outputfile
elif [[ "$file" == *.html ]] || [[ "$file" == *.css ]]; then
echo " HTML and CSS minify"
minify_html_css $file
ascii2hexCstyle $file >> $outputfile
elif [[ "$file" == *.svg ]]; then
echo " SVG minify"
minify_svg $file
ascii2hexCstyle $file >> $outputfile
else
echo " without minifier"
cat $file > /tmp/converter.temp
ascii2hexCstyle $file >> $outputfile
fi
echo ""
sleep 1
done
+7
View File
@@ -0,0 +1,7 @@
# Name, Type, SubType, Offset, Size, Flags
nvs, data, nvs, 0x9000, 0x5000,
otadata, data, ota, 0xe000, 0x2000,
app0, app, ota_0, 0x10000, 0x140000,
app1, app, ota_1, 0x150000,0x140000,
eeprom, data, 0x99, 0x290000,0x1000,
spiffs, data, spiffs, 0x291000,0x16F000,
1 # Name Type SubType Offset Size Flags
2 nvs data nvs 0x9000 0x5000
3 otadata data ota 0xe000 0x2000
4 app0 app ota_0 0x10000 0x140000
5 app1 app ota_1 0x150000 0x140000
6 eeprom data 0x99 0x290000 0x1000
7 spiffs data spiffs 0x291000 0x16F000
+7
View File
@@ -0,0 +1,7 @@
# Name, Type, SubType, Offset, Size, Flags
nvs, data, nvs, 0x9000, 0x5000,
otadata, data, ota, 0xe000, 0x2000,
app0, app, ota_0, 0x10000, 0x1D0000,
app1, app, ota_1, 0x1E0000,0x1D0000,
eeprom, data, 0x99, 0x3B0000,0x1000,
spiffs, data, spiffs, 0x3B1000,0x4F000,
1 # Name Type SubType Offset Size Flags
2 nvs data nvs 0x9000 0x5000
3 otadata data ota 0xe000 0x2000
4 app0 app ota_0 0x10000 0x1D0000
5 app1 app ota_1 0x1E0000 0x1D0000
6 eeprom data 0x99 0x3B0000 0x1000
7 spiffs data spiffs 0x3B1000 0x4F000
@@ -163,7 +163,7 @@ void loop(void) {
Serial.print(rgb_sensor.atime_ms);
Serial.print(F("ms (0x"));
Serial.print(rgb_sensor.atime, HEX);
Serial.println(F(")"));
Serial.println(")");
Serial.print(F("Raw R:"));
Serial.print(rgb_sensor.r);
@@ -182,7 +182,7 @@ void loop(void) {
Serial.print(rgb_sensor.saturation);
Serial.print(F(" Sat75:"));
Serial.print(rgb_sensor.saturation75);
Serial.print(F(" "));
Serial.print(" ");
Serial.println(rgb_sensor.isSaturated ? "*SATURATED*" : "");
Serial.print(F("CPL:"));
@@ -33,7 +33,7 @@ void displaySensorDetails(void)
Serial.print (F("Min Value: ")); Serial.print(sensor.min_value); Serial.println(F(" lux"));
Serial.print (F("Resolution: ")); Serial.print(sensor.resolution); Serial.println(F(" lux"));
Serial.println(F("------------------------------------"));
Serial.println(F(""));
Serial.println("");
delay(500);
}
@@ -81,7 +81,7 @@ void configureSensor(void)
Serial.print((tsl.getTiming() + 1) * 100, DEC);
Serial.println(F(" ms"));
Serial.println(F("------------------------------------"));
Serial.println(F(""));
Serial.println("");
}
+1 -1
View File
@@ -4207,7 +4207,7 @@ namespace Tbc {
}
else {
spliceLine( indent, remainder, width-1 );
lines.back() += "-";
lines.back() += '-';
}
if( lines.size() == 1 )
indent = _attr.indent;
@@ -70,6 +70,7 @@ ESPeasySoftwareSerial::ESPeasySoftwareSerial(uint8_t receivePin, uint8_t transmi
m_rxValid = m_txValid = m_txEnableValid = false;
m_buffer = NULL;
m_invert = inverse_logic;
m_rxEnabled = false;
if (isValidGPIOpin(receivePin)) {
m_rxPin = receivePin;
m_buffSize = buffSize;
@@ -140,6 +141,8 @@ uint8_t ESPeasySoftwareSerial::pinToIndex(uint8_t pin) {
void ESPeasySoftwareSerial::begin(long speed) {
// Use getCycleCount() loop to get as exact timing as possible
m_bitTime = ESP.getCpuFreqMHz()*1000000/speed;
if (!m_rxEnabled)
enableRx(true);
}
void ESPeasySoftwareSerial::setTransmitEnablePin(uint8_t transmitEnablePin) {
@@ -160,6 +163,7 @@ void ESPeasySoftwareSerial::enableRx(bool on) {
} else {
detachInterrupt(m_rxPin);
}
m_rxEnabled = on;
}
}
@@ -54,6 +54,12 @@ public:
void rxRead();
// AVR compatibility methods
bool listen() { enableRx(true); return true; }
void end() { stopListening(); }
bool isListening() { return m_rxEnabled; }
bool stopListening() { enableRx(false); return true; }
using Print::write;
private:
@@ -62,7 +68,8 @@ private:
// Member variables
uint8_t m_rxPin, m_txPin, m_txEnablePin;
bool m_rxValid, m_txValid, m_txEnableValid;
bool m_rxValid, m_rxEnabled;
bool m_txValid, m_txEnableValid;
bool m_invert;
unsigned long m_bitTime;
uint16_t m_inPos, m_outPos;
+82
View File
@@ -0,0 +1,82 @@
# Contributing to the IRremoteESP8266 library
:+1::tada: First off, thanks for taking the time to contribute! :tada::+1:
The following is a set of guidelines for contributing to the IRremoteESP8266 library, hosted on GitHub. These are guidelines, [not rules](http://imgur.com/mSHi8). Use your best judgment, and feel free to propose changes to this document in a pull request.
#### Table Of Contents
[Code of Conduct](#code-of-conduct)
[How Can I Contribute?](#how-can-i-contribute)
* [Reporting Bugs](#reporting-bugs)
* [Pull Requests](#pull-requests)
[Styleguides](#styleguides)
* [Google C++ Style Guide](https://google.github.io/styleguide/cppguide.html)
* [Git Commit Messages](#git-commit-messages)
## Code of Conduct
This project and everyone participating in it is governed by the principle of ["Be excellent to each other"](http://www.imdb.com/title/tt0096928/quotes). That's it. TL;DR: _Don't be a jerk._
## How Can I Contribute?
### Reporting Bugs
This section guides you through submitting a bug report for the library. Following these guidelines helps maintainers and the community understand your report :pencil:, reproduce the behavior :computer: :computer:, and find related reports :mag_right:.
Before creating bug reports, please check [this list](#before-submitting-a-bug-report) as you might find out that you don't need to create one. When you are creating a bug report, please [include as much detail as possible](#how-do-i-submit-a-good-bug-report). Fill out [the required template](issue_template.md), the information it asks for helps us resolve issues faster.
> **Note:** If you find a **Closed** issue that seems like it's the same thing that you're experiencing, open a new issue and include a link to the original issue in the body of your new one.
#### Before Submitting A Bug Report
* **Check the [Troubleshooting Guide](https://github.com/markszabo/IRremoteESP8266/wiki/Troubleshooting-Guide).** You might be able to find the cause of the problem and fix it yourself. Most importantly, check if you can reproduce the problem in the latest version (a.k.a. 'master') of the library.
* **Perform a [cursory search](https://github.com/issues?q=+is%3Aissue+repo%3Amarkszabo/IRremoteESP8266)** to see if the problem is already reported. If it has **and the issue is still open**, add a comment to the existing issue instead of opening a new one.
#### How Do I Submit A (Good) Bug Report?
Bugs are tracked as [GitHub issues](https://guides.github.com/features/issues/). Create an issue and provide the following information by filling in [the template](issue_template.md).
Explain the problem and include any additional details to help maintainers reproduce the problem:
* **Use a clear and descriptive title** for the issue to identify the problem.
* **Describe the exact steps which reproduce the problem** in as much detail as possible.
* **Provide specific examples to demonstrate the steps**. Include links to files or GitHub projects, or copy/pasteable snippets, which you use in those examples. If you're providing snippets in the issue, use [Markdown code blocks](https://help.github.com/articles/markdown-basics/#multiple-lines).
* **Describe the behavior you observed after following the steps** and point out what exactly is the problem with that behavior.
* **Explain which behavior you expected to see instead and why.**
* **If the problem wasn't triggered by a specific action**, describe what you were doing before the problem happened and share more information using the guidelines below.
Provide more context by answering these questions:
* **Can you reproduce the problem in one of the code examples?**
* **Did the problem start happening recently** (e.g. after updating to a new version of Arduino or the library) or was this always a problem?
* If the problem started happening recently, **can you reproduce the problem in an older version of the library?** What's the most recent version in which the problem doesn't happen? You can download older versions of the library from [the releases page](https://github.com/markszabo/IRremoteESP8266/releases).
* **Can you reliably reproduce the issue?** If not, provide details about how often the problem happens and under which conditions it normally happens.
Include details about your configuration, circuit and environment:
* **Which version of the library are you using?** You can get the exact version by inspecting the `library.json` file in the root directory of the library.
* **What board are you running this on?**
### Pull Requests
* Do not include issue numbers in the PR title
* Include as much data and comments as practicle.
* Follow the [C++ style guide](https://google.github.io/styleguide/cppguide.html).
* Please write or ensure Unit Tests cover the change you are making, if you can.
* End all files with a newline
* Avoid platform-dependent code.
* Use c98 types where possible for better portablity.
* In almost all cases, code & documentation should be peer-reviewed by at least one other contributor.
* The code should pass all the existing testing infrastructure in Travis. e.g. Unit tests, cpplint, and basic compilation.
* State if you have tested this under real conditions if you have, and what other tests you may have carried out.
### Git Commit Messages
* Limit the first line to 72 characters or less
* Reference issues and pull requests liberally after the first line
* Humour is always acceptable. Be liberal with it. ;-)
* While not required, a comprehensive description of all the changes in the PR is best.
@@ -7,6 +7,11 @@
- [Marcos de Alcântara Marinho](https://github.com/marcosamarinho/)
- [Massimiliano Pinto](https://github.com/pintomax/)
- [Darsh Patel](https://github.com/darshkpatel/)
- [Jonny Graham](https://github.com/jonnygraham/)
- [Stu Fisher](https://github.com/stufisher/)
- [Jorge Cisneros](https://github.com/jorgecis/)
- [Denes Varga](https://github.com/denxhun/)
- [Brett T. Warden](https://github.com/bwarden/)
All contributors can be found on the [contributors site](https://github.com/markszabo/IRremoteESP8266/graphs/contributors).
+42
View File
@@ -0,0 +1,42 @@
_(Please use this template for reporting issues. You can delete what ever is not relevant. Giving us this information will help us help you faster. Please also read the [FAQ](https://github.com/markszabo/IRremoteESP8266/wiki/Frequently-Asked-Questions) & [Troubleshooting Guide](https://github.com/markszabo/IRremoteESP8266/wiki/Troubleshooting-Guide). Your problem may already have an answer there.)_
### Version/revison of the library used
_Typically located in the `library.json` & `src/IRremoteESP8266.h` files in the root directory of the library.
e.g. v2.0.0, or 'master' as at 1st of June, 2017. etc._
### Expected behavior
_What steps did you do and what should it have done?_
e.g.
1. Initialise the IRsend class.
2. IRsend.sendFoobar(0xdeadbeef);
3. Foobar branded BBQ turns on and cooks me some ribs.
### Actual behavior
_What steps did you do, and what did or didn't actually happen?_
e.g.
1. Initialise the IRsend class.
2. IRsend.sendFoobar(0xdeadbeef);
3. Foobar BBQ went into Cow(er)-saving mode and fried me a couple of eggs instead.
#### Output of raw data from IRrecvDumpV2.ino (if applicable)
_Include some raw dumps of what the device saw._
### Steps to reproduce the behavior
_What can we do to (pref. reliably) repeat what is happening?_
#### Example code used
_Include all relevant code snippets or links to the actual code files. Tip: [How to quote your code so it is still readable](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet#code)._
#### Circuit diagram and hardware used (if applicable)
_Link to an image of the circuit diagram used. Part number of the IR receiver module etc._
### I have followed the steps in the [Troubleshooting Guide](https://github.com/markszabo/IRremoteESP8266/wiki/Troubleshooting-Guide) & read the [FAQ](https://github.com/markszabo/IRremoteESP8266/wiki/Frequently-Asked-Questions)
_Yes/No._
### Has this library/code previously worked as expected for you?
_Yes/No. If "Yes", which version last worked for you?_
### Other useful information
_More information is always welcome. Be verbose._
+45
View File
@@ -0,0 +1,45 @@
#----------------------------------------#
# .gitingore for IRremoteESP8266 library #
#----------------------------------------#
### Files to ignore.
## Editors
# vi/vim
**/*.swp
## Build environments
# Platformio
**/.pioenvs/
**/.piolibdeps/
**/.clang_complete
**/.gcc-flags.json
examples/**/lib
examples/**/.travis.yml
examples/**/.gitignore
lib/readme.txt
lib/googletest/**/*
# GCC pre-compiled headers.
**/*.gch
# Python compiled files
**/*.pyc
# Unit Test builds
test/*.o
test/*.a
test/*_test
# Tools builds
tools/*.o
tools/*.a
tools/gc_decode
.pioenvs
.piolibdeps
.clang_complete
.gcc-flags.json
#Cygwin builds
*.exe
+4
View File
@@ -0,0 +1,4 @@
[submodule "lib/googletest"]
path = lib/googletest
url = https://github.com/google/googletest.git
branch = v1.8.x
+3
View File
@@ -0,0 +1,3 @@
[style]
based_on_style: google
indent_width: 2
+27
View File
@@ -10,13 +10,19 @@ before_install:
- tar xf arduino-1.8.2-linux64.tar.xz
- sudo mv arduino-1.8.2 /usr/local/share/arduino
- sudo ln -s /usr/local/share/arduino/arduino /usr/local/bin/arduino
- wget https://raw.githubusercontent.com/google/styleguide/gh-pages/cpplint/cpplint.py
install:
- ln -s $PWD /usr/local/share/arduino/libraries/
- git clone https://github.com/tzapu/WiFiManager.git /usr/local/share/arduino/libraries/WiFiManager
- git clone https://github.com/knolleary/pubsubclient.git /usr/local/share/arduino/libraries/PubSubClient
- arduino --pref "boardsmanager.additional.urls=http://arduino.esp8266.com/stable/package_esp8266com_index.json" --save-prefs
- arduino --install-boards esp8266:esp8266
- arduino --board $BD --save-prefs
- arduino --pref "compiler.warning_level=all" --save-prefs
- sudo apt-get install jq
- sudo pip install pylint
script:
# Check that everything compiles.
- arduino --verify --board $BD $PWD/examples/IRrecvDemo/IRrecvDemo.ino
- arduino --verify --board $BD $PWD/examples/IRGCSendDemo/IRGCSendDemo.ino
- arduino --verify --board $BD $PWD/examples/IRGCTCPServer/IRGCTCPServer.ino
@@ -25,8 +31,29 @@ script:
- arduino --verify --board $BD $PWD/examples/IRsendDemo/IRsendDemo.ino
- arduino --verify --board $BD $PWD/examples/JVCPanasonicSendDemo/JVCPanasonicSendDemo.ino
- arduino --verify --board $BD $PWD/examples/TurnOnDaikinAC/TurnOnDaikinAC.ino
- arduino --verify --board $BD $PWD/examples/TurnOnFujitsuAC/TurnOnFujitsuAC.ino
- arduino --verify --board $BD $PWD/examples/TurnOnKelvinatorAC/TurnOnKelvinatorAC.ino
- arduino --verify --board $BD $PWD/examples/TurnOnMitsubishiAC/TurnOnMitsubishiAC.ino
- arduino --verify --board $BD $PWD/examples/IRsendProntoDemo/IRsendProntoDemo.ino
- arduino --verify --board $BD $PWD/examples/TurnOnTrotecAC/TurnOnTrotecAC.ino
- arduino --verify --board $BD $PWD/examples/LGACSend/LGACSend.ino
- arduino --verify --board $BD $PWD/examples/TurnOnArgoAC/TurnOnArgoAC.ino
- arduino --verify --board $BD $PWD/examples/IRMQTTServer/IRMQTTServer.ino
- arduino --verify --board $BD $PWD/examples/TurnOnToshibaAC/TurnOnToshibaAC.ino
# Also check the tools programs compile.
- (cd tools; make all)
# Check for lint issues.
- shopt -s nullglob
- python cpplint.py --extensions=c,cc,cpp,ino --headers=h,hpp {src,test,tools}/*.{h,c,cc,cpp,hpp,ino} examples/*/*.{h,c,cc,cpp,hpp,ino}
- pylint {src,test,tools}/*.py
- shopt -u nullglob
# Build and run the unit tests.
- (cd test; make run)
- (cd tools; make run_tests)
# Check the version numbers match.
- LIB_VERSION=$(egrep "^#define\s+_IRREMOTEESP8266_VERSION_\s+" src/IRremoteESP8266.h | cut -d\" -f2)
- test ${LIB_VERSION} == "$(jq -r .version library.json)"
- grep -q "^version=${LIB_VERSION}$" library.properties
notifications:
email:
+3
View File
@@ -0,0 +1,3 @@
set noparent
root=src
linelength=80
-152
View File
@@ -1,152 +0,0 @@
/*
An Arduino sketch to emulate IR Daikin ARC433** remote control unit
Read more on http://harizanov.com/2012/02/control-daikin-air-conditioner-over-the-internet/
*/
#include <IRDaikinESP.h>
IRDaikinESP::IRDaikinESP(int pin) : _irsend(pin)
{
}
void ICACHE_FLASH_ATTR IRDaikinESP::begin()
{
_irsend.begin();
}
void ICACHE_FLASH_ATTR IRDaikinESP::send()
{
_irsend.sendDaikin(daikin);
}
void ICACHE_FLASH_ATTR IRDaikinESP::checksum()
{
uint8_t sum = 0;
uint8_t i;
for(i = 0; i <= 6; i++){
sum += daikin[i];
}
daikin[7] = sum &0xFF;
sum=0;
for(i = 8; i <= 25; i++){
sum += daikin[i];
}
daikin[26] = sum &0xFF;
}
void ICACHE_FLASH_ATTR IRDaikinESP::on()
{
//state = ON;
daikin[13] |= 0x01;
checksum();
}
void ICACHE_FLASH_ATTR IRDaikinESP::off()
{
//state = OFF;
daikin[13] &= 0xFE;
checksum();
}
uint8_t ICACHE_FLASH_ATTR IRDaikinESP::getPower()
{
return (daikin[13])&0x01;
}
// DAIKIN_SILENT or DAIKIN_POWERFUL
void ICACHE_FLASH_ATTR IRDaikinESP::setAux(uint8_t aux)
{
daikin[21] = aux;
checksum();
}
uint8_t ICACHE_FLASH_ATTR IRDaikinESP::getAux(){
return daikin[21];
}
// Set the temp in deg C
void ICACHE_FLASH_ATTR IRDaikinESP::setTemp(uint8_t temp)
{
if (temp < 18)
temp = 18;
else if (temp > 32)
temp = 32;
daikin[14] = (temp)*2;
checksum();
}
uint8_t ICACHE_FLASH_ATTR IRDaikinESP::getTemp()
{
return (daikin[14])/2;
}
// Set the speed of the fan, 0-5, 0 is auto, 1-5 is the speed
void ICACHE_FLASH_ATTR IRDaikinESP::setFan(uint8_t fan)
{
// Set the fan speed bits, leave low 4 bits alone
uint8_t fanset;
daikin[16] = daikin[16] & 0x0F;
if (fan >= 1 && fan <= 5)
fanset = 0x20 + (0x10 * fan);
else
fanset = 0xA0;
daikin[16] = daikin[16] | fanset;
checksum();
}
uint8_t ICACHE_FLASH_ATTR IRDaikinESP::getFan()
{
uint8_t fan = daikin[16] >> 4;
fan = fan - 2;
if (fan > 5)
fan = 0;
return fan;
}
uint8_t ICACHE_FLASH_ATTR IRDaikinESP::getMode()
{/*
DAIKIN_COOL
DAIKIN_HEAT
DAIKIN_FAN
DAIKIN_AUTO
DAIKIN_DRY
*/
return (daikin[13])>>4;
}
void ICACHE_FLASH_ATTR IRDaikinESP::setMode(uint8_t mode)
{
daikin[13]=mode<<4 | getPower();
checksum();
}
void ICACHE_FLASH_ATTR IRDaikinESP::setSwingVertical(uint8_t swing)
{
if (swing)
daikin[16] = daikin[16] | 0x0F;
else
daikin[16] = daikin[16] & 0xF0;
checksum();
}
uint8_t ICACHE_FLASH_ATTR IRDaikinESP::getSwingVertical()
{
return (daikin[16])&0x01;
}
void ICACHE_FLASH_ATTR IRDaikinESP::setSwingHorizontal(uint8_t swing)
{
if (swing)
daikin[17] = daikin[17] | 0x0F;
else
daikin[17] = daikin[17] & 0xF0;
checksum();
}
uint8_t ICACHE_FLASH_ATTR IRDaikinESP::getSwingHorizontal()
{
return (daikin[17])&0x01;
}
-100
View File
@@ -1,100 +0,0 @@
#include <IRremoteESP8266.h>
#include <Arduino.h>
#define DAIKIN_COOL B011
#define DAIKIN_HEAT B100
#define DAIKIN_FAN B110
#define DAIKIN_AUTO B000
#define DAIKIN_DRY B010
#define DAIKIN_POWERFUL B00000010
#define DAIKIN_SILENT B00100000
/*
Daikin AC map
byte 7= checksum of the first part (and last byte before a 29ms pause)
byte 13=mode
b7 = 0
b6+b5+b4 = Mode
Modes: b6+b5+b4
011 = Cool
100 = Heat (temp 23)
110 = FAN (temp not shown, but 25)
000 = Fully Automatic (temp 25)
010 = DRY (temp 0xc0 = 96 degrees c)
b3 = 0
b2 = OFF timer set
b1 = ON timer set
b0 = Air Conditioner ON
byte 14=temp*2 (Temp should be between 18 - 32)
byte 16=Fan
FAN control
b7+b6+b5+b4 = Fan speed
Fan: b7+b6+b5+b4
0×30 = 1 bar
0×40 = 2 bar
0×50 = 3 bar
0×60 = 4 bar
0×70 = 5 bar
0xa0 = Auto
0xb0 = Not auto, moon + tree
b3+b2+b1+b0 = Swing control up/down
Swing control up/down:
0000 = Swing up/down off
1111 = Swing up/down on
byte 17
Swing control left/right:
0000 = Swing left/right off
1111 = Swing left/right on
byte 21=Aux -> Powerful (bit 1), Silent (bit 5)
byte 24=Aux2 -> Intelligent eye on (bit 7)
byte 26= checksum of the second part
*/
#define DAIKIN_COMMAND_LENGTH 27
class IRDaikinESP
{
public:
IRDaikinESP(int pin);
//: IRsend(pin){};
void send();
void begin();
void on();
void off();
uint8_t getPower();
void setAux(uint8_t aux);
uint8_t getAux();
void setTemp(uint8_t temp);
uint8_t getTemp();
void setFan(uint8_t fan);
uint8_t getFan();
uint8_t getMode();
void setMode(uint8_t mode);
void setSwingVertical(uint8_t swing);
uint8_t getSwingVertical();
void setSwingHorizontal(uint8_t swing);
uint8_t getSwingHorizontal();
private:
// # of bytes per command
unsigned char daikin[DAIKIN_COMMAND_LENGTH] = {
0x11,0xDA,0x27,0xF0,0x00,0x00,0x00,0x20,
//0 1 2 3 4 5 6 7
0x11,0xDA,0x27,0x00,0x00,0x41,0x1E,0x00,
//8 9 10 11 12 13 14 15
0xB0,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x00,0x00,0xE3 };
//16 17 18 19 20 21 22 23 24 25 26
void checksum();
IRsend _irsend;
};
-233
View File
@@ -1,233 +0,0 @@
/*
Code to emulate IR Kelvinator YALIF remote control unit, which should control
at least the following Kelvinator A/C units:
KSV26CRC, KSV26HRC, KSV35CRC, KSV35HRC, KSV53HRC, KSV62HRC, KSV70CRC,
KSV70HRC, KSV80HRC.
Note:
* Unsupported:
- All Sleep modes.
- All Timer modes.
- "I Feel" button & mode.
- Energy Saving mode.
- Low Heat mode.
- Farenheit.
*/
#include <IRKelvinator.h>
IRKelvinatorAC::IRKelvinatorAC(int pin) : _irsend(pin) {
stateReset();
}
void ICACHE_FLASH_ATTR IRKelvinatorAC::stateReset() {
for (uint8_t i = 0; i < KELVINATOR_STATE_LENGTH; i++)
remote_state[i] = 0x0;
remote_state[3] = 0x50;
remote_state[11] = 0x70;
}
void ICACHE_FLASH_ATTR IRKelvinatorAC::begin() {
_irsend.begin();
}
void ICACHE_FLASH_ATTR IRKelvinatorAC::fixup() {
// X-Fan mode is only valid in COOL or DRY modes.
if (getMode() != KELVINATOR_COOL && getMode() != KELVINATOR_DRY)
setXFan(false);
checksum(); // Calculate the checksums
}
void ICACHE_FLASH_ATTR IRKelvinatorAC::send() {
fixup(); // Ensure correct settings before sending.
_irsend.sendKelvinator(remote_state);
}
uint8_t* ICACHE_FLASH_ATTR IRKelvinatorAC::getRaw() {
fixup(); // Ensure correct settings before sending.
return remote_state;
}
// Many Bothans died to bring us this information.
void ICACHE_FLASH_ATTR IRKelvinatorAC::checksum() {
// For each command + options block.
for (uint8_t offset = 0; offset < KELVINATOR_STATE_LENGTH; offset += 8) {
uint8_t sum = KELVINATOR_CHECKSUM_START;
// Sum the lower half of the first 4 bytes of this block.
for(uint8_t i = 0; i < 4; i++) {
sum += (remote_state[i + offset] & 0xFU);
}
// then sum the upper half of the next 3 bytes.
for(uint8_t i = 4; i < 7; i++) {
sum += (remote_state[i + offset] >> 4);
}
// Trim it down to fit into the 4 bits allowed. i.e. Mod 16.
sum &= 0xFU;
// Place it into the IR code in the top half of the 8th & 16th byte.
remote_state[7 + offset] = (sum << 4) | (remote_state[7 + offset] & 0xFU);
}
}
void ICACHE_FLASH_ATTR IRKelvinatorAC::on() {
//state = ON;
remote_state[0] |= KELVINATOR_POWER;
remote_state[8] = remote_state[0]; // Duplicate to the 2nd command chunk.
}
void ICACHE_FLASH_ATTR IRKelvinatorAC::off() {
//state = OFF;
remote_state[0] &= ~KELVINATOR_POWER;
remote_state[8] = remote_state[0]; // Duplicate to the 2nd command chunk.
}
void ICACHE_FLASH_ATTR IRKelvinatorAC::setPower(bool state) {
if (state)
on();
else
off();
}
bool ICACHE_FLASH_ATTR IRKelvinatorAC::getPower() {
return ((remote_state[0] & KELVINATOR_POWER) != 0);
}
// Set the temp. in deg C
void ICACHE_FLASH_ATTR IRKelvinatorAC::setTemp(uint8_t temp) {
temp = max(static_cast<uint8_t>(KELVINATOR_MIN_TEMP), temp);
temp = min(static_cast<uint8_t>(KELVINATOR_MAX_TEMP), temp);
remote_state[1] = (remote_state[1] & 0xF0U) | (temp - KELVINATOR_MIN_TEMP);
remote_state[9] = remote_state[1]; // Duplicate to the 2nd command chunk.
}
// Return the set temp. in deg C
uint8_t ICACHE_FLASH_ATTR IRKelvinatorAC::getTemp() {
return ((remote_state[1] & 0xFU) + KELVINATOR_MIN_TEMP);
}
// Set the speed of the fan, 0-5, 0 is auto, 1-5 is the speed
void ICACHE_FLASH_ATTR IRKelvinatorAC::setFan(uint8_t fan) {
fan = min(static_cast<uint8_t>(KELVINATOR_FAN_MAX), fan); // Bounds check
// Only change things if we need to.
if (fan != getFan()) {
// Set the basic fan values.
uint8_t fan_basic = min(static_cast<uint8_t>(KELVINATOR_BASIC_FAN_MAX), fan);
remote_state[0] = (remote_state[0] & KELVINATOR_BASIC_FAN_MASK) |
(fan_basic << KELVINATOR_FAN_OFFSET);
remote_state[8] = remote_state[0]; // Duplicate to the 2nd command chunk.
// Set the advanced(?) fan value.
remote_state[14] = (remote_state[14] & KELVINATOR_FAN_MASK) |
(fan << KELVINATOR_FAN_OFFSET);
setTurbo(false); // Turbo mode is turned off if we change the fan settings.
}
}
uint8_t ICACHE_FLASH_ATTR IRKelvinatorAC::getFan() {
return ((remote_state[14] & ~KELVINATOR_FAN_MASK) >> KELVINATOR_FAN_OFFSET);
}
uint8_t ICACHE_FLASH_ATTR IRKelvinatorAC::getMode() {
/*
KELVINATOR_AUTO
KELVINATOR_COOL
KELVINATOR_DRY
KELVINATOR_FAN
KELVINATOR_HEAT
*/
return (remote_state[0] & ~KELVINATOR_MODE_MASK);
}
void ICACHE_FLASH_ATTR IRKelvinatorAC::setMode(uint8_t mode) {
// If we get an unexpected mode, default to AUTO.
if (mode > KELVINATOR_HEAT) mode = KELVINATOR_AUTO;
remote_state[0] = (remote_state[0] & KELVINATOR_MODE_MASK) | mode;
remote_state[8] = remote_state[0]; // Duplicate to the 2nd command chunk.
if (mode == KELVINATOR_AUTO)
// When the remote is set to Auto, it defaults to 25C and doesn't show it.
setTemp(KELVINATOR_AUTO_TEMP);
}
void ICACHE_FLASH_ATTR IRKelvinatorAC::setSwingVertical(bool state) {
if (state) {
remote_state[0] |= KELVINATOR_VENT_SWING;
remote_state[4] |= KELVINATOR_VENT_SWING_V;
}
else {
remote_state[4] &= ~KELVINATOR_VENT_SWING_V;
if (! getSwingHorizontal())
remote_state[0] &= ~KELVINATOR_VENT_SWING;
}
remote_state[8] = remote_state[0]; // Duplicate to the 2nd command chunk.
}
bool ICACHE_FLASH_ATTR IRKelvinatorAC::getSwingVertical() {
return ((remote_state[4] & KELVINATOR_VENT_SWING_V) != 0);
}
void ICACHE_FLASH_ATTR IRKelvinatorAC::setSwingHorizontal(bool state) {
if (state) {
remote_state[0] |= KELVINATOR_VENT_SWING;
remote_state[4] |= KELVINATOR_VENT_SWING_H;
}
else {
remote_state[4] &= ~KELVINATOR_VENT_SWING_H;
if (! getSwingVertical())
remote_state[0] &= ~KELVINATOR_VENT_SWING;
}
remote_state[8] = remote_state[0]; // Duplicate to the 2nd command chunk.
}
bool ICACHE_FLASH_ATTR IRKelvinatorAC::getSwingHorizontal() {
return ((remote_state[4] & KELVINATOR_VENT_SWING_H) != 0);
}
void ICACHE_FLASH_ATTR IRKelvinatorAC::setQuiet(bool state) {
remote_state[12] &= ~KELVINATOR_QUIET;
remote_state[12] |= (state << KELVINATOR_QUIET_OFFSET);
}
bool ICACHE_FLASH_ATTR IRKelvinatorAC::getQuiet() {
return ((remote_state[12] & KELVINATOR_QUIET) != 0);
}
void ICACHE_FLASH_ATTR IRKelvinatorAC::setIonFilter(bool state) {
remote_state[2] &= ~KELVINATOR_ION_FILTER;
remote_state[2] |= (state << KELVINATOR_ION_FILTER_OFFSET);
remote_state[10] = remote_state[2]; // Duplicate to the 2nd command chunk.
}
bool ICACHE_FLASH_ATTR IRKelvinatorAC::getIonFilter() {
return ((remote_state[2] & KELVINATOR_ION_FILTER) != 0);
}
void ICACHE_FLASH_ATTR IRKelvinatorAC::setLight(bool state) {
remote_state[2] &= ~KELVINATOR_LIGHT;
remote_state[2] |= (state << KELVINATOR_LIGHT_OFFSET);
remote_state[10] = remote_state[2]; // Duplicate to the 2nd command chunk.
}
bool ICACHE_FLASH_ATTR IRKelvinatorAC::getLight() {
return ((remote_state[2] & KELVINATOR_LIGHT) != 0);
}
// Note: XFan mode is only valid in Cool or Dry mode.
void ICACHE_FLASH_ATTR IRKelvinatorAC::setXFan(bool state) {
remote_state[2] &= ~KELVINATOR_XFAN;
remote_state[2] |= (state << KELVINATOR_XFAN_OFFSET);
remote_state[10] = remote_state[2]; // Duplicate to the 2nd command chunk.
}
bool ICACHE_FLASH_ATTR IRKelvinatorAC::getXFan() {
return ((remote_state[2] & KELVINATOR_XFAN) != 0);
}
// Note: Turbo mode is turned off if the fan speed is changed.
void ICACHE_FLASH_ATTR IRKelvinatorAC::setTurbo(bool state) {
remote_state[2] &= ~KELVINATOR_TURBO;
remote_state[2] |= (state << KELVINATOR_TURBO_OFFSET);
remote_state[10] = remote_state[2]; // Duplicate to the 2nd command chunk.
}
bool ICACHE_FLASH_ATTR IRKelvinatorAC::getTurbo() {
return ((remote_state[2] & KELVINATOR_TURBO) != 0);
}
-160
View File
@@ -1,160 +0,0 @@
#include <IRremoteESP8266.h>
#include <Arduino.h>
#define KELVINATOR_AUTO 0U
#define KELVINATOR_COOL 1U
#define KELVINATOR_DRY 2U
#define KELVINATOR_FAN 3U
#define KELVINATOR_HEAT 4U
#define KELVINATOR_MODE_MASK 0xF8U
#define KELVINATOR_POWER 8U
#define KELVINATOR_FAN_OFFSET 4U
#define KELVINATOR_BASIC_FAN_MAX 3U
#define KELVINATOR_BASIC_FAN_MASK uint8_t(0xFFU ^ (3U << KELVINATOR_FAN_OFFSET))
#define KELVINATOR_FAN_MASK uint8_t(0xFFU ^ (7U << KELVINATOR_FAN_OFFSET))
#define KELVINATOR_FAN_MAX 5U
#define KELVINATOR_VENT_SWING_OFFSET 6U
#define KELVINATOR_VENT_SWING uint8_t(1U << KELVINATOR_VENT_SWING_OFFSET)
#define KELVINATOR_VENT_SWING_V uint8_t(1U)
#define KELVINATOR_VENT_SWING_H uint8_t(1U << 4)
#define KELVINATOR_SLEEP_1_AND_3 uint8_t(1U << 7)
#define KELVINATOR_MIN_TEMP 16U // 16C
#define KELVINATOR_MAX_TEMP 30U // 30C
#define KELVINATOR_AUTO_TEMP 25U // 25C
#define KELVINATOR_CHECKSUM_START 10U
#define KELVINATOR_QUIET_OFFSET 7U
#define KELVINATOR_QUIET uint8_t(1U << KELVINATOR_QUIET_OFFSET)
#define KELVINATOR_ION_FILTER_OFFSET 6U
#define KELVINATOR_ION_FILTER uint8_t(1U << KELVINATOR_ION_FILTER_OFFSET)
#define KELVINATOR_LIGHT_OFFSET 5U
#define KELVINATOR_LIGHT uint8_t(1U << KELVINATOR_LIGHT_OFFSET)
#define KELVINATOR_XFAN_OFFSET 7U
#define KELVINATOR_XFAN uint8_t(1U << KELVINATOR_XFAN_OFFSET)
#define KELVINATOR_TURBO_OFFSET 4U
#define KELVINATOR_TURBO uint8_t(1U << KELVINATOR_TURBO_OFFSET)
/*
Kelvinator AC map
(header mark and space)
byte 0 = Basic Modes
b2-0 = Modes
Modes:
000 = Auto (temp = 25C)
001 = Cool
010 = Dry (temp = 25C, but not shown)
011 = Fan
100 = Heat
b3 = Power Status (1 = On, 0 = Off)
b5-4 = Fan (Basic modes)
Fan:
00 = Auto
01 = Fan 1
10 = Fan 2
11 = Fan 3 or higher (See byte 14)
b6 = Vent swing (1 = On, 0 = Off) (See byte 4)
b7 = Sleep Modes 1 & 3 (1 = On, 0 = Off)
byte 1 = Temperature
b3-0: Degrees C.
0000 (0) = 16C
0001 (1) = 17C
0010 (2) = 18C
...
1101 (13) = 29C
1110 (14) = 30C
byte 2 = Extras
b3-0 = UNKNOWN, typically 0.
b4 = Turbo Fan (1 = On, 0 = Off)
b5 = Light (Display) (1 = On, 0 = Off)
b6 = Ion Filter (1 = On, 0 = Off)
b7 = X-Fan (Fan runs for a while after power off) (1 = On, 0 = Off)
byte 3 = Section Indicator
b3-0 = Unused (Typically 0)
b5-4 = Unknown (possibly timer related) (Typically B01)
b7-6 = End of command block (B01)
(B010 marker and a gap of 20ms)
byte 4 = Extended options
b0 = Swing Vent Vertical (1 = On, 0 = Off)
b4 = Swing Vent Horizontal (1 = On, 0 = Off)
byte 5-6 = Timer related. Typically 0 except when timer in use.
byte 7 = checksum
b3-0 = Unknown (Used in Timer mode)
b7-4 = checksum of the previous bytes (0-6)
(gap of 40ms)
(header mark and space)
byte 8 = Repeat of byte 0
byte 9 = Repeat of byte 1
byte 10 = Repeat of byte 2
byte 11 = Section Indicator
b3-0 = Unused (Typically 0)
b5-4 = Unknown (possibly timer related) (Typically B11)
b7-6 = End of command block (B01)
(B010 marker and a gap of 20ms)
byte 12 = Extended options
b0 = Sleep mode 2 (1 = On, 0=Off)
b6-1 = Unknown (Used in Sleep Mode 3, Typically B000000)
b7 = Quiet Mode (1 = On, 0=Off)
byte 13 = Unknown (Sleep Mode 3 related, Typically 0x00)
byte 14 = Fan control
b3-0 = Unknown (Sleep Mode 3 related, Typically B0000)
b6-4 = Fan speed
B000 (0) = Automatic
B001 (1) = Fan 1
B010 (2) = Fan 2
B011 (3) = Fan 3
B100 (4) = Fan 4
B101 (5) = Fan 5
byte 15 = checksum
b3-0 = Unknown (Typically B0000)
b7-4 = checksum of the previous bytes (8-14)
*/
#define KELVINATOR_STATE_LENGTH 16
class IRKelvinatorAC
{
public:
IRKelvinatorAC(int pin);
//: IRsend(pin){};
void stateReset();
void send();
void begin();
void on();
void off();
void setPower(bool state);
bool getPower();
void setTemp(uint8_t temp);
uint8_t getTemp();
void setFan(uint8_t fan);
uint8_t getFan();
void setMode(uint8_t mode);
uint8_t getMode();
void setSwingVertical(bool state);
bool getSwingVertical();
void setSwingHorizontal(bool state);
bool getSwingHorizontal();
void setQuiet(bool state);
bool getQuiet();
void setIonFilter(bool state);
bool getIonFilter();
void setLight(bool state);
bool getLight();
void setXFan(bool state);
bool getXFan();
void setTurbo(bool state);
bool getTurbo();
uint8_t* getRaw();
private:
// The state of the IR remote in IR code form.
uint8_t remote_state[KELVINATOR_STATE_LENGTH];
void checksum();
void fixup();
IRsend _irsend;
};
-148
View File
@@ -1,148 +0,0 @@
/*
Code to emulate Mitsubishi A/C IR remote control unit.
Inspired and derived from the work done at:
https://github.com/r45635/HVAC-IR-Control
Warning: Consider this very alpha code. Seems to work, but not validated.
Equipment it seems compatible with:
* <Add models (A/C & remotes) you've gotten it working with here>
*/
#include <IRMitsubishiAC.h>
// Initialise the object.
IRMitsubishiAC::IRMitsubishiAC(int pin) : _irsend(pin) {
stateReset();
}
// Reset the state of the remote to a known good state/sequence.
void ICACHE_FLASH_ATTR IRMitsubishiAC::stateReset() {
for (uint8_t i = 0; i < MITSUBISHI_AC_STATE_LENGTH; i++)
remote_state[i] = known_good_state[i];
checksum(); // Calculate the checksum
}
// Configure the pin for output.
void ICACHE_FLASH_ATTR IRMitsubishiAC::begin() {
_irsend.begin();
}
// Send the current desired state to the IR LED.
void ICACHE_FLASH_ATTR IRMitsubishiAC::send() {
checksum(); // Ensure correct checksum before sending.
_irsend.sendMitsubishiAC(remote_state);
}
// Return a pointer to the internal state date of the remote.
uint8_t* ICACHE_FLASH_ATTR IRMitsubishiAC::getRaw() {
checksum();
return remote_state;
}
// Calculate the checksum for the current internal state of the remote.
void ICACHE_FLASH_ATTR IRMitsubishiAC::checksum() {
uint8_t sum = 0;
// Checksum is simple addition of all previous bytes stored
// as a 8 bit value.
for (uint8_t i = 0; i < 17; i++)
sum += remote_state[i];
remote_state[17] = sum & 0xFFU;
}
// Set the requested power state of the A/C to off.
void ICACHE_FLASH_ATTR IRMitsubishiAC::on() {
//state = ON;
remote_state[5] |= MITSUBISHI_AC_POWER;
}
// Set the requested power state of the A/C to off.
void ICACHE_FLASH_ATTR IRMitsubishiAC::off() {
//state = OFF;
remote_state[5] &= ~MITSUBISHI_AC_POWER;
}
// Set the requested power state of the A/C.
void ICACHE_FLASH_ATTR IRMitsubishiAC::setPower(bool state) {
if (state)
on();
else
off();
}
// Return the requested power state of the A/C.
bool ICACHE_FLASH_ATTR IRMitsubishiAC::getPower() {
return((remote_state[5] & MITSUBISHI_AC_POWER) != 0);
}
// Set the temp. in deg C
void ICACHE_FLASH_ATTR IRMitsubishiAC::setTemp(uint8_t temp) {
temp = max(static_cast<uint8_t>(MITSUBISHI_AC_MIN_TEMP), temp);
temp = min(static_cast<uint8_t>(MITSUBISHI_AC_MAX_TEMP), temp);
remote_state[7] = temp - MITSUBISHI_AC_MIN_TEMP;
}
// Return the set temp. in deg C
uint8_t ICACHE_FLASH_ATTR IRMitsubishiAC::getTemp() {
return(remote_state[7] + MITSUBISHI_AC_MIN_TEMP);
}
// Set the speed of the fan, 0-6.
// 0 is auto, 1-5 is the speed, 6 is silent.
void ICACHE_FLASH_ATTR IRMitsubishiAC::setFan(uint8_t fan) {
// Bounds check
if (fan > MITSUBISHI_AC_FAN_SILENT)
fan = MITSUBISHI_AC_FAN_MAX; // Set the fan to maximum if out of range.
if (fan == MITSUBISHI_AC_FAN_AUTO) { // Automatic is a special case.
remote_state[9] = B10000000 | (remote_state[9] & B01111000);
return;
} else if (fan >= MITSUBISHI_AC_FAN_MAX) {
fan--; // There is no spoon^H^H^Heed 5 (max), pretend it doesn't exist.
}
remote_state[9] |= fan;
}
// Return the requested state of the unit's fan.
uint8_t ICACHE_FLASH_ATTR IRMitsubishiAC::getFan() {
uint8_t fan = remote_state[9] & B111;
if (fan == MITSUBISHI_AC_FAN_MAX)
return MITSUBISHI_AC_FAN_SILENT;
return fan;
}
// Return the requested climate operation mode of the a/c unit.
uint8_t ICACHE_FLASH_ATTR IRMitsubishiAC::getMode() {
/*
MITSUBISHI_AC_AUTO
MITSUBISHI_AC_COOL
MITSUBISHI_AC_DRY
MITSUBISHI_AC_HEAT
*/
return(remote_state[6]);
}
// Set the requested climate operation mode of the a/c unit.
void ICACHE_FLASH_ATTR IRMitsubishiAC::setMode(uint8_t mode) {
// If we get an unexpected mode, default to AUTO.
switch (mode) {
case MITSUBISHI_AC_AUTO: break;
case MITSUBISHI_AC_COOL: break;
case MITSUBISHI_AC_DRY: break;
case MITSUBISHI_AC_HEAT: break;
default: mode = MITSUBISHI_AC_AUTO;
}
remote_state[6] = mode;
}
// Set the requested vane operation mode of the a/c unit.
void ICACHE_FLASH_ATTR IRMitsubishiAC::setVane(uint8_t mode) {
mode = max(mode, static_cast<uint8_t>(B111)); // bounds check
mode |= B1000;
mode <<= 3;
remote_state[9] |= mode;
}
// Return the requested vane operation mode of the a/c unit.
uint8_t ICACHE_FLASH_ATTR IRMitsubishiAC::getVane() {
return ((remote_state[9] & B00111000) >> 3);
}
-52
View File
@@ -1,52 +0,0 @@
#include <IRremoteESP8266.h>
#include <Arduino.h>
#define MITSUBISHI_AC_AUTO 0x20U
#define MITSUBISHI_AC_COOL 0x18U
#define MITSUBISHI_AC_DRY 0x10U
#define MITSUBISHI_AC_HEAT 0x08U
#define MITSUBISHI_AC_POWER 0x20U
#define MITSUBISHI_AC_FAN_AUTO 0U
#define MITSUBISHI_AC_FAN_MAX 5U
#define MITSUBISHI_AC_FAN_SILENT 6U
#define MITSUBISHI_AC_MIN_TEMP 16U // 16C
#define MITSUBISHI_AC_MAX_TEMP 31U // 31C
#define MITSUBISHI_AC_VANE_AUTO 0U
#define MITSUBISHI_AC_VANE_AUTO_MOVE 7U
#define MITSUBISHI_AC_STATE_LENGTH 18
class IRMitsubishiAC
{
public:
IRMitsubishiAC(int pin);
void stateReset();
void send();
void begin();
void on();
void off();
void setPower(bool state);
bool getPower();
void setTemp(uint8_t temp);
uint8_t getTemp();
void setFan(uint8_t fan);
uint8_t getFan();
void setMode(uint8_t mode);
uint8_t getMode();
void setVane(uint8_t mode);
uint8_t getVane();
uint8_t* getRaw();
private:
// The state of the IR remote in IR code form.
// Known good state obtained from:
// https://github.com/r45635/HVAC-IR-Control/blob/master/HVAC_ESP8266/HVAC_ESP8266.ino#L108
uint8_t known_good_state[MITSUBISHI_AC_STATE_LENGTH] = { 0x23, 0xCB, 0x26, 0x01, 0x00, 0x20, 0x08, 0x06, 0x30, 0x45, 0x67, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F };
uint8_t remote_state[MITSUBISHI_AC_STATE_LENGTH];
void checksum();
IRsend _irsend;
};
File diff suppressed because it is too large Load Diff
-237
View File
@@ -1,237 +0,0 @@
/***************************************************
* IRremote for ESP8266
*
* Based on the IRremote library for Arduino by Ken Shirriff
* Version 0.11 August, 2009
* Copyright 2009 Ken Shirriff
* For details, see http://arcfn.com/2009/08/multi-protocol-infrared-remote-library.html
*
* Edited by Mitra to add new controller SANYO
*
* Interrupt code based on NECIRrcv by Joe Knapp
* http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1210243556
* Also influenced by http://zovirl.com/2008/11/12/building-a-universal-remote-with-an-arduino/
*
* JVC and Panasonic protocol added by Kristian Lauszus (Thanks to zenwheel and other people at the original blog post)
* LG added by Darryl Smith (based on the JVC protocol)
* Whynter A/C ARC-110WD added by Francesco Meschia
* Coolix A/C / heatpump added by bakrus
* Denon: sendDenon, decodeDenon added by Massimiliano Pinto
(from https://github.com/z3t0/Arduino-IRremote/blob/master/ir_Denon.cpp)
* Kelvinator A/C and Sherwood added by crankyoldgit
* Updated by markszabo (https://github.com/markszabo/IRremoteESP8266) for sending IR code on ESP8266
* Updated by Sebastien Warin (http://sebastien.warin.fr) for receiving IR code on ESP8266
*
* Updated by sillyfrog for Daikin, adopted from
* (https://github.com/mharizanov/Daikin-AC-remote-control-over-the-Internet/)
*
* GPL license, all text above must be included in any redistribution
****************************************************/
#ifndef IRremote_h
#define IRremote_h
#include <stdint.h>
#include "IRremoteInt.h"
// The following are compile-time library options.
// If you change them, recompile the library.
// If DEBUG is defined, a lot of debugging output will be printed during decoding.
// TEST must be defined for the IRtest unittests to work. It will make some
// methods virtual, which will be slightly slower, which is why it is optional.
//#define DEBUG
//#define TEST
/*
* Always add to the end of the list and should never remove entries
* or change order. Projects may save the type number for later usage
* so numbering should always stay the same.
*/
enum decode_type_t {
UNKNOWN = -1,
UNUSED = 0,
RC5,
RC6,
NEC,
PIONEER,
SONY,
PANASONIC,
JVC,
SAMSUNG,
WHYNTER,
AIWA_RC_T501,
LG,
SANYO,
MITSUBISHI,
DISH,
SHARP,
COOLIX,
DAIKIN,
DENON,
KELVINATOR,
SHERWOOD,
MITSUBISHI_AC,
RCMM
};
// Results returned from the decoder
class decode_results {
public:
int decode_type; // NEC, SONY, RC5, UNKNOWN
union { // This is used for decoding Panasonic and Sharp data
unsigned int panasonicAddress;
unsigned int sharpAddress;
};
unsigned long value; // Decoded value
int bits; // Number of bits in decoded value
volatile unsigned int *rawbuf; // Raw intervals in .5 us ticks
int rawlen; // Number of records in rawbuf.
bool overflow;
};
// Decoded value for NEC when a repeat code is received
#define REPEAT 0xffffffff
#define SEND_PROTOCOL_NEC case NEC: sendNEC(data, nbits); break;
#define SEND_PROTOCOL_PIONEER case PIONEER: sendPioneer(data, nbits, 1, 0ul); break;
#define SEND_PROTOCOL_SONY case SONY: sendSony(data, nbits); break;
#define SEND_PROTOCOL_RC5 case RC5: sendRC5(data, nbits); break;
#define SEND_PROTOCOL_RC6 case RC6: sendRC6(data, nbits); break;
#define SEND_PROTOCOL_DISH case DISH: sendDISH(data, nbits); break;
#define SEND_PROTOCOL_JVC case JVC: sendJVC(data, nbits, 0); break;
#define SEND_PROTOCOL_SAMSUNG case SAMSUNG: sendSAMSUNG(data, nbits); break;
#define SEND_PROTOCOL_LG case LG: sendLG(data, nbits); break;
#define SEND_PROTOCOL_WHYNTER case WHYNTER: sendWhynter(data, nbits); break;
#define SEND_PROTOCOL_COOLIX case COOLIX: sendCOOLIX(data, nbits); break;
#define SEND_PROTOCOL_DENON case DENON: sendDenon(data, nbits); break;
#define SEND_PROTOCOL_SHERWOOD case SHERWOOD: sendSherwood(data, nbits); break;
#define SEND_PROTOCOL_RCMM case RCMM: sendRCMM(data, nbits); break;
// main class for receiving IR
class IRrecv
{
public:
IRrecv(int recvpin);
bool decode(decode_results *results, irparams_t *save=NULL);
void enableIRIn();
void disableIRIn();
void resume();
private:
// These are called by decode
void copyIrParams(irparams_t *dest);
int getRClevel(decode_results *results, int *offset, int *used, int t1);
bool decodeNEC(decode_results *results);
bool decodeSony(decode_results *results);
bool decodeSanyo(decode_results *results);
bool decodeMitsubishi(decode_results *results);
bool decodeRC5(decode_results *results);
bool decodeRC6(decode_results *results);
bool decodeRCMM(decode_results *results);
bool decodePanasonic(decode_results *results);
bool decodeLG(decode_results *results);
bool decodeJVC(decode_results *results);
bool decodeSAMSUNG(decode_results *results);
bool decodeWhynter(decode_results *results);
bool decodeHash(decode_results *results);
// COOLIX decode is not implemented yet
// bool decodeCOOLIX(decode_results *results);
bool decodeDaikin(decode_results *results);
bool decodeDenon(decode_results *results);
int compare(unsigned int oldval, unsigned int newval);
uint32_t ticksLow(uint32_t usecs, uint8_t tolerance=TOLERANCE);
uint32_t ticksHigh(uint32_t usecs, uint8_t tolerance=TOLERANCE);
bool match(uint32_t measured_ticks, uint32_t desired_us,
uint8_t tolerance=TOLERANCE);
bool matchMark(uint32_t measured_ticks, uint32_t desired_us,
uint8_t tolerance=TOLERANCE, int excess=MARK_EXCESS);
bool matchSpace(uint32_t measured_ticks, uint32_t desired_us,
uint8_t tolerance=TOLERANCE, int excess=MARK_EXCESS);
};
// Only used for testing; can remove virtual for shorter code
#ifdef TEST
#define VIRTUAL virtual
#else
#define VIRTUAL
#endif
class IRsend
{
public:
IRsend(int IRsendPin);
void begin();
void send(int type, unsigned long data, int nbits) {
switch (type) {
SEND_PROTOCOL_NEC
SEND_PROTOCOL_PIONEER
SEND_PROTOCOL_SONY
SEND_PROTOCOL_RC5
SEND_PROTOCOL_RC6
SEND_PROTOCOL_DISH
SEND_PROTOCOL_JVC
SEND_PROTOCOL_SAMSUNG
SEND_PROTOCOL_LG
SEND_PROTOCOL_WHYNTER
SEND_PROTOCOL_COOLIX
SEND_PROTOCOL_DENON
SEND_PROTOCOL_SHERWOOD
SEND_PROTOCOL_RCMM
}
};
void sendCOOLIX(unsigned long data, int nbits);
void sendWhynter(unsigned long data, int nbits);
void sendNEC(unsigned long data, int nbits=32, unsigned int repeat=0);
void sendPioneer(unsigned long data, int nbits=32, unsigned int repeat=0, unsigned long secondData=0ul);
void sendLG(unsigned long data, int nbits=28, unsigned int repeat=0);
// sendSony() should typically be called with repeat=2 as Sony devices
// expect the code to be sent at least 3 times. (code + 2 repeats = 3 codes)
// As the legacy use of this procedure was only to send a single code
// it defaults to repeat=0 for backward compatiblity.
void sendSony(unsigned long data, int nbits, unsigned int repeat=0);
// Neither Sanyo nor Mitsubishi send is implemented yet
// void sendSanyo(unsigned long data, int nbits);
// void sendMitsubishi(unsigned long data, int nbits);
void sendRaw(unsigned int buf[], int len, int hz);
void sendGC(unsigned int buf[], int len);
void sendRC5(unsigned long data, int nbits);
void sendRC6(unsigned long data, int nbits);
void sendRCMM(uint32_t data, uint8_t nbits=24);
// sendDISH() should typically be called with repeat=3 as DISH devices
// expect the code to be sent at least 4 times. (code + 3 repeats = 4 codes)
// As the legacy use of this procedure was only to send a single code
// it defaults to repeat=0 for backward compatiblity.
void sendDISH(unsigned long data, int nbits, unsigned int repeat=0);
void sendSharp(unsigned int address, unsigned int command);
void sendSharpRaw(unsigned long data, int nbits);
void sendPanasonic(unsigned int address, unsigned long data);
void sendJVC(unsigned long data, int nbits, unsigned int repeat=0);
void sendSAMSUNG(unsigned long data, int nbits=32);
void sendDaikin(unsigned char data[]);
void sendDenon(unsigned long data, int nbits=14);
void sendKelvinator(unsigned char data[]);
void sendSherwood(unsigned long data, int nbits=32, unsigned int repeat=1);
void sendMitsubishiAC(unsigned char data[]);
void enableIROut(int khz);
VIRTUAL void mark(unsigned int usec);
VIRTUAL void space(unsigned long usec);
private:
int halfPeriodicTime;
int IRpin;
void sendMitsubishiACChunk(unsigned char data);
void sendData(uint16_t onemark, uint32_t onespace,
uint16_t zeromark, uint32_t zerospace,
uint32_t data, uint8_t nbits, bool MSBfirst=true);
void ledOff();
} ;
class IRtimer {
public:
IRtimer();
void reset();
uint32_t elapsed();
private:
uint32_t start;
};
#endif
-267
View File
@@ -1,267 +0,0 @@
/***************************************************
* IRremote for ESP8266
*
* Based on the IRremote library for Arduino by Ken Shirriff
* Version 0.11 August, 2009
* Copyright 2009 Ken Shirriff
* For details, see http://arcfn.com/2009/08/multi-protocol-infrared-remote-library.html
*
* Modified by Paul Stoffregen <paul@pjrc.com> to support other boards and timers
*
* Interrupt code based on NECIRrcv by Joe Knapp
* http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1210243556
* Also influenced by http://zovirl.com/2008/11/12/building-a-universal-remote-with-an-arduino/
*
* JVC and Panasonic protocol added by Kristian Lauszus (Thanks to zenwheel and other people at the original blog post)
* Whynter A/C ARC-110WD added by Francesco Meschia
* Coolix A/C / heatpump added by bakrus
* Denon: sendDenon, decodeDenon added by Massimiliano Pinto
(from https://github.com/z3t0/Arduino-IRremote/blob/master/ir_Denon.cpp)
* Kelvinator A/C added by crankyoldgit
* Mitsubishi A/C added by crankyoldgit
* (based on https://github.com/r45635/HVAC-IR-Control)
*
* 09/23/2015 : Samsung pulse parameters updated by Sebastien Warin to be compatible with EUxxD6200
*
* GPL license, all text above must be included in any redistribution
****************************************************/
#ifndef IRremoteint_h
#define IRremoteint_h
#if defined(ARDUINO) && ARDUINO >= 100
#include <Arduino.h>
#else
#include <WProgram.h>
#endif
// Pulse parms are *50-100 for the Mark and *50+100 for the space
// First MARK is the one after the long gap
// pulse parameters in usec
#define COOLIX_BIT_MARK 560 // Approximately 21 cycles at 38kHz
#define COOLIX_ONE_SPACE COOLIX_BIT_MARK * 3
#define COOLIX_ZERO_SPACE COOLIX_BIT_MARK * 1
#define COOLIX_HDR_MARK COOLIX_BIT_MARK * 8
#define COOLIX_HDR_SPACE COOLIX_BIT_MARK * 8
#define WHYNTER_HDR_MARK 2850
#define WHYNTER_HDR_SPACE 2850
#define WHYNTER_BIT_MARK 750
#define WHYNTER_ONE_MARK 750
#define WHYNTER_ONE_SPACE 2150
#define WHYNTER_ZERO_MARK 750
#define WHYNTER_ZERO_SPACE 750
#define NEC_HDR_MARK 9000
#define NEC_HDR_SPACE 4500
#define NEC_BIT_MARK 560
#define NEC_ONE_SPACE 1690
#define NEC_ZERO_SPACE 560
#define NEC_RPT_SPACE 2250
#define NEC_MIN_COMMAND_LENGTH 108000UL
#define PIONEER_HDR_MARK 8000
#define PIONEER_HDR_SPACE 4000
#define PIONEER_BIT_MARK 500
#define PIONEER_ONE_SPACE 1500
#define PIONEER_ZERO_SPACE 500
#define PIONEER_RPT_SPACE 2250
#define PIONEER_MIN_COMMAND_LENGTH 90000UL
// Timings based on http://www.sbprojects.com/knowledge/ir/sirc.php
#define SONY_HDR_MARK 2400
#define SONY_HDR_SPACE 600
#define SONY_ONE_MARK 1250 // Experiments suggest +50 to spec is better.
#define SONY_ZERO_MARK 650 // Experiments suggest +50 to spec is better.
#define SONY_RPT_LENGTH 45000
#define SONY_DOUBLE_SPACE_USECS 500 // usually see 713 - not using ticks as get number wrapround
// SA 8650B
#define SANYO_HDR_MARK 3500 // seen range 3500
#define SANYO_HDR_SPACE 950 // seen 950
#define SANYO_ONE_MARK 2400 // seen 2400
#define SANYO_ZERO_MARK 700 // seen 700
#define SANYO_DOUBLE_SPACE_USECS 800 // usually see 713 - not using ticks as get number wrapround
#define SANYO_RPT_LENGTH 45000
// Mitsubishi RM 75501
// 14200 7 41 7 42 7 42 7 17 7 17 7 18 7 41 7 18 7 17 7 17 7 18 7 41 8 17 7 17 7 18 7 17 7
// #define MITSUBISHI_HDR_MARK 250 // seen range 3500
#define MITSUBISHI_HDR_SPACE 350 // 7*50+100
#define MITSUBISHI_ONE_MARK 1950 // 41*50-100
#define MITSUBISHI_ZERO_MARK 750 // 17*50-100
// #define MITSUBISHI_DOUBLE_SPACE_USECS 800 // usually ssee 713 - not using ticks as get number wrapround
// #define MITSUBISHI_RPT_LENGTH 45000
// Mitsubishi A/C
// Values were initially obtained from:
// https://github.com/r45635/HVAC-IR-Control/blob/master/HVAC_ESP8266/HVAC_ESP8266.ino#L84
#define MITSUBISHI_AC_HDR_MARK 3400
#define MITSUBISHI_AC_HDR_SPACE 1750
#define MITSUBISHI_AC_BIT_MARK 450
#define MITSUBISHI_AC_ONE_SPACE 1300
#define MITSUBISHI_AC_ZERO_SPACE 420
#define MITSUBISHI_AC_RPT_MARK 440
#define MITSUBISHI_AC_RPT_SPACE 17100L
#define RC5_T1 889
#define RC5_RPT_LENGTH 46000
#define RC6_HDR_MARK 2666
#define RC6_HDR_SPACE 889
#define RC6_T1 444
#define RC6_RPT_LENGTH 46000
// http://www.sbprojects.com/knowledge/ir/rcmm.php
#define RCMM_HDR_MARK 416
#define RCMM_HDR_SPACE 277
#define RCMM_BIT_MARK 166
#define RCMM_BIT_SPACE_0 277
#define RCMM_BIT_SPACE_1 444
#define RCMM_BIT_SPACE_2 611
#define RCMM_BIT_SPACE_3 777
#define RCMM_RPT_LENGTH 27778
#define RCMM_MIN_GAP 3360
// Use a tolerance of +/-10% when matching some data spaces.
#define RCMM_TOLERANCE 10
#define RCMM_EXCESS 50
#define SHARP_BIT_MARK 245
#define SHARP_ONE_SPACE 1805
#define SHARP_ZERO_SPACE 795
#define SHARP_GAP 600000
#define SHARP_TOGGLE_MASK 0x3FF
#define SHARP_RPT_SPACE 3000
#define DISH_HDR_MARK 400
#define DISH_HDR_SPACE 6100
#define DISH_BIT_MARK 400
#define DISH_ONE_SPACE 1700
#define DISH_ZERO_SPACE 2800
#define DISH_RPT_SPACE 6200
// Ref: http://www.remotecentral.com/cgi-bin/mboard/rc-pronto/thread.cgi?26152
#define PANASONIC_HDR_MARK 3456
#define PANASONIC_HDR_SPACE 1728
#define PANASONIC_BIT_MARK 432
#define PANASONIC_ONE_SPACE 1296
#define PANASONIC_ZERO_SPACE 432
#define JVC_HDR_MARK 8000
#define JVC_HDR_SPACE 4000
#define JVC_BIT_MARK 600
#define JVC_ONE_SPACE 1600
#define JVC_ZERO_SPACE 550
#define JVC_RPT_LENGTH 60000
#define LG_HDR_MARK 8000
#define LG_HDR_SPACE 4000
#define LG_BIT_MARK 600
#define LG_ONE_SPACE 1600
#define LG_ZERO_SPACE 550
#define LG_RPT_LENGTH 60000
/*
#define SAMSUNG_HDR_MARK 5000
#define SAMSUNG_HDR_SPACE 5000
#define SAMSUNG_BIT_MARK 560
#define SAMSUNG_ONE_SPACE 1600
#define SAMSUNG_ZERO_SPACE 560
#define SAMSUNG_RPT_SPACE 2250
*/
// Update by Sebastien Warin for my EU46D6200
#define SAMSUNG_HDR_MARK 4500
#define SAMSUNG_HDR_SPACE 4500
#define SAMSUNG_BIT_MARK 590
#define SAMSUNG_ONE_SPACE 1690
#define SAMSUNG_ZERO_SPACE 590
#define SAMSUNG_RPT_SPACE 2250
#define SHARP_BITS 15
#define DISH_BITS 16
// Daikin, from https://github.com/mharizanov/Daikin-AC-remote-control-over-the-Internet/tree/master/IRremote
#define DAIKIN_HDR_MARK 3650 //DAIKIN_ZERO_MARK*8
#define DAIKIN_HDR_SPACE 1623 //DAIKIN_ZERO_MARK*4
#define DAIKIN_ONE_SPACE 1280
#define DAIKIN_ONE_MARK 428
#define DAIKIN_ZERO_MARK 428
#define DAIKIN_ZERO_SPACE 428
//Denon, from https://github.com/z3t0/Arduino-IRremote/blob/master/ir_Denon.cpp
#define DENON_BITS 14 // The number of bits in the command
#define DENON_HDR_MARK 300 // The length of the Header:Mark
#define DENON_HDR_SPACE 750 // The lenght of the Header:Space
#define DENON_BIT_MARK 300 // The length of a Bit:Mark
#define DENON_ONE_SPACE 1800 // The length of a Bit:Space for 1's
#define DENON_ZERO_SPACE 750 // The length of a Bit:Space for 0's
#define KELVINATOR_HDR_MARK 8990U
#define KELVINATOR_HDR_SPACE 4490U
#define KELVINATOR_BIT_MARK 675U
#define KELVINATOR_ONE_SPACE 1560U
#define KELVINATOR_ZERO_SPACE 520U
#define KELVINATOR_GAP_SPACE 19950U
#define KELVINATOR_CMD_FOOTER 2U
// Some useful constants
#define USECPERTICK 50 // microseconds per clock interrupt tick
#define RAWBUF 100 // Length of raw duration buffer
// Marks tend to be 100us too long, and spaces 100us too short
// when received due to sensor lag.
#define MARK_EXCESS 100
#define _GAP 5000 // Minimum map between transmissions
#define GAP_TICKS (_GAP/USECPERTICK)
#define TOLERANCE 25 // default percent tolerance in measurements
// receiver states
#define STATE_IDLE 2
#define STATE_MARK 3
#define STATE_SPACE 4
#define STATE_STOP 5
#define RAWBUF 100 // Length of raw duration buffer
// information for the interrupt handler
typedef struct {
uint8_t recvpin; // pin for IR data from detector
uint8_t rcvstate; // state machine
unsigned int timer; // state timer, counts 50uS ticks.
unsigned int rawbuf[RAWBUF]; // raw data
// uint16_t is used for rawlen as it saves 3 bytes of iram in the interrupt
// handler. Don't ask why, I don't know. It just does.
uint16_t rawlen; // counter of entries in rawbuf.
uint8_t overflow; // Buffer overflow indicator.
}
irparams_t;
// Defined in IRremote.cpp
extern volatile irparams_t irparams;
// IR detector output is active low
#define MARK 0
#define SPACE 1
#define TOPBIT 0x80000000
#define NEC_BITS 32
#define SONY_BITS 12
#define SANYO_BITS 12
#define MITSUBISHI_BITS 16
#define MIN_RC5_SAMPLES 11
#define MIN_RC6_SAMPLES 1
#define PANASONIC_BITS 48
#define JVC_BITS 16
#define LG_BITS 28
#define SAMSUNG_BITS 32
#define WHYNTER_BITS 32
#define COOLIX_NBYTES 3
#define DAIKIN_BITS 99
#endif
+57 -17
View File
@@ -1,38 +1,78 @@
# IRremote ESP8266 Library
[![Build Status](https://travis-ci.org/markszabo/IRremoteESP8266.svg?branch=master)](https://travis-ci.org/markszabo/IRremoteESP8266)
[![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/markszabo/IRremoteESP8266.svg)](http://isitmaintained.com/project/markszabo/IRremoteESP8266 "Average time to resolve an issue")
[![Percentage of issues still open](http://isitmaintained.com/badge/open/markszabo/IRremoteESP8266.svg)](http://isitmaintained.com/project/markszabo/IRremoteESP8266 "Percentage of issues still open")
[![GitLicense](https://gitlicense.com/badge/markszabo/IRremoteESP8266)](https://gitlicense.com/license/markszabo/IRremoteESP8266)
This library enables you to **send and receive** infra-red signals on an ESP8266 using Arduino framework (https://github.com/esp8266/Arduino)
This library enables you to **send _and_ receive** infra-red signals on an [ESP8266 using the Arduino framework](https://github.com/esp8266/Arduino) using common 940nm IR LEDs and common IR receiver modules. e.g. TSOP{17,22,24,36,38,44,48}* etc.
This library is based on Ken Shirriff's work (https://github.com/shirriff/Arduino-IRremote/)
## v2.5.2 Now Available
Version 2.5.2 of the library is now [available](https://github.com/markszabo/IRremoteESP8266/releases/latest). You can view the [Release Notes](ReleaseNotes.md) for all the significant changes.
[Mark Szabo](https://github.com/markszabo/IRremoteESP8266) has updated the IRsend class to work on ESP8266 and [Sebastien Warin](https://github.com/sebastienwarin/IRremoteESP8266) the receiving & decoding part (IRrecv class).
#### Upgrading from pre-v2.0
Usage of the library has been slightly changed in v2.0. You will need to change your usage to work with v2.0 and beyond. You can read more about the changes required on our [Upgrade to v2.0](https://github.com/markszabo/IRremoteESP8266/wiki/Upgrading-to-v2.0) page.
Seb's notes : I also changed the pulse parameters for Samsung, update the Panasonic and Samsung decoders and remove the SANYO decoders. The IR decoder was successfully tested with Panasonic and Samsung remote controls.
#### Upgrading from pre-v2.5
The library has changed from using constants declared as `#define` to
[const](https://google.github.io/styleguide/cppguide.html#Constant_Names) with
the appropriate naming per the
[C++ style guide](https://google.github.io/styleguide/cppguide.html).
This may potentially cause old programs to not compile.
The most likely externally used `#define`s have been _aliased_ for limited
backward compatibility for projects using the old style. Going forward, only the
new `kConstantName` style will be supported for new protocol additions.
In the unlikely case it does break your code, then you may have been referencing
something you likely should not have. You should be able to quickly determine
the new name from the old. e.g. `CONSTANT_NAME` to `kConstantName`.
Use common sense or examining the library's code if this does affect code.
## Troubleshooting
Before reporting an issue or asking for help, please try to follow our [Troubleshooting Guide](https://github.com/markszabo/IRremoteESP8266/wiki/Troubleshooting-Guide) first.
## Frequently Asked Questions
Some common answers to common questions and problems are on our [F.A.Q. wiki page](https://github.com/markszabo/IRremoteESP8266/wiki/Frequently-Asked-Questions).
## Installation
1. Click "Download ZIP"
2. Extract the downloaded zip file
3. Rename the extracted folder to "IRremoteESP8266"
4. Move this folder to your libraries directory (under windows: C:\Users\YOURNAME\Documents\Arduino\libraries\)
5. Restart your Arduino ide
6. Check out the examples
##### Official releases via the Arduino IDE v1.8+ (Windows & Linux)
1. Click the _"Sketch"_ -> _"Include Library"_ -> _"Manage Libraries..."_ Menu items.
1. Enter `IRremoteESP8266` into the _"Filter your search..."_ top right search box.
1. Click on the IRremoteESP8266 result of the search.
1. Select the version you wish to install and click _"Install"_.
###### Using Git to install library ( Linux )
##### Manual Installation for Windows
1. Click on _"Clone or Download"_ button, then _"[Download ZIP](https://github.com/markszabo/IRremoteESP8266/archive->master.zip)"_ on the page.
1. Extract the contents of the downloaded zip file.
1. Rename the extracted folder to _"IRremoteESP8266"_.
1. Move this folder to your libraries directory. (under windows: `C:\Users\YOURNAME\Documents\Arduino\libraries\`)
1. Restart your Arduino IDE.
1. Check out the examples.
##### Using Git to install library ( Linux )
```
cd ~/Arduino/libraries
git clone https://github.com/markszabo/IRremoteESP8266.git
```
###### To Update to the latest version of the library
`
```
cd ~/Arduino/libraries/IRremoteESP8266 && git pull
`
```
## Contributing
If you want to contribute to this project:
- Report bugs and errors
If you want to [contribute](.github/CONTRIBUTING.md#how-can-i-contribute) to this project, consider:
- [Report](.github/CONTRIBUTING.md#reporting-bugs) bugs and errors
- Ask for enhancements
- Create issues and pull requests
- Improve our documentation
- [Create issues](.github/CONTRIBUTING.md#reporting-bugs) and [pull requests](.github/CONTRIBUTING.md#pull-requests)
- Tell other people about this library
## Contributors
Check [here](Contributors.md)
Available [here](.github/Contributors.md)
## Library History
This library was originally based on Ken Shirriff's work (https://github.com/shirriff/Arduino-IRremote/)
[Mark Szabo](https://github.com/markszabo/IRremoteESP8266) has updated the IRsend class to work on ESP8266 and [Sebastien Warin](https://github.com/sebastienwarin/IRremoteESP8266) the receiving & decoding part (IRrecv class).
As of v2.0, the library was almost entirely re-written with the ESP8266's resources in mind.
+308
View File
@@ -0,0 +1,308 @@
# Release Notes
## _v2.5.2 (20181021)_
**[Bug Fixes]**
- Add missing send() method to IRPanasonicAC class. (#545)
- Add missing sendWhirlpoolAC() to IRMQTTServer.ino (#558)
**[Features]**
- Add IR receiving support to IRMQTTServer. (#543)
- Pioneer support (#547)
- Add support for a second LG protocol variant. (#552)
- Support for short Panasonic A/C messages. (#553)
- Add support for Panasonic CKP series A/Cs. (#554)
- Experimental timer/clock support for Panasonic A/Cs. (#546)
- Add Made With Magic (MWM) support (#557)
**[Misc]**
- Grammar and typo fixes (#541, #549)
- Increase Panasonic A/C message tolerances. (#542)
- Added command mode2_decode in tools/ (#557)
- General code style cleanup (#560)
## _v2.5.1 (20181002)_
**[Bug Fixes]**
- Correct the byte used for Samsung AC Swing. (#529)
- Fix not sending Samsung A/C messages in IRMQTTServer. (#529)
**[Features]**
- Experimental support for Electra A/C messages. (#528)
- Experimental support for Panasonic A/C messages. (#535)
- Samsung A/C fixes & improvements (#529)
- IRMQTTServer v0.6.0 (#530)
**[Misc]**
- Change required WifiManager lib version to v0.14
- Add alias for RAWTICK to kRawTick. (#535)
- Update sendLutron() status. (#515)
- Remove leftover debug message in IRrecvDumpV2 (#526)
## _v2.5.0 (20180919)_
**[Bug Fixes]**
- Fix HTML menu error for GICABLE in IRMQTTServer. (#516)
- Fix Mitsubishi A/C mode setting. (#514)
- Add missing ',' in auto analyse tool generated code. (#513)
- Fix Fujitsu checksum validation. (#501)
- Remove errant Repeat debug statement in IRMQTTServer. (#507)
**[Features]**
- Mitsubishi A/C decode improvements. (#514)
- Basic support for Whirlpool A/C messages. (#511)
- Basic support for Samsung A/C messages. (#512)
- Experimental support for detailed Samsung A/C messages. (#521)
- Experimental support for detailed Coolix A/C messages. (#518)
- Experimental support for Lutron protocol. (#516)
- Calculate and use average values for timings in analysing tool. (#513)
**[Misc]**
- Style change from using #define's for constants to `const kConstantName`.
- Improve the JVC example code.
## _v2.4.3 (20180727)_
**[Bug Fixes]**
- Handle Space Gaps better in auto analyse tool. (#482)
- Correct min repeat for GICABLE in IRMQTTServer. (#494)
**[Features]**
- Add static IP config option to IRMQTTServer (#480)
- Full decoding/encoding support for the Haier YRW02 A/C. (#485 #486 #487)
**[Misc]**
- Update LG (28-bit) HDR mark and space timings. (#492)
- Spelling and grammar fixes (#491)
## _v2.4.2 (20180601)_
**[Bug Fixes]**
- Timing Fix: Update the period offset compensation.
**[Features]**
- Improvements for IRMQTTServer example (#466)
## _v2.4.1 (20180520)_
**[Bug Fixes]**
- Fix crash in IRMQTTServer when compiled under Arduino IDE. (#455)
- Default bit length not set for RCMM in IRMQTTServer example. (#456)
- Bad acknowledgements for some A/C protocols in IRMQTTServer example. (#460)
**[Features]**
- Allow disabling the use of delay() calls. (#450)
- Initial support for G.I. Cable protocol. (#458)
- Support of Hitachi A/C 13 & 53 byte messages. (#461)
**[Misc]**
- Auto Analyse Raw Data script converted to Python. (#454)
## _v2.4.0 (20180407)_
**[Bug Fixes]**
- Add missing WiFi.begin() call to IRGCTCPServer example. (#433)
- Add missing sendHaierAC() to IRMQTTServer example. (#434 & #444)
- Make mqtt clientid unique in IRMQTTServer example. (#444)
**[Features]**
- Initial Mitsubishi projector protocol support. (#442)
- Experimental support of Hitachi A/C messages. (#445)
- Improve transmission pulse modulation support.
Allow disabling of transmission frequency modulation.(#439)
**[Misc]**
- IRMQTTServer example improvements. (#444)
## _v2.3.3 (20180302)_
**[Bug Fixes]**
- Ensure the IR LED is off before we start. (#405)
**[Features]**
- Experimental decode support for Gree HVAC units (#397)
- Initial support for Haier A/Cs. (#409)
- Improve timing accuracy of unit tests. (#403)
- Rework matchData() to handle equal total data bit time protocols. (#408)
**[Misc]**
- Add startup text to IRrecvDumpV2 and IRrecvDemo (#412)
- Tweak timings on Fujitsu A/C header (#418)
- AutoAnalyseRawData.sh: Add some support for handling larger than 64 bit codes. (#419)
- Use better comments for send GPIO in examples. (#425)
## _v2.3.2 (20180126)_
**[Bug Fixes]**
- Integer underflow caused device not to respond in `sendJVC()` (#401)
**[Features]**
- Initial support for sending & receiving Carrier HVAC codes. (#387)
- Add Pronto HEX code support to _gc_decode_ tool. (#388)
**[Misc]**
- Make mDNS independent of MQTT in IRMQTTServer example code. (#390 #391)
## _v2.3.1 (20171229)_
**[Bug Fixes]**
- Setting `#define SEND_FUJITSU_AC false` caused a compilation error (#375)
- Integer underflow caused huge `space()` in `sendGeneric()` (#381)
**[Features]**
- Support sending & receiving Lasertag codes. (#374)
- Reduce the library footprint by using a new `sendGeneric()` routine. (#373)
**[Misc]**
- Lots of grammar & typo fixes. (#378)
- Update keywords.txt for Arduino IDE users (#371)
- Update pins in examples so they are compatible with Adafruit boards. (#383)
## _v2.3.0 (20171208)_
**[Bug Fixes]**
- Panasonic-based protocols had incorrect message gap. (#358)
- Formatting error for large rawData values in example code. (#355)
- Off-by-one error in payload_copy malloc. (#337)
- Off-by-one error in unit test helper routines (#363)
**[Features]**
- Support sending and receiving Midea A/C codes.
- Support for receiving Kelvinator A/C codes. (#332)
- Support more operation features for Daikin A/Cs.
- Support for decoding Daikin A/Cs.
- Support sending and receiving Toshiba A/Cs. (#333)
- Support sending and receiving AR-DB1 Fujitsu A/C codes. (#367)
- Add new AutoAnalyseRawData.sh & RawToGlobalCache.sh tools (#345) (#343)
- Support for MagiQuest wands. (#365)
**[Misc]**
- Add checksum verification to Kelvinator A/C decodes. (#348)
- Changes to the threshold reporting of UNKNOWN messages (#347)
- Major re-work of Daikin A/C support.
- Sending for all A/Cs added to MQTT example code.
- MQTT example code improvements. (#334)
- IRrecvDumpV2 significant output improvements. (#363)
- Improved unit test coverage for the library.
## _v2.2.1 (20171025)_
**[Features]**
- Support for sending and decoding Nikai TV messages. (#311, #313)
- gc_decode: External utility to decode Global Cache codes. (#308, #312)
- IRMQTTServer: Example code to send IR messages via HTTP & MQTT. (#316, #323)
- Improve converting 64bit values to hexadecimal. (#318)
**[Misc]**
- IRrecvDump.ino code is now deprecated. Use IRrecvDumpV2.ino instead. (#314)
## _v2.2.0 (20170922)_
**[Bug Fixes]**
- Add printing output of RC-MM and RC-5X protocols in example code. (#284)
- LG timing improvements based on observations (#291)
**[Features]**
- Automatic capture timing calibration for some protocols. (#268)
- Support for creating & sending Trotec AC codes. (#279)
- Support for creating & sending Argo Ulisse 13 DCI codes. (#280 #300)
- Move to 2 microsecond timing resolution for capture of codes. (#287)
- Capture buffer changes:
- Size at runtime. (#276)
- Message timeout at runtime. (#294)
- Simplify creating & using a second buffer (#303)
- New example code:
- Trotec A/C (#279)
- LG A/C units (#289)
- Argo Ulisse 13 DCI codes. (#300)
## _v2.1.1 (20170711)_
**[Bug Fixes]**
- GlobalCache incorrectly using hardware offset for period calc. (#267)
**[Features]**
- Support reporting of 'NEC'-like 32-bit protocols. e.g. Apple TV remote (#265)
- Add an example of sendRaw() to IRsendDemo.ino (#270)
## _v2.1.0 (20170704)_
**[Features]**
- Support for sending Pronto IR codes. (#248)
- Support for sending Fujitsu A/C codes. (#88)
- Minor improvements to examples.
## _v2.0.3 (20170618)_
**[Bug fixes]**
- Capture buffer could become corrupt after large message, breaking subsequent decodes. (#253)
## _v2.0.2 (20170615)_
**[Bug fixes]**
- Correct decode issue introduced in v2.0.1 affecting multiple protocol decoders (#243)
- Correct post-message gap for the Panasonic protocol(s) (#245)
- Incorrect display of the decoded uint64_t value in the example code. (#245)
## _v2.0.1 (20170614)_
**[Bug fixes]**
- Decoding protocols when it doesn't detect a post-command gap, and there is no more data. (#243)
- Incorrect minimum size calculation when there is no post-command gap. (#243)
## _v2.0.0 - 64 bit support and major improvements (20170612)_
**[Misc]**
- This is almost a complete re-write of the library.
**[Features]**
- All suitable protocols now handle 64-bit data messages and are repeatable via an optional argument.
- Unit tests for all protocols.
- Far better and stricter decoding for most protocols.
- Address & command decoding for protocols where that information is available.
- Much more precise timing for generation of signals sent.
- Lower duty-cycles for some protocols.
- Several new protocols added, and some new sending and decoding routines for existing ones.
- Ability to optionally chose which protocols are included, enabling faster decoding and smaller code footprints if desired.
- Support for far larger capture buffers. (e.g. RAWLEN > 256)
**[Bug fixes]**
- Numerous bug fixes.
## _v1.2.0 (20170429)_
**[Features]**
- Add ability to copy IR capture buffer, and continue capturing. Means faster and better IR command decoding.
- Reduce IRAM usage by 28 bytes.
- Improve capture of RC-MM & Panasonic protocols.
- Upgrade IRrecvDumpV2 to new IR capture buffer. Much fewer corrupted/truncated IR messages.
## _v1.1.1 (20170413)_
**[Bug fixes]**
- Fix a reported problem when sending the LG protocol. Preemptive fix for possible similar cases.
- Fix minor issues in examples.
**[Features]**
- Add documentation to some examples to aid new people.
- Add ALPHA support for RC-MM protocol. (Known to be currently not 100% working.)
@@ -1,26 +1,72 @@
/*
* IRremoteESP8266: IRsendGCDemo - demonstrates sending Global Cache-formatted IR codes with IRsend
* An IR LED must be connected to ESP8266 pin 0.
* IRremoteESP8266: IRsendGCDemo
* demonstrates sending Global Cache-formatted IR codes with IRsend
* Copyright 2009 Ken Shirriff
* http://arcfn.com
*
* Version 0.2 June, 2017
* Added helpful comments
* Better includes files.
* Version 0.1 30 March, 2016
* Based on Ken Shirriff's IrsendDemo Version 0.1 July, 2009, Copyright 2009 Ken Shirriff, http://arcfn.com
* Based on Ken Shirriff's IrsendDemo
* Version 0.1 July, 2009
*
* An IR LED circuit *MUST* be connected to the ESP8266 on a pin
* as specified by IR_LED below.
*
* TL;DR: The IR LED needs to be driven by a transistor for a good result.
*
* Suggested circuit:
* https://github.com/markszabo/IRremoteESP8266/wiki#ir-sending
*
* Common mistakes & tips:
* * Don't just connect the IR LED directly to the pin, it won't
* have enough current to drive the IR LED effectively.
* * Make sure you have the IR LED polarity correct.
* See: https://learn.sparkfun.com/tutorials/polarity/diode-and-led-polarity
* * Typical digital camera/phones can be used to see if the IR LED is
* flashed. Replace the IR LED with a normal LED if you don't have a digital
* camera when debugging.
* * Avoid using the following pins unless you really know what you are doing:
* * Pin 0/D3: Can interfere with the boot/program mode & support circuits.
* * Pin 1/TX/TXD0: Any serial transmissions from the ESP8266 will
* interfere.
* * Pin 3/RX/RXD0: Any serial transmissions to the ESP8266 will interfere.
* * ESP-01 modules are tricky. We suggest you use a module with more GPIOs
* for your first time. e.g. ESP-12 etc.
*/
#ifndef UNIT_TEST
#include <Arduino.h>
#endif
#include <IRremoteESP8266.h>
#include <IRsend.h>
// Codes are in Global Cache format less the emitter ID and request ID. These codes can be found in GC's Control Tower database.
// Codes are in Global Cache format less the emitter ID and request ID.
// These codes can be found in GC's Control Tower database.
unsigned int Samsung_power_toggle[71] = {38000,1,1,170,170,20,63,20,63,20,63,20,20,20,20,20,20,20,20,20,20,20,63,20,63,20,63,20,20,20,20,20,20,20,20,20,20,20,20,20,63,20,20,20,20,20,20,20,20,20,20,20,20,20,63,20,20,20,63,20,63,20,63,20,63,20,63,20,63,20,1798};
uint16_t Samsung_power_toggle[71] = {
38000, 1, 1, 170, 170, 20, 63, 20, 63, 20, 63, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 63, 20, 63, 20, 63, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 63, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 63, 20, 20, 20, 63, 20,
63, 20, 63, 20, 63, 20, 63, 20, 63, 20, 1798};
IRsend irsend(4); //an IR emitter led is connected to GPIO pin 4
#define IR_LED 4 // ESP8266 GPIO pin to use. Recommended: 4 (D2).
void setup()
{
IRsend irsend(IR_LED); // Set the GPIO to be used to sending the message.
void setup() {
irsend.begin();
Serial.begin(115200);
}
void loop() {
Serial.println("Toggling power");
#if SEND_GLOBALCACHE
irsend.sendGC(Samsung_power_toggle, 71);
#else // SEND_GLOBALCACHE
Serial.println("Can't send because SEND_GLOBALCACHE has been disabled.");
#endif // SEND_GLOBALCACHE
delay(10000);
}
}
@@ -0,0 +1,17 @@
[platformio]
lib_extra_dirs = ../../
src_dir=.
[common]
build_flags =
lib_deps_builtin =
lib_deps_external =
[env:nodemcuv2]
platform = espressif8266
framework = arduino
board = nodemcuv2
build_flags = ${common.build_flags}
lib_deps =
${common.lib_deps_builtin}
${common.lib_deps_external}
@@ -1,85 +1,133 @@
/*
* IRremoteESP8266: IRGCTCPServer - send Global Cache-formatted codes via TCP.
* An IR emitter must be connected to GPIO pin 4.
* Version 0.1 1 April, 2016
* Hisham Khalifa, http://www.hishamkhalifa.com
* Version 0.2 May, 2017
* Copyright 2016 Hisham Khalifa, http://www.hishamkhalifa.com
* Copyright 2017 David Conran
*
* Example command - Samsung TV power toggle: 38000,1,1,170,170,20,63,20,63,20,63,20,20,20,20,20,20,20,20,20,20,20,63,20,63,20,63,20,20,20,20,20,20,20,20,20,20,20,20,20,63,20,20,20,20,20,20,20,20,20,20,20,20,20,63,20,20,20,63,20,63,20,63,20,63,20,63,20,63,20,1798\r\n
* For more codes, visit: https://irdb.globalcache.com/
*
* How to use this program:
* 1) Update "kSsid" and "kPassword" below for your WIFI network.
* 2) Compile and upload the sketch to your ESP8266 module.
* 3) (Optional) Use the serial connection to confirm it started and get the
* IP address.
* 4) From a client machine, connect to port 4998 on the ESP8266, using
* 'telnet', 'nc' (netcat), 'putty' or similar command, etc.
* You may need to install one.
* Unix/OSX:
* Start a shell. Then type:
* telnet <esp8266deviceIPaddress> 4998
* Windows:
* Start a new CMD window, then type:
* telnet <esp8266deviceIPaddress> 4998
*
* 5) Enter a Global Cache-formatted code, starting at the frequency,
* and then a return/enter at the end. No spaces. e.g.:
*
* 38000,1,1,170,170,20,63,20,63,20,63,20,20,20,20,20,20,20,20,20,20,20,63,20,63,20,63,20,20,20,20,20,20,20,20,20,20,20,20,20,63,20,20,20,20,20,20,20,20,20,20,20,20,20,63,20,20,20,63,20,63,20,63,20,63,20,63,20,63,20,1798
*
* To exit the 'telnet' command:
* press <control> + <]> at the same time, then press 'q', and then <return>.
* or:
* <control> + <d> might work.
*
* This program will display the ESP's IP address on the serial console, or you
* can check your wifi router for it's address.
*/
#include <IRremoteESP8266.h>
#include <IRremoteInt.h>
#ifndef UNIT_TEST
#include <Arduino.h>
#endif
#include <ESP8266WiFi.h>
#include <IRremoteESP8266.h>
#include <IRsend.h>
#include <WiFiClient.h>
#include <WiFiServer.h>
const char* ssid = "...";
const char* password = "...";
const char* kSsid = "..."; // Put your WIFI SSID here.
const char* kPassword = "..."; // Put your WIFI Password here.
WiFiServer server(4998); // Uses port 4998.
WiFiServer server(4998); // Uses port 4998.
WiFiClient client;
unsigned int *codeArray;
IRsend irsend(4); //an IR emitter led is connected to GPIO pin 4
uint16_t *code_array;
#define IR_LED 4 // ESP8266 GPIO pin to use. Recommended: 4 (D2).
void parseString(String str) {
int nextIndex;
int codeLength = 1;
int currentIndex = 0;
nextIndex = str.indexOf(',');
IRsend irsend(IR_LED); // Set the GPIO to be used to sending the message.
// change to do/until and remove superfluous repetition below...
while (nextIndex != -1) {
if (codeLength > 1) {
codeArray = (unsigned int*) realloc(codeArray, codeLength * sizeof(unsigned int));
} else {
codeArray = (unsigned int*) malloc(codeLength * sizeof(unsigned int));
}
void sendGCString(String str) {
int16_t index;
uint16_t count;
codeArray[codeLength-1] = (unsigned int) (str.substring(currentIndex, nextIndex).toInt());
codeLength++;
currentIndex = nextIndex + 1;
nextIndex = str.indexOf(',', currentIndex);
// Find out how many items there are in the string.
index = -1;
count = 1;
do {
index = str.indexOf(',', index + 1);
count++;
} while (index != -1);
// Now we know how many there are, allocate the memory to store them all.
code_array = reinterpret_cast<uint16_t*>(malloc(count * sizeof(uint16_t)));
// Check we malloc'ed successfully.
if (code_array == NULL) { // malloc failed, so give up.
Serial.printf("\nCan't allocate %d bytes. (%d bytes free)\n",
count * sizeof(uint16_t), ESP.getFreeHeap());
Serial.println("Giving up & forcing a reboot.");
ESP.restart(); // Reboot.
delay(500); // Wait for the restart to happen.
return; // Should never get here, but just in case.
}
codeArray = (unsigned int*) realloc(codeArray, codeLength * sizeof(unsigned int));
codeArray[codeLength-1] = (unsigned int) (str.substring(currentIndex, nextIndex).toInt());
irsend.sendGC(codeArray,codeLength);
// Now convert the strings to integers and place them in code_array.
count = 0;
uint16_t start_from = 0;
do {
index = str.indexOf(',', start_from);
code_array[count] = str.substring(start_from, index).toInt();
start_from = index + 1;
count++;
} while (index != -1);
#if SEND_GLOBALCACHE
irsend.sendGC(code_array, count); // All done. Send it.
#endif // SEND_GLOBALCACHE
free(code_array); // Free up the memory allocated.
}
void setup() {
// initialize serial:
Serial.begin(115200);
delay(100);
Serial.println(" ");
Serial.println("IR TCP Server");
while (WiFi.status() != WL_CONNECTED) {
WiFi.begin(kSsid, kPassword);
while (WiFi.status() != WL_CONNECTED) {
delay(900);
Serial.print(".");
}
server.begin();
IPAddress myAddress = WiFi.localIP();
Serial.println(myAddress);
irsend.begin();
server.begin();
IPAddress myAddress = WiFi.localIP();
Serial.println(myAddress.toString());
irsend.begin();
}
void loop() {
while(!client) {
while (!client)
client = server.available();
}
while(!client.connected()){
while (!client.connected()) {
delay(900);
client = server.available();
}
if(client.available()){
String irCode = client.readStringUntil('\r'); // Exclusive of \r
client.readStringUntil('\n'); // Skip new line as well
if (client.available()) {
String ir_code_str = client.readStringUntil('\r'); // Exclusive of \r
client.readStringUntil('\n'); // Skip new line as well
client.flush();
parseString(irCode);
}
}
sendGCString(ir_code_str);
}
}
@@ -0,0 +1,17 @@
[platformio]
lib_extra_dirs = ../../
src_dir=.
[common]
build_flags =
lib_deps_builtin =
lib_deps_external =
[env:nodemcuv2]
platform = espressif8266
framework = arduino
board = nodemcuv2
build_flags = ${common.build_flags}
lib_deps =
${common.lib_deps_builtin}
${common.lib_deps_external}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,28 @@
[platformio]
lib_extra_dirs = ../../
src_dir=.
[common]
build_flags = -DMQTT_MAX_PACKET_SIZE=512
lib_deps_builtin =
lib_deps_external =
PubSubClient
WifiManager@0.14
[env:nodemcuv2]
platform = espressif8266
framework = arduino
board = nodemcuv2
build_flags = ${common.build_flags}
lib_deps =
${common.lib_deps_builtin}
${common.lib_deps_external}
[env:d1_mini]
platform=espressif8266
framework=arduino
board=d1_mini
build_flags = ${common.build_flags}
lib_deps =
${common.lib_deps_builtin}
${common.lib_deps_external}
@@ -1,39 +1,78 @@
/*
* IRremoteESP8266: IRServer - demonstrates sending IR codes controlled from a webserver
* An IR LED must be connected to ESP8266 pin 0.
* Version 0.1 June, 2015
* Version 0.2 June, 2017
* Copyright 2015 Mark Szabo
*
* An IR LED circuit *MUST* be connected to the ESP8266 on a pin
* as specified by kIrLed below.
*
* TL;DR: The IR LED needs to be driven by a transistor for a good result.
*
* Suggested circuit:
* https://github.com/markszabo/IRremoteESP8266/wiki#ir-sending
*
* Common mistakes & tips:
* * Don't just connect the IR LED directly to the pin, it won't
* have enough current to drive the IR LED effectively.
* * Make sure you have the IR LED polarity correct.
* See: https://learn.sparkfun.com/tutorials/polarity/diode-and-led-polarity
* * Typical digital camera/phones can be used to see if the IR LED is flashed.
* Replace the IR LED with a normal LED if you don't have a digital camera
* when debugging.
* * Avoid using the following pins unless you really know what you are doing:
* * Pin 0/D3: Can interfere with the boot/program mode & support circuits.
* * Pin 1/TX/TXD0: Any serial transmissions from the ESP8266 will interfere.
* * Pin 3/RX/RXD0: Any serial transmissions to the ESP8266 will interfere.
* * ESP-01 modules are tricky. We suggest you use a module with more GPIOs
* for your first time. e.g. ESP-12 etc.
*/
#ifndef UNIT_TEST
#include <Arduino.h>
#endif
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>
#include <IRremoteESP8266.h>
const char* ssid = ".....";
const char* password = ".....";
#include <IRsend.h>
#include <WiFiClient.h>
const char* kSsid = ".....";
const char* kPassword = ".....";
MDNSResponder mdns;
ESP8266WebServer server(80);
IRsend irsend(0);
const uint16_t kIrLed = 4; // ESP8266 GPIO pin to use. Recommended: 4 (D2).
IRsend irsend(kIrLed); // Set the GPIO to be used to sending the message.
void handleRoot() {
server.send(200, "text/html", "<html><head> <title>ESP8266 Demo</title></head><body><h1>Hello from ESP8266, you can send NEC encoded IR signals from here!</h1><p><a href=\"ir?code=16769055\">Send 0xFFE01F</a></p><p><a href=\"ir?code=16429347\">Send 0xFAB123</a></p><p><a href=\"ir?code=16771222\">Send 0xFFE896</a></p></body></html>");
server.send(200, "text/html",
"<html>" \
"<head><title>ESP8266 Demo</title></head>" \
"<body>" \
"<h1>Hello from ESP8266, you can send NEC encoded IR" \
"signals from here!</h1>" \
"<p><a href=\"ir?code=16769055\">Send 0xFFE01F</a></p>" \
"<p><a href=\"ir?code=16429347\">Send 0xFAB123</a></p>" \
"<p><a href=\"ir?code=16771222\">Send 0xFFE896</a></p>" \
"</body>" \
"</html>");
}
void handleIr(){
for (uint8_t i=0; i<server.args(); i++){
if(server.argName(i) == "code")
{
unsigned long code = strtoul(server.arg(i).c_str(), NULL, 10);
void handleIr() {
for (uint8_t i = 0; i < server.args(); i++) {
if (server.argName(i) == "code") {
uint32_t code = strtoul(server.arg(i).c_str(), NULL, 10);
#if SEND_NEC
irsend.sendNEC(code, 32);
#endif // SEND_NEC
}
}
handleRoot();
}
void handleNotFound(){
void handleNotFound() {
String message = "File Not Found\n\n";
message += "URI: ";
message += server.uri();
@@ -42,17 +81,16 @@ void handleNotFound(){
message += "\nArguments: ";
message += server.args();
message += "\n";
for (uint8_t i=0; i<server.args(); i++){
message += " " + server.argName(i) + ": " + server.arg(i) + "\n";
}
for (uint8_t i = 0; i < server.args(); i++)
message += ' ' + server.argName(i) + ": " + server.arg(i) + "\n";
server.send(404, "text/plain", message);
}
void setup(void){
void setup(void) {
irsend.begin();
Serial.begin(115200);
WiFi.begin(ssid, password);
WiFi.begin(kSsid, kPassword);
Serial.println("");
// Wait for connection
@@ -62,27 +100,27 @@ void setup(void){
}
Serial.println("");
Serial.print("Connected to ");
Serial.println(ssid);
Serial.println(kSsid);
Serial.print("IP address: ");
Serial.println(WiFi.localIP());
Serial.println(WiFi.localIP().toString());
if (mdns.begin("esp8266", WiFi.localIP())) {
Serial.println("MDNS responder started");
}
server.on("/", handleRoot);
server.on("/ir", handleIr);
server.on("/ir", handleIr);
server.on("/inline", [](){
server.send(200, "text/plain", "this works as well");
});
server.onNotFound(handleNotFound);
server.begin();
Serial.println("HTTP server started");
}
void loop(void){
void loop(void) {
server.handleClient();
}
}
@@ -0,0 +1,17 @@
[platformio]
lib_extra_dirs = ../../
src_dir=.
[common]
build_flags =
lib_deps_builtin =
lib_deps_external =
[env:nodemcuv2]
platform = espressif8266
framework = arduino
board = nodemcuv2
build_flags = ${common.build_flags}
lib_deps =
${common.lib_deps_builtin}
${common.lib_deps_external}
@@ -1,28 +1,52 @@
/*
* IRremoteESP8266: IRrecvDemo - demonstrates receiving IR codes with IRrecv
* An IR detector/demodulator must be connected to the input RECV_PIN.
* Version 0.1 Sept, 2015
* Based on Ken Shirriff's IrsendDemo Version 0.1 July, 2009, Copyright 2009 Ken Shirriff, http://arcfn.com
* This is very simple teaching code to show you how to use the library.
* If you are trying to decode your Infra-Red remote(s) for later replay,
* use the IRrecvDumpV2.ino example code instead of this.
* An IR detector/demodulator must be connected to the input kRecvPin.
* Copyright 2009 Ken Shirriff, http://arcfn.com
* Example circuit diagram:
* https://github.com/markszabo/IRremoteESP8266/wiki#ir-receiving
* Changes:
* Version 0.2 June, 2017
* Changed GPIO pin to the same as other examples.
* Used our own method for printing a uint64_t.
* Changed the baud rate to 115200.
* Version 0.1 Sept, 2015
* Based on Ken Shirriff's IrsendDemo Version 0.1 July, 2009
*/
#ifndef UNIT_TEST
#include <Arduino.h>
#endif
#include <IRremoteESP8266.h>
#include <IRrecv.h>
#include <IRutils.h>
int RECV_PIN = 2; //an IR detector/demodulatord is connected to GPIO pin 2
// An IR detector/demodulator is connected to GPIO pin 14(D5 on a NodeMCU
// board).
const uint16_t kRecvPin = 14;
IRrecv irrecv(RECV_PIN);
IRrecv irrecv(kRecvPin);
decode_results results;
void setup()
{
Serial.begin(9600);
irrecv.enableIRIn(); // Start the receiver
void setup() {
Serial.begin(115200);
irrecv.enableIRIn(); // Start the receiver
while (!Serial) // Wait for the serial connection to be establised.
delay(50);
Serial.println();
Serial.print("IRrecvDemo is now running and waiting for IR message on Pin ");
Serial.println(kRecvPin);
}
void loop() {
if (irrecv.decode(&results)) {
Serial.println(results.value, HEX);
irrecv.resume(); // Receive the next value
// print() & println() can't handle printing long longs. (uint64_t)
serialPrintUint64(results.value, HEX);
Serial.println("");
irrecv.resume(); // Receive the next value
}
delay(100);
}
@@ -0,0 +1,17 @@
[platformio]
lib_extra_dirs = ../../
src_dir=.
[common]
build_flags =
lib_deps_builtin =
lib_deps_external =
[env:nodemcuv2]
platform = espressif8266
framework = arduino
board = nodemcuv2
build_flags = ${common.build_flags}
lib_deps =
${common.lib_deps_builtin}
${common.lib_deps_external}
@@ -1,89 +1,104 @@
/*
* IRremoteESP8266: IRrecvDump - dump details of IR codes with IRrecv
* Copyright 2009 Ken Shirriff, http://arcfn.com
*
***** DEPRECATED - DO NOT USE *****
* Unless you know what you are doing, you should be using the
* IRrecvDumpV2.ino sketch/example instead for capturing & decoding IR messages.
* In almost ALL ways it is BETTER, FASTER, and MORE DETAILED.
*
* This code is left only for legacy reasons, and as another simple example of
* how to use the IRremoteESP8266 library.
*
* As of November 2017 it will no longer be updated or supported.
* You have been warned.
***** DEPRECATED - DO NOT USE *****
*
* An IR detector/demodulator must be connected to the input RECV_PIN.
* Version 0.1 Sept, 2015
* Based on Ken Shirriff's IrsendDemo Version 0.1 July, 2009, Copyright 2009 Ken Shirriff, http://arcfn.com
* JVC and Panasonic protocol added by Kristian Lauszus (Thanks to zenwheel and other people at the original blog post)
* Version 0.2 Oct 2017
* Based on Ken Shirriff's IrsendDemo Version 0.1 July, 2009,
* JVC and Panasonic protocol added by Kristian Lauszus
* (Thanks to zenwheel and other people at the original blog post)
* LG added by Darryl Smith (based on the JVC protocol)
*/
#ifndef UNIT_TEST
#include <Arduino.h>
#endif
#include <IRremoteESP8266.h>
#include <IRrecv.h>
#include <IRutils.h>
int RECV_PIN = 2; //an IR detector/demodulatord is connected to GPIO pin 2
// an IR detector/demodulator is connected to GPIO pin 2
uint16_t RECV_PIN = 2;
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup()
{
Serial.begin(9600);
irrecv.enableIRIn(); // Start the receiver
void setup() {
Serial.begin(115200);
irrecv.enableIRIn(); // Start the receiver
}
void dump(decode_results *results) {
// Dumps out the decode_results structure.
// Call this after IRrecv::decode()
int count = results->rawlen;
uint16_t count = results->rawlen;
if (results->decode_type == UNKNOWN) {
Serial.print("Unknown encoding: ");
}
else if (results->decode_type == NEC) {
} else if (results->decode_type == NEC) {
Serial.print("Decoded NEC: ");
}
else if (results->decode_type == SONY) {
} else if (results->decode_type == SONY) {
Serial.print("Decoded SONY: ");
}
else if (results->decode_type == RC5) {
} else if (results->decode_type == RC5) {
Serial.print("Decoded RC5: ");
}
else if (results->decode_type == RC6) {
} else if (results->decode_type == RC5X) {
Serial.print("Decoded RC5X: ");
} else if (results->decode_type == RC6) {
Serial.print("Decoded RC6: ");
}
else if (results->decode_type == PANASONIC) {
} else if (results->decode_type == RCMM) {
Serial.print("Decoded RCMM: ");
} else if (results->decode_type == PANASONIC) {
Serial.print("Decoded PANASONIC - Address: ");
Serial.print(results->panasonicAddress, HEX);
Serial.print(results->address, HEX);
Serial.print(" Value: ");
}
else if (results->decode_type == LG) {
} else if (results->decode_type == LG) {
Serial.print("Decoded LG: ");
}
else if (results->decode_type == JVC) {
} else if (results->decode_type == JVC) {
Serial.print("Decoded JVC: ");
}
else if (results->decode_type == AIWA_RC_T501) {
} else if (results->decode_type == AIWA_RC_T501) {
Serial.print("Decoded AIWA RC T501: ");
}
else if (results->decode_type == WHYNTER) {
} else if (results->decode_type == WHYNTER) {
Serial.print("Decoded Whynter: ");
} else if (results->decode_type == NIKAI) {
Serial.print("Decoded Nikai: ");
}
Serial.print(results->value, HEX);
serialPrintUint64(results->value, 16);
Serial.print(" (");
Serial.print(results->bits, DEC);
Serial.println(" bits)");
Serial.print("Raw (");
Serial.print(count, DEC);
Serial.print("): ");
Serial.print("): {");
for (int i = 1; i < count; i++) {
for (uint16_t i = 1; i < count; i++) {
if (i % 100 == 0)
yield(); // Preemptive yield every 100th entry to feed the WDT.
if (i & 1) {
Serial.print(results->rawbuf[i]*USECPERTICK, DEC);
Serial.print(results->rawbuf[i] * kRawTick, DEC);
} else {
Serial.print(", ");
Serial.print((uint32_t) results->rawbuf[i] * kRawTick, DEC);
}
else {
Serial.write('-');
Serial.print((unsigned long) results->rawbuf[i]*USECPERTICK, DEC);
}
Serial.print(" ");
}
Serial.println();
Serial.println("};");
}
void loop() {
if (irrecv.decode(&results)) {
Serial.println(results.value, HEX);
dump(&results);
irrecv.resume(); // Receive the next value
Serial.println("DEPRECATED: Please use IRrecvDumpV2.ino instead!");
irrecv.resume(); // Receive the next value
}
}
@@ -0,0 +1,17 @@
[platformio]
lib_extra_dirs = ../../
src_dir=.
[common]
build_flags =
lib_deps_builtin =
lib_deps_external =
[env:nodemcuv2]
platform = espressif8266
framework = arduino
board = nodemcuv2
build_flags = ${common.build_flags}
lib_deps =
${common.lib_deps_builtin}
${common.lib_deps_external}
@@ -1,173 +1,254 @@
/*
* IRremoteESP8266: IRrecvDumpV2 - dump details of IR codes with IRrecv
* An IR detector/demodulator must be connected to the input RECV_PIN.
* An IR detector/demodulator must be connected to the input kRecvPin.
*
* Copyright 2009 Ken Shirriff, http://arcfn.com
* Copyright 2017 David Conran
*
* Example circuit diagram:
* https://github.com/markszabo/IRremoteESP8266/wiki#ir-receiving
*
* Changes:
* Version 0.4 July, 2018
* - Minor improvements and more A/C unit support.
* Version 0.3 November, 2017
* - Support for A/C decoding for some protcols.
* Version 0.2 April, 2017
* - Decode from a copy of the data so we can start capturing faster thus
* reduce the likelihood of miscaptures.
* Based on Ken Shirriff's IrsendDemo Version 0.1 July, 2009, Copyright 2009 Ken Shirriff, http://arcfn.com
* Based on Ken Shirriff's IrsendDemo Version 0.1 July, 2009,
*/
#ifndef UNIT_TEST
#include <Arduino.h>
#endif
#include <IRrecv.h>
#include <IRremoteESP8266.h>
#include <IRutils.h>
// The following are only needed for extended decoding of A/C Messages
#include <ir_Coolix.h>
#include <ir_Daikin.h>
#include <ir_Fujitsu.h>
#include <ir_Gree.h>
#include <ir_Haier.h>
#include <ir_Kelvinator.h>
#include <ir_Midea.h>
#include <ir_Mitsubishi.h>
#include <ir_Panasonic.h>
#include <ir_Samsung.h>
#include <ir_Toshiba.h>
// An IR detector/demodulator is connected to GPIO pin 14(D5 on a NodeMCU board).
int RECV_PIN = 14;
// ==================== start of TUNEABLE PARAMETERS ====================
// An IR detector/demodulator is connected to GPIO pin 14
// e.g. D5 on a NodeMCU board.
const uint16_t kRecvPin = 14;
IRrecv irrecv(RECV_PIN);
// The Serial connection baud rate.
// i.e. Status message will be sent to the PC at this baud rate.
// Try to avoid slow speeds like 9600, as you will miss messages and
// cause other problems. 115200 (or faster) is recommended.
// NOTE: Make sure you set your Serial Monitor to the same speed.
const uint32_t kBaudRate = 115200;
decode_results results; // Somewhere to store the results
irparams_t save; // A place to copy the interrupt state while decoding.
// As this program is a special purpose capture/decoder, let us use a larger
// than normal buffer so we can handle Air Conditioner remote codes.
const uint16_t kCaptureBufferSize = 1024;
// kTimeout is the Nr. of milli-Seconds of no-more-data before we consider a
// message ended.
// This parameter is an interesting trade-off. The longer the timeout, the more
// complex a message it can capture. e.g. Some device protocols will send
// multiple message packets in quick succession, like Air Conditioner remotes.
// Air Coniditioner protocols often have a considerable gap (20-40+ms) between
// packets.
// The downside of a large timeout value is a lot of less complex protocols
// send multiple messages when the remote's button is held down. The gap between
// them is often also around 20+ms. This can result in the raw data be 2-3+
// times larger than needed as it has captured 2-3+ messages in a single
// capture. Setting a low timeout value can resolve this.
// So, choosing the best kTimeout value for your use particular case is
// quite nuanced. Good luck and happy hunting.
// NOTE: Don't exceed kMaxTimeoutMs. Typically 130ms.
#if DECODE_AC
// Some A/C units have gaps in their protocols of ~40ms. e.g. Kelvinator
// A value this large may swallow repeats of some protocols
const uint8_t kTimeout = 50;
#else // DECODE_AC
// Suits most messages, while not swallowing many repeats.
const uint8_t kTimeout = 15;
#endif // DECODE_AC
// Alternatives:
// const uint8_t kTimeout = 90;
// Suits messages with big gaps like XMP-1 & some aircon units, but can
// accidentally swallow repeated messages in the rawData[] output.
//
// const uint8_t kTimeout = kMaxTimeoutMs;
// This will set it to our currently allowed maximum.
// Values this high are problematic because it is roughly the typical boundary
// where most messages repeat.
// e.g. It will stop decoding a message and start sending it to serial at
// precisely the time when the next message is likely to be transmitted,
// and may miss it.
// Set the smallest sized "UNKNOWN" message packets we actually care about.
// This value helps reduce the false-positive detection rate of IR background
// noise as real messages. The chances of background IR noise getting detected
// as a message increases with the length of the kTimeout value. (See above)
// The downside of setting this message too large is you can miss some valid
// short messages for protocols that this library doesn't yet decode.
//
// Set higher if you get lots of random short UNKNOWN messages when nothing
// should be sending a message.
// Set lower if you are sure your setup is working, but it doesn't see messages
// from your device. (e.g. Other IR remotes work.)
// NOTE: Set this value very high to effectively turn off UNKNOWN detection.
const uint16_t kMinUnknownSize = 12;
// ==================== end of TUNEABLE PARAMETERS ====================
// Use turn on the save buffer feature for more complete capture coverage.
IRrecv irrecv(kRecvPin, kCaptureBufferSize, kTimeout, true);
decode_results results; // Somewhere to store the results
// Display the human readable state of an A/C message if we can.
void dumpACInfo(decode_results *results) {
String description = "";
#if DECODE_DAIKIN
if (results->decode_type == DAIKIN) {
IRDaikinESP ac(0);
ac.setRaw(results->state);
description = ac.toString();
}
#endif // DECODE_DAIKIN
#if DECODE_FUJITSU_AC
if (results->decode_type == FUJITSU_AC) {
IRFujitsuAC ac(0);
ac.setRaw(results->state, results->bits / 8);
description = ac.toString();
}
#endif // DECODE_FUJITSU_AC
#if DECODE_KELVINATOR
if (results->decode_type == KELVINATOR) {
IRKelvinatorAC ac(0);
ac.setRaw(results->state);
description = ac.toString();
}
#endif // DECODE_KELVINATOR
#if DECODE_MITSUBISHI_AC
if (results->decode_type == MITSUBISHI_AC) {
IRMitsubishiAC ac(0);
ac.setRaw(results->state);
description = ac.toString();
}
#endif // DECODE_MITSUBISHI_AC
#if DECODE_TOSHIBA_AC
if (results->decode_type == TOSHIBA_AC) {
IRToshibaAC ac(0);
ac.setRaw(results->state);
description = ac.toString();
}
#endif // DECODE_TOSHIBA_AC
#if DECODE_GREE
if (results->decode_type == GREE) {
IRGreeAC ac(0);
ac.setRaw(results->state);
description = ac.toString();
}
#endif // DECODE_GREE
#if DECODE_MIDEA
if (results->decode_type == MIDEA) {
IRMideaAC ac(0);
ac.setRaw(results->value); // Midea uses value instead of state.
description = ac.toString();
}
#endif // DECODE_MIDEA
#if DECODE_HAIER_AC
if (results->decode_type == HAIER_AC) {
IRHaierAC ac(0);
ac.setRaw(results->state);
description = ac.toString();
}
#endif // DECODE_HAIER_AC
#if DECODE_HAIER_AC_YRW02
if (results->decode_type == HAIER_AC_YRW02) {
IRHaierACYRW02 ac(0);
ac.setRaw(results->state);
description = ac.toString();
}
#endif // DECODE_HAIER_AC_YRW02
#if DECODE_SAMSUNG_AC
if (results->decode_type == SAMSUNG_AC) {
IRSamsungAc ac(0);
ac.setRaw(results->state);
description = ac.toString();
}
#endif // DECODE_SAMSUNG_AC
#if DECODE_COOLIX
if (results->decode_type == COOLIX) {
IRCoolixAC ac(0);
ac.setRaw(results->value); // Coolix uses value instead of state.
description = ac.toString();
}
#endif // DECODE_COOLIX
#if DECODE_PANASONIC_AC
if (results->decode_type == PANASONIC_AC &&
results->bits > kPanasonicAcShortBits) {
IRPanasonicAc ac(0);
ac.setRaw(results->state);
description = ac.toString();
}
#endif // DECODE_PANASONIC_AC
// If we got a human-readable description of the message, display it.
if (description != "") Serial.println("Mesg Desc.: " + description);
}
// The section of code run only once at start-up.
void setup() {
Serial.begin(115200, SERIAL_8N1, SERIAL_TX_ONLY); // Status message will be sent to the PC at 115200 baud
Serial.begin(kBaudRate, SERIAL_8N1, SERIAL_TX_ONLY);
while (!Serial) // Wait for the serial connection to be establised.
delay(50);
Serial.println();
Serial.print("IRrecvDumpV2 is now running and waiting for IR input on Pin ");
Serial.println(kRecvPin);
#if DECODE_HASH
// Ignore messages with less than minimum on or off pulses.
irrecv.setUnknownThreshold(kMinUnknownSize);
#endif // DECODE_HASH
irrecv.enableIRIn(); // Start the receiver
}
//+=============================================================================
// Display IR code
//
void ircode(decode_results *results) {
// Panasonic has an Address
if (results->decode_type == PANASONIC) {
Serial.print(results->panasonicAddress, HEX);
Serial.print(":");
}
// Print Code
Serial.print(results->value, HEX);
}
//+=============================================================================
// Display encoding type
//
void encoding(decode_results *results) {
switch (results->decode_type) {
default:
case UNKNOWN: Serial.print("UNKNOWN"); break ;
case NEC: Serial.print("NEC"); break ;
case SONY: Serial.print("SONY"); break ;
case RC5: Serial.print("RC5"); break ;
case RC6: Serial.print("RC6"); break ;
case DISH: Serial.print("DISH"); break ;
case SHARP: Serial.print("SHARP"); break ;
case JVC: Serial.print("JVC"); break ;
case SANYO: Serial.print("SANYO"); break ;
case MITSUBISHI: Serial.print("MITSUBISHI"); break ;
case SAMSUNG: Serial.print("SAMSUNG"); break ;
case LG: Serial.print("LG"); break ;
case WHYNTER: Serial.print("WHYNTER"); break ;
case AIWA_RC_T501: Serial.print("AIWA_RC_T501"); break ;
case PANASONIC: Serial.print("PANASONIC"); break ;
case DENON: Serial.print("DENON"); break ;
}
}
//+=============================================================================
// Dump out the decode_results structure.
//
void dumpInfo (decode_results *results) {
if (results->overflow) {
Serial.println("IR code too long. Edit IRremoteInt.h and increase RAWBUF");
return;
}
// Show Encoding standard
Serial.print("Encoding : ");
encoding(results);
Serial.println("");
// Show Code & length
Serial.print("Code : ");
ircode(results);
Serial.print(" (");
Serial.print(results->bits, DEC);
Serial.println(" bits)");
}
//+=============================================================================
// Dump out the decode_results structure.
//
void dumpRaw(decode_results *results) {
// Print Raw data
Serial.print("Timing[");
Serial.print(results->rawlen-1, DEC);
Serial.println("]: ");
for (int i = 1; i < results->rawlen; i++) {
unsigned long x = results->rawbuf[i] * USECPERTICK;
if (!(i & 1)) { // even
Serial.print("-");
if (x < 1000) Serial.print(" ") ;
if (x < 100) Serial.print(" ") ;
Serial.print(x, DEC);
} else { // odd
Serial.print(" ");
Serial.print("+");
if (x < 1000) Serial.print(" ") ;
if (x < 100) Serial.print(" ") ;
Serial.print(x, DEC);
if (i < results->rawlen-1) Serial.print(", "); //',' not needed for last one
}
if (!(i % 8)) Serial.println("");
}
Serial.println(""); // Newline
}
//+=============================================================================
// Dump out the decode_results structure.
//
void dumpCode (decode_results *results) {
// Start declaration
Serial.print("unsigned int "); // variable type
Serial.print("rawData["); // array name
Serial.print(results->rawlen - 1, DEC); // array size
Serial.print("] = {"); // Start declaration
// Dump data
for (int i = 1; i < results->rawlen; i++) {
Serial.print(results->rawbuf[i] * USECPERTICK, DEC);
if ( i < results->rawlen-1 ) Serial.print(","); // ',' not needed on last one
if (!(i & 1)) Serial.print(" ");
}
// End declaration
Serial.print("};"); //
// Comment
Serial.print(" // ");
encoding(results);
Serial.print(" ");
ircode(results);
// Newline
Serial.println("");
// Now dump "known" codes
if (results->decode_type != UNKNOWN) {
// Some protocols have an address
if (results->decode_type == PANASONIC) {
Serial.print("unsigned int addr = 0x");
Serial.print(results->panasonicAddress, HEX);
Serial.println(";");
}
// All protocols have data
Serial.print("unsigned int data = 0x");
Serial.print(results->value, HEX);
Serial.println(";");
}
}
//+=============================================================================
// The repeating section of the code
//
void loop() {
// Check if the IR code has been received.
if (irrecv.decode(&results, &save)) {
dumpInfo(&results); // Output the results
dumpRaw(&results); // Output the results in RAW format
dumpCode(&results); // Output the results as source code
Serial.println(""); // Blank line between entries
if (irrecv.decode(&results)) {
// Display a crude timestamp.
uint32_t now = millis();
Serial.printf("Timestamp : %06u.%03u\n", now / 1000, now % 1000);
if (results.overflow)
Serial.printf(
"WARNING: IR code is too big for buffer (>= %d). "
"This result shouldn't be trusted until this is resolved. "
"Edit & increase kCaptureBufferSize.\n",
kCaptureBufferSize);
// Display the basic output of what we found.
Serial.print(resultToHumanReadableBasic(&results));
dumpACInfo(&results); // Display any extra A/C info if we have it.
yield(); // Feed the WDT as the text output can take a while to print.
// Display the library version the message was captured with.
Serial.print("Library : v");
Serial.println(_IRREMOTEESP8266_VERSION_);
Serial.println();
// Output RAW timing info of the result.
Serial.println(resultToTimingInfo(&results));
yield(); // Feed the WDT (again)
// Output the results as source code
Serial.println(resultToSourceCode(&results));
Serial.println(""); // Blank line between entries
yield(); // Feed the WDT (again)
}
}
@@ -0,0 +1,17 @@
[platformio]
lib_extra_dirs = ../../
src_dir=.
[common]
build_flags =
lib_deps_builtin =
lib_deps_external =
[env:nodemcuv2]
platform = espressif8266
framework = arduino
board = nodemcuv2
build_flags = ${common.build_flags}
lib_deps =
${common.lib_deps_builtin}
${common.lib_deps_external}
@@ -1,10 +1,14 @@
/*
* IRremoteESP8266: IRsendDemo - demonstrates sending IR codes with IRsend.
/* IRremoteESP8266: IRsendDemo - demonstrates sending IR codes with IRsend.
*
* An IR LED circuit *MUST* be connected to ESP8266 pin 4 (D2).
* Version 1.0 April, 2017
* Based on Ken Shirriff's IrsendDemo Version 0.1 July, 2009,
* Copyright 2009 Ken Shirriff, http://arcfn.com
*
* An IR LED circuit *MUST* be connected to the ESP8266 on a pin
* as specified by kIrLed below.
*
* TL;DR: The IR LED needs to be driven by a transistor for a good result.
*
*
* Suggested circuit:
* https://github.com/markszabo/IRremoteESP8266/wiki#ir-sending
*
@@ -22,26 +26,46 @@
* * Pin 3/RX/RXD0: Any serial transmissions to the ESP8266 will interfere.
* * ESP-01 modules are tricky. We suggest you use a module with more GPIOs
* for your first time. e.g. ESP-12 etc.
*
* Version 1.0 April, 2017
* Based on Ken Shirriff's IrsendDemo Version 0.1 July, 2009, Copyright 2009 Ken Shirriff, http://arcfn.com
*/
#ifndef UNIT_TEST
#include <Arduino.h>
#endif
#include <IRremoteESP8266.h>
#include <IRsend.h>
IRsend irsend(4); //an IR led is connected to GPIO pin 4 (D2)
const uint16_t kIrLed = 4; // ESP8266 GPIO pin to use. Recommended: 4 (D2).
void setup()
{
IRsend irsend(kIrLed); // Set the GPIO to be used to sending the message.
// Example of data captured by IRrecvDumpV2.ino
uint16_t rawData[67] = {9000, 4500, 650, 550, 650, 1650, 600, 550, 650, 550,
600, 1650, 650, 550, 600, 1650, 650, 1650, 650, 1650,
600, 550, 650, 1650, 650, 1650, 650, 550, 600, 1650,
650, 1650, 650, 550, 650, 550, 650, 1650, 650, 550,
650, 550, 650, 550, 600, 550, 650, 550, 650, 550,
650, 1650, 600, 550, 650, 1650, 650, 1650, 650, 1650,
650, 1650, 650, 1650, 650, 1650, 600};
void setup() {
irsend.begin();
Serial.begin(115200, SERIAL_8N1, SERIAL_TX_ONLY);
}
void loop() {
#if SEND_NEC
Serial.println("NEC");
irsend.sendNEC(0x00FFE01FUL, 32);
#endif // SEND_NEC
delay(2000);
#if SEND_SONY
Serial.println("Sony");
irsend.sendSony(0xa90, 12, 2);
#endif // SEND_SONY
delay(2000);
#if SEND_RAW
Serial.println("a rawData capture from IRrecvDumpV2");
irsend.sendRaw(rawData, 67, 38); // Send a raw data capture at 38kHz.
#endif // SEND_RAW
delay(2000);
}
@@ -0,0 +1,17 @@
[platformio]
lib_extra_dirs = ../../
src_dir=.
[common]
build_flags =
lib_deps_builtin =
lib_deps_external =
[env:nodemcuv2]
platform = espressif8266
framework = arduino
board = nodemcuv2
build_flags = ${common.build_flags}
lib_deps =
${common.lib_deps_builtin}
${common.lib_deps_external}
@@ -0,0 +1,112 @@
/* IRremoteESP8266: IRsendProntoDemo
* Copyright 2017 David Conran
*
* Demonstrates sending Pronto codes with IRsend.
*
* Version 1.0 June, 2017
*
* An IR LED circuit *MUST* be connected to ESP8266 pin 4 (D2), unless you
* change the kIrLed value below.
*
* TL;DR: The IR LED needs to be driven by a transistor for a good result.
*
* Suggested circuit:
* https://github.com/markszabo/IRremoteESP8266/wiki#ir-sending
*
* Common mistakes & tips:
* * Don't just connect the IR LED directly to the pin, it won't
* have enough current to drive the IR LED effectively.
* * Make sure you have the IR LED polarity correct.
* See: https://learn.sparkfun.com/tutorials/polarity/diode-and-led-polarity
* * Typical digital camera/phones can be used to see if the IR LED is flashed.
* Replace the IR LED with a normal LED if you don't have a digital camera
* when debugging.
* * Avoid using the following pins unless you really know what you are doing:
* * Pin 0/D3: Can interfere with the boot/program mode & support circuits.
* * Pin 1/TX/TXD0: Any serial transmissions from the ESP8266 will interfere.
* * Pin 3/RX/RXD0: Any serial transmissions to the ESP8266 will interfere.
* * ESP-01 modules are tricky. We suggest you use a module with more GPIOs
* for your first time. e.g. ESP-12 etc.
*/
#ifndef UNIT_TEST
#include <Arduino.h>
#endif
#include <IRremoteESP8266.h>
#include <IRsend.h>
const uint16_t kIrLed = 4; // ESP8266 GPIO pin to use. Recommended: 4 (D2).
IRsend irsend(kIrLed); // Set the GPIO to be used to sending the message.
// Panasonic Plasma TV Descrete code (Power On).
// Acquired from:
// https://irdb.globalcache.com/
// e.g.
// 0000 006D 0000 0022 00ac 00ac 0016 0040 0016 0040 0016 0040 0016 0015 0016
// 0015 0016 0015 0016 0015 0016 0015 0016 0040 0016 0040 0016 0040 0016 0015
// 0016 0015 0016 0015 0016 0015 0016 0015 0016 0040 0016 0015 0016 0015 0016
// 0040 0016 0040 0016 0015 0016 0015 0016 0040 0016 0015 0016 0040 0016 0040
// 0016 0015 0016 0015 0016 0040 0016 0040 0016 0015 0016 071c
//
// Or the equiv. of sendSamsung(0xE0E09966);
uint16_t samsungProntoCode[72] = {
0x0000, 0x006D, 0x0000, 0x0022,
0x00ac, 0x00ac, 0x0016, 0x0040, 0x0016, 0x0040, 0x0016, 0x0040,
0x0016, 0x0015, 0x0016, 0x0015, 0x0016, 0x0015, 0x0016, 0x0015,
0x0016, 0x0015, 0x0016, 0x0040, 0x0016, 0x0040, 0x0016, 0x0040,
0x0016, 0x0015, 0x0016, 0x0015, 0x0016, 0x0015, 0x0016, 0x0015,
0x0016, 0x0015, 0x0016, 0x0040, 0x0016, 0x0015, 0x0016, 0x0015,
0x0016, 0x0040, 0x0016, 0x0040, 0x0016, 0x0015, 0x0016, 0x0015,
0x0016, 0x0040, 0x0016, 0x0015, 0x0016, 0x0040, 0x0016, 0x0040,
0x0016, 0x0015, 0x0016, 0x0015, 0x0016, 0x0040, 0x0016, 0x0040,
0x0016, 0x0015, 0x0016, 0x071c
};
// Panasonic Plasma TV Descrete code (Power On).
// Acquired from:
// ftp://ftp.panasonic.com/pub/panasonic/drivers/monitors/Discrete-remote-control-codesProntoCCFformat.pdf
// e.g.
// 0000 0071 0000 0032 0080 003F 0010 0010 0010 0030 0010 0010 0010 0010 0010
// 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010
// 0010 0010 0010 0030 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010
// 0010 0010 0010 0010 0010 0010 0010 0010 0030 0010 0010 0010 0010 0010 0010
// 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0030 0010
// 0030 0010 0030 0010 0030 0010 0030 0010 0010 0010 0010 0010 0010 0010 0030
// 0010 0030 0010 0030 0010 0030 0010 0030 0010 0010 0010 0030 0010 0A98
//
// Or the equiv. of sendPanasonic64(0x400401007C7D);
uint16_t panasonicProntoCode[104] = {
0x0000, 0x0071, 0x0000, 0x0032,
0x0080, 0x003F, 0x0010, 0x0010, 0x0010, 0x0030, 0x0010, 0x0010,
0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010,
0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010,
0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0030, 0x0010, 0x0010,
0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010,
0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010,
0x0010, 0x0030, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010,
0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010,
0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0030, 0x0010, 0x0030,
0x0010, 0x0030, 0x0010, 0x0030, 0x0010, 0x0030, 0x0010, 0x0010,
0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0030, 0x0010, 0x0030,
0x0010, 0x0030, 0x0010, 0x0030, 0x0010, 0x0030, 0x0010, 0x0010,
0x0010, 0x0030, 0x0010, 0x0A98};
void setup() {
irsend.begin();
Serial.begin(115200, SERIAL_8N1, SERIAL_TX_ONLY);
}
void loop() {
#if SEND_PRONTO
Serial.println("Sending a Samsung TV 'on' command.");
irsend.sendPronto(samsungProntoCode, 72);
delay(2000);
Serial.println("Sending a Panasonic Plasma TV 'on' command.");
irsend.sendPronto(panasonicProntoCode, 104);
delay(2000);
#else // SEND_PRONTO
Serial.println("Can't send because SEND_PRONTO has been disabled.");
delay(10000);
#endif // SEND_PRONTO
}
@@ -0,0 +1,17 @@
[platformio]
lib_extra_dirs = ../../
src_dir=.
[common]
build_flags =
lib_deps_builtin =
lib_deps_external =
[env:nodemcuv2]
platform = espressif8266
framework = arduino
board = nodemcuv2
build_flags = ${common.build_flags}
lib_deps =
${common.lib_deps_builtin}
${common.lib_deps_external}
@@ -1,29 +1,63 @@
/*
* IRremoteESP8266: IRsendDemo - demonstrates sending IR codes with IRsend
* An IR LED must be connected to ESP8266 pin 0.
* Version 0.1 June, 2015
* Based on Ken Shirriff's IrsendDemo Version 0.1 July, 2009, Copyright 2009 Ken Shirriff, http://arcfn.com
* JVC and Panasonic protocol added by Kristian Lauszus (Thanks to zenwheel and other people at the original blog post)
*
* An IR LED circuit *MUST* be connected to the ESP8266 on a pin
* as specified by kIrLed below.
*
* TL;DR: The IR LED needs to be driven by a transistor for a good result.
*
* Suggested circuit:
* https://github.com/markszabo/IRremoteESP8266/wiki#ir-sending
*
* Common mistakes & tips:
* * Don't just connect the IR LED directly to the pin, it won't
* have enough current to drive the IR LED effectively.
* * Make sure you have the IR LED polarity correct.
* See: https://learn.sparkfun.com/tutorials/polarity/diode-and-led-polarity
* * Typical digital camera/phones can be used to see if the IR LED is flashed.
* Replace the IR LED with a normal LED if you don't have a digital camera
* when debugging.
* * Avoid using the following pins unless you really know what you are doing:
* * Pin 0/D3: Can interfere with the boot/program mode & support circuits.
* * Pin 1/TX/TXD0: Any serial transmissions from the ESP8266 will interfere.
* * Pin 3/RX/RXD0: Any serial transmissions to the ESP8266 will interfere.
* * ESP-01 modules are tricky. We suggest you use a module with more GPIOs
* for your first time. e.g. ESP-12 etc.
*/
#ifndef UNIT_TEST
#include <Arduino.h>
#endif
#include <IRremoteESP8266.h>
#define PanasonicAddress 0x4004 // Panasonic address (Pre data)
#define PanasonicPower 0x100BCBD // Panasonic Power button
#include <IRsend.h>
#define JVCPower 0xC5E8
const uint16_t kPanasonicAddress = 0x4004; // Panasonic address (Pre data)
const uint32_t kPanasonicPower = 0x100BCBD; // Panasonic Power button
const uint16_t kJVCPower = 0xC5E8;
IRsend irsend(0); //an IR led is connected to GPIO pin 0
const uint16_t kIrLed = 4; // ESP8266 GPIO pin to use. Recommended: 4 (D2).
void setup()
{
irsend.begin();
IRsend irsend(kIrLed); // Set the GPIO to be used to sending the message.
void setup() {
irsend.begin();
}
void loop() {
irsend.sendPanasonic(PanasonicAddress,PanasonicPower); // This should turn your TV on and off
irsend.sendJVC(JVCPower, 16,0); // hex value, 16 bits, no repeat
delayMicroseconds(50); // see http://www.sbprojects.com/knowledge/ir/jvc.php for information
irsend.sendJVC(JVCPower, 16,1); // hex value, 16 bits, repeat
delayMicroseconds(50);
// This should turn your TV on and off
#if SEND_PANASONIC
irsend.sendPanasonic(kPanasonicAddress, kPanasonicPower);
#else // SEND_PANASONIC
Serial.println("Can't send because SEND_PANASONIC has been disabled.");
#endif // SEND_PANASONIC
#if SEND_JVC
irsend.sendJVC(kJVCPower, 16, 1); // hex value, 16 bits, single repeat
#else // SEND_JVC
Serial.println("Can't send because SEND_JVC has been disabled.");
#endif // SEND_JVC
delay(10000); // Wait 10 seconds before we repeat everything.
}
@@ -0,0 +1,17 @@
[platformio]
lib_extra_dirs = ../../
src_dir=.
[common]
build_flags =
lib_deps_builtin =
lib_deps_external =
[env:nodemcuv2]
platform = espressif8266
framework = arduino
board = nodemcuv2
build_flags = ${common.build_flags}
lib_deps =
${common.lib_deps_builtin}
${common.lib_deps_external}
@@ -0,0 +1,263 @@
// Copyright 2015 chaeplin
// Copyright 2017 xpokor22
// This is based on:
// https://github.com/z3t0/Arduino-IRremote/blob/master/examples/LGACSendDemo/LGACSendDemo.ino
#include <IRremoteESP8266.h>
#include <IRsend.h>
IRsend irsend(14); // An IR LED is controlled by GPIO pin 14 (D5)
// 0 : TOWER
// 1 : WALL
const unsigned int kAc_Type = 1;
// 0 : cooling
// 1 : heating
unsigned int ac_heat = 1;
// 0 : off
// 1 : on
unsigned int ac_power_on = 0;
// 0 : off
// 1 : on --> power on
unsigned int ac_air_clean_state = 0;
// temperature : 18 ~ 30
unsigned int ac_temperature = 24;
// 0 : low
// 1 : mid
// 2 : high
// if kAc_Type = 1, 3 : change
unsigned int ac_flow = 0;
const uint8_t kAc_Flow_Tower[3] = {0, 4, 6};
const uint8_t kAc_Flow_Wall[4] = {0, 2, 4, 5};
uint32_t ac_code_to_sent;
void Ac_Send_Code(uint32_t code) {
Serial.print("code to send : ");
Serial.print(code, BIN);
Serial.print(" : ");
Serial.println(code, HEX);
#if SEND_LG
irsend.sendLG(code, 28);
#else // SEND_LG
Serial.println("Can't send because SEND_LG has been disabled.");
#endif // SEND_LG
}
void Ac_Activate(unsigned int temperature, unsigned int air_flow,
unsigned int heat) {
ac_heat = heat;
unsigned int ac_msbits1 = 8;
unsigned int ac_msbits2 = 8;
unsigned int ac_msbits3 = 0;
unsigned int ac_msbits4;
if (ac_heat == 1)
ac_msbits4 = 4; // heating
else
ac_msbits4 = 0; // cooling
unsigned int ac_msbits5 = (temperature < 15) ? 0 : temperature - 15;
unsigned int ac_msbits6 = 0;
if (air_flow <= 2) {
if (kAc_Type == 0)
ac_msbits6 = kAc_Flow_Tower[air_flow];
else
ac_msbits6 = kAc_Flow_Wall[air_flow];
}
// calculating using other values
unsigned int ac_msbits7 = (ac_msbits3 + ac_msbits4 + ac_msbits5 +
ac_msbits6) & B00001111;
ac_code_to_sent = ac_msbits1 << 4;
ac_code_to_sent = (ac_code_to_sent + ac_msbits2) << 4;
ac_code_to_sent = (ac_code_to_sent + ac_msbits3) << 4;
ac_code_to_sent = (ac_code_to_sent + ac_msbits4) << 4;
ac_code_to_sent = (ac_code_to_sent + ac_msbits5) << 4;
ac_code_to_sent = (ac_code_to_sent + ac_msbits6) << 4;
ac_code_to_sent = (ac_code_to_sent + ac_msbits7);
Ac_Send_Code(ac_code_to_sent);
ac_power_on = 1;
ac_temperature = temperature;
ac_flow = air_flow;
}
void Ac_Change_Air_Swing(int air_swing) {
if (kAc_Type == 0) {
if (air_swing == 1)
ac_code_to_sent = 0x881316B;
else
ac_code_to_sent = 0x881317C;
} else {
if (air_swing == 1)
ac_code_to_sent = 0x8813149;
else
ac_code_to_sent = 0x881315A;
}
Ac_Send_Code(ac_code_to_sent);
}
void Ac_Power_Down() {
ac_code_to_sent = 0x88C0051;
Ac_Send_Code(ac_code_to_sent);
ac_power_on = 0;
}
void Ac_Air_Clean(int air_clean) {
if (air_clean == '1')
ac_code_to_sent = 0x88C000C;
else
ac_code_to_sent = 0x88C0084;
Ac_Send_Code(ac_code_to_sent);
ac_air_clean_state = air_clean;
}
void setup() {
Serial.begin(115200);
delay(1000);
irsend.begin();
}
void loop() {
char b = ' ';
Serial.println("# a : mode or temp b : air_flow, temp, swing, clean,"
" cooling/heating");
Serial.println("# 0 : off 0");
Serial.println("# 1 : on 0");
Serial.println("# 2 : air_swing 0 or 1");
Serial.println("# 3 : air_clean 0 or 1");
Serial.println("# 4 : air_flow 0 ~ 2 : flow");
Serial.println("# + : temp + 1");
Serial.println("# - : temp - 1");
Serial.println("# c : cooling");
Serial.println("# h : heating");
Serial.println("# m : change cooling to air clean, air clean to cooling");
Serial.println("a="); // Prompt User for input
while (Serial.available() == 0) { // Wait for user input
}
char a = Serial.read(); // Read user input into a
switch (a) {
case '0':
case '1':
case '+':
case '-':
case 'c':
case 'h':
case 'm':
break;
default:
Serial.println("b="); // Prompt User for input
while (Serial.available() == 0) {}
b = Serial.read();
}
/*
# a : mode or temp b : air_flow, temp, swing, clean, cooling/heating
# 18 ~ 30 : temp 0 ~ 2 : flow // on
# 0 : off 0
# 1 : on 0
# 2 : air_swing 0 or 1
# 3 : air_clean 0 or 1
# 4 : air_flow 0 ~ 3 : flow
# + : temp + 1
# - : temp - 1
# c : cooling
# h : heating
# m : change cooling to air clean, air clean to cooling
*/
Serial.print("a : ");
Serial.print(a);
Serial.print(" b : ");
Serial.println(b);
switch (a) {
case '0': // off
Ac_Power_Down();
break;
case '1': // on
Ac_Activate(ac_temperature, ac_flow, ac_heat);
break;
case '2':
if (b == '0')
Ac_Change_Air_Swing(0);
else
Ac_Change_Air_Swing(1);
break;
case '3': // 1 : clean on, power on
if (b == '0' || b == '1')
Ac_Air_Clean(b);
break;
case '4':
switch (b) {
case '1':
Ac_Activate(ac_temperature, 1, ac_heat);
break;
case '2':
Ac_Activate(ac_temperature, 2, ac_heat);
break;
case '3':
Ac_Activate(ac_temperature, 3, ac_heat);
break;
default:
Ac_Activate(ac_temperature, 0, ac_heat);
}
break;
case '+':
if (18 <= ac_temperature && ac_temperature <= 29)
Ac_Activate((ac_temperature + 1), ac_flow, ac_heat);
break;
case '-':
if (19 <= ac_temperature && ac_temperature <= 30)
Ac_Activate((ac_temperature - 1), ac_flow, ac_heat);
break;
case 'c':
ac_heat = 0;
Ac_Activate(ac_temperature, ac_flow, ac_heat);
break;
case 'h':
ac_heat = 1;
Ac_Activate(ac_temperature, ac_flow, ac_heat);
break;
case 'm':
/*
if ac is on, 1) turn off, 2) turn on Ac_Air_Clean(1)
if ac is off, 1) turn on, 2) turn off Ac_Air_Clean(0)
*/
if (ac_power_on == 1) {
Ac_Power_Down();
delay(100);
Ac_Air_Clean(1);
} else {
if (ac_air_clean_state == 1) {
Ac_Air_Clean(0);
delay(100);
}
Ac_Activate(ac_temperature, ac_flow, ac_heat);
}
break;
}
delay(100);
Serial.println("ac_temperature");
Serial.println(ac_temperature);
Serial.println("ac_flow");
Serial.println(ac_flow);
Serial.println("ac_heat");
Serial.println(ac_heat);
Serial.println("ac_power_on");
Serial.println(ac_power_on);
}
@@ -0,0 +1,17 @@
[platformio]
lib_extra_dirs = ../../
src_dir=.
[common]
build_flags =
lib_deps_builtin =
lib_deps_external =
[env:nodemcuv2]
platform = espressif8266
framework = arduino
board = nodemcuv2
build_flags = ${common.build_flags}
lib_deps =
${common.lib_deps_builtin}
${common.lib_deps_external}
@@ -0,0 +1,58 @@
/* Copyright 2017 crankyoldgit
* An IR LED circuit *MUST* be connected to the ESP8266 on a pin
* as specified by kIrLed below.
*
* TL;DR: The IR LED needs to be driven by a transistor for a good result.
*
* Suggested circuit:
* https://github.com/markszabo/IRremoteESP8266/wiki#ir-sending
*
* Common mistakes & tips:
* * Don't just connect the IR LED directly to the pin, it won't
* have enough current to drive the IR LED effectively.
* * Make sure you have the IR LED polarity correct.
* See: https://learn.sparkfun.com/tutorials/polarity/diode-and-led-polarity
* * Typical digital camera/phones can be used to see if the IR LED is flashed.
* Replace the IR LED with a normal LED if you don't have a digital camera
* when debugging.
* * Avoid using the following pins unless you really know what you are doing:
* * Pin 0/D3: Can interfere with the boot/program mode & support circuits.
* * Pin 1/TX/TXD0: Any serial transmissions from the ESP8266 will interfere.
* * Pin 3/RX/RXD0: Any serial transmissions to the ESP8266 will interfere.
* * ESP-01 modules are tricky. We suggest you use a module with more GPIOs
* for your first time. e.g. ESP-12 etc.
*/
#ifndef UNIT_TEST
#include <Arduino.h>
#endif
#include <IRremoteESP8266.h>
#include <IRsend.h>
#include <ir_Argo.h>
const uint16_t kIrLed = 4; // ESP8266 GPIO pin to use. Recommended: 4 (D2).
IRArgoAC argoir(kIrLed); // Set the GPIO to be used to sending the message.
void setup() {
argoir.begin();
Serial.begin(115200);
}
void loop() {
Serial.println("Sending...");
// Set up what we want to send. See ir_Argo.cpp for all the options.
argoir.setPower(true);
argoir.setFan(ARGO_FAN_1);
argoir.setCoolMode(ARGO_COOL_AUTO);
argoir.setTemp(25);
#if SEND_ARGO
// Now send the IR signal.
argoir.send();
#else // SEND_ARGO
Serial.println("Can't send because SEND_ARGO has been disabled.");
#endif // SEND_ARGO
delay(5000);
}
@@ -0,0 +1,17 @@
[platformio]
lib_extra_dirs = ../../
src_dir=.
[common]
build_flags =
lib_deps_builtin =
lib_deps_external =
[env:nodemcuv2]
platform = espressif8266
framework = arduino
board = nodemcuv2
build_flags = ${common.build_flags}
lib_deps =
${common.lib_deps_builtin}
${common.lib_deps_external}
@@ -1,27 +1,69 @@
/* Copyright 2017 sillyfrog
*
* An IR LED circuit *MUST* be connected to the ESP8266 on a pin
* as specified by kIrLed below.
*
* TL;DR: The IR LED needs to be driven by a transistor for a good result.
*
* Suggested circuit:
* https://github.com/markszabo/IRremoteESP8266/wiki#ir-sending
*
* Common mistakes & tips:
* * Don't just connect the IR LED directly to the pin, it won't
* have enough current to drive the IR LED effectively.
* * Make sure you have the IR LED polarity correct.
* See: https://learn.sparkfun.com/tutorials/polarity/diode-and-led-polarity
* * Typical digital camera/phones can be used to see if the IR LED is flashed.
* Replace the IR LED with a normal LED if you don't have a digital camera
* when debugging.
* * Avoid using the following pins unless you really know what you are doing:
* * Pin 0/D3: Can interfere with the boot/program mode & support circuits.
* * Pin 1/TX/TXD0: Any serial transmissions from the ESP8266 will interfere.
* * Pin 3/RX/RXD0: Any serial transmissions to the ESP8266 will interfere.
* * ESP-01 modules are tricky. We suggest you use a module with more GPIOs
* for your first time. e.g. ESP-12 etc.
*/
#include <IRDaikinESP.h>
#ifndef UNIT_TEST
#include <Arduino.h>
#endif
#include <IRremoteESP8266.h>
#include <IRsend.h>
#include <ir_Daikin.h>
IRDaikinESP dakinir(D1);
const uint16_t kIrLed = 4; // ESP8266 GPIO pin to use. Recommended: 4 (D2).
IRDaikinESP daikinir(kIrLed); // Set the GPIO to be used to sending the message
void setup(){
dakinir.begin();
void setup() {
daikinir.begin();
Serial.begin(115200);
}
void loop(){
void loop() {
Serial.println("Sending...");
// Set up what we want to send. See IRDaikinESP.cpp for all the options.
dakinir.on();
dakinir.setFan(1);
dakinir.setMode(DAIKIN_COOL);
dakinir.setTemp(25);
dakinir.setSwingVertical(0);
dakinir.setSwingHorizontal(0);
// Set up what we want to send. See ir_Daikin.cpp for all the options.
daikinir.on();
daikinir.setFan(1);
daikinir.setMode(kDaikinCool);
daikinir.setTemp(25);
daikinir.setSwingVertical(false);
daikinir.setSwingHorizontal(false);
// Set the current time to 1:33PM (13:33)
// Time works in minutes past midnight
daikinir.setCurrentTime((13*60) + 33);
// Turn off about 1 hour later at 2:30PM (15:30)
daikinir.enableOffTimer((14*60) + 30);
// Display what we are going to send.
Serial.println(daikinir.toString());
// Now send the IR signal.
dakinir.send();
#if SEND_DAIKIN
daikinir.send();
#endif // SEND_DAIKIN
delay(5000);
delay(15000);
}
@@ -0,0 +1,17 @@
[platformio]
lib_extra_dirs = ../../
src_dir=.
[common]
build_flags =
lib_deps_builtin =
lib_deps_external =
[env:nodemcuv2]
platform = espressif8266
framework = arduino
board = nodemcuv2
build_flags = ${common.build_flags}
lib_deps =
${common.lib_deps_builtin}
${common.lib_deps_external}
@@ -0,0 +1,49 @@
// Copyright 2017 Jonny Graham
#include <IRsend.h>
#include <ir_Fujitsu.h>
const uint16_t kIrLed = 4; // ESP8266 GPIO pin to use. Recommended: 4 (D2).
IRFujitsuAC fujitsu(kIrLed);
void printState() {
// Display the settings.
Serial.println("Fujitsu A/C remote is in the following state:");
Serial.printf(" Command:%d, Mode: %d, Temp: %dC, Fan Speed: %d," \
" Swing Mode: %d\n",
fujitsu.getCmd(), fujitsu.getMode(), fujitsu.getTemp(),
fujitsu.getFanSpeed(), fujitsu.getSwing());
// Display the encoded IR sequence.
unsigned char* ir_code = fujitsu.getRaw();
Serial.print("IR Code: 0x");
for (uint8_t i = 0; i < fujitsu.getStateLength(); i++)
Serial.printf("%02X", ir_code[i]);
Serial.println();
}
void setup() {
fujitsu.begin();
Serial.begin(115200);
delay(200);
// Set up what we want to send. See ir_Fujitsu.cpp for all the options.
Serial.println("Default state of the remote.");
printState();
Serial.println("Setting desired state for A/C.");
fujitsu.setCmd(FUJITSU_AC_CMD_TURN_ON);
fujitsu.setSwing(FUJITSU_AC_SWING_BOTH);
fujitsu.setMode(FUJITSU_AC_MODE_COOL);
fujitsu.setFanSpeed(FUJITSU_AC_FAN_HIGH);
fujitsu.setTemp(24);
}
void loop() {
// Now send the IR signal.
Serial.println("Sending IR command to A/C ...");
#if SEND_FUJITSU_AC
fujitsu.send();
#else // SEND_FUJITSU_AC
Serial.println("Can't send because SEND_FUJITSU_AC has been disabled.");
#endif // SEND_FUJITSU_AC
printState();
delay(5000);
}
@@ -0,0 +1,17 @@
[platformio]
lib_extra_dirs = ../../
src_dir=.
[common]
build_flags =
lib_deps_builtin =
lib_deps_external =
[env:nodemcuv2]
platform = espressif8266
framework = arduino
board = nodemcuv2
build_flags = ${common.build_flags}
lib_deps =
${common.lib_deps_builtin}
${common.lib_deps_external}
@@ -1,7 +1,37 @@
/* Copyright 2016 David Conran
*
* An IR LED circuit *MUST* be connected to the ESP8266 on a pin
* as specified by kIrLed below.
*
* TL;DR: The IR LED needs to be driven by a transistor for a good result.
*
* Suggested circuit:
* https://github.com/markszabo/IRremoteESP8266/wiki#ir-sending
*
* Common mistakes & tips:
* * Don't just connect the IR LED directly to the pin, it won't
* have enough current to drive the IR LED effectively.
* * Make sure you have the IR LED polarity correct.
* See: https://learn.sparkfun.com/tutorials/polarity/diode-and-led-polarity
* * Typical digital camera/phones can be used to see if the IR LED is flashed.
* Replace the IR LED with a normal LED if you don't have a digital camera
* when debugging.
* * Avoid using the following pins unless you really know what you are doing:
* * Pin 0/D3: Can interfere with the boot/program mode & support circuits.
* * Pin 1/TX/TXD0: Any serial transmissions from the ESP8266 will interfere.
* * Pin 3/RX/RXD0: Any serial transmissions to the ESP8266 will interfere.
* * ESP-01 modules are tricky. We suggest you use a module with more GPIOs
* for your first time. e.g. ESP-12 etc.
*/
#ifndef UNIT_TEST
#include <Arduino.h>
#endif
#include <IRremoteESP8266.h>
#include <IRsend.h>
#include <ir_Kelvinator.h>
#include <IRKelvinator.h>
IRKelvinatorAC kelvir(D1); // IR led controlled by Pin D1.
const uint16_t kIrLed = 4; // ESP8266 GPIO pin to use. Recommended: 4 (D2).
IRKelvinatorAC kelvir(kIrLed); // Set the GPIO to be used for sending messages.
void printState() {
// Display the settings.
@@ -17,17 +47,17 @@ void printState() {
// Display the encoded IR sequence.
unsigned char* ir_code = kelvir.getRaw();
Serial.print("IR Code: 0x");
for (int i = 0; i < KELVINATOR_STATE_LENGTH; i++)
for (uint8_t i = 0; i < kKelvinatorStateLength; i++)
Serial.printf("%02X", ir_code[i]);
Serial.println();
}
void setup(){
void setup() {
kelvir.begin();
Serial.begin(115200);
delay(200);
// Set up what we want to send. See IRKelvinator.cpp for all the options.
// Set up what we want to send. See ir_Kelvinator.cpp for all the options.
// Most things default to off.
Serial.println("Default state of the remote.");
printState();
@@ -45,8 +75,10 @@ void setup(){
void loop() {
// Now send the IR signal.
#if SEND_KELVINATOR
Serial.println("Sending IR command to A/C ...");
kelvir.send();
#endif // SEND_KELVINATOR
printState();
delay(5000);
}
@@ -0,0 +1,17 @@
[platformio]
lib_extra_dirs = ../../
src_dir=.
[common]
build_flags =
lib_deps_builtin =
lib_deps_external =
[env:nodemcuv2]
platform = espressif8266
framework = arduino
board = nodemcuv2
build_flags = ${common.build_flags}
lib_deps =
${common.lib_deps_builtin}
${common.lib_deps_external}
@@ -1,28 +1,59 @@
/* Copyright 2017 David Conran
*
* An IR LED circuit *MUST* be connected to the ESP8266 on a pin
* as specified by kIrLed below.
*
* TL;DR: The IR LED needs to be driven by a transistor for a good result.
*
* Suggested circuit:
* https://github.com/markszabo/IRremoteESP8266/wiki#ir-sending
*
* Common mistakes & tips:
* * Don't just connect the IR LED directly to the pin, it won't
* have enough current to drive the IR LED effectively.
* * Make sure you have the IR LED polarity correct.
* See: https://learn.sparkfun.com/tutorials/polarity/diode-and-led-polarity
* * Typical digital camera/phones can be used to see if the IR LED is flashed.
* Replace the IR LED with a normal LED if you don't have a digital camera
* when debugging.
* * Avoid using the following pins unless you really know what you are doing:
* * Pin 0/D3: Can interfere with the boot/program mode & support circuits.
* * Pin 1/TX/TXD0: Any serial transmissions from the ESP8266 will interfere.
* * Pin 3/RX/RXD0: Any serial transmissions to the ESP8266 will interfere.
* * ESP-01 modules are tricky. We suggest you use a module with more GPIOs
* for your first time. e.g. ESP-12 etc.
*/
#ifndef UNIT_TEST
#include <Arduino.h>
#endif
#include <IRremoteESP8266.h>
#include <IRsend.h>
#include <ir_Mitsubishi.h>
#include <IRMitsubishiAC.h>
IRMitsubishiAC mitsubir(D1); // IR led controlled by Pin D1.
const uint16_t kIrLed = 4; // ESP8266 GPIO pin to use. Recommended: 4 (D2).
IRMitsubishiAC mitsubir(kIrLed); // Set the GPIO used for sending messages.
void printState() {
// Display the settings.
Serial.println("Mitsubishi A/C remote is in the following state:");
Serial.printf(" Power: %d, Mode: %d, Temp: %dC, Fan Speed: %d, Vane Mode: %d\n",
Serial.printf(" Power: %d, Mode: %d, Temp: %dC, Fan Speed: %d," \
" Vane Mode: %d\n",
mitsubir.getPower(), mitsubir.getMode(), mitsubir.getTemp(),
mitsubir.getFan(), mitsubir.getVane());
// Display the encoded IR sequence.
unsigned char* ir_code = mitsubir.getRaw();
Serial.print("IR Code: 0x");
for (int i = 0; i < MITSUBISHI_AC_STATE_LENGTH; i++)
for (uint8_t i = 0; i < kMitsubishiACStateLength; i++)
Serial.printf("%02X", ir_code[i]);
Serial.println();
}
void setup(){
void setup() {
mitsubir.begin();
Serial.begin(115200);
delay(200);
// Set up what we want to send. See IRMitsubishiAC.cpp for all the options.
// Set up what we want to send. See ir_Mitsubishi.cpp for all the options.
Serial.println("Default state of the remote.");
printState();
Serial.println("Setting desired state for A/C.");
@@ -35,8 +66,10 @@ void setup(){
void loop() {
// Now send the IR signal.
#if SEND_MITSUBISHI_AC
Serial.println("Sending IR command to A/C ...");
mitsubir.send();
#endif // SEND_MITSUBISHI_AC
printState();
delay(5000);
}
@@ -0,0 +1,17 @@
[platformio]
lib_extra_dirs = ../../
src_dir=.
[common]
build_flags =
lib_deps_builtin =
lib_deps_external =
[env:nodemcuv2]
platform = espressif8266
framework = arduino
board = nodemcuv2
build_flags = ${common.build_flags}
lib_deps =
${common.lib_deps_builtin}
${common.lib_deps_external}
@@ -0,0 +1,73 @@
/* Copyright 2017 David Conran
*
* An IR LED circuit *MUST* be connected to the ESP8266 on a pin
* as specified by kIrLed below.
*
* TL;DR: The IR LED needs to be driven by a transistor for a good result.
*
* Suggested circuit:
* https://github.com/markszabo/IRremoteESP8266/wiki#ir-sending
*
* Common mistakes & tips:
* * Don't just connect the IR LED directly to the pin, it won't
* have enough current to drive the IR LED effectively.
* * Make sure you have the IR LED polarity correct.
* See: https://learn.sparkfun.com/tutorials/polarity/diode-and-led-polarity
* * Typical digital camera/phones can be used to see if the IR LED is flashed.
* Replace the IR LED with a normal LED if you don't have a digital camera
* when debugging.
* * Avoid using the following pins unless you really know what you are doing:
* * Pin 0/D3: Can interfere with the boot/program mode & support circuits.
* * Pin 1/TX/TXD0: Any serial transmissions from the ESP8266 will interfere.
* * Pin 3/RX/RXD0: Any serial transmissions to the ESP8266 will interfere.
* * ESP-01 modules are tricky. We suggest you use a module with more GPIOs
* for your first time. e.g. ESP-12 etc.
*/
#ifndef UNIT_TEST
#include <Arduino.h>
#endif
#include <IRremoteESP8266.h>
#include <IRsend.h>
#include <ir_Toshiba.h>
const uint16_t kIrLed = 4; // ESP8266 GPIO pin to use. Recommended: 4 (D2).
IRToshibaAC toshibair(kIrLed); // Set the GPIO to be used for sending messages.
void printState() {
// Display the settings.
Serial.println("Toshiba A/C remote is in the following state:");
Serial.printf(" Power: %d, Mode: %d, Temp: %dC, Fan Speed: %d\n",
toshibair.getPower(), toshibair.getMode(), toshibair.getTemp(),
toshibair.getFan());
// Display the encoded IR sequence.
unsigned char* ir_code = toshibair.getRaw();
Serial.print("IR Code: 0x");
for (uint8_t i = 0; i < kToshibaACStateLength; i++)
Serial.printf("%02X", ir_code[i]);
Serial.println();
}
void setup() {
toshibair.begin();
Serial.begin(115200);
delay(200);
// Set up what we want to send. See ir_Toshiba.cpp for all the options.
Serial.println("Default state of the remote.");
printState();
Serial.println("Setting desired state for A/C.");
toshibair.on();
toshibair.setFan(1);
toshibair.setMode(TOSHIBA_AC_COOL);
toshibair.setTemp(26);
}
void loop() {
// Now send the IR signal.
#if SEND_TOSHIBA_AC
Serial.println("Sending IR command to A/C ...");
toshibair.send();
#endif // SEND_TOSHIBA_AC
printState();
delay(5000);
}
@@ -0,0 +1,17 @@
[platformio]
lib_extra_dirs = ../../
src_dir=.
[common]
build_flags =
lib_deps_builtin =
lib_deps_external =
[env:nodemcuv2]
platform = espressif8266
framework = arduino
board = nodemcuv2
build_flags = ${common.build_flags}
lib_deps =
${common.lib_deps_builtin}
${common.lib_deps_external}
@@ -0,0 +1,58 @@
/* Copyright 2017 stufisher
* An IR LED circuit *MUST* be connected to the ESP8266 on a pin
* as specified by kIrLed below.
*
* TL;DR: The IR LED needs to be driven by a transistor for a good result.
*
* Suggested circuit:
* https://github.com/markszabo/IRremoteESP8266/wiki#ir-sending
*
* Common mistakes & tips:
* * Don't just connect the IR LED directly to the pin, it won't
* have enough current to drive the IR LED effectively.
* * Make sure you have the IR LED polarity correct.
* See: https://learn.sparkfun.com/tutorials/polarity/diode-and-led-polarity
* * Typical digital camera/phones can be used to see if the IR LED is flashed.
* Replace the IR LED with a normal LED if you don't have a digital camera
* when debugging.
* * Avoid using the following pins unless you really know what you are doing:
* * Pin 0/D3: Can interfere with the boot/program mode & support circuits.
* * Pin 1/TX/TXD0: Any serial transmissions from the ESP8266 will interfere.
* * Pin 3/RX/RXD0: Any serial transmissions to the ESP8266 will interfere.
* * ESP-01 modules are tricky. We suggest you use a module with more GPIOs
* for your first time. e.g. ESP-12 etc.
*/
#ifndef UNIT_TEST
#include <Arduino.h>
#endif
#include <IRremoteESP8266.h>
#include <IRsend.h>
#include <ir_Trotec.h>
const uint16_t kIrLed = 4; // ESP8266 GPIO pin to use. Recommended: 4 (D2).
IRTrotecESP trotecir(kIrLed); // Set the GPIO to be used for sending messages.
void setup() {
trotecir.begin();
Serial.begin(115200);
}
void loop() {
Serial.println("Sending...");
// Set up what we want to send. See ir_Trotec.cpp for all the options.
trotecir.setPower(true);
trotecir.setSpeed(TROTEC_FAN_LOW);
trotecir.setMode(TROTEC_COOL);
trotecir.setTemp(25);
// Now send the IR signal.
#if SEND_TROTEC
trotecir.send();
#else // SEND_TROTEC
Serial.println("Can't send because SEND_TROTEC has been disabled.");
#endif // SEND_TROTEC
delay(5000);
}
@@ -0,0 +1,17 @@
[platformio]
lib_extra_dirs = ../../
src_dir=.
[common]
build_flags =
lib_deps_builtin =
lib_deps_external =
[env:nodemcuv2]
platform = espressif8266
framework = arduino
board = nodemcuv2
build_flags = ${common.build_flags}
lib_deps =
${common.lib_deps_builtin}
${common.lib_deps_external}
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "IRremoteESP8266",
"version": "1.2.0",
"version": "2.5.2",
"keywords": "infrared, ir, remote, esp8266",
"description": "Send and receive infrared signals with multiple protocols (ESP8266)",
"repository":
+1 -1
View File
@@ -1,5 +1,5 @@
name=IRremoteESP8266
version=1.2.0
version=2.5.2
author=Sebastien Warin, Mark Szabo, Ken Shirriff, David Conran
maintainer=Mark Szabo, David Conran, Sebastien Warin, Roi Dayan, Massimiliano Pinto
sentence=Send and receive infrared signals with multiple protocols (ESP8266)
+26
View File
@@ -0,0 +1,26 @@
[platformio]
lib_extra_dirs = .
src_dir = examples/IRrecvDumpV2
[common]
build_flags =
lib_deps_builtin =
lib_deps_external =
[env:nodemcuv2]
platform = espressif8266
framework = arduino
board = nodemcuv2
build_flags = ${common.build_flags}
lib_deps =
${common.lib_deps_builtin}
${common.lib_deps_external}
[env:d1_mini]
platform = espressif8266
framework = arduino
board = d1_mini
build_flags = ${common.build_flags}
lib_deps =
${common.lib_deps_builtin}
${common.lib_deps_external}
+12
View File
@@ -0,0 +1,12 @@
[REPORTS]
# Tells whether to display a full report or only the messages
reports=no
[FORMAT]
# Maximum number of characters on a single line.
max-line-length=80
# String used as indentation unit.
indent-string=' '
+1
View File
@@ -0,0 +1 @@
filter=-build/include,+build/include_alpha,+build/include_order,+build/include_what_you_use
+734
View File
@@ -0,0 +1,734 @@
// Copyright 2009 Ken Shirriff
// Copyright 2015 Mark Szabo
// Copyright 2015 Sebastien Warin
// Copyright 2017 David Conran
#include "IRrecv.h"
#include <stddef.h>
#ifndef UNIT_TEST
extern "C" {
#include <gpio.h>
#include <user_interface.h>
}
#include <Arduino.h>
#endif
#include <algorithm>
#include "IRremoteESP8266.h"
#include "IRutils.h"
#ifdef UNIT_TEST
#undef ICACHE_RAM_ATTR
#define ICACHE_RAM_ATTR
#endif
// Updated by Sebastien Warin (http://sebastien.warin.fr) for receiving IR code
// on ESP8266
// Updated by markszabo (https://github.com/markszabo/IRremoteESP8266) for
// sending IR code on ESP8266
// Globals
#ifndef UNIT_TEST
static ETSTimer timer;
#endif
volatile irparams_t irparams;
irparams_t *irparams_save; // A copy of the interrupt state while decoding.
#ifndef UNIT_TEST
static void ICACHE_RAM_ATTR read_timeout(void *arg __attribute__((unused))) {
os_intr_lock();
if (irparams.rawlen) irparams.rcvstate = kStopState;
os_intr_unlock();
}
static void ICACHE_RAM_ATTR gpio_intr() {
uint32_t now = system_get_time();
uint32_t gpio_status = GPIO_REG_READ(GPIO_STATUS_ADDRESS);
static uint32_t start = 0;
os_timer_disarm(&timer);
GPIO_REG_WRITE(GPIO_STATUS_W1TC_ADDRESS, gpio_status);
// Grab a local copy of rawlen to reduce instructions used in IRAM.
// This is an ugly premature optimisation code-wise, but we do everything we
// can to save IRAM.
// It seems referencing the value via the structure uses more instructions.
// Less instructions means faster and less IRAM used.
// N.B. It saves about 13 bytes of IRAM.
uint16_t rawlen = irparams.rawlen;
if (rawlen >= irparams.bufsize) {
irparams.overflow = true;
irparams.rcvstate = kStopState;
}
if (irparams.rcvstate == kStopState) return;
if (irparams.rcvstate == kIdleState) {
irparams.rcvstate = kMarkState;
irparams.rawbuf[rawlen] = 1;
} else {
if (now < start)
irparams.rawbuf[rawlen] = (UINT32_MAX - start + now) / kRawTick;
else
irparams.rawbuf[rawlen] = (now - start) / kRawTick;
}
irparams.rawlen++;
start = now;
#define ONCE 0
os_timer_arm(&timer, irparams.timeout, ONCE);
}
#endif // UNIT_TEST
// Start of IRrecv class -------------------
// Class constructor
// Args:
// recvpin: GPIO pin the IR receiver module's data pin is connected to.
// bufsize: Nr. of entries to have in the capture buffer. (Default: kRawBuf)
// timeout: Nr. of milli-Seconds of no signal before we stop capturing data.
// (Default: kTimeoutMs)
// save_buffer: Use a second (save) buffer to decode from. (Def: false)
// Returns:
// An IRrecv class object.
IRrecv::IRrecv(uint16_t recvpin, uint16_t bufsize, uint8_t timeout,
bool save_buffer) {
irparams.recvpin = recvpin;
irparams.bufsize = bufsize;
// Ensure we are going to be able to store all possible values in the
// capture buffer.
irparams.timeout = std::min(timeout, (uint8_t)kMaxTimeoutMs);
irparams.rawbuf = new uint16_t[bufsize];
if (irparams.rawbuf == NULL) {
DPRINTLN(
"Could not allocate memory for the primary IR buffer.\n"
"Try a smaller size for CAPTURE_BUFFER_SIZE.\nRebooting!");
#ifndef UNIT_TEST
ESP.restart(); // Mem alloc failure. Reboot.
#endif
}
// If we have been asked to use a save buffer (for decoding), then create one.
if (save_buffer) {
irparams_save = new irparams_t;
irparams_save->rawbuf = new uint16_t[bufsize];
// Check we allocated the memory successfully.
if (irparams_save->rawbuf == NULL) {
DPRINTLN(
"Could not allocate memory for the second IR buffer.\n"
"Try a smaller size for CAPTURE_BUFFER_SIZE.\nRebooting!");
#ifndef UNIT_TEST
ESP.restart(); // Mem alloc failure. Reboot.
#endif
}
} else {
irparams_save = NULL;
}
#if DECODE_HASH
unknown_threshold = kUnknownThreshold;
#endif // DECODE_HASH
}
// Class destructor
IRrecv::~IRrecv(void) {
delete[] irparams.rawbuf;
if (irparams_save != NULL) {
delete[] irparams_save->rawbuf;
delete irparams_save;
}
}
// initialization
void IRrecv::enableIRIn() {
// initialize state machine variables
resume();
#ifndef UNIT_TEST
// Initialize timer
os_timer_disarm(&timer);
os_timer_setfn(&timer, reinterpret_cast<os_timer_func_t *>(read_timeout),
NULL);
// Attach Interrupt
attachInterrupt(irparams.recvpin, gpio_intr, CHANGE);
#endif
}
void IRrecv::disableIRIn() {
#ifndef UNIT_TEST
os_timer_disarm(&timer);
detachInterrupt(irparams.recvpin);
#endif
}
void IRrecv::resume() {
irparams.rcvstate = kIdleState;
irparams.rawlen = 0;
irparams.overflow = false;
}
// Make a copy of the interrupt state & buffer data.
// Needed because irparams is marked as volatile, thus memcpy() isn't allowed.
// Only call this when you know the interrupt handlers won't modify anything.
// i.e. In kStopState.
//
// Args:
// src: Pointer to an irparams_t structure to copy from.
// dst: Pointer to an irparams_t structure to copy to.
void IRrecv::copyIrParams(volatile irparams_t *src, irparams_t *dst) {
// Typecast src and dst addresses to (char *)
char *csrc = (char *)src; // NOLINT(readability/casting)
char *cdst = (char *)dst; // NOLINT(readability/casting)
// Save the pointer to the destination's rawbuf so we don't lose it as
// the for-loop/copy after this will overwrite it with src's rawbuf pointer.
// This isn't immediately obvious due to typecasting/different variable names.
uint16_t *dst_rawbuf_ptr;
dst_rawbuf_ptr = dst->rawbuf;
// Copy contents of src[] to dst[]
for (uint16_t i = 0; i < sizeof(irparams_t); i++) cdst[i] = csrc[i];
// Restore the buffer pointer
dst->rawbuf = dst_rawbuf_ptr;
// Copy the rawbuf
for (uint16_t i = 0; i < dst->bufsize; i++) dst->rawbuf[i] = src->rawbuf[i];
}
// Obtain the maximum number of entries possible in the capture buffer.
// i.e. It's size.
uint16_t IRrecv::getBufSize() { return irparams.bufsize; }
#if DECODE_HASH
// Set the minimum length we will consider for reporting UNKNOWN message types.
void IRrecv::setUnknownThreshold(uint16_t length) {
unknown_threshold = length;
}
#endif // DECODE_HASH
// Decodes the received IR message.
// If the interrupt state is saved, we will immediately resume waiting
// for the next IR message to avoid missing messages.
// Note: There is a trade-off here. Saving the state means less time lost until
// we can receiving the next message vs. using more RAM. Choose appropriately.
//
// Args:
// results: A pointer to where the decoded IR message will be stored.
// save: A pointer to an irparams_t instance in which to save
// the interrupt's memory/state. NULL means don't save it.
// Returns:
// A boolean indicating if an IR message is ready or not.
bool IRrecv::decode(decode_results *results, irparams_t *save) {
// Proceed only if an IR message been received.
#ifndef UNIT_TEST
if (irparams.rcvstate != kStopState) return false;
#endif
// Clear the entry we are currently pointing to when we got the timeout.
// i.e. Stopped collecting IR data.
// It's junk as we never wrote an entry to it and can only confuse decoding.
// This is done here rather than logically the best place in read_timeout()
// as it saves a few bytes of ICACHE_RAM as that routine is bound to an
// interrupt. decode() is not stored in ICACHE_RAM.
// Another better option would be to zero the entire irparams.rawbuf[] on
// resume() but that is a much more expensive operation compare to this.
irparams.rawbuf[irparams.rawlen] = 0;
bool resumed = false; // Flag indicating if we have resumed.
// If we were requested to use a save buffer previously, do so.
if (save == NULL) save = irparams_save;
if (save == NULL) {
// We haven't been asked to copy it so use the existing memory.
#ifndef UNIT_TEST
results->rawbuf = irparams.rawbuf;
results->rawlen = irparams.rawlen;
results->overflow = irparams.overflow;
#endif
} else {
copyIrParams(&irparams, save); // Duplicate the interrupt's memory.
resume(); // It's now safe to rearm. The IR message won't be overridden.
resumed = true;
// Point the results at the saved copy.
results->rawbuf = save->rawbuf;
results->rawlen = save->rawlen;
results->overflow = save->overflow;
}
// Reset any previously partially processed results.
results->decode_type = UNKNOWN;
results->bits = 0;
results->value = 0;
results->address = 0;
results->command = 0;
results->repeat = false;
#if DECODE_AIWA_RC_T501
DPRINTLN("Attempting Aiwa RC T501 decode");
// Try decodeAiwaRCT501() before decodeSanyoLC7461() & decodeNEC()
// because the protocols are similar. This protocol is more specific than
// those ones, so should got before them.
if (decodeAiwaRCT501(results)) return true;
#endif
#if DECODE_SANYO
DPRINTLN("Attempting Sanyo LC7461 decode");
// Try decodeSanyoLC7461() before decodeNEC() because the protocols are
// similar in timings & structure, but the Sanyo one is much longer than the
// NEC protocol (42 vs 32 bits) so this one should be tried first to try to
// reduce false detection as a NEC packet.
if (decodeSanyoLC7461(results)) return true;
#endif
#if DECODE_CARRIER_AC
DPRINTLN("Attempting Carrier AC decode");
// Try decodeCarrierAC() before decodeNEC() because the protocols are
// similar in timings & structure, but the Carrier one is much longer than the
// NEC protocol (3x32 bits vs 1x32 bits) so this one should be tried first to
// try to reduce false detection as a NEC packet.
if (decodeCarrierAC(results)) return true;
#endif
#if DECODE_PIONEER
DPRINTLN("Attempting Pioneer decode");
// Try decodePioneer() before decodeNEC() because the protocols are
// similar in timings & structure, but the Pioneer one is much longer than the
// NEC protocol (2x32 bits vs 1x32 bits) so this one should be tried first to
// try to reduce false detection as a NEC packet.
if (decodePioneer(results)) return true;
#endif
#if DECODE_NEC
DPRINTLN("Attempting NEC decode");
if (decodeNEC(results)) return true;
#endif
#if DECODE_SONY
DPRINTLN("Attempting Sony decode");
if (decodeSony(results)) return true;
#endif
#if DECODE_MITSUBISHI
DPRINTLN("Attempting Mitsubishi decode");
if (decodeMitsubishi(results)) return true;
#endif
#if DECODE_MITSUBISHI_AC
DPRINTLN("Attempting Mitsubishi AC decode");
if (decodeMitsubishiAC(results)) return true;
#endif
#if DECODE_MITSUBISHI2
DPRINTLN("Attempting Mitsubishi2 decode");
if (decodeMitsubishi2(results)) return true;
#endif
#if DECODE_RC5
DPRINTLN("Attempting RC5 decode");
if (decodeRC5(results)) return true;
#endif
#if DECODE_RC6
DPRINTLN("Attempting RC6 decode");
if (decodeRC6(results)) return true;
#endif
#if DECODE_RCMM
DPRINTLN("Attempting RC-MM decode");
if (decodeRCMM(results)) return true;
#endif
#if DECODE_FUJITSU_AC
// Fujitsu A/C needs to precede Panasonic and Denon as it has a short
// message which looks exactly the same as a Panasonic/Denon message.
DPRINTLN("Attempting Fujitsu A/C decode");
if (decodeFujitsuAC(results)) return true;
#endif
#if DECODE_DENON
// Denon needs to precede Panasonic as it is a special case of Panasonic.
DPRINTLN("Attempting Denon decode");
if (decodeDenon(results, DENON_48_BITS) || decodeDenon(results, DENON_BITS) ||
decodeDenon(results, kDenonLegacyBits))
return true;
#endif
#if DECODE_PANASONIC
DPRINTLN("Attempting Panasonic decode");
if (decodePanasonic(results)) return true;
#endif
#if DECODE_LG
DPRINTLN("Attempting LG (28-bit) decode");
if (decodeLG(results, kLgBits, true)) return true;
DPRINTLN("Attempting LG (32-bit) decode");
// LG32 should be tried before Samsung
if (decodeLG(results, kLg32Bits, true)) return true;
#endif
#if DECODE_GICABLE
// Note: Needs to happen before JVC decode, because it looks similar except
// with a required NEC-like repeat code.
DPRINTLN("Attempting GICable decode");
if (decodeGICable(results)) return true;
#endif
#if DECODE_JVC
DPRINTLN("Attempting JVC decode");
if (decodeJVC(results)) return true;
#endif
#if DECODE_SAMSUNG
DPRINTLN("Attempting SAMSUNG decode");
if (decodeSAMSUNG(results)) return true;
#endif
#if DECODE_WHYNTER
DPRINTLN("Attempting Whynter decode");
if (decodeWhynter(results)) return true;
#endif
#if DECODE_DISH
DPRINTLN("Attempting DISH decode");
if (decodeDISH(results)) return true;
#endif
#if DECODE_SHARP
DPRINTLN("Attempting Sharp decode");
if (decodeSharp(results)) return true;
#endif
#if DECODE_COOLIX
DPRINTLN("Attempting Coolix decode");
if (decodeCOOLIX(results)) return true;
#endif
#if DECODE_NIKAI
DPRINTLN("Attempting Nikai decode");
if (decodeNikai(results)) return true;
#endif
#if DECODE_KELVINATOR
// Kelvinator based-devices use a similar code to Gree ones, to avoid false
// matches this needs to happen before decodeGree().
DPRINTLN("Attempting Kelvinator decode");
if (decodeKelvinator(results)) return true;
#endif
#if DECODE_DAIKIN
DPRINTLN("Attempting Daikin decode");
if (decodeDaikin(results)) return true;
#endif
#if DECODE_TOSHIBA_AC
DPRINTLN("Attempting Toshiba AC decode");
if (decodeToshibaAC(results)) return true;
#endif
#if DECODE_MIDEA
DPRINTLN("Attempting Midea decode");
if (decodeMidea(results)) return true;
#endif
#if DECODE_MAGIQUEST
DPRINTLN("Attempting Magiquest decode");
if (decodeMagiQuest(results)) return true;
#endif
/* NOTE: Disabled due to poor quality.
#if DECODE_SANYO
// The Sanyo S866500B decoder is very poor quality & depricated.
// *IF* you are going to enable it, do it near last to avoid false positive
// matches.
DPRINTLN("Attempting Sanyo SA8650B decode");
if (decodeSanyo(results))
return true;
#endif
*/
#if DECODE_NEC
// Some devices send NEC-like codes that don't follow the true NEC spec.
// This should detect those. e.g. Apple TV remote etc.
// This needs to be done after all other codes that use strict and some
// other protocols that are NEC-like as well, as turning off strict may
// cause this to match other valid protocols.
DPRINTLN("Attempting NEC (non-strict) decode");
if (decodeNEC(results, kNECBits, false)) {
results->decode_type = NEC_LIKE;
return true;
}
#endif
#if DECODE_LASERTAG
DPRINTLN("Attempting Lasertag decode");
if (decodeLasertag(results)) return true;
#endif
#if DECODE_GREE
// Gree based-devices use a similar code to Kelvinator ones, to avoid false
// matches this needs to happen after decodeKelvinator().
DPRINTLN("Attempting Gree decode");
if (decodeGree(results)) return true;
#endif
#if DECODE_HAIER_AC
DPRINTLN("Attempting Haier AC decode");
if (decodeHaierAC(results)) return true;
#endif
#if DECODE_HAIER_AC_YRW02
DPRINTLN("Attempting Haier AC YR-W02 decode");
if (decodeHaierACYRW02(results)) return true;
#endif
#if DECODE_HITACHI_AC2
// HitachiAC2 should be checked before HitachiAC
DPRINTLN("Attempting Hitachi AC2 decode");
if (decodeHitachiAC(results, kHitachiAc2Bits)) return true;
#endif
#if DECODE_HITACHI_AC
DPRINTLN("Attempting Hitachi AC decode");
if (decodeHitachiAC(results, kHitachiAcBits)) return true;
#endif
#if DECODE_HITACHI_AC1
DPRINTLN("Attempting Hitachi AC1 decode");
if (decodeHitachiAC(results, kHitachiAc1Bits)) return true;
#endif
#if DECODE_WHIRLPOOL_AC
DPRINTLN("Attempting Whirlpool AC decode");
if (decodeWhirlpoolAC(results)) return true;
#endif
#if DECODE_SAMSUNG_AC
DPRINTLN("Attempting Samsung AC (extended) decode");
// Check the extended size first, as it should fail fast due to longer length.
if (decodeSamsungAC(results, kSamsungAcExtendedBits, false)) return true;
// Now check for the more common length.
DPRINTLN("Attempting Samsung AC decode");
if (decodeSamsungAC(results, kSamsungAcBits)) return true;
#endif
#if DECODE_ELECTRA_AC
DPRINTLN("Attempting Electra AC decode");
if (decodeElectraAC(results)) return true;
#endif
#if DECODE_PANASONIC_AC
DPRINTLN("Attempting Panasonic AC decode");
if (decodePanasonicAC(results)) return true;
DPRINTLN("Attempting Panasonic AC short decode");
if (decodePanasonicAC(results, kPanasonicAcShortBits)) return true;
#endif
#if DECODE_LUTRON
DPRINTLN("Attempting Lutron decode");
if (decodeLutron(results)) return true;
#endif
#if DECODE_MWM
DPRINTLN("Attempting MWM decode");
if (decodeMWM(results)) return true;
#endif
#if DECODE_HASH
// decodeHash returns a hash on any input.
// Thus, it needs to be last in the list.
// If you add any decodes, add them before this.
if (decodeHash(results)) {
return true;
}
#endif // DECODE_HASH
// Throw away and start over
if (!resumed) // Check if we have already resumed.
resume();
return false;
}
// Calculate the lower bound of the nr. of ticks.
//
// Args:
// usecs: Nr. of uSeconds.
// tolerance: Percent as an integer. e.g. 10 is 10%
// delta: A non-scaling amount to reduce usecs by.
// Returns:
// Nr. of ticks.
uint32_t IRrecv::ticksLow(uint32_t usecs, uint8_t tolerance, uint16_t delta) {
// max() used to ensure the result can't drop below 0 before the cast.
return ((uint32_t)std::max(
(int32_t)(usecs * (1.0 - tolerance / 100.0) - delta), 0));
}
// Calculate the upper bound of the nr. of ticks.
//
// Args:
// usecs: Nr. of uSeconds.
// tolerance: Percent as an integer. e.g. 10 is 10%
// delta: A non-scaling amount to increase usecs by.
// Returns:
// Nr. of ticks.
uint32_t IRrecv::ticksHigh(uint32_t usecs, uint8_t tolerance, uint16_t delta) {
return ((uint32_t)(usecs * (1.0 + tolerance / 100.0)) + 1 + delta);
}
// Check if we match a pulse(measured) with the desired within
// +/-tolerance percent and/or +/- a fixed delta range.
//
// Args:
// measured: The recorded period of the signal pulse.
// desired: The expected period (in useconds) we are matching against.
// tolerance: A percentage expressed as an integer. e.g. 10 is 10%.
// delta: A non-scaling (+/-) error margin (in useconds).
//
// Returns:
// Boolean: true if it matches, false if it doesn't.
bool IRrecv::match(uint32_t measured, uint32_t desired, uint8_t tolerance,
uint16_t delta) {
measured *= kRawTick; // Convert to uSecs.
DPRINT("Matching: ");
DPRINT(ticksLow(desired, tolerance, delta));
DPRINT(" <= ");
DPRINT(measured);
DPRINT(" <= ");
DPRINTLN(ticksHigh(desired, tolerance, delta));
return (measured >= ticksLow(desired, tolerance, delta) &&
measured <= ticksHigh(desired, tolerance, delta));
}
// Check if we match a pulse(measured) of at least desired within
// tolerance percent and/or a fixed delta margin.
//
// Args:
// measured: The recorded period of the signal pulse.
// desired: The expected period (in useconds) we are matching against.
// tolerance: A percentage expressed as an integer. e.g. 10 is 10%.
// delta: A non-scaling amount to reduce usecs by.
//
// Returns:
// Boolean: true if it matches, false if it doesn't.
bool IRrecv::matchAtLeast(uint32_t measured, uint32_t desired,
uint8_t tolerance, uint16_t delta) {
measured *= kRawTick; // Convert to uSecs.
DPRINT("Matching ATLEAST ");
DPRINT(measured);
DPRINT(" vs ");
DPRINT(desired);
DPRINT(". Matching: ");
DPRINT(measured);
DPRINT(" >= ");
DPRINT(ticksLow(std::min(desired, MS_TO_USEC(irparams.timeout)), tolerance,
delta));
DPRINT(" [min(");
DPRINT(ticksLow(desired, tolerance, delta));
DPRINT(", ");
DPRINT(ticksLow(MS_TO_USEC(irparams.timeout), tolerance, delta));
DPRINTLN(")]");
// We really should never get a value of 0, except as the last value
// in the buffer. If that is the case, then assume infinity and return true.
if (measured == 0) return true;
return measured >= ticksLow(std::min(desired, MS_TO_USEC(irparams.timeout)),
tolerance, delta);
}
// Check if we match a mark signal(measured) with the desired within
// +/-tolerance percent, after an expected is excess is added.
//
// Args:
// measured: The recorded period of the signal pulse.
// desired: The expected period (in useconds) we are matching against.
// tolerance: A percentage expressed as an integer. e.g. 10 is 10%.
// excess: Nr. of useconds.
//
// Returns:
// Boolean: true if it matches, false if it doesn't.
bool IRrecv::matchMark(uint32_t measured, uint32_t desired, uint8_t tolerance,
int16_t excess) {
DPRINT("Matching MARK ");
DPRINT(measured * kRawTick);
DPRINT(" vs ");
DPRINT(desired);
DPRINT(" + ");
DPRINT(excess);
DPRINT(". ");
return match(measured, desired + excess, tolerance);
}
// Check if we match a space signal(measured) with the desired within
// +/-tolerance percent, after an expected is excess is removed.
//
// Args:
// measured: The recorded period of the signal pulse.
// desired: The expected period (in useconds) we are matching against.
// tolerance: A percentage expressed as an integer. e.g. 10 is 10%.
// excess: Nr. of useconds.
//
// Returns:
// Boolean: true if it matches, false if it doesn't.
bool IRrecv::matchSpace(uint32_t measured, uint32_t desired, uint8_t tolerance,
int16_t excess) {
DPRINT("Matching SPACE ");
DPRINT(measured * kRawTick);
DPRINT(" vs ");
DPRINT(desired);
DPRINT(" - ");
DPRINT(excess);
DPRINT(". ");
return match(measured, desired - excess, tolerance);
}
/* -----------------------------------------------------------------------
* hashdecode - decode an arbitrary IR code.
* Instead of decoding using a standard encoding scheme
* (e.g. Sony, NEC, RC5), the code is hashed to a 32-bit value.
*
* The algorithm: look at the sequence of MARK signals, and see if each one
* is shorter (0), the same length (1), or longer (2) than the previous.
* Do the same with the SPACE signals. Hash the resulting sequence of 0's,
* 1's, and 2's to a 32-bit value. This will give a unique value for each
* different code (probably), for most code systems.
*
* http://arcfn.com/2010/01/using-arbitrary-remotes-with-arduino.html
*/
// Compare two tick values, returning 0 if newval is shorter,
// 1 if newval is equal, and 2 if newval is longer
// Use a tolerance of 20%
int16_t IRrecv::compare(uint16_t oldval, uint16_t newval) {
if (newval < oldval * 0.8)
return 0;
else if (oldval < newval * 0.8)
return 2;
else
return 1;
}
#if DECODE_HASH
/* Converts the raw code values into a 32-bit hash code.
* Hopefully this code is unique for each button.
* This isn't a "real" decoding, just an arbitrary value.
*/
bool IRrecv::decodeHash(decode_results *results) {
// Require at least some samples to prevent triggering on noise
if (results->rawlen < unknown_threshold) return false;
int32_t hash = kFnvBasis32;
// 'rawlen - 2' to avoid the look ahead from going out of bounds.
// Should probably be -3 to avoid comparing the trailing space entry,
// however it is left this way for compatibility with previously captured
// values.
for (uint16_t i = 1; i < results->rawlen - 2; i++) {
int16_t value = compare(results->rawbuf[i], results->rawbuf[i + 2]);
// Add value into the hash
hash = (hash * kFnvPrime32) ^ value;
}
results->value = hash & 0xFFFFFFFF;
results->bits = results->rawlen / 2;
results->address = 0;
results->command = 0;
results->decode_type = UNKNOWN;
return true;
}
#endif // DECODE_HASH
// Match & decode the typical data section of an IR message.
// The data value is stored in the least significant bits reguardless of the
// bit ordering requested.
//
// Args:
// data_ptr: A pointer to where we are at in the capture buffer.
// nbits: Nr. of data bits we expect.
// onemark: Nr. of uSeconds in an expected mark signal for a '1' bit.
// onespace: Nr. of uSeconds in an expected space signal for a '1' bit.
// zeromark: Nr. of uSeconds in an expected mark signal for a '0' bit.
// zerospace: Nr. of uSeconds in an expected space signal for a '0' bit.
// tolerance: Percentage error margin to allow. (Def: kTolerance)
// excess: Nr. of useconds. (Def: kMarkExcess)
// MSBfirst: Bit order to save the data in. (Def: true)
// Returns:
// A match_result_t structure containing the success (or not), the data value,
// and how many buffer entries were used.
match_result_t IRrecv::matchData(
volatile uint16_t *data_ptr, const uint16_t nbits, const uint16_t onemark,
const uint32_t onespace, const uint16_t zeromark, const uint32_t zerospace,
const uint8_t tolerance, const int16_t excess, const bool MSBfirst) {
match_result_t result;
result.success = false; // Fail by default.
result.data = 0;
for (result.used = 0; result.used < nbits * 2;
result.used += 2, data_ptr += 2) {
// Is the bit a '1'?
if (matchMark(*data_ptr, onemark, tolerance, excess) &&
matchSpace(*(data_ptr + 1), onespace, tolerance, excess)) {
result.data = (result.data << 1) | 1;
} else if (matchMark(*data_ptr, zeromark, tolerance, excess) &&
matchSpace(*(data_ptr + 1), zerospace, tolerance, excess)) {
result.data <<= 1; // The bit is a '0'.
} else {
if (!MSBfirst) result.data = reverseBits(result.data, result.used / 2);
return result; // It's neither, so fail.
}
}
result.success = true;
if (!MSBfirst) result.data = reverseBits(result.data, nbits);
return result;
}
// End of IRrecv class -------------------
+335
View File
@@ -0,0 +1,335 @@
// Copyright 2009 Ken Shirriff
// Copyright 2015 Mark Szabo
// Copyright 2015 Sebastien Warin
// Copyright 2017 David Conran
#ifndef IRRECV_H_
#define IRRECV_H_
#ifndef UNIT_TEST
#include <Arduino.h>
#endif
#include <stddef.h>
#define __STDC_LIMIT_MACROS
#include <stdint.h>
#include "IRremoteESP8266.h"
// Constants
const uint16_t kHeader = 2; // Usual nr. of header entries.
const uint16_t kFooter = 2; // Usual nr. of footer (stop bits) entries.
const uint16_t kStartOffset = 1; // Usual rawbuf entry to start from.
#define MS_TO_USEC(x) (x * 1000U) // Convert milli-Seconds to micro-Seconds.
// Marks tend to be 100us too long, and spaces 100us too short
// when received due to sensor lag.
const uint16_t kMarkExcess = 50;
const uint16_t kRawBuf = 100; // Default length of raw capture buffer
const uint64_t kRepeat = UINT64_MAX;
// Default min size of reported UNKNOWN messages.
const uint16_t kUnknownThreshold = 6;
// receiver states
const uint8_t kIdleState = 2;
const uint8_t kMarkState = 3;
const uint8_t kSpaceState = 4;
const uint8_t kStopState = 5;
const uint8_t kTolerance = 25; // default percent tolerance in measurements.
const uint16_t kRawTick = 2; // Capture tick to uSec factor.
#define RAWTICK kRawTick // Deprecated. For legacy user code support only.
// How long (ms) before we give up wait for more data?
// Don't exceed kMaxTimeoutMs without a good reason.
// That is the capture buffers maximum value size. (UINT16_MAX / kRawTick)
// Typically messages/protocols tend to repeat around the 100ms timeframe,
// thus we should timeout before that to give us some time to try to decode
// before we need to start capturing a possible new message.
// Typically 15ms suits most applications. However, some protocols demand a
// higher value. e.g. 90ms for XMP-1 and some aircon units.
const uint8_t kTimeoutMs = 15; // In MilliSeconds.
#define TIMEOUT_MS kTimeoutMs // For legacy documentation.
const uint16_t kMaxTimeoutMs = kRawTick * (UINT16_MAX / MS_TO_USEC(1));
// Use FNV hash algorithm: http://isthe.com/chongo/tech/comp/fnv/#FNV-param
const uint32_t kFnvPrime32 = 16777619UL;
const uint32_t kFnvBasis32 = 2166136261UL;
#if DECODE_AC
// Hitachi AC is the current largest state size.
const uint16_t kStateSizeMax = kHitachiAc2StateLength;
#else
// Just define something
const uint16_t kStateSizeMax = 0;
#endif
// Types
// information for the interrupt handler
typedef struct {
uint8_t recvpin; // pin for IR data from detector
uint8_t rcvstate; // state machine
uint16_t timer; // state timer, counts 50uS ticks.
uint16_t bufsize; // max. nr. of entries in the capture buffer.
uint16_t *rawbuf; // raw data
// uint16_t is used for rawlen as it saves 3 bytes of iram in the interrupt
// handler. Don't ask why, I don't know. It just does.
uint16_t rawlen; // counter of entries in rawbuf.
uint8_t overflow; // Buffer overflow indicator.
uint8_t timeout; // Nr. of milliSeconds before we give up.
} irparams_t;
// results from a data match
typedef struct {
bool success; // Was the match successful?
uint64_t data; // The data found.
uint16_t used; // How many buffer positions were used.
} match_result_t;
// Classes
// Results returned from the decoder
class decode_results {
public:
decode_type_t decode_type; // NEC, SONY, RC5, UNKNOWN
// value, address, & command are all mutually exclusive with state.
// i.e. They MUST NOT be used at the same time as state, so we can use a union
// structure to save us a handful of valuable bytes of memory.
union {
struct {
uint64_t value; // Decoded value
uint32_t address; // Decoded device address.
uint32_t command; // Decoded command.
};
uint8_t state[kStateSizeMax]; // Multi-byte results.
};
uint16_t bits; // Number of bits in decoded value
volatile uint16_t *rawbuf; // Raw intervals in .5 us ticks
uint16_t rawlen; // Number of records in rawbuf.
bool overflow;
bool repeat; // Is the result a repeat code?
};
// main class for receiving IR
class IRrecv {
public:
explicit IRrecv(uint16_t recvpin, uint16_t bufsize = kRawBuf,
uint8_t timeout = kTimeoutMs,
bool save_buffer = false); // Constructor
~IRrecv(); // Destructor
bool decode(decode_results *results, irparams_t *save = NULL);
void enableIRIn();
void disableIRIn();
void resume();
uint16_t getBufSize();
#if DECODE_HASH
void setUnknownThreshold(uint16_t length);
#endif
static bool match(uint32_t measured, uint32_t desired,
uint8_t tolerance = kTolerance, uint16_t delta = 0);
static bool matchMark(uint32_t measured, uint32_t desired,
uint8_t tolerance = kTolerance,
int16_t excess = kMarkExcess);
static bool matchSpace(uint32_t measured, uint32_t desired,
uint8_t tolerance = kTolerance,
int16_t excess = kMarkExcess);
#ifndef UNIT_TEST
private:
#endif
irparams_t *irparams_save;
#if DECODE_HASH
uint16_t unknown_threshold;
#endif
// These are called by decode
void copyIrParams(volatile irparams_t *src, irparams_t *dst);
int16_t compare(uint16_t oldval, uint16_t newval);
static uint32_t ticksLow(uint32_t usecs, uint8_t tolerance = kTolerance,
uint16_t delta = 0);
static uint32_t ticksHigh(uint32_t usecs, uint8_t tolerance = kTolerance,
uint16_t delta = 0);
bool matchAtLeast(uint32_t measured, uint32_t desired,
uint8_t tolerance = kTolerance, uint16_t delta = 0);
match_result_t matchData(volatile uint16_t *data_ptr, const uint16_t nbits,
const uint16_t onemark, const uint32_t onespace,
const uint16_t zeromark, const uint32_t zerospace,
const uint8_t tolerance = kTolerance,
const int16_t excess = kMarkExcess,
const bool MSBfirst = true);
bool decodeHash(decode_results *results);
#if (DECODE_NEC || DECODE_SHERWOOD || DECODE_AIWA_RC_T501 || SEND_SANYO)
bool decodeNEC(decode_results *results, uint16_t nbits = kNECBits,
bool strict = true);
#endif
#if DECODE_SONY
bool decodeSony(decode_results *results, uint16_t nbits = kSonyMinBits,
bool strict = false);
#endif
#if DECODE_SANYO
// DISABLED due to poor quality.
// bool decodeSanyo(decode_results *results,
// uint16_t nbits = kSanyoSA8650BBits,
// bool strict = false);
bool decodeSanyoLC7461(decode_results *results,
uint16_t nbits = kSanyoLC7461Bits, bool strict = true);
#endif
#if DECODE_MITSUBISHI
bool decodeMitsubishi(decode_results *results,
uint16_t nbits = kMitsubishiBits, bool strict = true);
#endif
#if DECODE_MITSUBISHI2
bool decodeMitsubishi2(decode_results *results,
uint16_t nbits = kMitsubishiBits, bool strict = true);
#endif
#if DECODE_MITSUBISHI_AC
bool decodeMitsubishiAC(decode_results *results,
uint16_t nbits = kMitsubishiACBits,
bool strict = false);
#endif
#if (DECODE_RC5 || DECODE_R6 || DECODE_LASERTAG || DECODE_MWM)
int16_t getRClevel(decode_results *results, uint16_t *offset, uint16_t *used,
uint16_t bitTime, uint8_t tolerance = kTolerance,
int16_t excess = kMarkExcess, uint16_t delta = 0,
uint8_t maxwidth = 3);
#endif
#if DECODE_RC5
bool decodeRC5(decode_results *results, uint16_t nbits = kRC5XBits,
bool strict = true);
#endif
#if DECODE_RC6
bool decodeRC6(decode_results *results, uint16_t nbits = kRC6Mode0Bits,
bool strict = false);
#endif
#if DECODE_RCMM
bool decodeRCMM(decode_results *results, uint16_t nbits = kRCMMBits,
bool strict = false);
#endif
#if (DECODE_PANASONIC || DECODE_DENON)
bool decodePanasonic(decode_results *results, uint16_t nbits = kPanasonicBits,
bool strict = false,
uint32_t manufacturer = kPanasonicManufacturer);
#endif
#if DECODE_LG
bool decodeLG(decode_results *results, uint16_t nbits = kLgBits,
bool strict = false);
#endif
#if DECODE_JVC
bool decodeJVC(decode_results *results, uint16_t nbits = kJvcBits,
bool strict = true);
#endif
#if DECODE_SAMSUNG
bool decodeSAMSUNG(decode_results *results, uint16_t nbits = kSamsungBits,
bool strict = true);
#endif
#if DECODE_SAMSUNG_AC
bool decodeSamsungAC(decode_results *results, uint16_t nbits = kSamsungAcBits,
bool strict = true);
#endif
#if DECODE_WHYNTER
bool decodeWhynter(decode_results *results, uint16_t nbits = kWhynterBits,
bool strict = true);
#endif
#if DECODE_COOLIX
bool decodeCOOLIX(decode_results *results, uint16_t nbits = kCoolixBits,
bool strict = true);
#endif
#if DECODE_DENON
bool decodeDenon(decode_results *results, uint16_t nbits = DENON_BITS,
bool strict = true);
#endif
#if DECODE_DISH
bool decodeDISH(decode_results *results, uint16_t nbits = kDishBits,
bool strict = true);
#endif
#if (DECODE_SHARP || DECODE_DENON)
bool decodeSharp(decode_results *results, uint16_t nbits = kSharpBits,
bool strict = true, bool expansion = true);
#endif
#if DECODE_AIWA_RC_T501
bool decodeAiwaRCT501(decode_results *results,
uint16_t nbits = kAiwaRcT501Bits, bool strict = true);
#endif
#if DECODE_NIKAI
bool decodeNikai(decode_results *results, uint16_t nbits = kNikaiBits,
bool strict = true);
#endif
#if DECODE_MAGIQUEST
bool decodeMagiQuest(decode_results *results, uint16_t nbits = kMagiquestBits,
bool strict = true);
#endif
#if DECODE_KELVINATOR
bool decodeKelvinator(decode_results *results,
uint16_t nbits = kKelvinatorBits, bool strict = true);
#endif
#if DECODE_DAIKIN
bool decodeDaikin(decode_results *results, uint16_t nbits = kDaikinRawBits,
bool strict = true);
#endif
#if DECODE_TOSHIBA_AC
bool decodeToshibaAC(decode_results *results,
uint16_t nbytes = kToshibaACBits, bool strict = true);
#endif
#if DECODE_MIDEA
bool decodeMidea(decode_results *results, uint16_t nbits = kMideaBits,
bool strict = true);
#endif
#if DECODE_FUJITSU_AC
bool decodeFujitsuAC(decode_results *results, uint16_t nbits = kFujitsuAcBits,
bool strict = false);
#endif
#if DECODE_LASERTAG
bool decodeLasertag(decode_results *results, uint16_t nbits = kLasertagBits,
bool strict = true);
#endif
#if DECODE_CARRIER_AC
bool decodeCarrierAC(decode_results *results, uint16_t nbits = kCarrierAcBits,
bool strict = true);
#endif
#if DECODE_GREE
bool decodeGree(decode_results *results, uint16_t nbits = kGreeBits,
bool strict = true);
#endif
#if (DECODE_HAIER_AC | DECODE_HAIER_AC_YRW02)
bool decodeHaierAC(decode_results *results, uint16_t nbits = kHaierACBits,
bool strict = true);
#endif
#if DECODE_HAIER_AC_YRW02
bool decodeHaierACYRW02(decode_results *results,
uint16_t nbits = kHaierACYRW02Bits,
bool strict = true);
#endif
#if (DECODE_HITACHI_AC || DECODE_HITACHI_AC2)
bool decodeHitachiAC(decode_results *results, uint16_t nbits = kHitachiAcBits,
bool strict = true);
#endif
#if DECODE_HITACHI_AC1
bool decodeHitachiAC1(decode_results *results,
uint16_t nbits = kHitachiAc1Bits, bool strict = true);
#endif
#if DECODE_GICABLE
bool decodeGICable(decode_results *results, uint16_t nbits = kGicableBits,
bool strict = true);
#endif
#if DECODE_WHIRLPOOL_AC
bool decodeWhirlpoolAC(decode_results *results,
uint16_t nbits = kWhirlpoolAcBits, bool strict = true);
#endif
#if DECODE_LUTRON
bool decodeLutron(decode_results *results, uint16_t nbits = kLutronBits,
bool strict = true);
#endif
#if DECODE_ELECTRA_AC
bool decodeElectraAC(decode_results *results, uint16_t nbits = kElectraAcBits,
bool strict = true);
#endif
#if DECODE_PANASONIC_AC
bool decodePanasonicAC(decode_results *results,
uint16_t nbits = kPanasonicAcBits, bool strict = true);
#endif
#if DECODE_PIONEER
bool decodePioneer(decode_results *results,
const uint16_t nbits = kPioneerBits,
const bool strict = true);
#endif
#if DECODE_MWM
bool decodeMWM(decode_results *results, uint16_t nbits = 24,
bool strict = true);
#endif
};
#endif // IRRECV_H_
+453
View File
@@ -0,0 +1,453 @@
/***************************************************
* IRremote for ESP8266
*
* Based on the IRremote library for Arduino by Ken Shirriff
* Version 0.11 August, 2009
* Copyright 2009 Ken Shirriff
* For details, see http://arcfn.com/2009/08/multi-protocol-infrared-remote-library.html
*
* Edited by Mitra to add new controller SANYO
*
* Interrupt code based on NECIRrcv by Joe Knapp
* http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1210243556
* Also influenced by http://zovirl.com/2008/11/12/building-a-universal-remote-with-an-arduino/
*
* JVC and Panasonic protocol added by Kristian Lauszus (Thanks to zenwheel and other people at the original blog post)
* LG added by Darryl Smith (based on the JVC protocol)
* Whynter A/C ARC-110WD added by Francesco Meschia
* Coolix A/C / heatpump added by (send) bakrus & (decode) crankyoldgit
* Denon: sendDenon, decodeDenon added by Massimiliano Pinto
(from https://github.com/z3t0/Arduino-IRremote/blob/master/ir_Denon.cpp)
* Kelvinator A/C and Sherwood added by crankyoldgit
* Mitsubishi (TV) sending added by crankyoldgit
* Pronto code sending added by crankyoldgit
* Mitsubishi & Toshiba A/C added by crankyoldgit
* (derived from https://github.com/r45635/HVAC-IR-Control)
* DISH decode by marcosamarinho
* Gree Heatpump sending added by Ville Skyttä (scop)
* (derived from https://github.com/ToniA/arduino-heatpumpir/blob/master/GreeHeatpumpIR.cpp)
* Updated by markszabo (https://github.com/markszabo/IRremoteESP8266) for sending IR code on ESP8266
* Updated by Sebastien Warin (http://sebastien.warin.fr) for receiving IR code on ESP8266
*
* Updated by sillyfrog for Daikin, adopted from
* (https://github.com/mharizanov/Daikin-AC-remote-control-over-the-Internet/)
* Fujitsu A/C code added by jonnygraham
* Trotec AC code by stufisher
* Carrier & Haier AC code by crankyoldgit
*
* GPL license, all text above must be included in any redistribution
****************************************************/
#ifndef IRREMOTEESP8266_H_
#define IRREMOTEESP8266_H_
#define __STDC_LIMIT_MACROS
#include <stdint.h>
#ifdef UNIT_TEST
#include <iostream>
#endif
// Library Version
#define _IRREMOTEESP8266_VERSION_ "2.5.2"
// Supported IR protocols
// Each protocol you include costs memory and, during decode, costs time
// Disable (set to false) all the protocols you do not need/want!
// The Air Conditioner protocols are the most expensive memory-wise.
//
#define DECODE_HASH true // Semi-unique code for unknown messages
#define SEND_RAW true
#define DECODE_NEC true
#define SEND_NEC true
#define DECODE_SHERWOOD true // Doesn't exist. Actually is DECODE_NEC
#define SEND_SHERWOOD true
#define DECODE_RC5 true
#define SEND_RC5 true
#define DECODE_RC6 true
#define SEND_RC6 true
#define DECODE_RCMM true
#define SEND_RCMM true
#define DECODE_SONY true
#define SEND_SONY true
#define DECODE_PANASONIC true
#define SEND_PANASONIC true
#define DECODE_JVC true
#define SEND_JVC true
#define DECODE_SAMSUNG true
#define SEND_SAMSUNG true
#define DECODE_SAMSUNG_AC true
#define SEND_SAMSUNG_AC true
#define DECODE_WHYNTER true
#define SEND_WHYNTER true
#define DECODE_AIWA_RC_T501 true
#define SEND_AIWA_RC_T501 true
#define DECODE_LG true
#define SEND_LG true
#define DECODE_SANYO true
#define SEND_SANYO true
#define DECODE_MITSUBISHI true
#define SEND_MITSUBISHI true
#define DECODE_MITSUBISHI2 true
#define SEND_MITSUBISHI2 true
#define DECODE_DISH true
#define SEND_DISH true
#define DECODE_SHARP true
#define SEND_SHARP true
#define DECODE_DENON true
#define SEND_DENON true
#define DECODE_KELVINATOR true
#define SEND_KELVINATOR true
#define DECODE_MITSUBISHI_AC true // Beta.
#define SEND_MITSUBISHI_AC true
#define DECODE_FUJITSU_AC true
#define SEND_FUJITSU_AC true
#define DECODE_DAIKIN true
#define SEND_DAIKIN true
#define DECODE_COOLIX true
#define SEND_COOLIX true
#define DECODE_GLOBALCACHE false // Not written.
#define SEND_GLOBALCACHE true
#define DECODE_GREE true
#define SEND_GREE true
#define DECODE_PRONTO false // Not written.
#define SEND_PRONTO true
#define DECODE_ARGO false // Not written.
#define SEND_ARGO true
#define DECODE_TROTEC false // Not implemented.
#define SEND_TROTEC true
#define DECODE_NIKAI true
#define SEND_NIKAI true
#define DECODE_TOSHIBA_AC true
#define SEND_TOSHIBA_AC true
#define DECODE_MAGIQUEST true
#define SEND_MAGIQUEST true
#define DECODE_MIDEA true
#define SEND_MIDEA true
#define DECODE_LASERTAG true
#define SEND_LASERTAG true
#define DECODE_CARRIER_AC true
#define SEND_CARRIER_AC true
#define DECODE_HAIER_AC true
#define SEND_HAIER_AC true
#define DECODE_HITACHI_AC true
#define SEND_HITACHI_AC true
#define DECODE_HITACHI_AC1 true
#define SEND_HITACHI_AC1 true
#define DECODE_HITACHI_AC2 true
#define SEND_HITACHI_AC2 true
#define DECODE_GICABLE true
#define SEND_GICABLE true
#define DECODE_HAIER_AC_YRW02 true
#define SEND_HAIER_AC_YRW02 true
#define DECODE_WHIRLPOOL_AC true
#define SEND_WHIRLPOOL_AC true
#define DECODE_LUTRON true
#define SEND_LUTRON true
#define DECODE_ELECTRA_AC true
#define SEND_ELECTRA_AC true
#define DECODE_PANASONIC_AC true
#define SEND_PANASONIC_AC true
#define DECODE_MWM true
#define SEND_MWM true
#define DECODE_PIONEER true
#define SEND_PIONEER true
#if (DECODE_ARGO || DECODE_DAIKIN || DECODE_FUJITSU_AC || DECODE_GREE || \
DECODE_KELVINATOR || DECODE_MITSUBISHI_AC || DECODE_TOSHIBA_AC || \
DECODE_TROTEC || DECODE_HAIER_AC || DECODE_HITACHI_AC || \
DECODE_HITACHI_AC1 || DECODE_HITACHI_AC2 || DECODE_HAIER_AC_YRW02 || \
DECODE_WHIRLPOOL_AC || DECODE_SAMSUNG_AC || DECODE_ELECTRA_AC || \
DECODE_PANASONIC_AC || DECODE_MWM)
#define DECODE_AC true // We need some common infrastructure for decoding A/Cs.
#else
#define DECODE_AC false // We don't need that infrastructure.
#endif
// Use millisecond 'delay()' calls where we can to avoid tripping the WDT.
// Note: If you plan to send IR messages in the callbacks of the AsyncWebserver
// library, you need to set ALLOW_DELAY_CALLS to false.
// Ref: https://github.com/markszabo/IRremoteESP8266/issues/430
#define ALLOW_DELAY_CALLS true
/*
* Always add to the end of the list and should never remove entries
* or change order. Projects may save the type number for later usage
* so numbering should always stay the same.
*/
enum decode_type_t {
UNKNOWN = -1,
UNUSED = 0,
RC5,
RC6,
NEC,
SONY,
PANASONIC,
JVC,
SAMSUNG,
WHYNTER,
AIWA_RC_T501,
LG,
SANYO,
MITSUBISHI,
DISH,
SHARP,
COOLIX,
DAIKIN,
DENON,
KELVINATOR,
SHERWOOD,
MITSUBISHI_AC,
RCMM,
SANYO_LC7461,
RC5X,
GREE,
PRONTO, // Technically not a protocol, but an encoding.
NEC_LIKE,
ARGO,
TROTEC,
NIKAI,
RAW, // Technically not a protocol, but an encoding.
GLOBALCACHE, // Technically not a protocol, but an encoding.
TOSHIBA_AC,
FUJITSU_AC,
MIDEA,
MAGIQUEST,
LASERTAG,
CARRIER_AC,
HAIER_AC,
MITSUBISHI2,
HITACHI_AC,
HITACHI_AC1,
HITACHI_AC2,
GICABLE,
HAIER_AC_YRW02,
WHIRLPOOL_AC,
SAMSUNG_AC,
LUTRON,
ELECTRA_AC,
PANASONIC_AC,
PIONEER,
LG2,
MWM,
};
// Message lengths & required repeat values
const uint16_t kNoRepeat = 0;
const uint16_t kSingleRepeat = 1;
const uint16_t kAiwaRcT501Bits = 15;
const uint16_t kAiwaRcT501MinRepeats = kSingleRepeat;
const uint16_t kArgoStateLength = 12;
const uint16_t kCoolixBits = 24;
const uint16_t kCarrierAcBits = 32;
const uint16_t kCarrierAcMinRepeat = kNoRepeat;
// Daikin has a lot of static stuff that is discarded
const uint16_t kDaikinRawBits = 583;
const uint16_t kDaikinStateLength = 27;
const uint16_t kDaikinBits = kDaikinStateLength * 8;
const uint16_t kDenonBits = 15;
const uint16_t kDenonLegacyBits = 14;
const uint16_t kDishBits = 16;
const uint16_t kDishMinRepeat = 3;
const uint16_t kElectraAcStateLength = 13;
const uint16_t kElectraAcBits = kElectraAcStateLength * 8;
const uint16_t kFujitsuAcMinRepeat = kNoRepeat;
const uint16_t kFujitsuAcStateLength = 16;
const uint16_t kFujitsuAcStateLengthShort = 7;
const uint16_t kFujitsuAcBits = kFujitsuAcStateLength * 8;
const uint16_t kFujitsuAcMinBits = (kFujitsuAcStateLengthShort - 1) * 8;
const uint16_t kGicableBits = 16;
const uint16_t kGicableMinRepeat = kSingleRepeat;
const uint16_t kGreeStateLength = 8;
const uint16_t kGreeBits = kGreeStateLength * 8;
const uint16_t kHaierACStateLength = 9;
const uint16_t kHaierACBits = kHaierACStateLength * 8;
const uint16_t kHaierACYRW02StateLength = 14;
const uint16_t kHaierACYRW02Bits = kHaierACYRW02StateLength * 8;
const uint16_t kHitachiAcStateLength = 28;
const uint16_t kHitachiAcBits = kHitachiAcStateLength * 8;
const uint16_t kHitachiAc1StateLength = 13;
const uint16_t kHitachiAc1Bits = kHitachiAc1StateLength * 8;
const uint16_t kHitachiAc2StateLength = 53;
const uint16_t kHitachiAc2Bits = kHitachiAc2StateLength * 8;
const uint16_t kJvcBits = 16;
const uint16_t kKelvinatorStateLength = 16;
const uint16_t kKelvinatorBits = kKelvinatorStateLength * 8;
const uint16_t kLasertagBits = 13;
const uint16_t kLasertagMinRepeat = kNoRepeat;
const uint16_t kLgBits = 28;
const uint16_t kLg32Bits = 32;
const uint16_t kLutronBits = 35;
const uint16_t kMagiquestBits = 56;
const uint16_t kMideaBits = 48;
const uint16_t kMideaMinRepeat = kNoRepeat;
const uint16_t kMitsubishiBits = 16;
// TODO(anyone): Verify that the Mitsubishi repeat is really needed.
// Based on marcosamarinho's code.
const uint16_t kMitsubishiMinRepeat = kSingleRepeat;
const uint16_t kMitsubishiACStateLength = 18;
const uint16_t kMitsubishiACBits = kMitsubishiACStateLength * 8;
const uint16_t kMitsubishiACMinRepeat = kSingleRepeat;
const uint16_t kNikaiBits = 24;
const uint16_t kNECBits = 32;
const uint16_t kPanasonicBits = 48;
const uint32_t kPanasonicManufacturer = 0x4004;
const uint16_t kPanasonicAcStateLength = 27;
const uint16_t kPanasonicAcStateShortLength = 16;
const uint16_t kPanasonicAcBits = kPanasonicAcStateLength * 8;
const uint16_t kPanasonicAcShortBits = kPanasonicAcStateShortLength * 8;
const uint16_t kPioneerBits = 64;
const uint16_t kProntoMinLength = 6;
const uint16_t kRC5RawBits = 14;
const uint16_t kRC5Bits = kRC5RawBits - 2;
const uint16_t kRC5XBits = kRC5RawBits - 1;
const uint16_t kRC6Mode0Bits = 20; // Excludes the 'start' bit.
const uint16_t kRC6_36Bits = 36; // Excludes the 'start' bit.
const uint16_t kRCMMBits = 24;
const uint16_t kSamsungBits = 32;
const uint16_t kSamsungAcStateLength = 14;
const uint16_t kSamsungAcBits = kSamsungAcStateLength * 8;
const uint16_t kSamsungAcExtendedStateLength = 21;
const uint16_t kSamsungAcExtendedBits = kSamsungAcExtendedStateLength * 8;
const uint16_t kSanyoSA8650BBits = 12;
const uint16_t kSanyoLC7461AddressBits = 13;
const uint16_t kSanyoLC7461CommandBits = 8;
const uint16_t kSanyoLC7461Bits = (kSanyoLC7461AddressBits +
kSanyoLC7461CommandBits) * 2;
const uint8_t kSharpAddressBits = 5;
const uint8_t kSharpCommandBits = 8;
const uint16_t kSharpBits = kSharpAddressBits + kSharpCommandBits + 2; // 15
const uint8_t kSherwoodBits = kNECBits;
const uint16_t kSherwoodMinRepeat = kSingleRepeat;
const uint16_t kSony12Bits = 12;
const uint16_t kSony15Bits = 15;
const uint16_t kSony20Bits = 20;
const uint16_t kSonyMinBits = 12;
const uint16_t kSonyMinRepeat = 2;
const uint16_t kToshibaACStateLength = 9;
const uint16_t kToshibaACBits = kToshibaACStateLength * 8;
const uint16_t kToshibaACMinRepeat = kSingleRepeat;
const uint16_t kTrotecStateLength = 9;
const uint16_t kWhirlpoolAcStateLength = 21;
const uint16_t kWhirlpoolAcBits = kWhirlpoolAcStateLength * 8;
const uint16_t kWhynterBits = 32;
// Legacy defines. (Deprecated)
#define AIWA_RC_T501_BITS kAiwaRcT501Bits
#define ARGO_COMMAND_LENGTH kArgoStateLength
#define COOLIX_BITS kCoolixBits
#define CARRIER_AC_BITS kCarrierAcBits
#define DAIKIN_COMMAND_LENGTH kDaikinStateLength
#define DENON_BITS kDenonBits
#define DENON_48_BITS kPanasonicBits
#define DENON_LEGACY_BITS kDenonLegacyBits
#define DISH_BITS kDishBits
#define FUJITSU_AC_MIN_REPEAT kFujitsuAcMinRepeat
#define FUJITSU_AC_STATE_LENGTH kFujitsuAcStateLength
#define FUJITSU_AC_STATE_LENGTH_SHORT kFujitsuAcStateLengthShort
#define FUJITSU_AC_BITS kFujitsuAcBits
#define FUJITSU_AC_MIN_BITS kFujitsuAcMinBits
#define GICABLE_BITS kGicableBits
#define GREE_STATE_LENGTH kGreeStateLength
#define HAIER_AC_STATE_LENGTH kHaierACStateLength
#define HAIER_AC_YRW02_STATE_LENGTH kHaierACYRW02StateLength
#define HITACHI_AC_STATE_LENGTH kHitachiAcStateLength
#define HITACHI_AC_BITS kHitachiAcBits
#define HITACHI_AC1_STATE_LENGTH kHitachiAc1StateLength
#define HITACHI_AC1_BITS kHitachiAc1Bits
#define HITACHI_AC2_STATE_LENGTH kHitachiAc2StateLength
#define HITACHI_AC2_BITS kHitachiAc2Bits
#define JVC_BITS kJvcBits
#define KELVINATOR_STATE_LENGTH kKelvinatorStateLength
#define LASERTAG_BITS kLasertagBits
#define LG_BITS kLgBits
#define LG32_BITS kLg32Bits
#define MAGIQUEST_BITS kMagiquestBits
#define MIDEA_BITS kMideaBits
#define MITSUBISHI_BITS kMitsubishiBits
#define MITSUBISHI_AC_STATE_LENGTH kMitsubishiACStateLength
#define NEC_BITS kNECBits
#define NIKAI_BITS kNikaiBits
#define PANASONIC_BITS kPanasonicBits
#define RC5_BITS kRC5Bits
#define RC5X_BITS kRC5XBits
#define RC6_MODE0_BITS kRC6Mode0Bits
#define RC6_36_BITS kRC6_36Bits
#define RCMM_BITS kRCMMBits
#define SANYO_LC7461_BITS kSanyoLC7461Bits
#define SAMSUNG_BITS kSamsungBits
#define SANYO_SA8650B_BITS kSanyoSA8650BBits
#define SHARP_BITS kSharpBits
#define SHERWOOD_BITS kSherwoodBits
#define SONY_12_BITS kSony12Bits
#define SONY_15_BITS kSony15Bits
#define SONY_20_BITS kSony20Bits
#define TOSHIBA_AC_STATE_LENGTH kToshibaACStateLength
#define TROTEC_COMMAND_LENGTH kTrotecStateLength
#define WHYNTER_BITS kWhynterBits
// Turn on Debugging information by uncommenting the following line.
// #define DEBUG 1
#ifdef DEBUG
#ifdef UNIT_TEST
#define DPRINT(x) do { std::cout << x; } while (0)
#define DPRINTLN(x) do { std::cout << x << std::endl; } while (0)
#endif // UNIT_TEST
#ifdef ARDUINO
#define DPRINT(x) do { Serial.print(x); } while (0)
#define DPRINTLN(x) do { Serial.println(x); } while (0)
#endif // ARDUINO
#else // DEBUG
#define DPRINT(x)
#define DPRINTLN(x)
#endif // DEBUG
#endif // IRREMOTEESP8266_H_

Some files were not shown because too many files have changed in this diff Show More