diff --git a/build-flags/build_flags_due-5100 b/build-flags/build_flags_due-5100 deleted file mode 100644 index 3457cb4..0000000 --- a/build-flags/build_flags_due-5100 +++ /dev/null @@ -1,9 +0,0 @@ --DARTNET_ENABLE --DDMX_SMOOTH --DSTATUSLED --DSYSLOG_ENABLE --DWiz5100 -#-DPID_DISABLE --DARDUINO_OTA_MDNS_DISABLE --DMDNS_ENABLE --DTIMER_INT diff --git a/build-flags/build_flags_due-5500 b/build-flags/build_flags_due-5500 deleted file mode 100644 index b3872a3..0000000 --- a/build-flags/build_flags_due-5500 +++ /dev/null @@ -1,9 +0,0 @@ --DWiz5500 --DARTNET_ENABLE --DDMX_SMOOTH --DSTATUSLED --DSYSLOG_ENABLE -#-DPID_DISABLE --DARDUINO_OTA_MDNS_DISABLE --DMDNS_ENABLE --DTIMER_INT diff --git a/build-flags/build_flags_stm32 b/build-flags/build_flags_stm32 new file mode 100644 index 0000000..4d3f896 --- /dev/null +++ b/build-flags/build_flags_stm32 @@ -0,0 +1,12 @@ +-DDMX_DISABLE +-DMODBUS_DISABLE +-DMBUS_DISABLE +-DOWIRE_DISABLE +-DDHT_DISABLE +-DCOUNTER_DISABLE +-DNO_HOMIE +-DCSSHDC_DISABLE +-DSPILED_DISABLE +-DAC_DISABLE +-DPID_DISABLE +-DdebugSerialPort=SerialUSB diff --git a/build-flags/build_flags_stm32-enc2860 b/build-flags/build_flags_stm32-enc2860 index 8d34a98..728e7d5 100644 --- a/build-flags/build_flags_stm32-enc2860 +++ b/build-flags/build_flags_stm32-enc2860 @@ -9,3 +9,4 @@ -DSPILED_DISABLE -DAC_DISABLE -DPID_DISABLE +-DUIPETHERNET diff --git a/compiled/due-5100/firmware.bin b/compiled/due-5100/firmware.bin deleted file mode 100644 index 15a0e11..0000000 Binary files a/compiled/due-5100/firmware.bin and /dev/null differ diff --git a/compiled/due-5100/upload.bat b/compiled/due-5100/upload.bat deleted file mode 100644 index 29a5af9..0000000 --- a/compiled/due-5100/upload.bat +++ /dev/null @@ -1,3 +0,0 @@ -mode com3:1200,n,8,1 -pause -..\tools\win\tool-bossac\bossac.exe -i --port=com3 -U false -e -w -v -b firmware.bin -R \ No newline at end of file diff --git a/compiled/due-5100/upload.sh b/compiled/due-5100/upload.sh deleted file mode 100755 index cde7707..0000000 --- a/compiled/due-5100/upload.sh +++ /dev/null @@ -1,3 +0,0 @@ -export PORT=cu.usbmodem1451 -echo . | stty -f /dev/$PORT speed 1200 -../tools/mac/tool-bossac/bossac -U false -p $PORT -i -e -w -v -b firmware.bin -R \ No newline at end of file diff --git a/compiled/due-5500/firmware.bin b/compiled/due-5500/firmware.bin deleted file mode 100644 index 1ddd9d8..0000000 Binary files a/compiled/due-5500/firmware.bin and /dev/null differ diff --git a/compiled/due-5500/upload.bat b/compiled/due-5500/upload.bat deleted file mode 100644 index 29a5af9..0000000 --- a/compiled/due-5500/upload.bat +++ /dev/null @@ -1,3 +0,0 @@ -mode com3:1200,n,8,1 -pause -..\tools\win\tool-bossac\bossac.exe -i --port=com3 -U false -e -w -v -b firmware.bin -R \ No newline at end of file diff --git a/compiled/due-5500/upload.sh b/compiled/due-5500/upload.sh deleted file mode 100755 index e7d678a..0000000 --- a/compiled/due-5500/upload.sh +++ /dev/null @@ -1,3 +0,0 @@ -export PORT=cu.usbmodem14201 -echo . | stty -f /dev/$PORT speed 1200 -../tools/mac/tool-bossac/bossac -U false -p $PORT -i -e -w -v -b firmware.bin -R \ No newline at end of file diff --git a/compiled/due-5500/uploadOTA.bat b/compiled/due-5500/uploadOTA.bat deleted file mode 100644 index b553413..0000000 --- a/compiled/due-5500/uploadOTA.bat +++ /dev/null @@ -1 +0,0 @@ -..\tools\win\arduinoOTA.exe -address 192.168.88.21 -port 65280 -username arduino -password password -sketch firmware.bin -b -upload /sketch diff --git a/compiled/due-5500/uploadOTA.sh b/compiled/due-5500/uploadOTA.sh deleted file mode 100755 index 5cba131..0000000 --- a/compiled/due-5500/uploadOTA.sh +++ /dev/null @@ -1 +0,0 @@ -../tools/mac/arduinoOTA -address 192.168.88.21 -port 65280 -username arduino -password password -sketch firmware.bin -b -upload /sketch diff --git a/compiled/lighthub21/firmware.bin b/compiled/lighthub21/firmware.bin index 95a9ae9..a2af498 100644 Binary files a/compiled/lighthub21/firmware.bin and b/compiled/lighthub21/firmware.bin differ diff --git a/compiled/mega2560slim2/firmware.bin b/compiled/mega2560slim2/firmware.bin index ed3a5e8..d4b0fd5 100755 Binary files a/compiled/mega2560slim2/firmware.bin and b/compiled/mega2560slim2/firmware.bin differ diff --git a/lighthub/dmx.cpp b/lighthub/dmx.cpp index 5fcb5c0..a257f42 100644 --- a/lighthub/dmx.cpp +++ b/lighthub/dmx.cpp @@ -288,10 +288,16 @@ void DMXOUT_propagate() if (!step) step=1; if (delta<0) - {DmxWrite2(i,currLevel+step);debugSerial<<"<";} + { + DmxWrite2(i,currLevel+step); + //debugSerial<<"<"; + } if (delta>0) - {DmxWrite2(i,currLevel-step);debugSerial<<">";} + { + DmxWrite2(i,currLevel-step); + //debugSerial<<">"; + } } } checkTimestamp=now; diff --git a/lighthub/inputs.cpp b/lighthub/inputs.cpp index ec54960..37534ab 100644 --- a/lighthub/inputs.cpp +++ b/lighthub/inputs.cpp @@ -655,7 +655,7 @@ static volatile uint8_t contactPollBusy = 0; void Input::contactPoll(short cause) { boolean currentInputState; - if (!store || contactPollBusy) return; + if (!store /*|| contactPollBusy*/) return; contactPollBusy++; changeState(IS_REQSTATE,cause); //Check for postponed states transitions diff --git a/lighthub/inputs.h b/lighthub/inputs.h index 492d350..87fd755 100644 --- a/lighthub/inputs.h +++ b/lighthub/inputs.h @@ -55,7 +55,7 @@ e-mail anklimov@gmail.com -#define SAME_STATE_ATTEMPTS 3 +#define SAME_STATE_ATTEMPTS 2 #define ANALOG_STATE_ATTEMPTS 6 #define ANALOG_NOIZE 1 diff --git a/lighthub/main.cpp b/lighthub/main.cpp index 4845605..3e3f47f 100644 --- a/lighthub/main.cpp +++ b/lighthub/main.cpp @@ -1605,13 +1605,17 @@ void postTransmission() { volatile unsigned long timerCount=0; volatile int16_t timerNumber=-1; +volatile int8_t timerHandlerBusy=0; void TimerHandler(void) -{ interrupts(); +{ + timerHandlerBusy++; + interrupts(); timerCount=micros(); - if (configLoaded) inputLoop(CHECK_INTERRUPT); + if (configLoaded && !timerHandlerBusy) inputLoop(CHECK_INTERRUPT); + DMXOUT_propagate(); timerCount=micros()-timerCount; - + timerHandlerBusy--; } #if defined(__SAM3X8E__) && defined (TIMER_INT) @@ -2017,8 +2021,9 @@ void owIdle(void) { if (artnet && (lanStatus>=HAVE_IP_ADDRESS)) artnet->read(); #endif - wdt_res(); - return; +wdt_res(); +inputLoop(CHECK_INTERRUPT); + return; //????? #ifdef _dmxin yield(); diff --git a/lighthub/main.h b/lighthub/main.h index 0293e2a..697d61c 100644 --- a/lighthub/main.h +++ b/lighthub/main.h @@ -162,7 +162,7 @@ extern Streamlog errorSerial; #ifdef Wiz5500 #include #else - #ifdef ARDUINO_ARCH_STM32 + #ifdef UIPETHERNET #include "UIPEthernet.h" #else #include diff --git a/platformio.ini b/platformio.ini index 76276ac..94bf9c4 100644 --- a/platformio.ini +++ b/platformio.ini @@ -31,13 +31,8 @@ default_envs = ; LightHub controller HW revision 2.1 and above (Wiznet 5500 CS on pin 53) ; lighthub21 -; Arduino DUE + Ethernet shield Wiznet 5100 -; due-5100 - -; Generic DUE +; Generic DUE (working with Wiznet 5X00 network) ; due -; Arduino DUE + Ethernet shield Wiznet 5500 -; due-5500 ; ESP 8266 ; esp8266-wifi @@ -54,6 +49,9 @@ default_envs = ; STM32 board + ENC28j60 network ; stm32-enc2860 +; STM32 board (olmexino) with WIZNET 5X00 network +; stm32 + ; NRF52 board + Wiznet 5x00 network ; nrf52840 @@ -244,59 +242,7 @@ lib_deps = monitor_speed = 115200 -[env:due-5100] -platform = atmelsam -framework = arduino -board = due -monitor_baud = 115200 -build_flags = !python get_build_flags.py due-5100 -lib_ignore = - ;DS2482_OneWire //UNCOMMENT for software 1-wire driver - DHT sensor library for ESPx - ESP_EEPROM - DMXSerial - DmxSimple - httpClient - ESPDMX - ESP-Dmx - WifiManager - Ethernet3 - NRFFlashStorage - WebServer - UIPEthernet - EEPROM - M5Stack - ;ArduinoOTA -lib_deps = - https://github.com/sebnil/DueFlashStorage - https://github.com/anklimov/Arduino-Temperature-Control-Library.git - https://github.com/anklimov/DS2482_OneWire - https://github.com/anklimov/DmxDue - ArduinoHttpClient - https://github.com/anklimov/aJson - https://github.com/anklimov/CmdArduino - https://github.com/anklimov/ModbusMaster - https://github.com/anklimov/Ethernet5100 - https://github.com/knolleary/pubsubclient.git - https://github.com/anklimov/Artnet.git - FastLED@3.3.2 - SD - SdFat - Adafruit Unified Sensor - DHT sensor library - https://github.com/arcao/Syslog.git - Streaming - ClosedCube HDC1080 - SparkFun CCS811 Arduino Library@~1.0.7 - Adafruit NeoPixel - https://github.com/anklimov/ArduinoOTA - Adafruit MCP23017 Arduino Library - Adafruit BusIO - br3ttb/PID@^1.2.1 - ArduinoMDNS - https://github.com/khoih-prog/TimerInterrupt_Generic.git -monitor_speed = 115200 [env:due] ;Experimental target with universal Ethernet Library @@ -425,8 +371,8 @@ board_build.f_cpu = 16000000L ;build_unflags = -flto - not working without LTO! ;upload_protocol = arduino -upload_command = arduinoOTA -address 192.168.11.213 -port 65280 -username arduino -password password -b -upload /sketch -sketch $BUILD_DIR/${PROGNAME}.bin;sleep 5 -upload_protocol = custom +;upload_command = arduinoOTA -address 192.168.11.213 -port 65280 -username arduino -password password -b -upload /sketch -sketch $BUILD_DIR/${PROGNAME}.bin;sleep 5 +;upload_protocol = custom board_upload.speed = ${env:fuses_bootloader.board_bootloader.speed} framework = arduino @@ -646,60 +592,6 @@ lib_deps = monitor_speed = 115200 -[env:due-5500] -platform = atmelsam -framework = arduino -board = due -build_flags = !python get_build_flags.py due-5500 -lib_ignore = - ;DS2482_OneWire //UNCOMMENT for software 1-wire driver - DHT sensor library for ESPx - ESPDMX - ESP-Dmx - DMXSerial - WifiManager - DmxSimple - httpClient - Ethernet - Ethernet3 - Ethernet5100 - NRFFlashStorage - WebServer - UIPEthernet - ESP_EEPROM - EEPROM - M5Stack -lib_deps = - https://github.com/sebnil/DueFlashStorage - https://github.com/anklimov/Arduino-Temperature-Control-Library.git - https://github.com/anklimov/DS2482_OneWire - https://github.com/anklimov/DmxDue - ArduinoHttpClient - https://github.com/anklimov/aJson - https://github.com/anklimov/CmdArduino - https://github.com/anklimov/ModbusMaster - https://github.com/anklimov/Ethernet2 - https://github.com/knolleary/pubsubclient.git - https://github.com/anklimov/Artnet.git - FastLED@3.3.2 - SD - SdFat - Adafruit Unified Sensor - DHT sensor library - https://github.com/arcao/Syslog.git - Streaming - https://github.com/livello/PrintEx#is-select-redecl - ClosedCube HDC1080 - SparkFun CCS811 Arduino Library@~1.0.7 - Adafruit NeoPixel - https://github.com/anklimov/ArduinoOTA - Adafruit MCP23017 Arduino Library - Adafruit BusIO - br3ttb/PID@^1.2.1 - ArduinoMDNS - https://github.com/khoih-prog/TimerInterrupt_Generic.git - -monitor_speed = 115200 [env:lighthub21] platform = atmelsam @@ -707,9 +599,9 @@ framework = arduino board = due monitor_baud = 115200 build_flags = !python get_build_flags.py lighthub21 -;upload_command = arduinoOTA -address 192.168.11.172 -port 65280 -username arduino -password password -b -upload /sketch -sketch $SOURCE ;sleep 6 +upload_command = arduinoOTA -address 192.168.11.172 -port 65280 -username arduino -password password -b -upload /sketch -sketch $SOURCE ;sleep 6 ;upload_command = arduinoOTA -address 192.168.88.45 -port 65280 -username arduino -password password -b -upload /sketch -sketch $SOURCE;sleep 6 -;upload_protocol = custom +upload_protocol = custom lib_ignore = ;DS2482_OneWire //UNCOMMENT for software 1-wire driver DHT sensor library for ESPx @@ -868,6 +760,66 @@ lib_deps = monitor_speed = 115200 + +[env:stm32] +platform = ststm32 +board = olimexino +board_build.mcu = stm32f103rbt6 +board_build.f_cpu = 72000000L +framework = arduino +monitor_baud = 115200 +upload_protocol = dfu +;debug_tool = cmsis-dap +build_flags = !python get_build_flags.py stm32 +lib_ignore = + ;DS2482_OneWire //UNCOMMENT for software 1-wire driver + DHT sensor library for ESPx + DmxDue + DueFlashStorage + ESPDMX + ESP-Dmx + WifiManager + FastLED + UIPEthernet + DMXSerial + DmxSimple + httpClient + SD + PrintEx + Ethernet2 + Artnet + Ethernet3 + WebServer + ESP_EEPROM + DHT sensor library + DallasTemperature + Adafruit Unified Sensor + DS2482_OneWire + ModbusMaster + Syslog + EEPROM + ClosedCube HDC1080 + SparkFun CCS811 Arduino Library + M5Stack + ArduinoOTA +lib_deps = + https://github.com/anklimov/aJson + https://github.com/anklimov/CmdArduino + ArduinoHttpClient + https://github.com/knolleary/pubsubclient.git + Streaming + Ethernet + https://github.com/anklimov/NRFFlashStorage + Adafruit NeoPixel + Adafruit MCP23017 Arduino Library + Adafruit BusIO + SPI + br3ttb/PID@^1.2.1 + ArduinoMDNS + https://github.com/khoih-prog/TimerInterrupt_Generic.git + +monitor_speed = 115200 + ; Run the following command to upload with this environment ; pio run -e Upload_ISP -t upload [env:Upload_ISP]