65 Commits

Author SHA1 Message Date
09831781aa bins 2024-01-28 16:27:01 +03:00
340d54be09 sync 2024-01-28 16:20:45 +03:00
bcae3c9d50 artnet hung, sensors loop, inputs, multivent 2024-01-28 16:19:45 +03:00
1654f05bbe lh21 bins 2024-01-28 15:12:35 +03:00
99466f6e9f bins & cross-compilation 2024-01-28 15:10:56 +03:00
05ea031977 PID out, less logs, GET cfg fix, mbus concurr wrte 2024-01-28 12:05:10 +03:00
5ec57f0414 GET cmd refactored to operate in safe time 2024-01-27 15:03:11 +03:00
7ab78ab2ae binaries 2023-11-23 17:05:50 +03:00
4d909dd449 DMX IN integration with items 2023-11-20 20:55:37 +03:00
Климов Андрей Николаевич
b3db766b1a post-refactoring fix (Mercury) 2023-11-20 14:58:56 +03:00
080cdd4e22 LOG cleaning 2023-11-20 13:50:14 +03:00
91d5acf619 pre-release bins 2023-11-20 01:23:58 +03:00
454b88fbbf DMX IN fix (rollback to 2021) 2023-11-20 01:13:25 +03:00
6e283e32db decrease Timer0 int priority 2023-11-19 13:47:48 +03:00
18fbc783b5 templates, I2C/1Wire reset tune, bins 2023-11-18 00:57:12 +03:00
Климов Андрей Николаевич
5235bb67c1 timed command fx 2023-11-17 17:45:45 +03:00
9683e51c18 subitem retrieve fix, new loglev 9 for mbus trace 2023-11-15 11:02:53 +03:00
fd65c1a3a1 remove old stuff, templates for Emit strings 2023-11-12 23:21:11 +03:00
90298cd5a3 modbus 8N1 2023-11-12 16:36:35 +03:00
5719ba209a bins 2023-11-12 01:31:45 +03:00
2e21362fd8 I2C autoreset, driver status refactor, VC_TEMP fix 2023-11-12 01:04:53 +03:00
fe054c3c4e i2c reset utility 2023-11-09 09:48:51 +03:00
e3d84a1a02 binaries & migration 2560 slim to universal Wiznet 2023-11-07 21:02:40 +03:00
ca457a2a05 1w,MBUSv1,inputs resp fixes. update libs! 2023-11-07 19:37:19 +03:00
6d4f76c642 Multitask & 1-wire optimzation, sensor fixes 2023-11-07 01:48:48 +03:00
7251e229b6 pre-release bin & small fixes 2023-10-31 15:20:54 +03:00
Климов Андрей Николаевич
e9355ef142 modbus v2 fix 2023-10-31 00:13:09 +03:00
Климов Андрей Николаевич
7836876fcd crosscompilation fix 2023-10-30 20:36:30 +03:00
Климов Андрей Николаевич
8e7bbee96a Merge branch 'master' of https://github.com/anklimov/lighthub 2023-10-30 20:12:26 +03:00
Климов Андрей Николаевич
456f6b8ad4 modbus v1 retry optimisation 2023-10-30 20:12:16 +03:00
c4af5e92f9 Update README.md 2023-10-30 14:33:44 +03:00
Климов Андрей Николаевич
896a22862f 1-wire errors/reset improved, cleaned up 2023-10-30 00:00:11 +03:00
Климов Андрей Николаевич
83e8639034 Merge branch 'master' of https://github.com/anklimov/lighthub 2023-10-29 15:36:51 +03:00
Климов Андрей Николаевич
256ab175ce 1-w refactoring 2023-10-29 15:36:04 +03:00
199a80cbb9 pre-release binaries, all archs 2023-10-25 01:28:58 +03:00
Климов Андрей Николаевич
9204bd0898 +counter to Mega slim 2023-10-25 00:52:49 +03:00
Климов Андрей Николаевич
df4bf02e8d Merge branch 'master' of https://github.com/anklimov/lighthub 2023-10-25 00:29:14 +03:00
Климов Андрей Николаевич
45d925ba88 pins protection,core fixes for grp ch stat& sched 2023-10-25 00:28:26 +03:00
0a3bbcd7f9 binaries 2023-10-23 21:57:41 +03:00
Климов Андрей Николаевич
1e58ad90eb config reload issues fixed 2023-10-23 21:34:17 +03:00
a0ad782257 Update README.md 2023-10-21 22:55:33 +03:00
65556ed39d Update README.md 2023-10-21 22:19:57 +03:00
7bf685a0d4 cross-compiled & binaries 2023-10-21 21:52:57 +03:00
Климов Андрей Николаевич
f6a57348eb text chan types, comp options, counter fixed 2023-10-21 21:06:00 +03:00
Климов Андрей Николаевич
e93e52702e XNova CRYPT,SHAREDSECRET,PROTECTED_PINS,PULSEPIN12 2023-10-08 17:43:30 +03:00
Климов Андрей Николаевич
6cd4f1d82a mbus coils, discr inputs, new logic. AC - feedback 2023-08-13 23:49:35 +03:00
Климов Андрей Николаевич
3907158437 mac save&AC swmode fixes, sha256 sign for cmd tst 2023-07-16 20:29:59 +03:00
Климов Андрей Николаевич
eb68556012 STM32 persistent MVP, cross-compiled & binaries 2023-05-06 02:53:01 +03:00
Климов Андрей Николаевич
30f7b36a9c Multi-AC 2023-04-10 19:19:45 +03:00
Климов Андрей Николаевич
927272824c counter fix 2023-04-10 00:01:20 +03:00
Климов Андрей Николаевич
bab472d2d1 JSON RAM optimization (update libs needed), HTTP 2023-04-09 21:37:37 +03:00
Климов Андрей Николаевич
ec306c4934 Cumulative changes/pre-release 2023-04-02 17:27:02 +03:00
Климов Андрей Николаевич
3e0566cf07 ENABLE & DISABLE to separate topic and XON timer 2023-01-30 01:10:34 +03:00
Климов Андрей Николаевич
86d0d784a0 Mercury electricity counter driver, refactoring 2023-01-29 12:33:22 +03:00
Климов Андрей Николаевич
b06dad9395 noSerial option, DHT fix, 8266 slim to fit Sonoff 2022-12-16 17:14:59 +03:00
a974290389 Complex MBUS mapping, PID fix 2022-12-04 03:19:07 +03:00
2da04b45bf PID fixes/improvements and MBUS improvements 2022-11-28 14:57:43 +03:00
724eabc22f API CORS = * 2022-11-24 02:00:20 +03:00
c70a4eaac9 bin flash update fix (after revorking) & bins 2022-11-22 01:01:47 +03:00
a956b6f8e2 RAM optim to save huge configs to flash, PID min/max 2022-11-19 23:30:02 +03:00
07688f53ae core fixes (int & tens val<1), mbus optimization 2022-11-05 16:40:31 +03:00
6d28cb9f34 null mapping fix 2022-11-01 01:48:01 +03:00
d7e93177d6 possibility to turn val mapping off ("val":null) 2022-11-01 00:49:54 +03:00
c23543b213 PID & Modbus fine tuning 2022-10-31 23:56:51 +03:00
b94ab723ee modbus negative register fix 2022-10-13 08:22:06 +03:00
150 changed files with 74260 additions and 55297 deletions

View File

@@ -1,5 +1,15 @@
# LightHub # LightHub
is Flexible, Arduino-Mega/Arduino DUE/ESP8266/ESP32 open-software and open-hardware SmartHome controller. [RU](https://geektimes.ru/post/295109/) [HOME-site RU](http://lazyhome.ru) is Flexible, Arduino-Mega/Arduino DUE/ESP8266/ESP32 open-software and open-hardware SmartHome controller.
Useful links:
* [Article/RU](https://geektimes.ru/post/295109/)
* [HOME-site/RU](http://lazyhome.ru)
* [WIKI/RU](https://www.lazyhome.ru/dokuwiki/doku.php?id=start)
* [Doxigen autodocumentation for developers](https://anklimov.github.io/lighthub/docs/html/index.html) (litle bit outdated)
It may operate both: It may operate both:
* On [especially designed hardware board](http://www.lazyhome.ru/index.php/featurerequest) with 16 optocoupled digital inputs, 16 ESD protected digital/analog Inputs/outputs, 8 open-collector outputs (up to 0.5A/50V), DMX IN/OUT, MODBUS RTU and hardware 1-wire support circuit. * On [especially designed hardware board](http://www.lazyhome.ru/index.php/featurerequest) with 16 optocoupled digital inputs, 16 ESD protected digital/analog Inputs/outputs, 8 open-collector outputs (up to 0.5A/50V), DMX IN/OUT, MODBUS RTU and hardware 1-wire support circuit.
* On plain Arduino MEGA 2560, Arduino DUE, ESP8266, ESP32 and even on [Controllino](http://controllino.biz/) * On plain Arduino MEGA 2560, Arduino DUE, ESP8266, ESP32 and even on [Controllino](http://controllino.biz/)
@@ -12,7 +22,7 @@ Lighthub allows connecting together:
* Temperature/Humidity/CO2 sensors: DHT22, CS811, HDC1080 and any type of Modbus connected devices * Temperature/Humidity/CO2 sensors: DHT22, CS811, HDC1080 and any type of Modbus connected devices
* Standard nonexpensive Relay board with TTL inputs, [like this](http://ali.pub/2zlosh) to control AC powered lamps, floor heaters, boilers etc * Standard nonexpensive Relay board with TTL inputs, [like this](http://ali.pub/2zlosh) to control AC powered lamps, floor heaters, boilers etc
* [Standard nonexpensive LED dimmers](http://ali.pub/2zlokp) and [AC DMX-512 dimmers](http://ali.pub/2zlont) * [Standard nonexpensive LED dimmers](http://ali.pub/2zlokp) and [AC DMX-512 dimmers](http://ali.pub/2zlont)
* Modbus RTU devices (Currently, possible to control two types of Modbus devices: AC Dimmer and Ventilation set (Based on [Vacon 10 controller](http://files.danfoss.com/download/Drives/Vacon-10-Quick-Guide-DPD00714F1-UK.pdf)) and configure polling of virtually any Modbus device. * Modbus RTU devices (Currently, possible to control any type of Modbus devices - e.c dimmers, sensors, wall climate panels, HVAC e.t.c
* Simple DMX wall sensor panel [like this](http://ali.pub/2zlohe) * Simple DMX wall sensor panel [like this](http://ali.pub/2zlohe)
[List of non-expensive compatible components from AliExpress here](http://ppv.alipromo.com/custom/promo.php?hash=pjagwaovaero6vkeabjpkpvy4gznbgkc&landing_id=39661) [List of non-expensive compatible components from AliExpress here](http://ppv.alipromo.com/custom/promo.php?hash=pjagwaovaero6vkeabjpkpvy4gznbgkc&landing_id=39661)
@@ -43,14 +53,16 @@ Scalability of Lighthub is virtually unlimited: Setup so many controllers you ne
# Platforms specific details: # Platforms specific details:
**AVR** version (Arduino Mega) is basic, long time in production and have all functions **AVR** version (Arduino Mega) is basic, long time in production and have most functions
* DMX-out is software (DMXSimple) on pin3, can be re-defined to PIN 18 (USART1 TX) * DMX-out is software (DMXSimple) on pin3, can be re-defined to PIN 18 (USART1 TX)
* DMX-in - hardware * DMX-in - hardware
* WIZNET 5100 and 5500 Ethernets are supported * WIZNET 5100 and 5500 Ethernets are supported
* Modbus on USART2 * Modbus on USART2
* Very limited in terms of RAM available
* OptiBoot bootloader recommended
**SAM3X8E** (Arduino DUE): (Tested. In production. Recomended hardware at current moment) **SAM3X8E** (Arduino DUE): (Tested. In production. Recomended hardware at current moment)
* default PWM out frequency * Reachest funcionality from all possible options
* both, DMX-in and DMX-out are hardware USART based. Use USART1 (pins 18 and 19) for DMX-out and DMX-in * both, DMX-in and DMX-out are hardware USART based. Use USART1 (pins 18 and 19) for DMX-out and DMX-in
* WIZNET 5100 and 5500 Ethernets are supported * WIZNET 5100 and 5500 Ethernets are supported
* Modbus on USART2 * Modbus on USART2
@@ -58,7 +70,7 @@ Scalability of Lighthub is virtually unlimited: Setup so many controllers you ne
**ESP8266, ESP32**: (Tested) **ESP8266, ESP32**: (Tested)
* DMX-OUT on USART1 TX * DMX-OUT on USART1 TX
* DMX-IN - disabled - not possible to deploy in ESP8266 * DMX-IN - disabled - not possible to deploy in ESP8266
* Modbus - disabled on ESP8266, Might be configured in future on USART0 instead CLI/DEBUG, on ESP32 binded with UART2 * Modbus - disabled on ESP8266, Might be configured on USART0 instead CLI/DEBUG, on ESP32 binded with UART2
* Uses Wifi interface instead wired connection * Uses Wifi interface instead wired connection
**NRF52840** : Still early development stage **NRF52840** : Still early development stage

View File

@@ -3,4 +3,5 @@
-DWiz5100 -DWiz5100
#-DPID_DISABLE #-DPID_DISABLE
-DRESTART_LAN_ON_MQTT_ERRORS -DRESTART_LAN_ON_MQTT_ERRORS
-D CORS=\"http://lazyhome.ru\" -D CORS=\"*\"
-D REDIRECTION_URL=\"http://lazyhome.ru/pwa\"

View File

@@ -1,7 +1,7 @@
#-DW5500_CS_PIN=53 #-DW5500_CS_PIN=53
-DDMX_SMOOTH -DDMX_SMOOTH
-DSYSLOG_ENABLE -DSYSLOG_ENABLE
#-DMODBUS_DIMMER_PARAM=SERIAL_8E1 #-DMODBUS_SERIAL_PARAM=SERIAL_8E1
-DARTNET_ENABLE -DARTNET_ENABLE
-DOTA -DOTA
-DSTATUSLED -DSTATUSLED
@@ -10,8 +10,10 @@
-DARDUINO_OTA_MDNS_DISABLE -DARDUINO_OTA_MDNS_DISABLE
-DMDNS_ENABLE -DMDNS_ENABLE
-DMCP23017 -DMCP23017
-DCORS=\"http://lazyhome.ru\" -D CORS=\"*\"
-D REDIRECTION_URL=\"http://lazyhome.ru/pwa\"
-DTIMER_INT -DTIMER_INT
-DRESTART_LAN_ON_MQTT_ERRORS -DRESTART_LAN_ON_MQTT_ERRORS
-DOTA_PORT=80 -DOTA_PORT=80
-DMERCURY_ENABLE

View File

@@ -5,7 +5,7 @@
#-DAC_DISABLE #-DAC_DISABLE
-DMODBUS_DISABLE -DMODBUS_DISABLE
#-DMBUS_DISABLE #-DMBUS_DISABLE
-DCOUNTER_DISABLE #-DCOUNTER_DISABLE
-DSYSLOG_ENABLE -DSYSLOG_ENABLE
# - udp errors # - udp errors
-DOTA -DOTA
@@ -26,6 +26,10 @@
#-DmodbusSerial=Serial1 #-DmodbusSerial=Serial1
#-DMODBUS_DEBUG #-DMODBUS_DEBUG
#-DMODBUS_UART_RX_PIN=16
#-DMODBUS_UART_TX_PIN=17
#-DmodbusSerial=Serial2
# Use default pins for modbus UART # Use default pins for modbus UART
#-DMODBUS_UART_RX_PIN=-1 #-DMODBUS_UART_RX_PIN=-1
#-DMODBUS_UART_TX_PIN=-1 #-DMODBUS_UART_TX_PIN=-1
@@ -46,5 +50,11 @@
-DFS_PREPARE -DFS_PREPARE
-DRESTART_LAN_ON_MQTT_ERRORS -DRESTART_LAN_ON_MQTT_ERRORS
-D CORS=\"http://lazyhome.ru\" #-D CORS=\"http://lazyhome.ru\"
-DOTA_PORT=80 -DOTA_PORT=80
-DMQTT_KEEPALIVE=10
-DMQTT_SOCKET_TIMEOUT=20
-D CORS=\"*\"
-D REDIRECTION_URL=\"http://lazyhome.ru/pwa\"
#-DMERCURY_ENABLE

View File

@@ -7,7 +7,6 @@
-DARTNET_ENABLE -DARTNET_ENABLE
-DUSE_1W_PIN=16 -DUSE_1W_PIN=16
-DW5500_CS_PIN=15 -DW5500_CS_PIN=15
#-DPID_DISABLE
-DARDUINO_OTA_MDNS_DISABLE -DARDUINO_OTA_MDNS_DISABLE
-DMDNS_ENABLE -DMDNS_ENABLE
-DWM_MDNS -DWM_MDNS
@@ -17,8 +16,34 @@
-DFS_PREPARE -DFS_PREPARE
-DRESTART_LAN_ON_MQTT_ERRORS -DRESTART_LAN_ON_MQTT_ERRORS
#-D CORS=\"http://lazyhome.ru\" -D CORS=\"*\"
-D REDIRECTION_URL=\"http://lazyhome.ru/pwa\"
-DOTA_PORT=80 -DOTA_PORT=80
#oct22 - violation in Publish/OnMQTTConnect while publish homie info #oct22 - violation in Publish/OnMQTTConnect while publish homie info
-DNO_HOMIE -DNO_HOMIE
#options to fit firmware to Sonoff-S26 (uncomment it)
##Disabling debug log and move I2C to 1-3 pins
#-DnoSerial
#-D TWI_SCL=1
#-D TWI_SDA=3
##Slimming firmware to fit 50% of 1m flash
-DDMX_DISABLE
-UDARTNET_ENABLE
-DMODBUS_DISABLE
-DMBUS_DISABLE
-DOWIRE_DISABLE
-DCOUNTER_DISABLE
-DAC_DISABLE
-DMOTOR_DISABLE
-DMULTIVENT_DISABLE
-DHSV_DISABLE
-UMCP23017
-D BEARSSL_SSL_BASIC
-D SPILED_DISABLE
-D PWM_DISABLE
# WAK for HDC1080 (pin D3 on wemos is IO0)
-D WAK_PIN=D3

View File

@@ -12,8 +12,8 @@
-DTIMER_INT -DTIMER_INT
#-DFLASH_OFFSET=-256 #-DFLASH_OFFSET=-256
# Serial parameters for LEGACY Modbus # default MODBUS Serial parameters for LEGACY Modbus and MODBUS over IP
-DMODBUS_DIMMER_PARAM=SERIAL_8E1 #-DMODBUS_SERIAL_PARAM=SERIAL_8E1
#Set Logariphmic law for DMX channels bright #Set Logariphmic law for DMX channels bright
-DBRIGHT_LOG -DBRIGHT_LOG
@@ -34,5 +34,10 @@
#-DdebugSerialPort=Serial #-DdebugSerialPort=Serial
-DRESTART_LAN_ON_MQTT_ERRORS -DRESTART_LAN_ON_MQTT_ERRORS
-D CORS=\"http://lazyhome.ru\" #-D CORS=\"http://lazyhome.ru\"
-DOTA_PORT=80 -DOTA_PORT=80
-D CORS=\"*\"
-D REDIRECTION_URL=\"http://lazyhome.ru/pwa\"
-D MERCURY_ENABLE
#-D IPMODBUS
-D CONFIG_CLEAN_PIN=2

View File

@@ -19,5 +19,6 @@
-DOTA -DOTA
-DRESTART_LAN_ON_MQTT_ERRORS -DRESTART_LAN_ON_MQTT_ERRORS
-D CORS=\"http://lazyhome.ru\" -D CORS=\"*\"
-D REDIRECTION_URL=\"http://lazyhome.ru/pwa\"
-DOTA_PORT=80 -DOTA_PORT=80

View File

@@ -1,4 +1,4 @@
#-DMODBUS_DIMMER_PARAM=SERIAL_8E1 #-DMODBUS_SERIAL_PARAM=SERIAL_8E1
-DAVR_DMXOUT_PIN=18 -DAVR_DMXOUT_PIN=18
-DSYSLOG_ENABLE -DSYSLOG_ENABLE
-DWiz5100 -DWiz5100
@@ -7,5 +7,6 @@
-DMDNS_ENABLE -DMDNS_ENABLE
-DRESTART_LAN_ON_MQTT_ERRORS -DRESTART_LAN_ON_MQTT_ERRORS
-D CORS=\"http://lazyhome.ru\" -D CORS=\"*\"
-DOTA_PORT=80 -D REDIRECTION_URL=\"http://lazyhome.ru/pwa\"
-DOTA_PORT=80

View File

@@ -1,11 +1,18 @@
-DWiz5500 -DWiz5500
#-DMODBUS_DIMMER_PARAM=SERIAL_8E1 #-DMODBUS_SERIAL_PARAM=SERIAL_8E1
-DAVR_DMXOUT_PIN=18 -DAVR_DMXOUT_PIN=18
-DSYSLOG_ENABLE -DSYSLOG_ENABLE
#-DPID_DISABLE #-DPID_DISABLE
-DARDUINO_OTA_MDNS_DISABLE -DARDUINO_OTA_MDNS_DISABLE
-DMDNS_ENABLE -DMDNS_ENABLE
-DNO_HOMIE
-DCSSHDC_DISABLE
-DSPILED_DISABLE
-DAC_DISABLE
-DRESTART_LAN_ON_MQTT_ERRORS -DRESTART_LAN_ON_MQTT_ERRORS
-D CORS=\"http://lazyhome.ru\" -D CORS=\"*\"
-DOTA_PORT=80 -D REDIRECTION_URL=\"http://lazyhome.ru/pwa\"
-DOTA_PORT=80

View File

@@ -1,5 +1,5 @@
#-DMODBUS_DIMMER_PARAM=SERIAL_8E1 #-DMODBUS_SERIAL_PARAM=SERIAL_8E1
#-DAVR_DMXOUT_PIN=18 #-DAVR_DMXOUT_PIN=18
-DDMX_DISABLE -DDMX_DISABLE
-DMODBUS_DISABLE -DMODBUS_DISABLE
@@ -15,13 +15,16 @@
-DPID_DISABLE -DPID_DISABLE
-DOTA -DOTA
-DMOTOR_DISABLE -DMOTOR_DISABLE
-DMULTIVENT_DISABLE
#-DWiz5100 #-DWiz5100
-DARDUINO_OTA_MDNS_DISABLE -DARDUINO_OTA_MDNS_DISABLE
#-DMDNS_ENABLE -DMDNS_ENABLE
-DRESTART_LAN_ON_MQTT_ERRORS -DRESTART_LAN_ON_MQTT_ERRORS
-D CORS=\"http://lazyhome.ru\" -D CORS=\"*\"
-D REDIRECTION_URL=\"http://lazyhome.ru/pwa\"
# Example of UARTBRIDGE configuration # Example of UARTBRIDGE configuration
#-DUARTBRIDGE_ENABLE #-DUARTBRIDGE_ENABLE
-DOTA_PORT=80 -DOTA_PORT=80
#-DMERCURY_ENABLE

View File

@@ -1,29 +1,30 @@
#-DMODBUS_DIMMER_PARAM=SERIAL_8E1 #-DMODBUS_SERIAL_PARAM=SERIAL_8E1
#-DAVR_DMXOUT_PIN=18 #-DAVR_DMXOUT_PIN=18
-DDMX_DISABLE -DDMX_DISABLE
-DMODBUS_DISABLE -DMODBUS_DISABLE
#-DMBUS_DISABLE -DMBUS_DISABLE
#-DOWIRE_DISABLE #-DOWIRE_DISABLE
-DDHT_DISABLE -DDHT_DISABLE
-DCOUNTER_DISABLE #-DCOUNTER_DISABLE
-DNO_HOMIE -DNO_HOMIE
-DCSSHDC_DISABLE -DCSSHDC_DISABLE
-DSPILED_DISABLE -DSPILED_DISABLE
-DAC_DISABLE -DAC_DISABLE
-DSYSLOG_ENABLE -DSYSLOG_ENABLE
-DPID_DISABLE -DPID_DISABLE
-DWiz5100 #-DWiz5100
-DMOTOR_DISABLE -DMOTOR_DISABLE
-DOTA -DOTA
-DARDUINO_OTA_MDNS_DISABLE -DARDUINO_OTA_MDNS_DISABLE
#-DMDNS_ENABLE #-DMDNS_ENABLE
-DRESTART_LAN_ON_MQTT_ERRORS -DRESTART_LAN_ON_MQTT_ERRORS
-D CORS=\"http://lazyhome.ru\" -D CORS=\"*\"
-D REDIRECTION_URL=\"http://lazyhome.ru/pwa\"
-DOTA_PORT=80 -DOTA_PORT=80
-DHSV_DISABLE -DHSV_DISABLE
-DMULTIVENT_DISABLE -DMULTIVENT_DISABLE
-DPID_DISABLE -DPID_DISABLE
-DPWM_DISABLE -DPWM_DISABLE
-DSPILED_DISABLE -DSPILED_DISABLE
-DOW_DEVICES_LIMIT=17 #-DOW_DEVICES_LIMIT=17

View File

@@ -14,3 +14,6 @@
-DPID_DISABLE -DPID_DISABLE
#-DMCP23017 #-DMCP23017
-D CORS=\"*\"
-D REDIRECTION_URL=\"http://lazyhome.ru/pwa\"
#-DMERCURY_ENABLE

View File

@@ -9,15 +9,32 @@
-DSPILED_DISABLE -DSPILED_DISABLE
-DAC_DISABLE -DAC_DISABLE
-DPID_DISABLE -DPID_DISABLE
-DdebugSerialPort=SerialUSB
-DSerialPortType=USBSerial
-DSERIAL_BAUD=0
-DPIO_FRAMEWORK_ARDUINO_ENABLE_CDC -DENABLE_HWSERIAL1
-DUSBCON -DdebugSerialPort=Serial1
#-DFLASH_BASE_ADDRESS
#-DFLASH_DATA_SECTOR
#-DFLASH_PAGE_NUMBER
-D PIO_FRAMEWORK_ARDUINO_ENABLE_MASS_STORAGE
-D PIO_FRAMEWORK_ARDUINO_ENABLE_CDC_AND_MSC
#-DdebugSerialPort=SerialUSB
#-DSerialPortType=USBSerial
#-DSERIAL_BAUD=0
#-DPIO_FRAMEWORK_ARDUINO_ENABLE_CDC
#-DUSBCON
#-DUSBD_VID=0x0483 #-DUSBD_VID=0x0483
#-DUSBD_PID=0x5740 #-DUSBD_PID=0x5740
#-DUSB_MANUFACTURER="Unknown" #-DUSB_MANUFACTURER="Unknown"
#-DUSB_PRODUCT="\"BLUEPILL_F103C8\"" #-DUSB_PRODUCT="\"BLUEPILL_F103C8\""
#-DHAL_PCD_MODULE_ENABLED #-DHAL_PCD_MODULE_ENABLED
#-D USBD_USE_CDC #-D USBD_USE_CDC
-D HAL_CAN_MODULE_ENABLED
#HAL_ETH_MODULE_DISABLED
#HAL_SD_MODULE_DISABLED
#HAL_DAC_MODULE_DISABLED
#-DMERCURY_ENABLE

View File

@@ -0,0 +1,16 @@
REM fetch DeviceID of Arduino Port from WMI Service
FOR /f "tokens=* skip=1" %%a IN ('wmic PATH Win32_SerialPort Where "Caption LIKE '%%Arduino Uno%%'" get DeviceID') DO (
SET COMX=%%a
GOTO exit1
)
REM Arduino Due Programming Port not exist
GOTO error_comport
:exit1
REM remove blank
SET COMPORT=%COMX: =%
..\tools\win\tool-avrdude\avrdude -C ..\tools\win\tool-avrdude\avrdude.conf -c arduino -P %COMPORT% -b 19200 -p m16u2 -vvv -U flash:w:16u2.hex:i

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1 @@
..\tools\win\tool-avrdude\avrdude -C ../tools/mac/tool-avrdude/avrdude.conf -v -V -P com8 -patmega2560 -cwiring -b115200 -D -Uflash:w:firmware.hex:i

View File

@@ -0,0 +1 @@
..\tools\arduinoOTA.exe -address 192.168.11.213 -port 80 -username arduino -password password -sketch firmware.bin -b -upload /sketch

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -1,2 +1,2 @@
~/.platformio/packages/tool-mkspiffs/mkspiffs_espressif32_arduino -s 20480 -c data data.bin ~/.platformio/packages/tool-mkspiffs/mkspiffs_espressif32_arduino -s 20480 -c data data.bin
../tools/mac/arduinoOTA -v -address 192.168.88.50 -port 65280 -username arduino -password password -sketch data.bin -upload /data -b ../tools/mac/arduinoOTA -v -address 192.168.88.50 -port 80 -username arduino -password password -sketch data.bin -upload /data -b

View File

@@ -1 +1 @@
../tools/mac/arduinoOTA -v -address 192.168.88.50 -port 65280 -username arduino -password password -sketch firmware.bin -upload /sketch -b ../tools/mac/arduinoOTA -v -address 192.168.11.207 -port 80 -username arduino -password password -sketch firmware.bin -upload /sketch -b

Binary file not shown.

View File

@@ -0,0 +1,31 @@
Компактная сборка с набором опций, умещающаяся в 50 процентов flash ESP12
CLI и отладочная информация на serial0 отключена для возможности использования PIN0-1
(-)MULTIVENT
(+)PWM_RELAY
(+)MDNS
(-)UARTBRIDGE
(+)SYSLOG
(+)PID
(-)MCP23017
(-)ARTNET
(+)OTA
(-)SPI LED
(-)MOTOR CTR
(+)AC HAIER
(+)CCS811 & HDC1080
(+)RESTART_LAN_ON_MQTT_ERRORS
(-)HARDRESET, using soft
(-)COUNTER
(+)DHT
(-)OWIRE
(-)IPMODBUS
(-)MODBUS
(-)DMX
(+)WiFi
(+)FreeRam printing
(+)WATCHDOG
Config server:lazyhome.ru
201703L C++
version:e9355ef_2023-10-31

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,32 @@
Полная версия прошивки
(+)MULTIVENT
(+)PWM_RELAY
(+)MDNS
(-)UARTBRIDGE
(+)SYSLOG
(+)PID
(+)MCP23017
(+)ARTNET
(+)OTA
(+)SPI LED
(+)MOTOR CTR
(+)AC HAIER
(+)CCS811 & HDC1080
(+)RESTART_LAN_ON_MQTT_ERRORS
(-)HARDRESET, using soft
(+)COUNTER
(+)DHT
(-)DS2482-100 USE_1W_PIN
(+)OWIRE
(-)IPMODBUS
(+)MODBUS SERIAL_8N1 at Serial1 speed:9600
(+)ADAFRUIT LED
(+)DMX
(+)WiFi
(+)FreeRam printing
(+)WATCHDOG
lazyhome.ru
Config server:
201703L C++ version:e9355ef_2023-10-31

View File

@@ -0,0 +1 @@
../../tools/mac/arduinoOTA -address 192.168.11.208 -port 80 -username arduino -password password -b -upload /sketch -sketch firmware.bin

View File

@@ -0,0 +1 @@
arduinoOTA -address 192.168.11.208 -port 80 -username arduino -password password -b -upload /sketch -sketch firmware.bin

1
compiled/esp8266-wifi/ota.sh Executable file
View File

@@ -0,0 +1 @@
../tools/mac/arduinoOTA -address 192.168.11.208 -port 80 -username arduino -password password -b -upload /sketch -sketch firmware.bin

View File

@@ -0,0 +1 @@
wmic PATH Win32_SerialPort get DeviceID

Binary file not shown.

View File

@@ -0,0 +1,91 @@
@ECHO off
REM Wait X second for memory on Arduino Due is erased.
SET WAIT_ERASED=4
ECHO ------ External tool BossacArduinoDue started ------
REM number of command line arguments ok?
REM IF [%1]==[] GOTO error_args
REM IF [%2]==[] GOTO error_args
REM set command line arguments
SET BOSSACPATH=..\tools\win\tool-bossac\bossac.exe
SET BINFILE=firmware.bin
REM parse command line arguments
SET BOSSACPATH=%BOSSACPATH:"=%
SET BINFILE=%BINFILE:"=%
REM workeround for bug in Atmel Studio 6.0.1996 Service Pack 2
SET BINFILE=%BINFILE:\\=\%
SET BINFILE=%BINFILE:.cproj=%
REM bossac path exist?
IF NOT EXIST "%BOSSACPATH%" GOTO error_arg1
REM bin file exist?
IF NOT EXIST "%BINFILE%" GOTO error_binfile
REM fetch DeviceID of Arduino Due Programming Port from WMI Service
FOR /f "tokens=* skip=1" %%a IN ('wmic PATH Win32_SerialPort Where "Caption LIKE '%%BOSSA%%'" get DeviceID') DO (
SET COMX=%%a
GOTO exit1
)
REM Arduino Due Programming Port not exist
GOTO error_comport
:exit1
REM remove blank
SET COMPORT=%COMX: =%
REM report in Atmel Studio 6.0 IDE output window
ECHO BossacPath=%BOSSACPATH%
ECHO BinFile=%BINFILE%
ECHO Arduino Due Programming Port is detected as %COMPORT%.
REM The bossac bootloader only runs if the memory on Arduino Due is erased.
REM The Arduino IDE does this by opening and closing the COM port at 1200 baud.
REM This causes the Due to execute a soft erase command.
ECHO Forcing reset using 1200bps open/close on port
ECHO MODE %COMPORT%:1200,N,8,1
MODE %COMPORT%:1200,N,8,1
REM Wait X second for memory on Arduino Due is erased.
ECHO Wait for memory on Arduino Due is erased...
PING -n %WAIT_ERASED% 127.0.0.1>NUL
REM Execute bossac.exe
ECHO Execute bossac with command line:
"%BOSSACPATH%" -i --port=%COMPORT% --unlock -R
REM START /WAIT "" "%BOSSACPATH%" -i --port=%COMPORT% -u -e -w -v -b "%BINFILE%" -R
GOTO end
:error_args
ECHO Error: wrong number of command line arguments passed!
GOTO end
:error_arg1
ECHO Error: command line argument 1 - path to bossac.exe not exist! - "C:\Program Files (x86)\arduino-1.5.2\hardware\tools\bossac.exe"
ECHO Error: command line argument 1 - argument passed = %1
GOTO end
:error_arg2
ECHO Error: command line argument 2 - path to bin file not exist! - use $(OutputDirectory)\$(OutputFileName).bin
ECHO Error: command line argument 2 - argument passed = %1
GOTO end
:error_binfile
ECHO Error: bin file "%BINFILE%" not exist!
GOTO end
:error_comport
ECHO Error: Arduino Due Programming Port not found!
:end
ECHO ======================== Done ========================

View File

@@ -28,7 +28,7 @@ REM bin file exist?
IF NOT EXIST "%BINFILE%" GOTO error_binfile IF NOT EXIST "%BINFILE%" GOTO error_binfile
REM fetch DeviceID of Arduino Due Programming Port from WMI Service REM fetch DeviceID of Arduino Due Programming Port from WMI Service
FOR /f "tokens=* skip=1" %%a IN ('wmic PATH Win32_SerialPort Where "Caption LIKE '%%USB%%'" get DeviceID') DO ( FOR /f "tokens=* skip=1" %%a IN ('wmic PATH Win32_SerialPort Where "Caption LIKE '%%Due%%'" get DeviceID') DO (
SET COMX=%%a SET COMX=%%a
GOTO exit1 GOTO exit1
) )
@@ -59,8 +59,8 @@ PING -n %WAIT_ERASED% 127.0.0.1>NUL
REM Execute bossac.exe REM Execute bossac.exe
ECHO Execute bossac with command line: ECHO Execute bossac with command line:
ECHO "%BOSSACPATH%" -i -d --port=%COMPORT% -U false -e -w -v -b "%BINFILE%" -R "%BOSSACPATH%" -i --port=%COMPORT% -U false -w -v -b "%BINFILE%" -R
START /WAIT "" "%BOSSACPATH%" -i --port=%COMPORT% -U false -e -w -v -b "%BINFILE%" -R REM START /WAIT "" "%BOSSACPATH%" -i --port=%COMPORT% -U false -e -w -v -b "%BINFILE%" -R
GOTO end GOTO end

View File

@@ -1,3 +1,3 @@
export PORT=cu.usbmodem14101 export PORT=cu.usbmodem142101
echo . | stty -f /dev/$PORT speed 1200 echo . | stty -f /dev/$PORT speed 1200
../tools/mac/tool-bossac/bossac -U false -p $PORT -i -e -w -v -b firmware.bin -R ../tools/mac/tool-bossac/bossac -U false -p $PORT -i -w -v -b firmware.bin -R

View File

@@ -0,0 +1,91 @@
@ECHO off
REM Wait X second for memory on Arduino Due is erased.
SET WAIT_ERASED=4
ECHO ------ External tool BossacArduinoDue started ------
REM number of command line arguments ok?
REM IF [%1]==[] GOTO error_args
REM IF [%2]==[] GOTO error_args
REM set command line arguments
SET BOSSACPATH=..\tools\win\tool-bossac\bossac.exe
SET BINFILE=firmware.bin
REM parse command line arguments
SET BOSSACPATH=%BOSSACPATH:"=%
SET BINFILE=%BINFILE:"=%
REM workeround for bug in Atmel Studio 6.0.1996 Service Pack 2
SET BINFILE=%BINFILE:\\=\%
SET BINFILE=%BINFILE:.cproj=%
REM bossac path exist?
IF NOT EXIST "%BOSSACPATH%" GOTO error_arg1
REM bin file exist?
IF NOT EXIST "%BINFILE%" GOTO error_binfile
REM fetch DeviceID of Arduino Due Programming Port from WMI Service
FOR /f "tokens=* skip=1" %%a IN ('wmic PATH Win32_SerialPort Where "Caption LIKE '%%BOSSA%%'" get DeviceID') DO (
SET COMX=%%a
GOTO exit1
)
REM Arduino Due Programming Port not exist
GOTO error_comport
:exit1
REM remove blank
SET COMPORT=%COMX: =%
REM report in Atmel Studio 6.0 IDE output window
ECHO BossacPath=%BOSSACPATH%
ECHO BinFile=%BINFILE%
ECHO Arduino Due Programming Port is detected as %COMPORT%.
REM The bossac bootloader only runs if the memory on Arduino Due is erased.
REM The Arduino IDE does this by opening and closing the COM port at 1200 baud.
REM This causes the Due to execute a soft erase command.
ECHO Forcing reset using 1200bps open/close on port
ECHO MODE %COMPORT%:1200,N,8,1
MODE %COMPORT%:1200,N,8,1
REM Wait X second for memory on Arduino Due is erased.
ECHO Wait for memory on Arduino Due is erased...
PING -n %WAIT_ERASED% 127.0.0.1>NUL
REM Execute bossac.exe
ECHO Execute bossac with command line:
"%BOSSACPATH%" -i --port=%COMPORT% -w -v -b "%BINFILE%" -R
REM START /WAIT "" "%BOSSACPATH%" -i --port=%COMPORT% -u -e -w -v -b "%BINFILE%" -R
GOTO end
:error_args
ECHO Error: wrong number of command line arguments passed!
GOTO end
:error_arg1
ECHO Error: command line argument 1 - path to bossac.exe not exist! - "C:\Program Files (x86)\arduino-1.5.2\hardware\tools\bossac.exe"
ECHO Error: command line argument 1 - argument passed = %1
GOTO end
:error_arg2
ECHO Error: command line argument 2 - path to bin file not exist! - use $(OutputDirectory)\$(OutputFileName).bin
ECHO Error: command line argument 2 - argument passed = %1
GOTO end
:error_binfile
ECHO Error: bin file "%BINFILE%" not exist!
GOTO end
:error_comport
ECHO Error: Arduino Due Programming Port not found!
:end
ECHO ======================== Done ========================

View File

@@ -0,0 +1 @@
..\tools\arduinoOTA -address 192.168.11.204 -port 80 -username arduino -password password -sketch firmware.bin -b -upload /sketch

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1 @@
cp ../../.pio/build/lighthub21/firmware.bin .

6597
compiled/nrf52840-5500 Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

Binary file not shown.

9823
compiled/stm32/firmware.map Normal file

File diff suppressed because it is too large Load Diff

BIN
compiled/tools/arduinoOTA Executable file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

16
compiled/update_bin.bat Normal file
View File

@@ -0,0 +1,16 @@
copy ..\.pio\build\due\firmware.bin due
copy ..\.pio\build\controllino\firmware.hex controllino
copy ..\.pio\build\m5stack\firmware.bin m5stack
copy ..\.pio\build\mega2560slim\firmware.hex mega2560slim
copy ..\.pio\build\mega2560slim\firmware.bin mega2560slim
copy ..\.pio\build\mega2560slim2\firmware.hex mega2560slim2
copy ..\.pio\build\mega2560slim2\firmware.bin mega2560slim2
copy ..\.pio\build\due-5100\firmware.bin due-5100
copy ..\.pio\build\mega2560-5100\firmware.hex mega2560-5100
copy ..\.pio\build\due-5500\firmware.bin due-5500
copy ..\.pio\build\nrf52840\firmware.hex nrf52840-5500
copy ..\.pio\build\esp32-wifi\firmware.bin esp32-wifi
copy ..\.pio\build\stm32-enc2860\firmware.bin stm32-enc2860
copy ..\.pio\build\esp8266-wifi\firmware.bin esp8266-wifi
copy ..\.pio\build\lighthub21\firmware.bin lighthub21
copy ..\.pio\build\mega2560-5500\firmware.hex mega2560-5500

View File

@@ -1,8 +1,8 @@
cp ../.pio/build/due/firmware.bin due cp ../.pio/build/due/firmware.bin due
cp ../.pio/build/controllino/firmware.hex controllino cp ../.pio/build/controllino/firmware.hex controllino
cp ../.pio/build/m5stack/firmware.bin m5stack cp ../.pio/build/m5stack/firmware.bin m5stack
cp ../.pio/build/mega2560slim-5100/firmware.hex mega2560slim-5100 cp ../.pio/build/mega2560slim/firmware.hex mega2560slim
cp ../.pio/build/mega2560slim-5100/firmware.bin mega2560slim-5100 cp ../.pio/build/mega2560slim/firmware.bin mega2560slim
cp ../.pio/build/mega2560-optiboot/firmware.hex mega2560-optiboot cp ../.pio/build/mega2560-optiboot/firmware.hex mega2560-optiboot
cp ../.pio/build/mega2560-optiboot/firmware.bin mega2560-optiboot cp ../.pio/build/mega2560-optiboot/firmware.bin mega2560-optiboot
cp ../.pio/build/mega2560-5100/firmware.hex mega2560-5100 cp ../.pio/build/mega2560-5100/firmware.hex mega2560-5100

View File

@@ -0,0 +1,25 @@
{
"syslog":["95.31.43.9"],
"items": {
"ledhum":[6,-13],
"reghum": [13, [
[50, 10, 0, 60, 250, 200], [{"item": "relayhum"}, {"item":"ledhum"}]
], 30, 12],
"relayhum": [16, [12, 1200], 255, 2]
},
"in":{
"0":{"T":0,
"click":{ "item":"reghum","icmd":"TOGGLE"},
"dclick":{ "emit":"myhome/light-d2/light","ecmd":"TOGGLE"}
},
"3":{"T":4,
"temp":{"emit":"plugtemp"},
"hum":{"item":"reghum/val","emit":"plughum"}
}
},
"mqtt":["plug00","192.168.88.2"]
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,3 @@
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

View File

@@ -1,6 +1,8 @@
import os
Import("env") Import("env")
script = env.GetProjectOption("_upload_command")
script = env.GetProjectOption("_upload_command")
spath = os.path.abspath(script)
#env.Replace( #env.Replace(
# UPLOADER="executable or path to executable", # UPLOADER="executable or path to executable",
# UPLOADCMD=script # UPLOADCMD=script
@@ -8,5 +10,4 @@ script = env.GetProjectOption("_upload_command")
env.AddCustomTarget( env.AddCustomTarget(
"ota", "ota",
"$BUILD_DIR/${PROGNAME}.bin", "$BUILD_DIR/${PROGNAME}.bin",
script spath)
)

18
ldscripts/bootloader.ld Normal file
View File

@@ -0,0 +1,18 @@
/*
* Linker script for Generic STM32F103RE boards, using the generic bootloader (which takes the lower 8k of memory)
*/
MEMORY
{
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
rom (rx) : ORIGIN = 0x08002000, LENGTH = 504K
}
/* Provide memory region aliases for common.inc */
REGION_ALIAS("REGION_TEXT", rom);
REGION_ALIAS("REGION_DATA", ram);
REGION_ALIAS("REGION_BSS", ram);
REGION_ALIAS("REGION_RODATA", rom);
/* Let common.inc handle the real work. */
INCLUDE ldscripts/common.inc

220
ldscripts/common.inc Normal file
View File

@@ -0,0 +1,220 @@
/*
* Linker script for libmaple.
*
* Original author "lanchon" from ST forums, with modifications by LeafLabs.
*/
OUTPUT_FORMAT ("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")
/*
* Configure other libraries we want in the link.
*
* libgcc, libc, and libm are common across supported toolchains.
* However, some toolchains require additional archives which aren't
* present everywhere (e.g. ARM's gcc-arm-embedded releases).
*
* To hack around this, we let the build system specify additional
* archives by putting the right extra_libs.inc (in a directory under
* toolchains/) in our search path.
*/
GROUP(libgcc.a libc.a libm.a)
INCLUDE ldscripts/extra_libs.inc
/*
* These force the linker to search for vector table symbols.
*
* These symbols vary by STM32 family (and also within families).
* It's up to the build system to configure the link's search path
* properly for the target MCU.
*/
INCLUDE ldscripts/vector_symbols.inc
/* STM32 vector table. */
EXTERN(__stm32_vector_table)
/* C runtime initialization function. */
EXTERN(start_c)
/* main entry point */
EXTERN(main)
/* Initial stack pointer value. */
EXTERN(__msp_init)
PROVIDE(__msp_init = ORIGIN(ram) + LENGTH(ram));
/* Reset vector and chip reset entry point */
EXTERN(__start__)
ENTRY(__start__)
PROVIDE(__exc_reset = __start__);
/* Heap boundaries, for libmaple */
EXTERN(_lm_heap_start);
EXTERN(_lm_heap_end);
SECTIONS
{
.text :
{
__text_start__ = .;
/*
* STM32 vector table. Leave this here. Yes, really.
*/
*(.stm32.interrupt_vector)
/*
* Program code and vague linking
*/
*(.text .text.* .gnu.linkonce.t.*)
*(.plt)
*(.gnu.warning)
*(.glue_7t) *(.glue_7) *(.vfp11_veneer)
*(.ARM.extab* .gnu.linkonce.armextab.*)
*(.gcc_except_table)
*(.eh_frame_hdr)
*(.eh_frame)
. = ALIGN(4);
KEEP(*(.init))
. = ALIGN(4);
__preinit_array_start = .;
KEEP (*(.preinit_array))
__preinit_array_end = .;
. = ALIGN(4);
__init_array_start = .;
KEEP (*(SORT(.init_array.*)))
KEEP (*(.init_array))
__init_array_end = .;
. = ALIGN(0x4);
KEEP (*crtbegin.o(.ctors))
KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
KEEP (*(SORT(.ctors.*)))
KEEP (*crtend.o(.ctors))
. = ALIGN(4);
KEEP(*(.fini))
. = ALIGN(4);
__fini_array_start = .;
KEEP (*(.fini_array))
KEEP (*(SORT(.fini_array.*)))
__fini_array_end = .;
KEEP (*crtbegin.o(.dtors))
KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
KEEP (*(SORT(.dtors.*)))
KEEP (*crtend.o(.dtors))
} > REGION_TEXT
/*
* End of text
*/
.text.align :
{
. = ALIGN(8);
__text_end__ = .;
} > REGION_TEXT
/*
* .ARM.exidx exception unwinding; mandated by ARM's C++ ABI
*/
__exidx_start = .;
.ARM.exidx :
{
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
} > REGION_RODATA
__exidx_end = .;
/*
* .data
*/
.data :
{
__data_start__ = .;
LONG(0)
. = ALIGN(8);
*(.got.plt) *(.got)
*(.data .data.* .gnu.linkonce.d.*)
. = ALIGN(8);
__data_end__ = .;
} > REGION_DATA AT> REGION_RODATA
/*
* Read-only data
*/
.rodata :
{
*(.rodata .rodata.* .gnu.linkonce.r.*)
/* .USER_FLASH: We allow users to allocate into Flash here */
*(.USER_FLASH)
/* ROM image configuration; for C startup */
. = ALIGN(4);
_lm_rom_img_cfgp = .;
LONG(LOADADDR(.data));
/*
* Heap: Linker scripts may choose a custom heap by overriding
* _lm_heap_start and _lm_heap_end. Otherwise, the heap is in
* internal SRAM, beginning after .bss, and growing towards
* the stack.
*
* I'm shoving these here naively; there's probably a cleaner way
* to go about this. [mbolivar]
*/
_lm_heap_start = DEFINED(_lm_heap_start) ? _lm_heap_start : _end;
_lm_heap_end = DEFINED(_lm_heap_end) ? _lm_heap_end : __msp_init;
} > REGION_RODATA
/*
* .bss
*/
.bss :
{
. = ALIGN(8);
__bss_start__ = .;
*(.bss .bss.* .gnu.linkonce.b.*)
*(COMMON)
. = ALIGN (8);
__bss_end__ = .;
_end = __bss_end__;
} > REGION_BSS
/*
* Debugging sections
*/
.stab 0 (NOLOAD) : { *(.stab) }
.stabstr 0 (NOLOAD) : { *(.stabstr) }
/* DWARF debug sections.
* Symbols in the DWARF debugging sections are relative to the beginning
* of the section so we begin them at 0. */
/* DWARF 1 */
.debug 0 : { *(.debug) }
.line 0 : { *(.line) }
/* GNU DWARF 1 extensions */
.debug_srcinfo 0 : { *(.debug_srcinfo) }
.debug_sfnames 0 : { *(.debug_sfnames) }
/* DWARF 1.1 and DWARF 2 */
.debug_aranges 0 : { *(.debug_aranges) }
.debug_pubnames 0 : { *(.debug_pubnames) }
/* DWARF 2 */
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_line 0 : { *(.debug_line) }
.debug_frame 0 : { *(.debug_frame) }
.debug_str 0 : { *(.debug_str) }
.debug_loc 0 : { *(.debug_loc) }
.debug_macinfo 0 : { *(.debug_macinfo) }
/* SGI/MIPS DWARF 2 extensions */
.debug_weaknames 0 : { *(.debug_weaknames) }
.debug_funcnames 0 : { *(.debug_funcnames) }
.debug_typenames 0 : { *(.debug_typenames) }
.debug_varnames 0 : { *(.debug_varnames) }
.note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }
.ARM.attributes 0 : { KEEP (*(.ARM.attributes)) }
/DISCARD/ : { *(.note.GNU-stack) }
}

7
ldscripts/extra_libs.inc Normal file
View File

@@ -0,0 +1,7 @@
/*
* Extra archives needed by ARM's GCC ARM Embedded arm-none-eabi-
* releases (https://launchpad.net/gcc-arm-embedded/).
*/
/* This is for the provided newlib. */
GROUP(libnosys.a)

26
ldscripts/flash.ld Normal file
View File

@@ -0,0 +1,26 @@
/*
* libmaple linker script for "Flash" builds.
*
* A Flash build puts .text (and .rodata) in Flash, and
* .data/.bss/heap (of course) in SRAM, but offsets the sections by
* enough space to store the Maple bootloader, which lives in low
* Flash and uses low memory.
*/
/*
* This pulls in the appropriate MEMORY declaration from the right
* subdirectory of stm32/mem/ (the environment must call ld with the
* right include directory flags to make this happen). Boards can also
* use this file to use any of libmaple's memory-related hooks (like
* where the heap should live).
*/
INCLUDE mem-flash.inc
/* Provide memory region aliases for common.inc */
REGION_ALIAS("REGION_TEXT", rom);
REGION_ALIAS("REGION_DATA", ram);
REGION_ALIAS("REGION_BSS", ram);
REGION_ALIAS("REGION_RODATA", rom);
/* Let common.inc handle the real work. */
INCLUDE ldscripts/common.inc

31
ldscripts/jtag.ld Normal file
View File

@@ -0,0 +1,31 @@
/*
* libmaple linker script for "JTAG" builds.
*
* A "JTAG" build puts .text (and .rodata) in Flash, and
* .data/.bss/heap (of course) in SRAM, but links starting at the
* Flash and SRAM starting addresses (0x08000000 and 0x20000000
* respectively). This will wipe out a Maple bootloader if there's one
* on the board, so only use this if you know what you're doing.
*
* Of course, a "JTAG" build is perfectly usable for upload over SWD,
* the system memory bootloader, etc. The name is just a historical
* artifact.
*/
/*
* This pulls in the appropriate MEMORY declaration from the right
* subdirectory of stm32/mem/ (the environment must call ld with the
* right include directory flags to make this happen). Boards can also
* use this file to use any of libmaple's memory-related hooks (like
* where the heap should live).
*/
INCLUDE mem-jtag.inc
/* Provide memory region aliases for common.inc */
REGION_ALIAS("REGION_TEXT", rom);
REGION_ALIAS("REGION_DATA", ram);
REGION_ALIAS("REGION_BSS", ram);
REGION_ALIAS("REGION_RODATA", rom);
/* Let common.inc handle the real work. */
INCLUDE ldscripts/common.inc

46
ldscripts/ldscript.ld Normal file
View File

@@ -0,0 +1,46 @@
/*
!!!!!!!!!!!! STM32Duino default linker script
* This script extends the default linker script to add a .noinit
* section. This section is just mapped to RAM, but it is emitted
* separately from the .data and .bss sections (both of which are
* initialized by startup code), so any variables in this section are
* untouched on startup (so they survive across resets).
*
* This script is intended to supplied to the linker's -T / --script
* option as the primary linker script. When the linker sees an INSERT
* command, this will cause it to *also* read the default linker script
* (after reading this script) and then executing the INSERT commands
* after both scripts have been read.
*
* Note that parsing of linker scripts is a bit peculiar, e.g. INSERT
* does not textually inserts, it inserts any generated output sections.
* Also, because this script is read *first*, we cannot refer to things
* in the default script. In particular, it would make sense to add >
* RAM to the output section below to ensure that the section is mapped
* into RAM, but the RAM region is not defined yet (I think it would
* work though, but produces warnings). Instead, we just rely on the
* defaults used by the linker: If no region is defined for an output
* section, it will just map to first address after the previous section
* (.bss in this case, which is fine).
*/
SECTIONS
{
/* Define a noinit output section and mark it as NOLOAD to prevent
* putting its contents into the resulting .bin file (which is the
* default). */
.noinit (NOLOAD) :
{
/* Ensure output is aligned */
. = ALIGN(4);
/* Define a global _snoinit (and _enoinit below) symbol just in case
* code wants to iterate over all noinit variables for some reason */
_snoinit = .;
/* Actually import the .noinit and .noinit* import sections */
*(.noinit)
*(.noinit*)
. = ALIGN(4);
_enoinit = .;
}
}
INSERT AFTER .bss;

5
ldscripts/mem-flash.inc Normal file
View File

@@ -0,0 +1,5 @@
MEMORY
{
ram (rwx) : ORIGIN = 0x20000C00, LENGTH = 61K
rom (rx) : ORIGIN = 0x08005000, LENGTH = 492K
}

5
ldscripts/mem-jtag.inc Normal file
View File

@@ -0,0 +1,5 @@
MEMORY
{
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
rom (rx) : ORIGIN = 0x08000000, LENGTH = 512K
}

5
ldscripts/mem-ram.inc Normal file
View File

@@ -0,0 +1,5 @@
MEMORY
{
ram (rwx) : ORIGIN = 0x20000C00, LENGTH = 61K
rom (rx) : ORIGIN = 0x08005000, LENGTH = 0K
}

25
ldscripts/ram.ld Normal file
View File

@@ -0,0 +1,25 @@
/*
* libmaple linker script for RAM builds.
*
* A Flash build puts .text, .rodata, and .data/.bss/heap (of course)
* in SRAM, but offsets the sections by enough space to store the
* Maple bootloader, which uses low memory.
*/
/*
* This pulls in the appropriate MEMORY declaration from the right
* subdirectory of stm32/mem/ (the environment must call ld with the
* right include directory flags to make this happen). Boards can also
* use this file to use any of libmaple's memory-related hooks (like
* where the heap should live).
*/
INCLUDE mem-ram.inc
/* Provide memory region aliases for common.inc */
REGION_ALIAS("REGION_TEXT", ram);
REGION_ALIAS("REGION_DATA", ram);
REGION_ALIAS("REGION_BSS", ram);
REGION_ALIAS("REGION_RODATA", ram);
/* Let common.inc handle the real work. */
INCLUDE ldscripts/common.inc

18
ldscripts/stm32f103rb.ld Normal file
View File

@@ -0,0 +1,18 @@
/*
* Linker script for Generic STM32F103RB boards.
*/
MEMORY
{
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 20K
rom (rx) : ORIGIN = 0x08000000, LENGTH = 128K
}
/* Provide memory region aliases for common.inc */
REGION_ALIAS("REGION_TEXT", rom);
REGION_ALIAS("REGION_DATA", ram);
REGION_ALIAS("REGION_BSS", ram);
REGION_ALIAS("REGION_RODATA", rom);
/* Let common.inc handle the real work. */
INCLUDE ldscripts/common.inc

View File

@@ -0,0 +1,17 @@
/*
* Linker script for Generic STM32F103RB boards, using the generic bootloader (which takes the lower 8k of memory)
*/
MEMORY
{
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 20K
rom (rx) : ORIGIN = 0x08002000, LENGTH = 120K
}
/* Provide memory region aliases for common.inc */
REGION_ALIAS("REGION_TEXT", rom);
REGION_ALIAS("REGION_DATA", ram);
REGION_ALIAS("REGION_BSS", ram);
REGION_ALIAS("REGION_RODATA", rom);
/* Let common.inc handle the real work. */
INCLUDE ldscripts/common.inc

18
ldscripts/stm32f103rc.ld Normal file
View File

@@ -0,0 +1,18 @@
/*
* Linker script for Generic STM32F103RC boards.
*/
MEMORY
{
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 48K
rom (rx) : ORIGIN = 0x08000000, LENGTH = 256K
}
/* Provide memory region aliases for common.inc */
REGION_ALIAS("REGION_TEXT", rom);
REGION_ALIAS("REGION_DATA", ram);
REGION_ALIAS("REGION_BSS", ram);
REGION_ALIAS("REGION_RODATA", rom);
/* Let common.inc handle the real work. */
INCLUDE ldscripts/common.inc

View File

@@ -0,0 +1,18 @@
/*
* Linker script for Generic STM32F103RC boards, using the generic bootloader (which takes the lower 8k of memory)
*/
MEMORY
{
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 48K
rom (rx) : ORIGIN = 0x08002000, LENGTH = 248K
}
/* Provide memory region aliases for common.inc */
REGION_ALIAS("REGION_TEXT", rom);
REGION_ALIAS("REGION_DATA", ram);
REGION_ALIAS("REGION_BSS", ram);
REGION_ALIAS("REGION_RODATA", rom);
/* Let common.inc handle the real work. */
INCLUDE ldscripts/common.inc

18
ldscripts/stm32f103re.ld Normal file
View File

@@ -0,0 +1,18 @@
/*
* Linker script for Generic STM32F103RE boards.
*/
MEMORY
{
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
rom (rx) : ORIGIN = 0x08000000, LENGTH = 512K
}
/* Provide memory region aliases for common.inc */
REGION_ALIAS("REGION_TEXT", rom);
REGION_ALIAS("REGION_DATA", ram);
REGION_ALIAS("REGION_BSS", ram);
REGION_ALIAS("REGION_RODATA", rom);
/* Let common.inc handle the real work. */
INCLUDE ldscripts/common.inc

View File

@@ -0,0 +1,78 @@
EXTERN(__msp_init)
EXTERN(__exc_reset)
EXTERN(__exc_nmi)
EXTERN(__exc_hardfault)
EXTERN(__exc_memmanage)
EXTERN(__exc_busfault)
EXTERN(__exc_usagefault)
EXTERN(__stm32reservedexception7)
EXTERN(__stm32reservedexception8)
EXTERN(__stm32reservedexception9)
EXTERN(__stm32reservedexception10)
EXTERN(__exc_svc)
EXTERN(__exc_debug_monitor)
EXTERN(__stm32reservedexception13)
EXTERN(__exc_pendsv)
EXTERN(__exc_systick)
EXTERN(__irq_wwdg)
EXTERN(__irq_pvd)
EXTERN(__irq_tamper)
EXTERN(__irq_rtc)
EXTERN(__irq_flash)
EXTERN(__irq_rcc)
EXTERN(__irq_exti0)
EXTERN(__irq_exti1)
EXTERN(__irq_exti2)
EXTERN(__irq_exti3)
EXTERN(__irq_exti4)
EXTERN(__irq_dma1_channel1)
EXTERN(__irq_dma1_channel2)
EXTERN(__irq_dma1_channel3)
EXTERN(__irq_dma1_channel4)
EXTERN(__irq_dma1_channel5)
EXTERN(__irq_dma1_channel6)
EXTERN(__irq_dma1_channel7)
EXTERN(__irq_adc)
EXTERN(__irq_usb_hp_can_tx)
EXTERN(__irq_usb_lp_can_rx0)
EXTERN(__irq_can_rx1)
EXTERN(__irq_can_sce)
EXTERN(__irq_exti9_5)
EXTERN(__irq_tim1_brk)
EXTERN(__irq_tim1_up)
EXTERN(__irq_tim1_trg_com)
EXTERN(__irq_tim1_cc)
EXTERN(__irq_tim2)
EXTERN(__irq_tim3)
EXTERN(__irq_tim4)
EXTERN(__irq_i2c1_ev)
EXTERN(__irq_i2c1_er)
EXTERN(__irq_i2c2_ev)
EXTERN(__irq_i2c2_er)
EXTERN(__irq_spi1)
EXTERN(__irq_spi2)
EXTERN(__irq_usart1)
EXTERN(__irq_usart2)
EXTERN(__irq_usart3)
EXTERN(__irq_exti15_10)
EXTERN(__irq_rtcalarm)
EXTERN(__irq_usbwakeup)
EXTERN(__irq_tim8_brk)
EXTERN(__irq_tim8_up)
EXTERN(__irq_tim8_trg_com)
EXTERN(__irq_tim8_cc)
EXTERN(__irq_adc3)
EXTERN(__irq_fsmc)
EXTERN(__irq_sdio)
EXTERN(__irq_tim5)
EXTERN(__irq_spi3)
EXTERN(__irq_uart4)
EXTERN(__irq_uart5)
EXTERN(__irq_tim6)
EXTERN(__irq_tim7)
EXTERN(__irq_dma2_channel1)
EXTERN(__irq_dma2_channel2)
EXTERN(__irq_dma2_channel3)
EXTERN(__irq_dma2_channel4_5)

View File

@@ -10,7 +10,7 @@ extern PubSubClient mqttClient;
extern int8_t ethernetIdleCount; extern int8_t ethernetIdleCount;
int abstractCh::publishTopic(const char* topic, long value, const char* subtopic) int abstractCh::publishTopic(const char* topic, long value, const char* subtopic)
{ {
char valstr[16]; char valstr[16];
printUlongValueToStr(valstr, value); printUlongValueToStr(valstr, value);
return publishTopic(topic, valstr,subtopic); return publishTopic(topic, valstr,subtopic);
@@ -19,7 +19,7 @@ int abstractCh::publishTopic(const char* topic, long value, const char* subtopic
int abstractCh::publishTopic(const char* topic, float value, const char* subtopic) int abstractCh::publishTopic(const char* topic, float value, const char* subtopic)
{ {
char valstr[16]; char valstr[16];
printFloatValueToStr(value, valstr); printFloatValueToStr(valstr, value);
return publishTopic(topic, valstr,subtopic); return publishTopic(topic, valstr,subtopic);
}; };

View File

@@ -2,8 +2,9 @@
#include "Arduino.h" #include "Arduino.h"
#define CST_UNKNOWN 0 #define CST_UNKNOWN 0
#define CST_INITIALIZED 1 #define CST_FAILED 1
#define CST_FAILED 2 #define CST_INITIALIZED 2
#define CST_USER 3
class abstractCh { class abstractCh {
public: public:
@@ -11,9 +12,10 @@ public:
virtual ~abstractCh(){}; virtual ~abstractCh(){};
virtual int Poll(short cause) {return 0;} virtual int Poll(short cause) {return 0;}
virtual int Setup() =0; //Should initialize hardware and reserve resources virtual int Setup() =0; //Should initialize hardware and reserve resources
virtual int Anounce () {return 0;}; // virtual int Anounce () {return 0;};
virtual int Stop() {return 0;}; //Should free resources virtual int Stop() {return 0;}; //Should free resources
virtual int Status() {return CST_UNKNOWN;} virtual int Status() {return CST_UNKNOWN;}
virtual void setStatus(uint8_t status) {}
protected: protected:

View File

@@ -20,7 +20,7 @@ int abstractIn::publish(long value, const char* subtopic)
int abstractIn::publish(float value, const char* subtopic) int abstractIn::publish(float value, const char* subtopic)
{ {
char valstr[16]; char valstr[16];
printFloatValueToStr(value, valstr); printFloatValueToStr(valstr, value);
return publish(valstr,subtopic); return publish(valstr,subtopic);
}; };

View File

@@ -1,3 +1,5 @@
#pragma once #pragma once
#include "Arduino.h" #include "Arduino.h"
#include "abstractch.h" #include "abstractch.h"

View File

@@ -1,4 +1,5 @@
#include "item.h" #include "item.h"
#include "abstractout.h" #include "abstractout.h"
#include "itemCmd.h" #include "itemCmd.h"
@@ -12,6 +13,8 @@ int abstractOut::isActive()
case CMD_VOID: case CMD_VOID:
return 0; return 0;
break; break;
case CMD_ON: //trying (PWM ON set=0 issue)
return 1;
default: default:
st.loadItem(item); st.loadItem(item);
return st.getPercents255(); return st.getPercents255();
@@ -22,4 +25,16 @@ int abstractOut::Setup()
{ {
if (item && (item->getCmd()==-1)) item->setCmd(CMD_OFF); if (item && (item->getCmd()==-1)) item->setCmd(CMD_OFF);
return 1; return 1;
} }
int abstractOut::Status()
{
if (item && item->itemArr)
return item->itemArr->subtype;
return CST_UNKNOWN;
}
void abstractOut::setStatus(uint8_t status)
{
if (item && item->itemArr) item->itemArr->subtype = status & 0xF;
}

View File

@@ -8,11 +8,14 @@ class chPersistent {};
class abstractOut : public abstractCh{ class abstractOut : public abstractCh{
public: public:
abstractOut(Item * _item):abstractCh(){item=_item;}; abstractOut(Item * _item):abstractCh(){item=_item;};
virtual int Ctrl(itemCmd cmd, char* subItem=NULL, bool toExecute=true) =0; virtual int Ctrl(itemCmd cmd, char* subItem=NULL, bool toExecute=true, bool authorized = false) =0;
virtual int isActive(); virtual int isActive();
virtual bool isAllowed(itemCmd cmd){return true;};
virtual itemCmd getDefaultOnVal(){return itemCmd().Percents255(255);}; virtual itemCmd getDefaultOnVal(){return itemCmd().Percents255(255);};
virtual int getChanType(){return 0;} virtual int getChanType(){return 0;}
virtual int getDefaultStorageType(){return 0;} /// Remove?? Now getChanType used instead // virtual int getDefaultStorageType(){return 0;} /// Remove?? Now getChanType used instead
virtual int Status() override;
virtual void setStatus(uint8_t status) override;
int Setup() override; int Setup() override;
protected: protected:
Item * item; Item * item;

View File

@@ -16,7 +16,7 @@ short colorChannel::getChannelAddr(short n)
return item->getArg(n); return item->getArg(n);
} }
/*
int colorChannel::getDefaultStorageType() int colorChannel::getDefaultStorageType()
{ {
@@ -33,7 +33,7 @@ int colorChannel::getDefaultStorageType()
return ST_VOID; return ST_VOID;
} }
/*
int colorChannel::isActive() int colorChannel::isActive()
{ {
itemCmd st; itemCmd st;
@@ -44,7 +44,7 @@ return val;
} }
*/ */
int colorChannel::Ctrl(itemCmd cmd, char* subItem, bool toExecute) int colorChannel::Ctrl(itemCmd cmd, char* subItem, bool toExecute, bool authorized)
{ {
debugSerial<<F("clrCtr: "); debugSerial<<F("clrCtr: ");
cmd.debugOut(); cmd.debugOut();
@@ -58,29 +58,29 @@ case S_NOTFOUND:
// turn on and set // turn on and set
toExecute = true; toExecute = true;
case S_SET: case S_SET:
//case S_ESET:
case S_HSV: case S_HSV:
PixelCtrl(cmd, subItem, toExecute); PixelCtrl(cmd, subItem, toExecute, authorized);
return 1; return 1;
case S_CMD: case S_CMD:
//item->setCmd(cmd.getCmd()); //item->setCmd(cmd.getCmd());
switch (cmd.getCmd()) switch (cmd.getCmd())
{ {
case CMD_ON: case CMD_ON:
if (vol=cmd.getPercents()<MIN_VOLUME && vol>=0) vol=cmd.getPercents();
if (vol<MIN_VOLUME && vol>=0)
{ {
cmd.setPercents(INIT_VOLUME); cmd.setPercents(INIT_VOLUME);
cmd.saveItem(item); cmd.saveItem(item);
item->SendStatus(SEND_PARAMETERS | SEND_DEFFERED); item->SendStatus(FLAG_PARAMETERS | FLAG_SEND_DEFFERED);
}; };
PixelCtrl(cmd,subItem, true); PixelCtrl(cmd,subItem, true, authorized);
// item->SendStatus(SEND_COMMAND | SEND_PARAMETERS ); // item->SendStatus(FLAG_COMMAND | FLAG_PARAMETERS );
return 1; return 1;
case CMD_OFF: case CMD_OFF:
cmd.param.asInt32=0; cmd.param.asInt32=0;
PixelCtrl(cmd, subItem, true); PixelCtrl(cmd, subItem, true,authorized);
// item->SendStatus(SEND_COMMAND); // item->SendStatus(FLAG_COMMAND);
return 1; return 1;
default: default:

View File

@@ -14,9 +14,9 @@ public:
if (iaddr<0) iaddr=-iaddr; if (iaddr<0) iaddr=-iaddr;
numArgs = item->getArgCount(); // and how many addresses is configured numArgs = item->getArgCount(); // and how many addresses is configured
}; };
int Ctrl(itemCmd cmd, char* subItem=NULL, bool toExecute=true) override; int Ctrl(itemCmd cmd, char* subItem=NULL, bool toExecute=true, bool authorized=false) override;
int getDefaultStorageType()override; //int getDefaultStorageType()override;
virtual int PixelCtrl(itemCmd cmd, char* subItem=NULL, bool show=true ) =0; virtual int PixelCtrl(itemCmd cmd, char* subItem=NULL, bool show=true, bool authorized = false ) =0;
short getChannelAddr(short n =0); short getChannelAddr(short n =0);
// int isActive() override; // int isActive() override;
protected: protected:

View File

@@ -30,7 +30,7 @@ bool systemConfig::isValidSysConf()
stream->close(); stream->close();
return false; return false;
} }
stream->close(); stream->close();
return true; return true;
}; };
@@ -44,7 +44,7 @@ bool systemConfig::isValidSysConf()
bool isMacValid = false; bool isMacValid = false;
for (short i = 0; i < 6; i++) { for (short i = 0; i < 6; i++) {
mac[i] = stream->read(); mac[i] = stream->read();
if (mac[i] != 0 && mac[i] != 0xff) isMacValid = true; if ((mac[i] != 0) && (mac[i] != 0xff)) isMacValid = true;
} }
stream->close(); stream->close();
return isMacValid; return isMacValid;
@@ -53,7 +53,7 @@ bool systemConfig::isValidSysConf()
bool systemConfig::setMAC(macAddress& _mac) bool systemConfig::setMAC(macAddress& _mac)
{ {
if (!stream || !isValidSysConf()) return false; if (!stream || !isValidSysConf()) return false;
openStream('a'); openStream('r'); //was 'a'
stream->seek(offsetof(systemConfigData,mac)); stream->seek(offsetof(systemConfigData,mac));
stream->write ((const uint8_t *)&_mac,sizeof(_mac)); stream->write ((const uint8_t *)&_mac,sizeof(_mac));
memcpy(mac, _mac, sizeof(mac)); memcpy(mac, _mac, sizeof(mac));
@@ -293,6 +293,19 @@ bool systemConfig::setConfigFlags(systemConfigFlags flags)
return setConfigFlags(flags); return setConfigFlags(flags);
} }
bool systemConfig::getDHCPfallback()
{
systemConfigFlags flags = getConfigFlags();
return flags.dhcpFallback;
}
bool systemConfig::setDHCPfallback(bool flag)
{
systemConfigFlags flags = getConfigFlags();
flags.dhcpFallback=flag;
return setConfigFlags(flags);
}
bool systemConfig::getLoadHTTPConfig() bool systemConfig::getLoadHTTPConfig()
{ {
systemConfigFlags flags = getConfigFlags(); systemConfigFlags flags = getConfigFlags();

View File

@@ -61,6 +61,9 @@ class systemConfig {
bool saveETAG(); bool saveETAG();
bool loadETAG(); bool loadETAG();
bool getDHCPfallback();
bool setDHCPfallback(bool flag);
systemConfigFlags getConfigFlags(); systemConfigFlags getConfigFlags();
bool setConfigFlags(systemConfigFlags flags); bool setConfigFlags(systemConfigFlags flags);

View File

@@ -47,6 +47,7 @@ volatile uint32_t checkTimestamp=0L;
#if defined(_dmxin) #if defined(_dmxin)
volatile uint32_t D_State=0; volatile uint32_t D_State=0;
volatile unsigned long D_checkT=0; volatile unsigned long D_checkT=0;
uint8_t DMXINChannels=0;
#endif #endif
#ifdef _artnet #ifdef _artnet
@@ -61,6 +62,61 @@ extern aJsonObject *items;
extern aJsonObject *dmxArr; extern aJsonObject *dmxArr;
itemCmd rgb2hsv(itemCmd in)
{
itemCmd out;
out.setArgType(ST_HSV255);
double min, max, delta;
double inr=in.param.r/255;
double ing=in.param.g/255;
double inb=in.param.b/255;
double inw=in.param.w/255;
min = inr < ing ? inr : ing;
min = min < inb ? min : inb;
max = inr > ing ? inr : ing;
max = max > inb ? max : inb;
max = max > inw ? max : inw;
out.param.v = max*255; // v
delta = max - min;
if (delta < 0.00001)
{
out.param.s = 0;
out.param.h = 0; // undefined, maybe nan?
return out;
}
if( max > 0.0 ) { // NOTE: if Max is == 0, this divide would cause a crash
out.param.s = (delta / max)*100; // s
} else {
// if max is 0, then r = g = b = 0
// s = 0, h is undefined
out.param.s = 0;
out.param.h = 0; // its now undefined
return out;
}
double outh;
if( inr >= max ) // > is bogus, just keeps compilor happy
outh = ( ing - inb ) / delta; // between yellow & magenta
else
if( ing >= max )
outh = 2.0 + ( inb - inr ) / delta; // between cyan & yellow
else
outh = 4.0 + ( inr - ing ) / delta; // between magenta & cyan
outh *= 60.0; // degrees
if( outh < 0.0 )
outh += 360.0;
out.param.h=outh;
return out;
}
int itemCtrl2(char* name,int r,int g, int b, int w) int itemCtrl2(char* name,int r,int g, int b, int w)
{ {
if (!items) return 0; if (!items) return 0;
@@ -68,7 +124,6 @@ int itemCtrl2(char* name,int r,int g, int b, int w)
if (itemArr && (itemArr->type==aJson_Array)) if (itemArr && (itemArr->type==aJson_Array))
{ {
short itemtype = aJson.getArrayItem(itemArr,0)->valueint; short itemtype = aJson.getArrayItem(itemArr,0)->valueint;
short itemaddr = aJson.getArrayItem(itemArr,1)->valueint; short itemaddr = aJson.getArrayItem(itemArr,1)->valueint;
switch (itemtype){ switch (itemtype){
@@ -84,7 +139,6 @@ int itemCtrl2(char* name,int r,int g, int b, int w)
case CH_RGB: // RGB case CH_RGB: // RGB
{ {
DmxWrite(itemaddr, r); DmxWrite(itemaddr, r);
DmxWrite(itemaddr+1, g); DmxWrite(itemaddr+1, g);
DmxWrite(itemaddr+2, b); DmxWrite(itemaddr+2, b);
@@ -96,7 +150,7 @@ int itemCtrl2(char* name,int r,int g, int b, int w)
if (groupArr && (groupArr->type==aJson_Array)) if (groupArr && (groupArr->type==aJson_Array))
{ aJsonObject *i =groupArr->child; { aJsonObject *i =groupArr->child;
while (i) while (i)
{ //Serial.println(i->valuestring); {
if (i->type == aJson_String) itemCtrl2(i->valuestring,r,g,b,w); if (i->type == aJson_String) itemCtrl2(i->valuestring,r,g,b,w);
i=i->next;} i=i->next;}
} }
@@ -119,9 +173,34 @@ void DMXImmediateUpdate(short tch,short r, short g, short b, short w) {
} }
} }
void DMXSemiImmediateUpdate(short tch,short trh, int val) void DMXSemiImmediateUpdate(short tch,short r, short g, short b, short w)
{ {
//Here any code for passthrow between DMX IN and DMX OUT in idle state //Here any code for passthrow between DMX IN and DMX OUT in idle state
if (dmxArr && (dmxArr->type==aJson_Array))
{
aJsonObject *DMXch = aJson.getArrayItem(dmxArr,tch);
char* itemname = NULL;
if (DMXch->type == aJson_String) itemname=DMXch->valuestring;
if (itemname)
{
Item it(itemname);
if (!r && !g && !b && !w) it.Ctrl(itemCmd().Cmd(CMD_OFF).setSuffix(S_CMD));
else
{
/*
CRGB rgb;
rgb.r = r;
rgb.g = g;
rgb.b = b;
CHSV hsv = rgb2hsv_approximate(rgb);
it.Ctrl(itemCmd().HSV255(hsv.h,hsv.s,hsv.v).setSuffix(S_SET)); */
it.Ctrl(itemCmd().RGBW(r,g,b,w).setSuffix(S_SET));
//it.Ctrl(rgb2hsv(itemCmd().RGBW(r,g,b,w)).setSuffix(S_SET));
it.Ctrl(itemCmd().Cmd(CMD_ON).setSuffix(S_CMD));
}
}
}
} }
void DMXput(void) void DMXput(void)
@@ -132,6 +211,7 @@ for (short tch=0; tch<=3 ; tch++)
short base = tch*4; short base = tch*4;
DMXImmediateUpdate(tch,DMXin[base],DMXin[base+1],DMXin[base+2],DMXin[base+3]); DMXImmediateUpdate(tch,DMXin[base],DMXin[base+1],DMXin[base+2],DMXin[base+3]);
} }
}; };
extern volatile uint8_t timerHandlerBusy; extern volatile uint8_t timerHandlerBusy;
@@ -140,81 +220,62 @@ extern volatile uint8_t timerHandlerBusy;
volatile int DMXinDoublecheck=0; volatile int DMXinDoublecheck=0;
#endif #endif
// INVOKED BY INTERRUPTS - MUST BE SAFE CODE
void DMXUpdate(void) void DMXUpdate(void)
{ {
#if defined(_dmxin) #if defined(_dmxin)
int t;
if(!DMXin) return; if(!DMXin) return;
#if defined(__SAM3X8E__) #if defined(__SAM3X8E__)
if (dmxin.getRxLength()<16) return; if (dmxin.getRxLength()<DMXINChannels) return;
#endif #endif
for (short tch=0; tch<=3 ; tch++)
uint8_t RGBWChannels=DMXINChannels >> 2;
for (short tch=0; tch<RGBWChannels ; tch++)
{ {
short base = tch*4; short base = tch*4;
bool updated = 0; bool updated = false;
bool confirmed = 0; int t;
for (short trh=0; trh<4 ; trh++) for (short trh=0; trh<4 ; trh++)
if (((t=dmxin.read(base+trh+1)) != DMXin[base+trh])) if ((t=dmxin.read(base+trh+1)) != DMXin[base+trh])
{ {
D_State |= (1<<tch);
updated=1; updated=1;
if (DMXinDoublecheck>2) DMXin[base+trh]=t;
{ }
D_State |= (1<<tch); if (updated)
DMXin[base+trh]=t;
confirmed = 1;
}
}
if (updated) DMXinDoublecheck++; else DMXinDoublecheck=0;
if (confirmed)
{ {
DMXImmediateUpdate(tch,DMXin[base],DMXin[base+1],DMXin[base+2],DMXin[base+3]); DMXImmediateUpdate(tch,DMXin[base],DMXin[base+1],DMXin[base+2],DMXin[base+3]);
//for (int i=1; i<17; i++) {debugSerial.print(dmxin.read(i));debugSerial.print("-");};debugSerial.print("|");
D_checkT=millisNZ(); D_checkT=millisNZ();
} }
} }
//Serial.print(D_State,BIN);Serial.println();
#endif #endif
} }
// INVOKED in safe loop
void DMXCheck(void) void DMXCheck(void)
{ {
// CHSV hsv;
// CRGB rgb;
DMXOUT_propagate(); DMXOUT_propagate();
#if defined(_dmxin) #if defined(_dmxin)
if ( (!D_checkT) || (!isTimeOver(D_checkT,millis(),D_CHECKT))) return;
short t,tch;
//Here code for semi-immediate update
for (t=1,tch=0; t<=8 ; t<<=1,tch++)
if (D_State & t)
{
// Serial.print(D_State,BIN);Serial.print(":");
D_State &= ~t;
for (short trh=0; trh<4 ; trh++)
DMXSemiImmediateUpdate(tch,trh,DMXin[tch*4+trh]);
}
//if ((millis()<D_checkT) || (D_checkT==0)) return;
if ( (!D_checkT) || (!isTimeOver(D_checkT,millis(),D_CHECKT))) return;
D_checkT=0; D_checkT=0;
uint8_t RGBWChannels=DMXINChannels >> 2;
for (short rgbwChan=0; rgbwChan < RGBWChannels; rgbwChan++)
{
short base = rgbwChan*4;
short bitMask = 1 << rgbwChan;
if (D_State & bitMask)
{
D_State &= ~bitMask;
DMXSemiImmediateUpdate(rgbwChan,DMXin[base],DMXin[base+1],DMXin[base+2],DMXin[base+3]);
break;
}
}
// Here code for network update //#ifdef _dmxout
//int ch = 0; //for (int i=1; i<17; i++) {debugSerial.print(dmxin.read(i));debugSerial.print(";");}
//debugSerial.println();
DMXput(); //#endif
#ifdef _dmxout
for (int i=1; i<17; i++) {debugSerial.print(dmxin.read(i));debugSerial.print(";");}
debugSerial.println();
#endif
#endif #endif
} }
@@ -238,7 +299,9 @@ void DMXinSetup(int channels)
//DmxSimple.maxChannel(channels); //DmxSimple.maxChannel(channels);
#if defined(_dmxin) #if defined(_dmxin)
if (channels>(32*4)) channels = 32*4;
DMXin = new uint8_t [channels]; DMXin = new uint8_t [channels];
DMXINChannels=channels;
#if defined(ARDUINO_ARCH_AVR) #if defined(ARDUINO_ARCH_AVR)
DMXSerial.init(DMXReceiver,0,channels); DMXSerial.init(DMXReceiver,0,channels);
if (DMXSerial.getBuffer()) {debugSerial.print(F("Init in ch:"));debugSerial.println(channels);} else debugSerial.println(F("DMXin Buffer alloc err")); if (DMXSerial.getBuffer()) {debugSerial.print(F("Init in ch:"));debugSerial.println(channels);} else debugSerial.println(F("DMXin Buffer alloc err"));

View File

@@ -8,7 +8,7 @@
#endif #endif
#if defined(ARDUINO_ARCH_AVR) #if defined(ARDUINO_ARCH_AVR)
#include <EEPROM.h> #include <EEPROM.h>
#endif #endif
@@ -23,30 +23,21 @@
#if defined(__SAM3X8E__) #if defined(__SAM3X8E__)
#include <DueFlashStorage.h> #include <DueFlashStorage.h>
extern DueFlashStorage EEPROM;
#endif
#ifdef NRF5
#include <NRFFlashStorage.h> //STUB
extern NRFFlashStorage EEPROM;
#endif
#ifdef ARDUINO_ARCH_STM32
#include <NRFFlashStorage.h> //STUB
extern NRFFlashStorage EEPROM;
#endif
#if defined(__SAM3X8E__)
DueFlashStorage EEPROM; DueFlashStorage EEPROM;
static char samBuffer[64];
short samBufferPos = 0;
#endif #endif
#ifdef NRF5 #ifdef NRF5
#include <NRFFlashStorage.h> //STUB
NRFFlashStorage EEPROM; NRFFlashStorage EEPROM;
#endif #endif
#ifdef ARDUINO_ARCH_STM32 #ifdef ARDUINO_ARCH_STM32
NRFFlashStorage EEPROM; //NRFFlashStorage EEPROM;
#include <EEPROM.h>
#define DATA_LENGTH E2END
//FLASH_PAGE_SIZE = 0x400
#endif #endif
#if defined(FS_STORAGE) #if defined(FS_STORAGE)
@@ -114,7 +105,7 @@ NRFFlashStorage EEPROM;
debugSerial<<(F(" Res:"))<<res<<endl; debugSerial<<(F(" Res:"))<<res<<endl;
return res; return res;
}; };
void flashStream::close() {fs.close(); debugSerial<<filename<<" Closed\n";}; void flashStream::close() {fs.flush();fs.close(); debugSerial<<filename<<" Closed\n";};
void flashStream::flush() {fs.flush(); debugSerial<<filename<<" Flushed\n";}; void flashStream::flush() {fs.flush(); debugSerial<<filename<<" Flushed\n";};
size_t flashStream::write(uint8_t ch) size_t flashStream::write(uint8_t ch)
{ {
@@ -129,6 +120,15 @@ NRFFlashStorage EEPROM;
int flashStream::open(short fileNum, char mode) int flashStream::open(short fileNum, char mode)
{ {
#if defined(__SAM3X8E__) //|| defined (ARDUINO_ARCH_STM32)
if (samBufferPos) flush();
samBufferPos = 0;
#endif
#if defined (ARDUINO_ARCH_STM32)
eeprom_buffer_fill();
#endif
switch (fileNum) { switch (fileNum) {
case FN_CONFIG_JSON: case FN_CONFIG_JSON:
pos = 0; pos = 0;
@@ -138,6 +138,7 @@ NRFFlashStorage EEPROM;
#ifdef OTA #ifdef OTA
contentType = HTTP_TEXT_JSON; contentType = HTTP_TEXT_JSON;
#endif #endif
openmode = mode;
return 1; return 1;
case FN_CONFIG_BIN: case FN_CONFIG_BIN:
@@ -148,6 +149,7 @@ NRFFlashStorage EEPROM;
#ifdef OTA #ifdef OTA
contentType = HTTP_OCTET_STREAM; contentType = HTTP_OCTET_STREAM;
#endif #endif
openmode = mode;
return 1; return 1;
default: default:
@@ -171,8 +173,20 @@ NRFFlashStorage EEPROM;
}; };
unsigned int flashStream::seek(unsigned int _pos) unsigned int flashStream::seek(unsigned int _pos)
{ pos=min(_pos, streamSize); {
//debugSerial<<F("Seek:")<<pos<<endl;
#if defined(__SAM3X8E__) //|| defined (ARDUINO_ARCH_STM32)
if (samBufferPos) flush();
#endif
#if defined (ARDUINO_ARCH_STM32)
//eeprom_buffer_flush();
#endif
pos=min(_pos, streamSize);
//Serial.print("StartPos=");Serial.println(startPos);
//Serial.print("Pos=");Serial.println(pos);
//Serial.print("streamSize=");Serial.println(streamSize);
return pos; return pos;
}; };
@@ -196,27 +210,58 @@ NRFFlashStorage EEPROM;
else return -1; else return -1;
}; };
void flashStream::flush() { void flashStream::flush() {
#if defined(ESP8266) || defined(ESP32) #if defined(ESP8266) || defined(ESP32)
if (EEPROM.commitReset()) if (EEPROM.commitReset())
infoSerial<<"Commited to FLASH"<<endl; infoSerial<<"Commited to FLASH"<<endl;
else errorSerial<<"Commit error. len:"<<EEPROM.length()<<endl; else errorSerial<<"Commit error. len:"<<EEPROM.length()<<endl;
#elif defined(__SAM3X8E__) //|| defined (ARDUINO_ARCH_STM32)
if (samBufferPos)
EEPROM.write(startPos+pos-samBufferPos,(byte*)samBuffer,samBufferPos);
samBufferPos=0;
#elif defined (ARDUINO_ARCH_STM32)
eeprom_buffer_flush();
#endif #endif
}; };
size_t flashStream::write(uint8_t ch) size_t flashStream::write(uint8_t ch)
{ {
#if defined(__AVR__) #if defined(__AVR__)
EEPROM.update(startPos+pos++,(char)ch); EEPROM.update(startPos+pos++,(char)ch);
return 1; return 1;
#elif defined(__SAM3X8E__) #elif defined(__SAM3X8E__)// || defined (ARDUINO_ARCH_STM32)
return EEPROM.write(startPos+pos++,(char)ch);
if (samBufferPos==sizeof(samBuffer))
{
samBufferPos = 0;
EEPROM.write(startPos+pos-sizeof(samBuffer),(byte*)samBuffer,sizeof(samBuffer));
}
samBuffer[samBufferPos++]=ch;
pos++;
return 1;
// return EEPROM.write(startPos+pos++,(char)ch);
#elif defined (ARDUINO_ARCH_STM32)
if (startPos+pos<=DATA_LENGTH)
{
eeprom_buffered_write_byte(startPos+pos++,(char)ch);
return 1;
}
else
{
errorSerial<<F("Flash sector exceeded")<<endl;
return 0;
}
#else #else
EEPROM.write(startPos+pos++,(char)ch); EEPROM.write(startPos+pos++,(char)ch);
return 1; return 1;
#endif #endif
}; };
/*
#if defined(__SAM3X8E__) #if defined(__SAM3X8E__)
size_t flashStream::write(const uint8_t *buffer, size_t size) size_t flashStream::write(const uint8_t *buffer, size_t size)
{ {
@@ -226,7 +271,7 @@ NRFFlashStorage EEPROM;
}; };
#endif #endif
*/
#if defined(ESP8266) || defined(ESP32) #if defined(ESP8266) || defined(ESP32)
void flashStream::putEOF() void flashStream::putEOF()
{ {
@@ -237,7 +282,14 @@ NRFFlashStorage EEPROM;
void flashStream::close() void flashStream::close()
{ {
putEOF(); if (openmode == 'w')
{
putEOF();
debugSerial<<F("EOF")<<endl;
}
#if defined(__SAM3X8E__)
if (samBufferPos) flush();
#endif
} }

Some files were not shown because too many files have changed in this diff Show More