diff --git a/README.md b/README.md index 499602c..2be4eed 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Lighthub allows connecting together: * Modbus RTU devices (Currently, are deployed two types of Modbus devices: AC Dimmer and Ventilation set (Based on [Vacon 10 controller](http://files.danfoss.com/download/Drives/Vacon-10-Quick-Guide-DPD00714F1-UK.pdf)) * Simple DMX wall sensor panel [like this](https://aliexpress.com/item/New-Ltech-D8-LED-rgb-RGBW-touch-panel-controller-DMX512-controller-DC12-24V-4-zones-4/32800199589.html) -![alt text](LightHub.png "LightHub application diagram") +![alt text](docs/LightHubAppDiagram.png "LightHub application diagram") Where is possible both, to configure local control/mapping between inputs and outputs (light, floor heating thermostats) and remote control from MQTT enabled software. At the moment, LightHub tested with following set of complementary free software: * [Openhab or Openhab2 Smarthome software](http://www.openhab.org/) @@ -110,13 +110,9 @@ pio init --ide [atom|clion|codeblocks|eclipse|emacs|netbeans|qtcreator|sublimete ``` Set custom build flags. first make your own copy of template ```bash -cp build_flags_template.sh my_build_flags.sh +cp custom_build_flags_template.py my_custom_build_flags.py ``` then edit, change or comment unnecessary sections and source it -```bash -nano my_build_flags.sh -source my_build_flags.sh -``` build and upload firmware for due|megaatmega2560|esp8266 board ```bash pio run -e due|megaatmega2560|esp8266 -t upload @@ -144,9 +140,11 @@ platformio device monitor -b 115200 * MODBUS_DISABLE // disable Modbus support * OWIRE_DISABLE // disable OneWire support * ARTNET_ENABLE //Enable Artnet protocol support +* DAVR_DMXOUT_PIN=18 // Set Pin for DMXOUT on megaatmega2560 * CONTROLLINO //Change Modbus port, direction pins and Wiznet SS pins to be working on [Controllino](http://controllino.biz/) + # Default compilation behavior: * Config server: lazyhome.ru * Watchdog enabled diff --git a/build_flags_template.sh b/build_flags_template.sh deleted file mode 100644 index 0e97a40..0000000 --- a/build_flags_template.sh +++ /dev/null @@ -1,21 +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="-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:00" - export FLAGS="$FLAGS -DDMX_DISABLE" - export FLAGS="$FLAGS -DMODBUS_DISABLE" - export FLAGS="$FLAGS -DOWIRE_DISABLE" - export PLATFORMIO_BUILD_FLAGS="$FLAGS" - unset FLAGS \ No newline at end of file diff --git a/custom_build_flags_template.py b/custom_build_flags_template.py new file mode 100644 index 0000000..c8d2f5a --- /dev/null +++ b/custom_build_flags_template.py @@ -0,0 +1,25 @@ +# usage: +# first make your own copy of template +# cp custom_build_flags_template.py my_custom_build_flags.py +# then edit, change or comment something + +import os +print("==============================================Custom build flags are:=====================================================") +FLAGS="-DMY_CONFIG_SERVER=lazyhome.ru" +FLAGS+=" -DWATCH_DOG_TICKER_DISABLE" +FLAGS+=" -DUSE_1W_PIN=12" +FLAGS+=" -DSD_CARD_INSERTED" +FLAGS+=" -DSERIAL_BAUD=115200" +FLAGS+=" -DWiz5500" +FLAGS+=" -DDISABLE_FREERAM_PRINT" +FLAGS+=" -DCUSTOM_FIRMWARE_MAC=de:ad:be:ef:fe:00" +FLAGS+=" -DDMX_DISABLE" +FLAGS+=" -DMODBUS_DISABLE" +FLAGS+=" -DOWIRE_DISABLE" +FLAGS+=" -DARTNET_ENABLE" +FLAGS+=" -DCONTROLLINO" +FLAGS+=" -DAVR_DMXOUT_PIN=18" + +print(FLAGS) +print("==============================================Custom build flags END=====================================================") +os.environ["PLATFORMIO_BUILD_FLAGS"] = FLAGS \ No newline at end of file diff --git a/LightHub.png b/docs/LightHubAppDiagram.png similarity index 100% rename from LightHub.png rename to docs/LightHubAppDiagram.png diff --git a/platformio.ini b/platformio.ini index 0df0f79..5e45e25 100644 --- a/platformio.ini +++ b/platformio.ini @@ -10,19 +10,16 @@ [platformio] src_dir = lighthub env_default = -; due-5500 -; controllino ; megaatmega2560 - megaatmega2560-5500 -; due + due ; esp8266 - [env:due] platform = atmelsam framework = arduino board = due lib_ldf_mode = chain+ -build_flags = !echo -n "-DPIO_SRC_REV="$(git rev-parse --short HEAD) +build_flags = !echo -n "-DPIO_SRC_REV="$(git log --pretty=format:%h_%ad -1 --date=short) +extra_scripts = pre:my_custom_build_flags.py lib_deps = https://github.com/sebnil/DueFlashStorage https://github.com/anklimov/Arduino-Temperature-Control-Library.git @@ -33,12 +30,12 @@ lib_deps = https://github.com/anklimov/CmdArduino https://github.com/anklimov/ModbusMaster https://github.com/anklimov/Ethernet -; https://github.com/PaulStoffregen/SPI.git + https://github.com/anklimov/Ethernet2 https://github.com/knolleary/pubsubclient.git https://github.com/anklimov/Artnet.git FastLED - 161 - 322 + SD + SdFat [env:megaatmega2560] @@ -46,7 +43,8 @@ platform = atmelavr board = megaatmega2560 framework = arduino ;lib_ldf_mode = chain+ -build_flags = !echo -n "-DPIO_SRC_REV="$(git rev-parse --short HEAD) +build_flags = !echo -n "-DPIO_SRC_REV="$(git log --pretty=format:%h_%ad -1 --date=short) +extra_scripts = pre:my_custom_build_flags.py lib_deps = https://github.com/anklimov/Arduino-Temperature-Control-Library.git https://github.com/anklimov/DS2482_OneWire @@ -57,90 +55,21 @@ lib_deps = https://github.com/anklimov/ModbusMaster https://github.com/anklimov/DMXSerial https://github.com/anklimov/Ethernet - https://github.com/PaulStoffregen/SPI.git - https://github.com/knolleary/pubsubclient.git - https://github.com/anklimov/Artnet.git - FastLED - ; 161 - ; 322 - -[env:controllino] -platform = atmelavr -board = megaatmega2560 -framework = arduino -build_flags = !echo -n "-DPIO_SRC_REV="$(git rev-parse --short HEAD) -build_flags = -D CONTROLLINO -D CUSTOM_FIRMWARE_MAC=de:ad:be:ef:fe:07 -lib_deps = - https://github.com/anklimov/Arduino-Temperature-Control-Library.git - https://github.com/anklimov/DS2482_OneWire - https://github.com/anklimov/DmxSimple - https://github.com/anklimov/httpClient - https://github.com/anklimov/aJson - https://github.com/anklimov/CmdArduino - https://github.com/anklimov/ModbusMaster - https://github.com/anklimov/DMXSerial - https://github.com/anklimov/Ethernet - https://github.com/PaulStoffregen/SPI.git - https://github.com/knolleary/pubsubclient.git - https://github.com/anklimov/Artnet.git - FastLED - ; 161 - ; 322 - -[env:due-5500] -platform = atmelsam -framework = arduino -board = due -lib_ldf_mode = chain+ -build_flags = !echo -n "-DPIO_SRC_REV="$(git rev-parse --short HEAD) -build_flags = -D Wiz5500 -D ARTNET_ENABLE -lib_deps = - https://github.com/sebnil/DueFlashStorage - https://github.com/anklimov/Arduino-Temperature-Control-Library.git - https://github.com/anklimov/DS2482_OneWire - https://github.com/anklimov/DmxDue - https://github.com/anklimov/ArduinoHttpClient - https://github.com/anklimov/aJson - https://github.com/anklimov/CmdArduino - https://github.com/anklimov/ModbusMaster - https://github.com/anklimov/Ethernet2 -; https://github.com/PaulStoffregen/SPI.git - https://github.com/knolleary/pubsubclient.git - https://github.com/anklimov/Artnet.git - FastLED -; 161 -; 322 - -[env:megaatmega2560-5500] -platform = atmelavr -board = megaatmega2560 -framework = arduino -lib_ldf_mode = chain+ -build_flags = !echo -n "-DPIO_SRC_REV="$(git rev-parse --short HEAD) -build_flags = -D Wiz5500 -D AVR_DMXOUT_PIN=18 -lib_deps = - https://github.com/anklimov/Arduino-Temperature-Control-Library.git - https://github.com/anklimov/DS2482_OneWire - https://github.com/anklimov/DmxSimple - https://github.com/anklimov/httpClient - https://github.com/anklimov/aJson - https://github.com/anklimov/CmdArduino - https://github.com/anklimov/ModbusMaster - https://github.com/anklimov/DMXSerial https://github.com/anklimov/Ethernet2 https://github.com/PaulStoffregen/SPI.git https://github.com/knolleary/pubsubclient.git https://github.com/anklimov/Artnet.git FastLED EEPROM - ; 161 - ; 322 + +extra_scripts = pre:my_custom_build_flags.py [env:esp8266] platform = espressif8266 framework = arduino board = nodemcuv2 lib_ldf_mode = chain+ +extra_scripts = pre:my_custom_build_flags.py lib_deps = https://github.com/anklimov/Arduino-Temperature-Control-Library.git https://github.com/anklimov/DS2482_OneWire