mirror of
https://github.com/anklimov/lighthub
synced 2025-12-06 11:49:51 +03:00
Merge pull request #19 from livello/patch
clear EEPROM, laninit delay, clean platformio.ini
This commit is contained in:
@@ -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)
|
||||
|
||||

|
||||

|
||||
|
||||
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/)
|
||||
@@ -116,7 +116,6 @@ cp build_flags_template.sh my_build_flags.sh
|
||||
```
|
||||
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
|
||||
@@ -146,7 +145,10 @@ platformio device monitor -b 115200
|
||||
* MODBUS_DISABLE // disable Modbus support
|
||||
* OWIRE_DISABLE // disable OneWire support
|
||||
* ARTNET_ENABLE //Enable Artnet protocol support
|
||||
* AVR_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/)
|
||||
* LAN_INIT_DELAY=2000 // set lan init delay for Wiznet ethernet shield
|
||||
|
||||
|
||||
|
||||
# Default compilation behavior:
|
||||
@@ -162,6 +164,7 @@ platformio device monitor -b 115200
|
||||
* Modbus support enabled
|
||||
* OneWire support enabled
|
||||
* Artnet disabled
|
||||
* LAN_INIT_DELAY=500 //ms
|
||||
* Defailt MQTT input topic: /myhome/in
|
||||
* Default MQTT topic to publish device status: /myhome/s_out
|
||||
* Default Alarm output topic /alarm
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
# nano my_build_flags.sh
|
||||
# and source it
|
||||
# source my_build_flags.sh
|
||||
echo "==============================================Custom build flags are:====================================================="
|
||||
export FLAGS="-DMY_CONFIG_SERVER=lazyhome.ru"
|
||||
export FLAGS="$FLAGS -DWATCH_DOG_TICKER_DISABLE"
|
||||
export FLAGS="$FLAGS -DUSE_1W_PIN=12"
|
||||
@@ -17,5 +18,10 @@
|
||||
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 PLATFORMIO_BUILD_FLAGS="$FLAGS"
|
||||
echo PLATFORMIO_BUILD_FLAGS=$PLATFORMIO_BUILD_FLAGS
|
||||
echo "==============================================Custom build flags END====================================================="
|
||||
unset FLAGS
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
29
config/c4-3e-11-03-1b-1e.config.json
Normal file
29
config/c4-3e-11-03-1b-1e.config.json
Normal file
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"mqtt":["garden","192.168.10.115",1883,"test","test"],
|
||||
"ow":{
|
||||
"28FFADCE601705A3":{"emit":"t_soil1","item":"h_relay6"},
|
||||
"286164123FF96F55":{"emit":"t_soil2"},
|
||||
"28FFEF6D60170335":{"emit":"t_soil3"}
|
||||
},
|
||||
"items":{
|
||||
"h_relay1":[6,39,1,1],
|
||||
"h_relay2":[6,38,1,1],
|
||||
"h_relay3":[6,37,1,1],
|
||||
"h_relay4":[6,36,1,1],
|
||||
"h_relay5":[6,35,1,1],
|
||||
"h_relay6":[5,34,23],
|
||||
"h_relay7":[6,33,1,1],
|
||||
"h_relay8":[6,32,1,1],
|
||||
"h_auto":[6,29,1,1]
|
||||
},
|
||||
"in":{
|
||||
"40":{"emit":"/garden/s_in/1"},
|
||||
"41":{"emit":"/garden/s_in/2"},
|
||||
"42":{"emit":"/garden/s_in/3"},
|
||||
"43":{"emit":"/garden/s_in/4"},
|
||||
"44":{"emit":"/garden/s_in/5"},
|
||||
"45":{"emit":"/garden/s_in/6"},
|
||||
"46":{"emit":"/garden/s_in/7"},
|
||||
"47":{"emit":"/garden/s_in/8"}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 178 KiB After Width: | Height: | Size: 178 KiB |
@@ -297,7 +297,8 @@ if((wifiMulti.run() == WL_CONNECTED)) lanStatus=1;
|
||||
|
||||
|
||||
if (res == 0) {
|
||||
Serial.println(F("Failed to configure Ethernet using DHCP"));
|
||||
Serial.println(F("Failed to configure Ethernet using DHCP. You can set ip manually!"));
|
||||
Serial.print(F("'ip [ip[,dns[,gw[,subnet]]]]' - set static IP\n"));
|
||||
lanStatus = -10;
|
||||
lanCheck = millis() + 60000;
|
||||
} else {
|
||||
@@ -577,7 +578,8 @@ void cmdFunctionHelp(int arg_cnt, char **args)
|
||||
"'get' [config addr]' - get config from pre-configured URL and store addr\n"
|
||||
"'load' - load config from NVRAM\n"
|
||||
"'pwd' - define MQTT password\n"
|
||||
"'kill' - test watchdog"));
|
||||
"'kill' - test watchdog\n"
|
||||
"'clear' - clear EEPROM"));
|
||||
}
|
||||
|
||||
void cmdFunctionKill(int arg_cnt, char **args) {
|
||||
@@ -783,6 +785,13 @@ void cmdFunctionIp(int arg_cnt, char **args)
|
||||
Serial.println(F("Saved"));
|
||||
}
|
||||
|
||||
void cmdFunctionClearEEPROM(int arg_cnt, char **args){
|
||||
for (int i = 0; i < 512; i++)
|
||||
EEPROM.write(i, 0);
|
||||
Serial.println(F("EEPROM cleared"));
|
||||
|
||||
}
|
||||
|
||||
void cmdFunctionPwd(int arg_cnt, char **args)
|
||||
//(char* tokens)
|
||||
{ char empty[]="";
|
||||
@@ -990,7 +999,6 @@ void postTransmission() {
|
||||
digitalWrite(TXEnablePin, 0);
|
||||
#endif
|
||||
}
|
||||
//#define PIO_SRC_REV commit 8034a6b765229d94a94d90fd08dd9588acf5f3da Author: livello <livello@bk.ru> Date: Wed Mar 28 02:35:50 2018 +0300 refactoring
|
||||
|
||||
void setup_main() {
|
||||
setupCmdArduino();
|
||||
@@ -1005,7 +1013,6 @@ void setup_main() {
|
||||
#endif
|
||||
|
||||
setupMacAddress();
|
||||
|
||||
loadConfigFromEEPROM(0, NULL);
|
||||
|
||||
#ifdef _modbus
|
||||
@@ -1019,7 +1026,6 @@ pinMode(TXEnablePin, OUTPUT);
|
||||
#endif
|
||||
modbusSerial.begin(MODBUS_SERIAL_BAUD);
|
||||
node.idle(&modbusIdle);
|
||||
// Callbacks allow us to configure the RS485 transceiver correctly
|
||||
node.preTransmission(preTransmission);
|
||||
node.postTransmission(postTransmission);
|
||||
#endif
|
||||
@@ -1040,13 +1046,16 @@ pinMode(TXEnablePin, OUTPUT);
|
||||
SPI.begin();
|
||||
while (Ethernet.maintain() == NO_LINK && millis()<3000UL) {delay(500);Serial.print(F("."));}
|
||||
*/
|
||||
delay(500); //Wiz5500
|
||||
delay(LAN_INIT_DELAY);//for LAN-shield initializing
|
||||
//TODO: checkForRemoteSketchUpdate();
|
||||
}
|
||||
|
||||
void printFirmwareVersionAndBuildOptions() {
|
||||
Serial.print(F("\nLazyhome.ru LightHub controller "));
|
||||
Serial.println(F(QUOTE(PIO_SRC_REV)));
|
||||
#ifdef CONTROLLINO
|
||||
Serial.println(F("(+)CONTROLLINO"));
|
||||
#endif
|
||||
#ifdef WATCH_DOG_TICKER_DISABLE
|
||||
Serial.println(F("(-)WATCHDOG"));
|
||||
#else
|
||||
@@ -1134,6 +1143,7 @@ void setupCmdArduino() {
|
||||
cmdAdd("req", cmdFunctionReq);
|
||||
cmdAdd("ip", cmdFunctionIp);
|
||||
cmdAdd("pwd", cmdFunctionPwd);
|
||||
cmdAdd("clear",cmdFunctionClearEEPROM);
|
||||
}
|
||||
|
||||
void loop_main() {
|
||||
|
||||
@@ -81,6 +81,10 @@
|
||||
#define _artnet
|
||||
#endif
|
||||
|
||||
#ifndef LAN_INIT_DELAY
|
||||
#define LAN_INIT_DELAY 500
|
||||
#endif
|
||||
|
||||
#if defined(ESP8266)
|
||||
#define __ESP__
|
||||
#endif
|
||||
|
||||
@@ -10,19 +10,15 @@
|
||||
[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)
|
||||
lib_deps =
|
||||
https://github.com/sebnil/DueFlashStorage
|
||||
https://github.com/anklimov/Arduino-Temperature-Control-Library.git
|
||||
@@ -33,12 +29,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 +42,7 @@ 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)
|
||||
lib_deps =
|
||||
https://github.com/anklimov/Arduino-Temperature-Control-Library.git
|
||||
https://github.com/anklimov/DS2482_OneWire
|
||||
@@ -57,90 +53,20 @@ 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
|
||||
|
||||
|
||||
[env:esp8266]
|
||||
platform = espressif8266
|
||||
framework = arduino
|
||||
board = nodemcuv2
|
||||
lib_ldf_mode = chain+
|
||||
build_flags = !echo -n "-DPIO_SRC_REV="$(git log --pretty=format:%h_%ad -1 --date=short)
|
||||
lib_deps =
|
||||
https://github.com/anklimov/Arduino-Temperature-Control-Library.git
|
||||
https://github.com/anklimov/DS2482_OneWire
|
||||
|
||||
Reference in New Issue
Block a user