dht support in progress

This commit is contained in:
livello
2018-05-22 23:52:00 +03:00
parent 2ce453db82
commit 119c1082c2
3 changed files with 50 additions and 15 deletions

View File

@@ -91,6 +91,7 @@ aJsonObject *mqttArr = NULL;
aJsonObject *modbusArr = NULL; aJsonObject *modbusArr = NULL;
aJsonObject *owArr = NULL; aJsonObject *owArr = NULL;
aJsonObject *dmxArr = NULL; aJsonObject *dmxArr = NULL;
aJsonObject *dhtArr = NULL;
unsigned long nextPollingCheck = 0; unsigned long nextPollingCheck = 0;
unsigned long nextInputCheck = 0; unsigned long nextInputCheck = 0;
@@ -595,15 +596,18 @@ void cmdFunctionKill(int arg_cnt, char **args) {
void applyConfig() { void applyConfig() {
if (!root) return; if (!root) return;
#ifdef _dmxin #ifdef DHT_ENABLE
int itemsCount; dhtArr = aJson.getObjectItem(root, "dht");
dmxArr = aJson.getObjectItem(root, "dmxin"); #endif
if (dmxArr && (itemsCount = aJson.getArraySize(dmxArr))) { #ifdef _dmxin
DMXinSetup(itemsCount * 4); int itemsCount;
Serial.print(F("DMX in started. Channels:")); dmxArr = aJson.getObjectItem(root, "dmxin");
Serial.println(itemsCount * 4); if (dmxArr && (itemsCount = aJson.getArraySize(dmxArr))) {
} DMXinSetup(itemsCount * 4);
#endif Serial.print(F("DMX in started. Channels:"));
Serial.println(itemsCount * 4);
}
#endif
#ifdef _dmxout #ifdef _dmxout
int maxChannels; int maxChannels;
aJsonObject *dmxoutArr = aJson.getObjectItem(root, "dmx"); aJsonObject *dmxoutArr = aJson.getObjectItem(root, "dmx");
@@ -620,9 +624,6 @@ void applyConfig() {
#ifdef _owire #ifdef _owire
owArr = aJson.getObjectItem(root, "ow"); owArr = aJson.getObjectItem(root, "ow");
#endif
#ifdef _owire
if (owArr && !owReady) { if (owArr && !owReady) {
aJsonObject *item = owArr->child; aJsonObject *item = owArr->child;
owReady = owSetup(&Changed); owReady = owSetup(&Changed);
@@ -687,6 +688,8 @@ void printConfigSummary() {
printBool(mqttArr); printBool(mqttArr);
Serial.print(F("1-wire ")); Serial.print(F("1-wire "));
printBool(owArr); printBool(owArr);
Serial.print(F("dht "));
printBool(dhtArr);
} }
void cmdFunctionLoad(int arg_cnt, char **args) { void cmdFunctionLoad(int arg_cnt, char **args) {

32
my_build_flags.py Normal file
View File

@@ -0,0 +1,32 @@
# from time import time
#
# from SCons.Script import DefaultEnvironment
#
# print("==============================================Custom build flags are:=====================================================")
# #FLAGS="-MY_CONFIG_SERVER=192.168.10.110"
# #FLAGS+=" -WATCH_DOG_TICKER_DISABLE"
# #FLAGS+=" -USE_1W_PIN=12"
# #FLAGS+=" -SD_CARD_INSERTED"
# #FLAGS+=" -SERIAL_BAUD=115200"
# #FLAGS+=" -Wiz5500"
# #FLAGS+=" -DISABLE_FREERAM_PRINT"
# #FLAGS+=" -CUSTOM_FIRMWARE_MAC=C4:3E:1f:03:1B:1B"
# #FLAGS+=" -DMX_DISABLE"
# FLAGS="MODBUS_DISABLE"
# #FLAGS+=" -OWIRE_DISABLE"
# #FLAGS+=" -ARTNET_ENABLE"
# #FLAGS+=" -CONTROLLINO"
# #FLAGS+=" -AVR_DMXOUT_PIN=18"
#
# print(FLAGS)
# print("==============================================Custom build flags END=====================================================")
#
# env = DefaultEnvironment()
# env.Append(CPPDEFINES=['MODBUS_DISABLE=1'])
from time import time
from SCons.Script import DefaultEnvironment
env = DefaultEnvironment()
env.Append(CPPDEFINES=['BUILD_TIMESTAMP=%d' % time()])

View File

@@ -11,8 +11,8 @@
src_dir = lighthub src_dir = lighthub
env_default = env_default =
; megaatmega2560 ; megaatmega2560
; due due
esp8266 ; esp8266
[env:due] [env:due]
platform = atmelsam platform = atmelsam
framework = arduino framework = arduino
@@ -68,7 +68,7 @@ framework = arduino
board = nodemcuv2 board = nodemcuv2
lib_ldf_mode = chain+ lib_ldf_mode = chain+
build_flags = !echo -n "-DPIO_SRC_REV="$(git log --pretty=format:%h_%ad -1 --date=short) build_flags = !echo -n "-DPIO_SRC_REV="$(git log --pretty=format:%h_%ad -1 --date=short)
extra_scripts = pre:my_build_flags.py ;extra_scripts = pre:my_build_flags.py
lib_deps = lib_deps =
https://github.com/anklimov/Arduino-Temperature-Control-Library.git https://github.com/anklimov/Arduino-Temperature-Control-Library.git
https://github.com/anklimov/DS2482_OneWire https://github.com/anklimov/DS2482_OneWire