132 Commits
v2.0 ... v2.1.1

Author SHA1 Message Date
de6174c108 platformio.ini monitor baudrate&due bins updated 2020-12-17 01:43:55 +03:00
2d10ac6fbd Critical: DMXsmooth buffer memory corruption fixed 2020-12-17 01:26:23 +03:00
b0c65eb94b MQTT port/login/password issue fixed for some platforms 2020-12-06 02:44:45 +03:00
ffa2c521c5 Adopted to aJson lib update 2020-12-03 01:17:49 +03:00
f12286c3b9 Merge pull request #57 from anklimov/develop
RC Release notes:
=====
OTA
Universal Modbus (Read only)
Syslog fixes
MCP23017 driver
StatusLED
Moved to upstream Ethernet library for WizNet
Multiply buttons on single analog input
Refactoring LAN StateMachine and many relability improvements
2020-10-13 01:36:29 +03:00
cab96de146 Merge branch 'master' into develop 2020-10-13 01:34:24 +03:00
accfd0d245 Red blink on errors
Some cleanup
2020-10-06 02:25:07 +03:00
11943d4fc4 ReRead config AVR/syslog 2020-10-05 17:51:26 +03:00
a511869498 (critical) Syslog memory corruption fixed
LAN startup improved
2020-10-05 15:07:51 +03:00
13efb609d3 Refactored LAN final automate (Ethernet2 lib update required) 2020-10-05 03:50:23 +03:00
38cd7baf58 OTA sockets leak fixed with every Ethernet interface restart (critical) 2020-10-04 02:43:44 +03:00
1f1cd1024f compilation fix for slim options 2020-08-15 03:01:39 +03:00
b6610a31e7 Analog & I2C input reading cache
New input configuration format
many Discrete inputs on single analog in
2020-08-08 00:21:21 +03:00
97714b5c15 REST command fixed 2020-08-07 02:06:05 +03:00
840d3d60eb Modbus v2 initialization fixed 2020-07-26 14:20:04 +03:00
3b8d085b29 ESP32 stability fix + remove DMX 2020-07-15 02:11:43 +03:00
10a9bb119d building flags & small bugfix (MQTT&TOGGLE) 2020-07-14 01:54:42 +03:00
fb6bb153ba ESP8266 build 2020-07-13 22:32:07 +03:00
dffba00f74 ESP Wifi auto-restore connect for wifi manager
FIX Ethernet for ESP
2020-07-13 21:40:58 +03:00
832b469103 MCP23017 inputs
STATUSLED
Compilation for all platforms
WIFI_ENABLE option to allow wired connection for ESP
Modbus, Syslog for ESP
2020-07-12 21:56:05 +03:00
8b4b129b39 Master compilation error due Wiznet 5100 library replacing was fixed 2020-07-06 01:46:01 +03:00
3c38e151e1 SlatusLed & reverting to Ethernet2 wiznet lib 2020-07-04 22:04:57 +03:00
76fb07a7b2 few OTA changes 2020-06-14 17:11:17 +03:00
e87240d841 new interface class itemCmd as interface between objects
Modbus polling->MQTT
syslog fix
different level of logging infoSerial errorSerial
2020-06-06 18:03:57 +03:00
8c95732164 sysLog fixed, added logging library (for serial & syslog) 2020-05-31 18:14:10 +03:00
00e631515f due OTA programming, EEPROM signature check 2020-05-30 18:23:50 +03:00
f691aa0cb0 stop channels when get 2020-05-26 23:26:42 +03:00
0687949bb7 API simplificatoin ph1 (@send param remove 2020-05-21 15:36:35 +03:00
cebb6fc486 modbus serial parameters in config 2020-05-18 08:00:48 +03:00
0dedf388da interim commit: universal Modbus driver 2020-05-13 13:03:12 +03:00
4740e881f4 Merge pull request #55 from anklimov/develop
1-wire fixes
2020-05-09 04:16:55 +03:00
28909c0f34 Binaries recompiled with updated 1-wire libraries DS2482-100 and DallasTemperature 2020-05-09 04:15:27 +03:00
6277a44b1d fix for software 1-wire driver 2020-05-09 04:03:21 +03:00
d4536e403c 1-wire fix & cleanup 2020-05-08 03:43:03 +03:00
e4a5c37cf9 1-wire fix & simplification 2020-05-08 02:53:47 +03:00
e4cf5a45a5 Merge pull request #54 from anklimov/develop
Release-2.1
2020-05-07 01:53:22 +03:00
56a0360823 binaries 2020-05-07 01:31:02 +03:00
9d15f7ad9b RGB bright fix 2020-05-07 01:12:01 +03:00
f650b830d7 Compiled for all platforms + binaries 2020-05-07 00:22:27 +03:00
7b9c474c19 Motor driver fix and extension (auto switch PWM/NON PWM, Motor Quota) 2020-05-07 00:04:50 +03:00
08f251bc63 1wire error handling 2020-04-27 02:25:43 +03:00
ff6816b2e1 multiClick automation slightly modified
Suffix calculaton bug fixed
HUE&SAT impact to non-color channels fixed
2020-04-18 18:59:35 +03:00
c7bed971ba Fixes: negative pin# hung, compilation error, double ON ->white color, analog mapping on the edges of interval, macaddr mask, potential unrelability on LAN re-interability 2020-04-17 23:14:17 +03:00
d1d62515b6 Legacy input rcmd bug fixed 2020-04-02 02:40:26 +03:00
054ac6a206 /set suffix for RGB channel setup turning chan on bug fixed 2020-03-17 02:52:16 +03:00
d5e9686ca9 Compilation issue (with updated libs) fixed for most platforms
Command now can be refined for particular channel state using 
SUBITEM=CMD
2020-03-03 02:27:09 +03:00
504280ca84 compilation fix after ccs811 lib refactoring 2020-03-02 01:03:14 +03:00
24bf7316a9 Smooth DMX fadind for DUE 2020-01-19 23:59:05 +03:00
75b08441f7 SendStatus interim refactoring 2020-01-10 15:21:33 +03:00
e0a6ac9ff0 input "erev" param bug 2020-01-10 14:19:50 +03:00
9e9a3c6e7e Config re-reading memory corruption issue fixed 2020-01-10 13:33:22 +03:00
cc96e4697e fix 2020-01-10 00:57:34 +03:00
7dd48f78d4 JSON string type control. Relability fix 2020-01-10 00:45:32 +03:00
602a997757 input FA small fix 2020-01-09 00:43:12 +03:00
d0537484c5 /hue /sat fix 2020-01-08 21:36:30 +03:00
cacd9eab27 Fine tuning & bugfixing (Forced white, short-off) 2020-01-08 20:44:42 +03:00
5a06d221c8 items: /sat and /hue parameters can be changed separately 2020-01-08 13:45:37 +03:00
0044b741ac contact input: two-way long click
INCREASE and DECREASE (%) commands for volume, hue, sat
2020-01-08 03:00:38 +03:00
951d0d4383 single, double, tripple click, longpress, repeat logic for contact inputs are added 2020-01-07 00:15:13 +03:00
8a3980272e Modbus retry for VaCom fixed
1-st attempt to add OTA
2019-11-27 03:49:00 +03:00
b02edbda5e Cross-compilaton for all platforms & binaries 2019-11-09 04:27:25 +03:00
f57d47dc2b retry if modbus command failed
*/set topics don't invoke OFF/ON anymore
2019-11-09 03:13:41 +03:00
a3e0e70aec HSV -> RGB translation for Adafruit fixed (OMG!)
RGB volume restoring issue fixed
AirFlow regulator action timer more precsision
2019-11-09 01:50:02 +03:00
c947c8bb4c Motor driver with feedback input (Airflow regulator Dospel)
items pulling reworked
2019-11-03 03:31:32 +03:00
23167b4f1c "item":"item/set" - like config entries allowed now. Completely removed/refactored CMD_SET (suffixes are working instead now) - those commands and settings for challels are separated now 2019-10-24 03:57:18 +03:00
b779fd0fac Adafruit NeoPixel library used instead fastLed (allow define [pin#,num,LEDorder] in configuration. Use FASTLED directive to revert FASTLed back 2019-10-23 23:53:45 +03:00
86b19d081d interim spi-led fix 2019-10-22 01:29:48 +03:00
26e8fed4e1 Merge branch 'develop' of https://github.com/anklimov/lighthub into develop 2019-10-21 02:40:57 +03:00
78e1562b48 Interim SPI-LED update: general LED logic appplied, LED-ranges, dynamic LED array alloc 2019-10-21 02:40:27 +03:00
9ce0a84208 Merge pull request #53 from anklimov/develop
Major release commit
Windows compilation fixed (removed dependency from bash)
Core logic refactored - modularity for new devices added
-New module: Haier Air Conditioner UART control
-New module: SPI Led (not finalized yet, need remove hardcodes) - just as module example now
MQTT structure unified: split Commands and Settings topics
HomeAssistant compatibility (+HomeKit, GoogleHome, Alice)
HomeBridge compatibility (Homekit)
2019-10-17 14:02:34 +03:00
99b2456f82 Merge branch 'master' into develop 2019-10-17 14:01:40 +03:00
9cd0d924bb NO Bash required (windows compilation problem gone) - migrated to python
build flags format simplified
Binaries updated
2019-10-17 03:13:39 +03:00
0841c2b06f binaries 2019-10-16 03:12:30 +03:00
9356fa70c5 - 2019-10-16 03:06:12 +03:00
77701e541c Merge branch 'develop' of https://github.com/anklimov/lighthub into develop 2019-10-16 03:03:03 +03:00
c8561c8071 Compiled for all platforms 2019-10-16 03:02:43 +03:00
d7fda3b89e - 2019-10-16 02:54:23 +03:00
8ddd8f1313 - 2019-10-16 02:53:50 +03:00
668f0118b0 mac check 2019-10-16 01:31:31 +03:00
a80509af34 windows PIO compilation issue fixed 2019-10-16 01:02:02 +03:00
8a649272e0 cross-compilation (ESP/MEGA/DUE) 2019-10-15 16:49:10 +03:00
8699f496d6 ccs811 co2 error suppressing 2019-10-15 14:13:54 +03:00
0d3b260bd5 ac fan mode fix 2019-10-15 03:17:32 +03:00
d2915e9ad9 no @set command stored internally anymore to have clear differenciate on-off and value changing 2019-10-15 02:52:34 +03:00
0fbf9f0849 nodered colorpicker restored 2019-09-23 00:29:37 +03:00
88d9c262af HALT, REST, XON, XOFF for drivers 2019-09-22 02:13:59 +03:00
7c9d9d171b Critical AC fix
Some additional commands compatibility for generic driver
2019-09-22 00:25:25 +03:00
e487db022a fix AC temp update 2019-09-18 02:35:22 +03:00
9b413cd9bb AC mqtt status fixed
cmd  update for "set
Enabled & disabled
2019-09-18 02:23:13 +03:00
862f4bc0d3 Air conditioner driver (Haier) - working now
Small cold restart LED color restore issue fixed
command enlarged to 8 bit
2019-09-18 00:38:15 +03:00
9a0cff1f63 cleanup 2019-09-15 08:01:50 +03:00
21c09b2588 Merge branch 'develop' of https://github.com/anklimov/lighthub into develop 2019-09-15 07:56:03 +03:00
f900f897b7 Merge pull request #52 from anklimov/GenericOut
Core refactored - 'drivers' for items added
MQTT topics structure changed
driver example for SPI LED
driver example for Air conditioner HAIER
Termostat compatibility for HomeKit and HomeAssistant
2019-09-15 07:52:15 +03:00
3fae70bd61 Haier Air Conditioner UART driver added (initial release)
some warnings removed
2019-09-15 00:44:07 +03:00
206355b3ec group restore/interim fix 2019-09-14 06:53:04 +03:00
4b1be34561 modbus retry issue, core fixes (cold restore issues) 2019-08-29 16:35:56 +03:00
549bd6527c TOGGLE input re-intrrable issue fixed double toggling 2019-08-29 01:06:07 +03:00
90965aad85 commands are case insensetive now
new commands for HVAC/Thermostates
core logic fixes: Group channel logic& stats
RGBx color change cmd will turn chan on
Modbus fm driver shutdown on alarm deadlock fixed
hsv bit flag in channels RAM profile added
MQTT send empty command for OH fixed
ON for thermostat causes HEAT string to stat topic (to be compatible 
with homekit & home assistant)
2019-08-21 23:20:43 +03:00
a001bd9e35 HomeKit (HomeBridge) compatible thermostat now.
Small bugfixes & cleanup
2019-08-13 23:26:17 +03:00
209cba2352 getFlag/setFlag/clearFlag added (cmd ext refactoring) 2019-08-13 12:30:58 +03:00
1e06556fe5 pre-sendStatus routine refactoring commit 2019-08-13 03:37:02 +03:00
94810689c2 Split connand and value topics. 1st attempt 2019-08-10 23:20:23 +03:00
64588b6c5a gitignore 2019-08-01 20:21:41 +03:00
fa1127190c just working adddress led 2019-08-01 20:03:37 +03:00
fb64394571 driver status, setup, stop 2019-07-19 13:52:52 +03:00
a24e56e941 generic output channel and first example on SPI LED 2019-07-19 01:11:48 +03:00
91a3aeb206 remove .vscode 2019-07-16 22:04:40 +03:00
cc0a679613 remove .vscode 2019-07-16 22:02:28 +03:00
5c4b1512bb abstract ch defs 2019-07-16 22:00:11 +03:00
c78891a423 modbus pooling/tomeout fix 2019-07-14 01:44:06 +03:00
088a4b0397 channels abstraction changed 2019-07-14 01:11:23 +03:00
5540b6ae4d - 2019-07-13 20:18:56 +03:00
bb318d6a96 binaries for due-5500 2019-07-11 02:01:41 +03:00
07349f3586 Merge pull request #51 from anklimov/develop
Develop
2019-07-08 02:29:39 +03:00
6c0c3ce77e Merge pull request #50 from anklimov/GenericOut
fixed network for MEGA+Wiz5500,  … Mega DMX OUT on TX1 pin now (same with DUE), E81 port Modbus dimmer settings for MEGA. AVR Binaries
2019-07-08 02:27:13 +03:00
4efe3af7bb fixed network for MEGA+Wiz5500,
Mega DMX OUT on TX1 pin now (same with DUE),
E81 port Modbus dimmer settings for MEGA. AVR Binaries
2019-07-08 02:25:41 +03:00
8aec09fe76 Merge pull request #49 from anklimov/GenericOut
simple analog mapping fix (& binaries)
2019-07-01 18:54:11 +03:00
1919d3c210 simple analog mapping fix (& binaries) 2019-06-29 16:35:45 +03:00
ea67d46810 minor fix & binaries 2019-06-27 10:32:13 +03:00
e6f8e3f9d0 Fix & binaries 2019-06-27 00:21:51 +03:00
3542ba1a6a analog mapping return float value now
noize parameter working against input of mapping translation
2019-06-26 23:35:55 +03:00
719908d7ff Merge pull request #48 from anklimov/develop
ESP8266 EEPROM commit for CLI commands pwd, get, ip added
2019-06-16 23:29:45 +03:00
d7e4181377 ESP8266 EEPROM commit for CLI commands pwd, get, ip added 2019-06-16 23:26:35 +03:00
1214e306ea Merge pull request #47 from anklimov/develop
static IP address fix
2019-06-16 00:11:10 +03:00
ae868f42d6 binaries 2019-06-16 00:09:00 +03:00
fda79ea55f static ip is working again 2019-06-15 01:13:51 +03:00
a19ee7bc51 Merge pull request #46 from anklimov/develop
Develop
2019-06-11 15:40:07 +03:00
21b93f4065 Merge pull request #45 from anklimov/develop
merging Develop branch
2019-06-04 20:33:04 +03:00
902b2768fb Merge pull request #43 from anklimov/develop
Critical: hdc1080 sensor stack overflow fixed
2019-05-01 22:40:28 +03:00
dff2f43e41 Merge pull request #42 from anklimov/develop
Develop
2019-04-30 15:37:43 +03:00
3b1f1e7b9e Merge pull request #41 from anklimov/develop
Develop branch merge
2019-04-25 19:20:52 +03:00
5a99efa0c2 Merge pull request #40 from anklimov/develop
Develop to master
MANY stability improvements, Wifi, compilation for all platforms, include ESP32, new sensors, Embedded MAC address for ESPx and DUE, New RGB conversion algorithm and Node-Red compatibility

Release-Candidate for 2.0
Merge
2019-04-09 21:39:42 +03:00
108 changed files with 40693 additions and 23358 deletions

22
.gitignore vendored
View File

@@ -6,12 +6,16 @@
.DS_Store .DS_Store
CMakeListsPrivate.txt CMakeListsPrivate.txt
custom-build-flags/* custom-build-flags/*
build_flags_due.sh custom-build-flags/build_flags_due
build_flags_esp32.sh custom-build-flags/build_flags_esp32
build_flags_esp8266.sh custom-build-flags/build_flags_esp8266
build_flags_stm32.sh custom-build-flags/build_flags_stm32
build_flags_due-5500.sh custom-build-flags/build_flags_due-5500
build_flags_mega2560.sh custom-build-flags/build_flags_mega2560
build_flags_mega2560-net.sh custom-build-flags/build_flags_mega2560-net
build_flags_controllino.sh custom-build-flags/build_flags_controllino
build_flags_nrf52840.sh custom-build-flags/build_flags_nrf52840
.vscode/*
.vscode/.browse.c_cpp.db
.vscode/c_cpp_properties.json
.vscode/launch.json

Binary file not shown.

View File

@@ -1,4 +0,0 @@
{
"board": "arduino:sam:arduino_due_x",
"port": "/dev/cu.usbmodem1411"
}

View File

@@ -1,108 +0,0 @@
{
"!!! WARNING !!!": "PLEASE DO NOT MODIFY THIS FILE! USE https://docs.platformio.org/page/projectconf/section_env_build.html#build-flags",
"configurations": [
{
"name": "Mac",
"macFrameworkPath": [],
"includePath": [
"/Users/andrey/Library/Arduino15/packages/arduino/tools/**",
"/Users/andrey/Library/Arduino15/packages/arduino/hardware/sam/1.6.11/**",
"/Users/andrey/.platformio/packages/framework-arduinosam/cores/sam",
"/Users/andrey/.platformio/packages/framework-arduinosam/system/sam/libsam",
"/Users/andrey/.platformio/packages/framework-arduinosam/system/sam/CMSIS/CMSIS/Include",
"/Users/andrey/.platformio/packages/framework-arduinosam/system/sam/CMSIS/Device/ATMEL",
"/Users/andrey/.platformio/packages/framework-arduinosam/variants/arduino_due_x",
"/Users/andrey/Documents/Arduino/lighthub/.piolibdeps/Adafruit Unified Sensor_ID31",
"/Users/andrey/Documents/Arduino/lighthub/.piolibdeps/ArduinoHttpClient/src",
"/Users/andrey/Documents/Arduino/lighthub/.piolibdeps/Artnet",
"/Users/andrey/Documents/Arduino/lighthub/.piolibdeps/CmdArduino",
"/Users/andrey/Documents/Arduino/lighthub/.piolibdeps/DHT sensor library_ID19",
"/Users/andrey/Documents/Arduino/lighthub/.piolibdeps/DS2482_OneWire",
"/Users/andrey/Documents/Arduino/lighthub/.piolibdeps/DallasTemperature",
"/Users/andrey/.platformio/packages/framework-arduinosam/libraries/__cores__/sam/Wire/src",
"/Users/andrey/Documents/Arduino/lighthub/.piolibdeps/DmxDue",
"/Users/andrey/Documents/Arduino/lighthub/.piolibdeps/DueFlashStorage/src",
"/Users/andrey/Documents/Arduino/lighthub/.piolibdeps/Ethernet2/src",
"/Users/andrey/Documents/Arduino/lighthub/.piolibdeps/FastLED_ID126",
"/Users/andrey/Documents/Arduino/lighthub/.piolibdeps/ModbusMaster/src",
"/Users/andrey/Documents/Arduino/lighthub/.piolibdeps/PrintEx/src",
"/Users/andrey/Documents/Arduino/lighthub/.piolibdeps/PubSubClient/src",
"/Users/andrey/Documents/Arduino/lighthub/.piolibdeps/SD_ID161",
"/Users/andrey/.platformio/packages/framework-arduinosam/libraries/__cores__/sam/SPI/src",
"/Users/andrey/Documents/Arduino/lighthub/.piolibdeps/SdFat_ID322/src",
"/Users/andrey/Documents/Arduino/lighthub/.piolibdeps/Streaming_ID560",
"/Users/andrey/Documents/Arduino/lighthub/.piolibdeps/Syslog/src",
"/Users/andrey/Documents/Arduino/lighthub/.piolibdeps/aJson",
"/Users/andrey/Documents/Arduino/lighthub/.piolibdeps/Ethernet2_ID261/src",
"/Users/andrey/.platformio/packages/framework-arduinosam/libraries/__cores__/sam/HID/src",
"/Users/andrey/.platformio/packages/tool-unity",
"/Users/andrey/Documents/Arduino/lighthub/include",
"/Users/andrey/Documents/Arduino/lighthub/lighthub",
""
],
"browse": {
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": "${workspaceRoot}/.vscode/.browse.c_cpp.db",
"path": [
"/Users/andrey/.platformio/packages/framework-arduinosam/cores/sam",
"/Users/andrey/.platformio/packages/framework-arduinosam/system/sam/libsam",
"/Users/andrey/.platformio/packages/framework-arduinosam/system/sam/CMSIS/CMSIS/Include",
"/Users/andrey/.platformio/packages/framework-arduinosam/system/sam/CMSIS/Device/ATMEL",
"/Users/andrey/.platformio/packages/framework-arduinosam/variants/arduino_due_x",
"/Users/andrey/Documents/Arduino/lighthub/.piolibdeps/Adafruit Unified Sensor_ID31",
"/Users/andrey/Documents/Arduino/lighthub/.piolibdeps/ArduinoHttpClient/src",
"/Users/andrey/Documents/Arduino/lighthub/.piolibdeps/Artnet",
"/Users/andrey/Documents/Arduino/lighthub/.piolibdeps/CmdArduino",
"/Users/andrey/Documents/Arduino/lighthub/.piolibdeps/DHT sensor library_ID19",
"/Users/andrey/Documents/Arduino/lighthub/.piolibdeps/DS2482_OneWire",
"/Users/andrey/Documents/Arduino/lighthub/.piolibdeps/DallasTemperature",
"/Users/andrey/.platformio/packages/framework-arduinosam/libraries/__cores__/sam/Wire/src",
"/Users/andrey/Documents/Arduino/lighthub/.piolibdeps/DmxDue",
"/Users/andrey/Documents/Arduino/lighthub/.piolibdeps/DueFlashStorage/src",
"/Users/andrey/Documents/Arduino/lighthub/.piolibdeps/Ethernet2/src",
"/Users/andrey/Documents/Arduino/lighthub/.piolibdeps/FastLED_ID126",
"/Users/andrey/Documents/Arduino/lighthub/.piolibdeps/ModbusMaster/src",
"/Users/andrey/Documents/Arduino/lighthub/.piolibdeps/PrintEx/src",
"/Users/andrey/Documents/Arduino/lighthub/.piolibdeps/PubSubClient/src",
"/Users/andrey/Documents/Arduino/lighthub/.piolibdeps/SD_ID161",
"/Users/andrey/.platformio/packages/framework-arduinosam/libraries/__cores__/sam/SPI/src",
"/Users/andrey/Documents/Arduino/lighthub/.piolibdeps/SdFat_ID322/src",
"/Users/andrey/Documents/Arduino/lighthub/.piolibdeps/Streaming_ID560",
"/Users/andrey/Documents/Arduino/lighthub/.piolibdeps/Syslog/src",
"/Users/andrey/Documents/Arduino/lighthub/.piolibdeps/aJson",
"/Users/andrey/Documents/Arduino/lighthub/.piolibdeps/Ethernet2_ID261/src",
"/Users/andrey/.platformio/packages/framework-arduinosam/libraries/__cores__/sam/HID/src",
"/Users/andrey/.platformio/packages/tool-unity",
"/Users/andrey/Documents/Arduino/lighthub/include",
"/Users/andrey/Documents/Arduino/lighthub/lighthub",
""
]
},
"defines": [
"PLATFORMIO=40000",
"__SAM3X8E__",
"ARDUINO_ARCH_SAM",
"ARDUINO_SAM_DUE",
"Wiz5500",
"ARTNET_ENABLE",
"F_CPU=84000000L",
"USBCON",
"ARDUINO=10805",
"USB_VID=0x2341",
"USB_PID=0x003E",
"USB_PRODUCT=\"Arduino Due\"",
"USB_MANUFACTURER=\"Arduino\"",
"printf=iprintf",
""
],
"intelliSenseMode": "clang-x64",
"cStandard": "c11",
"cppStandard": "c++11",
"compilerPath": "/Users/andrey/.platformio/packages/toolchain-gccarmnoneeabi@1.40804.0/bin/arm-none-eabi-gcc -mthumb -mcpu=cortex-m3",
"forcedInclude": [
"/Users/andrey/Library/Arduino15/packages/arduino/hardware/sam/1.6.11/cores/arduino/Arduino.h"
]
}
],
"version": 4
}

View File

@@ -1,7 +0,0 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"platformio.platformio-ide"
]
}

34
.vscode/launch.json vendored
View File

@@ -1,34 +0,0 @@
// AUTOMATICALLY GENERATED FILE. PLEASE DO NOT MODIFY IT MANUALLY
// PIO Unified Debugger
//
// Documentation: https://docs.platformio.org/page/plus/debugging.html
// Configuration: https://docs.platformio.org/page/projectconf/section_env_debug.html
{
"version": "0.2.0",
"configurations": [
{
"type": "platformio-debug",
"request": "launch",
"name": "PIO Debug",
"executable": "/Users/andrey/Documents/Arduino/lighthub/.pioenvs/due-5500/firmware.elf",
"toolchainBinDir": "/Users/andrey/.platformio/packages/toolchain-gccarmnoneeabi@1.40804.0/bin",
"svdPath": "/Users/andrey/.platformio/platforms/atmelsam/misc/svd/ATSAM3X8E.svd",
"preLaunchTask": {
"type": "PlatformIO",
"task": "Pre-Debug"
},
"internalConsoleOptions": "openOnSessionStart"
},
{
"type": "platformio-debug",
"request": "launch",
"name": "PIO Debug (skip Pre-Debug)",
"executable": "/Users/andrey/Documents/Arduino/lighthub/.pioenvs/due-5500/firmware.elf",
"toolchainBinDir": "/Users/andrey/.platformio/packages/toolchain-gccarmnoneeabi@1.40804.0/bin",
"svdPath": "/Users/andrey/.platformio/platforms/atmelsam/misc/svd/ATSAM3X8E.svd",
"internalConsoleOptions": "openOnSessionStart"
}
]
}

View File

@@ -1,6 +0,0 @@
{
"terminal.integrated.env.osx": {
"PATH": "/Users/andrey/.platformio/penv/bin:/Users/andrey/.platformio/penv:/usr/local/opt/ruby/bin:/usr/local/opt/python@2/bin:/opt/local/sbin:/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Applications/Wireshark.app/Contents/MacOS",
"PLATFORMIO_CALLER": "vscode"
}
}

View File

@@ -0,0 +1,3 @@
-DCONTROLLINO
-DCUSTOM_FIRMWARE_MAC=de:ad:be:ef:fe:07
-DWiz5100

View File

@@ -0,0 +1,7 @@
#-DW5500_CS_PIN=53
-DDMX_SMOOTH
-DSYSLOG_ENABLE
-DMODBUS_DIMMER_PARAM=SERIAL_8E1
-DARTNET_ENABLE
-DOTA
-DSTATUSLED

View File

@@ -0,0 +1,5 @@
-DARTNET_ENABLE
-DDMX_SMOOTH
-DSTATUSLED
-DSYSLOG_ENABLE
-DWiz5100

View File

@@ -0,0 +1,5 @@
-DWiz5500
-DARTNET_ENABLE
-DDMX_SMOOTH
-DSTATUSLED
-DSYSLOG_ENABLE

View File

@@ -0,0 +1,15 @@
-DWIFI_ENABLE
-DDMX_DISABLE
# - exeption in DMX.update/begin
#-DSPILED_DISABLE
#-DAC_DISABLE
-DMODBUS_DISABLE
#-DMBUS_DISABLE
-DCOUNTER_DISABLE
#-DSYSLOG_ENABLE - udp errors
-DOTA
-DMCP23017
-DMODBUS_TX_PIN=13
#-DARTNET_ENABLE - udp rx errors ((
#-DUSE_1W_PIN=16
#-DW5500_CS_PIN=15

View File

@@ -0,0 +1,9 @@
-DWIFI_ENABLE
-DMODBUS_DISABLE
-DOTA
-std=gnu++11
-DSYSLOG_ENABLE
-DMCP23017
-DARTNET_ENABLE
-DUSE_1W_PIN=16
-DW5500_CS_PIN=15

View File

@@ -0,0 +1,10 @@
-DW5500_CS_PIN=53
-DARTNET_ENABLE
-DDMX_SMOOTH
-DMODBUS_DIMMER_PARAM=SERIAL_8E1
-DMODBUS_SERIAL_BAUD=9600
-DOTA
-DSYSLOG_ENABLE
#-DWiz5500
-DSTATUSLED
-DMCP23017

View File

@@ -0,0 +1,11 @@
-DWIFI_ENABLE
-DDMX_DISABLE
-DMODBUS_DISABLE
-DOWIRE_DISABLE
-DDHT_DISABLE
-DCOUNTER_DISABLE
-DSPILED_DISABLE
-DAC_DISABLE
-DM5STACK
#-DSYSLOG_ENABLE
-DUSE_1W_PIN=16

View File

@@ -0,0 +1,4 @@
-DMODBUS_DIMMER_PARAM=SERIAL_8E1
-DAVR_DMXOUT_PIN=18
-DSYSLOG_ENABLE
-DWiz5100

View File

@@ -0,0 +1,4 @@
-DWiz5500
-DMODBUS_DIMMER_PARAM=SERIAL_8E1
-DAVR_DMXOUT_PIN=18
-DSYSLOG_ENABLE

View File

@@ -0,0 +1,14 @@
#-DMODBUS_DIMMER_PARAM=SERIAL_8E1
#-DAVR_DMXOUT_PIN=18
-DDMX_DISABLE
-DMODBUS_DISABLE
#-DMBUS_DISABLE
#-DOWIRE_DISABLE
-DDHT_DISABLE
-DCOUNTER_DISABLE
-DNO_HOMIE
-DCSSHDC_DISABLE
-DSPILED_DISABLE
-DAC_DISABLE
-DSYSLOG_ENABLE

View File

@@ -0,0 +1,13 @@
-DWiz5500
#-DW5500_CS_PIN=10
-DDMX_DISABLE
-DMODBUS_DISABLE
#-DOWIRE_DISABLE
-std=gnu++11
-DWIFI_MANAGER_DISABLE
-DCOUNTER_DISABLE
-DCSSHDC_DISABLE
-DSPILED_DISABLE
-DAC_DISABLE
-DSYSLOG_ENABLE
-DMBUS_DISABLE

View File

@@ -0,0 +1,10 @@
-DDMX_DISABLE
-DMODBUS_DISABLE
-DMBUS_DISABLE
-DOWIRE_DISABLE
-DDHT_DISABLE
-DCOUNTER_DISABLE
-DNO_HOMIE
-DCSSHDC_DISABLE
-DSPILED_DISABLE
-DAC_DISABLE

View File

@@ -0,0 +1,33 @@
# usage:
# first make your own copy of template
# cp build_flags_template build_flags_ENVNAME
# then edit, change or comment something
# place to custom-build-flags dir if you would like have your own private settings
# -DMY_CONFIG_SERVER=lazyhome.ru
# -DWATCH_DOG_TICKER_DISABLE
# -DUSE_1W_PIN=12
# -DSD_CARD_INSERTED
# -DSERIAL_BAUD=115200
# -DWiz5500
# -DDISABLE_FREERAM_PRINT
# -DCUSTOM_FIRMWARE_MAC=de:ad:be:ef:fe:ff
# -DDMX_DISABLE
# -DMODBUS_DISABLE
# -DOWIRE_DISABLE
# -DAVR_DMXOUT_PIN=18
# -DLAN_INIT_DELAY=2000
# -DCONTROLLINO
# -DESP_WIFI_AP=MYAP
# -DESP_WIFI_PWD=MYPWD
# -DWIFI_MANAGER_DISABLE
# -DRESET_PIN=5
# -DDHCP_RETRY_INTERVAL=60000
# -DRESTART_LAN_ON_MQTT_ERRORS
# -DW5500_CS_PIN=53
# -DSYSLOG_ENABLE
# -DDEVICE_NAME=MYDEVICE
# -DDHT_DISABLE
# -DCOUNTER_DISABLE
# -DWITH_PRINTEX_LIB
# -DCSSHDC_DISABLE

View File

@@ -1,30 +0,0 @@
#! /bin/bash
# usage:
# first make your own copy of template
# cp build_flags_template.sh build_flags_ENVNAME.sh
# then edit, change or comment something
export FLAGS="-DMY_CONFIG_SERVER=lazyhome.ru"
#export FLAGS="$FLAGS -DWATCH_DOG_TICKER_DISABLE"
#export FLAGS="$FLAGS -DUSE_1W_PIN=12"
#export FLAGS="$FLAGS -DSD_CARD_INSERTED"
export FLAGS="$FLAGS -DSERIAL_BAUD=115200"
#export FLAGS="$FLAGS -DWiz5500"
#export FLAGS="$FLAGS -DDISABLE_FREERAM_PRINT"
export FLAGS="$FLAGS -DCUSTOM_FIRMWARE_MAC=de:ad:be:ef:fe:fe"
# export FLAGS="$FLAGS -DDMX_DISABLE"
# export FLAGS="$FLAGS -DARTNET_ENABLE"
# export FLAGS="$FLAGS -DMODBUS_DISABLE"
# export FLAGS="$FLAGS -DOWIRE_DISABLE"
# export FLAGS="$FLAGS -DAVR_DMXOUT_PIN=18"
# export FLAGS="$FLAGS -DLAN_INIT_DELAY=2000"
# export FLAGS="$FLAGS -DCONTROLLINO"
# export FLAGS="$FLAGS -DESP_WIFI_AP=MYAP"
# export FLAGS="$FLAGS -DESP_WIFI_PWD=MYPWD"
# export FLAGS="$FLAGS -DWIFI_MANAGER_DISABLE"
export FLAGS="$FLAGS -DDHT_DISABLE"
# export FLAGS="$FLAGS -DRESET_PIN=5"
# export FLAGS="$FLAGS -DDHCP_RETRY_INTERVAL=60000"
# export FLAGS="$FLAGS -DRESTART_LAN_ON_MQTT_ERRORS"
# export FLAGS="$FLAGS -DW5500_CS_PIN=53"
export FLAGS="$FLAGS -DPIO_SRC_REV="$(git log --pretty=format:%h_%ad -1 --date=short)
echo $FLAGS

View File

@@ -1,9 +0,0 @@
#! /bin/bash
export FLAGS="$FLAGS -DCONTROLLINO"
export FLAGS="$FLAGS -DCUSTOM_FIRMWARE_MAC=de:ad:be:ef:fe:07"
export FLAGS="$FLAGS -DPIO_SRC_REV="$(git log --pretty=format:%h_%ad -1 --date=short)
CUSTOM_BUILD_FLAGS_FILE=custom-build-flags/build_flags_controllino.sh
if [ -f $CUSTOM_BUILD_FLAGS_FILE ]; then
source $CUSTOM_BUILD_FLAGS_FILE
fi
echo $FLAGS

View File

@@ -1,9 +0,0 @@
#! /bin/bash
export FLAGS="$FLAGS -DWiz5500"
export FLAGS="$FLAGS -DARTNET_ENABLE"
export FLAGS="$FLAGS -DPIO_SRC_REV="$(git log --pretty=format:%h_%ad -1 --date=short)
CUSTOM_BUILD_FLAGS_FILE=custom-build-flags/build_flags_due-5500.sh
if [ -f $CUSTOM_BUILD_FLAGS_FILE ]; then
source $CUSTOM_BUILD_FLAGS_FILE
fi
echo $FLAGS

View File

@@ -1,7 +0,0 @@
#! /bin/bash
export FLAGS="$FLAGS -DPIO_SRC_REV="$(git log --pretty=format:%h_%ad -1 --date=short)
CUSTOM_BUILD_FLAGS_FILE=custom-build-flags/build_flags_due.sh
if [ -f $CUSTOM_BUILD_FLAGS_FILE ]; then
source $CUSTOM_BUILD_FLAGS_FILE
fi
echo $FLAGS

View File

@@ -1,14 +0,0 @@
#! /bin/bash
export FLAGS="$FLAGS -DPIO_SRC_REV="$(git log --pretty=format:%h_%ad -1 --date=short)
export FLAGS="$FLAGS -DDMX_DISABLE"
export FLAGS="$FLAGS -DMODBUS_DISABLE"
export FLAGS="$FLAGS -DOWIRE_DISABLE"
export FLAGS="$FLAGS -DDHT_DISABLE"
export FLAGS="$FLAGS -DCOUNTER_DISABLE"
#export FLAGS="$FLAGS -DM5STACK"
#export FLAGS="$FLAGS -std=gnu++11"
CUSTOM_BUILD_FLAGS_FILE=custom-build-flags/build_flags_esp32.sh
if [ -f $CUSTOM_BUILD_FLAGS_FILE ]; then
source $CUSTOM_BUILD_FLAGS_FILE
fi
echo $FLAGS

View File

@@ -1,9 +0,0 @@
#! /bin/bash
export FLAGS="$FLAGS -DMODBUS_DISABLE"
#export FLAGS="$FLAGS -DCOUNTER_DISABLE"
export FLAGS="$FLAGS -DPIO_SRC_REV="$(git log --pretty=format:%h_%ad -1 --date=short)
CUSTOM_BUILD_FLAGS_FILE=custom-build-flags/build_flags_esp8266.sh
if [ -f $CUSTOM_BUILD_FLAGS_FILE ]; then
source $CUSTOM_BUILD_FLAGS_FILE
fi
echo $FLAGS

View File

@@ -1,10 +0,0 @@
#! /bin/bash
export FLAGS="$FLAGS -DWiz5500"
export FLAGS="$FLAGS -DW5500_CS_PIN=53"
export FLAGS="$FLAGS -DARTNET_ENABLE"
export FLAGS="$FLAGS -DPIO_SRC_REV="$(git log --pretty=format:%h_%ad -1 --date=short)
CUSTOM_BUILD_FLAGS_FILE=custom-build-flags/build_flags_due-5500.sh
if [ -f $CUSTOM_BUILD_FLAGS_FILE ]; then
source $CUSTOM_BUILD_FLAGS_FILE
fi
echo $FLAGS

View File

@@ -1,9 +0,0 @@
#! /bin/bash
CUSTOM_BUILD_FLAGS_FILE="custom-build-flags/build_flags_mega2560.sh"
export FLAGS="$FLAGS -DPIO_SRC_REV="$(git log --pretty=format:%h_%ad -1 --date=short)
export FLAGS="$FLAGS -DWiz5500"
#TODO: make one file for all envs
if [ -f $CUSTOM_BUILD_FLAGS_FILE ]; then
source $CUSTOM_BUILD_FLAGS_FILE
fi
echo $FLAGS

View File

@@ -1,8 +0,0 @@
#! /bin/bash
CUSTOM_BUILD_FLAGS_FILE="custom-build-flags/build_flags_mega2560-slim.sh"
export FLAGS="$FLAGS -DPIO_SRC_REV="$(git log --pretty=format:%h_%ad -1 --date=short)
#TODO: make one file for all envs
if [ -f $CUSTOM_BUILD_FLAGS_FILE ]; then
source $CUSTOM_BUILD_FLAGS_FILE
fi
echo $FLAGS

View File

@@ -1,7 +0,0 @@
#! /bin/bash
CUSTOM_BUILD_FLAGS_FILE=custom-build-flags/build_flags_mega2560.sh
export FLAGS="$FLAGS -DPIO_SRC_REV="$(git log --pretty=format:%h_%ad -1 --date=short)
if [ -f $CUSTOM_BUILD_FLAGS_FILE ]; then
source $CUSTOM_BUILD_FLAGS_FILE
fi
echo $FLAGS

View File

@@ -1,17 +0,0 @@
#! /bin/bash
export FLAGS="$FLAGS -DWiz5500"
#export FLAGS="$FLAGS -DW5500_CS_PIN=10"
export FLAGS="$FLAGS -DPIO_SRC_REV="$(git log --pretty=format:%h_%ad -1 --date=short)
export FLAGS="$FLAGS -DDMX_DISABLE"
export FLAGS="$FLAGS -DMODBUS_DISABLE"
#export FLAGS="$FLAGS -DOWIRE_DISABLE"
export FLAGS="$FLAGS -std=gnu++11"
export FLAGS="$FLAGS -DWIFI_MANAGER_DISABLE"
export FLAGS="$FLAGS -DCOUNTER_DISABLE"
export FLAGS="$FLAGS -DCSSHDC_DISABLE"
CUSTOM_BUILD_FLAGS_FILE=custom-build-flags/build_flags_nrf52840.sh
if [ -f $CUSTOM_BUILD_FLAGS_FILE ]; then
source $CUSTOM_BUILD_FLAGS_FILE
fi
echo $FLAGS

View File

@@ -1,14 +0,0 @@
#! /bin/bash
CUSTOM_BUILD_FLAGS_FILE=custom-build-flags/build_flags_stm32.sh
export FLAGS="$FLAGS -DPIO_SRC_REV="$(git log --pretty=format:%h_%ad -1 --date=short)
export FLAGS="$FLAGS -DDMX_DISABLE"
export FLAGS="$FLAGS -DMODBUS_DISABLE"
export FLAGS="$FLAGS -DOWIRE_DISABLE"
export FLAGS="$FLAGS -DDHT_DISABLE"
export FLAGS="$FLAGS -DCOUNTER_DISABLE"
export FLAGS="$FLAGS -DNO_HOMIE"
export FLAGS="$FLAGS -DCSSHDC_DISABLE"
if [ -f $CUSTOM_BUILD_FLAGS_FILE ]; then
source $CUSTOM_BUILD_FLAGS_FILE
fi
echo $FLAGS

View File

@@ -0,0 +1,137 @@
:20000000A7C00000C0C00000BEC00000BCC00000BAC00000B8C00000B6C00000B4C0000023
:20002000B2C00000B0C00000AEC00000CBC400008FC40000A8C00000A6C00000A4C000005C
:20004000A2C00000A0C000009EC000009CC000009AC0000098C0000096C0000021C100003A
:2000600092C0000090C000008EC000008CC000008AC0000088C0000086C0000084C0000028
:2000800082C0000080C000007EC000007CC000007AC0000078C000001201100102000008C4
:2000A00041233D0001000102DC0109023E00020100C0320904000001020201000524000143
:2000C00010042402060524060001070582030800FF09040100020A000000070504024000AC
:2000E0000107058302400001040309043203410072006400750069006E006F0020002800CA
:200100007700770077002E00610072006400750069006E006F002E0063006300290000003D
:200120002E03410072006400750069006E006F0020004400750065002000500072006F002D
:2001400067002E00200050006F0072007400000011241FBECFEFD2E0DEBFCDBF11E0A0E029
:20016000B1E0E8EEF0E102C005900D92A831B107D9F712E0A8E1B1E001C01D92A833B107E1
:20018000E1F722D1AFC73CCF9C01DC01AE57BF4FED91FC91119741911196FC93EE93805872
:2001A0009F4FE817F90711F42D933C939FB7F894F901EC57FF4F8081815080839FBF842F6B
:2001C0000895882311F03F9A01C03F9847980895882311F046980895469A0895DF92EF9253
:2001E000FF920F931F93FC018489813019F0823019F404C010E303C010E001C010E283896E
:20020000823009F418608589873031F0883031F0863029F4126003C0146001C016601092A3
:20022000C9001092C8001092CA000785F088E188D288202F3F2D4E2D5D2D10921E01203B7C
:2002400084E0380780E0480780E0580719F481E080931E01CA01B90122E030E040E050E006
:2002600026D720583B47414E5F4FCA01B901202F3F2D4E2D5D2DF9D6215030403093CD00C5
:200280002093CC001093CA0082E08093C80088E98093C9001F910F91FF90EF90DF9008957E
:2002A0001F920F920FB60F9211242F938F939F93EF93FF939091CE008EB38430F1F4E091ED
:2002C000A201F091A3019083E091A201F091A301CF0101969093A3018093A201825A914079
:2002E00021F482E291E0928381839FB7F8948091A6018F5F8093A6019FBFFF91EF919F911B
:200300008F912F910F900FBE0F901F901895FC0140911A0140931B0180911C0180931D015F
:200320008585282F30E02170307020931A01858590E096958795817080931C0180911E013B
:20034000882339F08FE590E090931901809318010895442341F4222331F08EE190E09093DB
:20036000190180931801089580E091E014C680E091E0C7C51F9384B7877F84BF18E10FB69E
:20038000F89410936000109260000FBE80E019DF469A3E9A87E690E09093CD008093CC0043
:2003A00086E08093CA001092C8001093C900539A5A9A8AB180638AB98BB180638BB9BDD2F0
:2003C00084E085BD1F9108950F931F93CF93DF93D1DF2FB7F89487EA91E09093280280939E
:2003E000270290932A02809329022FBF2FB7F89482E291E09093A3018093A2019093A501CC
:200400008093A4012FBF7894C7EAD1E003E08FB7F89490912B028FBF903809F180E091E0E4
:20042000E6D497FD1CC0E0912702F09128028083E0912702F0912802CF0101969093280251
:20044000809327028752924011F4D283C1839FB7F89480912B028F5F80932B029FBF8FB725
:20046000F8941091A6018FBFA89903C0113608F469C0A89A8091A601882361F05D9800936C
:200480001F0108C082E291E07FDE682F80E091E014D511501123B1F780911F01882351F097
:2004A00080911F01815080931F0180911F01882309F45D9A80912001882351F080912001E7
:2004C00081508093200180912001882309F45C9A8091180190911901181619067CF58F3560
:2004E000910521F481E074DE80E06BDE8091180190911901839721F480E06ADE80E061DE1A
:200500008091180190911901499721F480E060DE81E057DE8091180190911901019721F43B
:2005200080E056DE80E04DDE80911801909119010197909319018093180104C080E048DEEC
:2005400080E03FDE8FB7F89490912B028FBF992369F087EA91E018DE982F8091C80085FF9F
:20056000FCCF9093CE005C980093200180E091E095D42AD44CCFDA01923049F0933061F0DA
:200580009130F9F4E8E9F0E022E130E01EC0EAEAF0E02EE330E019C0813049F0813018F0DA
:2005A000823079F408C0E8EEF0E0849107C0ECEEF0E0849103C0E0E2F1E08491282F30E041
:2005C00004C0E0E0F0E020E030E0ED93FC93C901089528E030E040E003C04F5F220F331F15
:2005E00028173907D0F3842F8295807F08958093E9008091EB0081608093EB001092ED00ED
:200600006093EC004093ED008091EE00881F8827881F08951092F40090E09093E9001092EE
:20062000F0001092E8001092ED008091EB008E7F8093EB009F5F953081F70895809130028F
:2006400088238CF403C08EB38823B1F08091E80082FFF9CF8091E8008B778093E80008954A
:200660008EB3882349F08091E80080FFF9CF8091E8008E778093E800089594E68091EC0008
:2006800080FF05C08091E80080FF05C023C08091E80082FD1FC08EB3882311F482E00895AF
:2006A0008EB3853011F483E008958091EB0085FF02C081E008958091E10082FFDFCF8091CD
:2006C000E1008B7F8093E100992311F484E008959150D4CF80E008959C0140913602509171
:2006E00037024617570718F4F90120E038C06115710511F0AB01F8CF8091E8008E77809397
:20070000E80040E050E0F0CF8091E80083FF02C081E008958091E80082FD2DC08EB3882356
:2007200081F18EB3853079F18091E80080FF17C09091F20006C081918093F1004150504088
:200740009F5F4115510511F09830A8F320E0983009F421E08091E8008E778093E800411576
:20076000510591F6222381F606C08EB3882349F08EB3853041F08091E80082FFF6CF80E02F
:20078000089582E0089583E008959C0140913602509137024617570710F490E03BC061155D
:2007A000710511F0AB01F9CF8091E8008E778093E80040E050E0F1CF8091E80083FF02C008
:2007C00081E008958091E80082FD30C08EB3882399F18EB3853091F18091E80080FF1AC073
:2007E0008091F20009C0F9012F5F3F4FE491E093F100415050408F5F4115510511F08830CA
:2008000090F390E0883009F491E08091E8008E778093E8004115510579F6992369F606C0CA
:200820008EB3882349F08EB3853041F08091E80082FFF6CF80E0089582E0089583E0089531
:200840009C016115710529F48091E8008B778093E800F90120C08091E80083FF02C081E084
:2008600008958EB3882339F18EB3853031F18091E80082FFF0CF06C08091F10081936150E7
:20088000704021F08091F2008823B1F78091E8008B778093E80061157105E9F606C08EB379
:2008A000882349F08EB3853041F08091E80080FFF6CF80E0089582E0089583E0089542D0E2
:2008C00044D01EBA10922E0210922D0210922C0284E089BD89B5826089BD09B400FEFDCF22
:2008E0008091D800982F9F779093D80080688093D800809163008E7F809363008091D80084
:200900008F7D8093D8008091E0008E7F8093E0008091E1008E7F8093E1008091E200816028
:200920008093E2008091E100877F8093E1008091E20088608093E2000895C1DF81E0809355
:200940002F0208951092E20008951092E10008951F920F920FB60F9211241F932F933F9355
:200960004F935F936F937F938F939F93AF93BF93EF93FF93E9EEF0E0108117701082E0EF73
:20098000F0E08081877F80837894C3D0F894A9EEB0E01C92E0EFF0E08081886080831C9343
:2009A000FF91EF91BF91AF919F918F917F916F915F914F913F912F911F910F900FBE0F901C
:2009C0001F9018951F920F920FB60F9211242F933F934F935F936F937F938F939F93AF93BC
:2009E000BF93EF93FF938091E10080FF1BC08091E20080FF17C08091E1008E7F8093E10009
:200A00008091E2008E7F8093E2008091E20080618093E2008091D80080628093D80019BC8D
:200A20001EBAD1D18091E10084FF29C08091E20084FF25C084E089BD89B5826089BD09B4B6
:200A400000FEFDCF8091D8008F7D8093D8008091E1008F7E8093E1008091E2008F7E8093E6
:200A6000E2008091E20081608093E20080912E02882311F481E001C084E08EBBA4D1809185
:200A8000E10083FF27C08091E20083FF23C08091E100877F8093E10082E08EBB10922E024B
:200AA0008091E1008E7F8093E1008091E2008E7F8093E2008091E20080618093E200AADDFE
:200AC00080E060E042E093DD8091F00088608093F00079D18091E10082FF0AC08091E2007E
:200AE00082FF06C08091E1008B7F8093E1006BD1FF91EF91BF91AF919F918F917F916F9183
:200B00005F914F913F912F910F900FBE0F901F9018951F93DF93CF93CDB7DEB7AC970FB667
:200B2000F894DEBF0FBECDBFE0E3F2E08091F100819322E0E833F207C9F7809130023091AE
:200B40003102353009F487C0363040F43130C9F1313070F0333009F01DC133C0383009F4B1
:200B6000EFC0393009F4FEC0363009F013C192C0803821F0823809F00DC108C090912C02BC
:200B800080912D02882399F0926011C08091340287708093E9008091EB0090E025E0969548
:200BA00087952A95E1F7982F91701092E9008091E800877F8093E8009093F1001092F1008E
:200BC000CAC0882319F0823009F0E4C090E08F719070009721F0029709F0DDC00CC0809164
:200BE0003202813009F0D7C010922D02333069F580932D022AC080913202882331F52091FB
:200C00003402277009F4C7C02093E9008091EB0080FFC1C0333021F48091EB00806213C0C2
:200C20008091EB0080618093EB0081E090E002C0880F991F2A95E2F78093EA001092EA00D6
:200C40008091EB0088608093EB001092E9008091E800877F83C0882309F09CC01091320210
:200C60008091E800877F8093E800E8DC04C08EB3882309F490C08091E80080FFF8CF812FCA
:200C80008F7711F492E001C093E09EBB80688093E30081C08058823008F07CC08091320228
:200CA0009091330223E08C3D920799F55FB7F894DE0115964EE020E030E061E2E42FF0E05B
:200CC00060935700849120FF03C082958F704F5F982F9F70892F805D8A3308F0895F8C93E8
:200CE00011961C9211972F5F3F4F12962431310529F75FBF8AE28B8383E08C838091E80085
:200D0000877F8093E800CE0103966AE270E0E4DC11C060913402AE014F5F5F4F2CDCBC0146
:200D20000097C9F18091E800877F8093E80089819A812BDD8091E8008B778093E8002BC05A
:200D4000803841F58091E800877F8093E80080912E028093F1008091E8008E778093E8006D
:200D60006DDC19C08823B1F490913202923098F48091E800877F8093E80090932E025EDCD7
:200D800080912E02882311F483E001C084E08EBBEEDA01C0E9DA8091E80083FF0AC08091EF
:200DA000EB0080628093EB008091E800877F8093E800AC960FB6F894DEBF0FBECDBFCF9185
:200DC000DF911F91089508951F938EB3882361F01091E9001092E9008091E80083FF01C079
:200DE00098DE17701093E9001F9108950895FC018EB3843021F587859089A189B289009757
:200E0000A105B105E1F085818093E9008091E80082FF15C08091F200882319F42FEF3FEF4D
:200E200004C08091F100282F30E08091F200882341F48091E8008B778093E80002C02FEFCC
:200E40003FEFC9010895FC018EB3843011F587859089A189B2890097A105B105D1F08181C5
:200E60008093E9008091F2008823A9F09091E8008091E8008E778093E80095FD0CC0FDDBF7
:200E8000982F882349F48091E8008E778093E80003C092E001C090E0892F0895FC018EB3B1
:200EA000843051F487859089A189B2890097A105B10511F0CF01C7CF08951F93FC01162FC4
:200EC0008EB38430D9F487859089A189B2890097A105B10599F081818093E9008091E80053
:200EE00085FD08C08091E8008E778093E800C5DB882329F41093F10080E001C082E01F9180
:200F000008950F931F93CF93DF93EC010D96FC0189E0DF011D928A95E9F72A813B81098197
:200F20008C81882311F410E001C014E0C90151DB182B1260802F61E8412F59DB882329F143
:200F40002E813F810D818885882311F410E001C014E0C9013EDB182B1260802F60E8412F33
:200F600046DB882391F02A853B8509858C85882311F410E001C014E0C9012BDB182B12603C
:200F8000802F61EC412F33DB01C080E0DF91CF911F910F910895CF93DF93EC018091E8003F
:200FA00083FF60C0888190E020913402309135022817390709F056C080913102813261F061
:200FC000823220F4803209F04DC019C0823269F1833209F047C038C080913002813A09F006
:200FE00041C08091E800877F8093E800CE010F9667E070E071DB8091E8008B7713C08091C0
:201000003002813279F58091E800877F8093E800CE010F9667E070E013DCCE01DFD88091F2
:20102000E8008E778093E8001DC0809130028132C9F48091E800877F8093E80080913202F9
:201040008D87CE0164D90DC080913002813251F48091E800877F8093E800CE01609132027A
:20106000C5DEECDADF91CF910895A1E21A2EAA1BBB1BFD010DC0AA1FBB1FEE1FFF1FA217E2
:20108000B307E407F50720F0A21BB30BE40BF50B661F771F881F991F1A9469F760957095B3
:2010A000809590959B01AC01BD01CF01089597FB092E05260ED057FD04D0D7DF0AD0001CDC
:2010C00038F450954095309521953F4F4F4F5F4F0895F6F790958095709561957F4F8F4F6A
:2010E0009F4F0895F894FFCF00034000000440000002080000000000000000000000140066
:00000001FF

View File

@@ -0,0 +1,137 @@
:20000000A7C00000C0C00000BEC00000BCC00000BAC00000B8C00000B6C00000B4C0000023
:20002000B2C00000B0C00000AEC00000C1C4000085C40000A8C00000A6C00000A4C0000070
:20004000A2C00000A0C000009EC000009CC000009AC0000098C0000096C0000021C100003A
:2000600092C0000090C000008EC000008CC000008AC0000088C0000086C0000084C0000028
:2000800082C0000080C000007EC000007CC000007AC0000078C000001201100102000008C4
:2000A00041233D0001000102DC0109023E00020100C0320904000001020201000524000143
:2000C00010042402060524060001070582030800FF09040100020A000000070504024000AC
:2000E0000107058302400001040309043203410072006400750069006E006F0020002800CA
:200100007700770077002E00610072006400750069006E006F002E0063006300290000003D
:200120002E03410072006400750069006E006F0020004400750065002000500072006F002D
:2001400067002E00200050006F0072007400000011241FBECFEFD2E0DEBFCDBF11E0A0E029
:20016000B1E0E4EDF0E102C005900D92A831B107D9F712E0A8E1B1E001C01D92A833B107E6
:20018000E1F72BD1A5C73CCF9C01DC01AE57BF4FED91FC91119741911196FC93EE93805873
:2001A0009F4FE817F90711F42D933C939FB7F894F901EC57FF4F8081815080839FBF842F6B
:2001C0000895882311F03F9A01C03F9847980895882311F046980895469A0895DF92EF9253
:2001E000FF920F931F93FC018489813019F0823019F404C010E303C010E001C010E283896E
:20020000823009F418608589873031F0883031F0863029F4126003C0146001C016601092A3
:20022000C9001092C8001092CA000785F088E188D288202F3F2D4E2D5D2D10921E01203B7C
:2002400084E0380780E0480780E0580719F481E080931E01CA01B90122E030E040E050E006
:200260001CD720583B47414E5F4FCA01B901202F3F2D4E2D5D2DEFD6215030403093CD00D9
:200280002093CC001093CA0082E08093C80088E98093C9001F910F91FF90EF90DF9008957E
:2002A0001F920F920FB60F9211242F938F939F93EF93FF939091CE008EB38430F1F4E091ED
:2002C000A201F091A3019083E091A201F091A301CF0101969093A3018093A201825A914079
:2002E00021F482E291E0928381839FB7F8948091A6018F5F8093A6019FBFFF91EF919F911B
:200300008F912F910F900FBE0F901F901895FC0140911A0140931B0180911C0180931D015F
:200320008585282F30E02170307020931A01858590E096958795817080931C0180911E013B
:20034000882339F088E790E090931901809318010895442341F4222331F082E390E09093EA
:20036000190180931801089580E091E00AC680E091E0BDC584B7877F84BF88E10FB6F89468
:2003800080936000109260000FBE81E01ADF16BC83E085BD86B58831E8F315BC16BC80E078
:2003A00010DF469A3E9A87E690E09093CD008093CC0086E08093CA001092C80088E18093C1
:2003C000C900539A5A9A8AB180638AB98BB180638BB9A9D284E085BD08950F931F93CF933B
:2003E000DF93C8DF2FB7F89487EA91E0909328028093270290932A02809329022FBF2FB7A6
:20040000F89482E291E09093A3018093A2019093A5018093A4012FBF7894C7EAD1E003E03E
:200420008FB7F89490912B028FBF903809F180E091E0D3D497FD1CC0E0912702F09128025F
:200440008083E0912702F0912802CF01019690932802809327028752924011F4D283C1831B
:200460009FB7F89480912B028F5F80932B029FBF8FB7F8941091A6018FBFA89903C011361D
:2004800008F456C0A89A8091A601882361F05D9800931F0108C082E291E076DE682F80E0C4
:2004A00091E001D511501123B1F780911F01882351F080911F01815080931F0180911F0135
:2004C000882309F45D9A80912001882351F08091200181508093200180912001882309F44E
:2004E0005C9A809118019091190118161906E4F4CC97CD9710F481E001C080E069DE8091D7
:200500001801909119010197C29710F481E001C080E057DE809118019091190101979093BB
:2005200019018093180104C080E052DE80E049DE8FB7F89490912B028FBF992369F087EAA6
:2005400091E022DE982F8091C80085FFFCCF9093CE005C980093200180E091E095D42AD46A
:200560005FCFDA01923049F0933061F09130F9F4E8E9F0E022E130E01EC0EAEAF0E02EE36E
:2005800030E019C0813049F0813018F0823079F408C0E8EEF0E0849107C0ECEEF0E08491A7
:2005A00003C0E0E2F1E08491282F30E004C0E0E0F0E020E030E0ED93FC93C901089528E087
:2005C00030E040E003C04F5F220F331F28173907D0F3842F8295807F08958093E900809142
:2005E000EB0081608093EB001092ED006093EC004093ED008091EE00881F8827881F08956A
:200600001092F40090E09093E9001092F0001092E8001092ED008091EB008E7F8093EB0016
:200620009F5F953081F708958091300288238CF403C08EB38823B1F08091E80082FFF9CFE2
:200640008091E8008B778093E80008958EB3882349F08091E80080FFF9CF8091E8008E77A4
:200660008093E800089594E68091EC0080FF05C08091E80080FF05C023C08091E80082FD8F
:200680001FC08EB3882311F482E008958EB3853011F483E008958091EB0085FF02C081E0ED
:2006A00008958091E10082FFDFCF8091E1008B7F8093E100992311F484E008959150D4CF46
:2006C00080E008959C0140913602509137024617570718F4F90120E038C06115710511F0B7
:2006E000AB01F8CF8091E8008E778093E80040E050E0F0CF8091E80083FF02C081E0089544
:200700008091E80082FD2DC08EB3882381F18EB3853079F18091E80080FF17C09091F20054
:2007200006C081918093F100415050409F5F4115510511F09830A8F320E0983009F421E0E8
:200740008091E8008E778093E8004115510591F6222381F606C08EB3882349F08EB38530D0
:2007600041F08091E80082FFF6CF80E0089582E0089583E008959C0140913602509137024D
:200780004617570710F490E03BC06115710511F0AB01F9CF8091E8008E778093E80040E0B5
:2007A00050E0F1CF8091E80083FF02C081E008958091E80082FD30C08EB3882399F18EB3EF
:2007C000853091F18091E80080FF1AC08091F20009C0F9012F5F3F4FE491E093F100415044
:2007E00050408F5F4115510511F0883090F390E0883009F491E08091E8008E778093E80004
:200800004115510579F6992369F606C08EB3882349F08EB3853041F08091E80082FFF6CF51
:2008200080E0089582E0089583E008959C016115710529F48091E8008B778093E800F90126
:2008400020C08091E80083FF02C081E008958EB3882339F18EB3853031F18091E80082FFD5
:20086000F0CF06C08091F10081936150704021F08091F2008823B1F78091E8008B77809307
:20088000E80061157105E9F606C08EB3882349F08EB3853041F08091E80080FFF6CF80E0F6
:2008A000089582E0089583E0089542D044D01EBA10922E0210922D0210922C0284E089BD81
:2008C00089B5826089BD09B400FEFDCF8091D800982F9F779093D80080688093D800809186
:2008E00063008E7F809363008091D8008F7D8093D8008091E0008E7F8093E0008091E1004F
:200900008E7F8093E1008091E20081608093E2008091E100877F8093E1008091E200886046
:200920008093E2000895C1DF81E080932F0208951092E20008951092E10008951F920F92B0
:200940000FB60F9211241F932F933F934F935F936F937F938F939F93AF93BF93EF93FF93D2
:20096000E9EEF0E0108117701082E0EFF0E08081877F80837894C3D0F894A9EEB0E01C927D
:20098000E0EFF0E08081886080831C93FF91EF91BF91AF919F918F917F916F915F914F914D
:2009A0003F912F911F910F900FBE0F901F9018951F920F920FB60F9211242F933F934F932D
:2009C0005F936F937F938F939F93AF93BF93EF93FF938091E10080FF1BC08091E20080FF57
:2009E00017C08091E1008E7F8093E1008091E2008E7F8093E2008091E20080618093E2006F
:200A00008091D80080628093D80019BC1EBAD1D18091E10084FF29C08091E20084FF25C018
:200A200084E089BD89B5826089BD09B400FEFDCF8091D8008F7D8093D8008091E1008F7E40
:200A40008093E1008091E2008F7E8093E2008091E20081608093E20080912E02882311F4F3
:200A600081E001C084E08EBBA4D18091E10083FF27C08091E20083FF23C08091E100877F87
:200A80008093E10082E08EBB10922E028091E1008E7F8093E1008091E2008E7F8093E200FD
:200AA0008091E20080618093E200AADD80E060E042E093DD8091F00088608093F00079D17E
:200AC0008091E10082FF0AC08091E20082FF06C08091E1008B7F8093E1006BD1FF91EF9163
:200AE000BF91AF919F918F917F916F915F914F913F912F910F900FBE0F901F9018951F938D
:200B0000DF93CF93CDB7DEB7AC970FB6F894DEBF0FBECDBFE0E3F2E08091F100819322E0B1
:200B2000E833F207C9F78091300230913102353009F487C0363040F43130C9F1313070F08B
:200B4000333009F01DC133C0383009F4EFC0393009F4FEC0363009F013C192C0803821F0E2
:200B6000823809F00DC108C090912C0280912D02882399F0926011C0809134028770809355
:200B8000E9008091EB0090E025E0969587952A95E1F7982F91701092E9008091E800877FCB
:200BA0008093E8009093F1001092F100CAC0882319F0823009F0E4C090E08F7190700097FF
:200BC00021F0029709F0DDC00CC080913202813009F0D7C010922D02333069F580932D02AF
:200BE0002AC080913202882331F520913402277009F4C7C02093E9008091EB0080FFC1C05B
:200C0000333021F48091EB00806213C08091EB0080618093EB0081E090E002C0880F991FEE
:200C20002A95E2F78093EA001092EA008091EB0088608093EB001092E9008091E800877F27
:200C400083C0882309F09CC0109132028091E800877F8093E800E8DC04C08EB3882309F411
:200C600090C08091E80080FFF8CF812F8F7711F492E001C093E09EBB80688093E30081C00C
:200C80008058823008F07CC0809132029091330223E08C3D920799F55FB7F894DE011596DC
:200CA0004EE020E030E061E2E42FF0E060935700849120FF03C082958F704F5F982F9F70F5
:200CC000892F805D8A3308F0895F8C9311961C9211972F5F3F4F12962431310529F75FBF39
:200CE0008AE28B8383E08C838091E800877F8093E800CE0103966AE270E0E4DC11C0609188
:200D00003402AE014F5F5F4F2CDCBC010097C9F18091E800877F8093E80089819A812BDD55
:200D20008091E8008B778093E8002BC0803841F58091E800877F8093E80080912E02809396
:200D4000F1008091E8008E778093E8006DDC19C08823B1F490913202923098F48091E8009B
:200D6000877F8093E80090932E025EDC80912E02882311F483E001C084E08EBBF8DA01C090
:200D8000F3DA8091E80083FF0AC08091EB0080628093EB008091E800877F8093E800AC9629
:200DA0000FB6F894DEBF0FBECDBFCF91DF911F91089508951F938EB3882361F01091E900B9
:200DC0001092E9008091E80083FF01C098DE17701093E9001F9108950895FC018EB38430E7
:200DE00021F587859089A189B2890097A105B105E1F085818093E9008091E80082FF15C03E
:200E00008091F200882319F42FEF3FEF04C08091F100282F30E08091F200882341F48091AA
:200E2000E8008B778093E80002C02FEF3FEFC9010895FC018EB3843011F587859089A18911
:200E4000B2890097A105B105D1F081818093E9008091F2008823A9F09091E8008091E8005C
:200E60008E778093E80095FD0CC0FDDB982F882349F48091E8008E778093E80003C092E05F
:200E800001C090E0892F0895FC018EB3843051F487859089A189B2890097A105B10511F017
:200EA000CF01C7CF08951F93FC01162F8EB38430D9F487859089A189B2890097A105B105FC
:200EC00099F081818093E9008091E80085FD08C08091E8008E778093E800C5DB882329F4E7
:200EE0001093F10080E001C082E01F9108950F931F93CF93DF93EC010D96FC0189E0DF0190
:200F00001D928A95E9F72A813B8109818C81882311F410E001C014E0C90151DB182B126025
:200F2000802F61E8412F59DB882329F12E813F810D818885882311F410E001C014E0C90127
:200F40003EDB182B1260802F60E8412F46DB882391F02A853B8509858C85882311F410E061
:200F600001C014E0C9012BDB182B1260802F61EC412F33DB01C080E0DF91CF911F910F917C
:200F80000895CF93DF93EC018091E80083FF60C0888190E020913402309135022817390781
:200FA00009F056C080913102813261F0823220F4803209F04DC019C0823269F1833209F0C5
:200FC00047C038C080913002813A09F041C08091E800877F8093E800CE010F9667E070E015
:200FE00071DB8091E8008B7713C080913002813279F58091E800877F8093E800CE010F9605
:2010000067E070E013DCCE01E9D88091E8008E778093E8001DC0809130028132C9F4809120
:20102000E800877F8093E800809132028D87CE016ED90DC080913002813251F48091E80057
:20104000877F8093E800CE0160913202C5DEECDADF91CF910895A1E21A2EAA1BBB1BFD0161
:201060000DC0AA1FBB1FEE1FFF1FA217B307E407F50720F0A21BB30BE40BF50B661F771FE6
:20108000881F991F1A9469F760957095809590959B01AC01BD01CF01089597FB092E052647
:2010A0000ED057FD04D0D7DF0AD0001C38F450954095309521953F4F4F4F5F4F0895F6F7B9
:2010C00090958095709561957F4F8F4F9F4F0895F894FFCF000340000004400000020800B9
:0C10E000000000000000000000001400F0
:00000001FF

View File

@@ -0,0 +1,137 @@
:20000000A7C00000C0C00000BEC00000BCC00000BAC00000B8C00000B6C00000B4C0000023
:20002000B2C00000B0C00000AEC00000C1C4000085C40000A8C00000A6C00000A4C0000070
:20004000A2C00000A0C000009EC000009CC000009AC0000098C0000096C0000021C100003A
:2000600092C0000090C000008EC000008CC000008AC0000088C0000086C0000084C0000028
:2000800082C0000080C000007EC000007CC000007AC0000078C000001201100102000008C4
:2000A00041233D0001000102DC0109023E00020100C0320904000001020201000524000143
:2000C00010042402060524060001070582030800FF09040100020A000000070504024000AC
:2000E0000107058302400001040309043203410072006400750069006E006F0020002800CA
:200100007700770077002E00610072006400750069006E006F002E0063006300290000003D
:200120002E03410072006400750069006E006F0020004400750065002000500072006F002D
:2001400067002E00200050006F0072007400000011241FBECFEFD2E0DEBFCDBF11E0A0E029
:20016000B1E0E4EDF0E102C005900D92A831B107D9F712E0A8E1B1E001C01D92A833B107E6
:20018000E1F72BD1A5C73CCF9C01DC01AE57BF4FED91FC91119741911196FC93EE93805873
:2001A0009F4FE817F90711F42D933C939FB7F894F901EC57FF4F8081815080839FBF842F6B
:2001C0000895882311F03F9A01C03F9847980895882311F046980895469A0895DF92EF9253
:2001E000FF920F931F93FC018489813019F0823019F404C010E303C010E001C010E283896E
:20020000823009F418608589873031F0883031F0863029F4126003C0146001C016601092A3
:20022000C9001092C8001092CA000785F088E188D288202F3F2D4E2D5D2D10921E01203B7C
:2002400084E0380780E0480780E0580719F481E080931E01CA01B90122E030E040E050E006
:200260001CD720583B47414E5F4FCA01B901202F3F2D4E2D5D2DEFD6215030403093CD00D9
:200280002093CC001093CA0082E08093C80088E98093C9001F910F91FF90EF90DF9008957E
:2002A0001F920F920FB60F9211242F938F939F93EF93FF939091CE008EB38430F1F4E091ED
:2002C000A201F091A3019083E091A201F091A301CF0101969093A3018093A201825A914079
:2002E00021F482E291E0928381839FB7F8948091A6018F5F8093A6019FBFFF91EF919F911B
:200300008F912F910F900FBE0F901F901895FC0140911A0140931B0180911C0180931D015F
:200320008585282F30E02170307020931A01858590E096958795817080931C0180911E013B
:20034000882339F088E790E090931901809318010895442341F4222331F082E390E09093EA
:20036000190180931801089580E091E00AC680E091E0BDC584B7877F84BF88E10FB6F89468
:2003800080936000109260000FBE81E01ADF16BC83E085BD86B58831E8F315BC16BC80E078
:2003A00010DF469A3E9A87E690E09093CD008093CC0086E08093CA001092C80088E18093C1
:2003C000C900539A5A9A8AB180638AB98BB180638BB9A9D284E085BD08950F931F93CF933B
:2003E000DF93C8DF2FB7F89487EA91E0909328028093270290932A02809329022FBF2FB7A6
:20040000F89482E291E09093A3018093A2019093A5018093A4012FBF7894C7EAD1E003E03E
:200420008FB7F89490912B028FBF903809F180E091E0D3D497FD1CC0E0912702F09128025F
:200440008083E0912702F0912802CF01019690932802809327028752924011F4D283C1831B
:200460009FB7F89480912B028F5F80932B029FBF8FB7F8941091A6018FBFA89903C011361D
:2004800008F456C0A89A8091A601882361F05D9800931F0108C082E291E076DE682F80E0C4
:2004A00091E001D511501123B1F780911F01882351F080911F01815080931F0180911F0135
:2004C000882309F45D9A80912001882351F08091200181508093200180912001882309F44E
:2004E0005C9A809118019091190118161906E4F4CC97CD9710F481E001C080E069DE8091D7
:200500001801909119010197C29710F481E001C080E057DE809118019091190101979093BB
:2005200019018093180104C080E052DE80E049DE8FB7F89490912B028FBF992369F087EAA6
:2005400091E022DE982F8091C80085FFFCCF9093CE005C980093200180E091E095D42AD46A
:200560005FCFDA01923049F0933061F09130F9F4E8E9F0E022E130E01EC0EAEAF0E02EE36E
:2005800030E019C0813049F0813018F0823079F408C0E8EEF0E0849107C0ECEEF0E08491A7
:2005A00003C0E0E2F1E08491282F30E004C0E0E0F0E020E030E0ED93FC93C901089528E087
:2005C00030E040E003C04F5F220F331F28173907D0F3842F8295807F08958093E900809142
:2005E000EB0081608093EB001092ED006093EC004093ED008091EE00881F8827881F08956A
:200600001092F40090E09093E9001092F0001092E8001092ED008091EB008E7F8093EB0016
:200620009F5F953081F708958091300288238CF403C08EB38823B1F08091E80082FFF9CFE2
:200640008091E8008B778093E80008958EB3882349F08091E80080FFF9CF8091E8008E77A4
:200660008093E800089594E68091EC0080FF05C08091E80080FF05C023C08091E80082FD8F
:200680001FC08EB3882311F482E008958EB3853011F483E008958091EB0085FF02C081E0ED
:2006A00008958091E10082FFDFCF8091E1008B7F8093E100992311F484E008959150D4CF46
:2006C00080E008959C0140913602509137024617570718F4F90120E038C06115710511F0B7
:2006E000AB01F8CF8091E8008E778093E80040E050E0F0CF8091E80083FF02C081E0089544
:200700008091E80082FD2DC08EB3882381F18EB3853079F18091E80080FF17C09091F20054
:2007200006C081918093F100415050409F5F4115510511F09830A8F320E0983009F421E0E8
:200740008091E8008E778093E8004115510591F6222381F606C08EB3882349F08EB38530D0
:2007600041F08091E80082FFF6CF80E0089582E0089583E008959C0140913602509137024D
:200780004617570710F490E03BC06115710511F0AB01F9CF8091E8008E778093E80040E0B5
:2007A00050E0F1CF8091E80083FF02C081E008958091E80082FD30C08EB3882399F18EB3EF
:2007C000853091F18091E80080FF1AC08091F20009C0F9012F5F3F4FE491E093F100415044
:2007E00050408F5F4115510511F0883090F390E0883009F491E08091E8008E778093E80004
:200800004115510579F6992369F606C08EB3882349F08EB3853041F08091E80082FFF6CF51
:2008200080E0089582E0089583E008959C016115710529F48091E8008B778093E800F90126
:2008400020C08091E80083FF02C081E008958EB3882339F18EB3853031F18091E80082FFD5
:20086000F0CF06C08091F10081936150704021F08091F2008823B1F78091E8008B77809307
:20088000E80061157105E9F606C08EB3882349F08EB3853041F08091E80080FFF6CF80E0F6
:2008A000089582E0089583E0089542D044D01EBA10922E0210922D0210922C0284E089BD81
:2008C00089B5826089BD09B400FEFDCF8091D800982F9F779093D80080688093D800809186
:2008E00063008E7F809363008091D8008F7D8093D8008091E0008E7F8093E0008091E1004F
:200900008E7F8093E1008091E20081608093E2008091E100877F8093E1008091E200886046
:200920008093E2000895C1DF81E080932F0208951092E20008951092E10008951F920F92B0
:200940000FB60F9211241F932F933F934F935F936F937F938F939F93AF93BF93EF93FF93D2
:20096000E9EEF0E0108117701082E0EFF0E08081877F80837894C3D0F894A9EEB0E01C927D
:20098000E0EFF0E08081886080831C93FF91EF91BF91AF919F918F917F916F915F914F914D
:2009A0003F912F911F910F900FBE0F901F9018951F920F920FB60F9211242F933F934F932D
:2009C0005F936F937F938F939F93AF93BF93EF93FF938091E10080FF1BC08091E20080FF57
:2009E00017C08091E1008E7F8093E1008091E2008E7F8093E2008091E20080618093E2006F
:200A00008091D80080628093D80019BC1EBAD1D18091E10084FF29C08091E20084FF25C018
:200A200084E089BD89B5826089BD09B400FEFDCF8091D8008F7D8093D8008091E1008F7E40
:200A40008093E1008091E2008F7E8093E2008091E20081608093E20080912E02882311F4F3
:200A600081E001C084E08EBBA4D18091E10083FF27C08091E20083FF23C08091E100877F87
:200A80008093E10082E08EBB10922E028091E1008E7F8093E1008091E2008E7F8093E200FD
:200AA0008091E20080618093E200AADD80E060E042E093DD8091F00088608093F00079D17E
:200AC0008091E10082FF0AC08091E20082FF06C08091E1008B7F8093E1006BD1FF91EF9163
:200AE000BF91AF919F918F917F916F915F914F913F912F910F900FBE0F901F9018951F938D
:200B0000DF93CF93CDB7DEB7AC970FB6F894DEBF0FBECDBFE0E3F2E08091F100819322E0B1
:200B2000E833F207C9F78091300230913102353009F487C0363040F43130C9F1313070F08B
:200B4000333009F01DC133C0383009F4EFC0393009F4FEC0363009F013C192C0803821F0E2
:200B6000823809F00DC108C090912C0280912D02882399F0926011C0809134028770809355
:200B8000E9008091EB0090E025E0969587952A95E1F7982F91701092E9008091E800877FCB
:200BA0008093E8009093F1001092F100CAC0882319F0823009F0E4C090E08F7190700097FF
:200BC00021F0029709F0DDC00CC080913202813009F0D7C010922D02333069F580932D02AF
:200BE0002AC080913202882331F520913402277009F4C7C02093E9008091EB0080FFC1C05B
:200C0000333021F48091EB00806213C08091EB0080618093EB0081E090E002C0880F991FEE
:200C20002A95E2F78093EA001092EA008091EB0088608093EB001092E9008091E800877F27
:200C400083C0882309F09CC0109132028091E800877F8093E800E8DC04C08EB3882309F411
:200C600090C08091E80080FFF8CF812F8F7711F492E001C093E09EBB80688093E30081C00C
:200C80008058823008F07CC0809132029091330223E08C3D920799F55FB7F894DE011596DC
:200CA0004EE020E030E061E2E42FF0E060935700849120FF03C082958F704F5F982F9F70F5
:200CC000892F805D8A3308F0895F8C9311961C9211972F5F3F4F12962431310529F75FBF39
:200CE0008AE28B8383E08C838091E800877F8093E800CE0103966AE270E0E4DC11C0609188
:200D00003402AE014F5F5F4F2CDCBC010097C9F18091E800877F8093E80089819A812BDD55
:200D20008091E8008B778093E8002BC0803841F58091E800877F8093E80080912E02809396
:200D4000F1008091E8008E778093E8006DDC19C08823B1F490913202923098F48091E8009B
:200D6000877F8093E80090932E025EDC80912E02882311F483E001C084E08EBBF8DA01C090
:200D8000F3DA8091E80083FF0AC08091EB0080628093EB008091E800877F8093E800AC9629
:200DA0000FB6F894DEBF0FBECDBFCF91DF911F91089508951F938EB3882361F01091E900B9
:200DC0001092E9008091E80083FF01C098DE17701093E9001F9108950895FC018EB38430E7
:200DE00021F587859089A189B2890097A105B105E1F085818093E9008091E80082FF15C03E
:200E00008091F200882319F42FEF3FEF04C08091F100282F30E08091F200882341F48091AA
:200E2000E8008B778093E80002C02FEF3FEFC9010895FC018EB3843011F587859089A18911
:200E4000B2890097A105B105D1F081818093E9008091F2008823A9F09091E8008091E8005C
:200E60008E778093E80095FD0CC0FDDB982F882349F48091E8008E778093E80003C092E05F
:200E800001C090E0892F0895FC018EB3843051F487859089A189B2890097A105B10511F017
:200EA000CF01C7CF08951F93FC01162F8EB38430D9F487859089A189B2890097A105B105FC
:200EC00099F081818093E9008091E80085FD08C08091E8008E778093E800C5DB882329F4E7
:200EE0001093F10080E001C082E01F9108950F931F93CF93DF93EC010D96FC0189E0DF0190
:200F00001D928A95E9F72A813B8109818C81882311F410E001C014E0C90151DB182B126025
:200F2000802F61E8412F59DB882329F12E813F810D818885882311F410E001C014E0C90127
:200F40003EDB182B1260802F60E8412F46DB882391F02A853B8509858C85882311F410E061
:200F600001C014E0C9012BDB182B1260802F61EC412F33DB01C080E0DF91CF911F910F917C
:200F80000895CF93DF93EC018091E80083FF60C0888190E020913402309135022817390781
:200FA00009F056C080913102813261F0823220F4803209F04DC019C0823269F1833209F0C5
:200FC00047C038C080913002813A09F041C08091E800877F8093E800CE010F9667E070E015
:200FE00071DB8091E8008B7713C080913002813279F58091E800877F8093E800CE010F9605
:2010000067E070E013DCCE01E9D88091E8008E778093E8001DC0809130028132C9F4809120
:20102000E800877F8093E800809132028D87CE016ED90DC080913002813251F48091E80057
:20104000877F8093E800CE0160913202C5DEECDADF91CF910895A1E21A2EAA1BBB1BFD0161
:201060000DC0AA1FBB1FEE1FFF1FA217B307E407F50720F0A21BB30BE40BF50B661F771FE6
:20108000881F991F1A9469F760957095809590959B01AC01BD01CF01089597FB092E052647
:2010A0000ED057FD04D0D7DF0AD0001C38F450954095309521953F4F4F4F5F4F0895F6F7B9
:2010C00090958095709561957F4F8F4F9F4F0895F894FFCF000340000004400000020800B9
:0C10E000000000000000000000001400F0
:00000001FF

View File

@@ -0,0 +1,137 @@
:20000000A7C00000C0C00000BEC00000BCC00000BAC00000B8C00000B6C00000B4C0000023
:20002000B2C00000B0C00000AEC00000CBC400008FC40000A8C00000A6C00000A4C000005C
:20004000A2C00000A0C000009EC000009CC000009AC0000098C0000096C0000021C100003A
:2000600092C0000090C000008EC000008CC000008AC0000088C0000086C0000084C0000028
:2000800082C0000080C000007EC000007CC000007AC0000078C000001201100102000008C4
:2000A00041233D0001000102DC0109023E00020100C0320904000001020201000524000143
:2000C00010042402060524060001070582030800FF09040100020A000000070504024000AC
:2000E0000107058302400001040309043203410072006400750069006E006F0020002800CA
:200100007700770077002E00610072006400750069006E006F002E0063006300290000003D
:200120002E03410072006400750069006E006F0020004400750065002000500072006F002D
:2001400067002E00200050006F0072007400000011241FBECFEFD2E0DEBFCDBF11E0A0E029
:20016000B1E0E8EEF0E102C005900D92A831B107D9F712E0A8E1B1E001C01D92A833B107E1
:20018000E1F722D1AFC73CCF9C01DC01AE57BF4FED91FC91119741911196FC93EE93805872
:2001A0009F4FE817F90711F42D933C939FB7F894F901EC57FF4F8081815080839FBF842F6B
:2001C0000895882311F03F9A01C03F9847980895882311F046980895469A0895DF92EF9253
:2001E000FF920F931F93FC018489813019F0823019F404C010E303C010E001C010E283896E
:20020000823009F418608589873031F0883031F0863029F4126003C0146001C016601092A3
:20022000C9001092C8001092CA000785F088E188D288202F3F2D4E2D5D2D10921E01203B7C
:2002400084E0380780E0480780E0580719F481E080931E01CA01B90122E030E040E050E006
:2002600026D720583B47414E5F4FCA01B901202F3F2D4E2D5D2DF9D6215030403093CD00C5
:200280002093CC001093CA0082E08093C80088E98093C9001F910F91FF90EF90DF9008957E
:2002A0001F920F920FB60F9211242F938F939F93EF93FF939091CE008EB38430F1F4E091ED
:2002C000A201F091A3019083E091A201F091A301CF0101969093A3018093A201825A914079
:2002E00021F482E291E0928381839FB7F8948091A6018F5F8093A6019FBFFF91EF919F911B
:200300008F912F910F900FBE0F901F901895FC0140911A0140931B0180911C0180931D015F
:200320008585282F30E02170307020931A01858590E096958795817080931C0180911E013B
:20034000882339F08FE590E090931901809318010895442341F4222331F08EE190E09093DB
:20036000190180931801089580E091E014C680E091E0C7C51F9384B7877F84BF18E10FB69E
:20038000F89410936000109260000FBE80E019DF469A3E9A87E690E09093CD008093CC0043
:2003A00086E08093CA001092C8001093C900539A5A9A8AB180638AB98BB180638BB9BDD2F0
:2003C00084E085BD1F9108950F931F93CF93DF93D1DF2FB7F89487EA91E09093280280939E
:2003E000270290932A02809329022FBF2FB7F89482E291E09093A3018093A2019093A501CC
:200400008093A4012FBF7894C7EAD1E003E08FB7F89490912B028FBF903809F180E091E0E4
:20042000E6D497FD1CC0E0912702F09128028083E0912702F0912802CF0101969093280251
:20044000809327028752924011F4D283C1839FB7F89480912B028F5F80932B029FBF8FB725
:20046000F8941091A6018FBFA89903C0113608F469C0A89A8091A601882361F05D9800936C
:200480001F0108C082E291E07FDE682F80E091E014D511501123B1F780911F01882351F097
:2004A00080911F01815080931F0180911F01882309F45D9A80912001882351F080912001E7
:2004C00081508093200180912001882309F45C9A8091180190911901181619067CF58F3560
:2004E000910521F481E074DE80E06BDE8091180190911901839721F480E06ADE80E061DE1A
:200500008091180190911901499721F480E060DE81E057DE8091180190911901019721F43B
:2005200080E056DE80E04DDE80911801909119010197909319018093180104C080E048DEEC
:2005400080E03FDE8FB7F89490912B028FBF992369F087EA91E018DE982F8091C80085FF9F
:20056000FCCF9093CE005C980093200180E091E095D42AD44CCFDA01923049F0933061F0DA
:200580009130F9F4E8E9F0E022E130E01EC0EAEAF0E02EE330E019C0813049F0813018F0DA
:2005A000823079F408C0E8EEF0E0849107C0ECEEF0E0849103C0E0E2F1E08491282F30E041
:2005C00004C0E0E0F0E020E030E0ED93FC93C901089528E030E040E003C04F5F220F331F15
:2005E00028173907D0F3842F8295807F08958093E9008091EB0081608093EB001092ED00ED
:200600006093EC004093ED008091EE00881F8827881F08951092F40090E09093E9001092EE
:20062000F0001092E8001092ED008091EB008E7F8093EB009F5F953081F70895809130028F
:2006400088238CF403C08EB38823B1F08091E80082FFF9CF8091E8008B778093E80008954A
:200660008EB3882349F08091E80080FFF9CF8091E8008E778093E800089594E68091EC0008
:2006800080FF05C08091E80080FF05C023C08091E80082FD1FC08EB3882311F482E00895AF
:2006A0008EB3853011F483E008958091EB0085FF02C081E008958091E10082FFDFCF8091CD
:2006C000E1008B7F8093E100992311F484E008959150D4CF80E008959C0140913602509171
:2006E00037024617570718F4F90120E038C06115710511F0AB01F8CF8091E8008E77809397
:20070000E80040E050E0F0CF8091E80083FF02C081E008958091E80082FD2DC08EB3882356
:2007200081F18EB3853079F18091E80080FF17C09091F20006C081918093F1004150504088
:200740009F5F4115510511F09830A8F320E0983009F421E08091E8008E778093E800411576
:20076000510591F6222381F606C08EB3882349F08EB3853041F08091E80082FFF6CF80E02F
:20078000089582E0089583E008959C0140913602509137024617570710F490E03BC061155D
:2007A000710511F0AB01F9CF8091E8008E778093E80040E050E0F1CF8091E80083FF02C008
:2007C00081E008958091E80082FD30C08EB3882399F18EB3853091F18091E80080FF1AC073
:2007E0008091F20009C0F9012F5F3F4FE491E093F100415050408F5F4115510511F08830CA
:2008000090F390E0883009F491E08091E8008E778093E8004115510579F6992369F606C0CA
:200820008EB3882349F08EB3853041F08091E80082FFF6CF80E0089582E0089583E0089531
:200840009C016115710529F48091E8008B778093E800F90120C08091E80083FF02C081E084
:2008600008958EB3882339F18EB3853031F18091E80082FFF0CF06C08091F10081936150E7
:20088000704021F08091F2008823B1F78091E8008B778093E80061157105E9F606C08EB379
:2008A000882349F08EB3853041F08091E80080FFF6CF80E0089582E0089583E0089542D0E2
:2008C00044D01EBA10922E0210922D0210922C0284E089BD89B5826089BD09B400FEFDCF22
:2008E0008091D800982F9F779093D80080688093D800809163008E7F809363008091D80084
:200900008F7D8093D8008091E0008E7F8093E0008091E1008E7F8093E1008091E200816028
:200920008093E2008091E100877F8093E1008091E20088608093E2000895C1DF81E0809355
:200940002F0208951092E20008951092E10008951F920F920FB60F9211241F932F933F9355
:200960004F935F936F937F938F939F93AF93BF93EF93FF93E9EEF0E0108117701082E0EF73
:20098000F0E08081877F80837894C3D0F894A9EEB0E01C92E0EFF0E08081886080831C9343
:2009A000FF91EF91BF91AF919F918F917F916F915F914F913F912F911F910F900FBE0F901C
:2009C0001F9018951F920F920FB60F9211242F933F934F935F936F937F938F939F93AF93BC
:2009E000BF93EF93FF938091E10080FF1BC08091E20080FF17C08091E1008E7F8093E10009
:200A00008091E2008E7F8093E2008091E20080618093E2008091D80080628093D80019BC8D
:200A20001EBAD1D18091E10084FF29C08091E20084FF25C084E089BD89B5826089BD09B4B6
:200A400000FEFDCF8091D8008F7D8093D8008091E1008F7E8093E1008091E2008F7E8093E6
:200A6000E2008091E20081608093E20080912E02882311F481E001C084E08EBBA4D1809185
:200A8000E10083FF27C08091E20083FF23C08091E100877F8093E10082E08EBB10922E024B
:200AA0008091E1008E7F8093E1008091E2008E7F8093E2008091E20080618093E200AADDFE
:200AC00080E060E042E093DD8091F00088608093F00079D18091E10082FF0AC08091E2007E
:200AE00082FF06C08091E1008B7F8093E1006BD1FF91EF91BF91AF919F918F917F916F9183
:200B00005F914F913F912F910F900FBE0F901F9018951F93DF93CF93CDB7DEB7AC970FB667
:200B2000F894DEBF0FBECDBFE0E3F2E08091F100819322E0E833F207C9F7809130023091AE
:200B40003102353009F487C0363040F43130C9F1313070F0333009F01DC133C0383009F4B1
:200B6000EFC0393009F4FEC0363009F013C192C0803821F0823809F00DC108C090912C02BC
:200B800080912D02882399F0926011C08091340287708093E9008091EB0090E025E0969548
:200BA00087952A95E1F7982F91701092E9008091E800877F8093E8009093F1001092F1008E
:200BC000CAC0882319F0823009F0E4C090E08F719070009721F0029709F0DDC00CC0809164
:200BE0003202813009F0D7C010922D02333069F580932D022AC080913202882331F52091FB
:200C00003402277009F4C7C02093E9008091EB0080FFC1C0333021F48091EB00806213C0C2
:200C20008091EB0080618093EB0081E090E002C0880F991F2A95E2F78093EA001092EA00D6
:200C40008091EB0088608093EB001092E9008091E800877F83C0882309F09CC01091320210
:200C60008091E800877F8093E800E8DC04C08EB3882309F490C08091E80080FFF8CF812FCA
:200C80008F7711F492E001C093E09EBB80688093E30081C08058823008F07CC08091320228
:200CA0009091330223E08C3D920799F55FB7F894DE0115964EE020E030E061E2E42FF0E05B
:200CC00060935700849120FF03C082958F704F5F982F9F70892F805D8A3308F0895F8C93E8
:200CE00011961C9211972F5F3F4F12962431310529F75FBF8AE28B8383E08C838091E80085
:200D0000877F8093E800CE0103966AE270E0E4DC11C060913402AE014F5F5F4F2CDCBC0146
:200D20000097C9F18091E800877F8093E80089819A812BDD8091E8008B778093E8002BC05A
:200D4000803841F58091E800877F8093E80080912E028093F1008091E8008E778093E8006D
:200D60006DDC19C08823B1F490913202923098F48091E800877F8093E80090932E025EDCD7
:200D800080912E02882311F483E001C084E08EBBEEDA01C0E9DA8091E80083FF0AC08091EF
:200DA000EB0080628093EB008091E800877F8093E800AC960FB6F894DEBF0FBECDBFCF9185
:200DC000DF911F91089508951F938EB3882361F01091E9001092E9008091E80083FF01C079
:200DE00098DE17701093E9001F9108950895FC018EB3843021F587859089A189B289009757
:200E0000A105B105E1F085818093E9008091E80082FF15C08091F200882319F42FEF3FEF4D
:200E200004C08091F100282F30E08091F200882341F48091E8008B778093E80002C02FEFCC
:200E40003FEFC9010895FC018EB3843011F587859089A189B2890097A105B105D1F08181C5
:200E60008093E9008091F2008823A9F09091E8008091E8008E778093E80095FD0CC0FDDBF7
:200E8000982F882349F48091E8008E778093E80003C092E001C090E0892F0895FC018EB3B1
:200EA000843051F487859089A189B2890097A105B10511F0CF01C7CF08951F93FC01162FC4
:200EC0008EB38430D9F487859089A189B2890097A105B10599F081818093E9008091E80053
:200EE00085FD08C08091E8008E778093E800C5DB882329F41093F10080E001C082E01F9180
:200F000008950F931F93CF93DF93EC010D96FC0189E0DF011D928A95E9F72A813B81098197
:200F20008C81882311F410E001C014E0C90151DB182B1260802F61E8412F59DB882329F143
:200F40002E813F810D818885882311F410E001C014E0C9013EDB182B1260802F60E8412F33
:200F600046DB882391F02A853B8509858C85882311F410E001C014E0C9012BDB182B12603C
:200F8000802F61EC412F33DB01C080E0DF91CF911F910F910895CF93DF93EC018091E8003F
:200FA00083FF60C0888190E020913402309135022817390709F056C080913102813261F061
:200FC000823220F4803209F04DC019C0823269F1833209F047C038C080913002813A09F006
:200FE00041C08091E800877F8093E800CE010F9667E070E071DB8091E8008B7713C08091C0
:201000003002813279F58091E800877F8093E800CE010F9667E070E013DCCE01DFD88091F2
:20102000E8008E778093E8001DC0809130028132C9F48091E800877F8093E80080913202F9
:201040008D87CE0164D90DC080913002813251F48091E800877F8093E800CE01609132027A
:20106000C5DEECDADF91CF910895A1E21A2EAA1BBB1BFD010DC0AA1FBB1FEE1FFF1FA217E2
:20108000B307E407F50720F0A21BB30BE40BF50B661F771F881F991F1A9469F760957095B3
:2010A000809590959B01AC01BD01CF01089597FB092E05260ED057FD04D0D7DF0AD0001CDC
:2010C00038F450954095309521953F4F4F4F5F4F0895F6F790958095709561957F4F8F4F6A
:2010E0009F4F0895F894FFCF00034000000440000002080000000000000000000000140066
:00000001FF

View File

@@ -0,0 +1,273 @@
:10000000A7C00000C0C00000BEC00000BCC000000F
:10001000BAC00000B8C00000B6C00000B4C0000004
:10002000B2C00000B0C00000AEC00000C1C40000FB
:1000300085C40000A8C00000A6C00000A4C0000045
:10004000A2C00000A0C000009EC000009CC0000034
:100050009AC0000098C0000096C0000021C10000B6
:1000600092C0000090C000008EC000008CC0000054
:100070008AC0000088C0000086C0000084C0000064
:1000800082C0000080C000007EC000007CC0000074
:100090007AC0000078C000001201100102000008C0
:1000A00041233D0001000102DC0109023E00020182
:1000B00000C0320904000001020201000524000111
:1000C0001004240206052406000107058203080027
:1000D000FF09040100020A000000070504024000B5
:1000E00001070583024000010403090432034100B3
:1000F00072006400750069006E006F002000280027
:100100007700770077002E006100720064007500B0
:1001100069006E006F002E0063006300290000007C
:100120002E03410072006400750069006E006F00CC
:1001300020004400750065002000500072006F0030
:1001400067002E00200050006F0072007400000055
:1001500011241FBECFEFD2E0DEBFCDBF11E0A0E083
:10016000B1E0E4EDF0E102C005900D92A831B107D5
:10017000D9F712E0A8E1B1E001C01D92A833B107A0
:10018000E1F72BD1A5C73CCF9C01DC01AE57BF4F97
:10019000ED91FC91119741911196FC93EE9380584B
:1001A0009F4FE817F90711F42D933C939FB7F894EC
:1001B000F901EC57FF4F8081815080839FBF842FCE
:1001C0000895882311F03F9A01C03F9847980895F9
:1001D000882311F046980895469A0895DF92EF9289
:1001E000FF920F931F93FC018489813019F08230B4
:1001F00019F404C010E303C010E001C010E28389C9
:10020000823009F418608589873031F0883031F008
:10021000863029F4126003C0146001C01660109289
:10022000C9001092C8001092CA000785F088E188C2
:10023000D288202F3F2D4E2D5D2D10921E01203B88
:1002400084E0380780E0480780E0580719F481E02F
:1002500080931E01CA01B90122E030E040E050E085
:100260001CD720583B47414E5F4FCA01B901202F90
:100270003F2D4E2D5D2DEFD6215030403093CD00D7
:100280002093CC001093CA0082E08093C80088E9D4
:100290008093C9001F910F91FF90EF90DF90089518
:1002A0001F920F920FB60F9211242F938F939F934B
:1002B000EF93FF939091CE008EB38430F1F4E091F0
:1002C000A201F091A3019083E091A201F091A3011A
:1002D000CF0101969093A3018093A201825A91408D
:1002E00021F482E291E0928381839FB7F894809118
:1002F000A6018F5F8093A6019FBFFF91EF919F9111
:100300008F912F910F900FBE0F901F901895FC01A9
:1003100040911A0140931B0180911C0180931D01A3
:100320008585282F30E02170307020931A01858553
:1003300090E096958795817080931C0180911E01B5
:10034000882339F088E790E0909319018093180191
:100350000895442341F4222331F082E390E0909306
:10036000190180931801089580E091E00AC680E0A9
:1003700091E0BDC584B7877F84BF88E10FB6F8944C
:1003800080936000109260000FBE81E01ADF16BCFF
:1003900083E085BD86B58831E8F315BC16BC80E0E6
:1003A00010DF469A3E9A87E690E09093CD008093C6
:1003B000CC0086E08093CA001092C80088E1809348
:1003C000C900539A5A9A8AB180638AB98BB1806303
:1003D0008BB9A9D284E085BD08950F931F93CF9365
:1003E000DF93C8DF2FB7F89487EA91E09093280253
:1003F0008093270290932A02809329022FBF2FB760
:10040000F89482E291E09093A3018093A2019093EB
:10041000A5018093A4012FBF7894C7EAD1E003E03F
:100420008FB7F89490912B028FBF903809F180E03C
:1004300091E0D3D497FD1CC0E0912702F0912802EF
:100440008083E0912702F0912802CF0101969093DA
:100450002802809327028752924011F4D283C183ED
:100460009FB7F89480912B028F5F80932B029FBFE0
:100470008FB7F8941091A6018FBFA89903C01136C9
:1004800008F456C0A89A8091A601882361F05D986F
:1004900000931F0108C082E291E076DE682F80E0C1
:1004A00091E001D511501123B1F780911F018823EC
:1004B00051F080911F01815080931F0180911F0195
:1004C000882309F45D9A80912001882351F080915E
:1004D000200181508093200180912001882309F41C
:1004E0005C9A809118019091190118161906E4F48C
:1004F000CC97CD9710F481E001C080E069DE809157
:100500001801909119010197C29710F481E001C080
:1005100080E057DE80911801909119010197909326
:1005200019018093180104C080E052DE80E049DEAA
:100530008FB7F89490912B028FBF992369F087EAC7
:1005400091E022DE982F8091C80085FFFCCF909328
:10055000CE005C980093200180E091E095D42AD4ED
:100560005FCFDA01923049F0933061F09130F9F4C5
:10057000E8E9F0E022E130E01EC0EAEAF0E02EE334
:1005800030E019C0813049F0813018F0823079F4C0
:1005900008C0E8EEF0E0849107C0ECEEF0E0849152
:1005A00003C0E0E2F1E08491282F30E004C0E0E0F5
:1005B000F0E020E030E0ED93FC93C901089528E0DD
:1005C00030E040E003C04F5F220F331F2817390788
:1005D000D0F3842F8295807F08958093E9008091E5
:1005E000EB0081608093EB001092ED006093EC00D3
:1005F0004093ED008091EE00881F8827881F0895A2
:100600001092F40090E09093E9001092F0001092A4
:10061000E8001092ED008091EB008E7F8093EB005C
:100620009F5F953081F708958091300288238CF484
:1006300003C08EB38823B1F08091E80082FFF9CF28
:100640008091E8008B778093E80008958EB388232B
:1006500049F08091E80080FFF9CF8091E8008E7723
:100660008093E800089594E68091EC0080FF05C037
:100670008091E80080FF05C023C08091E80082FDE2
:100680001FC08EB3882311F482E008958EB38530A5
:1006900011F483E008958091EB0085FF02C081E0B2
:1006A00008958091E10082FFDFCF8091E1008B7F90
:1006B0008093E100992311F484E008959150D4CF00
:1006C00080E008959C014091360250913702461710
:1006D000570718F4F90120E038C06115710511F0D1
:1006E000AB01F8CF8091E8008E778093E80040E07E
:1006F00050E0F0CF8091E80083FF02C081E00895D0
:100700008091E80082FD2DC08EB3882381F18EB3E5
:10071000853079F18091E80080FF17C09091F20058
:1007200006C081918093F100415050409F5F411578
:10073000510511F09830A8F320E0983009F421E039
:100740008091E8008E778093E8004115510591F67D
:10075000222381F606C08EB3882349F08EB38530FC
:1007600041F08091E80082FFF6CF80E0089582E0BA
:10077000089583E008959C0140913602509137021C
:100780004617570710F490E03BC06115710511F052
:10079000AB01F9CF8091E8008E778093E80040E0CC
:1007A00050E0F1CF8091E80083FF02C081E008951E
:1007B0008091E80082FD30C08EB3882399F18EB31A
:1007C000853091F18091E80080FF1AC08091F2009D
:1007D00009C0F9012F5F3F4FE491E093F1004150D0
:1007E00050408F5F4115510511F0883090F390E033
:1007F000883009F491E08091E8008E778093E800DA
:100800004115510579F6992369F606C08EB3882300
:1008100049F08EB3853041F08091E80082FFF6CF39
:1008200080E0089582E0089583E008959C016115B9
:10083000710529F48091E8008B778093E800F90135
:1008400020C08091E80083FF02C081E008958EB34C
:10085000882339F18EB3853031F18091E80082FF31
:10086000F0CF06C08091F10081936150704021F07B
:100870008091F2008823B1F78091E8008B77809314
:10088000E80061157105E9F606C08EB3882349F0CA
:100890008EB3853041F08091E80080FFF6CF80E094
:1008A000089582E0089583E0089542D044D01EBAAE
:1008B00010922E0210922D0210922C0284E089BD1B
:1008C00089B5826089BD09B400FEFDCF8091D80052
:1008D000982F9F779093D80080688093D80080915C
:1008E00063008E7F809363008091D8008F7D80931A
:1008F000D8008091E0008E7F8093E0008091E1003D
:100900008E7F8093E1008091E20081608093E2001D
:100910008091E100877F8093E1008091E200886010
:100920008093E2000895C1DF81E080932F02089553
:100930001092E20008951092E10008951F920F9224
:100940000FB60F9211241F932F933F934F935F93F2
:100950006F937F938F939F93AF93BF93EF93FF9387
:10096000E9EEF0E0108117701082E0EFF0E0808196
:10097000877F80837894C3D0F894A9EEB0E01C926E
:10098000E0EFF0E08081886080831C93FF91EF911D
:10099000BF91AF919F918F917F916F915F914F9197
:1009A0003F912F911F910F900FBE0F901F901895A0
:1009B0001F920F920FB60F9211242F933F934F93D4
:1009C0005F936F937F938F939F93AF93BF93EF93B7
:1009D000FF938091E10080FF1BC08091E20080FFC7
:1009E00017C08091E1008E7F8093E1008091E2004A
:1009F0008E7F8093E2008091E20080618093E2002C
:100A00008091D80080628093D80019BC1EBAD1D1E1
:100A10008091E10084FF29C08091E20084FF25C01D
:100A200084E089BD89B5826089BD09B400FEFDCF2F
:100A30008091D8008F7D8093D8008091E1008F7ED7
:100A40008093E1008091E2008F7E8093E2008091AC
:100A5000E20081608093E20080912E02882311F4ED
:100A600081E001C084E08EBBA4D18091E10083FFCE
:100A700027C08091E20083FF23C08091E100877F3F
:100A80008093E10082E08EBB10922E028091E10003
:100A90008E7F8093E1008091E2008E7F8093E20060
:100AA0008091E20080618093E200AADD80E060E056
:100AB00042E093DD8091F00088608093F00079D16E
:100AC0008091E10082FF0AC08091E20082FF06C0AF
:100AD0008091E1008B7F8093E1006BD1FF91EF91DA
:100AE000BF91AF919F918F917F916F915F914F9146
:100AF0003F912F910F900FBE0F901F9018951F934D
:100B0000DF93CF93CDB7DEB7AC970FB6F894DEBFC7
:100B10000FBECDBFE0E3F2E08091F100819322E0CF
:100B2000E833F207C9F78091300230913102353055
:100B300009F487C0363040F43130C9F1313070F0FB
:100B4000333009F01DC133C0383009F4EFC03930FB
:100B500009F4FEC0363009F013C192C0803821F08C
:100B6000823809F00DC108C090912C0280912D02AD
:100B7000882399F0926011C080913402877080932D
:100B8000E9008091EB0090E025E0969587952A9505
:100B9000E1F7982F91701092E9008091E800877F2B
:100BA0008093E8009093F1001092F100CAC088236E
:100BB00019F0823009F0E4C090E08F7190700097D6
:100BC00021F0029709F0DDC00CC080913202813023
:100BD00009F0D7C010922D02333069F580932D02B1
:100BE0002AC080913202882331F520913402277087
:100BF00009F4C7C02093E9008091EB0080FFC1C0D9
:100C0000333021F48091EB00806213C08091EB00BF
:100C100080618093EB0081E090E002C0880F991F13
:100C20002A95E2F78093EA001092EA008091EB00A7
:100C300088608093EB001092E9008091E800877F44
:100C400083C0882309F09CC0109132028091E80093
:100C5000877F8093E800E8DC04C08EB3882309F422
:100C600090C08091E80080FFF8CF812F8F7711F43A
:100C700092E001C093E09EBB80688093E30081C056
:100C80008058823008F07CC080913202909133020B
:100C900023E08C3D920799F55FB7F894DE01159635
:100CA0004EE020E030E061E2E42FF0E06093570096
:100CB000849120FF03C082958F704F5F982F9F70A3
:100CC000892F805D8A3308F0895F8C9311961C927E
:100CD00011972F5F3F4F12962431310529F75FBFDF
:100CE0008AE28B8383E08C838091E800877F809306
:100CF000E800CE0103966AE270E0E4DC11C0609186
:100D00003402AE014F5F5F4F2CDCBC010097C9F18C
:100D10008091E800877F8093E80089819A812BDDAC
:100D20008091E8008B778093E8002BC0803841F5F4
:100D30008091E800877F8093E80080912E02809365
:100D4000F1008091E8008E778093E8006DDC19C097
:100D50008823B1F490913202923098F48091E800A7
:100D6000877F8093E80090932E025EDC80912E02B4
:100D7000882311F483E001C084E08EBBF8DA01C05F
:100D8000F3DA8091E80083FF0AC08091EB00806273
:100D90008093EB008091E800877F8093E800AC9619
:100DA0000FB6F894DEBF0FBECDBFCF91DF911F917C
:100DB000089508951F938EB3882361F01091E90080
:100DC0001092E9008091E80083FF01C098DE17705F
:100DD0001093E9001F9108950895FC018EB38430AB
:100DE00021F587859089A189B2890097A105B10570
:100DF000E1F085818093E9008091E80082FF15C0D1
:100E00008091F200882319F42FEF3FEF04C0809106
:100E1000F100282F30E08091F200882341F4809186
:100E2000E8008B778093E80002C02FEF3FEFC90105
:100E30000895FC018EB3843011F587859089A189CE
:100E4000B2890097A105B105D1F081818093E900B5
:100E50008091F2008823A9F09091E8008091E80049
:100E60008E778093E80095FD0CC0FDDB982F8823DA
:100E700049F48091E8008E778093E80003C092E007
:100E800001C090E0892F0895FC018EB3843051F4A5
:100E900087859089A189B2890097A105B10511F0D4
:100EA000CF01C7CF08951F93FC01162F8EB3843056
:100EB000D9F487859089A189B2890097A105B105E8
:100EC00099F081818093E9008091E80085FD08C058
:100ED0008091E8008E778093E800C5DB882329F4B1
:100EE0001093F10080E001C082E01F9108950F93FC
:100EF0001F93CF93DF93EC010D96FC0189E0DF0196
:100F00001D928A95E9F72A813B8109818C8188238A
:100F100011F410E001C014E0C90151DB182B12607C
:100F2000802F61E8412F59DB882329F12E813F81F1
:100F30000D818885882311F410E001C014E0C901F7
:100F40003EDB182B1260802F60E8412F46DB8823A0
:100F500091F02A853B8509858C85882311F410E062
:100F600001C014E0C9012BDB182B1260802F61EC4B
:100F7000412F33DB01C080E0DF91CF911F910F91B2
:100F80000895CF93DF93EC018091E80083FF60C068
:100F9000888190E02091340230913502281739077A
:100FA00009F056C080913102813261F0823220F422
:100FB000803209F04DC019C0823269F1833209F0E4
:100FC00047C038C080913002813A09F041C0809119
:100FD000E800877F8093E800CE010F9667E070E01D
:100FE00071DB8091E8008B7713C0809130028132F1
:100FF00079F58091E800877F8093E800CE010F9615
:1010000067E070E013DCCE01E9D88091E8008E77CC
:101010008093E8001DC0809130028132C9F4809134
:10102000E800877F8093E800809132028D87CE01AF
:101030006ED90DC080913002813251F48091E80068
:10104000877F8093E800CE0160913202C5DEECDA42
:10105000DF91CF910895A1E21A2EAA1BBB1BFD01BF
:101060000DC0AA1FBB1FEE1FFF1FA217B307E40787
:10107000F50720F0A21BB30BE40BF50B661F771FDF
:10108000881F991F1A9469F76095709580959095BF
:101090009B01AC01BD01CF01089597FB092E0526E8
:1010A0000ED057FD04D0D7DF0AD0001C38F450957D
:1010B0004095309521953F4F4F4F5F4F0895F6F77C
:1010C00090958095709561957F4F8F4F9F4F0895B4
:0410D000F894FFCFC2
:1010D400000340000004400000020800000000007B
:0810E4000000000000001400F0
:00000001FF

View File

@@ -0,0 +1 @@
../tools/mac/tool-avrdude/avrdude -C ../tools/mac/tool-avrdude/avrdude.conf -c arduino -P /dev/cu.usbmodem14201 -b 19200 -p m16u2 -vvv -U flash:r:16u2-out3.hex:i

2
compiled/DUE_16u2_reflash/reflash16u2DUE.sh Normal file → Executable file
View File

@@ -1 +1 @@
../tools/mac/tool-avrdude/avrdude -C ../tools/mac/tool-avrdude/avrdude.conf -c arduino -P /dev/cu.usbmodem1411 -b 19200 -p m16u2 -vvv -U flash:w:16u2.hex:i ../tools/mac/tool-avrdude/avrdude -C ../tools/mac/tool-avrdude/avrdude.conf -c arduino -P /dev/cu.usbmodem14201 -b 19200 -p m16u2 -vvv -U flash:w:16u2.hex:i

View File

@@ -0,0 +1 @@
../tools/mac/tool-avrdude/avrdude -C ../tools/mac/tool-avrdude/avrdude.conf -c arduino -P /dev/cu.usbmodem14201 -b 19200 -p m16u2 -vvv -U flash:w:16u2-original.hex:i

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

View File

@@ -1,3 +1,3 @@
export PORT=cu.usbmodem1411 export PORT=cu.usbmodem14201
echo . | stty -f /dev/$PORT speed 1200 echo . | stty -f /dev/$PORT speed 1200
../tools/mac/tool-bossac/bossac -U false -p $PORT -i -e -w -v -b firmware.bin -R ../tools/mac/tool-bossac/bossac -U false -p $PORT -i -e -w -v -b firmware.bin -R

1
compiled/due-5500/uploadOTA.sh Executable file
View File

@@ -0,0 +1 @@
../tools/mac/arduinoOTA -address 192.168.88.21 -port 65280 -username arduino -password password -sketch firmware.bin -b -upload /sketch

BIN
compiled/due/firmware.bin Executable file

Binary file not shown.

1
compiled/due/uploadOTA.sh Executable file
View File

@@ -0,0 +1 @@
../tools/mac/arduinoOTA -address 192.168.88.21 -port 65280 -username arduino -password password -sketch firmware.bin -b -upload /sketch

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
compiled/lighthub21/hello.bin Executable file

Binary file not shown.

View File

@@ -0,0 +1 @@
cp ../../.pio/build/lighthub21/firmware.bin .

View File

@@ -0,0 +1 @@
../tools/mac/arduinoOTA -address 192.168.88.59 -port 65280 -username arduino -password password -sketch hello.bin -b -upload /sketch

View File

@@ -0,0 +1 @@
../tools/mac/arduinoOTA -address 192.168.11.172 -port 65280 -username arduino -password password -sketch firmware.bin -b -upload /sketch

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

BIN
compiled/tools/mac/arduinoOTA Executable file

Binary file not shown.

View File

@@ -1,12 +1,13 @@
cp ../.pioenvs/controllino/firmware.hex controllino cp ../.pio/build/due/firmware.bin due
cp ../.pioenvs/m5stack/firmware.bin m5stack cp ../.pio/build/controllino/firmware.hex controllino
cp ../.pioenvs/mega2560slim-5100/firmware.hex mega2560slim-5100 cp ../.pio/build/m5stack/firmware.bin m5stack
cp ../.pioenvs/due-5100/firmware.bin due-5100 cp ../.pio/build/mega2560slim-5100/firmware.hex mega2560slim-5100
cp ../.pioenvs/mega2560-5100/firmware.hex mega2560-5100 cp ../.pio/build/due-5100/firmware.bin due-5100
cp ../.pioenvs/due-5500/firmware.bin due-5500 cp ../.pio/build/mega2560-5100/firmware.hex mega2560-5100
cp ../.pioenvs/nrf52840-5500/firmware.hex nrf52840-5500 cp ../.pio/build/due-5500/firmware.bin due-5500
cp ../.pioenvs/esp32-wifi/firmware.bin esp32-wifi cp ../.pio/build/nrf52840-5500/firmware.hex nrf52840-5500
cp ../.pioenvs/stm32-enc2860/firmware.bin stm32-enc2860 cp ../.pio/build/esp32-wifi/firmware.bin esp32-wifi
cp ../.pioenvs/esp8266-wifi/firmware.bin esp8266-wifi cp ../.pio/build/stm32-enc2860/firmware.bin stm32-enc2860
cp ../.pioenvs/lighthub21/firmware.bin lighthub21 cp ../.pio/build/esp8266-wifi/firmware.bin esp8266-wifi
cp ../.pioenvs/mega2560-5500/firmware.hex mega2560-5500 cp ../.pio/build/lighthub21/firmware.bin lighthub21
cp ../.pio/build/mega2560-5500/firmware.hex mega2560-5500

View File

@@ -1,32 +0,0 @@
#! /bin/bash
# usage:
# first make your own copy of template
# cp build_flags_template.sh my_build_flags.sh
# then edit, change or comment something
# nano my_build_flags.sh
# and source it
# source my_build_flags.sh
#export FLAGS="$FLAGS -DMY_CONFIG_SERVER=lighthub.elistech.ru"
#export FLAGS="$FLAGS -DWATCH_DOG_TICKER_DISABLE"
#export FLAGS="$FLAGS -DUSE_1W_PIN=12"
#export FLAGS="$FLAGS -DSD_CARD_INSERTED"
export FLAGS="$FLAGS -DSERIAL_BAUD=115200"
# export FLAGS="$FLAGS -DWiz5500"
export FLAGS="$FLAGS -DDISABLE_FREERAM_PRINT"
export FLAGS="$FLAGS -DCUSTOM_FIRMWARE_MAC=C2:3E:1f:03:1B:1E"
# export FLAGS="$FLAGS -DDMX_DISABLE"
# export FLAGS="$FLAGS -DMODBUS_DISABLE"
# export FLAGS="$FLAGS -DOWIRE_DISABLE"
#export FLAGS="$FLAGS -DAVR_DMXOUT_PIN=18"
#export FLAGS="$FLAGS -DCONTROLLINO"
# export FLAGS="$FLAGS -DRESET_PIN=8"
# export FLAGS="$FLAGS -DLAN_INIT_DELAY=2000"
# export FLAGS="$FLAGS -DESP_WIFI_AP=vent"
# export FLAGS="$FLAGS -DESP_WIFI_PWD=kk007remont"
# export FLAGS="$FLAGS -DSYSLOG_ENABLE"
export FLAGS="$FLAGS -DDEVICE_NAME=kk007_mega2560"
export FLAGS="$FLAGS -DCOUNTER_DISABLE"
export FLAGS="$FLAGS -DDHT_DISABLE"
#export FLAGS="$FLAGS -DWITH_DOMOTICZ"
#export FLAGS="$FLAGS -DWITH_PRINTEX_LIB"
export FLAGS="$FLAGS -DPIO_SRC_REV="$(git log --pretty=format:%h_%ad -1 --date=short)

View File

@@ -1,30 +0,0 @@
#! /bin/bash
# usage:
# first make your own copy of template
# cp build_flags_template.sh build_flags_ENVNAME.sh
# then edit, change or comment something
#export FLAGS="$FLAGS -DMY_CONFIG_SERVER=lazyhome.ru"
export FLAGS="$FLAGS -DWATCH_DOG_TICKER_DISABLE"
#export FLAGS="$FLAGS -DUSE_1W_PIN=12"
#export FLAGS="$FLAGS -DSD_CARD_INSERTED"
#export FLAGS="$FLAGS -DSERIAL_BAUD=115200"
#export FLAGS="$FLAGS -DWiz5500"
export FLAGS="$FLAGS -DDISABLE_FREERAM_PRINT"
#export FLAGS="$FLAGS -DCUSTOM_FIRMWARE_MAC=de:ad:be:ef:fe:ff"
#export FLAGS="$FLAGS -DDMX_DISABLE"
#export FLAGS="$FLAGS -DMODBUS_DISABLE"
#export FLAGS="$FLAGS -DOWIRE_DISABLE"
# export FLAGS="$FLAGS -DAVR_DMXOUT_PIN=18"
# export FLAGS="$FLAGS -DLAN_INIT_DELAY=2000"
# export FLAGS="$FLAGS -DCONTROLLINO"
# export FLAGS="$FLAGS -DWIFI_MANAGER_DISABLE"
# export FLAGS="$FLAGS -DRESET_PIN=5"
# export FLAGS="$FLAGS -DDHCP_RETRY_INTERVAL=60000"
# export FLAGS="$FLAGS -DRESTART_LAN_ON_MQTT_ERRORS"
# export FLAGS="$FLAGS -DW5500_CS_PIN=53"
#export FLAGS="$FLAGS -std=gnu++11"
#export FLAGS="$FLAGS -DDEVICE_NAME=MYDEVICE"
#export FLAGS="$FLAGS -DDHT_COUNTER_DISABLE"
#export FLAGS="$FLAGS -DWITH_PRINTEX_LIB"
#export FLAGS="$FLAGS -DPIO_SRC_REV="$(git log --pretty=format:%h_%ad -1 --date=short)
echo $FLAGS

View File

@@ -1,34 +0,0 @@
#! /bin/bash
# usage:
# first make your own copy of template
# cp build_flags_template.sh build_flags_ENVNAME.sh
# then edit, change or comment something
# export FLAGS="$FLAGS -DMY_CONFIG_SERVER=lazyhome.ru"
# export FLAGS="$FLAGS -DWATCH_DOG_TICKER_DISABLE"
# export FLAGS="$FLAGS -DUSE_1W_PIN=12"
# export FLAGS="$FLAGS -DSD_CARD_INSERTED"
# export FLAGS="$FLAGS -DSERIAL_BAUD=115200"
# export FLAGS="$FLAGS -DWiz5500"
# export FLAGS="$FLAGS -DDISABLE_FREERAM_PRINT"
# export FLAGS="$FLAGS -DCUSTOM_FIRMWARE_MAC=de:ad:be:ef:fe:ff"
# export FLAGS="$FLAGS -DDMX_DISABLE"
# export FLAGS="$FLAGS -DMODBUS_DISABLE"
# export FLAGS="$FLAGS -DOWIRE_DISABLE"
# export FLAGS="$FLAGS -DAVR_DMXOUT_PIN=18"
# export FLAGS="$FLAGS -DLAN_INIT_DELAY=2000"
# export FLAGS="$FLAGS -DCONTROLLINO"
# export FLAGS="$FLAGS -DESP_WIFI_AP=MYAP"
# export FLAGS="$FLAGS -DESP_WIFI_PWD=MYPWD"
# export FLAGS="$FLAGS -DWIFI_MANAGER_DISABLE"
# export FLAGS="$FLAGS -DRESET_PIN=5"
# export FLAGS="$FLAGS -DDHCP_RETRY_INTERVAL=60000"
# export FLAGS="$FLAGS -DRESTART_LAN_ON_MQTT_ERRORS"
# export FLAGS="$FLAGS -DW5500_CS_PIN=53"
# export FLAGS="$FLAGS -DSYSLOG_ENABLE"
# export FLAGS="$FLAGS -DDEVICE_NAME=MYDEVICE"
# export FLAGS="$FLAGS -DDHT_DISABLE"
# export FLAGS="$FLAGS -DCOUNTER_DISABLE"
# export FLAGS="$FLAGS -DWITH_PRINTEX_LIB"
# export FLAGS="$FLAGS -DPIO_SRC_REV="$(git log --pretty=format:%h_%ad -1 --date=short)
# export FLAGS="$FLAGS -DCSSHDC_DISABLE"
echo $FLAGS

31
get_build_flags.py Normal file
View File

@@ -0,0 +1,31 @@
# -*- coding: utf-8 -*-
from __future__ import print_function
import os
import sys
print(sys.argv[1:], file=sys.stderr)
#print("build_flags_"+sys.argv[1:][0])
try:
file = open("build-flags/build_flags_"+sys.argv[1:][0])
except IOError as e:
print(u'No build flags file ', file=sys.stderr)
else:
with file:
for line in file.readlines():
if not line.startswith('#'):
print (line)
file.close()
try:
file = open("custom-build-flags/build_flags_"+sys.argv[1:][0])
except IOError as e:
print(u'No custom build flags file ', file=sys.stderr)
else:
with file:
for line in file.readlines():
if not line.startswith('#'):
print (line)
file.close()
sys.stdout.write("-DPIO_SRC_REV=")
sys.stdout.flush()
os.system("git log --pretty=format:%h_%ad -1 --date=short")

42
lighthub/abstractch.cpp Normal file
View File

@@ -0,0 +1,42 @@
#include "abstractch.h"
#include <PubSubClient.h>
#include "utils.h"
#include <aJSON.h>
#include "main.h"
extern lan_status lanStatus;
extern PubSubClient mqttClient;
extern int8_t ethernetIdleCount;
int abstractCh::publishTopic(const char* topic, long value, const char* subtopic)
{
char valstr[16];
printUlongValueToStr(valstr, value);
return publishTopic(topic, valstr,subtopic);
};
int abstractCh::publishTopic(const char* topic, float value, const char* subtopic)
{
char valstr[16];
printFloatValueToStr(value, valstr);
return publishTopic(topic, valstr,subtopic);
};
int abstractCh::publishTopic(const char* topic, const char * value, const char* subtopic)
{
char addrstr[MQTT_TOPIC_LENGTH];
if (!isNotRetainingStatus()) return 0;
if (topic)
{
strncpy(addrstr,topic,sizeof(addrstr));
if (!strchr(addrstr,'/')) setTopic(addrstr,sizeof(addrstr),T_OUT,topic);
strncat(addrstr,subtopic,sizeof(addrstr));
if (mqttClient.connected() && lanStatus == OPERATION && !ethernetIdleCount)
{
mqttClient.publish(addrstr, value, true);
return 1;
}
}
return 0;
};

24
lighthub/abstractch.h Normal file
View File

@@ -0,0 +1,24 @@
#pragma once
#include "Arduino.h"
#define CST_UNKNOWN 0
#define CST_INITIALIZED 1
#define CST_FAILED 2
class abstractCh {
public:
abstractCh(){};
virtual ~abstractCh(){};
virtual int Poll(short cause) = 0;
virtual int Setup() =0; //Should initialize hardware and reserve resources
virtual int Anounce () {return 0;};
virtual int Stop() {return 0;}; //Should free resources
virtual int Status() {return CST_UNKNOWN;}
protected:
virtual int publishTopic(const char* topic, long value, const char* subtopic = NULL);
virtual int publishTopic(const char* topic, float value, const char* subtopic = NULL );
virtual int publishTopic(const char* topic, const char * value, const char* subtopic = NULL);
//friend Input;
};

View File

@@ -1,5 +1,6 @@
#include "abstractin.h" #include "abstractin.h"
#include "abstractch.h"
#include <PubSubClient.h> #include <PubSubClient.h>
#include "utils.h" #include "utils.h"
#include <aJSON.h> #include <aJSON.h>
@@ -9,36 +10,28 @@
extern lan_status lanStatus; extern lan_status lanStatus;
extern PubSubClient mqttClient; extern PubSubClient mqttClient;
int abstractIn::publish(long value, char* subtopic) int abstractIn::publish(long value, const char* subtopic)
{ {
char valstr[16]; char valstr[16];
printUlongValueToStr(valstr, value); printUlongValueToStr(valstr, value);
return publish(valstr,subtopic); return publish(valstr,subtopic);
}; };
int abstractIn::publish(float value, char* subtopic) int abstractIn::publish(float value, const char* subtopic)
{ {
char valstr[16]; char valstr[16];
printFloatValueToStr(value, valstr); printFloatValueToStr(value, valstr);
return publish(valstr,subtopic); return publish(valstr,subtopic);
}; };
int abstractIn::publish(char * value, char* subtopic) int abstractIn::publish(char * value, const char* subtopic)
{ {
char addrstr[MQTT_TOPIC_LENGTH];
if (in) if (in)
{ {
aJsonObject *emit = aJson.getObjectItem(in->inputObj, "emit"); aJsonObject *emit = aJson.getObjectItem(in->inputObj, "emit");
if (emit) if (emit && emit->type == aJson_String)
{ {
strncpy(addrstr,emit->valuestring,sizeof(addrstr)); return publishTopic(emit->valuestring,value,subtopic);
if (!strchr(addrstr,'/')) setTopic(addrstr,sizeof(addrstr),T_OUT,emit->valuestring);
strncat(addrstr,subtopic,sizeof(addrstr));
if (mqttClient.connected() && lanStatus == OPERATION)
{
mqttClient.publish(addrstr, value, true);
return 1;
}
} }
} }
return 0; return 0;

View File

@@ -1,17 +1,16 @@
#pragma once #pragma once
#include "Arduino.h" #include "Arduino.h"
#include "abstractch.h"
class Input; class Input;
class abstractIn { class abstractIn : public abstractCh{
public: public:
abstractIn(Input * _in){in=_in;}; abstractIn(Input * _in):abstractCh(){in=_in;};
virtual int Setup(int addr) = 0;
virtual int Poll() = 0;
protected: protected:
Input * in; Input * in;
int publish(long value, char* subtopic = NULL); int publish(long value, const char* subtopic = NULL);
int publish(float value, char* subtopic = NULL ); int publish(float value, const char* subtopic = NULL );
int publish(char * value, char* subtopic = NULL); int publish(char * value, const char* subtopic = NULL);
friend Input; friend Input;
}; };

16
lighthub/abstractout.h Normal file
View File

@@ -0,0 +1,16 @@
#pragma once
#include "Arduino.h"
#include "abstractch.h"
class Item;
class chPersistent {};
class abstractOut : public abstractCh{
public:
abstractOut(Item * _item):abstractCh(){item=_item;};
virtual int Ctrl(short cmd, short n=0, int * Parameters=NULL, int suffixCode=0, char* subItem=NULL) =0;
virtual int isActive(){return 0;};
virtual int getDefaultOnVal(){return 100;};
virtual int getChanType(){return 0;}
protected:
Item * item;
};

23
lighthub/bright.cpp Normal file
View File

@@ -0,0 +1,23 @@
#include "bright.h"
uint8_t getBright(uint8_t percent)
{
int index = map(percent,0,100,0,255);
if (index>255) index=255;
return getBright255(index);
}
uint8_t getBright255(uint8_t percent)
{
#ifdef BRIGHT_LINEAR
return percent;
#else
int val = stepvar[index];
if (val>255) val=255;
Serial.print(F("Bright:"));
Serial.print(percent);
Serial.print(F("->"));
Serial.println(val);
return val;
#endif
}

105
lighthub/bright.h Normal file
View File

@@ -0,0 +1,105 @@
#pragma once
#include <Arduino.h>
#define BRIGHT_LINEAR
#ifdef BRIGHT_LOG
const uint8_t stepvar[] PROGMEM =
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x02, 0x02, 0x02, 0x02, 0x02,
0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
0x02, 0x03, 0x03, 0x03, 0x03, 0x03,
0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
0x03, 0x03, 0x03, 0x03, 0x04, 0x04,
0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
0x04, 0x04, 0x04, 0x04, 0x05, 0x05,
0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
0x05, 0x06, 0x06, 0x06, 0x06, 0x06,
0x06, 0x06, 0x06, 0x07, 0x07, 0x07,
0x07, 0x07, 0x07, 0x08, 0x08, 0x08,
0x08, 0x08, 0x08, 0x09, 0x09, 0x09,
0x09, 0x09, 0x0A, 0x0A, 0x0A, 0x0A,
0x0A, 0x0B, 0x0B, 0x0B, 0x0B, 0x0C,
0x0C, 0x0C, 0x0C, 0x0D, 0x0D, 0x0D,
0x0E, 0x0E, 0x0E, 0x0E, 0x0F, 0x0F,
0x0F, 0x10, 0x10, 0x10, 0x11, 0x11,
0x12, 0x12, 0x12, 0x13, 0x13, 0x14,
0x14, 0x14, 0x15, 0x15, 0x16, 0x16,
0x17, 0x17, 0x18, 0x18, 0x19, 0x19,
0x1A, 0x1B, 0x1B, 0x1C, 0x1C, 0x1D,
0x1E, 0x1E, 0x1F, 0x20, 0x20, 0x21,
0x22, 0x23, 0x23, 0x24, 0x25, 0x26,
0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B,
0x2C, 0x2D, 0x2E, 0x2F, 0x30, 0x31,
0x32, 0x33, 0x34, 0x35, 0x37, 0x38,
0x39, 0x3A, 0x3B, 0x3D, 0x3E, 0x3F,
0x41, 0x42, 0x44, 0x45, 0x47, 0x48,
0x4A, 0x4C, 0x4D, 0x4F, 0x51, 0x52,
0x54, 0x56, 0x58, 0x5A, 0x5C, 0x5E,
0x60, 0x62, 0x64, 0x66, 0x69, 0x6B,
0x6D, 0x70, 0x72, 0x75, 0x77, 0x7A,
0x7C, 0x7F, 0x82, 0x85, 0x88, 0x8B,
0x8E, 0x91, 0x94, 0x97, 0x9B, 0x9E,
0xA2, 0xA5, 0xA9, 0xAC, 0xB0, 0xB4,
0xB8, 0xBC, 0xC0, 0xC4, 0xC9, 0xCD,
0xD2, 0xD6, 0xDB, 0xE0, 0xE5, 0xEA,
0xEF, 0xF4, 0xF9, 0xFF};
#endif
#ifdef BRIGHT_STEP
const uint8_t stepvar[] PROGMEM =
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
0x02, 0x02, 0x03, 0x03, 0x03, 0x03,
0x03, 0x03, 0x04, 0x04, 0x04, 0x04,
0x04, 0x04, 0x05, 0x05, 0x05, 0x05,
0x06, 0x06, 0x06, 0x06, 0x07, 0x07,
0x07, 0x07, 0x08, 0x08, 0x08, 0x08,
0x09, 0x09, 0x09, 0x0A, 0x0A, 0x0A,
0x0B, 0x0B, 0x0C, 0x0C, 0x0C, 0x0D,
0x0D, 0x0E, 0x0E, 0x0E, 0x0F, 0x0F,
0x10, 0x10, 0x11, 0x11, 0x12, 0x12,
0x13, 0x13, 0x14, 0x14, 0x15, 0x16,
0x16, 0x17, 0x17, 0x18, 0x19, 0x19,
0x1A, 0x1B, 0x1B, 0x1C, 0x1D, 0x1D,
0x1E, 0x1F, 0x20, 0x20, 0x21, 0x22,
0x23, 0x23, 0x24, 0x25, 0x26, 0x27,
0x28, 0x29, 0x29, 0x2A, 0x2B, 0x2C,
0x2D, 0x2E, 0x2F, 0x30, 0x31, 0x32,
0x33, 0x34, 0x35, 0x36, 0x37, 0x38,
0x39, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F,
0x40, 0x42, 0x43, 0x44, 0x45, 0x47,
0x48, 0x49, 0x4B, 0x4C, 0x4D, 0x4F,
0x50, 0x51, 0x53, 0x54, 0x56, 0x57,
0x59, 0x5A, 0x5C, 0x5D, 0x5F, 0x60,
0x62, 0x64, 0x65, 0x67, 0x68, 0x6A,
0x6C, 0x6E, 0x6F, 0x71, 0x73, 0x75,
0x76, 0x78, 0x7A, 0x7C, 0x7E, 0x80,
0x82, 0x84, 0x85, 0x87, 0x89, 0x8B,
0x8E, 0x90, 0x92, 0x94, 0x96, 0x98,
0x9A, 0x9C, 0x9E, 0xA1, 0xA3, 0xA5,
0xA7, 0xAA, 0xAC, 0xAE, 0xB1, 0xB3,
0xB6, 0xB8, 0xBA, 0xBD, 0xBF, 0xC2,
0xC4, 0xC7, 0xCA, 0xCC, 0xCF, 0xD1,
0xD4, 0xD7, 0xD9, 0xDC, 0xDF, 0xE2,
0xE5, 0xE7, 0xEA, 0xED, 0xF0, 0xF3,
0xF6, 0xF9, 0xFC, 0xFF};
#endif
uint8_t getBright(uint8_t percent);
uint8_t getBright255(uint8_t percent);

View File

@@ -21,6 +21,7 @@ e-mail anklimov@gmail.com
//#include <DmxSimple.h> //#include <DmxSimple.h>
//#include <DMXSerial.h> //#include <DMXSerial.h>
#include "options.h" #include "options.h"
#include "item.h"
#ifdef _dmxin #ifdef _dmxin
#if defined(ARDUINO_ARCH_AVR) #if defined(ARDUINO_ARCH_AVR)
@@ -35,6 +36,13 @@ DMXESPSerial dmxout;
#endif #endif
uint8_t * DMXin = NULL; uint8_t * DMXin = NULL;
#ifdef DMX_SMOOTH
uint8_t * DMXinterimBuf = NULL;
uint16_t DMXOUT_Channels=0;
uint32_t checkTimestamp=0L;
#endif
int D_State=0; int D_State=0;
unsigned long D_checkT=0; unsigned long D_checkT=0;
@@ -61,16 +69,16 @@ int itemCtrl2(char* name,int r,int g, int b, int w)
short itemaddr = aJson.getArrayItem(itemArr,1)->valueint; short itemaddr = aJson.getArrayItem(itemArr,1)->valueint;
switch (itemtype){ switch (itemtype){
#ifdef _dmxout #ifdef _dmxout
case 0: //Dimmed light case CH_DIMMER: //Dimmed light
DmxWrite(itemaddr, w); DmxWrite(itemaddr, w);
break; break;
case 1: //Colour RGBW case CH_RGBW: //Colour RGBW
DmxWrite(itemaddr+3, w); DmxWrite(itemaddr+3, w);
case 2: // RGB case CH_RGB: // RGB
{ {
DmxWrite(itemaddr, r); DmxWrite(itemaddr, r);
@@ -79,13 +87,13 @@ int itemCtrl2(char* name,int r,int g, int b, int w)
break; } break; }
#endif #endif
case 7: //Group case CH_GROUP: //Group
aJsonObject *groupArr= aJson.getArrayItem(itemArr, 1); aJsonObject *groupArr= aJson.getArrayItem(itemArr, 1);
if (groupArr && (groupArr->type==aJson_Array)) if (groupArr && (groupArr->type==aJson_Array))
{ aJsonObject *i =groupArr->child; { aJsonObject *i =groupArr->child;
while (i) while (i)
{ //Serial.println(i->valuestring); { //Serial.println(i->valuestring);
itemCtrl2(i->valuestring,r,g,b,w); if (i->type == aJson_String) itemCtrl2(i->valuestring,r,g,b,w);
i=i->next;} i=i->next;}
} }
} //itemtype } //itemtype
@@ -100,7 +108,9 @@ void DMXImmediateUpdate(short tch,short r, short g, short b, short w) {
if (dmxArr && (dmxArr->type==aJson_Array)) if (dmxArr && (dmxArr->type==aJson_Array))
{ {
char* itemname = aJson.getArrayItem(dmxArr,tch)->valuestring; aJsonObject *DMXch = aJson.getArrayItem(dmxArr,tch);
char* itemname = NULL;
if (DMXch->type == aJson_String) itemname=DMXch->valuestring;
if (itemname) itemCtrl2(itemname,r,g,b,w); if (itemname) itemCtrl2(itemname,r,g,b,w);
} }
} }
@@ -112,7 +122,6 @@ void DMXSemiImmediateUpdate(short tch,short trh, int val)
void DMXput(void) void DMXput(void)
{ {
int t;
for (short tch=0; tch<=3 ; tch++) for (short tch=0; tch<=3 ; tch++)
{ {
short base = tch*4; short base = tch*4;
@@ -160,6 +169,7 @@ for (short tch=0; tch<=3 ; tch++)
{ {
// CHSV hsv; // CHSV hsv;
// CRGB rgb; // CRGB rgb;
DMXOUT_propagate();
#if defined(_dmxin) #if defined(_dmxin)
short t,tch; short t,tch;
@@ -191,7 +201,7 @@ for (int i=1; i<17; i++) {Serial.print(dmxin.read(i));Serial.print(";");}
void onDmxFrame(uint16_t universe, uint16_t length, uint8_t sequence, uint8_t* data, IPAddress remoteIP) void onDmxFrame(uint16_t universe, uint16_t length, uint8_t sequence, uint8_t* data, IPAddress remoteIP)
{ {
#ifdef _dmxout #ifdef _dmxout
for (int i = 0 ; i < length && i<MAX_CHANNELS ; i++) for (unsigned int i = 0 ; i < length && i<MAX_CHANNELS ; i++)
{ {
DmxWrite(i+1,data[i]); DmxWrite(i+1,data[i]);
} }
@@ -249,6 +259,39 @@ dmxout.setTxMaxChannels(channels);
#ifndef DMX_DISABLE #ifndef DMX_DISABLE
for (int i=1;i<=channels;i++) DmxWrite(i,0); for (int i=1;i<=channels;i++) DmxWrite(i,0);
#endif #endif
#ifdef DMX_SMOOTH
if (DMXinterimBuf) delete DMXinterimBuf;
DMXinterimBuf = new uint8_t [channels+1];
DMXOUT_Channels=channels;
for (int i=1;i<=channels;i++) DMXinterimBuf[i]=0;
#endif
}
void DMXOUT_propagate()
{
#ifdef DMX_SMOOTH
uint32_t now = millis();
if (now<checkTimestamp) return;
for(int i=1;i<=DMXOUT_Channels;i++)
{
uint8_t currLevel=dmxout.getTx(i);
int32_t delta = currLevel-DMXinterimBuf[i-1];
if (delta)
{
uint16_t step = abs(delta) >> 4;
if (!step) step=1;
if (delta<0)
{DmxWrite2(i,currLevel+step);}
if (delta>0)
{DmxWrite2(i,currLevel-step);}
}
}
checkTimestamp=now+DMX_SMOOTH_DELAY;
#endif
} }
void ArtnetSetup() void ArtnetSetup()
@@ -259,3 +302,12 @@ void ArtnetSetup()
if (artnet) artnet->setArtDmxCallback(onDmxFrame); if (artnet) artnet->setArtDmxCallback(onDmxFrame);
#endif #endif
} }
void DmxWriteBuf(uint16_t chan,uint8_t val)
{
#ifdef DMX_SMOOTH
if (chan && chan<=DMXOUT_Channels)
DMXinterimBuf[chan-1] = val;
#endif
}

View File

@@ -32,6 +32,35 @@ e-mail anklimov@gmail.com
#if defined(_dmxout) #if defined(_dmxout)
#if defined DMX_SMOOTH
#if defined(ARDUINO_ARCH_AVR)
#include <DmxSimple.h>
#define DmxWrite DmxSimple.write
//#define DmxWrite DmxWriteBuf
#endif
#if defined(ESP8266)
#include <ESPDMX.h>
extern DMXESPSerial dmxout;
#define DmxWrite dmxout.write
//#define DmxWrite DmxWriteBuf
#endif
#if defined(ARDUINO_ARCH_ESP32)
#include <ESPDMX.h>
extern DMXESPSerial dmxout;
#define DmxWrite dmxout.write
//#define DmxWrite DmxWriteBuf
#endif
#if defined(__SAM3X8E__)
#include <DmxDue.h>
#define DmxWrite2 dmxout.write
#define DmxWrite DmxWriteBuf
#endif
#else
#if defined(ARDUINO_ARCH_AVR) #if defined(ARDUINO_ARCH_AVR)
#include <DmxSimple.h> #include <DmxSimple.h>
#define DmxWrite DmxSimple.write #define DmxWrite DmxSimple.write
@@ -52,6 +81,8 @@ extern DMXESPSerial dmxout;
#if defined(__SAM3X8E__) #if defined(__SAM3X8E__)
#include <DmxDue.h> #include <DmxDue.h>
#define DmxWrite dmxout.write #define DmxWrite dmxout.write
#endif
#endif #endif
#endif #endif
@@ -78,3 +109,5 @@ void ArtnetSetup();
void DMXCheck(void); void DMXCheck(void);
int itemCtrl2(char* name,int r,int g, int b, int w); int itemCtrl2(char* name,int r,int g, int b, int w);
void ArtnetSetup(); void ArtnetSetup();
void DmxWriteBuf(uint16_t chan,uint8_t val);
void DMXOUT_propagate();

View File

@@ -1,38 +0,0 @@
#pragma once
const char state_P[] PROGMEM = "$state";
const char disconnected_P[] PROGMEM = "disconnected";
const char ready_P[] PROGMEM = "ready";
const char homie_P[] PROGMEM = "$homie";
const char homiever_P[] PROGMEM = "2.1.0";
const char name_P[] PROGMEM = "$name";
const char nameval_P[] PROGMEM = "LightHub ";
const char nodes_P[] PROGMEM = "$nodes";
const char localip_P[] PROGMEM = "$localip";
const char mac_P[] PROGMEM = "$mac";
const char fwname_P[] PROGMEM = "$fw/name";
const char fwversion_P[] PROGMEM = "$fw/version";
const char implementation_P[] PROGMEM = "$implementation";
const char interval_P[] PROGMEM = "$stats/interval";
const char color_P[] PROGMEM = "color";
const char datatype_P[] PROGMEM = "$datatype";
const char float_P[] PROGMEM = "float";
const char hsv_P[] PROGMEM = "hsv";
const char int_P[] PROGMEM = "integer";
const char enum_P[] PROGMEM = "enum";
const char format_P[] PROGMEM = "$format";
const char true_P[] PROGMEM = "true";
const char false_P[] PROGMEM = "false";
const char enumformat_P[] PROGMEM = "ON,OFF,HALT,REST,XON,XOFF,TOGGLE";
const char intformat_P[] PROGMEM = "0-100";
const char stats_P[] PROGMEM = "$stats";
const char statsval_P[] PROGMEM = "uptime,freeheap";
const char uptime_P[] PROGMEM = "uptime";
const char freeheap_P[] PROGMEM = "freeheap";

View File

@@ -22,6 +22,7 @@ e-mail anklimov@gmail.com
#include "item.h" #include "item.h"
#include "utils.h" #include "utils.h"
#include <PubSubClient.h> #include <PubSubClient.h>
#include "main.h"
#ifndef DHT_DISABLE #ifndef DHT_DISABLE
#if defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_ESP32) #if defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_ESP32)
@@ -31,9 +32,15 @@ e-mail anklimov@gmail.com
#endif #endif
#endif #endif
#ifdef MCP23017
#include "Adafruit_MCP23017.h"
Adafruit_MCP23017 mcp;
#endif
extern PubSubClient mqttClient; extern PubSubClient mqttClient;
extern aJsonObject *root; extern aJsonObject *root;
extern int8_t ethernetIdleCount; extern int8_t ethernetIdleCount;
extern int8_t configLocked;
#if !defined(DHT_DISABLE) || !defined(COUNTER_DISABLE) #if !defined(DHT_DISABLE) || !defined(COUNTER_DISABLE)
static volatile unsigned long nextPollMillisValue[5]; static volatile unsigned long nextPollMillisValue[5];
@@ -60,6 +67,7 @@ static short counter_irq_map[54];
#endif #endif
#endif #endif
readCache inCache;
Input::Input(char * name) //Constructor Input::Input(char * name) //Constructor
{ {
@@ -71,66 +79,148 @@ Input::Input(char * name) //Constructor
} }
Input::Input(int pin) Input::Input(aJsonObject * obj, aJsonObject * parent)
{
// TODO
}
Input::Input(aJsonObject * obj)
{ {
inputObj= obj; inputObj= obj;
Parse(); Parse(parent);
} }
boolean Input::isValid () boolean Input::isValid ()
{ {
return (pin && store); return (store);
} }
void Input::Parse()
void Input::Parse(aJsonObject * configObj)
{ {
aJsonObject *itemBuffer;
store = NULL; store = NULL;
inType = 0; inType = 0;
pin = 0; pin = 0;
if (inputObj && (inputObj->type == aJson_Object) && root) {
aJsonObject *itemBuffer; if (!inputObj || !root) return;
itemBuffer = aJson.getObjectItem(inputObj, "T"); if (!configObj) configObj = inputObj;
if (configObj->type == aJson_Object)
{
// Retreive type and pin#
itemBuffer = aJson.getObjectItem(configObj, "T");
if (itemBuffer) inType = static_cast<uint8_t>(itemBuffer->valueint); if (itemBuffer) inType = static_cast<uint8_t>(itemBuffer->valueint);
pin = static_cast<uint8_t>(atoi(inputObj->name));
itemBuffer = aJson.getObjectItem(configObj, "#");
if (itemBuffer) pin = static_cast<uint8_t>(itemBuffer->valueint);
else pin = static_cast<uint8_t>(atoi(configObj->name));
}
// Persistant storage
itemBuffer = aJson.getObjectItem(inputObj, "S"); itemBuffer = aJson.getObjectItem(inputObj, "S");
if (!itemBuffer) { if (!itemBuffer) {
debugSerial<<F("In: ")<<pin<<F("/")<<inType<<endl; debugSerial<<F("In: ")<<pin<<F("/")<<inType<<endl;
aJson.addNumberToObject(inputObj, "S", 0); aJson.addNumberToObject(inputObj, "S", (long int) 0);
itemBuffer = aJson.getObjectItem(inputObj, "S"); itemBuffer = aJson.getObjectItem(inputObj, "S");
} }
if (itemBuffer) store = (inStore *) &itemBuffer->valueint; if (itemBuffer) store = (inStore *) &itemBuffer->valueint;
}
void cleanStore(aJsonObject * input)
{
if (input->type == aJson_Object) {
// Check for nested inputs
aJsonObject * inputArray = aJson.getObjectItem(input, "act");
if (inputArray && (inputArray->type == aJson_Array))
{
aJsonObject *inputObj = inputArray->child;
while(inputObj)
{
Input in(inputObj,input);
in.store->aslong = 0;
yield();
inputObj = inputObj->next;
} }
}
else
{
Input in(input);
in.Poll(CHECK_INPUT);
}
}
} }
void Input::setup() void Input::setup()
{ {
if (!isValid() || (!root)) return; if (!isValid() || (!root)) return;
cleanStore(inputObj);
#ifndef CSSHDC_DISABLE store->aslong=0;
if (inType == IN_CCS811) uint8_t inputPinMode = INPUT; //if IN_ACTIVE_HIGH
switch (inType)
{
case IN_PUSH_ON:
case IN_PUSH_TOGGLE :
inputPinMode = INPUT_PULLUP;
case IN_PUSH_ON | IN_ACTIVE_HIGH:
case IN_PUSH_TOGGLE | IN_ACTIVE_HIGH:
pinMode(pin, inputPinMode);
store->state=IS_IDLE;
break;
#ifdef MCP23017
case IN_I2C | IN_PUSH_ON:
case IN_I2C | IN_PUSH_TOGGLE :
inputPinMode = INPUT_PULLUP;
case IN_I2C | IN_PUSH_ON | IN_ACTIVE_HIGH:
case IN_I2C | IN_PUSH_TOGGLE | IN_ACTIVE_HIGH:
mcp.begin(); //TBD - multiple chip
mcp.pinMode(pin, INPUT);
if (inputPinMode == INPUT_PULLUP) mcp.pullUp(0, HIGH); // turn on a 100K pullup internally
store->state=IS_IDLE;
break;
#endif
case IN_ANALOG:
inputPinMode = INPUT_PULLUP;
case IN_ANALOG | IN_ACTIVE_HIGH:
pinMode(pin, inputPinMode);
break;
case IN_DHT22:
case IN_COUNTER:
case IN_UPTIME:
break;
#ifndef CSSHDC_DISABLE
case IN_CCS811:
{ {
in_ccs811 ccs811(this); in_ccs811 ccs811(this);
ccs811.Setup(pin); ccs811.Setup();
} }
else if (inType == IN_HDC1080) break;
case IN_HDC1080:
{ {
in_hdc1080 hdc1080(this); in_hdc1080 hdc1080(this);
hdc1080.Setup(pin); hdc1080.Setup();
} }
// TODO rest types setup break;
#endif #endif
} //switch
} }
int Input::poll(short cause) { int Input::Poll(short cause) {
if (!isValid()) return -1; if (!isValid()) return -1;
#ifndef CSSHDC_DISABLE #ifndef CSSHDC_DISABLE
@@ -140,17 +230,22 @@ if (!isValid()) return -1;
switch (cause) { switch (cause) {
case CHECK_INPUT: //Fast polling case CHECK_INPUT: //Fast polling
case CHECK_INTERRUPT: //Realtime polling
switch (inType) switch (inType)
{ {
case IN_PUSH_ON: case IN_PUSH_ON:
case IN_PUSH_ON | IN_ACTIVE_HIGH: case IN_PUSH_ON | IN_ACTIVE_HIGH:
case IN_PUSH_TOGGLE : case IN_PUSH_TOGGLE :
case IN_PUSH_TOGGLE | IN_ACTIVE_HIGH: case IN_PUSH_TOGGLE | IN_ACTIVE_HIGH:
contactPoll(); case IN_I2C | IN_PUSH_ON:
case IN_I2C | IN_PUSH_ON | IN_ACTIVE_HIGH:
case IN_I2C | IN_PUSH_TOGGLE :
case IN_I2C | IN_PUSH_TOGGLE | IN_ACTIVE_HIGH:
contactPoll(cause);
break; break;
case IN_ANALOG: case IN_ANALOG:
case IN_ANALOG | IN_ACTIVE_HIGH: case IN_ANALOG | IN_ACTIVE_HIGH:
analogPoll(); analogPoll(cause);
break; break;
// No fast polling // No fast polling
@@ -167,10 +262,10 @@ switch (cause) {
{ {
#ifndef CSSHDC_DISABLE #ifndef CSSHDC_DISABLE
case IN_CCS811: case IN_CCS811:
_ccs811.Poll(); _ccs811.Poll(POLLING_SLOW);
break; break;
case IN_HDC1080: case IN_HDC1080:
_hdc1080.Poll(); _hdc1080.Poll(POLLING_SLOW);
break; break;
#endif #endif
#ifndef DHT_DISABLE #ifndef DHT_DISABLE
@@ -188,6 +283,7 @@ switch (cause) {
#endif #endif
} }
} }
return 0;
} }
#ifndef COUNTER_DISABLE #ifndef COUNTER_DISABLE
@@ -221,16 +317,16 @@ void Input::counterPoll() {
debugSerial<<F("IN:")<<(pin)<<F(" Counter type. val=")<<counterValue; debugSerial<<F("IN:")<<(pin)<<F(" Counter type. val=")<<counterValue;
aJsonObject *emit = aJson.getObjectItem(inputObj, "emit"); aJsonObject *emit = aJson.getObjectItem(inputObj, "emit");
if (emit) { if (emit && emit->type == aJson_String) {
char valstr[10]; char valstr[10];
char addrstr[MQTT_TOPIC_LENGTH]; char addrstr[MQTT_TOPIC_LENGTH];
strncpy(addrstr,emit->valuestring,sizeof(addrstr)); strncpy(addrstr,emit->valuestring,sizeof(addrstr));
if (!strchr(addrstr,'/')) setTopic(addrstr,sizeof(addrstr),T_OUT,emit->valuestring); if (!strchr(addrstr,'/')) setTopic(addrstr,sizeof(addrstr),T_OUT,emit->valuestring);
sprintf(valstr, "%d", counterValue); sprintf(valstr, "%ld", counterValue);
if (mqttClient.connected() && !ethernetIdleCount) if (mqttClient.connected() && !ethernetIdleCount)
mqttClient.publish(addrstr, valstr); mqttClient.publish(addrstr, valstr);
setNextPollTime(millis() + DHT_POLL_DELAY_DEFAULT); setNextPollTime(millis() + DHT_POLL_DELAY_DEFAULT);
debugSerial<<F(" NextPollMillis=")<<nextPollTime(); // debugSerial<<F(" NextPollMillis=")<<nextPollTime();
} }
else else
debugSerial<<F(" No emit data!"); debugSerial<<F(" No emit data!");
@@ -280,7 +376,7 @@ void Input::uptimePoll() {
if (nextPollTime() > millis()) if (nextPollTime() > millis())
return; return;
aJsonObject *emit = aJson.getObjectItem(inputObj, "emit"); aJsonObject *emit = aJson.getObjectItem(inputObj, "emit");
if (emit) { if (emit && emit->type == aJson_String) {
#ifdef WITH_DOMOTICZ #ifdef WITH_DOMOTICZ
if(getIdxField()){ if(getIdxField()){
publishDataToDomoticz(DHT_POLL_DELAY_DEFAULT, emit, "{\"idx\":%s,\"svalue\":\"%d\"}", getIdxField(), millis()); publishDataToDomoticz(DHT_POLL_DELAY_DEFAULT, emit, "{\"idx\":%s,\"svalue\":\"%d\"}", getIdxField(), millis());
@@ -375,9 +471,9 @@ void Input::dht22Poll() {
#endif #endif
aJsonObject *emit = aJson.getObjectItem(inputObj, "emit"); aJsonObject *emit = aJson.getObjectItem(inputObj, "emit");
aJsonObject *item = aJson.getObjectItem(inputObj, "item"); aJsonObject *item = aJson.getObjectItem(inputObj, "item");
if (item) thermoSetCurTemp(item->valuestring, temp); if (item && item->type == aJson_String) thermoSetCurTemp(item->valuestring, temp);
debugSerial << F("IN:") << pin << F(" DHT22 type. T=") << temp << F("°C H=") << humidity << F("%")<<endl; debugSerial << F("IN:") << pin << F(" DHT22 type. T=") << temp << F("°C H=") << humidity << F("%")<<endl;
if (emit && temp && humidity && temp == temp && humidity == humidity) { if (emit && emit->type == aJson_String && temp && humidity && temp == temp && humidity == humidity) {
char addrstr[MQTT_TOPIC_LENGTH] = ""; char addrstr[MQTT_TOPIC_LENGTH] = "";
#ifdef WITH_DOMOTICZ #ifdef WITH_DOMOTICZ
if(getIdxField()){ if(getIdxField()){
@@ -399,97 +495,457 @@ void Input::dht22Poll() {
mqttClient.publish(addrstr, valstr); mqttClient.publish(addrstr, valstr);
setNextPollTime(millis() + DHT_POLL_DELAY_DEFAULT); setNextPollTime(millis() + DHT_POLL_DELAY_DEFAULT);
debugSerial << F(" NextPollMillis=") << nextPollTime() << endl; // debugSerial << F(" NextPollMillis=") << nextPollTime() << endl;
} else } else
setNextPollTime(millis() + DHT_POLL_DELAY_DEFAULT / 3); setNextPollTime(millis() + DHT_POLL_DELAY_DEFAULT / 3);
} }
#endif #endif
void Input::contactPoll() {
boolean currentInputState;
/* /*
#if defined(ARDUINO_ARCH_STM32) bool Input::executeCommand(aJsonObject* cmd, int8_t toggle, char* defCmd)
WiringPinMode inputPinMode; {
#endif if (!cmd) return false;
#if defined(__SAM3X8E__)||defined(ARDUINO_ARCH_AVR)||defined(ARDUINO_ARCH_ESP8266)||defined(ARDUINO_ARCH_ESP32) switch (cmd->type)
{
#endif case aJson_String: //legacy - no action
*/ break;
uint32_t inputPinMode; case aJson_Array: //array - recursive iterate
uint8_t inputOnLevel; {
if (inType & IN_ACTIVE_HIGH) { configLocked++;
inputOnLevel = HIGH; aJsonObject * command = cmd->child;
inputPinMode = INPUT; while (command)
} else { {
inputOnLevel = LOW; executeCommand(command,toggle,defCmd);
inputPinMode = INPUT_PULLUP; command = command->next;
} }
pinMode(pin, inputPinMode); configLocked--;
currentInputState = (digitalRead(pin) == inputOnLevel); }
if (currentInputState != store->currentValue) // value changed break;
case aJson_Object:
{
aJsonObject *item = aJson.getObjectItem(cmd, "item");
aJsonObject *icmd = aJson.getObjectItem(cmd, "icmd");
aJsonObject *irev = aJson.getObjectItem(cmd, "irev");
aJsonObject *ecmd = aJson.getObjectItem(cmd, "ecmd");
aJsonObject *erev = aJson.getObjectItem(cmd, "erev");
aJsonObject *emit = aJson.getObjectItem(cmd, "emit");
char * itemCommand;
if (irev && toggle && irev->type == aJson_String) itemCommand = irev->valuestring;
else if(icmd && icmd->type == aJson_String) itemCommand = icmd->valuestring;
else itemCommand = defCmd;
char * emitCommand;
if (erev && toggle && erev->type == aJson_String) emitCommand = erev->valuestring;
else if(ecmd && ecmd->type == aJson_String) emitCommand = ecmd->valuestring;
else emitCommand = defCmd;
debugSerial << F("IN:") << (pin) << F(" : ") <<endl;
if (item) debugSerial << item->valuestring<< F(" -> ")<<itemCommand<<endl;
if (emit) debugSerial << emit->valuestring<< F(" -> ")<<emitCommand<<endl;
if (emit && emitCommand && emit->type == aJson_String) {
// *
TODO implement
#ifdef WITH_DOMOTICZ
if (getIdxField())
{ (newValue) ? publishDataToDomoticz(0, emit, "{\"command\":\"switchlight\",\"idx\":%s,\"switchcmd\":\"On\"}",
: publishDataToDomoticz(0,emit,"{\"command\":\"switchlight\",\"idx\":%s,\"switchcmd\":\"Off\"}",getIdxField()); getIdxField())
: publishDataToDomoticz(0, emit,
"{\"command\":\"switchlight\",\"idx\":%s,\"switchcmd\":\"Off\"}",
getIdxField());
} else
#endif
* //
{
char addrstr[MQTT_TOPIC_LENGTH];
strncpy(addrstr,emit->valuestring,sizeof(addrstr));
if (mqttClient.connected() && !ethernetIdleCount)
{
if (!strchr(addrstr,'/')) setTopic(addrstr,sizeof(addrstr),T_OUT,emit->valuestring);
mqttClient.publish(addrstr, emitCommand , true);
}
}
} // emit
if (item && itemCommand && item->type == aJson_String) {
//debugSerial <<F("Controlled item:")<< item->valuestring <<endl;
Item it(item->valuestring);
if (it.isValid()) it.Ctrl(itemCommand, true);
}
return true;
}
default:
return false;
} //switch type
return false;
}
*/
// TODO Polling via timed interrupt with CHECK_INTERRUPT cause
bool Input::changeState(uint8_t newState, short cause)
{
if (!inputObj || !store) return false;
if (newState == IS_REQSTATE)
if (store->delayedState && cause != CHECK_INTERRUPT)
{
// Requested delayed change State and safe moment
newState=store->reqState; //Retrieve requested state
debugSerial<<F("Pended state retrieved:")<<newState;
}
else return true; // No pended State
else if (store->delayedState)
return false; //State changing is postponed already (( giving up
aJsonObject *cmd = NULL;
int8_t toggle=0;
if (newState!=store->state) debugSerial<<F("#")<<pin<<F(" ")<<store->state<<F("->") <<newState<<endl;
switch (newState)
{
case IS_IDLE:
switch (store->state)
{
case IS_RELEASED: //click
cmd = aJson.getObjectItem(inputObj, "click");
toggle=store->toggle1;
break;
case IS_RELEASED2: //doubleclick
cmd = aJson.getObjectItem(inputObj, "dclick");
toggle=store->toggle2;
break;
case IS_PRESSED3: //tripple click
cmd = aJson.getObjectItem(inputObj, "tclick");
toggle=store->toggle3;
break;
case IS_WAITPRESS: //do nothing
break;
default: //rcmd
cmd = aJson.getObjectItem(inputObj, "rcmd");
;
}
break;
case IS_PRESSED: //scmd
cmd = aJson.getObjectItem(inputObj, "scmd");
toggle=store->toggle1;
store->toggle1 = !store->toggle1;
break;
case IS_PRESSED2: //scmd2
cmd = aJson.getObjectItem(inputObj, "scmd2");
toggle=store->toggle2;
store->toggle2 = !store->toggle2;
break;
case IS_PRESSED3: //scmd3
cmd = aJson.getObjectItem(inputObj, "scmd3");
toggle=store->toggle3;
store->toggle3 = !store->toggle3;
break;
case IS_RELEASED: //rcmd
case IS_WAITPRESS:
case IS_RELEASED2:
cmd = aJson.getObjectItem(inputObj, "rcmd");
// toggle=state->toggle1;
break;
case IS_LONG: //lcmd
cmd = aJson.getObjectItem(inputObj, "lcmd");
toggle=store->toggle1;
break;
case IS_REPEAT: //rpcmd
cmd = aJson.getObjectItem(inputObj, "rpcmd");
toggle=store->toggle1;
break;
case IS_LONG2: //lcmd2
cmd = aJson.getObjectItem(inputObj, "lcmd2");
toggle=store->toggle2;
break;
case IS_REPEAT2: //rpcmd2
cmd = aJson.getObjectItem(inputObj, "rpcmd2");
toggle=store->toggle2;
break;
case IS_LONG3: //lcmd3
cmd = aJson.getObjectItem(inputObj, "lcmd3");
toggle=store->toggle3;
break;
case IS_REPEAT3: //rpcmd3
cmd = aJson.getObjectItem(inputObj, "rpcmd3");
toggle=store->toggle3;
break;
}
if (!cmd)
{
store->state=newState;
return true; //nothing to do
}
if (cause != CHECK_INTERRUPT)
{
store->state=newState;
executeCommand(cmd,toggle);
//Executed
store->delayedState=false;
return true;
}
else
{
//Postpone actual execution
store->reqState=store->state;
store->delayedState=true;
return true;
}
}
void Input::contactPoll(short cause) {
boolean currentInputState;
if (!store) return;
changeState(IS_REQSTATE,cause); //Check for postponed states transitions
uint8_t inputOnLevel;
aJsonObject * mapObj;
if (inType & IN_ACTIVE_HIGH) inputOnLevel = HIGH;
else inputOnLevel = LOW;
#ifdef MCP23017
if (inType & IN_I2C)
currentInputState = (inCache.I2CReadBit(IN_I2C,0,pin) == inputOnLevel);
else
#endif
if (isAnalogPin(pin) && (mapObj=aJson.getObjectItem(inputObj, "map")) && mapObj->type == aJson_Array)
{
int value = inCache.analogReadCached(pin);
if (value >= aJson.getArrayItem(mapObj, 0)->valueint && value <= aJson.getArrayItem(mapObj, 1)->valueint)
currentInputState = true;
else currentInputState = false;
}
else currentInputState = (digitalRead(pin) == inputOnLevel);
switch (store->state) //Timer based transitions
{
case IS_PRESSED:
if (isTimeOver(store->timestamp16,millis() & 0xFFFF,T_LONG,0xFFFF))
{
if (!aJson.getObjectItem(inputObj, "lcmd") && !aJson.getObjectItem(inputObj, "rpcmd")) changeState(IS_WAITRELEASE, cause);
else changeState(IS_LONG, cause);
}
break;
case IS_LONG:
if (isTimeOver(store->timestamp16,millis() & 0xFFFF,T_RPT,0xFFFF))
{
changeState(IS_REPEAT, cause);
store->timestamp16 = millis() & 0xFFFF;
}
break;
case IS_REPEAT:
if (isTimeOver(store->timestamp16,millis() & 0xFFFF,T_RPT_PULSE,0xFFFF))
{
changeState(IS_REPEAT, cause);
store->timestamp16 = millis() & 0xFFFF;
}
break;
case IS_PRESSED2:
if (isTimeOver(store->timestamp16,millis() & 0xFFFF,T_LONG,0xFFFF))
{
if (!aJson.getObjectItem(inputObj, "lcmd2") && !aJson.getObjectItem(inputObj, "rpcmd2")) changeState(IS_WAITRELEASE, cause);
else changeState(IS_LONG2, cause);
}
break;
case IS_LONG2:
if (isTimeOver(store->timestamp16,millis() & 0xFFFF,T_RPT,0xFFFF))
{
changeState(IS_REPEAT2, cause);
store->timestamp16 = millis() & 0xFFFF;
}
break;
case IS_REPEAT2:
if (isTimeOver(store->timestamp16,millis() & 0xFFFF,T_RPT_PULSE,0xFFFF))
{
changeState(IS_REPEAT2, cause);
store->timestamp16 = millis() & 0xFFFF;
}
break;
case IS_PRESSED3:
if (isTimeOver(store->timestamp16,millis() & 0xFFFF,T_LONG,0xFFFF))
{
if (!aJson.getObjectItem(inputObj, "lcmd3") && !aJson.getObjectItem(inputObj, "rpcmd3")) //No longpress handlers
{
if (aJson.getObjectItem(inputObj, "scmd3")) changeState(IS_WAITRELEASE, cause); //was used
else changeState(IS_PRESSED2, cause); // completely empty trippleClick section - fallback to first click handler
}
else changeState(IS_LONG3, cause);
}
break;
case IS_LONG3:
if (isTimeOver(store->timestamp16,millis() & 0xFFFF,T_RPT,0xFFFF))
{
changeState(IS_REPEAT3, cause);
store->timestamp16 = millis() & 0xFFFF;
}
break;
case IS_REPEAT3:
if (isTimeOver(store->timestamp16,millis() & 0xFFFF,T_RPT_PULSE,0xFFFF))
{
changeState(IS_REPEAT3, cause);
store->timestamp16 = millis() & 0xFFFF;
}
break;
case IS_RELEASED:
case IS_RELEASED2:
case IS_WAITPRESS:
if (isTimeOver(store->timestamp16,millis() & 0xFFFF,T_IDLE,0xFFFF)) changeState(IS_IDLE, cause);
break;
}
if (currentInputState != store->lastValue) // value changed
{ {
if (store->bounce) store->bounce = store->bounce - 1; if (store->bounce) store->bounce = store->bounce - 1;
else //confirmed change else //confirmed change
{ {
if (inType & IN_PUSH_TOGGLE) { store->timestamp16 = millis() & 0xFFFF; //Saving timestamp of changing
if (inType & IN_PUSH_TOGGLE) { //To refactore
if (currentInputState) { //react on leading edge only (change from 0 to 1) if (currentInputState) { //react on leading edge only (change from 0 to 1)
store->logicState = !store->logicState; //store->logicState = !store->logicState;
onContactChanged(store->logicState); store->lastValue = currentInputState;
onContactChanged(store->toggle1);
} }
} else { } else
store->logicState = currentInputState;
onContactChanged(currentInputState); {
onContactChanged(currentInputState); //Legacy input - to remove later
bool res = true;
if (currentInputState) //Button pressed state transitions
switch (store->state)
{
case IS_IDLE:
res = changeState(IS_PRESSED, cause);
break;
case IS_RELEASED:
case IS_WAITPRESS:
res = changeState(IS_PRESSED2, cause);
break;
case IS_RELEASED2:
res = changeState(IS_PRESSED3, cause);
break;
} }
store->currentValue = currentInputState; else
switch (store->state) //Button released state transitions
{
case IS_PRESSED:
res = changeState(IS_RELEASED, cause);
break;
case IS_LONG:
case IS_REPEAT:
case IS_WAITRELEASE:
res = changeState(IS_WAITPRESS, cause);
break;
case IS_PRESSED2:
res = changeState(IS_RELEASED2, cause);
break;
case IS_LONG2:
case IS_REPEAT2:
case IS_LONG3:
case IS_REPEAT3:
case IS_PRESSED3:
res = changeState(IS_IDLE, cause);
break;
}
if (res) { //State changed or postponed
// store->logicState = currentInputState;
store->lastValue = currentInputState;
}
}
// store->currentValue = currentInputState;
} }
} else // no change } else // no change
store->bounce = SAME_STATE_ATTEMPTS; store->bounce = SAME_STATE_ATTEMPTS;
} }
void Input::analogPoll() {
int16_t mappedInputVal; void Input::analogPoll(short cause) {
int16_t inputVal;
int32_t mappedInputVal; // 10x inputVal
aJsonObject *inputMap = aJson.getObjectItem(inputObj, "map"); aJsonObject *inputMap = aJson.getObjectItem(inputObj, "map");
short Noize = ANALOG_NOIZE; int16_t Noize = ANALOG_NOIZE;
short simple = 0; short simple = 0;
// uint32_t inputPinMode;
int max=1024*10;
int min=0;
/* /*
#if defined(ARDUINO_ARCH_STM32)
WiringPinMode inputPinMode;
#endif
#if defined(__SAM3X8E__)||defined(ARDUINO_ARCH_AVR)||defined(ARDUINO_ARCH_ESP8266)||defined(ARDUINO_ARCH_ESP32)
#endif */
uint32_t inputPinMode;
if (inType & IN_ACTIVE_HIGH) { if (inType & IN_ACTIVE_HIGH) {
inputPinMode = INPUT; inputPinMode = INPUT;
} else { } else {
inputPinMode = INPUT_PULLUP; inputPinMode = INPUT_PULLUP;
} }
pinMode(pin, inputPinMode); pinMode(pin, inputPinMode);
mappedInputVal = analogRead(pin); */
inputVal = inCache.analogReadCached(pin);
// Mapping // Mapping
if (inputMap && inputMap->type == aJson_Array) if (inputMap && inputMap->type == aJson_Array)
{ {
int max=1024;
if (aJson.getArraySize(inputMap)>=4) if (aJson.getArraySize(inputMap)>=4)
mappedInputVal = map (mappedInputVal, mappedInputVal = map (inputVal,
aJson.getArrayItem(inputMap, 0)->valueint, aJson.getArrayItem(inputMap, 0)->valueint,
aJson.getArrayItem(inputMap, 1)->valueint, aJson.getArrayItem(inputMap, 1)->valueint,
aJson.getArrayItem(inputMap, 2)->valueint, min=aJson.getArrayItem(inputMap, 2)->valueint*10,
max=aJson.getArrayItem(inputMap, 3)->valueint); max=aJson.getArrayItem(inputMap, 3)->valueint*10);
else mappedInputVal = inputVal*10;
if (aJson.getArraySize(inputMap)==5) Noize = aJson.getArrayItem(inputMap, 4)->valueint; if (aJson.getArraySize(inputMap)==5) Noize = aJson.getArrayItem(inputMap, 4)->valueint;
if (mappedInputVal>max) mappedInputVal=max;
if (mappedInputVal>max)
{
mappedInputVal = max;
inputVal = 1023;
}
if (mappedInputVal<min) {
mappedInputVal = min;
inputVal = 0;
}
if (aJson.getArraySize(inputMap)==2) if (aJson.getArraySize(inputMap)==2)
{ {
simple = 1; simple = 1;
if (mappedInputVal < aJson.getArrayItem(inputMap, 0)->valueint) mappedInputVal = 0; if (inputVal < aJson.getArrayItem(inputMap, 0)->valueint) mappedInputVal = 0;
else if (mappedInputVal > aJson.getArrayItem(inputMap, 1)->valueint) mappedInputVal = 1; else if (inputVal > aJson.getArrayItem(inputMap, 1)->valueint) mappedInputVal = 1;
else return; else return;
} }
} } else mappedInputVal = inputVal*10; //No mapping arguments
if (simple) { if (simple) {
if (mappedInputVal != store->currentValue) if (mappedInputVal != store->currentValue)
{ {
@@ -497,29 +953,34 @@ void Input::analogPoll() {
store->currentValue = mappedInputVal; store->currentValue = mappedInputVal;
}} }}
else else
if (abs(mappedInputVal - store->currentValue)>Noize) // value changed >ANALOG_NOIZE {
//if (abs(mappedInputVal - store->currentValue)>Noize || mappedInputVal == min || mappedInputVal ==max) // value changed >ANALOG_NOIZE
if (abs(inputVal - store->currentValue)>Noize ) // value changed >ANALOG_NOIZE
store->bounce = 0; store->bounce = 0;
else // no change else // no change
if (store->bounce<ANALOG_STATE_ATTEMPTS) store->bounce ++; if (store->bounce<ANALOG_STATE_ATTEMPTS) store->bounce ++;
if (store->bounce<ANALOG_STATE_ATTEMPTS-1 && (mappedInputVal != store->currentValue)) //confirmed change if ((store->bounce<ANALOG_STATE_ATTEMPTS-1 || mappedInputVal == min || mappedInputVal ==max )&& (inputVal != store->currentValue))//confirmed change
{ {
onAnalogChanged(mappedInputVal); onAnalogChanged(mappedInputVal/10.);
store->currentValue = mappedInputVal; // store->currentValue = mappedInputVal;
store->currentValue = inputVal;
}
} }
} }
void Input::onContactChanged(int newValue) { void Input::onContactChanged(int newValue) {
debugSerial << F("IN:") << (pin) << F("=") << newValue << endl;
aJsonObject *item = aJson.getObjectItem(inputObj, "item"); aJsonObject *item = aJson.getObjectItem(inputObj, "item");
aJsonObject *emit = aJson.getObjectItem(inputObj, "emit");
if (!item && !emit) return;
aJsonObject *scmd = aJson.getObjectItem(inputObj, "scmd"); aJsonObject *scmd = aJson.getObjectItem(inputObj, "scmd");
aJsonObject *rcmd = aJson.getObjectItem(inputObj, "rcmd"); aJsonObject *rcmd = aJson.getObjectItem(inputObj, "rcmd");
aJsonObject *emit = aJson.getObjectItem(inputObj, "emit"); debugSerial << F("LEGACY IN:") << (pin) << F("=") << newValue << endl;
if (emit) { if (emit && emit->type == aJson_String) {
#ifdef WITH_DOMOTICZ #ifdef WITH_DOMOTICZ
if (getIdxField()) if (getIdxField())
{ (newValue) ? publishDataToDomoticz(0, emit, "{\"command\":\"switchlight\",\"idx\":%s,\"switchcmd\":\"On\"}", { (newValue) ? publishDataToDomoticz(0, emit, "{\"command\":\"switchlight\",\"idx\":%s,\"switchcmd\":\"On\"}",
@@ -536,40 +997,40 @@ if (mqttClient.connected() && !ethernetIdleCount)
{ {
if (!strchr(addrstr,'/')) setTopic(addrstr,sizeof(addrstr),T_OUT,emit->valuestring); if (!strchr(addrstr,'/')) setTopic(addrstr,sizeof(addrstr),T_OUT,emit->valuestring);
if (newValue) { //send set command if (newValue) { //send set command
if (!scmd) mqttClient.publish(addrstr, "ON", true); if (!scmd || scmd->type != aJson_String) mqttClient.publish(addrstr, "ON", true);
else if (strlen(scmd->valuestring)) else if (strlen(scmd->valuestring))
mqttClient.publish(addrstr, scmd->valuestring, true); mqttClient.publish(addrstr, scmd->valuestring, true);
} else { //send reset command } else { //send reset command
if (!rcmd) mqttClient.publish(addrstr, "OFF", true); if (!rcmd || rcmd->type != aJson_String) mqttClient.publish(addrstr, "OFF", true);
else if (strlen(rcmd->valuestring))mqttClient.publish(addrstr, rcmd->valuestring, true); else if (strlen(rcmd->valuestring))mqttClient.publish(addrstr, rcmd->valuestring, true);
} }
} }
} }
} // emit } // emit
if (item) { if (item && item->type == aJson_String) {
//debugSerial <<F("Controlled item:")<< item->valuestring <<endl; //debugSerial <<F("Controlled item:")<< item->valuestring <<endl;
Item it(item->valuestring); Item it(item->valuestring);
if (it.isValid()) { if (it.isValid()) {
if (newValue) { //send set command if (newValue) { //send set command
if (!scmd) it.Ctrl(CMD_ON, 0, NULL, true); if (!scmd || scmd->type != aJson_String) it.Ctrl(CMD_ON, 0, NULL);
else if (strlen(scmd->valuestring)) else if (strlen(scmd->valuestring))
it.Ctrl(scmd->valuestring, true); it.Ctrl(scmd->valuestring);
} else { //send reset command } else { //send reset command
if (!rcmd) it.Ctrl(CMD_OFF, 0, NULL, true); if (!rcmd || rcmd->type != aJson_String) it.Ctrl(CMD_OFF, 0, NULL);
else if (strlen(rcmd->valuestring)) else if (strlen(rcmd->valuestring))
it.Ctrl(rcmd->valuestring, true); it.Ctrl(rcmd->valuestring);
} }
} }
} }
} }
void Input::onAnalogChanged(int newValue) { void Input::onAnalogChanged(float newValue) {
debugSerial << F("IN:") << (pin) << F("=") << newValue << endl; debugSerial << F("IN:") << (pin) << F("=") << newValue << endl;
aJsonObject *item = aJson.getObjectItem(inputObj, "item"); aJsonObject *item = aJson.getObjectItem(inputObj, "item");
aJsonObject *emit = aJson.getObjectItem(inputObj, "emit"); aJsonObject *emit = aJson.getObjectItem(inputObj, "emit");
if (emit) { if (emit && emit->type == aJson_String) {
//#ifdef WITH_DOMOTICZ //#ifdef WITH_DOMOTICZ
// if (getIdxField()) { // if (getIdxField()) {
@@ -581,15 +1042,17 @@ void Input::onAnalogChanged(int newValue) {
strncpy(addrstr,emit->valuestring,sizeof(addrstr)); strncpy(addrstr,emit->valuestring,sizeof(addrstr));
if (!strchr(addrstr,'/')) setTopic(addrstr,sizeof(addrstr),T_OUT,emit->valuestring); if (!strchr(addrstr,'/')) setTopic(addrstr,sizeof(addrstr),T_OUT,emit->valuestring);
char strVal[16]; char strVal[16];
itoa(newValue,strVal,10); //itoa(newValue,strVal,10);
printFloatValueToStr(newValue, strVal);
if (mqttClient.connected() && !ethernetIdleCount) if (mqttClient.connected() && !ethernetIdleCount)
mqttClient.publish(addrstr, strVal, true); mqttClient.publish(addrstr, strVal, true);
} }
if (item) { if (item && item->type == aJson_String) {
int intNewValue = round(newValue);
Item it(item->valuestring); Item it(item->valuestring);
if (it.isValid()) { if (it.isValid()) {
it.Ctrl(0, 1, &newValue, true); it.Ctrl(0, 1, &intNewValue, true);
} }
} }
} }
@@ -598,6 +1061,8 @@ void Input::onAnalogChanged(int newValue) {
bool Input::publishDataToDomoticz(int pollTimeIncrement, aJsonObject *emit, const char *format, ...) bool Input::publishDataToDomoticz(int pollTimeIncrement, aJsonObject *emit, const char *format, ...)
{ {
#ifdef WITH_DOMOTICZ #ifdef WITH_DOMOTICZ
if (emit && emit->type == aJson_String)
{
debugSerial << F("\nDomoticz valstr:"); debugSerial << F("\nDomoticz valstr:");
char valstr[50]; char valstr[50];
va_list args; va_list args;
@@ -609,7 +1074,8 @@ bool Input::publishDataToDomoticz(int pollTimeIncrement, aJsonObject *emit, cons
mqttClient.publish(emit->valuestring, valstr); mqttClient.publish(emit->valuestring, valstr);
if (pollTimeIncrement) if (pollTimeIncrement)
setNextPollTime(millis() + pollTimeIncrement); setNextPollTime(millis() + pollTimeIncrement);
debugSerial << F(" NextPollMillis=") << nextPollTime() << endl; // debugSerial << F(" NextPollMillis=") << nextPollTime() << endl;
}
#endif #endif
return true; return true;
@@ -617,7 +1083,48 @@ bool Input::publishDataToDomoticz(int pollTimeIncrement, aJsonObject *emit, cons
char* Input::getIdxField() { char* Input::getIdxField() {
aJsonObject *idx = aJson.getObjectItem(inputObj, "idx"); aJsonObject *idx = aJson.getObjectItem(inputObj, "idx");
if(idx&&idx->valuestring) if(idx&& idx->type == aJson_String && idx->valuestring)
return idx->valuestring; return idx->valuestring;
return nullptr; return nullptr;
} }
readCache::readCache()
{
addr=0;
type=0;
}
uint16_t readCache::analogReadCached (uint8_t _pin)
{
if ((_pin==addr) && (IN_ANALOG==type)) return cached_data;
addr = _pin;
type = IN_ANALOG;
cached_data =analogRead(_pin);
return cached_data;
}
uint8_t readCache::digitalReadCached(uint8_t _pin)
{
///TBD
}
#ifdef MCP23017
uint8_t readCache::I2CReadBit(uint8_t _type, uint8_t _addr, uint8_t _pin)
{
if (addr!=_addr || type != _type)
{
type=_type;
addr=_addr;
cached_data = mcp.readGPIOAB();
}
return (cached_data >> _pin ) & 0x1;
}
#endif
void readCache::invalidateInputCache()
{
addr=0;
type=0;
}

View File

@@ -24,6 +24,7 @@ e-mail anklimov@gmail.com
#define IN_ACTIVE_HIGH 2 // High level = PUSHED/ CLOSED/ ON othervise :Low Level. Use INPUT mode instead of INPUT_PULLUP for digital pin #define IN_ACTIVE_HIGH 2 // High level = PUSHED/ CLOSED/ ON othervise :Low Level. Use INPUT mode instead of INPUT_PULLUP for digital pin
#define IN_ANALOG 64 // Analog input #define IN_ANALOG 64 // Analog input
#define IN_RE 32 // Rotary Encoder (for further use) #define IN_RE 32 // Rotary Encoder (for further use)
#define IN_I2C 128 // MCP23017
#define IN_PUSH_ON 0 // PUSH - ON, Release - OFF (ovverrided by pcmd/rcmd) - DEFAULT #define IN_PUSH_ON 0 // PUSH - ON, Release - OFF (ovverrided by pcmd/rcmd) - DEFAULT
#define IN_PUSH_TOGGLE 1 // Used for push buttons. Every physicall push toggle logical switch on/off. Toggle on leading edge #define IN_PUSH_TOGGLE 1 // Used for push buttons. Every physicall push toggle logical switch on/off. Toggle on leading edge
@@ -35,13 +36,39 @@ e-mail anklimov@gmail.com
#define IN_COUNTER 8 #define IN_COUNTER 8
#define IN_UPTIME 16 #define IN_UPTIME 16
#define IS_IDLE 0
#define IS_PRESSED 1
#define IS_RELEASED 2
#define IS_LONG 3
#define IS_REPEAT 4
#define IS_WAITPRESS 5
#define IS_PRESSED2 6
#define IS_RELEASED2 7
#define IS_LONG2 8u
#define IS_REPEAT2 9u
#define IS_PRESSED3 10u
#define IS_LONG3 11u
#define IS_REPEAT3 12u
#define IS_WAITRELEASE 13u
#define IS_REQSTATE 0xFF
#define SAME_STATE_ATTEMPTS 3 #define SAME_STATE_ATTEMPTS 3
#define ANALOG_STATE_ATTEMPTS 6 #define ANALOG_STATE_ATTEMPTS 6
#define ANALOG_NOIZE 1 #define ANALOG_NOIZE 1
#define CHECK_INPUT 1 #define CHECK_SENSOR 1
#define CHECK_SENSOR 2 #define CHECK_INPUT 2
#define CHECK_INTERRUPT 3
#define T_LONG 1000
#define T_IDLE 600
#define T_RPT 300
#define T_RPT_PULSE 150
// in syntaxis // in syntaxis
// "pin": { "T":"N", "emit":"out_emit", item:"out_item", "scmd": "ON,OFF,TOGGLE,INCREASE,DECREASE", "rcmd": "ON,OFF,TOGGLE,INCREASE,DECREASE", "rcmd":"repeat_command" } // "pin": { "T":"N", "emit":"out_emit", item:"out_item", "scmd": "ON,OFF,TOGGLE,INCREASE,DECREASE", "rcmd": "ON,OFF,TOGGLE,INCREASE,DECREASE", "rcmd":"repeat_command" }
@@ -79,11 +106,25 @@ extern aJsonObject *inputs;
typedef union { typedef union {
long int aslong; long int aslong;
uint32_t timestamp; uint32_t timestamp;
// Analog input structure
struct { struct {
int8_t logicState; uint8_t reserved;
int8_t bounce; uint8_t logicState;
int16_t currentValue; int16_t currentValue;
}; };
// Digital input structure
struct {
uint8_t toggle1:1;
uint8_t toggle2:1;
uint8_t toggle3:1;
uint8_t lastValue:1;
uint8_t delayedState:1;
uint8_t bounce:3;
uint8_t state:4;
uint8_t reqState:4;
uint16_t timestamp16;
};
} inStore; } inStore;
@@ -94,18 +135,15 @@ public:
uint8_t pin; uint8_t pin;
inStore *store; inStore *store;
Input(int pin); Input(aJsonObject *obj, aJsonObject * configObj = NULL);
Input(aJsonObject *obj);
Input(char *name); Input(char *name);
boolean isValid(); boolean isValid();
void onContactChanged(int newValue); void onContactChanged(int newValue);
void onAnalogChanged(int newValue); void onAnalogChanged(float newValue);
int poll(short cause); int Poll(short cause);
void setup(); void setup();
static void inline onCounterChanged(int i); static void inline onCounterChanged(int i);
@@ -119,10 +157,10 @@ public:
protected: protected:
void Parse(); void Parse(aJsonObject * configObj = NULL);
void contactPoll(); void contactPoll(short cause);
void analogPoll(); void analogPoll(short cause);
void dht22Poll(); void dht22Poll();
@@ -140,4 +178,25 @@ protected:
bool publishDataToDomoticz(int , aJsonObject *, const char *format, ...); bool publishDataToDomoticz(int , aJsonObject *, const char *format, ...);
char* getIdxField(); char* getIdxField();
bool changeState(uint8_t newState, short cause);
//bool executeCommand(aJsonObject* cmd, int8_t toggle = -1, char* defCmd = NULL);
}; };
class readCache {
public:
readCache();
uint16_t analogReadCached (uint8_t pin);
uint8_t digitalReadCached(uint8_t pin);
#ifdef MCP23017
uint8_t I2CReadBit(uint8_t type, uint8_t addr, uint8_t pin);
#endif
void invalidateInputCache();
protected:
uint8_t addr;
uint8_t type;
uint16_t cached_data;
};
extern readCache inCache;

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,4 @@
/* Copyright © 2017-2018 Andrey Klimov. All rights reserved. /* Copyright © 2017-2020 Andrey Klimov. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@@ -17,18 +17,25 @@ GIT: https://github.com/anklimov/lighthub
e-mail anklimov@gmail.com e-mail anklimov@gmail.com
*/ */
#pragma once
#include "options.h" #include "options.h"
#include "abstractout.h"
#define S_SET 1 #define POLLING_SLOW 1
#define S_TEMP 2 #define POLLING_FAST 2
#define S_MODE 3 #define POLLING_INT 3
#define S_SETPOINT 4
#define S_POWER 5 #define S_NOTFOUND 0
#define S_VOL 6 #define S_SETnCMD 0
#define S_HEAT 7 #define S_CMD 1
#define S_HSV 8 #define S_SET 2
#define S_RGB 9 #define S_HSV 3
#define S_RPM 10 #define S_RGB 4
#define S_FAN 5
#define S_MODE 6
#define S_HUE 7
#define S_SAT 8
#define S_ADDITIONAL 64
#define CH_DIMMER 0 //DMX 1 ch #define CH_DIMMER 0 //DMX 1 ch
#define CH_RGBW 1 //DMX 4 ch #define CH_RGBW 1 //DMX 4 ch
@@ -40,14 +47,32 @@ e-mail anklimov@gmail.com
#define CH_GROUP 7 //Group pseudochannel #define CH_GROUP 7 //Group pseudochannel
#define CH_VCTEMP 8 //Vacom PID regulator #define CH_VCTEMP 8 //Vacom PID regulator
#define CH_VC 9 //Vacom modbus motor regulator #define CH_VC 9 //Vacom modbus motor regulator
#define CH_AC_HAIER 10 //AC Haier #define CH_AC 10 //AC Haier
#define CH_SPILED 11
#define CH_MOTOR 12
#define CH_MBUS 14
//#define CHANNEL_TYPES 13
//static uint32_t pollInterval[CHANNEL_TYPES] = {0,0,0,0,MODB};
//static uint32_t nextPollTime[CHANNEL_TYPES] = {0,0,0,0,0,0,0,0,0,0,0,0,0};
#define CH_WHITE 127// #define CH_WHITE 127//
#define CMD_NUM 0 #define CMD_NUM 0
#define CMD_UNKNOWN -1 #define CMD_UNKNOWN -1
#define CMD_JSON -2 #define CMD_JSON -2
#define CMD_RGB -3 //#define CMD_RGB -3
#define CMD_HSV -4 //#define CMD_HSV -4
typedef char cmdstr[9];
const cmdstr commands_P[] PROGMEM =
{
"","ON","OFF","REST","TOGGLE","HALT","XON","XOFF","INCREASE","DECREASE",
"HEAT","COOL","AUTO","FAN_ONLY","DRY","STOP","HIGH","MEDIUM","LOW",
"TRUE","FALSE","ENABLED","DISABLED","RGB","HSV"
};
#define commandsNum sizeof(commands_P)/sizeof(cmdstr)
#define CMD_ON 1 #define CMD_ON 1
#define CMD_OFF 2 #define CMD_OFF 2
@@ -58,12 +83,38 @@ e-mail anklimov@gmail.com
#define CMD_XOFF 7 //off only if was previously turned on by CMD_XON #define CMD_XOFF 7 //off only if was previously turned on by CMD_XON
#define CMD_UP 8 //increase #define CMD_UP 8 //increase
#define CMD_DN 9 //decrease #define CMD_DN 9 //decrease
#define CMD_SET 0xe #define CMD_HEAT 0xa
#define CMD_MASK 0xf #define CMD_COOL 0xb
#define CMD_AUTO 0xc
#define CMD_FAN 0xd
#define CMD_DRY 0xe
#define CMD_STOP 0xf
#define CMD_HIGH 0x10 //AC fan leve
#define CMD_MED 0x11
#define CMD_LOW 0x12
#define CMD_ENABLED 0x13
#define CMD_DISABLED 0x14
#define CMD_TRUE 0x15
#define CMD_FALSE 0x16
#define CMD_RGB 0x17
#define CMD_HSV 0x18
//#define CMD_CURTEMP 0xf
#define CMD_MASK 0xff
#define FLAG_MASK 0xff00
#define CMD_CURTEMP 127
#define CMD_RETRY 64 #define SEND_COMMAND 0x100
#define CMD_REPORT 32 #define SEND_PARAMETERS 0x200
#define SEND_RETRY 0x400
#define SEND_DEFFERED 0x800
#define ACTION_NEEDED 0x1000
#define ACTION_IN_PROCESS 0x2000
//#define CMD_REPORT 32
#define I_TYPE 0 //Type of item #define I_TYPE 0 //Type of item
#define I_ARG 1 //Chanel-type depended argument or array of arguments (pin, address etc) #define I_ARG 1 //Chanel-type depended argument or array of arguments (pin, address etc)
@@ -89,99 +140,127 @@ extern short thermoSetCurTemp(char *name, float t);
int txt2cmd (char * payload); int txt2cmd (char * payload);
enum itemStoreType {
ST_VOID = 0,
ST_PERCENTS = 1,
ST_HS = 2,
ST_HSV = 3,
ST_FLOAT_CELSIUS= 4,
ST_FLOAT_FARENHEIT= 5,
ST_RGB = 6,
ST_RGBW = 7,
ST_PERCENTS255 = 8,
ST_HSV255 = 9,
ST_INT32 = 10,
ST_UINT32 = 11,
ST_STRING = 12,
ST_FLOAT = 13,
ST_COMMAND = 15
};
#pragma pack(push, 1)
typedef union typedef union
{ {
long int aslong; long int aslong;
int32_t asInt32;
uint32_t asUint32;
char* asString;
float asfloat;
struct struct
{ {
int16_t h; uint8_t cmd_code;
int8_t s; uint8_t cmd_flag;
int8_t v; uint8_t cmd_effect;
uint8_t cmd_effect_param;
}; };
} HSVstore; struct
{ uint8_t v;
uint8_t s;
uint16_t h:15;
uint16_t hsv_flag:1;
};
struct
{
uint8_t r;
uint8_t g;
uint8_t b;
uint8_t w;//:7;
// uint8_t rgb_flag:1;
};
} itemStore;
class itemCmd
typedef union
{ {
long int aslong; public:
struct itemStoreType type;
{ itemStore param;
int8_t r; itemCmd Percents(int i);
int8_t g; itemCmd Int(int32_t i);
int8_t b; itemCmd Int(uint32_t i);
int8_t v; itemCmd Cmd(uint8_t i);
}; char * toString(char * Buffer, int bufLen);
} RGBVstore; short toCmd();
} ;
#pragma pack(pop)
class Item class Item
{ {
public: public:
aJsonObject *itemArr, *itemArg,*itemVal; aJsonObject *itemArr, *itemArg,*itemVal,*itemExt;
uint8_t itemType; uint8_t itemType;
abstractOut * driver;
Item(char * name); Item(char * name);
Item(aJsonObject * obj); Item(aJsonObject * obj);
~Item();
boolean isValid (); boolean isValid ();
virtual int Ctrl(short cmd, short n=0, int * Parameters=NULL, boolean send=true, int subItem=0); boolean Setup();
virtual int Ctrl(char * payload, boolean send=true, char * subItem=NULL); void Stop();
int Ctrl(short cmd, short n=0, int * Parameters=NULL, int suffixCode=0, char* subItem=NULL);
int Ctrl(itemCmd cmd, int suffixCode=0, char* subItem=NULL);
int Ctrl(char * payload, char * subItem=NULL);
int getArg(short n=0); int getArg(short n=0);
boolean getEnableCMD(int delta);
//int getVal(short n); //From VAL array. Negative if no array //int getVal(short n); //From VAL array. Negative if no array
long int getVal(); //From int val OR array long int getVal(); //From int val OR array
uint8_t getCmd(bool ext = false); uint8_t getCmd();
long int getExt(); //From int val OR array
void setExt(long int par);
chPersistent * getPersistent();
chPersistent * setPersistent(chPersistent * par);
void setCmd(uint8_t cmdValue); void setCmd(uint8_t cmdValue);
//void setVal(uint8_t n, int par); short getFlag (short flag=FLAG_MASK);
void setFlag (short flag);
void clearFlag (short flag);
void setVal(long int par); void setVal(long int par);
//void copyPar (aJsonObject *itemV); int Poll(int cause);
int SendStatus(int sendFlags);
int isActive();
int getChanType();
inline int On (){return Ctrl(CMD_ON);}; inline int On (){return Ctrl(CMD_ON);};
inline int Off(){return Ctrl(CMD_OFF);}; inline int Off(){return Ctrl(CMD_OFF);};
inline int Toggle(){return Ctrl(CMD_TOGGLE);}; inline int Toggle(){return Ctrl(CMD_TOGGLE);};
int Poll();
int SendStatus(short cmd, short n=0, int * Par=NULL, boolean deferred = false);
protected: protected:
//short cmd2changeActivity(int lastActivity, short defaultCmd = CMD_SET);
int VacomSetFan (int8_t val, int8_t cmd=0); int VacomSetFan (int8_t val, int8_t cmd=0);
int VacomSetHeat(int addr, int8_t val, int8_t cmd=0); int VacomSetHeat(int8_t val, int8_t cmd=0);
int modbusDimmerSet(int addr, uint16_t _reg, int _regType, int _mask, uint16_t value); int modbusDimmerSet(int addr, uint16_t _reg, int _regType, int _mask, uint16_t value);
void mb_fail(short addr, short op, int val, int cmd); int modbusDimmerSet(uint16_t value);
int isActive(); void mb_fail();
void Parse(); void Parse();
int checkModbusDimmer(); int checkModbusDimmer();
int checkModbusDimmer(int data); int checkModbusDimmer(int data);
boolean checkModbusRetry(); boolean checkModbusRetry();
boolean checkVCRetry();
boolean checkHeatRetry();
void sendDelayedStatus(); void sendDelayedStatus();
int checkFM(); int checkFM();
char defaultSubItem[10];
int defaultSuffixCode;
}; };
/*
class PooledItem : public Item
{
public:
virtual int onContactChanged() = 0;
virtual void Idle ();
protected:
int PoolingInterval;
unsigned long next;
virtual int Pool() =0;
};
class Vacon : public Item
{
public:
int Pool ();
virtual int Ctrl(short cmd, short n=0, int * Par=NULL);
protected:
};
*/

File diff suppressed because it is too large Load Diff

View File

@@ -21,33 +21,35 @@
#if defined(ARDUINO_ARCH_ESP8266) #if defined(ARDUINO_ARCH_ESP8266)
#include <FS.h> //this needs to be first, or it all crashes and burns... #include <FS.h> //this needs to be first, or it all crashes and burns...
//#include "SPIFFS.h"
#include <ESP_EEPROM.h> #include <ESP_EEPROM.h>
#include <ESP8266HTTPClient.h> //#include <ESP8266HTTPClient.h>
//#include <ArduinoHttpClient.h> //#include <ArduinoHttpClient.h>
//#include "HttpClient.h" //#include "HttpClient.h"
#include <WiFiManager.h> //#include <WiFiManager.h>
#include <DNSServer.h> //#include <DNSServer.h>
#include <ESP8266WebServer.h> //#include <ESP8266WebServer.h>
#include <ESP8266WiFi.h> //#include <ESP8266WiFi.h>
#include <user_interface.h> #include <user_interface.h>
#define Ethernet WiFi //#define Ethernet WiFi
#endif #endif
#if defined ARDUINO_ARCH_ESP32 #if defined ARDUINO_ARCH_ESP32
#include <FS.h> //this needs to be first, or it all crashes and burns... #include <FS.h> //this needs to be first, or it all crashes and burns...
//#include "SPIFFS.h"
//#include <EEPROM.h> //#include <EEPROM.h>
#include <NRFFlashStorage.h> #include <NRFFlashStorage.h>
//#include "HttpClient.h" //#include "HttpClient.h"
//#include <ArduinoHttpClient.h> //#include <ArduinoHttpClient.h>
#include <HTTPClient.h> //#include <HTTPClient.h>
#include <WiFi.h> //#include <WiFi.h>
#include <WiFiClient.h> //#include <WiFiClient.h>
#include <WiFiClientSecure.h> //#include <WiFiClientSecure.h>
#include <WebServer.h> //#include <WebServer.h>
#include <WiFiManager.h> //#include <WiFiManager.h>
#include <DNSServer.h> //include <DNSServer.h>
#define Ethernet WiFi //#define Ethernet WiFi
#endif #endif
#ifdef NRF5 #ifdef NRF5
@@ -57,11 +59,16 @@
#ifdef ARDUINO_ARCH_STM32 #ifdef ARDUINO_ARCH_STM32
#include "HttpClient.h" #include "HttpClient.h"
#include "UIPEthernet.h" //#include "UIPEthernet.h"
#include <NRFFlashStorage.h> #include <NRFFlashStorage.h>
//#include <EEPROM.h> //#include <EEPROM.h>
#endif #endif
#include "streamlog.h"
extern Streamlog debugSerial;
extern Streamlog infoSerial;
extern Streamlog errorSerial;
#if defined(__SAM3X8E__) #if defined(__SAM3X8E__)
#define wdt_res() watchdogReset() #define wdt_res() watchdogReset()
#define wdt_en() #define wdt_en()
@@ -117,13 +124,13 @@
#include "DallasTemperature.h" #include "DallasTemperature.h"
#endif #endif
#ifndef MODBUS_DISABLE #ifdef _modbus
#include <ModbusMaster.h> #include <ModbusMaster.h>
#endif #endif
#ifndef DMX_DISABLE //#ifndef DMX_DISABLE
#include "FastLED.h" //#include "FastLED.h"
#endif //#endif
#ifdef _owire #ifdef _owire
#include "owTerm.h" #include "owTerm.h"
@@ -133,13 +140,33 @@
#include "dmx.h" #include "dmx.h"
#endif #endif
#ifdef WIFI_ENABLE
#ifdef Wiz5500 #if defined(ARDUINO_ARCH_ESP32)
#include <Ethernet2.h> #include <WiFi.h>
#else #include <HTTPClient.h>
#if defined(ARDUINO_ARCH_AVR) || defined(__SAM3X8E__) || defined(NRF5) #include <WiFiClient.h>
#include <Ethernet.h> #include <WiFiClientSecure.h>
#endif #include <WiFiManager.h>
#include <WebServer.h>
#else
#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
#include <WiFiManager.h>
#include <DNSServer.h>
#include <ESP8266WebServer.h>
#endif
#define Ethernet WiFi
#else //Wired connection
#ifdef Wiz5500
#include <Ethernet2.h>
#else
#ifdef ARDUINO_ARCH_STM32
#include "UIPEthernet.h"
#else
#include <Ethernet.h>
#endif
#endif
#endif #endif
@@ -153,7 +180,7 @@
#include "Arduino.h" #include "Arduino.h"
#include "utils.h" #include "utils.h"
#include "homiedef.h" #include "textconst.h"
#include <PubSubClient.h> #include <PubSubClient.h>
#include <SPI.h> #include <SPI.h>
#include <string.h> #include <string.h>
@@ -169,14 +196,19 @@ extern Artnet *artnet;
enum lan_status { enum lan_status {
INITIAL_STATE = 0, INITIAL_STATE = 0,
HAVE_IP_ADDRESS = 1, AWAITING_ADDRESS = 1,
IP_READY_CONFIG_LOADED_CONNECTING_TO_BROKER = 2, HAVE_IP_ADDRESS = 2,
OPERATION = 3, LIBS_INITIALIZED = 3,
RETAINING_COLLECTING = 4, IP_READY_CONFIG_LOADED_CONNECTING_TO_BROKER = 4,
AWAITING_ADDRESS = -10, RETAINING_COLLECTING = 5,
RECONNECT = 12, OPERATION = 6,
READ_RE_CONFIG = -11,
DO_NOTHING = -14 DO_REINIT = -10,
REINIT = - 11,
DO_RECONNECT = 12,
RECONNECT = 13,
READ_RE_CONFIG = 14,
DO_NOTHING = -15
}; };
typedef union { typedef union {
@@ -184,6 +216,7 @@ typedef union {
uint8_t UID_Byte[20]; uint8_t UID_Byte[20];
} UID; } UID;
bool isNotRetainingStatus();
//void watchdogSetup(void); //void watchdogSetup(void);
void mqttCallback(char *topic, byte *payload, unsigned int length); void mqttCallback(char *topic, byte *payload, unsigned int length);
@@ -224,7 +257,7 @@ void printBool(bool arg);
void saveFlash(short n, char *str); void saveFlash(short n, char *str);
int loadFlash(short n, char *str, short l=32); int loadFlash(short n, char *str, short l=MAXFLASHSTR);
void saveFlash(short n, IPAddress& ip); void saveFlash(short n, IPAddress& ip);

View File

@@ -2,6 +2,8 @@
#include "Arduino.h" #include "Arduino.h"
#include "options.h" #include "options.h"
#include "Streaming.h" #include "Streaming.h"
#include "item.h"
#include "main.h"
#if defined(M5STACK) #if defined(M5STACK)
#include <M5Stack.h> #include <M5Stack.h>
@@ -17,7 +19,7 @@ static bool HDC1080ready = false;
static bool CCS811ready = false; static bool CCS811ready = false;
int in_ccs811::Setup(int addr) int in_ccs811::Setup()
{ {
if (CCS811ready) {debugSerial<<F("ccs811 is already initialized")<<endl; return 0;} if (CCS811ready) {debugSerial<<F("ccs811 is already initialized")<<endl; return 0;}
@@ -29,13 +31,17 @@ int in_ccs811::Setup(int addr)
Serial.println("CCS811 Init"); Serial.println("CCS811 Init");
Wire.begin(); //Inialize I2C Harware Wire.begin(); //Inialize I2C Harware
Wire.setClock(4000);
//It is recommended to check return status on .begin(), but it is not //It is recommended to check return status on .begin(), but it is not
//required. //required.
CCS811Core::status returnCode = ccs811.begin(); CCS811Core::status returnCode = ccs811.begin();
//CCS811Core::CC811_Status_e returnCode = ccs811.beginWithStatus();
if (returnCode != CCS811Core::SENSOR_SUCCESS) if (returnCode != CCS811Core::SENSOR_SUCCESS)
//if (returnCode != CCS811Core::CCS811_Stat_SUCCESS)
{ {
Serial.println("CCS811 Init error"); Serial.print("CCS811 Init error ");
//Serial.println(ccs811.statusString(returnCode));
printDriverError(returnCode); printDriverError(returnCode);
return 0; return 0;
} }
@@ -52,7 +58,7 @@ delay(2000); */
return 1; return 1;
} }
int in_hdc1080::Setup(int addr) int in_hdc1080::Setup()
{ {
if (HDC1080ready) {debugSerial<<F("hdc1080 is already initialized")<<endl; return 0;} if (HDC1080ready) {debugSerial<<F("hdc1080 is already initialized")<<endl; return 0;}
Serial.println("HDC1080 Init "); Serial.println("HDC1080 Init ");
@@ -72,20 +78,21 @@ return 1;
void i2cReset(){ void i2cReset(){
Wire.endTransmission(true); Wire.endTransmission(true);
#if defined (ARDUINO_ARCH_ESP8266) #if defined (SCL_RESET)
SCL_LOW(); SCL_LOW();
delay(300); delay(300);
SCL_HIGH(); SCL_HIGH();
#endif #endif
} }
int in_hdc1080::Poll() int in_hdc1080::Poll(short cause)
{ {
float h,t; float h,t;
int reg; int reg;
if (cause!=POLLING_SLOW) return 0;
if (!HDC1080ready) {debugSerial<<F("HDC1080 not initialized")<<endl; return 0;} if (!HDC1080ready) {debugSerial<<F("HDC1080 not initialized")<<endl; return 0;}
Serial.print("HDC Status="); Serial.print("HDC Status=");
Serial.print(reg=hdc1080.readRegister().rawData,HEX); Serial.println(reg=hdc1080.readRegister().rawData,HEX);
if (reg!=0xff) if (reg!=0xff)
{ {
Serial.print(" T="); Serial.print(" T=");
@@ -115,10 +122,10 @@ else //ESP I2C glitch
Serial.println("I2C Reset"); Serial.println("I2C Reset");
i2cReset(); i2cReset();
} }
return 1; return INTERVAL_POLLING;
} }
int in_ccs811::Poll() int in_ccs811::Poll(short cause)
{ {
if (!CCS811ready) {debugSerial<<F("ccs811 not initialized")<<endl; return 0;} if (!CCS811ready) {debugSerial<<F("ccs811 not initialized")<<endl; return 0;}
#ifdef WAK_PIN #ifdef WAK_PIN
@@ -156,10 +163,11 @@ int in_ccs811::Poll()
#endif #endif
if (co2<10000.) //Spontaneous calculation error suppress
{
publish(co2,"/CO2"); publish(co2,"/CO2");
publish(tvoc,"/TVOC"); publish(tvoc,"/TVOC");
publish(ccs811Baseline,"/base"); publish(ccs811Baseline,"/base");}
Serial.println("]"); Serial.println("]");
printSensorError(); printSensorError();

View File

@@ -18,8 +18,17 @@
#define SCL_LOW() (GPES = (1 << twi_scl)) #define SCL_LOW() (GPES = (1 << twi_scl))
#define SCL_HIGH() (GPEC = (1 << twi_scl)) #define SCL_HIGH() (GPEC = (1 << twi_scl))
#define SCL_RESET
#endif #endif
/*
#if defined (__SAM3X8E__)
#define SCL_LOW() digitalWrite(21,LOW)
#define SCL_HIGH() digitalWrite(21,HIGH)
#define SCL_RESET
#endif
*/
#if defined (ARDUINO_ARCH_ESP32) #if defined (ARDUINO_ARCH_ESP32)
#undef WAK_PIN #undef WAK_PIN
//#ifndef WAK_PIN //#ifndef WAK_PIN
@@ -40,8 +49,8 @@ public:
//CCS811 ccs811(CCS811_ADDR); //CCS811 ccs811(CCS811_ADDR);
//uint16_t ccs811Baseline; //uint16_t ccs811Baseline;
in_ccs811(Input * _in):abstractIn(_in){}; in_ccs811(Input * _in):abstractIn(_in){};
int Setup(int addr) override; int Setup() override;
int Poll() override; int Poll(short cause) override;
protected: protected:
void printDriverError( CCS811Core::status errorCode ); void printDriverError( CCS811Core::status errorCode );
@@ -52,8 +61,8 @@ class in_hdc1080 : public abstractIn {
public: public:
//ClosedCube_HDC1080 hdc1080; //ClosedCube_HDC1080 hdc1080;
in_hdc1080(Input * _in):abstractIn(_in){}; in_hdc1080(Input * _in):abstractIn(_in){};
int Setup(int addr) override; int Setup() override;
int Poll() override; int Poll(short cause) override;
protected: protected:
void printSerialNumber(); void printSerialNumber();

471
lighthub/modules/out_ac.cpp Normal file
View File

@@ -0,0 +1,471 @@
#ifndef AC_DISABLE
#include "modules/out_ac.h"
#include "Arduino.h"
#include "options.h"
#include "Streaming.h"
#include "item.h"
#include "textconst.h"
#include "main.h"
#ifndef AC_Serial
#define AC_Serial Serial3
#endif
#define INTERVAL_AC_POLLING 5000L
static int driverStatus = CST_UNKNOWN;
static int fresh =0;
static int power = 0;
static int swing =0;
static int lock_rem =0;
static int cur_tmp = 0;
static int set_tmp = 0;
static int fan_spd = 0;
static int mode = 0;
long prevPolling = 0;
byte inCheck = 0;
byte qstn[] = {255,255,10,0,0,0,0,0,1,1,77,1,90}; // Команда опроса
byte data[37] = {}; //Массив данных
byte on[] = {255,255,10,0,0,0,0,0,1,1,77,2,91}; // Включение кондиционера
byte off[] = {255,255,10,0,0,0,0,0,1,1,77,3,92}; // Выключение кондиционера
byte lock[] = {255,255,10,0,0,0,0,0,1,3,0,0,14}; // Блокировка пульта
//Extended subItem set
const char LOCK_P[] PROGMEM = "lock";
const char QUIET_P[] PROGMEM = "queit";
const char SWING_P[] PROGMEM = "swing";
const char RAW_P[] PROGMEM = "raw";
//const char IDLE_P[] PROGMEM = "IDLE";
/*
extern const char HEAT_P[] PROGMEM;
extern const char COOL_P[] PROGMEM;
extern const char AUTO_P[] PROGMEM;
extern const char FAN_ONLY_P[] PROGMEM;
extern const char DRY_P[] PROGMEM;
extern const char HIGH_P[] PROGMEM;
extern const char MED_P[] PROGMEM;
extern const char LOW_P[] PROGMEM;
*/
void out_AC::InsertData(byte data[], size_t size){
char s_mode[10];
set_tmp = data[B_SET_TMP]+16;
cur_tmp = data[B_CUR_TMP];
mode = data[B_MODE];
fan_spd = data[B_FAN_SPD];
swing = data[B_SWING];
power = data[B_POWER];
lock_rem = data[B_LOCK_REM];
fresh = data[B_FRESH];
/////////////////////////////////
if (fresh & 0x01)
publishTopic(item->itemArr->name, "ON","/fresh");
else publishTopic(item->itemArr->name, "OFF","/fresh");
/////////////////////////////////
if (lock_rem == 0x80){
publishTopic(item->itemArr->name, "ON","/lock");
}
if (lock_rem == 0x00){
publishTopic(item->itemArr->name, "OFF","/lock");
}
/////////////////////////////////
/*
if (power == 0x01 || power == 0x11){
publishTopic(item->itemArr->name,"Power", "on");
}
if (power == 0x00 || power == 0x10){
publishTopic(item->itemArr->name,"Power", "off");
}
*/
Serial.print ("Power=");
Serial.println(power);
if (power & 0x08)
publishTopic(item->itemArr->name, "ON", "/quiet");
else publishTopic(item->itemArr->name, "OFF" , "/quiet");
if (power & 0x02) //Compressor on
publishTopic(item->itemArr->name, "ON","/compressor");
else
publishTopic(item->itemArr->name, "OFF","/compressor");
publishTopic(item->itemArr->name, (long) swing,"/swing");
//publishTopic(item->itemArr->name, (long) fan_spd,"/fan");
/////////////////////////////////
if (fan_spd == 0x00){
publishTopic(item->itemArr->name, "high","/fan");
}
if (fan_spd == 0x01){
publishTopic(item->itemArr->name, "medium","/fan");
}
if (fan_spd == 0x02){
publishTopic(item->itemArr->name, "low","/fan");
}
if (fan_spd == 0x03){
publishTopic(item->itemArr->name, "auto","/fan");
}
if (swing == 0x00)
publishTopic(item->itemArr->name, "OFF","/swing");
else publishTopic(item->itemArr->name, "ON","/swing");
/*
if (swing == 0x01){
publishTopic(item->itemArr->name, "ud","swing");
}
if (swing == 0x02){
publishTopic(item->itemArr->name, "lr","swing");
}
if (swing == 0x03){
publishTopic(item->itemArr->name, "all","swing");
}*/
/////////////////////////////////
publishTopic(item->itemArr->name,(long)set_tmp,"/set");
publishTopic(item->itemArr->name, (long)cur_tmp, "/temp");
////////////////////////////////////
s_mode[0]='\0';
if (mode == 0x00){
strcpy_P(s_mode,AUTO_P);
}
else if (mode == 0x01){
strcpy_P(s_mode,COOL_P);
}
else if (mode == 0x02){
strcpy_P(s_mode,HEAT_P);
}
else if (mode == 0x03){
strcpy_P(s_mode,FAN_ONLY_P);
}
else if (mode == 0x04){
strcpy_P(s_mode,DRY_P);
}
publishTopic(item->itemArr->name, (long) mode, "/mode");
if (power & 0x01)
publishTopic(item->itemArr->name, s_mode,"/cmd");
else publishTopic(item->itemArr->name, "OFF","/cmd");
String raw_str;
char raw[75];
for (int i=0; i < 37; i++){
if (data[i] < 10){
raw_str += "0";
raw_str += String(data[i], HEX);
} else {
raw_str += String(data[i], HEX);
}
}
raw_str.toUpperCase();
raw_str.toCharArray(raw,75);
publishTopic(item->itemArr->name, raw,"/raw");
Serial.println(raw);
///////////////////////////////////
}
byte getCRC(byte req[], size_t size){
byte crc = 0;
for (int i=2; i < size; i++){
crc += req[i];
}
return crc;
}
void SendData(byte req[], size_t size){
AC_Serial.write(req, size - 1);
AC_Serial.write(getCRC(req, size-1));
AC_Serial.flush();
Serial.print("<<");
for (int i=0; i < size-1; i++)
{
if (req[i] < 10){
Serial.print("0");
Serial.print(req[i], HEX);
}
else
{
Serial.print(req[i], HEX);
}
}
Serial.println();
}
inline unsigned char toHex( char ch ){
return ( ( ch >= 'A' ) ? ( ch - 'A' + 0xA ) : ( ch - '0' ) ) & 0x0F;
}
int out_AC::Setup()
{
Serial.println("AC Init");
AC_Serial.begin(9600);
driverStatus = CST_INITIALIZED;
return 1;
}
int out_AC::Stop()
{
Serial.println("AC De-Init");
driverStatus = CST_UNKNOWN;
return 1;
}
int out_AC::Status()
{
return driverStatus;
}
int out_AC::isActive()
{
return (power & 1);
}
int out_AC::Poll(short cause)
{
if (cause!=POLLING_SLOW) return 0;
long now = millis();
if (now - prevPolling > INTERVAL_AC_POLLING) {
prevPolling = now;
Serial.println ("Polling");
SendData(qstn, sizeof(qstn)/sizeof(byte)); //Опрос кондиционера
}
delay(100);
if(AC_Serial.available() > 0){
AC_Serial.readBytes(data, 37);
while(AC_Serial.available()){
delay(2);
AC_Serial.read();
}
if (data[36] != inCheck){
inCheck = data[36];
InsertData(data, 37);
}
}
return INTERVAL_POLLING;
};
int out_AC::Ctrl(short cmd, short n, int * Parameters, int suffixCode, char* subItem)
{char s_mode[10];
// Some additional Subitems
if (strcmp_P(subItem, LOCK_P) == 0) suffixCode = S_LOCK;
else if (strcmp_P(subItem, SWING_P) == 0) suffixCode = S_SWING;
else if (strcmp_P(subItem, QUIET_P) == 0) suffixCode = S_QUIET;
else if (strcmp_P(subItem, RAW_P) == 0) suffixCode = S_RAW;
//data[B_POWER] = power;
// debugSerial<<F(".");
switch(suffixCode)
{
case S_SET:
set_tmp = Parameters[0];
if (set_tmp >= 10 && set_tmp <= 30)
{
data[B_SET_TMP] = set_tmp -16;
publishTopic(item->itemArr->name,(long) set_tmp,"/set");
}
break;
case S_CMD:
s_mode[0]='\0';
switch (cmd)
{
case CMD_ON:
case CMD_XON:
data[B_POWER] = power;
data[B_POWER] |= 1;
SendData(on, sizeof(on)/sizeof(byte));
publishTopic(item->itemArr->name,"ON","/cmd");
return 1;
break;
case CMD_OFF:
case CMD_HALT:
data[B_POWER] = power;
data[B_POWER] &= ~1;
SendData(off, sizeof(off)/sizeof(byte));
publishTopic(item->itemArr->name,"OFF","/cmd");
return 1;
break;
case CMD_AUTO:
data[B_MODE] = 0;
data[B_POWER] = power;
data[B_POWER] |= 1;
strcpy_P(s_mode,AUTO_P);
break;
case CMD_COOL:
data[B_MODE] = 1;
data[B_POWER] = power;
data[B_POWER] |= 1;
strcpy_P(s_mode,COOL_P);
break;
case CMD_HEAT:
data[B_MODE] = 2;
data[B_POWER] = power;
data[B_POWER] |= 1;
strcpy_P(s_mode,HEAT_P);
break;
case CMD_DRY:
data[B_MODE] = 4;
data[B_POWER] = power;
data[B_POWER] |= 1;
strcpy_P(s_mode,DRY_P);
break;
case CMD_FAN:
data[B_MODE] = 3;
debugSerial<<"fan\n";
data[B_POWER] = power;
data[B_POWER] |= 1;
strcpy_P(s_mode,FAN_ONLY_P);
break;
case CMD_UNKNOWN:
return -1;
break;
}
publishTopic(item->itemArr->name,s_mode,"/cmd");
break;
case S_FAN:
s_mode[0]='\0';
switch (cmd)
{
case CMD_AUTO:
data[B_FAN_SPD] = 3;
strcpy_P(s_mode,AUTO_P);
break;
case CMD_HIGH:
data[B_FAN_SPD] = 0;
strcpy_P(s_mode,HIGH_P);
break;
case CMD_MED:
data[B_FAN_SPD] = 1;
strcpy_P(s_mode,MED_P);
break;
case CMD_LOW:
data[B_FAN_SPD] = 2;
strcpy_P(s_mode,LOW_P);
break;
default:
if (n) data[B_FAN_SPD] = Parameters[0];
//TODO - mapping digits to speed
}
publishTopic(item->itemArr->name,s_mode,"/fan");
break;
case S_MODE:
data[B_MODE] = Parameters[0];
break;
case S_LOCK:
switch (cmd)
{
case CMD_ON:
data[B_LOCK_REM] = 80;
break;
case CMD_OFF:
data[B_LOCK_REM] = 0;
break;
}
break;
case S_SWING:
switch (cmd)
{
case CMD_ON:
data[B_LOCK_REM] = 3;
break;
case CMD_OFF:
data[B_LOCK_REM] = 0;
break;
default:
if (n) data[B_SWING] = Parameters[0];
}
break;
case S_QUIET:
switch (cmd)
{
case CMD_ON:
data[B_POWER] |= 8;
break;
case CMD_OFF:
data[B_POWER] &= ~8;
break;
}
break;
case S_RAW:
/*
{
char buf[75];
char hexbyte[3] = {0};
strPayload.toCharArray(buf, 75);
int octets[sizeof(buf) / 2] ;
for (int i=0; i < 76; i += 2){
hexbyte[0] = buf[i] ;
hexbyte[1] = buf[i+1] ;
data[i/2] = (toHex(hexbyte[0]) << 4) | toHex(hexbyte[1]);
AC_Serial.write(data, 37);
AC_Serial.flush();
publishTopic("RAW", buf);
}
*/
break;
case S_NOTFOUND:
return -1;
}
/*
//////////
if (strTopic == "/myhome/in/Conditioner/Swing"){
if (strPayload == "off"){
data[B_SWING] = 0;
}
if (strPayload == "ud"){
data[B_SWING] = 1;
}
if (strPayload == "lr"){
data[B_SWING] = 2;
}
if (strPayload == "all"){
data[B_SWING] = 3;
}
}
////////
*/
//if (strTopic == "/myhome/in/Conditioner/RAW")
data[B_CMD] = 0;
data[9] = 1;
data[10] = 77;
data[11] = 95;
SendData(data, sizeof(data)/sizeof(byte));
//InsertData(data, sizeof(data)/sizeof(byte));
return 1;
}
#endif

37
lighthub/modules/out_ac.h Normal file
View File

@@ -0,0 +1,37 @@
#pragma once
#ifndef AC_DISABLE
#include <abstractout.h>
#define LEN_B 37
#define B_CUR_TMP 13 //Текущая температура
#define B_CMD 17 // 00-команда 7F-ответ ???
#define B_MODE 23 //04 - DRY, 01 - cool, 02 - heat, 00 - smart 03 - вентиляция
#define B_FAN_SPD 25 //Скорость 02 - min, 01 - mid, 00 - max, 03 - auto
#define B_SWING 27 //01 - верхний и нижний предел вкл. 00 - выкл. 02 - левый/правый вкл. 03 - оба вкл
#define B_LOCK_REM 28 //80 блокировка вкл. 00 - выкл
#define B_POWER 29 //on/off 01 - on, 00 - off (10, 11)-Компрессор??? 09 - QUIET
#define B_FRESH 31 //fresh 00 - off, 01 - on
#define B_SET_TMP 35 //Установленная температура
#define S_LOCK S_ADDITIONAL+1
#define S_QUIET S_ADDITIONAL+2
#define S_SWING S_ADDITIONAL+3
#define S_RAW S_ADDITIONAL+4
extern void modbusIdle(void) ;
class out_AC : public abstractOut {
public:
out_AC(Item * _item):abstractOut(_item){};
int Setup() override;
int Poll(short cause) override;
int Stop() override;
int Status() override;
int isActive() override;
int Ctrl(short cmd, short n=0, int * Parameters=NULL, int suffixCode=0, char* subItem=NULL) override;
protected:
void InsertData(byte data[], size_t size);
};
#endif

View File

@@ -0,0 +1,412 @@
#ifndef MBUS_DISABLE
#include "modules/out_modbus.h"
#include "Arduino.h"
#include "options.h"
#include "utils.h"
#include "Streaming.h"
#include "item.h"
#include <ModbusMaster.h>
#include "main.h"
#include <HardwareSerial.h>
extern aJsonObject *modbusObj;
extern ModbusMaster node;
extern short modbusBusy;
extern void modbusIdle(void) ;
struct reg_t
{
const char verb[4];
const uint8_t id;
};
struct serial_t
{
const char verb[4];
const uint16_t mode;
};
#define PAR_I16 1
#define PAR_I32 2
#define PAR_U16 3
#define PAR_U32 4
#define PAR_I8H 5
#define PAR_I8L 6
#define PAR_U8H 7
#define PAR_U8L 8
const reg_t regSize_P[] PROGMEM =
{
{ "i16", (uint8_t) PAR_I16 },
{ "i32", (uint8_t) PAR_I32 },
{ "u16", (uint8_t) PAR_U16 },
{ "u32", (uint8_t) PAR_U32 },
{ "i8h", (uint8_t) PAR_I8H },
{ "i8l", (uint8_t) PAR_I8L },
{ "u8h", (uint8_t) PAR_U8H },
{ "u8l", (uint8_t) PAR_U8L }
} ;
#define regSizeNum sizeof(regSize_P)/sizeof(reg_t)
const serial_t serialModes_P[] PROGMEM =
{
{ "8E1", (uint16_t) SERIAL_8E1},//(uint16_t) US_MR_CHRL_8_BIT | US_MR_NBSTOP_1_BIT | UART_MR_PAR_EVEN },
{ "8N1", (uint16_t) SERIAL_8N1},
{ "8E2", (uint16_t) SERIAL_8E2},
{ "8N2", (uint16_t) SERIAL_8N2},
{ "8O1", (uint16_t) SERIAL_8O1},
{ "8O2", (uint16_t) SERIAL_8O2},
// { "8M1", SERIAL_8M1},
// { "8S1", SERIAL_8S1},
{ "7E1", (uint16_t) SERIAL_7E1},//(uint16_t) US_MR_CHRL_8_BIT | US_MR_NBSTOP_1_BIT | UART_MR_PAR_EVEN },
{ "7N1", (uint16_t) SERIAL_7N1},
{ "7E2", (uint16_t) SERIAL_7E2},
{ "7N2", (uint16_t) SERIAL_7N2},
{ "7O1", (uint16_t) SERIAL_7O1},
{ "7O2", (uint16_t) SERIAL_7O2}
// { "7M1", SERIAL_7M1},
// { "7S1", SERIAL_7S1}
} ;
#define serialModesNum sizeof(serialModes_P)/sizeof(serial_t)
uint16_t str2SerialParam(char * str)
{ debugSerial<<str<<F(" =>");
for(uint8_t i=0; i<serialModesNum && str;i++)
if (strcmp_P(str, serialModes_P[i].verb) == 0)
{
debugSerial<< i << F(" ") << pgm_read_word_near(&serialModes_P[i].mode)<< endl;
return pgm_read_word_near(&serialModes_P[i].mode);
}
debugSerial<< F("Default serial mode N81 used");
return static_cast<uint16_t> (SERIAL_8N1);
}
int str2regSize(char * str)
{
for(uint8_t i=0; i<regSizeNum && str;i++)
if (strcmp_P(str, regSize_P[i].verb) == 0)
return pgm_read_byte_near(&regSize_P[i].id);
return (int) PAR_I16;
}
bool out_Modbus::getConfig()
{
// Retrieve and store template values from global modbus settings
if (!store || !item || !item->itemArg || (item->itemArg->type != aJson_Array) || aJson.getArraySize(item->itemArg)<2)
{
errorSerial<<F("MBUS: config failed:")<<(bool)store<<F(",")<<(bool)item<<F(",")<<(bool)item->itemArg<<F(",")<<(item->itemArg->type != aJson_Array)<<F(",")<< (aJson.getArraySize(item->itemArg)<2)<<endl;
return false;
}
aJsonObject * templateIdObj = aJson.getArrayItem(item->itemArg, 1);
if (templateIdObj->type != aJson_String || !templateIdObj->valuestring)
{
errorSerial<<F("Invalid template.")<<endl;
return false;
}
aJsonObject * templateObj = aJson.getObjectItem(modbusObj, templateIdObj->valuestring);
if (! templateObj)
{
errorSerial<<F("Modbus template not found: ")<<templateIdObj->valuestring<<endl;
return false;
}
aJsonObject * serialParamObj=aJson.getObjectItem(templateObj, "serial");
if (serialParamObj && serialParamObj->type == aJson_String) store->serialParam = str2SerialParam(serialParamObj->valuestring);
else store->serialParam = SERIAL_8N1;
aJsonObject * baudObj=aJson.getObjectItem(templateObj, "baud");
if (baudObj && baudObj->type == aJson_Int && baudObj->valueint) store->baud = baudObj->valueint;
else store->baud = 9600;
aJsonObject * pollObj=aJson.getObjectItem(templateObj, "poll");
if (pollObj && pollObj->type == aJson_Object)
{
store->pollingRegisters=aJson.getObjectItem(pollObj, "regs");
store->pollingInterval =aJson.getObjectItem(pollObj, "delay")->valueint;
}
else {store->pollingRegisters=NULL;store->pollingInterval = 1000;}
store->parameters=aJson.getObjectItem(templateObj, "par");
return true;
//store->addr=item->getArg(0);
}
int out_Modbus::Setup()
{
if (!store) store= (mbPersistent *)item->setPersistent(new mbPersistent);
if (!store)
{ errorSerial<<F("MBUS: Out of memory")<<endl;
return 0;}
store->timestamp=millis();
if (getConfig())
{
//item->clearFlag(ACTION_NEEDED);
//item->clearFlag(ACTION_IN_PROCESS);
infoSerial<<F("Modbus config loaded ")<< item->itemArr->name<<endl;
store->driverStatus = CST_INITIALIZED;
return 1;
}
else
{ errorSerial<<F("Modbus config error")<<endl;
store->driverStatus = CST_FAILED;
return 0;
}
}
int out_Modbus::Stop()
{
Serial.println("Modbus De-Init");
delete store;
item->setPersistent(NULL);
store = NULL;
return 1;
}
int out_Modbus::Status()
{
if (store)
return store->driverStatus;
return CST_UNKNOWN;
}
int out_Modbus::isActive()
{
return item->getVal();
}
bool readModbus(uint16_t reg, int regType, int count)
{
uint8_t result;
switch (regType) {
case MODBUS_HOLDING_REG_TYPE:
result = node.readHoldingRegisters(reg, count);
break;
case MODBUS_COIL_REG_TYPE:
result = node.readCoils(reg, count);
break;
case MODBUS_DISCRETE_REG_TYPE:
result = node.readDiscreteInputs(reg, count);
break;
case MODBUS_INPUT_REG_TYPE:
result = node.readInputRegisters(reg, count);
break;
default:
debugSerial<<F("Not supported reg type\n");
}
if (result != node.ku8MBSuccess) errorSerial<<F("MBUS: Polling error")<<endl;
return (result == node.ku8MBSuccess);
}
int out_Modbus::findRegister(int registerNum, int posInBuffer)
{
aJsonObject * paramObj = store->parameters->child;
bool is8bit = false;
while (paramObj)
{
aJsonObject *regObj = aJson.getObjectItem(paramObj, "reg");
if (regObj && regObj->valueint ==registerNum)
{
aJsonObject *typeObj = aJson.getObjectItem(paramObj, "type");
aJsonObject *mapObj = aJson.getObjectItem(paramObj, "map");
aJsonObject * itemParametersObj = aJson.getArrayItem(item->itemArg, 2);
uint16_t data = node.getResponseBuffer(posInBuffer);
int8_t regType = PAR_I16;
uint32_t param =0;
itemCmd mappedParam;
bool isSigned=false;
if (typeObj && typeObj->type == aJson_String) regType=str2regSize(typeObj->valuestring);
switch(regType) {
case PAR_I16:
isSigned=true;
case PAR_U16:
param=data;
break;
case PAR_I32:
isSigned=true;
case PAR_U32:
param = data | (node.getResponseBuffer(posInBuffer+1)<<16);
break;
case PAR_U8L:
is8bit=true;
param = data & 0xFF;
break;
case PAR_U8H:
is8bit=true;
param = data << 8;
}
if (mapObj && (mapObj->type==aJson_Array || mapObj->type==aJson_Object))
mappedParam = mapInt(param,mapObj);
else mappedParam.Int(param);
if (itemParametersObj && itemParametersObj->type ==aJson_Object)
{
aJsonObject *execObj = aJson.getObjectItem(itemParametersObj,paramObj->name);
if (execObj) executeCommand(execObj, -1, mappedParam);
}
debugSerial << F("MB got ")<<param<< F(" from ")<<regType<<F(":")<<paramObj->name<<endl;
if (!is8bit) return 1;
}
paramObj=paramObj->next;
}
return is8bit;
}
int out_Modbus::Poll(short cause)
{
if (store->pollingRegisters && !modbusBusy && (Status() == CST_INITIALIZED) && isTimeOver(store->timestamp,millis(),store->pollingInterval))
{
debugSerial<<F("Poll ")<< item->itemArr->name << endl;
modbusBusy=1;
//store->serialParam=(USARTClass::USARTModes) SERIAL_8N1;
#if defined (__SAM3X8E__)
modbusSerial.begin(store->baud, static_cast <USARTClass::USARTModes> (store->serialParam));
#elif defined (ARDUINO_ARCH_ESP8266)
modbusSerial.begin(store->baud, static_cast <SerialConfig>(store->serialParam));
#else
modbusSerial.begin(store->baud, (store->serialParam));
#endif
debugSerial<< store->baud << F("---")<< store->serialParam<<endl;
node.begin(item->getArg(0), modbusSerial);
aJsonObject * reg = store->pollingRegisters->child;
while (reg)
{
switch (reg->type)
{
case aJson_Int:
{
int registerNum = reg->valueint;
if (readModbus(registerNum,MODBUS_HOLDING_REG_TYPE,1))
{
findRegister(registerNum,0);
// data = node.getResponseBuffer(j);
}
}
break;
case aJson_Array:
if (aJson.getArraySize(reg)==2)
{
int registerFrom=aJson.getArrayItem(reg, 0)->valueint;
int registerTo=aJson.getArrayItem(reg, 1)->valueint;
if (readModbus(registerFrom,MODBUS_HOLDING_REG_TYPE,registerTo-registerFrom+1))
{
for(int i=registerFrom;i<=registerTo;i++)
{
findRegister(i,i-registerFrom);
}
//data = node.getResponseBuffer(j);
}
}
}
reg = reg->next;
}
store->timestamp=millis();
debugSerial<<F("endPoll ")<< item->itemArr->name << endl;
//Non blocking waiting to release line
uint32_t time = millis()+50;
while (millis()<time)
modbusIdle();
modbusBusy =0;
}
return store->pollingInterval;
};
int out_Modbus::getChanType()
{
return CH_MODBUS;
}
int out_Modbus::Ctrl(short cmd, short n, int * Parameters, int suffixCode, char* subItem)
{
int chActive = item->isActive();
bool toExecute = (chActive>0);
long st;
if (cmd>0 && !suffixCode) suffixCode=S_CMD; //if some known command find, but w/o correct suffix - got it
//item->setFlag(ACTION_NEEDED);
switch(suffixCode)
{
case S_NOTFOUND:
// turn on and set
toExecute = true;
debugSerial<<F("Forced execution");
case S_SET:
if (!Parameters || n==0) return 0;
item->setVal(st=Parameters[0]); //Store
if (!suffixCode)
{
if (chActive>0 && !st) item->setCmd(CMD_OFF);
if (chActive==0 && st) item->setCmd(CMD_ON);
item->SendStatus(SEND_COMMAND | SEND_PARAMETERS | SEND_DEFFERED);
// if (item->getExt()) item->setExt(millis()+maxOnTime); //Extend motor time
}
else item->SendStatus(SEND_PARAMETERS | SEND_DEFFERED);
return 1;
//break;
case S_CMD:
item->setCmd(cmd);
switch (cmd)
{
case CMD_ON:
//retrive stored values
st = item->getVal();
if (st && (st<MIN_VOLUME) /* && send */) st=INIT_VOLUME;
item->setVal(st);
if (st) //Stored smthng
{
item->SendStatus(SEND_COMMAND | SEND_PARAMETERS);
debugSerial<<F("Restored: ")<<st<<endl;
}
else
{
debugSerial<<st<<F(": No stored values - default\n");
// Store
st=100;
item->setVal(st);
item->SendStatus(SEND_COMMAND | SEND_PARAMETERS );
}
// if (item->getExt()) item->setExt(millis()+maxOnTime); //Extend motor time
return 1;
case CMD_OFF:
item->SendStatus(SEND_COMMAND);
// if (item->getExt()) item->setExt(millis()+maxOnTime); //Extend motor time
return 1;
} //switch cmd
break;
} //switch suffix
debugSerial<<F("Unknown cmd")<<endl;
return 0;
}
#endif

View File

@@ -0,0 +1,42 @@
#pragma once
#include "options.h"
#ifndef MBUS_DISABLE
#include <abstractout.h>
#include <item.h>
class mbPersistent : public chPersistent {
public:
// int addr
int8_t driverStatus;
int baud;
uint16_t serialParam;
uint16_t pollingInterval;
uint32_t timestamp;
aJsonObject * pollingRegisters;
aJsonObject * parameters;
};
class out_Modbus : public abstractOut {
public:
out_Modbus(Item * _item):abstractOut(_item){store = (mbPersistent *) item->getPersistent();};
int Setup() override;
int Poll(short cause) override;
int Stop() override;
int Status() override;
int isActive() override;
int getChanType() override;
int Ctrl(short cmd, short n=0, int * Parameters=NULL, int suffixCode=0, char* subItem=NULL) override;
protected:
mbPersistent * store;
bool getConfig();
int findRegister(int registerNum, int posInBuffer);
};
#endif

View File

@@ -0,0 +1,285 @@
#ifndef MOTOR_DISABLE
#include "modules/out_motor.h"
#include "Arduino.h"
#include "options.h"
#include "Streaming.h"
#include "item.h"
#include "main.h"
static int driverStatus = CST_UNKNOWN;
void out_Motor::getConfig()
{
pinUp=item->getArg(0);
if(pinUp<=0 || pinUp>=PINS_COUNT) pinUp=32;
pinDown=item->getArg(1);
if (pinDown<=0 || pinDown>=PINS_COUNT) pinDown=33;
pinFeedback=item->getArg(2);
if (pinFeedback<0 || pinFeedback>=PINS_COUNT) pinFeedback=0;
feedbackOpen=item->getArg(3);
if (feedbackOpen<=0 || feedbackOpen>1024) feedbackOpen=0;
feedbackClosed=item->getArg(4);
if (feedbackClosed<0 || feedbackClosed>1024) feedbackClosed=1024;
maxOnTime=item->getArg(5);
if (maxOnTime<=0) maxOnTime=10000;
}
int out_Motor::Setup()
{
getConfig();
Serial.println("Motor Init");
pinMode(pinUp,OUTPUT);
pinMode(pinDown,OUTPUT);
digitalWrite(pinUp,LOW);
digitalWrite(pinDown,LOW);
pinMode(pinFeedback, INPUT);
item->setExt(0);
item->clearFlag(ACTION_NEEDED);
item->clearFlag(ACTION_IN_PROCESS);
driverStatus = CST_INITIALIZED;
motorQuote = MOTOR_QUOTE;
return 1;
}
int out_Motor::Stop()
{
Serial.println("Motor De-Init");
digitalWrite(pinUp,LOW);
digitalWrite(pinDown,LOW);
item->setExt(0);
driverStatus = CST_UNKNOWN;
return 1;
}
int out_Motor::Status()
{
return driverStatus;
}
int out_Motor::isActive()
{
return item->getVal();
}
int out_Motor::Poll(short cause)
{
int curPos = -1;
int targetPos = -1;
int dif;
if (!item->getFlag(ACTION_NEEDED)) return 0;
if (!item->getFlag(ACTION_IN_PROCESS))
{
if (motorQuote)
{
item->setFlag(ACTION_IN_PROCESS);
motorQuote--;
}
else return 0;
}
uint32_t motorOfftime = item->getExt();
switch (item->getCmd())
{
case CMD_ON:
case CMD_XON:
targetPos = item->getVal();
break;
case CMD_OFF:
case CMD_HALT:
targetPos = 0;
break;
}
if (pinFeedback && isAnalogPin(pinFeedback))
{
curPos=map(analogRead(pinFeedback),feedbackClosed,feedbackOpen,0,100);
if (curPos<0) curPos=0;
if (curPos>100) curPos=100;
}
if (motorOfftime && motorOfftime<millis()) //Time over
{dif = 0; debugSerial<<F("Motor timeout")<<endl;}
else if (curPos>=0)
dif=targetPos-curPos;
else
dif=targetPos-50; // Have No feedback
if (dif<-POS_ERR)
{
digitalWrite(pinDown,LOW);
if (!item->getExt())item->setExt(millis()+maxOnTime);
//
//PINS_COUNT
//PIN_ATTR_ANALOG
// uint32_t attr = g_APinDescription[pinUp].ulPinAttribute;
// if ((attr & PIN_ATTR_PWM) == PIN_ATTR_PWM) ;
#ifndef ESP32
if (digitalPinHasPWM(pinUp))
{
//Serial.println("pinUP PWM");
int velocity = map(-dif, 0, 10, 0, 255);
if (velocity>255) velocity=255;
if (velocity<0) velocity=0;
analogWrite(pinUp,velocity);
}
else if (digitalPinHasPWM(pinDown))
{
// Serial.println("pinDown PWM fallback");
digitalWrite(pinUp,HIGH);
int velocity = map(-dif, 0, 10, 255, 0);
if (velocity>255) velocity=255;
if (velocity<0) velocity=0;
analogWrite(pinDown,velocity);
}
else
#endif
{
// Serial.print(pinUp);
// Serial.println(" pinUP noPWM");
digitalWrite(pinUp,HIGH);
}
}
else
if (dif>POS_ERR)
{
digitalWrite(pinUp,LOW);
if (!item->getExt()) item->setExt(millis()+maxOnTime);
#ifndef ESP32
if (digitalPinHasPWM(pinDown))
{
//Serial.println("pinDown PWM");
int velocity = map(dif, 0, 10, 0, 255);
if (velocity>255) velocity=255;
if (velocity<0) velocity=0;
analogWrite(pinDown,velocity);
}
else
if (digitalPinHasPWM(pinUp))
{
//Serial.println("pinUP PWM fallback");
digitalWrite(pinDown,HIGH);
int velocity = map(dif, 0, 10, 255, 0);
if (velocity>255) velocity=255;
if (velocity<0) velocity=0;
analogWrite(pinUp,velocity);
}
else
#endif
{
//Serial.print(pinDown);
//Serial.println(" pinDown noPWM");
digitalWrite(pinDown,HIGH);
}
}
else //Target zone
{ Serial.println("Target");
digitalWrite(pinUp,LOW);
digitalWrite(pinDown,LOW);
item->setExt(0);
item->clearFlag(ACTION_NEEDED);
item->clearFlag(ACTION_IN_PROCESS);
motorQuote++;
}
return 0;
};
int out_Motor::getChanType()
{
return CH_PWM;
}
int out_Motor::Ctrl(short cmd, short n, int * Parameters, int suffixCode, char* subItem)
{
int chActive = item->isActive();
bool toExecute = (chActive>0);
long st;
if (cmd>0 && !suffixCode) suffixCode=S_CMD; //if some known command find, but w/o correct suffix - got it
item->setFlag(ACTION_NEEDED);
switch(suffixCode)
{
case S_NOTFOUND:
// turn on and set
toExecute = true;
debugSerial<<F("Forced execution");
case S_SET:
if (!Parameters || n==0) return 0;
item->setVal(st=Parameters[0]); //Store
if (!suffixCode)
{
if (chActive>0 && !st) item->setCmd(CMD_OFF);
if (chActive==0 && st) item->setCmd(CMD_ON);
item->SendStatus(SEND_COMMAND | SEND_PARAMETERS | SEND_DEFFERED);
if (item->getExt()) item->setExt(millis()+maxOnTime); //Extend motor time
}
else item->SendStatus(SEND_PARAMETERS | SEND_DEFFERED);
return 1;
//break;
case S_CMD:
item->setCmd(cmd);
switch (cmd)
{
case CMD_ON:
//retrive stored values
st = item->getVal();
if (st && (st<MIN_VOLUME) /* && send */) st=INIT_VOLUME;
item->setVal(st);
if (st) //Stored smthng
{
item->SendStatus(SEND_COMMAND | SEND_PARAMETERS);
debugSerial<<F("Restored: ")<<st<<endl;
}
else
{
debugSerial<<st<<F(": No stored values - default\n");
// Store
st=100;
item->setVal(st);
item->SendStatus(SEND_COMMAND | SEND_PARAMETERS );
}
if (item->getExt()) item->setExt(millis()+maxOnTime); //Extend motor time
return 1;
case CMD_OFF:
item->SendStatus(SEND_COMMAND);
if (item->getExt()) item->setExt(millis()+maxOnTime); //Extend motor time
return 1;
} //switch cmd
break;
} //switch suffix
debugSerial<<F("Unknown cmd")<<endl;
return 0;
}
#endif

View File

@@ -0,0 +1,39 @@
#pragma once
#include "options.h"
#ifndef MOTOR_DISABLE
#include <abstractout.h>
#include <item.h>
#ifndef POS_ERR
#define POS_ERR 2
#endif
// The number of simultaniusly working motors
#ifndef MOTOR_QUOTE
#define MOTOR_QUOTE 2
#endif
static int8_t motorQuote = MOTOR_QUOTE;
class out_Motor : public abstractOut {
public:
out_Motor(Item * _item):abstractOut(_item){getConfig();};
int Setup() override;
int Poll(short cause) override;
int Stop() override;
int Status() override;
int isActive() override;
int getChanType() override;
int Ctrl(short cmd, short n=0, int * Parameters=NULL, int suffixCode=0, char* subItem=NULL) override;
int8_t pinUp;
int8_t pinDown;
int8_t pinFeedback;
int16_t maxOnTime;
uint16_t feedbackOpen;
uint16_t feedbackClosed;
protected:
void getConfig();
};
#endif

View File

@@ -0,0 +1,336 @@
#ifndef SPILED_DISABLE
#include "modules/out_spiled.h"
#include "Arduino.h"
#include "options.h"
#include "Streaming.h"
#include "item.h"
#include "main.h"
#ifdef ADAFRUIT_LED
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h> // Required for 16 MHz Adafruit Trinket
#endif
Adafruit_NeoPixel *leds = NULL;
#else
#include "FastLED.h"
static CRGB *leds = NULL;
#endif
#define NUM_LEDS 43
static int driverStatus = CST_UNKNOWN;
void out_SPILed::getConfig()
{
pin=item->getArg(0);
if(pin<=0) pin=3;
numLeds=item->getArg(1);
if (numLeds<=0) numLeds=NUM_LEDS;
ledsType=item->getArg(2);
#ifdef ADAFRUIT_LED
if (ledsType<=0) ledsType= NEO_BRG + NEO_KHZ800;
#endif
}
int out_SPILed::Setup()
{
getConfig();
Serial.println("SPI-LED Init");
if (!leds)
{
#ifdef ADAFRUIT_LED
#if defined(__AVR_ATtiny85__) && (F_CPU == 16000000)
clock_prescale_set(clock_div_1);
#endif
leds = new Adafruit_NeoPixel(numLeds, pin, ledsType);
leds->begin();
#else
leds = new CRGB [numLeds]; //Allocate dynamic memory for LED objects
//template< CONTROLLER = TM1809, uint8_t DATA_PIN = pin, EOrder ORDER = BRG >
//FastLED.addLeds<TM1809, pin, BRG>(leds, numLeds);
FastLED.addLeds<CONTROLLER, DATA_PIN, ORDER>(leds, numLeds);
#endif
}
driverStatus = CST_INITIALIZED;
return 1;
}
int out_SPILed::Stop()
{
Serial.println("SPI-LED De-Init");
//FastLED.addLeds<TM1809, DATA_PIN, BRG>(leds, NUM_LEDS);
#ifdef ADAFRUIT_LED
leds->clear();
delete leds;
#else
FastLED.clear(true);
delete [] leds;
#endif
driverStatus = CST_UNKNOWN;
return 1;
}
int out_SPILed::Status()
{
return driverStatus;
}
int out_SPILed::isActive()
{
itemStore st;
st.aslong = item->getVal(); //Restore old params
debugSerial<< F(" val:")<<st.v<<endl;
return st.v;
}
int out_SPILed::Poll(short cause)
{
return 0;
};
int out_SPILed::getChanType()
{
if ((ledsType>>4) == (ledsType>>6))
return CH_RGB;
else
return CH_RGBW;
}
int out_SPILed::PixelCtrl(itemStore *st, short cmd, int from, int to, bool show, bool rgb)
{
//debugSerial<<F("cmd: ")<<cmd<<endl;
#ifdef ADAFRUIT_LED
uint32_t pixel;
#else
CRGB pixel;
#endif
if (!rgb)
{
int Saturation = map(st->s, 0, 100, 0, 255);
int Value = map(st->v, 0, 100, 0, 255);
#ifdef ADAFRUIT_LED
uint16_t Hue = map(st->h, 0, 365, 0, 65535);
pixel = leds->ColorHSV(Hue, Saturation, Value);
#else
int Hue = map(st->h, 0, 365, 0, 255);
pixel = CHSV(Hue, Saturation, Value);
#endif
debugSerial<<F("hsv: ")<<st->h<<F(",")<<st->s<<F(",")<<st->v<<endl;
}
if (to>numLeds-1) to=numLeds-1;
if (from<0) from=0;
for (int i=from;i<=to;i++)
{
switch (cmd) {
case CMD_ON:
#ifdef ADAFRUIT_LED
if (!leds->getPixelColor(i)) leds->setPixelColor(i, leds->Color(255, 255, 255));
#else
if (!leds[i].r && !leds[i].g &&!leds[i].b) leds[i] = CRGB::White;
#endif
break;
case CMD_OFF:
#ifdef ADAFRUIT_LED
leds->setPixelColor(i, leds->Color(0, 0, 0));
#else
leds[i] = CRGB::Black;
#endif
break;
default:
if (rgb)
{
#ifdef ADAFRUIT_LED
leds->setPixelColor(i, leds->Color(st->r,st->g,st->b));
#else
leds[i] = CRGB(st->r,st->g,st->b);
#endif
}
else
{
#ifdef ADAFRUIT_LED
leds->setPixelColor(i, pixel);
#else
leds[i] = pixel;
#endif
}
}
} //for
if (show)
{
#ifdef ADAFRUIT_LED
leds->show();
#else
FastLED.show();
#endif
debugSerial<<F("Show")<<endl;
}
return 1;
}
int out_SPILed::Ctrl(short cmd, short n, int * Parameters, int suffixCode, char* subItem)
{
int chActive = item->isActive();
bool toExecute = (chActive>0);
itemStore st;
if (cmd>0 && !suffixCode) suffixCode=S_CMD; //if some known command find, but w/o correct suffix - got it
int from=0, to=numLeds-1; //All LEDs on the strip by default
// retrive LEDs range from suffix
if (subItem)
{ //Just single LED to control todo - range
// debugSerial<<F("Range:")<<subItem<<endl;
if (sscanf(subItem,"%d-%d",&from,&to) == 1) to=from;
}
debugSerial<<from<<F("-")<<to<<F(" cmd=")<<cmd<<endl;
switch(suffixCode)
{
case S_NOTFOUND:
// turn on and set
toExecute = true;
case S_SET:
case S_HSV:
st.aslong = item->getVal(); //Restore old params
switch (n) //How many parameters are passed?
{
case 1:
st.v = Parameters[0]; //Volume only
if (!st.hsv_flag)
{
st.h = 0; //Filling by default
st.s = 0;
st.hsv_flag = 1; // Mark stored vals as HSV
}
break;
case 2: // Just hue and saturation
st.h = Parameters[0];
st.s = Parameters[1];
st.hsv_flag = 1;
break;
case 3: //complete triplet
st.h = Parameters[0];
st.s = Parameters[1];
st.v = Parameters[2];
st.hsv_flag = 1;
}
PixelCtrl(&st,0,from,to,toExecute);
if (!subItem) //Whole strip
{
item->setVal(st.aslong); //Store
if (!suffixCode)
{
if (chActive>0 && !st.v) item->setCmd(CMD_OFF);
if (chActive==0 && st.v) item->setCmd(CMD_ON);
item->SendStatus(SEND_COMMAND | SEND_PARAMETERS | SEND_DEFFERED);
}
else item->SendStatus(SEND_PARAMETERS | SEND_DEFFERED);
}
return 1;
//break;
case S_RGB:
st.r = Parameters[0];
st.g = Parameters[1];
st.b = Parameters[2];
st.w = 0;
st.hsv_flag = 0;
PixelCtrl(&st,0,from,to,toExecute,true);
//item->setVal(st.aslong); //Store
if (!suffixCode)
{
if (chActive>0 && !st.aslong) item->setCmd(CMD_OFF);
if (chActive==0 && st.aslong) item->setCmd(CMD_ON);
item->SendStatus(SEND_COMMAND | SEND_PARAMETERS | SEND_DEFFERED);
}
else item->SendStatus(SEND_PARAMETERS | SEND_DEFFERED);
return 1;
//break;
case S_CMD:
item->setCmd(cmd);
switch (cmd)
{
case CMD_ON:
/*
if (chActive>0 && send)
{
SendStatus(SEND_COMMAND);
return 1;
}
*/
//retrive stored values
st.aslong = item->getVal();
if (subItem) // LED range, not whole strip
PixelCtrl(&st,CMD_ON,from,to);
else //whole strip
{
if (st.aslong && (st.v<MIN_VOLUME) /* && send */) st.v=INIT_VOLUME;
item->setVal(st.aslong);
if (st.aslong ) //Stored smthng
{
item->SendStatus(SEND_COMMAND | SEND_PARAMETERS);
debugSerial<<F("Restored: ")<<st.h<<F(",")<<st.s<<F(",")<<st.v<<endl;
}
else
{
debugSerial<<st.aslong<<F(": No stored values - default\n");
st.h = 100;
st.s = 0;
st.v = 100;
st.hsv_flag=1;
// Store
item->setVal(st.aslong);
item->SendStatus(SEND_COMMAND | SEND_PARAMETERS );
}
PixelCtrl(&st,0,from,to);
}
return 1;
case CMD_OFF:
if (subItem) // LED range, not whole strip
PixelCtrl(&st,CMD_OFF,from,to);
else
{
st.v=0;
PixelCtrl(&st,0,from,to);
item->SendStatus(SEND_COMMAND);
// if (send) item->publishTopic(item->itemArr->name,"OFF","/cmd");
}
return 1;
} //switch cmd
break;
} //switch suffix
debugSerial<<F("Unknown cmd")<<endl;
return 0;
}
#endif

View File

@@ -0,0 +1,32 @@
#pragma once
#include "options.h"
#ifndef SPILED_DISABLE
#include <abstractout.h>
#include <item.h>
#ifdef ADAFRUIT_LED
#include <Adafruit_NeoPixel.h>
#else
#include "FastLED.h"
#endif
class out_SPILed : public abstractOut {
public:
out_SPILed(Item * _item):abstractOut(_item){getConfig();};
int Setup() override;
int Poll(short cause) override;
int Stop() override;
int Status() override;
int isActive() override;
int getChanType() override;
int Ctrl(short cmd, short n=0, int * Parameters=NULL, int suffixCode=0, char* subItem=NULL) override;
int PixelCtrl(itemStore *st, short cmd, int from =0 , int to = 1024, bool show = 1, bool rgb = 0);
int numLeds;
int8_t pin;
int ledsType;
protected:
void getConfig();
};
#endif

1
lighthub/monitor.bat Normal file
View File

@@ -0,0 +1 @@
pio device monitor -b 115200

View File

@@ -1,18 +0,0 @@
/*
int mqtt::publish(int value)
{};
int mqtt::publish(float value)
{
};
int mqtt::publish(char * value)
{
char addrstr[MQTT_TOPIC_LENGTH];
aJsonObject *emit = aJson.getObjectItem(in, "emit");
strncpy(addrstr,emit->valuestring,sizeof(addrstr));
if (!strchr(addrstr,'/')) setTopic(addrstr,sizeof(addrstr),T_OUT,emit->valuestring);
if mqttClient.connected() mqttClient.publish(addrstr, value, true);
};
*/

View File

@@ -1,13 +1,35 @@
// Configuration of drivers enabled // Configuration of drivers enabled
#ifndef PIO_SRC_REV #define SYSLOG_LOCAL_SOCKET 514
#define PIO_SRC_REV v0.999
#ifndef FASTLED
#define ADAFRUIT_LED
#endif
// ADAFRUIT library allow to dynamically configure SPI LED Strip Parameters
// If not defined ADAFRUIT_LED - FastLED library will be used instead
// And strip type, pin, order must defined on compilation time
#ifndef CONTROLLER
#define CONTROLLER TM1809
#endif #endif
#ifndef DATA_PIN
#define DATA_PIN 4
#endif
#ifndef ORDER
#define ORDER BRG
#endif
#ifndef MODBUS_TX_PIN
#define TXEnablePin 13 #define TXEnablePin 13
#else
#define TXEnablePin MODBUS_TX_PIN
#endif
#define ESP_EEPROM_SIZE 2048 #define ESP_EEPROM_SIZE 2048
#ifndef AVR_DMXOUT_PIN #ifndef AVR_DMXOUT_PIN
#define AVR_DMXOUT_PIN 3 #define AVR_DMXOUT_PIN 18
#endif #endif
#define T_ATTEMPTS 200 #define T_ATTEMPTS 200
@@ -18,8 +40,13 @@
#define THERMO_OVERHEAT_CELSIUS 38. #define THERMO_OVERHEAT_CELSIUS 38.
#define FM_OVERHEAT_CELSIUS 40. #define FM_OVERHEAT_CELSIUS 40.
#define MIN_VOLUME 10 #define MIN_VOLUME 25
#define INIT_VOLUME 50 #define INIT_VOLUME 40
#define MAXFLASHSTR 32
#define PWDFLASHSTR 16
#define EEPROM_SIGNATURE "LHCF"
#define EEPROM_SIGNATURE_LENGTH 4
#define OFFSET_MAC 0 #define OFFSET_MAC 0
#define OFFSET_IP OFFSET_MAC+6 #define OFFSET_IP OFFSET_MAC+6
@@ -27,12 +54,15 @@
#define OFFSET_GW OFFSET_DNS+4 #define OFFSET_GW OFFSET_DNS+4
#define OFFSET_MASK OFFSET_GW+4 #define OFFSET_MASK OFFSET_GW+4
#define OFFSET_CONFIGSERVER OFFSET_MASK+4 #define OFFSET_CONFIGSERVER OFFSET_MASK+4
#define OFFSET_MQTT_PWD OFFSET_CONFIGSERVER+32 #define OFFSET_MQTT_PWD OFFSET_CONFIGSERVER+MAXFLASHSTR
#define EEPROM_offset_NotAlligned OFFSET_MQTT_PWD+16 #define OFFSET_SIGNATURE OFFSET_MQTT_PWD+PWDFLASHSTR
#define EEPROM_offset EEPROM_offset_NotAlligned + (4 -(EEPROM_offset_NotAlligned & 3)) #define EEPROM_offset_NotAlligned OFFSET_SIGNATURE+EEPROM_SIGNATURE_LENGTH
#define EEPROM_offsetJSON EEPROM_offset_NotAlligned + (4 -(EEPROM_offset_NotAlligned & 3))
#define EEPROM_FIX_PART_LEN EEPROM_offsetJSON-OFFSET_MAC
#ifndef INTERVAL_CHECK_INPUT #ifndef INTERVAL_CHECK_INPUT
#define INTERVAL_CHECK_INPUT 50 #define INTERVAL_CHECK_INPUT 15
#endif #endif
#ifndef INTERVAL_CHECK_SENSOR #ifndef INTERVAL_CHECK_SENSOR
@@ -75,19 +105,6 @@
#ifndef HOMETOPIC #ifndef HOMETOPIC
#define HOMETOPIC "myhome" #define HOMETOPIC "myhome"
#endif #endif
/*
#ifndef OUTTOPIC
#define OUTTOPIC "/myhome/s_out/"
#endif
#ifndef CMDTOPIC
#define CMDTOPIC "/myhome/in/command/"
#endif
#ifndef INTOPIC
#define INTOPIC "/myhome/in/"
#endif
*/
//Default output topic //Default output topic
#ifndef OUTTOPIC #ifndef OUTTOPIC
@@ -116,7 +133,7 @@
#define _owire #define _owire
#endif #endif
#ifndef MODBUS_DISABLE #if !(defined (MODBUS_DISABLE) && defined (MBUS_DISABLE))
#define _modbus #define _modbus
#endif #endif
@@ -128,12 +145,16 @@
#define LAN_INIT_DELAY 500 #define LAN_INIT_DELAY 500
#endif #endif
#define DEFAULT_INC_STEP 5
#if defined(ARDUINO_ARCH_AVR) #if defined(ARDUINO_ARCH_AVR)
//All options available //All options available
#ifdef CONTROLLINO #ifdef CONTROLLINO
#define modbusSerial Serial3 #define modbusSerial Serial3
#define AC_Serial Serial2
#else #else
#define modbusSerial Serial2 #define modbusSerial Serial2
#define AC_Serial Serial3
#endif #endif
#define dmxin DMXSerial #define dmxin DMXSerial
#define dmxout DmxSimple #define dmxout DmxSimple
@@ -141,6 +162,7 @@
#if defined(__SAM3X8E__) #if defined(__SAM3X8E__)
#define modbusSerial Serial2 #define modbusSerial Serial2
#define AC_Serial Serial3
#define dmxout DmxDue1 #define dmxout DmxDue1
#define dmxin DmxDue1 #define dmxin DmxDue1
#endif #endif
@@ -154,23 +176,27 @@
#if defined(ARDUINO_ARCH_ESP8266) #if defined(ARDUINO_ARCH_ESP8266)
#undef _dmxin #undef _dmxin
#undef _modbus //#undef _modbus
#ifndef DMX_DISABLE #ifndef DMX_DISABLE
#define _espdmx #define _espdmx
#endif #endif
#define modbusSerial Serial1 #define modbusSerial Serial1
#define AC_Serial Serial1
#endif #endif
#if defined(ARDUINO_ARCH_ESP32) #if defined(ARDUINO_ARCH_ESP32)
#undef _dmxin #undef _dmxin
#undef _modbus //#undef _modbus
#ifndef DMX_DISABLE #ifndef DMX_DISABLE
#define _espdmx #define _espdmx
#endif #endif
//#undef _dmxout //#undef _dmxout
#undef modbusSerial //#undef modbusSerial
#define modbusSerial Serial2
#define AC_Serial Serial2
#endif #endif
#ifndef _dmxout #ifndef _dmxout
@@ -194,16 +220,51 @@
#define strncpy_P strncpy #define strncpy_P strncpy
#endif #endif
#ifndef DMX_SMOOTH_DELAY
#define DMX_SMOOTH_DELAY 10
#endif
//#ifdef M5STACK //#ifdef M5STACK
//#define debugSerial M5.Lcd //#define debugSerial M5.Lcd
//#endif //#endif
#ifndef debugSerial #ifndef debugSerialPort
#define debugSerial Serial #define debugSerialPort Serial
#endif #endif
#ifndef Wiz5500 #ifndef Wiz5500
#define W5100_ETHERNET_SHIELD #define W5100_ETHERNET_SHIELD
#else #else
#define W5500_ETHERNET_SHIELD #define W5500_ETHERNET_SHIELD
#endif #endif
#if defined(ARDUINO_ARCH_AVR)
#define PINS_COUNT NUM_DIGITAL_PINS
#define isAnalogPin(p) ((p >= 54) && (p<=69))
#endif
#if defined(__SAM3X8E__)
#define isAnalogPin(p) (g_APinDescription[p].ulPinAttribute & PIN_ATTR_ANALOG) == PIN_ATTR_ANALOG
#endif
#if defined(ARDUINO_ARCH_STM32)
#define PINS_COUNT NUM_DIGITAL_PINS
#define isAnalogPin(p) ((p >= 44) && (p<=57))
#endif
#if defined(ESP8266)
#define PINS_COUNT NUM_DIGITAL_PINS
#define isAnalogPin(p) ( p ==17 )
#endif
#if defined(ARDUINO_ARCH_ESP32)
#define PINS_COUNT NUM_DIGITAL_PINS
#define isAnalogPin(p) ((p ==4) || (p>=12)&& (p<=15) || (p>=25)&& (p<=27)||(p>=32)&& (p<=33) || (p>=37)&& (p<=38))
#endif
#if defined(NRF5)
#define PINS_COUNT NUM_DIGITAL_PINS
#define isAnalogPin(p) ((p >= 14) && (p<=21))
#endif

View File

@@ -24,6 +24,7 @@ e-mail anklimov@gmail.com
#include <Arduino.h> #include <Arduino.h>
#include "utils.h" #include "utils.h"
#include "options.h" #include "options.h"
#include "main.h"
OneWire *oneWire = NULL; OneWire *oneWire = NULL;
@@ -42,9 +43,13 @@ owChangedType owChanged;
int owUpdate() { int owUpdate() {
#ifndef OWIRE_DISABLE #ifndef OWIRE_DISABLE
unsigned long finish = millis() + OW_UPDATE_INTERVAL; unsigned long finish = millis() + OW_UPDATE_INTERVAL;
short sr; /*
if (oneWire->getError() == DS2482_ERROR_SHORT)
{
debugSerial<<F("1-wire shorted.")<<endl;
return false;
}
*/
Serial.println(F("Searching")); Serial.println(F("Searching"));
if (oneWire) oneWire->reset_search(); if (oneWire) oneWire->reset_search();
for (short i = 0; i < t_count; i++) wstat[i] &= ~SW_FIND; //absent for (short i = 0; i < t_count; i++) wstat[i] &= ~SW_FIND; //absent
@@ -68,7 +73,9 @@ int owUpdate() {
debugSerial.println(); debugSerial.println();
if (term[t_count][0] == 0x28) { if (term[t_count][0] == 0x28) {
sensors->setResolution(term[t_count], TEMPERATURE_PRECISION); sensors->setResolution(term[t_count], TEMPERATURE_PRECISION);
#ifdef DS2482_100_I2C_TO_1W_BRIDGE
oneWire->setStrongPullup(); oneWire->setStrongPullup();
#endif
// sensors.requestTemperaturesByAddress(term[t_count]); // sensors.requestTemperaturesByAddress(term[t_count]);
} }
t_count++; t_count++;
@@ -78,6 +85,7 @@ int owUpdate() {
debugSerial<<F("1-wire count: ")<<t_count<<endl; debugSerial<<F("1-wire count: ")<<t_count<<endl;
#endif #endif
return true;
} }
@@ -94,15 +102,13 @@ int owSetup(owChangedType owCh) {
oneWire = new OneWire (USE_1W_PIN); oneWire = new OneWire (USE_1W_PIN);
#endif #endif
// Pass our oneWire reference to Dallas Temperature. // Pass our oneWire reference to Dallas Temperature.
sensors = new DallasTemperature(oneWire); // sensors = new DallasTemperature(oneWire);
term = new DeviceAddress[t_max]; term = new DeviceAddress[t_max];
//regs = new int [t_max]; //regs = new int [t_max];
wstat = new uint16_t[t_max]; wstat = new uint16_t[t_max];
owChanged = owCh;
#ifdef DS2482_100_I2C_TO_1W_BRIDGE #ifdef DS2482_100_I2C_TO_1W_BRIDGE
Wire.begin(); Wire.begin();
@@ -118,30 +124,42 @@ int owSetup(owChangedType owCh) {
debugSerial.println(F("\tChecking for 1-Wire devices...")); debugSerial.println(F("\tChecking for 1-Wire devices..."));
if (oneWire->wireReset()) if (oneWire->wireReset())
debugSerial.println(F("\tReset done")); debugSerial.println(F("\tReset done"));
sensors->begin();
owChanged = owCh;
//owUpdate();
//debugSerial.println(F("\t1-w Updated"));
sensors->setWaitForConversion(false);
return true; return true;
} }
#endif
debugSerial.println(F("\tDS2482 error")); debugSerial.println(F("\tDS2482 error"));
return false; return false;
// IC Default 9 bit. If you have troubles consider upping it 12. Ups the delay giving the IC more time to process the temperature measurement #else
// software driver
oneWire->reset();
delay(500); delay(500);
return true;
#endif //DS2482-100
#endif #endif //1w is not disabled
return false;
} }
int sensors_loop(void) { int sensors_loop(void) {
if (!sensors) return -1; #ifdef DS2482_100_I2C_TO_1W_BRIDGE
if (oneWire->getError() == DS2482_ERROR_SHORT)
{
debugSerial<<F("1-wire shorted")<<endl;
oneWire->wireReset();
return 10000;
}
#endif
if (!sensors)
{
// Setup sensors library and resolution
sensors = new DallasTemperature(oneWire);
sensors->begin();
// IC Default 9 bit. If you have troubles consider upping it 12. Ups the delay giving the IC more time to process the temperature measurement
for (short i = 0; i < t_count; i++) sensors->setResolution(term[i],TEMPERATURE_PRECISION);
sensors->setWaitForConversion(false);
}
if (si >= t_count) { if (si >= t_count) {
owUpdate(); //every check circle - scan for new devices owUpdate(); //every check circle - scan for new devices
si = 0; si = 0;
@@ -184,17 +202,22 @@ void owAdd(DeviceAddress addr) {
if (t_count>=t_max) return; if (t_count>=t_max) return;
wstat[t_count] = SW_FIND; //Newly detected wstat[t_count] = SW_FIND; //Newly detected
memcpy(term[t_count], addr, 8); memcpy(term[t_count], addr, 8);
//term[t_count]=addr;
debugSerial<<F("dev#")<<t_count<<F(" Addr:"); debugSerial<<F("dev#")<<t_count<<F(" Addr:");
PrintBytes(term[t_count], 8,0); PrintBytes(term[t_count], 8,0);
debugSerial.println(); debugSerial.println();
if (term[t_count][0] == 0x28) { #ifdef DS2482_100_I2C_TO_1W_BRIDGE
sensors->setResolution(term[t_count], TEMPERATURE_PRECISION); if (term[t_count][0] == 0x28)
oneWire->setStrongPullup(); oneWire->setStrongPullup();
// sensors.requestTemperaturesByAddress(term[t_count]); #endif
}
t_count++; t_count++;
#endif #endif
} }
#endif #endif
void setupOwIdle (void (*ptr)())
{
#ifdef DS2482_100_I2C_TO_1W_BRIDGE
if (oneWire) oneWire->idle(ptr);
#endif
}

View File

@@ -1,4 +1,4 @@
/* Copyright © 2017-2018 Andrey Klimov. All rights reserved. /* Copyright © 2017-2020 Andrey Klimov. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@ e-mail anklimov@gmail.com
*/ */
//define APU_OFF //define APU_OFF
#pragma once
#define SW_AUX0 0x40 #define SW_AUX0 0x40
#define SW_AUX1 0x80 #define SW_AUX1 0x80
@@ -52,23 +53,25 @@ e-mail anklimov@gmail.com
#ifndef OWIRE_DISABLE #ifndef OWIRE_DISABLE
#ifndef ARDUINO_ARCH_STM32F1
#include <DS2482_OneWire.h>
#endif
#include <DallasTemperature.h> #include <DallasTemperature.h>
#include "aJSON.h" #include "aJSON.h"
extern aJsonObject *owArr; extern aJsonObject *owArr;
typedef void (*owChangedType) (int , DeviceAddress, float) ; typedef void (*owChangedType) (int , DeviceAddress, float) ;
#ifndef USE_1W_PIN #ifndef USE_1W_PIN
#define DS2482_100_I2C_TO_1W_BRIDGE // HW driver #define DS2482_100_I2C_TO_1W_BRIDGE // HW driver
#include <Wire.h>
#ifndef ARDUINO_ARCH_STM32F1
#include <DS2482_OneWire.h>
#endif
#else
#include <OneWire.h> //Software driver
#define wireReset reset
#define wireSearch search
#endif #endif
#ifdef DS2482_100_I2C_TO_1W_BRIDGE
#include <Wire.h>
#endif
extern OneWire *oneWire; extern OneWire *oneWire;
@@ -86,7 +89,7 @@ extern owChangedType owChanged;
int owUpdate(); int owUpdate();
int owSetup(owChangedType owCh); int owSetup(owChangedType owCh);
void owLoop(); void owLoop();
void owIdle(void) ; void setupOwIdle(void (*)()) ;
int owFind(DeviceAddress addr); int owFind(DeviceAddress addr);
void owAdd (DeviceAddress addr); void owAdd (DeviceAddress addr);

86
lighthub/streamlog.cpp Normal file
View File

@@ -0,0 +1,86 @@
#include "streamlog.h"
#include <Arduino.h>
#include "utils.h"
#if defined (STATUSLED)
extern statusLED LED;
#endif
#ifdef SYSLOG_ENABLE
extern bool syslogInitialized;
Streamlog::Streamlog (HardwareSerial * _serialPort, int _severity , Syslog * _syslog, uint8_t _ledPattern )
{
serialPort=_serialPort;
severity=_severity;
syslog=_syslog;
ledPattern=_ledPattern;
}
#else
Streamlog::Streamlog (HardwareSerial * _serialPort, int _severity, uint8_t _ledPattern)
{
serialPort=_serialPort;
severity=_severity;
}
#endif
void Streamlog::begin(unsigned long speed)
{
if (serialPort) serialPort->begin(speed);
};
void Streamlog::end()
{
if (serialPort) serialPort->end();
};
int Streamlog::available(void)
{
if (serialPort) return serialPort->available();
return 0;
};
int Streamlog::peek(void)
{
if (serialPort) return serialPort->peek();
return 0;
};
int Streamlog::read(void)
{
if (serialPort) return serialPort->read();
return 0;
};
void Streamlog::flush(void)
{
if (serialPort) serialPort->flush();
};
size_t Streamlog::write(uint8_t ch)
{
#ifdef SYSLOG_ENABLE
if (syslogInitialized)
{
if (ch=='\n')
{
logBuffer[logBufferPos]=0;
if (syslog) syslog->log(severity,(char *)logBuffer);
logBufferPos=0;
}
else
{
if (logBufferPos<LOGBUFFER_SIZE-1 && (ch!='\r')) logBuffer[logBufferPos++]=ch;
}
}
#endif
#if defined (STATUSLED)
if ((ch=='\n') && ledPattern) LED.flash(ledPattern);
#endif
if (serialPort) return serialPort->write(ch);
return 1;
};

48
lighthub/streamlog.h Normal file
View File

@@ -0,0 +1,48 @@
#include <Print.h>
#include <HardwareSerial.h>
#include <inttypes.h>
#ifndef LOGBUFFER_SIZE
#define LOGBUFFER_SIZE 80
#endif
#ifdef SYSLOG_ENABLE
#include <Syslog.h>
static char logBuffer[LOGBUFFER_SIZE];
static int logBufferPos=0;
#endif
#define LOG_DEBUG 7
#define LOG_INFO 6
#define LOG_ERROR 3
static uint8_t serialDebugLevel = 7;
static uint8_t udpDebugLevel =7;
class Streamlog : public Print
{
public:
#ifdef SYSLOG_ENABLE
Streamlog (HardwareSerial * _serialPort, int _severity = LOG_DEBUG, Syslog * _syslog = NULL, uint8_t _ledPattern = 0);
#else
Streamlog (HardwareSerial * _serialPort, int _severity = LOG_DEBUG, uint8_t _ledPattern = 0);
#endif
// {serialPort=_serialPort;severity=_severity; syslog=_syslog; }
void begin(unsigned long speed);
void end() ;
int available(void);
int peek(void);
int read(void);
void flush(void);
size_t write(uint8_t ch);
using Print::write; // pull in write(str) and write(buf, size) from Print
operator bool() {return true;};
private:
uint16_t severity;
HardwareSerial *serialPort;
#ifdef SYSLOG_ENABLE
Syslog * syslog;
uint8_t ledPattern;
#endif
};

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