mirror of
https://github.com/anklimov/lighthub
synced 2025-12-06 19:59:50 +03:00
MQTT subscribe fix, AnalogIn fix, first attempt to compile for NRF5
This commit is contained in:
BIN
.vscode/.browse.c_cpp.db
vendored
BIN
.vscode/.browse.c_cpp.db
vendored
Binary file not shown.
3
.vscode/arduino.json
vendored
3
.vscode/arduino.json
vendored
@@ -1,5 +1,4 @@
|
|||||||
{
|
{
|
||||||
"board": "esp8266:esp8266:d1",
|
"board": "arduino:sam:arduino_due_x",
|
||||||
"configuration": "CpuFrequency=80,FlashSize=4M1M,LwIPVariant=v2mss536,Debug=Disabled,DebugLevel=None____,UploadSpeed=921600",
|
|
||||||
"port": "/dev/cu.usbmodem1411"
|
"port": "/dev/cu.usbmodem1411"
|
||||||
}
|
}
|
||||||
23
.vscode/c_cpp_properties.json
vendored
23
.vscode/c_cpp_properties.json
vendored
@@ -5,6 +5,8 @@
|
|||||||
"name": "Mac",
|
"name": "Mac",
|
||||||
"macFrameworkPath": [],
|
"macFrameworkPath": [],
|
||||||
"includePath": [
|
"includePath": [
|
||||||
|
"/Users/andrey/Library/Arduino15/packages/arduino/tools/**",
|
||||||
|
"/Users/andrey/Library/Arduino15/packages/arduino/hardware/sam/1.6.11/**",
|
||||||
"/Users/andrey/.platformio/packages/framework-arduinosam/cores/sam",
|
"/Users/andrey/.platformio/packages/framework-arduinosam/cores/sam",
|
||||||
"/Users/andrey/.platformio/packages/framework-arduinosam/system/sam/libsam",
|
"/Users/andrey/.platformio/packages/framework-arduinosam/system/sam/libsam",
|
||||||
"/Users/andrey/.platformio/packages/framework-arduinosam/system/sam/CMSIS/CMSIS/Include",
|
"/Users/andrey/.platformio/packages/framework-arduinosam/system/sam/CMSIS/CMSIS/Include",
|
||||||
@@ -31,12 +33,7 @@
|
|||||||
"/Users/andrey/Documents/Arduino/lighthub/.piolibdeps/Streaming_ID560",
|
"/Users/andrey/Documents/Arduino/lighthub/.piolibdeps/Streaming_ID560",
|
||||||
"/Users/andrey/Documents/Arduino/lighthub/.piolibdeps/Syslog/src",
|
"/Users/andrey/Documents/Arduino/lighthub/.piolibdeps/Syslog/src",
|
||||||
"/Users/andrey/Documents/Arduino/lighthub/.piolibdeps/aJson",
|
"/Users/andrey/Documents/Arduino/lighthub/.piolibdeps/aJson",
|
||||||
"/Users/andrey/Documents/Arduino/lighthub/.piolibdeps/ArduinoJson_ID64/src",
|
"/Users/andrey/Documents/Arduino/lighthub/.piolibdeps/Ethernet2_ID261/src",
|
||||||
"/Users/andrey/Documents/Arduino/lighthub/.piolibdeps/AsyncMqttClient_ID346/src",
|
|
||||||
"/Users/andrey/Documents/Arduino/lighthub/.piolibdeps/Bounce2_ID1106/src",
|
|
||||||
"/Users/andrey/Documents/Arduino/lighthub/.piolibdeps/ESP Async WebServer_ID306/src",
|
|
||||||
"/Users/andrey/Documents/Arduino/lighthub/.piolibdeps/Homie_ID555/src",
|
|
||||||
"/Users/andrey/Documents/Arduino/lighthub/.piolibdeps/HttpClient_ID66",
|
|
||||||
"/Users/andrey/.platformio/packages/framework-arduinosam/libraries/__cores__/sam/HID/src",
|
"/Users/andrey/.platformio/packages/framework-arduinosam/libraries/__cores__/sam/HID/src",
|
||||||
"/Users/andrey/.platformio/packages/tool-unity",
|
"/Users/andrey/.platformio/packages/tool-unity",
|
||||||
"/Users/andrey/Documents/Arduino/lighthub/include",
|
"/Users/andrey/Documents/Arduino/lighthub/include",
|
||||||
@@ -73,12 +70,7 @@
|
|||||||
"/Users/andrey/Documents/Arduino/lighthub/.piolibdeps/Streaming_ID560",
|
"/Users/andrey/Documents/Arduino/lighthub/.piolibdeps/Streaming_ID560",
|
||||||
"/Users/andrey/Documents/Arduino/lighthub/.piolibdeps/Syslog/src",
|
"/Users/andrey/Documents/Arduino/lighthub/.piolibdeps/Syslog/src",
|
||||||
"/Users/andrey/Documents/Arduino/lighthub/.piolibdeps/aJson",
|
"/Users/andrey/Documents/Arduino/lighthub/.piolibdeps/aJson",
|
||||||
"/Users/andrey/Documents/Arduino/lighthub/.piolibdeps/ArduinoJson_ID64/src",
|
"/Users/andrey/Documents/Arduino/lighthub/.piolibdeps/Ethernet2_ID261/src",
|
||||||
"/Users/andrey/Documents/Arduino/lighthub/.piolibdeps/AsyncMqttClient_ID346/src",
|
|
||||||
"/Users/andrey/Documents/Arduino/lighthub/.piolibdeps/Bounce2_ID1106/src",
|
|
||||||
"/Users/andrey/Documents/Arduino/lighthub/.piolibdeps/ESP Async WebServer_ID306/src",
|
|
||||||
"/Users/andrey/Documents/Arduino/lighthub/.piolibdeps/Homie_ID555/src",
|
|
||||||
"/Users/andrey/Documents/Arduino/lighthub/.piolibdeps/HttpClient_ID66",
|
|
||||||
"/Users/andrey/.platformio/packages/framework-arduinosam/libraries/__cores__/sam/HID/src",
|
"/Users/andrey/.platformio/packages/framework-arduinosam/libraries/__cores__/sam/HID/src",
|
||||||
"/Users/andrey/.platformio/packages/tool-unity",
|
"/Users/andrey/.platformio/packages/tool-unity",
|
||||||
"/Users/andrey/Documents/Arduino/lighthub/include",
|
"/Users/andrey/Documents/Arduino/lighthub/include",
|
||||||
@@ -87,7 +79,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"defines": [
|
"defines": [
|
||||||
"PLATFORMIO=30603",
|
"PLATFORMIO=40000",
|
||||||
"__SAM3X8E__",
|
"__SAM3X8E__",
|
||||||
"ARDUINO_ARCH_SAM",
|
"ARDUINO_ARCH_SAM",
|
||||||
"ARDUINO_SAM_DUE",
|
"ARDUINO_SAM_DUE",
|
||||||
@@ -106,7 +98,10 @@
|
|||||||
"intelliSenseMode": "clang-x64",
|
"intelliSenseMode": "clang-x64",
|
||||||
"cStandard": "c11",
|
"cStandard": "c11",
|
||||||
"cppStandard": "c++11",
|
"cppStandard": "c++11",
|
||||||
"compilerPath": "/Users/andrey/.platformio/packages/toolchain-gccarmnoneeabi@1.40804.0/bin/arm-none-eabi-gcc -mthumb -mcpu=cortex-m3"
|
"compilerPath": "/Users/andrey/.platformio/packages/toolchain-gccarmnoneeabi@1.40804.0/bin/arm-none-eabi-gcc -mthumb -mcpu=cortex-m3",
|
||||||
|
"forcedInclude": [
|
||||||
|
"/Users/andrey/Library/Arduino15/packages/arduino/hardware/sam/1.6.11/cores/arduino/Arduino.h"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"version": 4
|
"version": 4
|
||||||
|
|||||||
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"terminal.integrated.env.osx": {
|
"terminal.integrated.env.osx": {
|
||||||
"PATH": "/Users/andrey/.platformio/penv/bin:/Users/andrey/.platformio/penv:/usr/local/opt/python@2/bin:/opt/local/sbin:/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Applications/Wireshark.app/Contents/MacOS",
|
"PATH": "/Users/andrey/.platformio/penv/bin:/Users/andrey/.platformio/penv:/usr/local/opt/ruby/bin:/usr/local/opt/python@2/bin:/opt/local/sbin:/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Applications/Wireshark.app/Contents/MacOS",
|
||||||
"PLATFORMIO_CALLER": "vscode"
|
"PLATFORMIO_CALLER": "vscode"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
#! /bin/bash
|
#! /bin/bash
|
||||||
|
export FLAGS="$FLAGS -DMODBUS_DISABLE"
|
||||||
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
|
||||||
|
|||||||
7
check_custom_build_flags_nrf52840.sh
Executable file
7
check_custom_build_flags_nrf52840.sh
Executable file
@@ -0,0 +1,7 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
export FLAGS="$FLAGS -DWiz5500"
|
||||||
|
CUSTOM_BUILD_FLAGS_FILE=custom-build-flags/build_flags_nrf52840.sh
|
||||||
|
if [ -f $CUSTOM_BUILD_FLAGS_FILE ]; then
|
||||||
|
source $CUSTOM_BUILD_FLAGS_FILE
|
||||||
|
fi
|
||||||
|
echo $FLAGS
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
# nano my_build_flags.sh
|
# nano my_build_flags.sh
|
||||||
# and source it
|
# and source it
|
||||||
# source my_build_flags.sh
|
# source my_build_flags.sh
|
||||||
#export FLAGS="-DMY_CONFIG_SERVER=lighthub.elistech.ru"
|
#export FLAGS="$FLAGS -DMY_CONFIG_SERVER=lighthub.elistech.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"
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
# first make your own copy of template
|
# first make your own copy of template
|
||||||
# cp build_flags_template.sh build_flags_ENVNAME.sh
|
# cp build_flags_template.sh build_flags_ENVNAME.sh
|
||||||
# then edit, change or comment something
|
# then edit, change or comment something
|
||||||
export FLAGS="-DMY_CONFIG_SERVER=lazyhome.ru"
|
export FLAGS="$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"
|
||||||
|
|||||||
31
custom-build-flags/build_flags_nrf52840.sh
Normal file
31
custom-build-flags/build_flags_nrf52840.sh
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
# usage:
|
||||||
|
# first make your own copy of template
|
||||||
|
# cp build_flags_template.sh build_flags_ENVNAME.sh
|
||||||
|
# then edit, change or comment something
|
||||||
|
export FLAGS="$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:ff"
|
||||||
|
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 FLAGS="$FLAGS -DWIFI_MANAGER_DISABLE"
|
||||||
|
# export FLAGS="$FLAGS -DRESET_PIN=5"
|
||||||
|
# export FLAGS="$FLAGS -DDHCP_RETRY_INTERVAL=60000"
|
||||||
|
# export FLAGS="$FLAGS -DRESTART_LAN_ON_MQTT_ERRORS"
|
||||||
|
# export FLAGS="$FLAGS -DW5500_CS_PIN=53"
|
||||||
|
export FLAGS="$FLAGS -DSYSLOG_DISABLE"
|
||||||
|
export FLAGS="$FLAGS -std=gnu++11"
|
||||||
|
#export FLAGS="$FLAGS -DDEVICE_NAME=MYDEVICE"
|
||||||
|
export FLAGS="$FLAGS -DDHT_COUNTER_DISABLE"
|
||||||
|
#export FLAGS="$FLAGS -DWITH_PRINTEX_LIB"
|
||||||
|
export FLAGS="$FLAGS -DPIO_SRC_REV="$(git log --pretty=format:%h_%ad -1 --date=short)
|
||||||
|
echo $FLAGS
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
# first make your own copy of template
|
# first make your own copy of template
|
||||||
# cp build_flags_template.sh build_flags_ENVNAME.sh
|
# cp build_flags_template.sh build_flags_ENVNAME.sh
|
||||||
# then edit, change or comment something
|
# then edit, change or comment something
|
||||||
export FLAGS="-DMY_CONFIG_SERVER=lazyhome.ru"
|
export FLAGS="$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"
|
||||||
|
|||||||
@@ -332,9 +332,9 @@ void Input::contactPoll() {
|
|||||||
WiringPinMode inputPinMode;
|
WiringPinMode inputPinMode;
|
||||||
#endif
|
#endif
|
||||||
#if defined(__SAM3X8E__)||defined(ARDUINO_ARCH_AVR)||defined(ARDUINO_ARCH_ESP8266)||defined(ARDUINO_ARCH_ESP32)
|
#if defined(__SAM3X8E__)||defined(ARDUINO_ARCH_AVR)||defined(ARDUINO_ARCH_ESP8266)||defined(ARDUINO_ARCH_ESP32)
|
||||||
uint32_t inputPinMode;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
uint32_t inputPinMode;
|
||||||
uint8_t inputOnLevel;
|
uint8_t inputOnLevel;
|
||||||
if (inType & IN_ACTIVE_HIGH) {
|
if (inType & IN_ACTIVE_HIGH) {
|
||||||
inputOnLevel = HIGH;
|
inputOnLevel = HIGH;
|
||||||
@@ -375,10 +375,10 @@ void Input::analogPoll() {
|
|||||||
#if defined(ARDUINO_ARCH_STM32F1)
|
#if defined(ARDUINO_ARCH_STM32F1)
|
||||||
WiringPinMode inputPinMode;
|
WiringPinMode inputPinMode;
|
||||||
#endif
|
#endif
|
||||||
#if defined(__SAM3X8E__)||defined(ARDUINO_ARCH_AVR)||defined(ARDUINO_ARCH_ESP8266)||defined(ARDUINO_ARCH_ESP32)
|
|
||||||
uint32_t inputPinMode;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
#if defined(__SAM3X8E__)||defined(ARDUINO_ARCH_AVR)||defined(ARDUINO_ARCH_ESP8266)||defined(ARDUINO_ARCH_ESP32)
|
||||||
|
#endif
|
||||||
|
uint32_t inputPinMode;
|
||||||
if (inType & IN_ACTIVE_HIGH) {
|
if (inType & IN_ACTIVE_HIGH) {
|
||||||
inputPinMode = INPUT;
|
inputPinMode = INPUT;
|
||||||
} else {
|
} else {
|
||||||
@@ -389,24 +389,25 @@ void Input::analogPoll() {
|
|||||||
// Mapping
|
// Mapping
|
||||||
if (inputMap && inputMap->type == aJson_Array)
|
if (inputMap && inputMap->type == aJson_Array)
|
||||||
{
|
{
|
||||||
|
int max;
|
||||||
if (aJson.getArraySize(inputMap)>=4)
|
if (aJson.getArraySize(inputMap)>=4)
|
||||||
mappedInputVal = map (mappedInputVal,
|
mappedInputVal = map (mappedInputVal,
|
||||||
aJson.getArrayItem(inputMap, 0)->valueint,
|
aJson.getArrayItem(inputMap, 0)->valueint,
|
||||||
aJson.getArrayItem(inputMap, 1)->valueint,
|
aJson.getArrayItem(inputMap, 1)->valueint,
|
||||||
aJson.getArrayItem(inputMap, 2)->valueint,
|
aJson.getArrayItem(inputMap, 2)->valueint,
|
||||||
aJson.getArrayItem(inputMap, 3)->valueint);
|
max=aJson.getArrayItem(inputMap, 3)->valueint);
|
||||||
if (aJson.getArraySize(inputMap)==5) Noize = aJson.getArrayItem(inputMap, 4)->valueint;
|
if (aJson.getArraySize(inputMap)==5) Noize = aJson.getArrayItem(inputMap, 4)->valueint;
|
||||||
|
if (mappedInputVal>max) mappedInputVal=max;
|
||||||
if (aJson.getArraySize(inputMap)==2)
|
if (aJson.getArraySize(inputMap)==2)
|
||||||
{
|
{
|
||||||
simple = 1;
|
simple = 1;
|
||||||
if (mappedInputVal < aJson.getArrayItem(inputMap, 0)->valueint) mappedInputVal = 0;
|
if (mappedInputVal < aJson.getArrayItem(inputMap, 0)->valueint) mappedInputVal = 0;
|
||||||
else if (mappedInputVal > aJson.getArrayItem(inputMap, 1)->valueint) mappedInputVal = 1;
|
else if (mappedInputVal > aJson.getArrayItem(inputMap, 1)->valueint) mappedInputVal = 1;
|
||||||
else mappedInputVal = -1;
|
else return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (simple) {
|
if (simple) {
|
||||||
if (mappedInputVal!=-1 && mappedInputVal != store->currentValue)
|
if (mappedInputVal != store->currentValue)
|
||||||
{
|
{
|
||||||
onContactChanged(mappedInputVal);
|
onContactChanged(mappedInputVal);
|
||||||
store->currentValue = mappedInputVal;
|
store->currentValue = mappedInputVal;
|
||||||
|
|||||||
@@ -218,7 +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)
|
#if not defined(ARDUINO_ARCH_ESP32) and not defined(ESP8266) and not defined(ARDUINO_ARCH_STM32F1) and not defined(DMX_DISABLE)
|
||||||
case -3: //RGB color in #RRGGBB notation
|
case -3: //RGB color in #RRGGBB notation
|
||||||
{
|
{
|
||||||
CRGB rgb;
|
CRGB rgb;
|
||||||
|
|||||||
@@ -109,6 +109,12 @@ WiFiClient ethClient;
|
|||||||
EthernetClient ethClient;
|
EthernetClient ethClient;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef NRF5
|
||||||
|
#include <NRFFlashStorage.h>
|
||||||
|
NRFFlashStorage EEPROM;
|
||||||
|
EthernetClient ethClient;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef SYSLOG_ENABLE
|
#ifdef SYSLOG_ENABLE
|
||||||
#include <Syslog.h>
|
#include <Syslog.h>
|
||||||
EthernetUDP udpSyslogClient;
|
EthernetUDP udpSyslogClient;
|
||||||
@@ -491,12 +497,13 @@ void ip_ready_config_loaded_connecting_to_broker() {
|
|||||||
|
|
||||||
strncpy_P(buf, outprefix, sizeof(buf));
|
strncpy_P(buf, outprefix, sizeof(buf));
|
||||||
strncat(buf, "#", sizeof(buf));
|
strncat(buf, "#", sizeof(buf));
|
||||||
mqttClient.subscribe(buf,MQTTQOS1);
|
mqttClient.subscribe(buf);
|
||||||
|
|
||||||
//Subscribing for command topics
|
//Subscribing for command topics
|
||||||
strncpy_P(buf, inprefix, sizeof(buf));
|
strncpy_P(buf, inprefix, sizeof(buf));
|
||||||
strncat(buf, "#", sizeof(buf));
|
strncat(buf, "#", sizeof(buf));
|
||||||
mqttClient.subscribe(buf,MQTTQOS1);
|
Serial.println(buf);
|
||||||
|
mqttClient.subscribe(buf);
|
||||||
|
|
||||||
//restoreState();
|
//restoreState();
|
||||||
onMQTTConnect();
|
onMQTTConnect();
|
||||||
@@ -738,7 +745,7 @@ void cmdFunctionKill(int arg_cnt, char **args) {
|
|||||||
|
|
||||||
void cmdFunctionReboot(int arg_cnt, char **args) {
|
void cmdFunctionReboot(int arg_cnt, char **args) {
|
||||||
debugSerial<<F("Soft rebooting...");
|
debugSerial<<F("Soft rebooting...");
|
||||||
softRebootFunc();
|
//// softRebootFunc();
|
||||||
}
|
}
|
||||||
|
|
||||||
void applyConfig() {
|
void applyConfig() {
|
||||||
|
|||||||
@@ -29,6 +29,12 @@
|
|||||||
#define wdt_dis()
|
#define wdt_dis()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(NRF5)
|
||||||
|
#define wdt_res()
|
||||||
|
#define wdt_en()
|
||||||
|
#define wdt_dis()
|
||||||
|
#endif
|
||||||
|
|
||||||
//#if defined(ESP8266)
|
//#if defined(ESP8266)
|
||||||
//#define wdt_res()
|
//#define wdt_res()
|
||||||
//#define wdt_en()
|
//#define wdt_en()
|
||||||
@@ -66,7 +72,7 @@
|
|||||||
#include <ModbusMaster.h>
|
#include <ModbusMaster.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef ARDUINO_ARCH_STM32F1
|
#ifndef DMX_DISABLE
|
||||||
#include "FastLED.h"
|
#include "FastLED.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -108,7 +114,7 @@
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(ARDUINO_ARCH_AVR) || defined(__SAM3X8E__) || defined(ESP8266)
|
#if defined(ARDUINO_ARCH_AVR) || defined(__SAM3X8E__) || defined(ESP8266) || defined(NRF5)
|
||||||
#ifdef Wiz5500
|
#ifdef Wiz5500
|
||||||
#include <Ethernet2.h>
|
#include <Ethernet2.h>
|
||||||
#else
|
#else
|
||||||
|
|||||||
@@ -66,7 +66,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef OUTTOPIC
|
#ifndef OUTTOPIC
|
||||||
#define OUTTOPIC "homie/s_out/"
|
#define OUTTOPIC "/myhome/s_out/"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef CMDTOPIC
|
#ifndef CMDTOPIC
|
||||||
|
|||||||
@@ -126,6 +126,23 @@ unsigned long freeRam() {
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(NRF5)
|
||||||
|
extern char _end;
|
||||||
|
extern "C" char *sbrk(int i);
|
||||||
|
|
||||||
|
unsigned long freeRam() {
|
||||||
|
char *ramstart = (char *) 0x20070000;
|
||||||
|
char *ramend = (char *) 0x20088000;
|
||||||
|
char *heapend = sbrk(0);
|
||||||
|
register char *stack_ptr asm( "sp" );
|
||||||
|
//struct mallinfo mi = mallinfo();
|
||||||
|
|
||||||
|
return stack_ptr - heapend;// + mi.fordblks;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
void parseBytes(const char *str, char separator, byte *bytes, int maxBytes, int base) {
|
void parseBytes(const char *str, char separator, byte *bytes, int maxBytes, int base) {
|
||||||
for (int i = 0; i < maxBytes; i++) {
|
for (int i = 0; i < maxBytes; i++) {
|
||||||
bytes[i] = strtoul(str, NULL, base); // Convert byte
|
bytes[i] = strtoul(str, NULL, base); // Convert byte
|
||||||
|
|||||||
@@ -24,6 +24,46 @@ env_default = due-5500
|
|||||||
|
|
||||||
;build_dir = /tmp/pioenvs
|
;build_dir = /tmp/pioenvs
|
||||||
;libdeps_dir = /tmp/piolibdeps
|
;libdeps_dir = /tmp/piolibdeps
|
||||||
|
[env:nrf52840_dk]
|
||||||
|
platform = nordinrf52
|
||||||
|
board = nrf52840_dk
|
||||||
|
;upload_protocol = mbed
|
||||||
|
;upload_port = /dev/cu.SLAB_USBtoUART
|
||||||
|
framework = arduino
|
||||||
|
build_flags = !bash check_custom_build_flags_nrf52840.sh
|
||||||
|
lib_ignore =
|
||||||
|
DmxSimple
|
||||||
|
DMXSerial
|
||||||
|
DmxDue
|
||||||
|
EEPROM
|
||||||
|
SD
|
||||||
|
SdFat
|
||||||
|
WifiManager
|
||||||
|
Ethernet
|
||||||
|
Ethernet3
|
||||||
|
httpClient
|
||||||
|
FastLED
|
||||||
|
ESPDMX
|
||||||
|
DueFlashStorage
|
||||||
|
PrintEx
|
||||||
|
; Adafruit_Sensor
|
||||||
|
lib_deps =
|
||||||
|
https://github.com/anklimov/Arduino-Temperature-Control-Library.git
|
||||||
|
https://github.com/anklimov/DS2482_OneWire
|
||||||
|
Ethernet2
|
||||||
|
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/anklimov/NRFFlashStorage
|
||||||
|
; https://github.com/livello/PrintEx#is-select-redecl
|
||||||
|
|
||||||
|
|
||||||
[env:esp32-evb]
|
[env:esp32-evb]
|
||||||
@@ -44,6 +84,7 @@ lib_ignore =
|
|||||||
Ethernet
|
Ethernet
|
||||||
Ethernet2
|
Ethernet2
|
||||||
httpClient
|
httpClient
|
||||||
|
NRFFlashStorage
|
||||||
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
|
||||||
@@ -59,7 +100,7 @@ lib_deps =
|
|||||||
DHT sensor library for ESPx
|
DHT sensor library for ESPx
|
||||||
DHT sensor library
|
DHT sensor library
|
||||||
Streaming
|
Streaming
|
||||||
https://github.com/livello/PrintEx#is-select-redecl
|
; https://github.com/livello/PrintEx#is-select-redecl
|
||||||
|
|
||||||
|
|
||||||
[env:esp32]
|
[env:esp32]
|
||||||
@@ -80,6 +121,7 @@ lib_ignore =
|
|||||||
Ethernet2
|
Ethernet2
|
||||||
HTTPClient
|
HTTPClient
|
||||||
httpClient
|
httpClient
|
||||||
|
NRFFlashStorage
|
||||||
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
|
||||||
@@ -110,6 +152,7 @@ lib_ignore =
|
|||||||
ESPDMX
|
ESPDMX
|
||||||
WifiManager
|
WifiManager
|
||||||
Ethernet3
|
Ethernet3
|
||||||
|
NRFFlashStorage
|
||||||
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
|
||||||
@@ -144,6 +187,7 @@ lib_ignore =
|
|||||||
WifiManager
|
WifiManager
|
||||||
Ethernet3
|
Ethernet3
|
||||||
HTTPClient
|
HTTPClient
|
||||||
|
NRFFlashStorage
|
||||||
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
|
||||||
@@ -177,6 +221,7 @@ lib_ignore =
|
|||||||
SdFat
|
SdFat
|
||||||
httpClient
|
httpClient
|
||||||
Ethernet3
|
Ethernet3
|
||||||
|
NRFFlashStorage
|
||||||
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
|
||||||
@@ -209,6 +254,7 @@ lib_ignore =
|
|||||||
WifiManager
|
WifiManager
|
||||||
Ethernet3
|
Ethernet3
|
||||||
Ethernet2
|
Ethernet2
|
||||||
|
NRFFlashStorage
|
||||||
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
|
||||||
@@ -244,6 +290,7 @@ lib_ignore =
|
|||||||
httpClient
|
httpClient
|
||||||
Ethernet
|
Ethernet
|
||||||
Ethernet3
|
Ethernet3
|
||||||
|
NRFFlashStorage
|
||||||
|
|
||||||
lib_deps =
|
lib_deps =
|
||||||
https://github.com/sebnil/DueFlashStorage
|
https://github.com/sebnil/DueFlashStorage
|
||||||
@@ -279,6 +326,7 @@ lib_ignore =
|
|||||||
WifiManager
|
WifiManager
|
||||||
Ethernet3
|
Ethernet3
|
||||||
Ethernet2
|
Ethernet2
|
||||||
|
NRFFlashStorage
|
||||||
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
|
||||||
@@ -322,6 +370,7 @@ lib_ignore =
|
|||||||
Ethernet2
|
Ethernet2
|
||||||
Artnet
|
Artnet
|
||||||
Ethernet3
|
Ethernet3
|
||||||
|
NRFFlashStorage
|
||||||
|
|
||||||
|
|
||||||
lib_deps =
|
lib_deps =
|
||||||
|
|||||||
Reference in New Issue
Block a user