mirror of
https://github.com/anklimov/lighthub
synced 2025-12-06 11:49:51 +03:00
Improve multiplatform building stuff
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
#! /bin/bash
|
#! /bin/bash
|
||||||
export FLAGS="$FLAGS -DCONTROLLINO"
|
export FLAGS="$FLAGS -DCONTROLLINO"
|
||||||
export FLAGS="$FLAGS -DCUSTOM_FIRMWARE_MAC=de:ad:be:ef:fe:07"
|
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
|
CUSTOM_BUILD_FLAGS_FILE=custom-build-flags/build_flags_controllino.sh
|
||||||
if [ -f $CUSTOM_BUILD_FLAGS_FILE ]; then
|
if [ -f $CUSTOM_BUILD_FLAGS_FILE ]; then
|
||||||
source $CUSTOM_BUILD_FLAGS_FILE
|
source $CUSTOM_BUILD_FLAGS_FILE
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#! /bin/bash
|
#! /bin/bash
|
||||||
export FLAGS="$FLAGS -DWiz5500"
|
export FLAGS="$FLAGS -DWiz5500"
|
||||||
export FLAGS="$FLAGS -DARTNET_ENABLE"
|
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
|
CUSTOM_BUILD_FLAGS_FILE=custom-build-flags/build_flags_due-5500.sh
|
||||||
if [ -f $CUSTOM_BUILD_FLAGS_FILE ]; then
|
if [ -f $CUSTOM_BUILD_FLAGS_FILE ]; then
|
||||||
source $CUSTOM_BUILD_FLAGS_FILE
|
source $CUSTOM_BUILD_FLAGS_FILE
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#! /bin/bash
|
#! /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
|
CUSTOM_BUILD_FLAGS_FILE=custom-build-flags/build_flags_due.sh
|
||||||
if [ -f $CUSTOM_BUILD_FLAGS_FILE ]; then
|
if [ -f $CUSTOM_BUILD_FLAGS_FILE ]; then
|
||||||
source $CUSTOM_BUILD_FLAGS_FILE
|
source $CUSTOM_BUILD_FLAGS_FILE
|
||||||
|
|||||||
@@ -1,4 +1,9 @@
|
|||||||
#! /bin/bash
|
#! /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 -std=gnu++11"
|
||||||
CUSTOM_BUILD_FLAGS_FILE=custom-build-flags/build_flags_esp32.sh
|
CUSTOM_BUILD_FLAGS_FILE=custom-build-flags/build_flags_esp32.sh
|
||||||
if [ -f $CUSTOM_BUILD_FLAGS_FILE ]; then
|
if [ -f $CUSTOM_BUILD_FLAGS_FILE ]; then
|
||||||
source $CUSTOM_BUILD_FLAGS_FILE
|
source $CUSTOM_BUILD_FLAGS_FILE
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#! /bin/bash
|
#! /bin/bash
|
||||||
export FLAGS="$FLAGS -DMODBUS_DISABLE"
|
export FLAGS="$FLAGS -DMODBUS_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
|
CUSTOM_BUILD_FLAGS_FILE=custom-build-flags/build_flags_esp8266.sh
|
||||||
if [ -f $CUSTOM_BUILD_FLAGS_FILE ]; then
|
if [ -f $CUSTOM_BUILD_FLAGS_FILE ]; then
|
||||||
source $CUSTOM_BUILD_FLAGS_FILE
|
source $CUSTOM_BUILD_FLAGS_FILE
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#! /bin/bash
|
#! /bin/bash
|
||||||
CUSTOM_BUILD_FLAGS_FILE=custom-build-flags/build_flags_mega2560-net.sh
|
CUSTOM_BUILD_FLAGS_FILE=custom-build-flags/build_flags_mega2560-net.sh
|
||||||
|
export FLAGS="$FLAGS -DPIO_SRC_REV="$(git log --pretty=format:%h_%ad -1 --date=short)
|
||||||
if [ -f $CUSTOM_BUILD_FLAGS_FILE ]; then
|
if [ -f $CUSTOM_BUILD_FLAGS_FILE ]; then
|
||||||
source $CUSTOM_BUILD_FLAGS_FILE
|
source $CUSTOM_BUILD_FLAGS_FILE
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
#! /bin/bash
|
#! /bin/bash
|
||||||
CUSTOM_BUILD_FLAGS_FILE="custom-build-flags/build_flags_mega2560.sh"
|
CUSTOM_BUILD_FLAGS_FILE="custom-build-flags/build_flags_mega2560.sh"
|
||||||
#CUSTOM_BUILD_FLAGS_FILE="custom-build-flags/build_flags_$PIOENV.sh"
|
export FLAGS="$FLAGS -DPIO_SRC_REV="$(git log --pretty=format:%h_%ad -1 --date=short)
|
||||||
#echo $PIOENV > custom-build-flags/1.txt
|
|
||||||
#TODO: make one file for all envs
|
#TODO: make one file for all envs
|
||||||
if [ -f $CUSTOM_BUILD_FLAGS_FILE ]; then
|
if [ -f $CUSTOM_BUILD_FLAGS_FILE ]; then
|
||||||
source $CUSTOM_BUILD_FLAGS_FILE
|
source $CUSTOM_BUILD_FLAGS_FILE
|
||||||
|
|||||||
@@ -1,5 +1,13 @@
|
|||||||
#! /bin/bash
|
#! /bin/bash
|
||||||
export FLAGS="$FLAGS -DWiz5500"
|
export FLAGS="$FLAGS -DWiz5500"
|
||||||
|
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 -DDHT_COUNTER_DISABLE"
|
||||||
|
|
||||||
CUSTOM_BUILD_FLAGS_FILE=custom-build-flags/build_flags_nrf52840.sh
|
CUSTOM_BUILD_FLAGS_FILE=custom-build-flags/build_flags_nrf52840.sh
|
||||||
if [ -f $CUSTOM_BUILD_FLAGS_FILE ]; then
|
if [ -f $CUSTOM_BUILD_FLAGS_FILE ]; then
|
||||||
source $CUSTOM_BUILD_FLAGS_FILE
|
source $CUSTOM_BUILD_FLAGS_FILE
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
#! /bin/bash
|
#! /bin/bash
|
||||||
CUSTOM_BUILD_FLAGS_FILE=custom-build-flags/build_flags_stm32.sh
|
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"
|
||||||
if [ -f $CUSTOM_BUILD_FLAGS_FILE ]; then
|
if [ -f $CUSTOM_BUILD_FLAGS_FILE ]; then
|
||||||
source $CUSTOM_BUILD_FLAGS_FILE
|
source $CUSTOM_BUILD_FLAGS_FILE
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -64,11 +64,9 @@ ESP32
|
|||||||
PWM Out
|
PWM Out
|
||||||
|
|
||||||
*/
|
*/
|
||||||
#include "Arduino.h"
|
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "options.h"
|
|
||||||
#include "utils.h"
|
|
||||||
#include "homiedef.h"
|
|
||||||
|
|
||||||
#if defined(__SAM3X8E__)
|
#if defined(__SAM3X8E__)
|
||||||
DueFlashStorage EEPROM;
|
DueFlashStorage EEPROM;
|
||||||
@@ -80,18 +78,12 @@ EthernetClient ethClient;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ARDUINO_ARCH_ESP8266
|
#ifdef ARDUINO_ARCH_ESP8266
|
||||||
#include <ESP8266WiFi.h>
|
|
||||||
#include <user_interface.h>
|
|
||||||
WiFiClient ethClient;
|
WiFiClient ethClient;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ARDUINO_ARCH_ESP32
|
#ifdef ARDUINO_ARCH_ESP32
|
||||||
#include <WiFiClient.h>
|
|
||||||
#include <WiFi.h>
|
|
||||||
#include <HTTPClient.h>
|
|
||||||
#include <EEPROM.h>
|
|
||||||
#include "Ethernet3.h"
|
|
||||||
WiFiClient ethClient;
|
WiFiClient ethClient;
|
||||||
|
NRFFlashStorage EEPROM;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ARDUINO_ARCH_STM32F1
|
#ifdef ARDUINO_ARCH_STM32F1
|
||||||
@@ -99,7 +91,7 @@ WiFiClient ethClient;
|
|||||||
//#include <EthernetClient.h>
|
//#include <EthernetClient.h>
|
||||||
//#include "UIPEthernet.h"
|
//#include "UIPEthernet.h"
|
||||||
//#include "UIPUdp.h"
|
//#include "UIPUdp.h"
|
||||||
#include <SPI.h>
|
//#include <SPI.h>
|
||||||
#include <Ethernet_STM.h>
|
#include <Ethernet_STM.h>
|
||||||
|
|
||||||
#include "Dns.h"
|
#include "Dns.h"
|
||||||
@@ -110,7 +102,6 @@ EthernetClient ethClient;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef NRF5
|
#ifdef NRF5
|
||||||
#include <NRFFlashStorage.h>
|
|
||||||
NRFFlashStorage EEPROM;
|
NRFFlashStorage EEPROM;
|
||||||
EthernetClient ethClient;
|
EthernetClient ethClient;
|
||||||
#endif
|
#endif
|
||||||
@@ -171,7 +162,9 @@ bool wifiInitialized;
|
|||||||
|
|
||||||
int mqttErrorRate;
|
int mqttErrorRate;
|
||||||
|
|
||||||
|
#if defined(__SAM3X8E__)
|
||||||
void watchdogSetup(void) {} //Do not remove - strong re-definition WDT Init for DUE
|
void watchdogSetup(void) {} //Do not remove - strong re-definition WDT Init for DUE
|
||||||
|
#endif
|
||||||
|
|
||||||
void mqttCallback(char *topic, byte *payload, unsigned int length) {
|
void mqttCallback(char *topic, byte *payload, unsigned int length) {
|
||||||
debugSerial<<F("\n[")<<topic<<F("] ");
|
debugSerial<<F("\n[")<<topic<<F("] ");
|
||||||
@@ -548,7 +541,7 @@ void onInitialStateInitLAN() {
|
|||||||
|
|
||||||
#ifdef ARDUINO_ARCH_ESP32
|
#ifdef ARDUINO_ARCH_ESP32
|
||||||
if(!wifiInitialized) {
|
if(!wifiInitialized) {
|
||||||
WiFi.mode(WIFI_STA);
|
// WiFi.mode(WIFI_STA);
|
||||||
WiFi.disconnect();
|
WiFi.disconnect();
|
||||||
debugSerial<<F("WIFI AP/Password:")<<QUOTE(ESP_WIFI_AP)<<F("/")<<QUOTE(ESP_WIFI_PWD);
|
debugSerial<<F("WIFI AP/Password:")<<QUOTE(ESP_WIFI_AP)<<F("/")<<QUOTE(ESP_WIFI_PWD);
|
||||||
WiFi.begin(QUOTE(ESP_WIFI_AP), QUOTE(ESP_WIFI_PWD));
|
WiFi.begin(QUOTE(ESP_WIFI_AP), QUOTE(ESP_WIFI_PWD));
|
||||||
@@ -740,7 +733,7 @@ void cmdFunctionHelp(int arg_cnt, char **args)
|
|||||||
void printCurentLanConfig() {
|
void printCurentLanConfig() {
|
||||||
debugSerial << F("Current LAN config(ip,dns,gw,subnet):");
|
debugSerial << F("Current LAN config(ip,dns,gw,subnet):");
|
||||||
printIPAddress(Ethernet.localIP());
|
printIPAddress(Ethernet.localIP());
|
||||||
printIPAddress(Ethernet.dnsServerIP());
|
// printIPAddress(Ethernet.dnsServerIP());
|
||||||
printIPAddress(Ethernet.gatewayIP());
|
printIPAddress(Ethernet.gatewayIP());
|
||||||
printIPAddress(Ethernet.subnetMask());
|
printIPAddress(Ethernet.subnetMask());
|
||||||
}
|
}
|
||||||
@@ -935,22 +928,32 @@ void cmdFunctionIp(int arg_cnt, char **args)
|
|||||||
{
|
{
|
||||||
IPAddress ip0(0, 0, 0, 0);
|
IPAddress ip0(0, 0, 0, 0);
|
||||||
IPAddress ip;
|
IPAddress ip;
|
||||||
|
|
||||||
|
#if defined(ARDUINO_ARCH_AVR) || defined(__SAM3X8E__) || defined(NRF5)
|
||||||
DNSClient dns;
|
DNSClient dns;
|
||||||
|
#define inet_aton(cp, addr) dns.inet_aton(cp, addr)
|
||||||
|
#else
|
||||||
|
#define inet_aton(cp, addr) inet_aton(cp, addr)
|
||||||
|
#endif
|
||||||
|
|
||||||
switch (arg_cnt) {
|
switch (arg_cnt) {
|
||||||
case 5:
|
case 5:
|
||||||
if (dns.inet_aton(args[4], ip)) saveFlash(OFFSET_MASK, ip);
|
if (inet_aton(args[4], ip)) saveFlash(OFFSET_MASK, ip);
|
||||||
else saveFlash(OFFSET_MASK, ip0);
|
else saveFlash(OFFSET_MASK, ip0);
|
||||||
case 4:
|
case 4:
|
||||||
if (dns.inet_aton(args[3], ip)) saveFlash(OFFSET_GW, ip);
|
if (inet_aton(args[3], ip)) saveFlash(OFFSET_GW, ip);
|
||||||
else saveFlash(OFFSET_GW, ip0);
|
else saveFlash(OFFSET_GW, ip0);
|
||||||
case 3:
|
case 3:
|
||||||
if (dns.inet_aton(args[2], ip)) saveFlash(OFFSET_DNS, ip);
|
if (inet_aton(args[2], ip)) saveFlash(OFFSET_DNS, ip);
|
||||||
else saveFlash(OFFSET_DNS, ip0);
|
else saveFlash(OFFSET_DNS, ip0);
|
||||||
case 2:
|
case 2:
|
||||||
if (dns.inet_aton(args[1], ip)) saveFlash(OFFSET_IP, ip);
|
if (inet_aton(args[1], ip)) saveFlash(OFFSET_IP, ip);
|
||||||
else saveFlash(OFFSET_IP, ip0);
|
else saveFlash(OFFSET_IP, ip0);
|
||||||
break;
|
break;
|
||||||
case 1:
|
|
||||||
|
case 1: //dynamic IP
|
||||||
|
saveFlash(OFFSET_IP,ip0);
|
||||||
|
/*
|
||||||
IPAddress current_ip = Ethernet.localIP();
|
IPAddress current_ip = Ethernet.localIP();
|
||||||
IPAddress current_mask = Ethernet.subnetMask();
|
IPAddress current_mask = Ethernet.subnetMask();
|
||||||
IPAddress current_gw = Ethernet.gatewayIP();
|
IPAddress current_gw = Ethernet.gatewayIP();
|
||||||
@@ -963,7 +966,7 @@ void cmdFunctionIp(int arg_cnt, char **args)
|
|||||||
printIPAddress(current_ip);
|
printIPAddress(current_ip);
|
||||||
printIPAddress(current_dns);
|
printIPAddress(current_dns);
|
||||||
printIPAddress(current_gw);
|
printIPAddress(current_gw);
|
||||||
printIPAddress(current_mask);
|
printIPAddress(current_mask); */
|
||||||
}
|
}
|
||||||
debugSerial<<F("Saved\n");
|
debugSerial<<F("Saved\n");
|
||||||
}
|
}
|
||||||
@@ -1104,9 +1107,13 @@ lan_status loadConfigFromHttp(int arg_cnt, char **args)
|
|||||||
return READ_RE_CONFIG;//-11;
|
return READ_RE_CONFIG;//-11;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if defined(__SAM3X8E__) || defined(ARDUINO_ARCH_STM32F1)
|
#if defined(__SAM3X8E__) || defined(ARDUINO_ARCH_STM32F1) || defined(ARDUINO_ARCH_ESP32)
|
||||||
String response;
|
#if defined(ARDUINO_ARCH_ESP32)
|
||||||
|
WiFiClient configEthClient;
|
||||||
|
#else
|
||||||
EthernetClient configEthClient;
|
EthernetClient configEthClient;
|
||||||
|
#endif
|
||||||
|
String response;
|
||||||
HttpClient htclient = HttpClient(configEthClient, configServer, 80);
|
HttpClient htclient = HttpClient(configEthClient, configServer, 80);
|
||||||
//htclient.stop(); //_socket =MAX
|
//htclient.stop(); //_socket =MAX
|
||||||
htclient.setHttpResponseTimeout(4000);
|
htclient.setHttpResponseTimeout(4000);
|
||||||
@@ -1142,7 +1149,7 @@ lan_status loadConfigFromHttp(int arg_cnt, char **args)
|
|||||||
return READ_RE_CONFIG;//-11; //Load from NVRAM
|
return READ_RE_CONFIG;//-11; //Load from NVRAM
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if defined(ARDUINO_ARCH_ESP32) || defined(ARDUINO_ARCH_ESP8266)
|
#if defined(ARDUINO_ARCH_ESP8266)
|
||||||
HTTPClient httpClient;
|
HTTPClient httpClient;
|
||||||
String fullURI = "http://";
|
String fullURI = "http://";
|
||||||
fullURI+=configServer;
|
fullURI+=configServer;
|
||||||
@@ -1194,6 +1201,8 @@ void postTransmission() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setup_main() {
|
void setup_main() {
|
||||||
|
//Serial.println("Hello");
|
||||||
|
//delay(1000);
|
||||||
setupCmdArduino();
|
setupCmdArduino();
|
||||||
printFirmwareVersionAndBuildOptions();
|
printFirmwareVersionAndBuildOptions();
|
||||||
|
|
||||||
|
|||||||
105
lighthub/main.h
105
lighthub/main.h
@@ -1,5 +1,48 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
|
#if defined(__SAM3X8E__)
|
||||||
|
#include <DueFlashStorage.h>
|
||||||
|
#include <watchdog.h>
|
||||||
|
#include <ArduinoHttpClient.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(ARDUINO_ARCH_AVR)
|
||||||
|
#include "HTTPClientAVR.h"
|
||||||
|
#include <avr/pgmspace.h>
|
||||||
|
#include <avr/wdt.h>
|
||||||
|
#include <EEPROM.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(ARDUINO_ARCH_ESP8266)
|
||||||
|
#include <FS.h> //this needs to be first, or it all crashes and burns...
|
||||||
|
#include <EEPROM.h>
|
||||||
|
#include <ESP8266HTTPClient.h>
|
||||||
|
#include <WiFiManager.h>
|
||||||
|
#include <DNSServer.h>
|
||||||
|
#include <ESP8266WebServer.h>
|
||||||
|
#include <ESP8266WiFi.h>
|
||||||
|
#include <user_interface.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined ARDUINO_ARCH_ESP32
|
||||||
|
//#include <FS.h> //this needs to be first, or it all crashes and burns...
|
||||||
|
//#include <EEPROM.h>
|
||||||
|
#include <NRFFlashStorage.h>
|
||||||
|
#include <HttpClient.h>
|
||||||
|
#include <WiFi.h>
|
||||||
|
#include <WiFiClient.h>
|
||||||
|
#include <WiFiClientSecure.h>
|
||||||
|
#include <WebServer.h>
|
||||||
|
#include <WiFiManager.h>
|
||||||
|
#include <DNSServer.h>
|
||||||
|
|
||||||
|
#define Ethernet WiFi
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef NRF5
|
||||||
|
#include <NRFFlashStorage.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(__SAM3X8E__)
|
#if defined(__SAM3X8E__)
|
||||||
#define wdt_res() watchdogReset()
|
#define wdt_res() watchdogReset()
|
||||||
@@ -56,18 +99,6 @@
|
|||||||
#include "DallasTemperature.h"
|
#include "DallasTemperature.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "Arduino.h"
|
|
||||||
#include <PubSubClient.h>
|
|
||||||
#include <SPI.h>
|
|
||||||
#include "utils.h"
|
|
||||||
#include <string.h>
|
|
||||||
#include "aJSON.h"
|
|
||||||
#include <Cmd.h>
|
|
||||||
#include "stdarg.h"
|
|
||||||
#include "item.h"
|
|
||||||
#include "inputs.h"
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef MODBUS_DISABLE
|
#ifndef MODBUS_DISABLE
|
||||||
#include <ModbusMaster.h>
|
#include <ModbusMaster.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -76,57 +107,23 @@
|
|||||||
#include "FastLED.h"
|
#include "FastLED.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "Dns.h"
|
|
||||||
//#include "hsv2rgb.h"
|
|
||||||
|
|
||||||
#if defined(__SAM3X8E__)
|
|
||||||
#include <DueFlashStorage.h>
|
|
||||||
#include <watchdog.h>
|
|
||||||
#include <ArduinoHttpClient.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(ARDUINO_ARCH_AVR)
|
|
||||||
#include "HTTPClientAVR.h"
|
|
||||||
#include <avr/pgmspace.h>
|
|
||||||
#include <avr/wdt.h>
|
|
||||||
#include <EEPROM.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(ESP8266)
|
|
||||||
#include <FS.h> //this needs to be first, or it all crashes and burns...
|
|
||||||
#include <EEPROM.h>
|
|
||||||
#include <ESP8266HTTPClient.h>
|
|
||||||
#include <WiFiManager.h>
|
|
||||||
#include <DNSServer.h>
|
|
||||||
#include <ESP8266WebServer.h>
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef _owire
|
#ifdef _owire
|
||||||
|
|
||||||
#include "owTerm.h"
|
#include "owTerm.h"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(_dmxin) || defined(_dmxout) || defined (_artnet)
|
#if defined(_dmxin) || defined(_dmxout) || defined (_artnet)
|
||||||
|
|
||||||
#include "dmx.h"
|
#include "dmx.h"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(ARDUINO_ARCH_AVR) || defined(__SAM3X8E__) || defined(ESP8266) || defined(NRF5)
|
|
||||||
#ifdef Wiz5500
|
#ifdef Wiz5500
|
||||||
#include <Ethernet2.h>
|
#include <Ethernet2.h>
|
||||||
#else
|
#else
|
||||||
|
#if defined(ARDUINO_ARCH_AVR) || defined(__SAM3X8E__) || defined(NRF5)
|
||||||
#include <Ethernet.h>
|
#include <Ethernet.h>
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ARDUINO_ARCH_ESP32
|
|
||||||
#include <SPI.h>
|
|
||||||
//#include <Ethernet3.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef _artnet
|
#ifdef _artnet
|
||||||
#include <Artnet.h>
|
#include <Artnet.h>
|
||||||
@@ -136,6 +133,18 @@
|
|||||||
#include "sd_card_w5100.h"
|
#include "sd_card_w5100.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "Arduino.h"
|
||||||
|
#include "utils.h"
|
||||||
|
#include "homiedef.h"
|
||||||
|
#include <PubSubClient.h>
|
||||||
|
#include <SPI.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include "aJSON.h"
|
||||||
|
#include <Cmd.h>
|
||||||
|
#include "stdarg.h"
|
||||||
|
#include "item.h"
|
||||||
|
#include "inputs.h"
|
||||||
|
|
||||||
#ifdef _artnet
|
#ifdef _artnet
|
||||||
extern Artnet *artnet;
|
extern Artnet *artnet;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -129,6 +129,10 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(ARDUINO_ARCH_ESP32)
|
#if defined(ARDUINO_ARCH_ESP32)
|
||||||
|
#undef _dmxin
|
||||||
|
#undef _modbus
|
||||||
|
#undef _dmxout
|
||||||
|
#undef modbusSerial
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef _dmxout
|
#ifndef _dmxout
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ unsigned long freeRam() {
|
|||||||
|
|
||||||
#endif
|
#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);
|
||||||
|
|
||||||
@@ -265,5 +265,67 @@ void ReadUniqueID( unsigned int * pdwUniqueID )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int inet_aton(const char* aIPAddrString, IPAddress& aResult)
|
||||||
|
{
|
||||||
|
// See if we've been given a valid IP address
|
||||||
|
const char* p =aIPAddrString;
|
||||||
|
while (*p &&
|
||||||
|
( (*p == '.') || (*p >= '0') || (*p <= '9') ))
|
||||||
|
{
|
||||||
|
p++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (*p == '\0')
|
||||||
|
{
|
||||||
|
// It's looking promising, we haven't found any invalid characters
|
||||||
|
p = aIPAddrString;
|
||||||
|
int segment =0;
|
||||||
|
int segmentValue =0;
|
||||||
|
while (*p && (segment < 4))
|
||||||
|
{
|
||||||
|
if (*p == '.')
|
||||||
|
{
|
||||||
|
// We've reached the end of a segment
|
||||||
|
if (segmentValue > 255)
|
||||||
|
{
|
||||||
|
// You can't have IP address segments that don't fit in a byte
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
aResult[segment] = (byte)segmentValue;
|
||||||
|
segment++;
|
||||||
|
segmentValue = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Next digit
|
||||||
|
segmentValue = (segmentValue*10)+(*p - '0');
|
||||||
|
}
|
||||||
|
p++;
|
||||||
|
}
|
||||||
|
// We've reached the end of address, but there'll still be the last
|
||||||
|
// segment to deal with
|
||||||
|
if ((segmentValue > 255) || (segment > 3))
|
||||||
|
{
|
||||||
|
// You can't have IP address segments that don't fit in a byte,
|
||||||
|
// or more than four segments
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
aResult[segment] = (byte)segmentValue;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#pragma message(VAR_NAME_VALUE(debugSerial))
|
#pragma message(VAR_NAME_VALUE(debugSerial))
|
||||||
#pragma message(VAR_NAME_VALUE(SERIAL_BAUD))
|
#pragma message(VAR_NAME_VALUE(SERIAL_BAUD))
|
||||||
|
|||||||
@@ -42,3 +42,4 @@ void parseBytes(const char* str, char separator, byte* bytes, int maxBytes, int
|
|||||||
int log(const char *str, ...);
|
int log(const char *str, ...);
|
||||||
void printFloatValueToStr(float value, char *valstr);
|
void printFloatValueToStr(float value, char *valstr);
|
||||||
void ReadUniqueID( unsigned int * pdwUniqueID );
|
void ReadUniqueID( unsigned int * pdwUniqueID );
|
||||||
|
int inet_aton(const char* aIPAddrString, IPAddress& aResult);
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
; http://docs.platformio.org/page/projectconf.html
|
; http://docs.platformio.org/page/projectconf.html
|
||||||
[platformio]
|
[platformio]
|
||||||
src_dir = lighthub
|
src_dir = lighthub
|
||||||
env_default = due-5500
|
env_default = esp32
|
||||||
;monitor_speed = 115200
|
;monitor_speed = 115200
|
||||||
; megaatmega2560
|
; megaatmega2560
|
||||||
; megaatmega2560-net
|
; megaatmega2560-net
|
||||||
@@ -21,11 +21,12 @@ env_default = due-5500
|
|||||||
; controllino
|
; controllino
|
||||||
; stm32
|
; stm32
|
||||||
; esp32-evb
|
; esp32-evb
|
||||||
|
; nrf52840_dk
|
||||||
|
|
||||||
;build_dir = /tmp/pioenvs
|
;build_dir = /tmp/pioenvs
|
||||||
;libdeps_dir = /tmp/piolibdeps
|
;libdeps_dir = /tmp/piolibdeps
|
||||||
[env:nrf52840_dk]
|
[env:nrf52840_dk]
|
||||||
platform = nordinrf52
|
platform = nordicnrf52
|
||||||
board = nrf52840_dk
|
board = nrf52840_dk
|
||||||
;upload_protocol = mbed
|
;upload_protocol = mbed
|
||||||
;upload_port = /dev/cu.SLAB_USBtoUART
|
;upload_port = /dev/cu.SLAB_USBtoUART
|
||||||
@@ -46,6 +47,9 @@ lib_ignore =
|
|||||||
ESPDMX
|
ESPDMX
|
||||||
DueFlashStorage
|
DueFlashStorage
|
||||||
PrintEx
|
PrintEx
|
||||||
|
DHT sensor library
|
||||||
|
DHT sensor library for ESPx
|
||||||
|
Adafruit Unified Sensor
|
||||||
; Adafruit_Sensor
|
; Adafruit_Sensor
|
||||||
lib_deps =
|
lib_deps =
|
||||||
https://github.com/anklimov/Arduino-Temperature-Control-Library.git
|
https://github.com/anklimov/Arduino-Temperature-Control-Library.git
|
||||||
@@ -58,55 +62,19 @@ lib_deps =
|
|||||||
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 for ESPx
|
; DHT sensor library for ESPx
|
||||||
DHT sensor library
|
; DHT sensor library
|
||||||
Streaming
|
Streaming
|
||||||
https://github.com/anklimov/NRFFlashStorage
|
https://github.com/anklimov/NRFFlashStorage
|
||||||
; https://github.com/livello/PrintEx#is-select-redecl
|
; https://github.com/livello/PrintEx#is-select-redecl
|
||||||
|
|
||||||
|
|
||||||
[env:esp32-evb]
|
|
||||||
platform = espressif32
|
|
||||||
framework = arduino
|
|
||||||
board = esp32-evb
|
|
||||||
upload_protocol = esptool
|
|
||||||
upload_speed = 115200
|
|
||||||
build_flags = !bash check_custom_build_flags_esp32.sh
|
|
||||||
lib_ignore =
|
|
||||||
DmxSimple
|
|
||||||
DMXSerial
|
|
||||||
DmxDue
|
|
||||||
DueFlashStorage
|
|
||||||
SD
|
|
||||||
SdFat
|
|
||||||
WifiManager
|
|
||||||
Ethernet
|
|
||||||
Ethernet2
|
|
||||||
httpClient
|
|
||||||
NRFFlashStorage
|
|
||||||
lib_deps =
|
|
||||||
https://github.com/anklimov/Arduino-Temperature-Control-Library.git
|
|
||||||
https://github.com/anklimov/DS2482_OneWire
|
|
||||||
Ethernet3
|
|
||||||
ESP8266HTTPClient
|
|
||||||
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
|
|
||||||
Streaming
|
|
||||||
; https://github.com/livello/PrintEx#is-select-redecl
|
|
||||||
|
|
||||||
|
|
||||||
[env:esp32]
|
[env:esp32]
|
||||||
platform = espressif32
|
platform = espressif32
|
||||||
framework = arduino
|
framework = arduino
|
||||||
board = pico32
|
;board = pico32
|
||||||
|
board = esp32-evb
|
||||||
upload_speed = 115200
|
upload_speed = 115200
|
||||||
build_flags = !bash check_custom_build_flags_esp32.sh
|
build_flags = !bash check_custom_build_flags_esp32.sh
|
||||||
lib_ignore =
|
lib_ignore =
|
||||||
@@ -116,29 +84,38 @@ lib_ignore =
|
|||||||
DueFlashStorage
|
DueFlashStorage
|
||||||
SD
|
SD
|
||||||
SdFat
|
SdFat
|
||||||
WifiManager
|
|
||||||
Ethernet
|
Ethernet
|
||||||
Ethernet2
|
Ethernet2
|
||||||
|
Ethernet3
|
||||||
HTTPClient
|
HTTPClient
|
||||||
httpClient
|
httpClient
|
||||||
NRFFlashStorage
|
EEPROM
|
||||||
lib_deps =
|
https://github.com/anklimov/ModbusMaster
|
||||||
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
|
||||||
Ethernet3
|
DS2482_OneWire
|
||||||
ESP8266HTTPClient
|
OneWire
|
||||||
https://github.com/anklimov/aJson
|
DallasTemperature
|
||||||
https://github.com/anklimov/CmdArduino
|
ModbusMaster
|
||||||
https://github.com/anklimov/ModbusMaster
|
Artnet
|
||||||
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 for ESPx
|
DHT sensor library for ESPx
|
||||||
DHT sensor library
|
DHT sensor library
|
||||||
|
Wire
|
||||||
|
;WifiManager
|
||||||
|
;HTTPClient
|
||||||
|
;HttpClient
|
||||||
|
lib_deps =
|
||||||
|
https://github.com/ebenolson/WIFIMANAGER-ESP32.git
|
||||||
|
https://github.com/zhouhan0126/WebServer-esp32.git
|
||||||
|
https://github.com/arduino-libraries/ArduinoHttpClient.git
|
||||||
|
https://github.com/anklimov/aJson
|
||||||
|
https://github.com/anklimov/CmdArduino
|
||||||
|
https://github.com/knolleary/pubsubclient.git
|
||||||
Streaming
|
Streaming
|
||||||
https://github.com/livello/PrintEx#is-select-redecl
|
https://github.com/anklimov/NRFFlashStorage
|
||||||
|
|
||||||
[env:due]
|
[env:due]
|
||||||
platform = atmelsam
|
platform = atmelsam
|
||||||
framework = arduino
|
framework = arduino
|
||||||
|
|||||||
Reference in New Issue
Block a user