mirror of
https://github.com/anklimov/lighthub
synced 2025-12-06 11:49:51 +03:00
Merge pull request #26 from livello/IS-ENC
Counters input support, up to 6 encoders on mega and due. Syslog, ESP32
This commit is contained in:
8
.idea/markdown-exported-files.xml
generated
Normal file
8
.idea/markdown-exported-files.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="MarkdownExportedFiles">
|
||||||
|
<htmlFiles />
|
||||||
|
<imageFiles />
|
||||||
|
<otherFiles />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
@@ -1,32 +1,28 @@
|
|||||||
#! /bin/bash
|
#! /bin/bash
|
||||||
# usage:
|
# usage:
|
||||||
# first make your own copy of template
|
# first make your own copy of template
|
||||||
# cp build_flags_template.sh my_build_flags.sh
|
# cp build_flags_template.sh build_flags_ENVNAME.sh
|
||||||
# then edit, change or comment something
|
# then edit, change or comment something
|
||||||
# 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="-DMY_CONFIG_SERVER=lazyhome.ru"
|
||||||
export FLAGS="$FLAGS -DWATCH_DOG_TICKER_DISABLE"
|
#export FLAGS="$FLAGS -DWATCH_DOG_TICKER_DISABLE"
|
||||||
export FLAGS="$FLAGS -DUSE_1W_PIN=12"
|
#export FLAGS="$FLAGS -DUSE_1W_PIN=12"
|
||||||
export FLAGS="$FLAGS -DSD_CARD_INSERTED"
|
#export FLAGS="$FLAGS -DSD_CARD_INSERTED"
|
||||||
export FLAGS="$FLAGS -DSERIAL_BAUD=115200"
|
export FLAGS="$FLAGS -DSERIAL_BAUD=115200"
|
||||||
export FLAGS="$FLAGS -DWiz5500"
|
#export FLAGS="$FLAGS -DWiz5500"
|
||||||
export FLAGS="$FLAGS -DDISABLE_FREERAM_PRINT"
|
#export FLAGS="$FLAGS -DDISABLE_FREERAM_PRINT"
|
||||||
export FLAGS="$FLAGS -DCUSTOM_FIRMWARE_MAC=de:ad:be:ef:fe:00"
|
export FLAGS="$FLAGS -DCUSTOM_FIRMWARE_MAC=de:ad:be:ef:fe:00"
|
||||||
export FLAGS="$FLAGS -DDMX_DISABLE"
|
# export FLAGS="$FLAGS -DDMX_DISABLE"
|
||||||
export FLAGS="$FLAGS -DMODBUS_DISABLE"
|
# export FLAGS="$FLAGS -DMODBUS_DISABLE"
|
||||||
export FLAGS="$FLAGS -DOWIRE_DISABLE"
|
# export FLAGS="$FLAGS -DOWIRE_DISABLE"
|
||||||
export FLAGS="$FLAGS -DAVR_DMXOUT_PIN=18"
|
# export FLAGS="$FLAGS -DAVR_DMXOUT_PIN=18"
|
||||||
export FLAGS="$FLAGS -DLAN_INIT_DELAY=2000"
|
# export FLAGS="$FLAGS -DLAN_INIT_DELAY=2000"
|
||||||
export FLAGS="$FLAGS -DCONTROLLINO"
|
# export FLAGS="$FLAGS -DCONTROLLINO"
|
||||||
export FLAGS="$FLAGS -DESP_WIFI_AP=MYAP"
|
# export FLAGS="$FLAGS -DESP_WIFI_AP=MYAP"
|
||||||
export FLAGS="$FLAGS -DESP_WIFI_PWD=MYPWD"
|
# export FLAGS="$FLAGS -DESP_WIFI_PWD=MYPWD"
|
||||||
export FLAGS="$FLAGS -DDHT_DISABLE"
|
# export FLAGS="$FLAGS -DWIFI_MANAGER_DISABLE"
|
||||||
export FLAGS="$FLAGS -DRESET_PIN=5"
|
# export FLAGS="$FLAGS -DDHT_DISABLE"
|
||||||
export FLAGS="$FLAGS -DDHCP_RETRY_INTERVAL=60000"
|
# export FLAGS="$FLAGS -DRESET_PIN=5"
|
||||||
export PLATFORMIO_BUILD_FLAGS="$FLAGS"
|
# export FLAGS="$FLAGS -DDHCP_RETRY_INTERVAL=60000"
|
||||||
echo PLATFORMIO_BUILD_FLAGS=$PLATFORMIO_BUILD_FLAGS
|
# export FLAGS="$FLAGS -DRESTART_LAN_ON_MQTT_ERRORS"
|
||||||
echo "==============================================Custom build flags END====================================================="
|
export FLAGS="$FLAGS -DPIO_SRC_REV="$(git log --pretty=format:%h_%ad -1 --date=short)
|
||||||
unset FLAGS
|
echo $FLAGS
|
||||||
@@ -28,7 +28,7 @@ e-mail anklimov@gmail.com
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__ESP__)
|
#if defined(ESP8266)
|
||||||
#ifndef DMX_DISABLE
|
#ifndef DMX_DISABLE
|
||||||
DMXESPSerial dmxout;
|
DMXESPSerial dmxout;
|
||||||
#endif
|
#endif
|
||||||
@@ -236,7 +236,7 @@ void DMXoutSetup(int channels)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if defined(__ESP__)
|
#if defined(ESP8266)
|
||||||
dmxout.init(channels);
|
dmxout.init(channels);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ e-mail anklimov@gmail.com
|
|||||||
#define DmxWrite DmxSimple.write
|
#define DmxWrite DmxSimple.write
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__ESP__)
|
#if defined(ESP8266)
|
||||||
#include <ESPDMX.h>
|
#include <ESPDMX.h>
|
||||||
extern DMXESPSerial dmxout;
|
extern DMXESPSerial dmxout;
|
||||||
#define DmxWrite dmxout.write
|
#define DmxWrite dmxout.write
|
||||||
|
|||||||
@@ -23,12 +23,35 @@ e-mail anklimov@gmail.com
|
|||||||
#include <PubSubClient.h>
|
#include <PubSubClient.h>
|
||||||
|
|
||||||
#ifndef DHT_DISABLE
|
#ifndef DHT_DISABLE
|
||||||
|
#if defined(ESP8266) || defined(ARDUINO_ARCH_ESP32)
|
||||||
|
#include <DHTesp.h>
|
||||||
|
#else
|
||||||
#include "DHT.h"
|
#include "DHT.h"
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
extern PubSubClient mqttClient;
|
extern PubSubClient mqttClient;
|
||||||
//DHT dht();
|
|
||||||
|
|
||||||
|
static volatile unsigned long nextPollMillisValue[5];
|
||||||
|
static volatile int nextPollMillisPin[5] = {0,0,0,0,0};
|
||||||
|
|
||||||
|
#if defined(__AVR__)
|
||||||
|
static volatile long counter_value[6];
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(ESP8266)
|
||||||
|
static volatile long counter_value[6];
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(ARDUINO_ARCH_ESP32)
|
||||||
|
static volatile long counter_value[6];
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__SAM3X8E__) || defined(ARDUINO_ARCH_STM32F1)
|
||||||
|
static short counter_irq_map[54];
|
||||||
|
static long counter_value[54];
|
||||||
|
static int counters_count;
|
||||||
|
#endif
|
||||||
Input::Input(char * name) //Constructor
|
Input::Input(char * name) //Constructor
|
||||||
{
|
{
|
||||||
if (name)
|
if (name)
|
||||||
@@ -39,13 +62,13 @@ Input::Input(char * name) //Constructor
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Input::Input(int pin) //Constructor
|
Input::Input(int pin)
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Input::Input(aJsonObject * obj) //Constructor
|
Input::Input(aJsonObject * obj)
|
||||||
{
|
{
|
||||||
inputObj= obj;
|
inputObj= obj;
|
||||||
Parse();
|
Parse();
|
||||||
@@ -68,9 +91,9 @@ void Input::Parse()
|
|||||||
aJsonObject *s;
|
aJsonObject *s;
|
||||||
|
|
||||||
s = aJson.getObjectItem(inputObj, "T");
|
s = aJson.getObjectItem(inputObj, "T");
|
||||||
if (s) inType = s->valueint;
|
if (s) inType = static_cast<uint8_t>(s->valueint);
|
||||||
|
|
||||||
pin = atoi(inputObj->name);
|
pin = static_cast<uint8_t>(atoi(inputObj->name));
|
||||||
|
|
||||||
s = aJson.getObjectItem(inputObj, "S");
|
s = aJson.getObjectItem(inputObj, "S");
|
||||||
if (!s) {
|
if (!s) {
|
||||||
@@ -90,24 +113,115 @@ int Input::poll() {
|
|||||||
if (!isValid()) return -1;
|
if (!isValid()) return -1;
|
||||||
if (inType & IN_DHT22)
|
if (inType & IN_DHT22)
|
||||||
dht22Poll();
|
dht22Poll();
|
||||||
/* example
|
else if (inType & IN_COUNTER)
|
||||||
else if (inType & IN_ANALOG)
|
counterPoll();
|
||||||
analogPoll(); */
|
else if (inType & IN_UPTIME)
|
||||||
|
uptimePoll();
|
||||||
else
|
else
|
||||||
contactPoll();
|
contactPoll();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Input::counterPoll() {
|
||||||
|
if(nextPollTime()>millis())
|
||||||
|
return;
|
||||||
|
if (store->logicState == 0) {
|
||||||
|
#if defined(__AVR__)
|
||||||
|
#define interrupt_number pin
|
||||||
|
if (interrupt_number >= 0 && interrupt_number < 6) {
|
||||||
|
const short mega_interrupt_array[6] = {2, 3, 21, 20, 19, 18};
|
||||||
|
short real_pin = mega_interrupt_array[interrupt_number];
|
||||||
|
attachInterruptPinIrq(real_pin,interrupt_number);
|
||||||
|
} else {
|
||||||
|
Serial.print(F("IRQ:"));
|
||||||
|
Serial.print(pin);
|
||||||
|
Serial.print(F(" Counter type. INCORRECT Interrupt number!!!"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__SAM3X8E__)
|
||||||
|
attachInterruptPinIrq(pin,counters_count);
|
||||||
|
counter_irq_map[counters_count]=pin;
|
||||||
|
counters_count++;
|
||||||
|
#endif
|
||||||
|
store->logicState = 1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
long counterValue = counter_value[pin];
|
||||||
|
Serial.print(F("IN:"));Serial.print(pin);Serial.print(F(" Counter type. val="));Serial.print(counterValue);
|
||||||
|
|
||||||
|
aJsonObject *emit = aJson.getObjectItem(inputObj, "emit");
|
||||||
|
if (emit) {
|
||||||
|
char valstr[10];
|
||||||
|
char addrstr[100] = "";
|
||||||
|
strcat(addrstr, emit->valuestring);
|
||||||
|
sprintf(valstr, "%d", counterValue);
|
||||||
|
mqttClient.publish(addrstr, valstr);
|
||||||
|
setNextPollTime(millis() + DHT_POLL_DELAY_DEFAULT);
|
||||||
|
Serial.print(F(" NextPollMillis="));Serial.println(nextPollTime());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Serial.print(F(" No emit data!"));
|
||||||
|
}
|
||||||
|
|
||||||
|
void Input::attachInterruptPinIrq(int realPin, int irq) {
|
||||||
|
pinMode(realPin, INPUT);
|
||||||
|
int real_irq;
|
||||||
|
#if defined(__AVR__)
|
||||||
|
real_irq = irq;
|
||||||
|
#endif
|
||||||
|
#if defined(__SAM3X8E__)
|
||||||
|
real_irq = realPin;
|
||||||
|
#endif
|
||||||
|
switch(irq){
|
||||||
|
case 0:
|
||||||
|
attachInterrupt(real_irq, onCounterChanged0, RISING);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
attachInterrupt(real_irq, onCounterChanged1, RISING);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
attachInterrupt(real_irq, onCounterChanged2, RISING);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
attachInterrupt(real_irq, onCounterChanged3, RISING);
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
attachInterrupt(real_irq, onCounterChanged4, RISING);
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
attachInterrupt(real_irq, onCounterChanged5, RISING);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Serial.print(F("Incorrect irq:"));Serial.println(irq);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Input::dht22Poll() {
|
void Input::dht22Poll() {
|
||||||
#ifndef DHT_DISABLE
|
#ifndef DHT_DISABLE
|
||||||
if (store->nextPollMillis > millis())
|
if(nextPollTime()>millis())
|
||||||
return;
|
return;
|
||||||
|
#if defined(ESP8266) || defined(ARDUINO_ARCH_ESP32)
|
||||||
|
DHTesp dhtSensor;
|
||||||
|
dhtSensor.setup(pin, DHTesp::DHT22);
|
||||||
|
TempAndHumidity dhtSensorData = dhtSensor.getTempAndHumidity();
|
||||||
|
float temp = dhtSensorData.temperature;
|
||||||
|
float humidity = dhtSensorData.humidity;
|
||||||
|
#else
|
||||||
DHT dht(pin, DHT22);
|
DHT dht(pin, DHT22);
|
||||||
float temp = dht.readTemperature();
|
float temp = dht.readTemperature();
|
||||||
float humidity = dht.readHumidity();
|
float humidity = dht.readHumidity();
|
||||||
|
#endif
|
||||||
aJsonObject *emit = aJson.getObjectItem(inputObj, "emit");
|
aJsonObject *emit = aJson.getObjectItem(inputObj, "emit");
|
||||||
Serial.print(F("IN:"));Serial.print(pin);Serial.print(F(" DHT22 type. T="));Serial.print(temp);
|
Serial.print(F("IN:"));
|
||||||
Serial.print(F("°C H="));Serial.print(humidity);Serial.print(F("%"));
|
Serial.print(pin);
|
||||||
|
Serial.print(F(" DHT22 type. T="));
|
||||||
|
Serial.print(temp);
|
||||||
|
Serial.print(F("°C H="));
|
||||||
|
Serial.print(humidity);
|
||||||
|
Serial.print(F("%"));
|
||||||
if (emit && temp && humidity && temp == temp && humidity == humidity) {
|
if (emit && temp && humidity && temp == temp && humidity == humidity) {
|
||||||
char valstr[10];
|
char valstr[10];
|
||||||
char addrstr[100] = "";
|
char addrstr[100] = "";
|
||||||
@@ -118,34 +232,66 @@ void Input::dht22Poll() {
|
|||||||
addrstr[strlen(addrstr) - 1] = 'H';
|
addrstr[strlen(addrstr) - 1] = 'H';
|
||||||
printFloatValueToStr(humidity, valstr);
|
printFloatValueToStr(humidity, valstr);
|
||||||
mqttClient.publish(addrstr, valstr);
|
mqttClient.publish(addrstr, valstr);
|
||||||
store->nextPollMillis = millis() + DHT_POLL_DELAY_DEFAULT;
|
setNextPollTime(millis() + DHT_POLL_DELAY_DEFAULT);
|
||||||
Serial.print(" NextPollMillis=");Serial.println(store->nextPollMillis);
|
Serial.print(" NextPollMillis=");
|
||||||
}
|
Serial.println(nextPollTime());
|
||||||
else
|
} else
|
||||||
store->nextPollMillis = millis() + DHT_POLL_DELAY_DEFAULT/3;
|
setNextPollTime(millis() + DHT_POLL_DELAY_DEFAULT / 3);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Input::printFloatValueToStr(float temp, char *valstr) {
|
unsigned long Input::nextPollTime() const {
|
||||||
#if defined(__ESP__)
|
for(int i=0;i<5;i++){
|
||||||
sprintf(valstr, "%2.1f", temp);
|
if(nextPollMillisPin[i]==pin)
|
||||||
|
return nextPollMillisValue[i];
|
||||||
|
else if(nextPollMillisPin[i]==0) {
|
||||||
|
nextPollMillisPin[i]=pin;
|
||||||
|
return nextPollMillisValue[i] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Input::setNextPollTime(unsigned long pollTime) {
|
||||||
|
for (int i = 0; i < 5; i++) {
|
||||||
|
if (nextPollMillisPin[i] == pin) {
|
||||||
|
nextPollMillisValue[i] = pollTime;
|
||||||
|
return;
|
||||||
|
} else if (nextPollMillisPin[i] == 0) {
|
||||||
|
nextPollMillisPin[i] == pin;
|
||||||
|
nextPollMillisValue[i] = pollTime;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Input::printFloatValueToStr(float value, char *valstr) {
|
||||||
|
#if defined(ESP8266) || defined(ARDUINO_ARCH_ESP32)
|
||||||
|
sprintf(valstr, "%2.1f", value);
|
||||||
#endif
|
#endif
|
||||||
#if defined(__AVR__)
|
#if defined(__AVR__)
|
||||||
sprintf(valstr, "%d", (int)temp);
|
sprintf(valstr, "%d", (int)value);
|
||||||
int fractional = 10.0*((float)abs(temp)-(float)abs((int)temp));
|
int fractional = 10.0*((float)abs(value)-(float)abs((int)value));
|
||||||
int val_len =strlen(valstr);
|
int val_len =strlen(valstr);
|
||||||
valstr[val_len]='.';
|
valstr[val_len]='.';
|
||||||
valstr[val_len+1]='0'+fractional;
|
valstr[val_len+1]='0'+fractional;
|
||||||
valstr[val_len+2]='\0';
|
valstr[val_len+2]='\0';
|
||||||
#endif
|
#endif
|
||||||
#if defined(__SAM3X8E__)
|
#if defined(__SAM3X8E__)
|
||||||
sprintf(valstr, "%2.1f", temp);
|
sprintf(valstr, "%2.1f",value);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Input::contactPoll() {
|
void Input::contactPoll() {
|
||||||
boolean currentInputState;
|
boolean currentInputState;
|
||||||
uint8_t inputPinMode, inputOnLevel;
|
#if defined(ARDUINO_ARCH_STM32F1)
|
||||||
|
WiringPinMode inputPinMode;
|
||||||
|
#endif
|
||||||
|
#if defined(__SAM3X8E__)||defined(__AVR__)||defined(ESP8266)||defined(ARDUINO_ARCH_ESP32)
|
||||||
|
uint32_t inputPinMode;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
uint8_t inputOnLevel;
|
||||||
if (inType & IN_ACTIVE_HIGH) {
|
if (inType & IN_ACTIVE_HIGH) {
|
||||||
inputOnLevel = HIGH;
|
inputOnLevel = HIGH;
|
||||||
inputPinMode = INPUT;
|
inputPinMode = INPUT;
|
||||||
@@ -167,6 +313,19 @@ void Input::contactPoll() {
|
|||||||
store->bounce = SAME_STATE_ATTEMPTS;
|
store->bounce = SAME_STATE_ATTEMPTS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Input::uptimePoll() {
|
||||||
|
if(nextPollTime()>millis())
|
||||||
|
return;
|
||||||
|
aJsonObject *emit = aJson.getObjectItem(inputObj, "emit");
|
||||||
|
if (emit) {
|
||||||
|
char valstr[11];
|
||||||
|
// printUlongValueToStr(valstr,millis());
|
||||||
|
printUlongValueToStr(valstr,millis());
|
||||||
|
mqttClient.publish(emit->valuestring, valstr);
|
||||||
|
}
|
||||||
|
setNextPollTime(millis() +UPTIME_POLL_DELAY_DEFAULT);
|
||||||
|
}
|
||||||
|
|
||||||
void Input::onContactChanged(int val)
|
void Input::onContactChanged(int val)
|
||||||
{
|
{
|
||||||
Serial.print(F("IN:")); Serial.print(pin);Serial.print(F("="));Serial.println(val);
|
Serial.print(F("IN:")); Serial.print(pin);Serial.print(F("="));Serial.println(val);
|
||||||
@@ -204,3 +363,48 @@ void Input::onContactChanged(int val)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Input::onCounterChanged(int i) {
|
||||||
|
#if defined(__SAM3X8E__)
|
||||||
|
counter_value[counter_irq_map[i]]++;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__AVR__)
|
||||||
|
counter_value[i]++;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void Input::onCounterChanged0() {
|
||||||
|
onCounterChanged(0);
|
||||||
|
}
|
||||||
|
void Input::onCounterChanged1() {
|
||||||
|
onCounterChanged(1);
|
||||||
|
}
|
||||||
|
void Input::onCounterChanged2() {
|
||||||
|
onCounterChanged(2);
|
||||||
|
}
|
||||||
|
void Input::onCounterChanged3() {
|
||||||
|
onCounterChanged(3);
|
||||||
|
}
|
||||||
|
void Input::onCounterChanged4() {
|
||||||
|
onCounterChanged(4);
|
||||||
|
}
|
||||||
|
void Input::onCounterChanged5() {
|
||||||
|
onCounterChanged(5);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Input::printUlongValueToStr(char *valstr, unsigned long value) {
|
||||||
|
char buf[11];
|
||||||
|
int i=0;
|
||||||
|
for(;value>0;i++){
|
||||||
|
unsigned long mod = value - ((unsigned long)(value/10))*10;
|
||||||
|
buf[i]=mod+48;
|
||||||
|
value = (unsigned long)(value/10);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int n=0;n<=i;n++){
|
||||||
|
valstr[n]=buf[i-n-1];
|
||||||
|
}
|
||||||
|
valstr[i]='\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,8 @@ e-mail anklimov@gmail.com
|
|||||||
#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 // Every physicall push toggle logical switch on/off
|
#define IN_PUSH_TOGGLE 1 // Every physicall push toggle logical switch on/off
|
||||||
#define IN_DHT22 4
|
#define IN_DHT22 4
|
||||||
|
#define IN_COUNTER 8
|
||||||
|
#define IN_UPTIME 16
|
||||||
|
|
||||||
#define SAME_STATE_ATTEMPTS 3
|
#define SAME_STATE_ATTEMPTS 3
|
||||||
|
|
||||||
@@ -63,8 +65,7 @@ e-mail anklimov@gmail.com
|
|||||||
extern aJsonObject *inputs;
|
extern aJsonObject *inputs;
|
||||||
|
|
||||||
|
|
||||||
typedef union
|
typedef union {
|
||||||
{
|
|
||||||
long int aslong;
|
long int aslong;
|
||||||
struct {
|
struct {
|
||||||
int8_t reserve;
|
int8_t reserve;
|
||||||
@@ -72,32 +73,56 @@ typedef union
|
|||||||
int8_t bounce;
|
int8_t bounce;
|
||||||
int8_t currentValue;
|
int8_t currentValue;
|
||||||
};
|
};
|
||||||
unsigned long nextPollMillis;
|
|
||||||
} inStore;
|
} inStore;
|
||||||
|
|
||||||
class Input
|
class Input {
|
||||||
{
|
public:
|
||||||
public:
|
aJsonObject *inputObj;
|
||||||
aJsonObject *inputObj;
|
uint8_t inType;
|
||||||
uint8_t inType;
|
uint8_t pin;
|
||||||
uint8_t pin;
|
inStore *store;
|
||||||
inStore * store;
|
|
||||||
|
|
||||||
Input(int pin);
|
Input(int pin);
|
||||||
Input(aJsonObject * obj);
|
|
||||||
Input(char * name);
|
|
||||||
|
|
||||||
boolean isValid ();
|
Input(aJsonObject *obj);
|
||||||
void onContactChanged(int val);
|
|
||||||
|
|
||||||
int poll();
|
Input(char *name);
|
||||||
protected:
|
|
||||||
void Parse();
|
boolean isValid();
|
||||||
|
|
||||||
|
void onContactChanged(int val);
|
||||||
|
|
||||||
|
int poll();
|
||||||
|
|
||||||
|
static void inline onCounterChanged(int i);
|
||||||
|
static void onCounterChanged0();
|
||||||
|
static void onCounterChanged1();
|
||||||
|
static void onCounterChanged2();
|
||||||
|
static void onCounterChanged3();
|
||||||
|
static void onCounterChanged4();
|
||||||
|
static void onCounterChanged5();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void Parse();
|
||||||
|
|
||||||
void contactPoll();
|
void contactPoll();
|
||||||
|
|
||||||
void dht22Poll();
|
void dht22Poll();
|
||||||
|
|
||||||
|
void printFloatValueToStr(float value, char *valstr);
|
||||||
|
|
||||||
void printFloatValueToStr(float temp, char *valstr);
|
void counterPoll();
|
||||||
|
|
||||||
|
void attachInterruptPinIrq(int realPin, int irq);
|
||||||
|
|
||||||
|
unsigned long nextPollTime() const;
|
||||||
|
void setNextPollTime(unsigned long pollTime);
|
||||||
|
|
||||||
|
|
||||||
|
void uptimePoll();
|
||||||
|
|
||||||
|
void printUlongValueToStr(char *valstr, unsigned long value);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -186,7 +186,7 @@ void Item::copyPar (aJsonObject *itemV)
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef ESP32
|
#if defined(ARDUINO_ARCH_ESP32)
|
||||||
void analogWrite(int pin, int val)
|
void analogWrite(int pin, int val)
|
||||||
{
|
{
|
||||||
//TBD
|
//TBD
|
||||||
@@ -218,6 +218,7 @@ int Item::Ctrl(char * payload, boolean send){
|
|||||||
case -1: //Not known command
|
case -1: //Not known command
|
||||||
case -2: //JSON input (not implemented yet
|
case -2: //JSON input (not implemented yet
|
||||||
break;
|
break;
|
||||||
|
#if not defined(ARDUINO_ARCH_ESP32) and not defined(ESP8266) and not defined(ARDUINO_ARCH_STM32F1)
|
||||||
case -3: //RGB color in #RRGGBB notation
|
case -3: //RGB color in #RRGGBB notation
|
||||||
{
|
{
|
||||||
CRGB rgb;
|
CRGB rgb;
|
||||||
@@ -231,6 +232,7 @@ int Item::Ctrl(char * payload, boolean send){
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
case CMD_ON:
|
case CMD_ON:
|
||||||
|
|
||||||
// if (item.getEnableCMD(500) || lanStatus == 4)
|
// if (item.getEnableCMD(500) || lanStatus == 4)
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -10,22 +10,34 @@
|
|||||||
#define wdt_dis()
|
#define wdt_dis()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(ARDUINO_ARCH_STM32F1)
|
||||||
|
#define wdt_res()
|
||||||
|
#define wdt_en()
|
||||||
|
#define wdt_dis()
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef DHCP_RETRY_INTERVAL
|
#ifndef DHCP_RETRY_INTERVAL
|
||||||
#define DHCP_RETRY_INTERVAL 60000
|
#define DHCP_RETRY_INTERVAL 60000
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__AVR__)
|
#if defined(ESP8266)
|
||||||
#define wdt_en() wdt_enable(WDTO_8S)
|
#define wdt_en() wdt_enable(WDTO_8S)
|
||||||
#define wdt_dis() wdt_disable()
|
#define wdt_dis() wdt_disable()
|
||||||
#define wdt_res() wdt_reset()
|
#define wdt_res() wdt_reset()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__ESP__)
|
#ifdef ARDUINO_ARCH_ESP32
|
||||||
#define wdt_res()
|
#define wdt_res()
|
||||||
#define wdt_en()
|
#define wdt_en()
|
||||||
#define wdt_dis()
|
#define wdt_dis()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//#if defined(ESP8266)
|
||||||
|
//#define wdt_res()
|
||||||
|
//#define wdt_en()
|
||||||
|
//#define wdt_dis()
|
||||||
|
//#endif
|
||||||
|
|
||||||
#if defined(WATCH_DOG_TICKER_DISABLE) && defined(__AVR__)
|
#if defined(WATCH_DOG_TICKER_DISABLE) && defined(__AVR__)
|
||||||
#define wdt_en() wdt_disable()
|
#define wdt_en() wdt_disable()
|
||||||
#define wdt_dis() wdt_disable()
|
#define wdt_dis() wdt_disable()
|
||||||
@@ -44,7 +56,9 @@
|
|||||||
#include "stdarg.h"
|
#include "stdarg.h"
|
||||||
#include "item.h"
|
#include "item.h"
|
||||||
#include "inputs.h"
|
#include "inputs.h"
|
||||||
|
#ifndef ARDUINO_ARCH_STM32F1
|
||||||
#include "FastLED.h"
|
#include "FastLED.h"
|
||||||
|
#endif
|
||||||
#include "Dns.h"
|
#include "Dns.h"
|
||||||
//#include "hsv2rgb.h"
|
//#include "hsv2rgb.h"
|
||||||
|
|
||||||
@@ -63,16 +77,13 @@
|
|||||||
#include <EEPROM.h>
|
#include <EEPROM.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__ESP__)
|
#if defined(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 <EEPROM.h>
|
#include <EEPROM.h>
|
||||||
#include <ESP8266HTTPClient.h>
|
#include <ESP8266HTTPClient.h>
|
||||||
|
|
||||||
#ifndef WIFI_MANAGER_DISABLE
|
|
||||||
#include <WiFiManager.h>
|
#include <WiFiManager.h>
|
||||||
#include <DNSServer.h>
|
#include <DNSServer.h>
|
||||||
#include <ESP8266WebServer.h>
|
#include <ESP8266WebServer.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -88,11 +99,19 @@
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(__AVR__) || defined(__SAM3X8E__) || defined(ESP8266)
|
||||||
#ifdef Wiz5500
|
#ifdef Wiz5500
|
||||||
#include <Ethernet2.h>
|
#include <Ethernet2.h>
|
||||||
#else
|
#else
|
||||||
#include <Ethernet.h>
|
#include <Ethernet.h>
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef ARDUINO_ARCH_ESP32
|
||||||
|
#include <SPI.h>
|
||||||
|
//#include <Ethernet3.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef _artnet
|
#ifdef _artnet
|
||||||
#include <Artnet.h>
|
#include <Artnet.h>
|
||||||
@@ -122,12 +141,9 @@ enum lan_status {
|
|||||||
|
|
||||||
void mqttCallback(char *topic, byte *payload, unsigned int length);
|
void mqttCallback(char *topic, byte *payload, unsigned int length);
|
||||||
|
|
||||||
//#ifndef __ESP__
|
|
||||||
|
|
||||||
void printIPAddress(IPAddress ipAddress);
|
void printIPAddress(IPAddress ipAddress);
|
||||||
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
void printMACAddress();
|
void printMACAddress();
|
||||||
|
|
||||||
void restoreState();
|
void restoreState();
|
||||||
|
|||||||
@@ -95,10 +95,6 @@
|
|||||||
#define LAN_INIT_DELAY 500
|
#define LAN_INIT_DELAY 500
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(ESP8266)
|
|
||||||
#define __ESP__
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(__AVR__)
|
#if defined(__AVR__)
|
||||||
//All options available
|
//All options available
|
||||||
#ifdef CONTROLLINO
|
#ifdef CONTROLLINO
|
||||||
@@ -116,7 +112,7 @@
|
|||||||
#define dmxin DmxDue1
|
#define dmxin DmxDue1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__ESP__)
|
#if defined(ESP8266)
|
||||||
#undef _dmxin
|
#undef _dmxin
|
||||||
#undef _modbus
|
#undef _modbus
|
||||||
#ifndef DMX_DISABLE
|
#ifndef DMX_DISABLE
|
||||||
@@ -139,4 +135,17 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define DHT_POLL_DELAY_DEFAULT 15000
|
#define DHT_POLL_DELAY_DEFAULT 15000
|
||||||
|
#define UPTIME_POLL_DELAY_DEFAULT 30000
|
||||||
|
|
||||||
|
#ifdef ARDUINO_ARCH_STM32F1
|
||||||
|
#define strncpy_P strncpy
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef debugSerial
|
||||||
|
#define debugSerial Serial
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef Wiz5500
|
||||||
|
#define W5100_ETHERNET_SHIELD
|
||||||
|
#endif
|
||||||
@@ -41,6 +41,7 @@ unsigned long owTimer = 0;
|
|||||||
owChangedType owChanged;
|
owChangedType owChanged;
|
||||||
|
|
||||||
int owUpdate() {
|
int owUpdate() {
|
||||||
|
#ifndef OWIRE_DISABLE
|
||||||
unsigned long finish = millis() + OW_UPDATE_INTERVAL;
|
unsigned long finish = millis() + OW_UPDATE_INTERVAL;
|
||||||
short sr;
|
short sr;
|
||||||
|
|
||||||
@@ -80,11 +81,12 @@ int owUpdate() {
|
|||||||
|
|
||||||
Serial.print(F("1-wire count: "));
|
Serial.print(F("1-wire count: "));
|
||||||
Serial.println(t_count);
|
Serial.println(t_count);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int owSetup(owChangedType owCh) {
|
int owSetup(owChangedType owCh) {
|
||||||
|
#ifndef OWIRE_DISABLE
|
||||||
//// todo - move memory allocation to here
|
//// todo - move memory allocation to here
|
||||||
if (net) return true; // Already initialized
|
if (net) return true; // Already initialized
|
||||||
#ifdef DS2482_100_I2C_TO_1W_BRIDGE
|
#ifdef DS2482_100_I2C_TO_1W_BRIDGE
|
||||||
@@ -138,6 +140,7 @@ net = new OneWire (USE_1W_PIN);
|
|||||||
|
|
||||||
delay(500);
|
delay(500);
|
||||||
|
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -182,6 +185,7 @@ int owFind(DeviceAddress addr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void owAdd(DeviceAddress addr) {
|
void owAdd(DeviceAddress addr) {
|
||||||
|
#ifndef OWIRE_DISABLE
|
||||||
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);
|
||||||
@@ -198,4 +202,5 @@ void owAdd(DeviceAddress addr) {
|
|||||||
// sensors.requestTemperaturesByAddress(term[t_count]);
|
// sensors.requestTemperaturesByAddress(term[t_count]);
|
||||||
}
|
}
|
||||||
t_count++;
|
t_count++;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,7 +50,10 @@ e-mail anklimov@gmail.com
|
|||||||
#define t_max 20 //Maximum number of 1w devices
|
#define t_max 20 //Maximum number of 1w devices
|
||||||
#define TEMPERATURE_PRECISION 9
|
#define TEMPERATURE_PRECISION 9
|
||||||
|
|
||||||
|
#ifndef ARDUINO_ARCH_STM32F1
|
||||||
#include <DS2482_OneWire.h>
|
#include <DS2482_OneWire.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <DallasTemperature.h>
|
#include <DallasTemperature.h>
|
||||||
#include "aJSON.h"
|
#include "aJSON.h"
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ e-mail anklimov@gmail.com
|
|||||||
|
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
#if defined(__SAM3X8E__)
|
#if defined(__SAM3X8E__) || defined(ARDUINO_ARCH_STM32F1)
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -53,7 +53,7 @@ void SetBytes(uint8_t *addr, uint8_t count, char *out) {
|
|||||||
|
|
||||||
|
|
||||||
byte HEX2DEC(char i) {
|
byte HEX2DEC(char i) {
|
||||||
byte v;
|
byte v=0;
|
||||||
if ('a' <= i && i <= 'f') { v = i - 97 + 10; }
|
if ('a' <= i && i <= 'f') { v = i - 97 + 10; }
|
||||||
else if ('A' <= i && i <= 'F') { v = i - 65 + 10; }
|
else if ('A' <= i && i <= 'F') { v = i - 65 + 10; }
|
||||||
else if ('0' <= i && i <= '9') { v = i - 48; }
|
else if ('0' <= i && i <= '9') { v = i - 48; }
|
||||||
@@ -80,7 +80,7 @@ int getInt(char **chan) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if defined(ESP8266)
|
#if defined(ARDUINO_ARCH_ESP32) || defined(ESP8266)
|
||||||
unsigned long freeRam ()
|
unsigned long freeRam ()
|
||||||
{return system_get_free_heap_size();}
|
{return system_get_free_heap_size();}
|
||||||
#endif
|
#endif
|
||||||
@@ -94,6 +94,20 @@ unsigned long freeRam ()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(ARDUINO_ARCH_STM32F1)
|
||||||
|
extern char _end;
|
||||||
|
extern "C" char *sbrk(int i);
|
||||||
|
|
||||||
|
unsigned long freeRam() {
|
||||||
|
char *heapend = sbrk(0);
|
||||||
|
register char *stack_ptr asm( "sp" );
|
||||||
|
struct mallinfo mi = mallinfo();
|
||||||
|
|
||||||
|
return stack_ptr - heapend + mi.fordblks;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(__SAM3X8E__)
|
#if defined(__SAM3X8E__)
|
||||||
extern char _end;
|
extern char _end;
|
||||||
extern "C" char *sbrk(int i);
|
extern "C" char *sbrk(int i);
|
||||||
@@ -119,4 +133,6 @@ void parseBytes(const char *str, char separator, byte *bytes, int maxBytes, int
|
|||||||
}
|
}
|
||||||
str++; // Point to next character after separator
|
str++; // Point to next character after separator
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#pragma message(VAR_NAME_VALUE(debugSerial))
|
||||||
|
#pragma message(VAR_NAME_VALUE(SERIAL_BAUD))
|
||||||
@@ -19,6 +19,9 @@ e-mail anklimov@gmail.com
|
|||||||
*/
|
*/
|
||||||
#define Q(x) #x
|
#define Q(x) #x
|
||||||
#define QUOTE(x) Q(x)
|
#define QUOTE(x) Q(x)
|
||||||
|
#define VALUE_TO_STRING(x) #x
|
||||||
|
#define VALUE(x) VALUE_TO_STRING(x)
|
||||||
|
#define VAR_NAME_VALUE(var) #var "=" VALUE(var)
|
||||||
|
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
|
||||||
|
|||||||
@@ -1,32 +0,0 @@
|
|||||||
# 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()])
|
|
||||||
101
platformio.ini
101
platformio.ini
@@ -10,23 +10,72 @@
|
|||||||
[platformio]
|
[platformio]
|
||||||
src_dir = lighthub
|
src_dir = lighthub
|
||||||
env_default =
|
env_default =
|
||||||
|
; megaatmega2560
|
||||||
megaatmega2560-net
|
; megaatmega2560-net
|
||||||
; due
|
; due
|
||||||
; esp8266
|
; esp8266
|
||||||
|
; esp32
|
||||||
; megaatmega2560-5500
|
; megaatmega2560-5500
|
||||||
; due-5500
|
; due-5500
|
||||||
; controllino
|
; controllino
|
||||||
|
; stm32
|
||||||
|
|
||||||
build_dir = /tmp/pioenvs
|
build_dir = /tmp/pioenvs
|
||||||
libdeps_dir = /tmp/piolibdeps
|
libdeps_dir = /tmp/piolibdeps
|
||||||
|
|
||||||
|
[env:esp32]
|
||||||
|
platform = espressif32
|
||||||
|
framework = arduino
|
||||||
|
board = pico32
|
||||||
|
lib_ldf_mode = chain+
|
||||||
|
build_flags = !sh build_flags_esp32.sh
|
||||||
|
lib_deps =
|
||||||
|
https://github.com/anklimov/Arduino-Temperature-Control-Library.git
|
||||||
|
https://github.com/anklimov/DS2482_OneWire
|
||||||
|
ESP8266HTTPClient
|
||||||
|
Ethernet3
|
||||||
|
https://github.com/anklimov/aJson
|
||||||
|
https://github.com/anklimov/CmdArduino
|
||||||
|
https://github.com/anklimov/ModbusMaster
|
||||||
|
https://github.com/knolleary/pubsubclient.git
|
||||||
|
https://github.com/anklimov/Artnet.git
|
||||||
|
FastLED
|
||||||
|
Adafruit Unified Sensor
|
||||||
|
DHT sensor library for ESPx
|
||||||
|
DHT sensor library
|
||||||
|
|
||||||
|
[env:stm32]
|
||||||
|
platform = ststm32
|
||||||
|
framework = arduino
|
||||||
|
board = nucleo_f103rb
|
||||||
|
upload_protocol = stlink
|
||||||
|
debug_tool = stlink
|
||||||
|
extra_scripts = pre:!pre_stm32.sh
|
||||||
|
;lib_ldf_mode = chain+
|
||||||
|
build_flags = !sh build_flags_stm32.sh
|
||||||
|
lib_deps =
|
||||||
|
DallasTemperature
|
||||||
|
https://github.com/anklimov/aJson
|
||||||
|
https://github.com/anklimov/CmdArduino
|
||||||
|
ArduinoHttpClient
|
||||||
|
https://github.com/anklimov/ModbusMaster
|
||||||
|
; https://github.com/Serasidis/Ethernet_STM.git
|
||||||
|
; https://github.com/livello/Ethernet_STM.git
|
||||||
|
https://github.com/knolleary/pubsubclient.git
|
||||||
|
Adafruit Unified Sensor
|
||||||
|
DHT sensor library
|
||||||
|
; https://github.com/anklimov/DMXSerial
|
||||||
|
; Syslog
|
||||||
|
; https://github.com/No3x/Syslog.git
|
||||||
|
https://github.com/arcao/Syslog.git
|
||||||
|
; UIPEthernet
|
||||||
|
|
||||||
[env:due]
|
[env:due]
|
||||||
platform = atmelsam
|
platform = atmelsam
|
||||||
framework = arduino
|
framework = arduino
|
||||||
board = due
|
board = due
|
||||||
lib_ldf_mode = chain+
|
lib_ldf_mode = chain+
|
||||||
extra_scripts = pre:my_build_flags.py
|
build_flags = !sh build_flags_due.sh
|
||||||
build_flags = !echo -n "-DPIO_SRC_REV="$(git log --pretty=format:%h_%ad -1 --date=short)
|
|
||||||
lib_deps =
|
lib_deps =
|
||||||
https://github.com/sebnil/DueFlashStorage
|
https://github.com/sebnil/DueFlashStorage
|
||||||
https://github.com/anklimov/Arduino-Temperature-Control-Library.git
|
https://github.com/anklimov/Arduino-Temperature-Control-Library.git
|
||||||
@@ -45,6 +94,7 @@ lib_deps =
|
|||||||
SdFat
|
SdFat
|
||||||
Adafruit Unified Sensor
|
Adafruit Unified Sensor
|
||||||
DHT sensor library
|
DHT sensor library
|
||||||
|
https://github.com/arcao/Syslog.git
|
||||||
|
|
||||||
|
|
||||||
[env:megaatmega2560]
|
[env:megaatmega2560]
|
||||||
@@ -52,7 +102,7 @@ platform = atmelavr
|
|||||||
board = megaatmega2560
|
board = megaatmega2560
|
||||||
framework = arduino
|
framework = arduino
|
||||||
;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 = !sh build_flags_mega2560.sh
|
||||||
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
|
||||||
@@ -77,8 +127,7 @@ platform = espressif8266
|
|||||||
framework = arduino
|
framework = arduino
|
||||||
board = nodemcuv2
|
board = nodemcuv2
|
||||||
lib_ldf_mode = chain+
|
lib_ldf_mode = chain+
|
||||||
build_flags = !echo -n "-DMODBUS_DISABLE -DPIO_SRC_REV="$(git log --pretty=format:%h_%ad -1 --date=short)
|
build_flags = !sh build_flags_esp8266.sh
|
||||||
;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
|
||||||
@@ -94,39 +143,37 @@ lib_deps =
|
|||||||
DHT sensor library for ESPx
|
DHT sensor library for ESPx
|
||||||
DHT sensor library
|
DHT sensor library
|
||||||
WifiManager
|
WifiManager
|
||||||
|
https://github.com/arcao/Syslog.git
|
||||||
|
|
||||||
[env:megaatmega2560-net]
|
[env:megaatmega2560-net]
|
||||||
platform = atmelavr
|
platform = atmelavr
|
||||||
board = megaatmega2560
|
board = megaatmega2560
|
||||||
framework = arduino
|
framework = arduino
|
||||||
upload_port = net:192.168.88.2:23000
|
upload_port = net:192.168.88.2:23000
|
||||||
|
build_flags = !sh build_flags_mega2560-net.sh
|
||||||
;lib_ldf_mode = chain+
|
;lib_ldf_mode = chain+
|
||||||
build_flags = !echo -n "-DPIO_SRC_REV="$(git rev-parse --short HEAD)
|
|
||||||
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
|
||||||
https://github.com/anklimov/DmxSimple
|
https://github.com/anklimov/DmxSimple
|
||||||
https://github.com/anklimov/httpClient
|
https://github.com/anklimov/httpClient
|
||||||
https://github.com/anklimov/aJson
|
https://github.com/anklimov/aJson
|
||||||
https://github.com/anklimov/CmdArduino
|
https://github.com/anklimov/CmdArduino
|
||||||
https://github.com/anklimov/ModbusMaster
|
https://github.com/anklimov/ModbusMaster
|
||||||
https://github.com/anklimov/DMXSerial
|
https://github.com/anklimov/DMXSerial
|
||||||
https://github.com/anklimov/Ethernet
|
https://github.com/anklimov/Ethernet
|
||||||
https://github.com/PaulStoffregen/SPI.git
|
https://github.com/PaulStoffregen/SPI.git
|
||||||
https://github.com/knolleary/pubsubclient.git
|
https://github.com/knolleary/pubsubclient.git
|
||||||
https://github.com/anklimov/Artnet.git
|
https://github.com/anklimov/Artnet.git
|
||||||
FastLED
|
FastLED
|
||||||
Adafruit Unified Sensor
|
Adafruit Unified Sensor
|
||||||
DHT sensor library
|
DHT sensor library
|
||||||
|
|
||||||
[env:due-5500]
|
[env:due-5500]
|
||||||
platform = atmelsam
|
platform = atmelsam
|
||||||
framework = arduino
|
framework = arduino
|
||||||
board = due
|
board = due
|
||||||
lib_ldf_mode = chain+
|
;lib_ldf_mode = chain+
|
||||||
extra_scripts = pre:my_build_flags.py
|
|
||||||
build_flags = !echo -n "-DPIO_SRC_REV="$(git log --pretty=format:%h_%ad -1 --date=short)
|
|
||||||
build_flags = -D Wiz5500 -D ARTNET_ENABLE
|
build_flags = -D Wiz5500 -D ARTNET_ENABLE
|
||||||
lib_deps =
|
lib_deps =
|
||||||
https://github.com/sebnil/DueFlashStorage
|
https://github.com/sebnil/DueFlashStorage
|
||||||
|
|||||||
4
pre_stm32.sh
Normal file
4
pre_stm32.sh
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
rm /tmp/piolibdeps -Rf
|
||||||
|
mkdir /tmp/piolibdeps_stm32
|
||||||
|
ln -s /tmp/piolibdeps_stm32 /tmp/piolibdeps
|
||||||
2
prepareDue.sh
Executable file
2
prepareDue.sh
Executable file
@@ -0,0 +1,2 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
sed -i -- 's/void USART0_Handler(void)/void USART0_Handler(void ) __attribute__((weak));\nvoid USART0_Handler(void )/g' ~/.platformio/packages/framework-arduinosam/variants/arduino_due_x/variant.cpp
|
||||||
Reference in New Issue
Block a user