diff --git a/lighthub/item.cpp b/lighthub/item.cpp index adc0318..3cf51f5 100644 --- a/lighthub/item.cpp +++ b/lighthub/item.cpp @@ -23,16 +23,17 @@ e-mail anklimov@gmail.com #include "utils.h" #ifdef _dmxout - #include "dmx.h" #include "FastLED.h" - #endif +#ifndef MODBUS_DISABLE #include +#endif #include + short modbusBusy = 0; extern aJsonObject *pollingItem; @@ -1266,7 +1267,10 @@ int Item::SendStatus(short cmd, short n, int *Par, boolean deffered) { if (Par) for (short i = 0; i < n; i++) { char num[4]; + #ifndef FLASH_64KB snprintf(num, sizeof(num), "%d", Par[i]); + #endif + itoa(Par[i],num,10); strncat(valstr, num, sizeof(valstr)); if (i != n - 1) { strcpy(num, ","); diff --git a/lighthub/main.cpp b/lighthub/main.cpp index f6f68f0..4d77acf 100644 --- a/lighthub/main.cpp +++ b/lighthub/main.cpp @@ -94,12 +94,13 @@ WiFiClient ethClient; #endif #ifdef ARDUINO_ARCH_STM32F1 +#include "HttpClient.h" //#include //#include "UIPEthernet.h" //#include "UIPUdp.h" #include #include -#include "HttpClient.h" + #include "Dns.h" //#include "utility/logging.h" #include @@ -126,10 +127,18 @@ aJsonObject *items = NULL; aJsonObject *inputs = NULL; aJsonObject *mqttArr = NULL; +#ifndef MODBUS_DISABLE aJsonObject *modbusArr = NULL; +#endif +#ifdef _owire aJsonObject *owArr = NULL; +#endif +#ifdef _dmxout aJsonObject *dmxArr = NULL; +#endif +#ifdef SYSLOG_ENABLE aJsonObject *udpSyslogArr = NULL; +#endif unsigned long nextPollingCheck = 0; unsigned long nextInputCheck = 0; @@ -378,7 +387,6 @@ void ip_ready_config_loaded_connecting_to_broker() { mqttClient.setCallback(mqttCallback); debugSerial<child; thermoItem; thermoItem = thermoItem->next) { if (isThermostatWithMinArraySize(thermoItem, 5)) { aJsonObject *thermoExtensionArray = aJson.getArrayItem(thermoItem, I_EXT); diff --git a/lighthub/main.h b/lighthub/main.h index 1ee34b2..b8c8ea4 100644 --- a/lighthub/main.h +++ b/lighthub/main.h @@ -55,13 +55,17 @@ #include #include "utils.h" #include -#include #include "aJSON.h" #include #include "stdarg.h" #include "item.h" #include "inputs.h" + +#ifndef MODBUS_DISABLE +#include +#endif + #ifndef ARDUINO_ARCH_STM32F1 #include "FastLED.h" #endif diff --git a/lighthub/options.h b/lighthub/options.h index 87bbde6..3654d89 100644 --- a/lighthub/options.h +++ b/lighthub/options.h @@ -158,6 +158,8 @@ #ifndef Wiz5500 #define W5100_ETHERNET_SHIELD +#else +#define W5500_ETHERNET_SHIELD #endif #define eol "\n" diff --git a/lighthub/utils.cpp b/lighthub/utils.cpp index db88ab5..ba8eaac 100644 --- a/lighthub/utils.cpp +++ b/lighthub/utils.cpp @@ -100,11 +100,13 @@ extern char _end; extern "C" char *sbrk(int i); unsigned long freeRam() { +#ifndef DISABLE_FREERAM_PRINT char *heapend = sbrk(0); register char *stack_ptr asm( "sp" ); struct mallinfo mi = mallinfo(); - return stack_ptr - heapend + mi.fordblks; +#endif + return 7777; } #endif @@ -156,6 +158,8 @@ void printFloatValueToStr(float value, char *valstr) { #define ARDBUFFER 16 //Buffer for storing intermediate strings. Performance may vary depending on size. +#ifndef ARDUINO_ARCH_STM32F1 + int log(const char *str, ...)//TODO: __FlashStringHelper str support { int i, count=0, j=0, flag=0; @@ -207,6 +211,7 @@ int log(const char *str, ...)//TODO: __FlashStringHelper str support Serial.println(); //Print trailing newline return count + 1; //Return number of arguments detected } +#endif #pragma message(VAR_NAME_VALUE(debugSerial)) diff --git a/platformio.ini b/platformio.ini index 7fc4ad3..b7e88a6 100644 --- a/platformio.ini +++ b/platformio.ini @@ -9,19 +9,19 @@ ; http://docs.platformio.org/page/projectconf.html [platformio] src_dir = lighthub -env_default = +;env_default = ; megaatmega2560 ; megaatmega2560-net ; due ; esp8266 ; esp32 ; megaatmega2560-5500 - due-5500 +; due-5500 ; controllino ; stm32 -build_dir = /tmp/pioenvs -libdeps_dir = /tmp/piolibdeps +;build_dir = /tmp/pioenvs +;libdeps_dir = /tmp/piolibdeps [env:esp32] platform = espressif32 @@ -247,35 +247,37 @@ lib_deps = https://github.com/livello/PrintEx#is-select-redecl ;TODO:STM32 compilation problems -;[env:stm32] -;platform = ststm32 -;framework = arduino -;board = nucleo_f103rb -;upload_protocol = stlink -;debug_tool = stlink -;build_flags = !bash check_custom_build_flags_stm32.sh -;lib_ignore = -; DHT sensor library for ESPx -; DmxDue -; DueFlashStorage -; ESP-Dmx -; WifiManager -; FastLED -; Ethernet -;lib_deps = +[env:stm32] +platform = ststm32 +framework = arduino +board = nucleo_f103rb +upload_protocol = stlink +debug_tool = stlink +build_flags = !bash check_custom_build_flags_stm32.sh +lib_ignore = + DHT sensor library for ESPx + DmxDue + DueFlashStorage + ESP-Dmx + WifiManager + FastLED + Ethernet + https://github.com/anklimov/Ethernet + DMXSerial + DmxSimple + httpClient + SD + PrintEx + Ethernet2 + Artnet + + +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 -; Streaming + https://github.com/anklimov/aJson + https://github.com/anklimov/CmdArduino + ArduinoHttpClient + https://github.com/knolleary/pubsubclient.git + Adafruit Unified Sensor + DHT sensor library + Streaming