diff --git a/.github/workflows/Tasmota_build_devel.yml b/.github/workflows/Tasmota_build_devel.yml index 6b087e613..50eedbea2 100644 --- a/.github/workflows/Tasmota_build_devel.yml +++ b/.github/workflows/Tasmota_build_devel.yml @@ -106,6 +106,7 @@ jobs: pip install wheel pip install -U platformio cp ./platformio_tasmota_core3_env_sample.ini ./platformio_tasmota_core3_env.ini + cp ./platformio_override_sample.ini ./platformio_override.ini - name: Run PlatformIO run: platformio run -e ${{ matrix.variant }} - name: Upload safeboot firmware artifacts @@ -175,6 +176,8 @@ jobs: - tasmota32s3 - tasmota32s3cdc - tasmota32solo1 + - tasmota32c2-arduino30 + - tasmota32c6cdc-arduino30 steps: - uses: actions/checkout@v3 with: @@ -187,6 +190,8 @@ jobs: run: | pip install wheel pip install -U platformio + cp ./platformio_tasmota_core3_env_sample.ini ./platformio_tasmota_core3_env.ini + cp ./platformio_override_sample.ini ./platformio_override.ini - name: Download safeboot firmwares uses: actions/download-artifact@v3 with: @@ -224,6 +229,8 @@ jobs: run: | pip install wheel pip install -U platformio + cp ./platformio_tasmota_core3_env_sample.ini ./platformio_tasmota_core3_env.ini + cp ./platformio_override_sample.ini ./platformio_override.ini - name: Download safeboot firmwares uses: actions/download-artifact@v3 with: diff --git a/.github/workflows/Tasmota_build_master.yml b/.github/workflows/Tasmota_build_master.yml index 96b4db262..1af64ebc8 100644 --- a/.github/workflows/Tasmota_build_master.yml +++ b/.github/workflows/Tasmota_build_master.yml @@ -45,6 +45,7 @@ jobs: pip install wheel pip install -U platformio cp ./platformio_tasmota_core3_env_sample.ini ./platformio_tasmota_core3_env.ini + cp ./platformio_override_sample.ini ./platformio_override.ini - name: Run PlatformIO run: platformio run -e ${{ matrix.variant }} - name: Upload safeboot firmware artifacts diff --git a/.github/workflows/build_all_the_things.yml b/.github/workflows/build_all_the_things.yml index bcaddcfc3..2d0d84e61 100644 --- a/.github/workflows/build_all_the_things.yml +++ b/.github/workflows/build_all_the_things.yml @@ -91,6 +91,7 @@ jobs: - tasmota-zbbridge - tasmota32 - tasmota32c3 + - tasmota32c6cdc-arduino30 - tasmota32s2 - tasmota32s3 - tasmota32-zbbrdgpro @@ -129,6 +130,7 @@ jobs: #platformio upgrade --dev #platformio update cp ./platformio_tasmota_core3_env_sample.ini ./platformio_tasmota_core3_env.ini + cp ./platformio_override_sample.ini ./platformio_override.ini - name: Run PlatformIO run: platformio run -e ${{ matrix.variant }} - uses: actions/upload-artifact@v3 diff --git a/.gitignore b/.gitignore index 78c2cfe2f..dcc81a15d 100644 --- a/.gitignore +++ b/.gitignore @@ -19,6 +19,8 @@ data unpacked_fs unpacked_boards tasmota/user_config_override.h +variants +variants3 build build_output/* firmware.map diff --git a/API.md b/API.md index 3a7a24c78..e12eea92e 100644 --- a/API.md +++ b/API.md @@ -17,7 +17,7 @@ Callback Id | Bool | xdrv | xsns | xnrg | xlgt | Description ----------------------------|------|------|------|------|------|---------------------------------- FUNC_SETTINGS_OVERRIDE | | x | | | | Override start-up settings FUNC_PIN_STATE | x | 1 | 2 | | | At GPIO configuration -FUNC_I2C_INIT | | x | | | | Immediatly after I2C init +FUNC_I2C_INIT | | x | | | | Immediately after I2C init FUNC_MODULE_INIT | x | 3 | 1 | | 2 | Init module specific parameters FUNC_PRE_INIT | | 1 | 3 | 2 | | Once GPIO have been established FUNC_INIT | | 1 | 3 | 2 | | At end of initialisation diff --git a/BUILDS.md b/BUILDS.md index d8d325b6e..09450ed6d 100644 --- a/BUILDS.md +++ b/BUILDS.md @@ -1,8 +1,6 @@ ## Available Features and Sensors -ESP8266 / ESP32 - -l = lite, t = tasmota, k = knx, s = sensors, i = ir, d = display +l = lite, t = tasmota (ESP8266 / ESP32), k = knx, s = sensors, i = ir, d = display Note: `minimal` variant is not listed as it shouldn't be used outside of the [upgrading](https://tasmota.github.io/docs/Upgrading/) process. diff --git a/CHANGELOG.md b/CHANGELOG.md index cdcb87873..28bf1da3d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,92 @@ All notable changes to this project will be documented in this file. ## [Released] +## [13.3.0] 20231213 +- Release Quinlan + +## [13.2.0.3] 20231213 +### Added +- DeepSleep support through TIMERS (#20117) +- Command ``WebCanvas linear-gradient(#F02 7%,#F93,#FF4,#082,#00F,#708 93%)`` to set GUI canvas + +### Breaking Changed +- Remove Berry `every_200ms` event which didn't work anyways (#20205) + +### Changed +- ESP32 LVGL library from v8.3.10 to v8.3.11 (no functional change) +- Berry ULP API changes for Core3/IDF5 (#20198) +- Berry leds animation refactoring stage 1 (#20197) + +### Fixed +- TUYA state machine (in TUYA v1) (#20110) +- ESP32 Neopixel flicker for Core3/IDF5 (#20196) +- HASPmota `bar` fixed `val` attribute (#20208) + +## [13.2.0.2] 20231130 +### Added +- Scripter TCP client (#19914) +- Berry ``debug.gcdebug()`` to enable GC debugging (#19936) +- Berry AES_CBC to crypto module (#19964) +- NeoPool sensor delta trigger (command ``NPTelePeriod``) (#19973) +- NeoPool store settings on unified file system (#19973) +- NeoPool command ``NPBoost`` (#19973) +- ESP32 Partition Wizard can be loaded dynamically (#19980) +- Berry `scale_int`, equivalent of `scale_uint` for signed integers (#20090) +- ESP32 support for Avago Tech Bluetooth Buttons (#20088) + +### Changed +- Matter update hierarchy of plugins (#19915) +- NeoPool ``NPHydrolysis`` percent and unit (#19924) +- Thermostat JSON index from 0 to 1 (#20011) + +### Fixed +- Scripter timer issue (#19914) +- Zero-Cross Dimmer for ESP32 with Core3 (#19929) +- Matter flow sensor (#19961) +- Berry ``gpio.dac_voltage()`` regression from v13.1.0.1 (#19997) +- ESP32-C3 ledlink functionality regression from v13.1.0.2 +- Berry parser error in specific cases (#20059) +- ``changeUIntScale`` for linearity when expanding range (#20089) +- ESP32 remove restart energy logging if no energy monitoring is selected +- ``WebQuery`` response buffer corruption and format character ``%`` (#20111) + +## [13.2.0.1] 20231103 +### Added +- I2C bus2 support to iAQ core sensor (#19799) +- I2C bus2 support to HTU temperature and humidity sensor +- I2C bus2 support to BH1750 ambient light sensor +- I2C bus2 support to ADS1115 A/D Converter +- I2C bus2 support to SHTxX temperature and humidity sensor +- I2C bus2 support to HYTxxx temperature and humidity sensor +- I2C bus2 support to SI1145/6/7 Ultra violet index and light sensor +- I2C bus2 support to LM75AD temperature sensor +- Command ``GpioRead`` to show input state (#19810) +- ESP32 core v3 auto TasConsole USB or Serial connection by @staars +- Support for Winsen XH03x dust particle sensors using USE_PMS5003 and PMS_MODEL_ZH03X (#19850) +- NeoPool hydrolysis setpoint and max +- NeoPool command ``NPFiltrationSpeed`` to set non-standard filtration type speed (#19857) +- NeoPool ``SetOption157`` to output sensitive data (#19857) +- NeoPool enhancements for HA (#19857) +- ST7735S display.ini for 1.44 inch 128x128 red SPI display (#19862) +- HASPmota add styling properties (#19912) +- Matter flow sensor support (#19852) + +### Breaking Changed +- NeoPool SENSOR topic ``Power`` renamed to ``Powerunit`` (#19857) + +### Changed +- Prepare I2C drivers for bus2 support +- Matter Light0 now accept a Relay number (#19809) +- ESP32 keep FS intact when over flashing with VSC (#19816) +- Increase MAX_HUE_DEVICES to 32 (#19820) +- MI32 updates (#19893) + +### Fixed +- NeoPool filtration mode display (#19801) +- Compile USE_PID (#19890) +- ESP32 I2C allow bus2 support when bus1 is not enabled +- ESP32 IR receive with Arduino Core 3 (#19904) + ## [13.2.0] 20231019 - Release Quincy @@ -73,7 +159,7 @@ All notable changes to this project will be documented in this file. - ESP32 Shutter migration (#19454) - ESP32 Shutter multi press button events (#19465) - Support for IPv6 link-local zones for esp-idf 5.1 (necessary for Matter) -- ESP32C3 relay click on restart +- ESP32-C3 relay click on restart ## [13.1.0.1] 20230831 ### Added @@ -128,7 +214,7 @@ All notable changes to this project will be documented in this file. - Zero cross dimmer minimum interrupt time (#19211) - Fade would fail when the difference between start and target would be too small (#19248) - Inverted shutter (#19243) -- Matter support for large atribute responses (#19252) +- Matter support for large attribute responses (#19252) - Matter auto-configuration Relay indices (#19255) ## [13.0.0.2] 20230721 @@ -975,14 +1061,14 @@ All notable changes to this project will be documented in this file. - Support for MQ analog sensor for air quality by Francesco Adriani (#14581) - Command ``SetOption134 1`` to disable PWM auto-phasing for lights by default (new behavior) (#14590) - Increase PWM channels to 16 (Esp32 only) -- Initial support for ESP32S3 with support for 38 configurable GPIOs +- Initial support for ESP32-S3 with support for 38 configurable GPIOs ### Changed - BME68x-Sensor-API library from v3.5.9 to v4.4.7 - ESP32 core library from v2.0.2 to v2.0.2.1 (#14553) ### Fixed -- OneWire-Stickbreaker (DS18x20) library support for ESP32S2 (#14338) +- OneWire-Stickbreaker (DS18x20) library support for ESP32-S2 (#14338) ## [2022.01.2 = 10.1.0.5] 20220116 ### Added @@ -1171,10 +1257,10 @@ All notable changes to this project will be documented in this file. ### Added - Command ``WebGetConfig `` if ``#define USE_WEBGETCONFIG`` is enabled to restore/init configuration from external webserver (#13034) - Berry class ``webclient`` for HTTP/HTTPS requests -- Support for ESP32S2 GPIOs +- Support for ESP32-S2 GPIOs - ESP32 add GPIO 6/7/8/11 to template and remove GPIO 28-31 (remapping so backwards compatible) -- Crash recorder ``Status 12`` for ESP32/ESP32S2/ESP32C3, supporting Esp-idf 3.3/4.4 -- Support for ESP32/ESP32S2 DAC gpio via Berry +- Crash recorder ``Status 12`` for ESP32/ESP32-S2/ESP32-C3, supporting Esp-idf 3.3/4.4 +- Support for ESP32/ESP32-S2 DAC gpio via Berry - Berry support for Serial - Support for Sensirion SCD40/SCD41 CO2 sensor (#13139) - Support for BL0939 energy monitor as used in ESP32 based Sonoff Dual R3 V2 Pow (#13195) @@ -1226,7 +1312,7 @@ All notable changes to this project will be documented in this file. - Berry now compiling in ``strict`` mode to catch more bugs ### Fixed -- Fixed PWM5 on ESP32C3 +- ESP32-C3 PWM5 ## [9.5.0.5] 20210815 ### Added diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7b15232be..ddb0768a5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -99,7 +99,7 @@ To accept the CLA it is required to put a x between [ ] on `[ ] I accept the CLA **Why a CLA ?** -_"A Contributor Licence Agreement (CLA) is strongly recommended when accepting third party contributions to an open development project, such as an open source software project. In order to redistribute contributions, it is necessary to ensure that the project has the necessary rights to do so. A Contributor Licence Agreement is a lightweight agreement, signed by the copyright holder, that grants the necessary rights for the contribution to be redistributed as part of the project."_ [OSS Watch](http://oss-watch.ac.uk/resources/cla) +_"A Contributor License Agreement (CLA) is strongly recommended when accepting third party contributions to an open development project, such as an open source software project. In order to redistribute contributions, it is necessary to ensure that the project has the necessary rights to do so. A Contributor License Agreement is a lightweight agreement, signed by the copyright holder, that grants the necessary rights for the contribution to be redistributed as part of the project."_ [OSS Watch](http://oss-watch.ac.uk/resources/cla) A CLA is a legal document in which you state _you are entitled to contribute the code/documentation/translation to the project_ you’re contributing to and that _you are willing to have it used in distributions and derivative works_. This means that should there be any kind of legal issue in the future as to the origins and ownership of any particular piece of code, then that project has the necessary forms on file from the contributor(s) saying they were permitted to make this contribution. diff --git a/FIRMWARE.md b/FIRMWARE.md index f0e069a9a..43f76f8d2 100644 --- a/FIRMWARE.md +++ b/FIRMWARE.md @@ -27,7 +27,7 @@ See [CHANGELOG.md](https://github.com/arendst/Tasmota/blob/development/tasmota/C Unless your Tasmota powered device exhibits a problem or you need to make use of a feature that is not available in the Tasmota version currently installed on your device, leave your device alone - it works so don't make unnecessary changes! If the release version (i.e., the master branch) exhibits unexpected behaviour for your device and configuration, you should upgrade to the latest development version instead to see if your problem is resolved as some bugs in previous releases or development builds may already have been resolved. -If new commits have been merged and they compile successfuly, new binary files for every variant will be placed here https://github.com/arendst/Tasmota-firmware/tree/main/firmware (this URL address can NOT be used for OTA updates) It is important to note that these binaries are based on the current development codebase. These commits are tested as much as is possible and are typically quite stable. However, it is infeasible to test on the hundreds of different types of devices with all the available configuration options permitted. +If new commits have been merged and they compile successfully, new binary files for every variant will be placed here https://github.com/arendst/Tasmota-firmware/tree/main/firmware (this URL address can NOT be used for OTA updates) It is important to note that these binaries are based on the current development codebase. These commits are tested as much as is possible and are typically quite stable. However, it is infeasible to test on the hundreds of different types of devices with all the available configuration options permitted. Note that there is a chance, as with any upgrade, that the device may not function as expected. You must always account for the possibility that you may need to flash the device via the serial programming interface if the OTA upgrade fails. Even with the master release, you should always attempt to test the device or a similar prototype before upgrading a device which is in production or is hard to reach. And, as always, make a backup of the device configuration before beginning any firmware update. diff --git a/I2CDEVICES.md b/I2CDEVICES.md index fcda37377..1a8500954 100644 --- a/I2CDEVICES.md +++ b/I2CDEVICES.md @@ -6,120 +6,122 @@ Using command ``I2cDriver`` individual drivers can be enabled or disabled at run ## Supported I2C devices The following table lists the supported I2C devices -Index | Define | Driver | Device | Address(es) | Description -------|---------------------|----------|----------|-------------|----------------------------------------------- - 1 | USE_PCA9685 | xdrv_15 | PCA9685 | 0x40 - 0x47 | 16-channel 12-bit pwm driver - 1 | USE_PCA9685_V2 | xdrv_15 | PCA9685 | 0x40 - 0x47 | 16-channel 12-bit pwm driver - 2 | USE_PCF8574 | xdrv_28 | PCF8574 | 0x20 - 0x26 | 8-bit I/O expander (address range overridable) - 2 | USE_PCF8574 | xdrv_28 | PCF8574A | 0x39 - 0x3F | 8-bit I/O expander (address range overridable) - 3 | USE_DISPLAY_LCD | xdsp_01 | | 0x27, 0x3F | LCD display - 4 | USE_DISPLAY_SSD1306 | xdsp_02 | SSD1306 | 0x3C - 0x3D | Oled display - 5 | USE_DISPLAY_MATRIX | xdsp_03 | HT16K33 | 0x70 - 0x77 | 8x8 led matrix - 6 | USE_DISPLAY_SH1106 | xdsp_07 | SH1106 | 0x3C - 0x3D | Oled display - 7 | USE_ADE7953 | xnrg_07 | ADE7953 | 0x38 | Energy monitor - 8 | USE_SHT | xsns_07 | SHT1X | Any | Temperature and Humidity sensor - 9 | USE_HTU | xsns_08 | HTU21 | 0x40 | Temperature and Humidity sensor - 9 | USE_HTU | xsns_08 | SI7013 | 0x40 | Temperature and Humidity sensor - 9 | USE_HTU | xsns_08 | SI7020 | 0x40 | Temperature and Humidity sensor - 9 | USE_HTU | xsns_08 | SI7021 | 0x40 | Temperature and Humidity sensor - 10 | USE_BMP | xsns_09 | BMP085 | 0x76 - 0x77 | Pressure and temperature sensor - 10 | USE_BMP | xsns_09 | BMP180 | 0x76 - 0x77 | Pressure and temperature sensor - 10 | USE_BMP | xsns_09 | BMP280 | 0x76 - 0x77 | Pressure and temperature sensor - 10 | USE_BMP | xsns_09 | BME280 | 0x76 - 0x77 | Pressure, temperature and humidity sensor - 10 | USE_BMP | xsns_09 | BME680 | 0x76 - 0x77 | Pressure, temperature, humidity and gas sensor - 11 | USE_BH1750 | xsns_10 | BH1750 | 0x23, 0x5C | Ambient light intensity sensor - 12 | USE_VEML6070 | xsns_11 | VEML6070 | 0x38 - 0x39 | Ultra violet light intensity sensor - 13 | USE_ADS1115 | xsns_12 | ADS1115 | 0x48 - 0x4B | 4-channel 16-bit A/D converter - 14 | USE_INA219 | xsns_13 | INA219 | 0x40 - 0x41, 0x44 - 0x45 | Low voltage current sensor - 15 | USE_SHT3X | xsns_14 | SHT3X | 0x44 - 0x45 | Temperature and Humidity sensor - 15 | USE_SHT3X | xsns_14 | SHT4X | 0x44 - 0x45 | Temperature and Humidity sensor - 15 | USE_SHT3X | xsns_14 | SHTCX | 0x70 | Temperature and Humidity sensor - 16 | USE_TSL2561 | xsns_16 | TSL2561 | 0x29, 0x39, 0x49 | Light intensity sensor - 17 | USE_MGS | xsns_19 | Grove | 0x04 | Multichannel gas sensor - 18 | USE_SGP30 | xsns_21 | SGP30 | 0x58 | Gas (TVOC) and air quality sensor - 19 | USE_SI1145 | xsns_24 | SI1145 | 0x60 | Ultra violet index and light sensor - 19 | USE_SI1145 | xsns_24 | SI1146 | 0x60 | Ultra violet index and light sensor - 19 | USE_SI1145 | xsns_24 | SI1147 | 0x60 | Ultra violet index and light sensor - 20 | USE_LM75AD | xsns_26 | LM75AD | 0x48 - 0x4F | Temperature sensor - 21 | USE_APDS9960 | xsns_27 | APDS9960 | 0x39 | Proximity ambient light RGB and gesture sensor - 22 | USE_MCP230xx | xsns_29 | MCP23008 | 0x20 - 0x26 | 8-bit I/O expander - 22 | USE_MCP230xx | xsns_29 | MCP23017 | 0x20 - 0x26 | 16-bit I/O expander - 23 | USE_MPR121 | xsns_30 | MPR121 | 0x5A - 0x5D | Proximity capacitive touch sensor - 24 | USE_CCS811 | xsns_31 | CCS811 | 0x5A | Gas (TVOC) and air quality sensor - 24' | USE_CCS811_V2 | xsns_31 | CCS811 | 0x5A - 0x5B | Gas (TVOC) and air quality sensor - 25 | USE_MPU6050 | xsns_32 | MPU6050 | 0x68 - 0x69 | 3-axis gyroscope and temperature sensor - 26 | USE_DS3231 | xsns_33 | DS3231 | 0x68 | Real time clock - 27 | USE_MGC3130 | xsns_36 | MGC3130 | 0x42 | Electric field sensor - 28 | USE_MAX44009 | xsns_41 | MAX44009 | 0x4A - 0x4B | Ambient light intensity sensor - 29 | USE_SCD30 | xsns_42 | SCD30 | 0x61 | CO2 sensor - 30 | USE_SPS30 | xsns_44 | SPS30 | 0x69 | Particle sensor - 31 | USE_VL53L0X | xsns_45 | VL53L0X | 0x29 | Time-of-flight (ToF) distance sensor - 32 | USE_MLX90614 | xsns_46 | MLX90614 | 0x5A | Infra red temperature sensor - 33 | USE_CHIRP | xsns_48 | CHIRP | 0x20 | Soil moisture sensor - 34 | USE_PAJ7620 | xsns_50 | PAJ7620 | 0x73 | Gesture sensor - 35 | USE_INA226 | xsns_54 | INA226 | 0x40 - 0x41, 0x44 - 0x45 | Low voltage current sensor - 36 | USE_HIH6 | xsns_55 | HIH6130 | 0x27 | Temperature and Humidity sensor - 37 | USE_24C256 | xdrv_10 | 24C256 | 0x50 | Scripter EEPROM storage - 38 | USE_DISPLAY_ILI9488 | xdsp_08 | FT6236 | 0x38 | Touch panel controller - 39 | USE_DISPLAY_RA8876 | xdsp_10 | FT5316 | 0x38 | Touch panel controller - 40 | USE_TSL2591 | xsns_57 | TSL2591 | 0x29 | Light intensity sensor - 41 | USE_DHT12 | xsns_58 | DHT12 | 0x5C | Temperature and humidity sensor - 42 | USE_DS1624 | xsns_59 | DS1621 | 0x48 - 0x4F | Temperature sensor - 42 | USE_DS1624 | xsns_59 | DS1624 | 0x48 - 0x4F | Temperature sensor - 43 | USE_AHT1x | xsns_63 | AHT10/15 | 0x38 - 0x39 | Temperature and humidity sensor - 43 | USE_AHT2x | xsns_63 | AHT20 | 0x38 | Temperature and humidity sensor - 43 | USE_AHT2x | xsns_63 | AM2301B | 0x38 | Temperature and humidity sensor - 44 | USE_WEMOS_MOTOR_V1 | xdrv_34 | | 0x2D - 0x30 | WEMOS motor shield v1.0.0 (6612FNG) - 45 | USE_HDC1080 | xsns_65 | HDC1080 | 0x40 | Temperature and Humidity sensor - 46 | USE_IAQ | xsns_66 | IAQ | 0x5a | Air quality sensor - 47 | USE_DISPLAY_SEVENSEG| xdsp_11 | HT16K33 | 0x70 - 0x77 | Seven segment LED - 48 | USE_AS3935 | xsns_67 | AS3935 | 0x03 | Franklin Lightning Sensor - 49 | USE_VEML6075 | xsns_70 | VEML6075 | 0x10 | UVA/UVB/UVINDEX Sensor - 50 | USE_VEML7700 | xsns_71 | VEML7700 | 0x10 | Ambient light intensity sensor - 51 | USE_MCP9808 | xsns_72 | MCP9808 | 0x18 - 0x1F | Temperature sensor - 52 | USE_HP303B | xsns_73 | HP303B | 0x76 - 0x77 | Pressure and temperature sensor - 53 | USE_MLX90640 | xdrv_43 | MLX90640 | 0x33 | IR array temperature sensor - 54 | USE_VL53L1X | xsns_77 | VL53L1X | 0x29 | Time-of-flight (ToF) distance sensor - 55 | USE_EZOPH | xsns_78 | EZOPH | 0x61 - 0x70 | pH sensor - 55 | USE_EZOORP | xsns_78 | EZOORP | 0x61 - 0x70 | ORP sensor - 55 | USE_EZORTD | xsns_78 | EZORTD | 0x61 - 0x70 | Temperature sensor - 55 | USE_EZOHUM | xsns_78 | EZOHUM | 0x61 - 0x70 | Humidity sensor - 55 | USE_EZOEC | xsns_78 | EZOEC | 0x61 - 0x70 | Electric conductivity sensor - 55 | USE_EZOCO2 | xsns_78 | EZOCO2 | 0x61 - 0x70 | CO2 sensor - 55 | USE_EZOO2 | xsns_78 | EZOO2 | 0x61 - 0x70 | O2 sensor - 55 | USE_EZOPRS | xsns_78 | EZOPRS | 0x61 - 0x70 | Pressure sensor - 55 | USE_EZOFLO | xsns_78 | EZOFLO | 0x61 - 0x70 | Flow meter sensor - 55 | USE_EZODO | xsns_78 | EZODO | 0x61 - 0x70 | Disolved Oxygen sensor - 55 | USE_EZORGB | xsns_78 | EZORGB | 0x61 - 0x70 | Color sensor - 55 | USE_EZOPMP | xsns_78 | EZOPMP | 0x61 - 0x70 | Peristaltic Pump - 56 | USE_SEESAW_SOIL | xsns_81 | SEESOIL | 0x36 - 0x39 | Adafruit seesaw soil moisture sensor - 57 | USE_TOF10120 | xsns_84 | TOF10120 | 0x52 | Time-of-flight (ToF) distance sensor - 58 | USE_MPU_ACCEL | xsns_85 | MPU_ACCEL| 0x68 | MPU6886/MPU9250 6-axis MotionTracking sensor from M5Stack - 59 | USE_BM8563 | xdrv_56 | BM8563 | 0x51 | BM8563 RTC from M5Stack - 60 | USE_AM2320 | xsns_88 | AM2320 | 0x5C | Temperature and Humidity sensor - 61 | USE_T67XX | xsns_89 | T67XX | 0x15 | CO2 sensor - 62 | USE_SCD40 | xsns_92 | SCD40 | 0x62 | CO2 sensor Sensirion SCD40/SCD41 - 63 | USE_HM330X | xsns_93 | HM330X | 0x40 | Particule sensor - 64 | USE_HDC2010 | xsns_94 | HDC2010 | 0x40 | Temperature and Humidity sensor - 65 | USE_ADE7880 | xnrg_23 | ADE7880 | 0x38 | Energy monitor - 66 | USE_PCF85363 | xsns_99 | PCF85363 | 0x51 | Real time clock - 67 | USE_DS3502 | xdrv_61 | DS3502 | 0x28 - 0x2B | Digital potentiometer - 68 | USE_HYT | xsns_97 | HYTxxx | 0x28 | Temperature and Humidity sensor - 69 | USE_SGP40 | xsns_98 | SGP40 | 0x59 | Gas (TVOC) and air quality - 70 | USE_LUXV30B | xsns_99 | LUXV30B | 0x4A | DFRobot SEN0390 V30B lux sensor - 71 | USE_QMC5883L | xsns_33 | QMC5883L | 0x0D | Magnetic Field Sensor - 72 | USE_INA3221 | xsns_100 | INA3221 | 0x40-0x43 | 3-channels Voltage and Current sensor - 73 | USE_HMC5883L | xsns_101 | HMC5883L | 0x1E | 3-channels Magnetic Field Sensor - 74 | USE_DISPLAY_TM1650 | xdsp_20 | TM1650 | 0x24 - 0x27, 0x34 - 0x37 | Four-digit seven-segment LED controller - 75 | USE_PCA9632 | xdrv_64 | PCA9632 | 0x60 | 4-channel 4-bit pwm driver - 76 | USE_SEN5X | xsns_103 | SEN5X | 0x69 | Gas (VOC/NOx index) and air quality (PPM <1,<2.5,<4,<10) - 77 | USE_MCP23XXX_DRV | xdrv_67 | MCP23x17 | 0x20 - 0x26 | 16-bit I/O expander as virtual button/switch/relay - 78 | USE_PMSA003I | xsns_104 | PMSA003I | 0x12 | PM2.5 Air Quality Sensor with I2C Interface - 79 | USE_GDK101 | xsns_106 | GDK101 | 0x18 - 0x1B | Gamma Radiation Sensor - 80 | USE_TC74 | xsns_108 | TC74 | 0x48 - 0x4F | Temperature sensor - 81 | USE_PCA9557 | xdrv_69 | PCA95xx | 0x18 - 0x1F | 8-bit I/O expander as virtual button/switch/relay - 82 | USE_SGP4X | xsns_109 | SGP4X | 0x59 | Gas (TVOC/NOx index) - 83 | USE_MAX17043 | xsns_110 | MAX17043 | 0x36 | Fuel-gauge for 3.7 Volt Lipo battery - 84 | USE_ENS16x | xsns_111 | ENS16x | 0x52 - 0x53 | Gas (TVOC, eCO2) and air quality sensor - 85 | USE_ENS210 | xsns_112 | ENS210 | 0x43 - 0x44 | Temperature and humidity sensor +Index | Define | Driver | Device | Address(es) | Bus2 | Description +------|---------------------|----------|----------|-------------|------|----------------------------------------------- + 1 | USE_PCA9685 | xdrv_15 | PCA9685 | 0x40 - 0x47 | | 16-channel 12-bit pwm driver + 1 | USE_PCA9685_V2 | xdrv_15 | PCA9685 | 0x40 - 0x47 | | 16-channel 12-bit pwm driver + 2 | USE_PCF8574 | xdrv_28 | PCF8574 | 0x20 - 0x26 | | 8-bit I/O expander (address range overridable) + 2 | USE_PCF8574 | xdrv_28 | PCF8574A | 0x39 - 0x3F | | 8-bit I/O expander (address range overridable) + 3 | USE_DISPLAY_LCD | xdsp_01 | | 0x27, 0x3F | | LCD display + 4 | USE_DISPLAY_SSD1306 | xdsp_02 | SSD1306 | 0x3C - 0x3D | | Oled display + 5 | USE_DISPLAY_MATRIX | xdsp_03 | HT16K33 | 0x70 - 0x77 | | 8x8 led matrix + 6 | USE_DISPLAY_SH1106 | xdsp_07 | SH1106 | 0x3C - 0x3D | | Oled display + 7 | USE_ADE7953 | xnrg_07 | ADE7953 | 0x38 | | Energy monitor + 8 | USE_SHT | xsns_07 | SHT1X | Any | | Temperature and Humidity sensor + 9 | USE_HTU | xsns_08 | HTU21 | 0x40 | Yes | Temperature and Humidity sensor + 9 | USE_HTU | xsns_08 | SI7013 | 0x40 | Yes | Temperature and Humidity sensor + 9 | USE_HTU | xsns_08 | SI7020 | 0x40 | Yes | Temperature and Humidity sensor + 9 | USE_HTU | xsns_08 | SI7021 | 0x40 | Yes | Temperature and Humidity sensor + 10 | USE_BMP | xsns_09 | BMP085 | 0x76 - 0x77 | Yes | Pressure and temperature sensor + 10 | USE_BMP | xsns_09 | BMP180 | 0x76 - 0x77 | Yes | Pressure and temperature sensor + 10 | USE_BMP | xsns_09 | BMP280 | 0x76 - 0x77 | Yes | Pressure and temperature sensor + 10 | USE_BMP | xsns_09 | BME280 | 0x76 - 0x77 | Yes | Pressure, temperature and humidity sensor + 10 | USE_BMP | xsns_09 | BME680 | 0x76 - 0x77 | Yes | Pressure, temperature, humidity and gas sensor + 11 | USE_BH1750 | xsns_10 | BH1750 | 0x23, 0x5C | Yes | Ambient light intensity sensor + 12 | USE_VEML6070 | xsns_11 | VEML6070 | 0x38 - 0x39 | | Ultra violet light intensity sensor + 13 | USE_ADS1115 | xsns_12 | ADS1115 | 0x48 - 0x4B | Yes | 4-channel 16-bit A/D converter + 14 | USE_INA219 | xsns_13 | INA219 | 0x40 - 0x41, 0x44 - 0x45 | | Low voltage current sensor + 15 | USE_SHT3X | xsns_14 | SHT3X | 0x44 - 0x45 | Yes | Temperature and Humidity sensor + 15 | USE_SHT3X | xsns_14 | SHT4X | 0x44 - 0x45 | Yes | Temperature and Humidity sensor + 15 | USE_SHT3X | xsns_14 | SHTCX | 0x70 | Yes | Temperature and Humidity sensor + 16 | USE_TSL2561 | xsns_16 | TSL2561 | 0x29, 0x39, 0x49 | | Light intensity sensor + 17 | USE_MGS | xsns_19 | Grove | 0x04 | | Multichannel gas sensor + 18 | USE_SGP30 | xsns_21 | SGP30 | 0x58 | | Gas (TVOC) and air quality sensor + 19 | USE_SI1145 | xsns_24 | SI1145 | 0x60 | Yes | Ultra violet index and light sensor + 19 | USE_SI1145 | xsns_24 | SI1146 | 0x60 | Yes | Ultra violet index and light sensor + 19 | USE_SI1145 | xsns_24 | SI1147 | 0x60 | Yes | Ultra violet index and light sensor + 20 | USE_LM75AD | xsns_26 | LM75AD | 0x48 - 0x4F | Yes | Temperature sensor + 21 | USE_APDS9960 | xsns_27 | APDS9960 | 0x39 | | Proximity ambient light RGB and gesture sensor + 22 | USE_MCP230xx | xsns_29 | MCP23008 | 0x20 - 0x26 | | 8-bit I/O expander + 22 | USE_MCP230xx | xsns_29 | MCP23017 | 0x20 - 0x26 | | 16-bit I/O expander + 23 | USE_MPR121 | xsns_30 | MPR121 | 0x5A - 0x5D | | Proximity capacitive touch sensor + 24 | USE_CCS811 | xsns_31 | CCS811 | 0x5A | | Gas (TVOC) and air quality sensor + 24' | USE_CCS811_V2 | xsns_31 | CCS811 | 0x5A - 0x5B | | Gas (TVOC) and air quality sensor + 25 | USE_MPU6050 | xsns_32 | MPU6050 | 0x68 - 0x69 | | 3-axis gyroscope and temperature sensor + 26 | USE_DS3231 | xsns_33 | DS1307 | 0x68 | | Real time clock + 26 | USE_DS3231 | xsns_33 | DS3231 | 0x68 | | Real time clock + 27 | USE_MGC3130 | xsns_36 | MGC3130 | 0x42 | | Electric field sensor + 28 | USE_MAX44009 | xsns_41 | MAX44009 | 0x4A - 0x4B | | Ambient light intensity sensor + 29 | USE_SCD30 | xsns_42 | SCD30 | 0x61 | | CO2 sensor + 30 | USE_SPS30 | xsns_44 | SPS30 | 0x69 | | Particle sensor + 31 | USE_VL53L0X | xsns_45 | VL53L0X | 0x29 | | Time-of-flight (ToF) distance sensor + 32 | USE_MLX90614 | xsns_46 | MLX90614 | 0x5A | | Infra red temperature sensor + 33 | USE_CHIRP | xsns_48 | CHIRP | 0x20 | | Soil moisture sensor + 34 | USE_PAJ7620 | xsns_50 | PAJ7620 | 0x73 | | Gesture sensor + 35 | USE_INA226 | xsns_54 | INA226 | 0x40 - 0x41, 0x44 - 0x45 | | Low voltage current sensor + 36 | USE_HIH6 | xsns_55 | HIH6130 | 0x27 | | Temperature and Humidity sensor + 37 | USE_24C256 | xdrv_10 | 24C256 | 0x50 | | Scripter EEPROM storage + 38 | USE_DISPLAY_ILI9488 | xdsp_08 | FT6236 | 0x38 | | Touch panel controller + 39 | USE_DISPLAY_RA8876 | xdsp_10 | FT5316 | 0x38 | | Touch panel controller + 40 | USE_TSL2591 | xsns_57 | TSL2591 | 0x29 | | Light intensity sensor + 41 | USE_DHT12 | xsns_58 | DHT12 | 0x5C | | Temperature and humidity sensor + 42 | USE_DS1624 | xsns_59 | DS1621 | 0x48 - 0x4F | | Temperature sensor + 42 | USE_DS1624 | xsns_59 | DS1624 | 0x48 - 0x4F | | Temperature sensor + 43 | USE_AHT1x | xsns_63 | AHT10/15 | 0x38 - 0x39 | | Temperature and humidity sensor + 43 | USE_AHT2x | xsns_63 | AHT20 | 0x38 | | Temperature and humidity sensor + 43 | USE_AHT2x | xsns_63 | AM2301B | 0x38 | | Temperature and humidity sensor + 44 | USE_WEMOS_MOTOR_V1 | xdrv_34 | | 0x2D - 0x30 | | WEMOS motor shield v1.0.0 (6612FNG) + 45 | USE_HDC1080 | xsns_65 | HDC1080 | 0x40 | | Temperature and Humidity sensor + 46 | USE_IAQ | xsns_66 | IAQ | 0x5a | Yes | Air quality sensor + 47 | USE_DISPLAY_SEVENSEG| xdsp_11 | HT16K33 | 0x70 - 0x77 | | Seven segment LED + 48 | USE_AS3935 | xsns_67 | AS3935 | 0x03 | | Franklin Lightning Sensor + 49 | USE_VEML6075 | xsns_70 | VEML6075 | 0x10 | | UVA/UVB/UVINDEX Sensor + 50 | USE_VEML7700 | xsns_71 | VEML7700 | 0x10 | | Ambient light intensity sensor + 51 | USE_MCP9808 | xsns_72 | MCP9808 | 0x18 - 0x1F | | Temperature sensor + 52 | USE_HP303B | xsns_73 | HP303B | 0x76 - 0x77 | | Pressure and temperature sensor + 53 | USE_MLX90640 | xdrv_43 | MLX90640 | 0x33 | | IR array temperature sensor + 54 | USE_VL53L1X | xsns_77 | VL53L1X | 0x29 | | Time-of-flight (ToF) distance sensor + 55 | USE_EZOPH | xsns_78 | EZOPH | 0x61 - 0x70 | | pH sensor + 55 | USE_EZOORP | xsns_78 | EZOORP | 0x61 - 0x70 | | ORP sensor + 55 | USE_EZORTD | xsns_78 | EZORTD | 0x61 - 0x70 | | Temperature sensor + 55 | USE_EZOHUM | xsns_78 | EZOHUM | 0x61 - 0x70 | | Humidity sensor + 55 | USE_EZOEC | xsns_78 | EZOEC | 0x61 - 0x70 | | Electric conductivity sensor + 55 | USE_EZOCO2 | xsns_78 | EZOCO2 | 0x61 - 0x70 | | CO2 sensor + 55 | USE_EZOO2 | xsns_78 | EZOO2 | 0x61 - 0x70 | | O2 sensor + 55 | USE_EZOPRS | xsns_78 | EZOPRS | 0x61 - 0x70 | | Pressure sensor + 55 | USE_EZOFLO | xsns_78 | EZOFLO | 0x61 - 0x70 | | Flow meter sensor + 55 | USE_EZODO | xsns_78 | EZODO | 0x61 - 0x70 | | Disolved Oxygen sensor + 55 | USE_EZORGB | xsns_78 | EZORGB | 0x61 - 0x70 | | Color sensor + 55 | USE_EZOPMP | xsns_78 | EZOPMP | 0x61 - 0x70 | | Peristaltic Pump + 56 | USE_SEESAW_SOIL | xsns_81 | SEESOIL | 0x36 - 0x39 | | Adafruit seesaw soil moisture sensor + 57 | USE_TOF10120 | xsns_84 | TOF10120 | 0x52 | | Time-of-flight (ToF) distance sensor + 58 | USE_MPU_ACCEL | xsns_85 | MPU_ACCEL| 0x68 | Yes | MPU6886/MPU9250 6-axis MotionTracking sensor from M5Stack + 59 | USE_BM8563 | xdrv_56 | BM8563 | 0x51 | Yes | BM8563 RTC from M5Stack + 60 | USE_AM2320 | xsns_88 | AM2320 | 0x5C | | Temperature and Humidity sensor + 61 | USE_T67XX | xsns_89 | T67XX | 0x15 | | CO2 sensor + 62 | USE_SCD40 | xsns_92 | SCD40 | 0x62 | | CO2 sensor Sensirion SCD40/SCD41 + 63 | USE_HM330X | xsns_93 | HM330X | 0x40 | | Particule sensor + 64 | USE_HDC2010 | xsns_94 | HDC2010 | 0x40 | | Temperature and Humidity sensor + 65 | USE_ADE7880 | xnrg_23 | ADE7880 | 0x38 | | Energy monitor + 66 | USE_PCF85363 | xsns_99 | PCF85363 | 0x51 | | Real time clock + 67 | USE_DS3502 | xdrv_61 | DS3502 | 0x28 - 0x2B | | Digital potentiometer + 68 | USE_HYT | xsns_97 | HYTxxx | 0x28 | Yes | Temperature and Humidity sensor + 69 | USE_SGP40 | xsns_98 | SGP40 | 0x59 | | Gas (TVOC) and air quality + 70 | USE_LUXV30B | xsns_99 | LUXV30B | 0x4A | | DFRobot SEN0390 V30B lux sensor + 71 | USE_QMC5883L | xsns_33 | QMC5883L | 0x0D | | Magnetic Field Sensor + 72 | USE_INA3221 | xsns_100 | INA3221 | 0x40-0x43 | | 3-channels Voltage and Current sensor + 73 | USE_HMC5883L | xsns_101 | HMC5883L | 0x1E | | 3-channels Magnetic Field Sensor + 74 | USE_DISPLAY_TM1650 | xdsp_20 | TM1650 | 0x24 - 0x27, 0x34 - 0x37 | | Four-digit seven-segment LED controller + 75 | USE_PCA9632 | xdrv_64 | PCA9632 | 0x60 | | 4-channel 4-bit pwm driver + 76 | USE_SEN5X | xsns_103 | SEN5X | 0x69 | Yes | Gas (VOC/NOx index) and air quality (PPM <1,<2.5,<4,<10) + 77 | USE_MCP23XXX_DRV | xdrv_67 | MCP23x17 | 0x20 - 0x26 | | 16-bit I/O expander as virtual button/switch/relay + 78 | USE_PMSA003I | xsns_104 | PMSA003I | 0x12 | | PM2.5 Air Quality Sensor with I2C Interface + 79 | USE_GDK101 | xsns_106 | GDK101 | 0x18 - 0x1B | | Gamma Radiation Sensor + 80 | USE_TC74 | xsns_108 | TC74 | 0x48 - 0x4F | | Temperature sensor + 81 | USE_PCA9557 | xdrv_69 | PCA95xx | 0x18 - 0x1F | | 8-bit I/O expander as virtual button/switch/relay + 82 | USE_SGP4X | xsns_109 | SGP4X | 0x59 | | Gas (TVOC/NOx index) + 83 | USE_MAX17043 | xsns_110 | MAX17043 | 0x36 | | Fuel-gauge for 3.7 Volt Lipo battery + 84 | USE_ENS16x | xsns_111 | ENS16x | 0x52 - 0x53 | | Gas (TVOC, eCO2) and air quality sensor + 85 | USE_ENS210 | xsns_112 | ENS210 | 0x43 - 0x44 | | Temperature and humidity sensor + NOTE: Bus2 supported on ESP32 only. diff --git a/README.md b/README.md index f36d66b24..1ca83d791 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ _Written for PlatformIO._ [![GitHub version](https://img.shields.io/github/release/arendst/Tasmota.svg)](http://ota.tasmota.com/tasmota/release) [![GitHub download](https://img.shields.io/github/downloads/arendst/Tasmota/total.svg)](https://github.com/arendst/Tasmota/releases/latest) [![License](https://img.shields.io/github/license/arendst/Tasmota.svg)](LICENSE.txt) -[![Chat](https://img.shields.io/discord/479389167382691863.svg)](https://discord.gg/Ks2Kzd4) +[![Discord](https://img.shields.io/discord/479389167382691863.svg?logo=discord&logoColor=white&color=5865F2&label=Discord)](https://discord.gg/Ks2Kzd4) [![Gitpod Ready-to-Code](https://img.shields.io/badge/Gitpod-Ready--to--Code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/arendst/Tasmota)
diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 7056e530a..aced10132 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -75,7 +75,7 @@ Latest released binaries can be downloaded from - http://ota.tasmota.com/tasmota/release Historical binaries can be downloaded from -- http://ota.tasmota.com/tasmota/release-13.2.0 +- http://ota.tasmota.com/tasmota/release-13.3.0 The latter links can be used for OTA upgrades too like ``OtaUrl http://ota.tasmota.com/tasmota/release/tasmota.bin.gz`` @@ -95,12 +95,18 @@ The following binary downloads have been compiled with ESP32/Arduino library cor - **tasmota32-webcam.bin** = The Webcam version adds webcam support for 4M+ flash. - **tasmota32-zbbridgepro.bin** - The Sonoff Zigbee Bridge Pro version with CC2652P firmware load support. +### ESP32-C2 and ESP32-C6 based +The following binary downloads have been compiled with ESP32/Arduino library core version **3.0.0-alpha3**. + +- **tasmota32c2-arduino30.bin** = The Tasmota version with most drivers including additional sensors and KNX for ESP32-C2 and 4M+ flash. +- **tasmota32c6cdc-arduino30.bin** = The Tasmota version with most drivers including additional sensors and KNX for ESP32-C6 with serial over embedded USB CDC or hardware USB and 4M+ flash. + Latest released binaries can be downloaded from - https://github.com/arendst/Tasmota-firmware/tree/main/release-firmware - https://ota.tasmota.com/tasmota32/release Historical binaries can be downloaded from -- https://ota.tasmota.com/tasmota32/release-13.2.0 +- https://ota.tasmota.com/tasmota32/release-13.3.0 The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasmota.com/tasmota32/release/tasmota32.bin`` @@ -110,55 +116,69 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm [Complete list](BUILDS.md) of available feature and sensors. -## Changelog v13.2.0 Quincy +## Changelog v13.3.0 Quinlan ### Added -- Experimental support for ESP32-C2 and ESP32-C6 using Arduino core v3 -- Commands to allow setting of timeprop parameters [#19310](https://github.com/arendst/Tasmota/issues/19310) -- Command ``Mi32Name`` [#19619](https://github.com/arendst/Tasmota/issues/19619) -- Variables ``%power<1..28>%`` and ``%switch<1..28>%`` to rules [#19331](https://github.com/arendst/Tasmota/issues/19331) -- Support different baudrates on BL0942 energy monitor -- Support for Shelly PlusPMMini, Plus1Mini and Plus1PMMini -- Support for HDMI CEC protocol [#19434](https://github.com/arendst/Tasmota/issues/19434) -- Support for ENS16x (air quality) and ENS210 (temp & RH) sensors [#19479](https://github.com/arendst/Tasmota/issues/19479) -- Support for HC8 CO2 sensor [#19714](https://github.com/arendst/Tasmota/issues/19714) -- Support for non-persistent ``WebButton17`` to ``WebButton32`` [#19580](https://github.com/arendst/Tasmota/issues/19580) -- ESP32 commands ``Ds18Rescan`` and ``Ds18RetryRead`` [#19700](https://github.com/arendst/Tasmota/issues/19700) -- ESP32 support for influxdb access using https [#19582](https://github.com/arendst/Tasmota/issues/19582) -- Berry read and write Counters [#19558](https://github.com/arendst/Tasmota/issues/19558) -- Matter support for Virtual Devices controllable via Rules or Berry [#19520](https://github.com/arendst/Tasmota/issues/19520) +- Support for ESP32-C2 and ESP32-C6 using Arduino Core3 +- Command ``GpioRead`` to show input state [#19810](https://github.com/arendst/Tasmota/issues/19810) +- Command ``WebCanvas linear-gradient(#F02 7%,#F93,#FF4,#082,#00F,#708 93%)`` to set GUI canvas +- I2C bus2 support to iAQ core sensor [#19799](https://github.com/arendst/Tasmota/issues/19799) +- I2C bus2 support to HTU temperature and humidity sensor +- I2C bus2 support to BH1750 ambient light sensor +- I2C bus2 support to ADS1115 A/D Converter +- I2C bus2 support to SHTxX temperature and humidity sensor +- I2C bus2 support to HYTxxx temperature and humidity sensor +- I2C bus2 support to SI1145/6/7 Ultra violet index and light sensor +- I2C bus2 support to LM75AD temperature sensor +- Support for Winsen XH03x dust particle sensors using USE_PMS5003 and PMS_MODEL_ZH03X [#19850](https://github.com/arendst/Tasmota/issues/19850) +- ST7735S display.ini for 1.44 inch 128x128 red SPI display [#19862](https://github.com/arendst/Tasmota/issues/19862) +- Scripter TCP client [#19914](https://github.com/arendst/Tasmota/issues/19914) +- NeoPool hydrolysis setpoint and max +- NeoPool command ``NPFiltrationSpeed`` to set non-standard filtration type speed [#19857](https://github.com/arendst/Tasmota/issues/19857) +- NeoPool command ``SetOption157`` to enable output of sensitive data [#19857](https://github.com/arendst/Tasmota/issues/19857) +- NeoPool command ``NPBoost`` [#19973](https://github.com/arendst/Tasmota/issues/19973) +- NeoPool sensor delta trigger (command ``NPTelePeriod``) [#19973](https://github.com/arendst/Tasmota/issues/19973) +- NeoPool enhancements for HomeAssistant [#19857](https://github.com/arendst/Tasmota/issues/19857) +- NeoPool store settings on unified file system [#19973](https://github.com/arendst/Tasmota/issues/19973) +- DeepSleep support through TIMERS [#20117](https://github.com/arendst/Tasmota/issues/20117) +- ESP32 auto TasConsole USB or Serial connection for Core3 by @staars +- ESP32 Partition Wizard can be loaded dynamically [#19980](https://github.com/arendst/Tasmota/issues/19980) +- ESP32 support for Avago Tech Bluetooth Buttons [#20088](https://github.com/arendst/Tasmota/issues/20088) +- Berry ``debug.gcdebug()`` to enable GC debugging [#19936](https://github.com/arendst/Tasmota/issues/19936) +- Berry AES_CBC to crypto module [#19964](https://github.com/arendst/Tasmota/issues/19964) +- Berry `scale_int`, equivalent of `scale_uint` for signed integers [#20090](https://github.com/arendst/Tasmota/issues/20090) +- HASPmota add styling properties [#19912](https://github.com/arendst/Tasmota/issues/19912) +- Matter flow sensor support [#19852](https://github.com/arendst/Tasmota/issues/19852) ### Breaking Changed -- `Sendmail` upgraded to ESP-Mail-Client v3.4.9 from v1.2.0, using BearSSL instead of MbedTLS [#19460](https://github.com/arendst/Tasmota/issues/19460) -- Removed support for Homekit in favour of Matter [#19738](https://github.com/arendst/Tasmota/issues/19738) +- NeoPool SENSOR topic ``Power`` renamed to ``Powerunit`` [#19857](https://github.com/arendst/Tasmota/issues/19857) +- Remove Berry `every_200ms` event which didn't work anyways [#20205](https://github.com/arendst/Tasmota/issues/20205) ### Changed -- ESP32 Framework (Arduino Core) from v2.0.11 to v2.0.14 -- ESP32 LVGL library from v8.3.8 to v8.3.10 (no functional change) -- Display invert setting after tasmota start in uDisplay driver [#19337](https://github.com/arendst/Tasmota/issues/19337) -- Consolidate SGP40 and SGP41 into SGP4x driver [#19560](https://github.com/arendst/Tasmota/issues/19560) -- MAX31855/MAX6675 sensors driver support up to 6 [#19329](https://github.com/arendst/Tasmota/issues/19329) -- Teleinfo use Apparent Power as Active Power approximation [#19756](https://github.com/arendst/Tasmota/issues/19756) -- ESP32 LittleFS updated to version with grow option [#19635](https://github.com/arendst/Tasmota/issues/19635) -- ESP32 I2S audio preparation for Arduino Core v3 [#19637](https://github.com/arendst/Tasmota/issues/19637) -- ESP32 analog from `analogRead()` to calibrated `analogReadMilliVolts()` [#19732](https://github.com/arendst/Tasmota/issues/19732) +- ESP32 Framework (Arduino Core3) from v3.0.0-alpha1 to v3.0.0-alpha3 +- ESP32 LVGL library from v8.3.10 to v8.3.11 (no functional change) +- Increase MAX_HUE_DEVICES to 32 [#19820](https://github.com/arendst/Tasmota/issues/19820) +- NeoPool ``NPHydrolysis`` percent and unit [#19924](https://github.com/arendst/Tasmota/issues/19924) +- Thermostat JSON index from 0 to 1 [#20011](https://github.com/arendst/Tasmota/issues/20011) +- MI32 updates [#19893](https://github.com/arendst/Tasmota/issues/19893) +- ESP32 keep FileSystem intact when over flashing with VSC [#19816](https://github.com/arendst/Tasmota/issues/19816) +- Berry leds animation refactoring stage 1 [#20197](https://github.com/arendst/Tasmota/issues/20197) +- Berry ULP API changes for Core3/IDF5 [#20198](https://github.com/arendst/Tasmota/issues/20198) +- Matter Light0 now accept a Relay number [#19809](https://github.com/arendst/Tasmota/issues/19809) +- Matter update hierarchy of plugins [#19915](https://github.com/arendst/Tasmota/issues/19915) ### Fixed -- Shutter invert [#19341](https://github.com/arendst/Tasmota/issues/19341) and [#19374](https://github.com/arendst/Tasmota/issues/19374) -- Teleinfo power [#19381](https://github.com/arendst/Tasmota/issues/19381) -- Exception 3 in IRHVAC [#19389](https://github.com/arendst/Tasmota/issues/19389) -- PCF8574 mode 1 with base relays exception 3/28 regression from v12.4.0.4 [#19408](https://github.com/arendst/Tasmota/issues/19408) -- ModbusBridge write memory leak [#19758](https://github.com/arendst/Tasmota/issues/19758) -- Zigbee timezone when device reads LocalTime attribute [#19772](https://github.com/arendst/Tasmota/issues/19772) -- ESP32 DS18x20 driver support extended over GPIO33 -- ESP32 Support for IPv6 link-local zones for esp-idf 5.1 (necessary for Matter) -- ESP32 Shutter migration [#19454](https://github.com/arendst/Tasmota/issues/19454) -- ESP32 Shutter multi press button events [#19465](https://github.com/arendst/Tasmota/issues/19465) -- ESP32 Shutter button quad press [#19589](https://github.com/arendst/Tasmota/issues/19589) -- ESP32 shutter frequency [#19717](https://github.com/arendst/Tasmota/issues/19717) -- ESP32 Arduino Core v2 wifi client flush [#19642](https://github.com/arendst/Tasmota/issues/19642) -- ESP32 Partition Wizard grow filesystem support [#19645](https://github.com/arendst/Tasmota/issues/19645) -- ESP32-C3 relay click on restart -- Matter support for Virtual Devices controllable via Rules or Berry [#19520](https://github.com/arendst/Tasmota/issues/19520) - -### Removed -- Support for Homekit in favour of Matter [#19738](https://github.com/arendst/Tasmota/issues/19738) +- Compile USE_PID [#19890](https://github.com/arendst/Tasmota/issues/19890) +- Scripter timer issue [#19914](https://github.com/arendst/Tasmota/issues/19914) +- NeoPool filtration mode display [#19801](https://github.com/arendst/Tasmota/issues/19801) +- ``changeUIntScale`` for linearity when expanding range [#20089](https://github.com/arendst/Tasmota/issues/20089) +- TUYA state machine (in TUYA v1) [#20110](https://github.com/arendst/Tasmota/issues/20110) +- ``WebQuery`` response buffer corruption and format character ``%`` [#20111](https://github.com/arendst/Tasmota/issues/20111) +- ESP32 I2C allow bus2 support when bus1 is not enabled +- ESP32 remove restart energy logging if no energy monitoring is selected +- ESP32 IR receive with Arduino Core3 [#19904](https://github.com/arendst/Tasmota/issues/19904) +- ESP32 Zero-Cross Dimmer for Core3 [#19929](https://github.com/arendst/Tasmota/issues/19929) +- ESP32-C3 ledlink functionality regression from v13.1.0.2 +- ESP32 Neopixel flicker for Core3/IDF5 [#20196](https://github.com/arendst/Tasmota/issues/20196) +- Berry parser error in specific cases [#20059](https://github.com/arendst/Tasmota/issues/20059) +- Berry ``gpio.dac_voltage()`` regression from v13.1.0.1 [#19997](https://github.com/arendst/Tasmota/issues/19997) +- HASPmota `bar` fixed `val` attribute [#20208](https://github.com/arendst/Tasmota/issues/20208) diff --git a/TEMPLATES.md b/TEMPLATES.md index 40cabf9ec..3d34fdf0f 100644 --- a/TEMPLATES.md +++ b/TEMPLATES.md @@ -5,7 +5,7 @@ # Templates -Find below the available templates as of October 2023. More template information can be found in the [Tasmota Device Templates Repository](http://blakadder.github.io/templates) +Find below the available templates as of December 2023. More template information can be found in the [Tasmota Device Templates Repository](http://blakadder.github.io/templates) ## Adapter Board ``` @@ -183,7 +183,7 @@ HeyLight Plafoniera 30W CCT {"NAME":"HeyLight Ceiling Light","GPIO":[0,0,0,0,0, Hykolity 13" RGBCCT Flush Mount {"NAME":"Hykolity","GPIO":[0,0,0,0,416,419,0,0,417,420,418,0,0,0],"FLAG":0,"BASE":18} Lamptan 3 Lights in 1 36W {"NAME":"Lamptan Smart Wi-Fi Ceiling Lamp LUMINA 36W","GPIO":[0,0,0,0,0,416,0,0,0,417,0,0,0,0],"FLAG":0,"BASE":54} LE lampUX 15W RGBCCT {"NAME":"LE lampUX 15W","GPIO":[0,0,0,0,416,419,0,0,417,420,418,0,0,0],"FLAG":0,"BASE":18} -LightZone MeLiTec {"NAME":"LightZone MeLiTec D114 Light ","GPIO":[0,2272,0,2304,0,0,0,0,0,0,0,0,0,0],"FLAG":0,"BASE":54,"CMND":"TuyaMCU 11,20 | TuyaMCU 21,22 | TuyaMCU 23,23 | DimmerRange 25,1000"} +LightZone MeLiTec {"NAME":"LightZone MeLiTec D114 Light ","GPIO":[0,2272,0,2304,0,0,0,0,0,0,0,0,0,0],"FLAG":0,"BASE":54} Lohas ZN026CL10 RGBCCT {"NAME":"Lohas LED Lamp","GPIO":[0,0,0,0,417,416,0,0,419,418,420,0,0,0],"FLAG":0,"BASE":18} LOLAsmart Uranus White 70 cm {"NAME":"lola smart","GPIO":[0,0,0,1088,416,419,0,0,417,420,418,0,0,0],"FLAG":0,"BASE":18} LSC 20W 1400lm White Ambiance {"NAME":"LSC RGBCW LED","GPIO":[0,0,0,0,0,0,0,0,4064,0,4032,0,0,0],"FLAG":0,"BASE":18} @@ -301,6 +301,7 @@ Coiaca Tasmota Development Board AWR12 {"NAME":"AWR12t","GPIO":[320,1,1,1,1,1,0 Dasduino CONNECT {"NAME":"Dasduino CONNECT","GPIO":[1,1,1376,1,640,608,1,1,1,1,1,1,1,1],"FLAG":0,"BASE":18} Dasduino CONNECTPLUS {"NAME":"Dasduino CONNECTPLUS","GPIO":[32,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,640,608,1,0,1,1,1,0,0,0,0,1376,1,1,1,1,0,0,1],"FLAG":0,"BASE":1} Espoir Rev 1.0.0 PoE+ {"NAME":"Espoir","GPIO":[0,0,1,0,1,1,1,1,1,1,1,1,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,5568,5600,1,7968,1,1,1,1],"FLAG":0,"BASE":1} +Freenove ESP32-WROOM {"NAME":"FREENOVE SP32 WROOM","GPIO":[1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,0,1,1,1,0,1,1,1,0,0,0,0,1,1,0,0,0,0,0,0],"FLAG":0,"BASE":1} KinCony 128 Channel Controller {"NAME":"KC868-A128","GPIO":[0,1,0,1,609,640,1,1,1,3232,3200,641,608,1,5600,0,0,1,0,5568,0,1,0,0,0,0,0,0,0,0,4705,4707,4706,0,0,4704],"FLAG":0,"BASE":1} KinCony 64 Channel Controller {"NAME":"KC868-A64","GPIO":[0,1,0,1,609,640,1,1,1,3232,3200,641,608,1,5600,0,0,1,0,5568,0,1,0,0,0,0,0,0,0,0,4705,4707,4706,0,0,4704],"FLAG":0,"BASE":1} LC Technology MicroPython Maker {"NAME":"LC-ESP-Python","GPIO":[1,1,544,1,1,1,1,1,1,1,1,1,1,1],"FLAG":0,"BASE":18} @@ -314,6 +315,7 @@ Olimex ESP32-POE Ethernet {"NAME":"Olimex ESP32-PoE","GPIO":[1,1,1,1,1,1,0,0, QuinLED 2 Channel {"NAME":"QuinLED 2 channel","GPIO":[416,0,417,0,0,0,0,0,0,0,0,0,0,0],"FLAG":0,"BASE":18} Silicognition wESP32 {"NAME":"wESP32","GPIO":[0,0,1,0,1,1,0,0,1,1,1,1,5568,5600,1,0,0,0,0,1,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,1],"FLAG":0,"BASE":1} TZT ESP8266 Weather Station Kit {"NAME":"TZT Weather Station","GPIO":[32,0,640,0,1,1184,0,0,1,1,608,1,1,1],"FLAG":0,"BASE":18} +WeAct Studio ESP32 Core {"NAME":"ESP32CoreBoard","GPIO":[32,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,544,1,0,1,1,1,0,0,0,0,1,1,1,1,1,0,0,1],"FLAG":0,"BASE":1} Wemos D1 Mini ESP32 {"NAME":"Wemos D1 Mini ESP32","GPIO":[0,0,1,0,1,1,0,0,1,1,1,1,1,1,1,1,0,1,1,1,0,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0],"FLAG":0,"BASE":1} Wemos LOLIN32 Lite V1.0.0 (ESP32) {"NAME":"Wemos LOLIN32 Lite V1.0.0","GPIO":[1,0,1,0,1,1,0,0,1,1,1,1,1,1,1,1,0,0,0,1,0,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0],"FLAG":0,"BASE":1} Wireless Tag ESP32 Ethernet {"NAME":"WT32_ETH01","GPIO":[1,1,1,1,1,1,0,0,1,0,1,1,3840,576,5600,0,0,0,0,5568,0,0,0,0,0,0,0,0,1,1,0,1,1,0,0,1],"FLAG":0,"BASE":1} @@ -456,11 +458,13 @@ QS-WiFi-D01-TRIAC 150W {"NAME":"QS-WiFi-D01-TRIAC","GPIO":[0,3200,0,3232,0 RJWF-02A {"NAME":"RJWF-02A","GPIO":[32,2272,0,2304,0,0,0,0,0,0,288,0,0,0],"FLAG":0,"BASE":54} Shelly Dimmer {"NAME":"Shelly Dimmer 1","GPIO":[0,3200,0,3232,5568,5600,0,0,192,0,193,288,0,4736],"FLAG":0,"BASE":18} Shelly Dimmer 2 {"NAME":"Shelly Dimmer 2","GPIO":[0,3200,0,3232,5568,5600,0,0,193,0,192,0,320,4736],"FLAG":0,"BASE":18} +Shelly Plus 0-10V Dimmer {"NAME":"Shelly Plus 0-10V Dimmer","GPIO":[288,0,0,0,192,0,0,0,0,0,0,0,0,0,193,1,0,0,0,0,0,32,416,0,0,0,0,0,4736,0,0,0,0,0,0,0],"FLAG":0,"BASE":1} Sonoff D1 {"NAME":"Sonoff D1","GPIO":[1,3200,0,3232,0,0,0,0,0,320,0,0,0,0],"FLAG":0,"BASE":74} ``` ## Display ``` +Espressif ESP-WROVER-KIT {"NAME":"ESPWroverKit41","GPIO":[1,1,1,1,1,992,1,1,1,1,1,1,1,1,1024,736,0,800,768,704,0,672,6210,1,0,0,0,0,1,1,1,1,1,0,0,1],"FLAG":0,"BASE":1} Heltec WiFi Kit 32 {"NAME":"WiFi Kit 32","GPIO":[1,1,1,1,640,1,1,1,1,1,1,608,3840,1,1,1,0,1,1,1,0,224,1,1,0,0,0,0,1,1,1,1,1,0,0,1],"FLAG":0,"BASE":1} Heltec WiFi Kit 8 {"NAME":"WifiKit8","GPIO":[1,1,1,1,640,608,1,1,1,1,1,1,1024,1],"FLAG":0,"BASE":18} LilyGO T5 4.7 inch E-paper {"NAME":"LilyGO T5-4.7","GPIO":[0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,7616,0,0,0,0,0,0,0,0,0,0,33,34,4704,0,0,32],"FLAG":0,"BASE":1} @@ -477,6 +481,7 @@ M5Stack M5StickC {"NAME":"M5StickC","GPIO":[1,0,0,0,0,768,1056,576,0 M5Stack Tough {"NAME":"M5Stack Tough","GPIO":[6210,1,1,1,6720,768,0,0,0,1,1,800,0,0,736,1,0,641,609,704,0,0,0,1,0,0,0,0,640,608,1,1,1,0,672,7968],"FLAG":0,"BASE":1} ODROID-GO Game Kit {"NAME":"ODROID-GO","GPIO":[32,3200,544,3232,608,768,0,0,6210,33,416,640,1,1,736,672,0,800,6720,704,0,0,0,34,0,0,0,0,164,165,3328,3329,4866,0,0,35],"FLAG":0,"BASE":3} OLED Display Module 0.66" for Wemos D1 Mini {"NAME":"OLED 64x48","GPIO":[1,1,1,1,640,608,0,0,1,1,1,1,1024,1],"FLAG":0,"BASE":18} +Sunton 2.8" 240*320 CYD {"NAME":"ESP32-2432S028","GPIO":[6210,1,800,0,448,0,1,1,672,704,736,768,449,450,1,1,0,992,1,1,0,737,480,1,0,0,0,0,705,7264,4768,1,0,0,0,673],"FLAG":0,"BASE":1} Wireless Tag 3.5" Touch {"NAME":"WT32-SC01","GPIO":[6210,1,1,1,1,1,0,0,1,704,736,768,1,1,640,608,1,800,1024,992,0,1,1,1,0,0,0,0,1,1,1,1,1,0,0,1],"FLAG":0,"BASE":1} ``` @@ -591,6 +596,7 @@ Devola Designer Glass Panel {"NAME":"Devola Heater","GPIO":[0,0,0,0,224,1,0,0,0 EBERG ROT 720 Infrared {"NAME":"Tuya MCU","GPIO":[0,2272,0,2304,0,0,0,0,0,0,0,0,0,0],"FLAG":0,"BASE":54,"CMND":"TuyaMCU 11,4 | TuyaMCU 72,2 | TuyaMCU 71,3"} Klarstein Bornholm Smart 2000W {"NAME":"Klarstein Bornholm","GPIO":[0,2272,0,2304,0,0,0,0,0,0,0,0,0,0],"FLAG":0,"BASE":54} Kogan 1500W Panel {"NAME":"Kogan Panel Heater","GPIO":[0,0,0,0,0,0,0,0,0,2304,0,2272,0,0],"FLAG":0,"BASE":54} +LSC Smart Connect 500W IR Panel {"NAME":"LSC Connect Smart IR Panel Heater","GPIO":[0,2272,0,2304,0,0,0,0,0,0,0,0,0,0],"FLAG":0,"BASE":54} SmartMi Electric Air {"NAME":"ZNNFJ07ZM","GPIO":[0,0,0,0,0,0,0,0,0,0,0,0,0,3200,3232,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"FLAG":0,"BASE":1} ``` @@ -618,12 +624,13 @@ BlitzWolf BW-RC1 {"NAME":"BW-RC1","GPIO":[0,0,0,0,320,1088,0,0,0,32, Connect SmartHome Universal Remote {"NAME":"CSH IR Controller","GPIO":[1,1,1,1,320,1088,0,0,0,32,1056,0,0,0],"FLAG":0,"BASE":62} Cusam CS-IRC-1 {"NAME":"YTF IR Controller","GPIO":[1,1,1,1,288,1088,0,0,0,32,1056,0,0,0],"FLAG":0,"BASE":62} Eachen IR DC6 {"NAME":"Eachen IR","GPIO":[0,0,0,0,320,1088,0,0,1,32,1056,0,0,0],"FLAG":0,"BASE":18} +ESP_IR_TR {"NAME":"Tasmota IR-Gateway","GPIO":[0,0,0,0,1056,0,0,0,0,0,1088,0,0,0],"FLAG":0,"BASE":18} Frankever Smart Remote {"NAME":"FK-UFO-R4","GPIO":[1,1,1,1,288,1088,0,0,0,32,1056,0,0,0],"FLAG":0,"BASE":62} Geeklink GK01 {"NAME":"GL IR Blaster","GPIO":[1,1,1,1,320,1088,0,0,0,32,1056,0,0,0],"FLAG":0,"BASE":62} HIPER IoT IR2 {"NAME":"hiper_HI-IR2","GPIO":[1,1,1,1,320,1088,0,0,0,32,1056,0,0,0],"FLAG":0,"BASE":62} Jinvoo AC/TV Box {"NAME":"Jinvoo IR Controller","GPIO":[1,1,1,1,320,1088,0,0,0,32,1056,0,0,0],"FLAG":0,"BASE":62} JS-IR1 Universal Remote {"NAME":"JS-IR1","GPIO":[1,1,1,1,288,1088,0,0,0,32,1056,0,0,0],"FLAG":0,"BASE":18} -KinCony ESP32 433MHz RF and {"NAME":"KC868-AG","GPIO":[0,0,1056,0,480,0,0,0,0,0,1,0,1,1,1,1,0,1,1120,1152,0,7968,0,0,0,0,0,0,1,1,1,1,1,0,0,1],"FLAG":0,"BASE":1,"CMND":"BuzzerPwm 1"} +KinCony ESP32 433MHz RF and {"NAME":"KC868-AG","GPIO":[0,0,1056,0,480,0,0,0,0,1152,1,0,1,1,1,1,0,1,1120,1088,0,1,1,1,0,0,0,0,1,1,1,1,1,0,0,1],"FLAG":0,"BASE":1,"CMND":"BuzzerPwm 1"} Lenovo SE-741C {"NAME":"Lenovo IR","GPIO":[1,1,1,1,320,1088,0,0,0,32,1056,0,0,0],"FLAG":0,"BASE":62} Mirabella Genio I002577 {"NAME":"Genio IR TxRx","GPIO":[1,1,1,1,320,1088,0,0,0,32,1056,0,0,0],"FLAG":0,"BASE":62} Moes Tuya Remote Control {"NAME":"Moes IR Controller","GPIO":[1,1,1,1,1,1088,0,0,0,32,1056,0,0,0],"FLAG":0,"BASE":62} @@ -864,12 +871,13 @@ Sinilink PCIe Computer Remote {"NAME":"XY-WPCE","GPIO":[1,1,320,1,32,224,0,0,16 Sinilink USB Computer Remote {"NAME":"XY-WPCL","GPIO":[0,0,320,0,0,224,0,32,160,0,0,0,0,0],"FLAG":0,"BASE":18,"CMND":"SO114 1 | Pulsetime 10 | SwitchMode1 2"} Sinilink XY-Clock Clock Alarm Module {"NAME":"XY-Clock","GPIO":[288,0,289,0,0,416,32,33,608,640,0,0,34,0],"FLAG":0,"BASE":18} Sunbeam LoftTec Electric Blanket {"NAME":"Sunbeam Heated Blanket","GPIO":[0,2272,0,2304,0,0,0,0,0,0,0,0,0,0],"FLAG":0,"BASE":54} -Ulanzi Smart Pixel Clock {"NAME":"Ulanzi TC001","GPIO":[0,0,0,0,0,0,0,0,0,0,34,480,0,0,0,0,0,640,608,0,0,0,32,33,0,0,0,0,1376,0,4704,4768,0,0,0,0],"FLAG":0,"BASE":1} +Ulanzi Smart Pixel Clock {"NAME":"Ulanzi TC001","GPIO":[0,0,0,0,0,0,0,0,0,0,34,480,0,0,0,0,0,640,608,0,0,0,32,33,0,0,0,0,1376,0,4705,4768,0,0,0,0],"FLAG":0,"BASE":1} Xystec USB3.0 4 Port Hub {"NAME":"Xystec USB Hub","GPIO":[0,0,0,0,224,0,0,0,226,227,225,0,0,0],"FLAG":0,"BASE":18} ``` ## Module ``` +Ants Make 16 Channel ESP32 Relay Driver 5V DC {"NAME":"AM-022","GPIO":[1,1,1,1,232,237,1,1,228,231,229,1,233,230,234,235,0,238,239,236,0,224,227,226,0,0,0,0,1,225,1,1,1,0,0,1],"FLAG":0,"BASE":1} DT-Light ESP8285 Lighting {"NAME":"DMP-L1","GPIO":[1,1,0,1,1,1,0,0,1,1,1,1,1,1],"FLAG":0,"BASE":18} ESP-01D {"NAME":"ESP-01D","GPIO":[1,1,0,1,1,0,0,0,1,0,1,0,0,0],"FLAG":0,"BASE":18} ESP-01S {"NAME":"ESP-01","GPIO":[1,1,1,1,0,0,0,0,0,0,0,0,0,0],"FLAG":0,"BASE":18} @@ -899,13 +907,18 @@ Tuya Alarm PIR {"NAME":"CT61W","GPIO":[0,0,0,0,0,0,0,0,0,160,480,2 ``` Steren Curtain {"NAME":"Steren_SHOME-155","GPIO":[0,0,0,0,0,0,0,0,0,2304,0,2272,0,0],"FLAG":0,"BASE":54,"CMND":"SO54 1|SO20 1|TuyaMCU 61,1|TuyaMCU 21,2|TuyaMCU 27,3|TuyaMCU 97,5|TuyaMCU 11,6|TuyaMCU 62,7|TuyaMCU 63,8|TuyaMCU 81,9|TuyaMCU 98,10|TuyaMCU 82,11"} Zemismart BCM300D-TY {"NAME":"Zemistart_Curt","GPIO":[0,0,0,0,0,0,0,0,0,2304,0,2272,0,0],"FLAG":0,"BASE":54} -Zemismart Blinds Controller {"NAME":"Zemismart Blind","GPIO":[1,1,1,1,1,1,0,0,1,2304,1,2272,1,0],"FLAG":0,"BASE":54} +Zemismart Blinds Controller {"NAME":"Zemismart Blind WBR3","GPIO":[0,2272,0,2304,0,0,0,0,0,0,0,0,0,0],"FLAG":0,"BASE":54,"CMND":"TuyaMCU 11,7|TuyaMCU 21,2"} Zemismart Curtain {"NAME":"Zemismart_Curt","GPIO":[0,0,0,0,0,0,0,0,0,2304,0,2272,0,0],"FLAG":0,"BASE":54} Zemismart Rechargeable Roller Shade {"NAME":"Zemismart Remote","GPIO":[544,0,288,33,225,32,0,0,34,226,289,224,290,0],"FLAG":0,"BASE":18} Zemismart Roller Shade {"NAME":"M2805EIGB","GPIO":[1,2272,1,2304,1,1,0,0,1,1,1,1,1,0],"FLAG":0,"BASE":54} Zemismart Updated RF Remote Roller Shade {"NAME":"Zemismart M515EGB","GPIO":[1,2272,1,2304,1,1,0,0,1,1,1,1,1,0],"FLAG":0,"BASE":54} ``` +## Other +``` +Kogan SmarterHome 1.9L Pet Water Fountain {"NAME":"WaterFountain","GPIO":[257,0,259,0,576,32,0,0,224,161,0,480,226,4704],"FLAG":0,"BASE":18} +``` + ## Outdoor Plug ``` Acenx SOP04-US Dual {"NAME":"SOP04-US Dual","GPIO":[1,1,1,1,320,321,0,0,224,32,225,1,1,0],"FLAG":0,"BASE":18} @@ -962,6 +975,7 @@ Maxcio EOP03-EU {"NAME":"Maxcio EOP03-EU","GPIO":[0,0,0,0,225,321,0 Maxcio SOP02-US {"NAME":"Maxcio SOP02US","GPIO":[0,0,0,0,0,544,0,0,224,32,225,0,0,1],"FLAG":0,"BASE":18} Merkury {"NAME":"Merkury Switch","GPIO":[32,0,0,0,0,321,0,0,0,288,224,0,0,0],"FLAG":0,"BASE":18} Merkury {"NAME":"Merkury Switch","GPIO":[0,0,0,0,32,0,0,0,0,224,0,0,0,0],"FLAG":0,"BASE":18} +Meross MSS620 16A IP44 {"NAME":"MSS620","GPIO":[0,320,0,320,225,0,0,0,224,576,32,0,0,0],"FLAG":0,"BASE":18} Minoston MP22W {"NAME":"Minoston MP22W","GPIO":[0,0,0,0,320,0,0,0,224,64,0,0,0,0],"FLAG":0,"BASE":18} Nedis PO120 IP44 {"NAME":"WIFIPO120FWT","GPIO":[32,0,0,0,2688,2656,0,0,2624,320,224,0,0,0],"FLAG":0,"BASE":49} Obi Stecker IP44 {"NAME":"OBI-Outdoor-Socket2","GPIO":[0,0,0,0,224,32,0,0,576,288,1,1,1,1],"FLAG":0,"BASE":18} @@ -1036,7 +1050,7 @@ Aquiv S1 {"NAME":"Aquiv S1","GPIO":[0,0,544,0,320,0,0,0,224, Arlec 10m Smart Extension Lead {"NAME":"Arlec Ext Cord","GPIO":[0,32,0,0,0,0,0,0,0,320,224,0,0,0],"FLAG":0,"BASE":18} Arlec Heavy Duty 20m Extension Lead {"NAME":"Arlec Ext Cord","GPIO":[0,32,0,0,0,0,0,0,0,320,224,0,0,0],"FLAG":0,"BASE":18} Arlec Plug In Socket {"NAME":"PC191HA","GPIO":[0,32,0,0,2720,2656,0,0,2624,224,288,0,0,0],"FLAG":0,"BASE":18} -Arlec Plug In Socket {"NAME":"PC191HAS2","GPIO":[0,0,0,32,2656,2624,0,0,224,2720,320,0,0,0],"FLAG":0,"BASE":18} +Arlec Plug In Socket {"NAME":"PC191HAS2 CB2S","GPIO":[0,0,0,32,2656,2624,0,0,224,2720,320,0,0,0],"FLAG":0,"BASE":18} Arlec Smart {"NAME":"Arlec-PC190HA","GPIO":[0,0,0,0,320,0,0,0,224,576,32,0,0,0],"FLAG":0,"BASE":18} Arlec Smart {"NAME":"PC399HA","GPIO":[0,0,0,32,2720,2656,0,0,2624,320,224,0,0,0],"FLAG":0,"BASE":52} Arlec Smart 2.1A USB Charger {"NAME":"Arlec Single","GPIO":[0,0,0,0,321,0,0,0,224,0,64,0,0,0],"FLAG":0,"BASE":18} @@ -1053,11 +1067,11 @@ Athom 16A EU V2 {"NAME":"Athom Plug V2","GPIO":[0,0,0,3104,0,32,0,0 Athom 16A Israel {"NAME":"Athom Power Monitoring Plug","GPIO":[0,0,0,32,2720,2656,0,0,2624,544,224,0,0,1],"FLAG":0,"BASE":18} Athom 16A Israel v2 {"NAME":"Athom Plug V2","GPIO":[0,0,0,3104,0,32,0,0,224,576,0,0,0,0],"FLAG":0,"BASE":18} Athom 16A Italy {"NAME":"Athom PG05-IT16A","GPIO":[0,0,0,32,2720,2656,0,0,2624,544,224,0,0,0],"FLAG":0,"BASE":1} +Athom 16A Switzerland v2 {"NAME":"Athom Plug V2","GPIO":[0,0,0,3104,0,32,0,0,224,576,0,0,0,0],"FLAG":0,"BASE":18} Athom 16A UK {"NAME":"Athom PG04-UK16A","GPIO":[0,0,0,32,2720,2656,0,0,2624,320,224,0,0,0],"FLAG":0,"BASE":18} Athom 16A UK V2 {"NAME":"Athom Plug V2","GPIO":[0,0,0,3104,0,32,0,0,224,576,0,0,0,0],"FLAG":0,"BASE":18} Athom 16A US {"NAME":"Athom PG03-US16A","GPIO":[0,0,0,32,2720,2656,0,0,2624,288,224,0,0,0],"FLAG":0,"BASE":18} Athom 16A US V2 {"NAME":"Athom Plug V2","GPIO":[0,0,0,3104,0,32,0,0,224,576,0,0,0,0],"FLAG":0,"BASE":18} -Athom Plug V3 {"NAME":"Athom Plug V3","GPIO":[0,0,0,32,0,224,576,0,0,0,0,0,0,0,0,0,0,0,0,0,3104,0],"FLAG":0,"BASE":1} Atlantis {"NAME":"Atlantis Smart Plug","GPIO":[32,0,0,0,2720,2656,0,0,2624,544,224,0,0,0],"FLAG":0,"BASE":18} Atomi AT1217 {"NAME":"AT1217","GPIO":[0,0,0,0,320,321,0,0,224,32,0,0,0,0],"FLAG":0,"BASE":18} Aubess 16A {"NAME":"Aubess 16A Power Monitoring Plug","GPIO":[0,32,0,0,2720,2656,0,0,2624,320,224,0,0,0],"FLAG":0,"BASE":18} @@ -1083,10 +1097,10 @@ Avatto OT08 {"NAME":"Avatto OT08","GPIO":[416,0,418,0,417,2720, Avidsen Home {"NAME":"Avidsen HomePlug","GPIO":[0,0,0,0,224,35,0,0,289,288,0,0,0,0],"FLAG":0,"BASE":18} Awow X5P {"NAME":"Awow","GPIO":[0,0,320,0,0,0,0,0,0,32,0,224,0,0],"FLAG":0,"BASE":18} AWP02L-N {"NAME":"AWP02L-N","GPIO":[0,0,320,0,0,0,0,0,0,32,0,224,0,0],"FLAG":0,"BASE":18} +AWP08L 20A {"NAME":"AWP08L","GPIO":[0,0,0,32,0,0,0,0,0,0,224,0,0,0],"FLAG":0,"BASE":18} AzpenHome Smart {"NAME":"Socket2Me","GPIO":[288,1,1,1,225,1,0,0,224,1,32,1,1,0],"FLAG":0,"BASE":18} Baco Smart Power Socket {"NAME":"Balco HE200021","GPIO":[0,0,0,32,2720,2656,0,0,2624,576,224,0,0,0],"FLAG":0,"BASE":52} Bagotte SK-EU-A01 {"NAME":"Bagotte SK-EU-A01","GPIO":[96,0,0,0,0,0,0,0,224,320,0,0,0,0],"FLAG":0,"BASE":18} -Bakibo Mini {"NAME":"SM300","GPIO":[320,0,576,0,0,2720,0,0,2624,32,2656,224,0,0],"FLAG":0,"BASE":59} Bakibo TP22Y {"NAME":"Bakibo TP22Y","GPIO":[0,0,0,32,2720,2656,0,0,2624,320,224,0,0,0],"FLAG":0,"BASE":52} Bardi 16A {"NAME":"BARDI","GPIO":[320,0,0,0,0,2720,0,0,224,32,2656,321,2624,0],"FLAG":0,"BASE":18} Bauhn ASPU-1019 {"NAME":"Bauhn Smart Pl","GPIO":[0,0,0,0,224,225,0,0,0,320,32,0,0,0],"FLAG":0,"BASE":18} @@ -1180,6 +1194,7 @@ DWFeng AWP02L-N {"NAME":"AWP02L-N","GPIO":[1,1,320,1,1,1,0,0,1,32,1 DWFeng BSD01 {"NAME":"DWFeng BSD01","GPIO":[1,1,1,1,1,1,1,1,224,32,320,1,1,1],"FLAG":0,"BASE":18} ECO Plugs CT-065W {"NAME":"ECO/CT-065W","GPIO":[0,0,576,0,0,0,0,0,0,32,0,224,0,0],"FLAG":0,"BASE":18} eco4life DPS1101S {"NAME":"Eco4Life Plug","GPIO":[0,0,0,0,288,321,0,0,224,32,0,0,0,0],"FLAG":0,"BASE":18} +Edisio 10A {"NAME":"Edisio Wifi Timer","GPIO":[1,1,1,1,1,1,1,1,1,1,32,1,320,1,1,1,1,1,1,1,1,1,224,1,1,1,1,1,1,1,1,1,1,1,1,1],"FLAG":0,"BASE":1} ednet 84334 {"NAME":"84334","GPIO":[0,0,0,0,320,321,0,0,224,32,0,0,0,0],"FLAG":0,"BASE":18} eFamilyCloud ASDFEE174 {"NAME":"eFamily Plug","GPIO":[0,0,0,0,288,224,0,0,0,32,0,0,0,0],"FLAG":0,"BASE":18} EFUN SH330W {"NAME":"EFUNPlug","GPIO":[320,1,1,1,1,1,1,1,1,32,1,224,1,1],"FLAG":0,"BASE":18} @@ -1343,6 +1358,7 @@ Koogeek KLSP2 {"NAME":"KOOGEEK KLSP2","GPIO":[321,3072,320,3104,0 Koogeek KLWP1 {"NAME":"Koogeek-KLWP1","GPIO":[544,0,320,0,0,2720,0,0,2624,32,2656,224,0,0],"FLAG":0,"BASE":1} Koogeek W-DEXI {"NAME":"W-DEXI","GPIO":[0,64,0,0,2720,2656,0,0,2592,288,224,0,0,0],"FLAG":0,"BASE":18} Koogeek W-UKX {"NAME":"Koogeek W-UKX","GPIO":[0,32,1,1,1,0,0,0,0,320,224,0,0,0],"FLAG":0,"BASE":1} +Kruger & Matz Connect P2 {"NAME":"KM2200","GPIO":[0,0,321,0,0,0,0,0,0,32,0,224,0,0],"FLAG":0,"BASE":18} KULED K63 {"NAME":"KULED K63","GPIO":[0,0,0,0,224,32,0,0,320,0,0,0,0,0],"FLAG":0,"BASE":18} Laduo YX-DE01 {"NAME":"YX-DE01","GPIO":[1,32,1,1,1,1,0,0,1,320,224,1,1,0],"FLAG":0,"BASE":18} LE LampUX Smart Socket {"NAME":"LE LampUX","GPIO":[0,0,0,0,0,320,0,0,224,32,0,0,0,0],"FLAG":0,"BASE":18} @@ -1406,7 +1422,7 @@ MoKo 2 USB {"NAME":"MoKo Plug","GPIO":[0,32,0,0,0,0,0,0,0,321, MoKo YX-WS01A {"NAME":"MoKo Plug","GPIO":[0,32,0,0,0,0,0,0,0,321,224,0,0,0],"FLAG":0,"BASE":18} Muvit iO MIOSMP008 {"NAME":"MIOSMP008","GPIO":[0,0,0,32,2656,2624,0,0,224,2720,320,0,0,0],"FLAG":0,"BASE":1} MXQ LED Nightlight {"NAME":"MXQ SP06","GPIO":[0,0,0,0,288,192,0,0,225,321,224,0,0,0],"FLAG":0,"BASE":18} -Nanxin NX-SM400 {"NAME":"NX-SM400","GPIO":[0,0,0,32,2720,2656,0,0,2592,288,224,0,0,0],"FLAG":0,"BASE":18} +Nanxin {"NAME":"NX-SM400","GPIO":[0,0,0,32,2720,2656,0,0,2592,288,224,0,0,0],"FLAG":0,"BASE":18} Naxa NSH-1000 {"NAME":"Naxa NSH-1000","GPIO":[0,0,0,0,32,0,0,0,321,320,224,0,0,0],"FLAG":0,"BASE":18} Nedis P110 {"NAME":"Nedis WIFIP110","GPIO":[32,0,0,0,2720,2656,0,0,2624,320,224,0,0,0],"FLAG":0,"BASE":49} Nedis P120 {"NAME":"WIFIP120EWT","GPIO":[32,0,0,0,2688,2656,0,0,2624,320,224,0,0,0],"FLAG":0,"BASE":49} @@ -1507,7 +1523,7 @@ SM-PW701K {"NAME":"SM-PW701K","GPIO":[0,0,0,0,288,0,0,0,224,3 Smaho {"NAME":"SMAHO WiFi P.","GPIO":[32,0,0,0,2720,2656,0,0,2624,320,224,0,0,0],"FLAG":0,"BASE":18} Smart 15A {"NAME":"JH-G09U","GPIO":[0,0,0,0,224,32,0,0,288,0,0,0,0,0],"FLAG":0,"BASE":18} Smart Plug {"NAME":"SO08WP","GPIO":[1,1,1,32,2688,2656,1,1,2624,288,224,1,1,1],"FLAG":0,"BASE":18} -SmartDGM PP-W162 {"NAME":"SmartDGM Plug","GPIO":[0,0,0,32,2720,2656,0,0,2624,288,224,0,0,0],"FLAG":0,"BASE":18} +SmartDGM PP-W162 {"NAME":"SmartDGM Plug","GPIO":[0,0,0,32,2720,2656,0,0,2624,320,224,0,0,0],"FLAG":0,"BASE":18} SmartGrade {"NAME":"SmartGrade AC","GPIO":[32,0,0,0,2688,2656,0,0,2624,320,224,0,0,0],"FLAG":0,"BASE":49} SmartVU Home {"NAME":"SHWSP1","GPIO":[0,0,0,32,2720,2656,0,0,2624,320,224,0,0,0],"FLAG":0,"BASE":52} Smitch 16A {"NAME":"Smitch SP0602","GPIO":[321,1,320,1,0,2720,0,0,2624,32,2656,224,0,0],"FLAG":0,"BASE":45} @@ -1797,6 +1813,8 @@ ZLD64-EU-W {"NAME":"ZLD64-EU-W","GPIO":[0,320,0,32,225,224,0,0 ## Presence Sensor ``` +Everything Presence Lite {"NAME":"Everything Presence Lite","GPIO":[0,0,0,0,0,0,0,0,0,0,544,0,3232,3200,160,161,0,640,608,0,0,1,1,1,0,0,0,0,1,0,0,0,0,0,0,0],"FLAG":0,"BASE":1} +Everything Presence One {"NAME":"Everything Presence One","GPIO":[0,0,0,0,0,0,0,0,0,3200,3232,160,0,1,1,1,0,0,1,1,0,608,640,0,0,0,0,0,544,161,0,0,0,0,0,0],"FLAG":0,"BASE":1,"CMND":"SO114 1 | SwitchMode1 1 | SwitchMode2 1"} Tuya mmWave {"NAME":"ZY-M100","GPIO":[1,1,1,1,1,1,0,0,1,1,1,1,1,0],"FLAG":0,"BASE":54,"CMND":"SO97 1 | TuyaMCU 99,1 | TuyaMCU 75,104"} ``` @@ -1819,7 +1837,6 @@ muvit IO miobulb001 600lm {"NAME":"miobulb001","GPIO":[0,0,0,0,419,0,0,0,417, Oobest ZN93028 11W {"NAME":"RGB Bulb 11W","GPIO":[0,0,0,0,419,0,0,0,417,418,416,0,0,4704],"FLAG":0,"BASE":18} SuperBrightLEDs 3W 70lm 12V {"NAME":"G4-RGB3W","GPIO":[0,0,0,0,417,0,0,0,418,0,416,0,0,0],"FLAG":0,"BASE":18} V-Tac P45 4.5W 300lm {"NAME":"V-TAC VT-5154","GPIO":[0,0,0,0,0,0,0,0,4065,0,4032,0,0,0],"FLAG":0,"BASE":18} -Wipro Garnet NS7001 480lm {"NAME":"WiproSmartBulb","GPIO":[0,0,0,0,416,419,0,0,417,420,418,0,0,0],"FLAG":0,"BASE":18} ``` ## RGBCCT @@ -2006,6 +2023,7 @@ WdtPro 8W 800lm {"NAME":"WdtPro","GPIO":[0,0,0,0,419,420,0,0,417,41 Wipro Garnet 9W 810lm {"NAME":"Wipro","GPIO":[0,0,0,0,416,419,0,0,417,420,418,0,0,0],"FLAG":0,"BASE":18} WiZ BR30 13.8W 750lm {"NAME":"WiZ RGBCCT PAR30","GPIO":[0,0,0,0,419,0,0,0,417,420,418,416,0,0],"FLAG":0,"BASE":48} Wiz Colors A19 8.8w 800lm {"NAME":"Wiz Colors RGBCCT","GPIO":[0,0,0,0,419,0,0,0,416,420,418,417,0,0],"FLAG":0,"BASE":48} +Wiz Colors A21 14.5w 1600lm {"NAME":"WIZ-922-65","GPIO":[1,1,420,1,419,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0,416,417,418,0,0,0,0,1,1,1,1,1,0,0,1],"FLAG":0,"BASE":1} WiZ PAR16 4.9W 400lm {"NAME":"WIZ GU10","GPIO":[0,0,420,0,419,416,0,0,0,0,0,0,0,0,417,418,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"FLAG":0,"BASE":1} Xtricity A19 10W 800lm {"NAME":"XTRICITY A19 10W 800LM RGBCCT BULB","GPIO":[0,0,0,0,416,419,0,0,417,452,418,2304,2272,0],"FLAG":0,"BASE":48} Zemismart 5W 480lm {"NAME":"Zemismart 5W","GPIO":[0,0,0,0,416,419,0,0,417,420,418,0,0,0],"FLAG":0,"BASE":18} @@ -2154,6 +2172,7 @@ MoKo GU10 {"NAME":"MoKo GU10","GPIO":[1,1,1,1,418,1,1,1,417,4 MoKo JL81 5W 400lm {"NAME":"MoKo E14","GPIO":[0,0,0,0,0,0,0,0,3008,0,3040,0,0,0],"FLAG":0,"BASE":27} MOKO YX-L01C-E14 A60 810lm {"NAME":"MOKO","GPIO":[32,0,0,0,3008,3040,0,0,0,0,0,0,0,0],"FLAG":0,"BASE":27} Nedis 4.5W 380lm {"NAME":"Nedis RGBW","GPIO":[0,0,0,0,2912,416,0,0,417,2976,2944,0,0,0],"FLAG":0,"BASE":18} +Nedis 6W 450lm {"NAME":"WIFILC10WTB22","GPIO":[0,0,0,0,416,419,0,0,417,0,418,0,0,0],"FLAG":0,"BASE":18} Nedis 6W 470lm {"NAME":"nedis Bulb","GPIO":[0,0,0,0,416,419,0,0,417,0,418,0,0,0],"FLAG":0,"BASE":18} Nedis A60 800lm {"NAME":"Nedis RGBW","GPIO":[0,0,0,0,2912,416,0,0,0,2976,2944,0,0,4704],"FLAG":0,"BASE":18} Nedis C10 350lm {"NAME":"Nedis WIFILC10","GPIO":[0,0,0,0,418,416,0,0,419,417,420,0,0,4704],"FLAG":0,"BASE":18} @@ -2200,6 +2219,7 @@ V-TAC A95 18W 1350lm {"NAME":"V-TAC VT-5021","GPIO":[0,0,0,0,416,420,0,0 V-TAC G45 4.5W 300lm {"NAME":"V-TAC VT-5124","GPIO":[0,0,0,0,0,0,0,0,4065,0,4032,0,0,0],"FLAG":0,"BASE":18} Vivitar 1100lm {"NAME":"Vivitar (Tuya) RGBW Lamp","GPIO":[0,0,0,0,416,419,0,0,417,0,418,0,0,0],"FLAG":0,"BASE":18} Wallfire WF-05 {"NAME":"Wallfire E27","GPIO":[32,0,0,0,0,0,0,0,0,3008,0,3040,0,0],"FLAG":0,"BASE":27} +Wipro Garnet NS7001 480lm {"NAME":"Wipro Garnet NS7001","GPIO":[0,0,0,0,416,419,0,0,417,0,418,0,0,0],"FLAG":0,"BASE":18} Wixann C37 5W 450lm {"NAME":"WIXANNE12","GPIO":[0,0,0,0,416,419,0,0,417,420,418,0,0,0],"FLAG":0,"BASE":18} Woopower 460lm {"NAME":"Woopower E14","GPIO":[0,0,0,0,0,0,0,0,0,3008,0,3040,0,0],"FLAG":0,"BASE":27} WOOX 4W 350lm {"NAME":"WOOX R4553","GPIO":[0,0,0,0,416,419,0,0,417,0,418,0,0,0],"FLAG":0,"BASE":18} @@ -2341,8 +2361,10 @@ T13 100W PD3.0 Portable {"NAME":"PTS200","GPIO":[0,0,33,0,34,0,0,0,6210,0,3 ``` 3 Way Smart Light {"NAME":"KS-602F","GPIO":[1,1,1,1,1,1,0,0,1,1,1,1,1,0],"FLAG":0,"BASE":54} 3A Smart Home {"NAME":"3A Smart Home ","GPIO":[544,0,290,33,225,34,0,0,32,224,289,226,288,0],"FLAG":0,"BASE":18} +4 Gang Light Touch {"NAME":"03O","GPIO":[32,0,0,0,226,225,33,34,224,260,35,227,0,0],"FLAG":0,"BASE":7} AGL 2 Gang {"NAME":"AGL WiFi 02","GPIO":[0,0,544,0,0,33,0,0,225,224,0,0,32,0],"FLAG":0,"BASE":18} AGL 3 Gang {"NAME":"AGL WiFi 03","GPIO":[0,0,544,0,34,33,0,0,225,224,226,0,32,0],"FLAG":0,"BASE":18} +AmmToo 433Mhz 2 Gang US Light {"NAME":"Dual band touch switch","GPIO":[0,0,0,32,33,0,0,0,0,224,225,0,0,0],"FLAG":0,"BASE":18} Aoycocr SW1 {"NAME":"Aoycocr SW1","GPIO":[576,1,321,1,1,1,1,1,320,32,1,224,1,1],"FLAG":0,"BASE":18} APPIO 1 Gang Switch {"NAME":"Appio-9608","GPIO":[0,0,0,0,0,32,0,0,0,0,0,224,288,0],"FLAG":0,"BASE":18} Appio 3 Gang Touch {"NAME":"Appio-9611","GPIO":[0,0,0,0,224,33,0,0,34,226,32,225,288,0],"FLAG":0,"BASE":18} @@ -2406,6 +2428,7 @@ Eachen 3CH {"NAME":"Eachen Smart Switch 3CH","GPIO":[34,0,0,0, Eachen CD303 3 Gang {"NAME":"ID Components","GPIO":[544,289,0,162,224,161,0,0,160,225,290,226,288,1],"FLAG":0,"BASE":18} Eachen SWT-2Gang {"NAME":"ID Components","GPIO":[544,1,1,1,1,161,1,1,160,224,289,225,288,1],"FLAG":0,"BASE":18} Earda 3-Way {"NAME":"ESW-1WAA-US","GPIO":[160,0,0,0,320,0,0,0,0,224,0,0,0,0],"FLAG":0,"BASE":18} +EJLINK RF433 2 Gang {"NAME":"EJLINK EK02","GPIO":[32,0,0,0,0,225,33,0,224,544,0,0,0,0],"FLAG":0,"BASE":18} Enjowi WF-SK301 {"NAME":"Tuya 3 Channel","GPIO":[0,0,0,0,226,33,0,0,32,224,34,225,544,0],"FLAG":0,"BASE":18} Esooli 1 Gang {"NAME":"Esooli 1G","GPIO":[0,288,0,0,0,32,0,0,224,0,0,0,0,0],"FLAG":0,"BASE":1} Esooli 2 Gang 1 Way {"NAME":"Esooli 2 gang","GPIO":[0,288,0,32,33,0,0,0,0,224,225,0,0,0],"FLAG":0,"BASE":1} @@ -2441,6 +2464,7 @@ Jinvoo SM-SW101-2 {"NAME":"SM-SW101-2","GPIO":[288,0,0,33,225,0,0,0,3 Jinvoo SM-SW101-3 {"NAME":"Jinvoo Wall Sw","GPIO":[288,0,0,33,225,34,0,0,32,224,0,226,0,4704],"FLAG":0,"BASE":18} KaBuM! 15A 3 Gang Touch {"NAME":"Kabum Switch 3","GPIO":[0,0,0,0,226,33,0,0,32,224,34,225,576,0],"FLAG":0,"BASE":18} Kauf RGB Wall {"NAME":"Kauf SRF10","GPIO":[448,1,450,1,450,449,1,1,449,32,448,224,1,1],"FLAG":0,"BASE":18} +Ketotek {"NAME":"KETOTEK KTSS1NU","GPIO":[0,0,0,0,0,32,0,0,224,0,0,0,0,0],"FLAG":0,"BASE":18} KingArt 1 Gang {"NAME":"KING-L1","GPIO":[0,0,0,0,0,0,0,0,224,32,0,0,0,0],"FLAG":0,"BASE":18} KingArt 3 Gang {"NAME":"KING-L3","GPIO":[0,0,0,0,226,225,0,0,224,164,165,0,167,0],"FLAG":0,"BASE":18} KMC 70008 {"NAME":"KMC 70008","GPIO":[32,1,1,0,0,1,0,0,0,320,224,1,1,0],"FLAG":0,"BASE":18} @@ -2603,6 +2627,11 @@ Sonoff TX T4 EU No Neutral 1 Gang {"NAME":"Sonoff T4 1CH","GPIO":[32,1,1,1,0,0, Sonoff TX Ultimate 1 Gang {"NAME":"TX Ultimate 1","GPIO":[0,0,7808,0,7840,3872,0,0,0,1376,0,7776,0,0,224,3232,0,480,3200,0,0,0,3840,0,0,0,0,0,0,0,0,0,0,0,0,0],"FLAG":0,"BASE":1,"CMND":"Backlog Pixels 28"} Sonoff TX Ultimate 2 Gang {"NAME":"TX Ultimate 2","GPIO":[0,0,7808,0,7840,3872,0,0,0,1376,0,7776,0,225,224,3232,0,480,3200,0,0,0,3840,0,0,0,0,0,0,0,0,0,0,0,0,0],"FLAG":0,"BASE":1,"CMND":"Backlog Pixels 28"} Sonoff TX Ultimate 3 Gang {"NAME":"TX Ultimate 3","GPIO":[0,0,7808,0,7840,3872,0,0,0,1376,0,7776,0,225,224,3232,0,480,3200,0,0,0,3840,226,0,0,0,0,0,0,0,0,0,0,0,0],"FLAG":0,"BASE":1,"CMND":"Backlog Pixels 28"} +Sonoff TX Ultimate 4 Gang {"NAME":"TX Ultimate 1","GPIO":[0,0,7808,0,7840,3872,0,0,0,1376,0,7776,0,0,224,3232,0,480,3200,0,0,0,3840,0,0,0,0,0,0,0,0,0,0,0,0,0],"FLAG":0,"BASE":1,"CMND":"Backlog Pixels 28"} +Sonoff TX Ultimate US 1 Gang {"NAME":"TX Ultimate 1","GPIO":[0,0,7808,0,7840,3872,0,0,0,1376,0,7776,0,0,224,3232,0,480,3200,0,0,0,3840,0,0,0,0,0,0,0,0,0,0,0,0,0],"FLAG":0,"BASE":1,"CMND":"Backlog Pixels 28"} +Sonoff TX Ultimate US 2 Gang {"NAME":"TX Ultimate 2","GPIO":[0,0,7808,0,7840,3872,0,0,0,1376,0,7776,0,225,224,3232,0,480,3200,0,0,0,3840,0,0,0,0,0,0,0,0,0,0,0,0,0],"FLAG":0,"BASE":1,"CMND":"Backlog Pixels 28"} +Sonoff TX Ultimate US 3 Gang {"NAME":"TX Ultimate 3","GPIO":[0,0,7808,0,7840,3872,0,0,0,1376,0,7776,0,225,224,3232,0,480,3200,0,0,0,3840,226,0,0,0,0,0,0,0,0,0,0,0,0],"FLAG":0,"BASE":1,"CMND":"Backlog Pixels 28"} +Sonoff TX Ultimate US 4 Gang {"NAME":"TX Ultimate 1","GPIO":[0,0,7808,0,7840,3872,0,0,0,1376,0,7776,0,0,224,3232,0,480,3200,0,0,0,3840,0,0,0,0,0,0,0,0,0,0,0,0,0],"FLAG":0,"BASE":1,"CMND":"Backlog Pixels 28"} SPC Hera {"NAME":"SPC HERA","GPIO":[544,0,0,32,224,0,0,0,0,0,288,0,0,0],"FLAG":0,"BASE":18} SRL 2 Gang {"NAME":"SRL 4WW Switch","GPIO":[0,0,0,0,0,33,0,0,32,224,0,225,0,0],"FLAG":0,"BASE":18} SRL 4 Gang {"NAME":"SRL 4WW Switch","GPIO":[0,0,0,34,226,33,0,0,32,224,227,225,35,0],"FLAG":0,"BASE":18} @@ -2632,6 +2661,8 @@ TreatLife 3-Way {"NAME":"Treatlife 3-Way","GPIO":[0,0,0,0,224,576,0 TreatLife Single Pole ON/OFF {"NAME":"Treatlife SS02","GPIO":[0,0,0,0,288,576,0,0,224,32,0,0,0,0],"FLAG":0,"BASE":18} Tuya 20A {"NAME":"DS-161","GPIO":[544,0,0,32,0,0,0,0,0,224,288,0,0,0],"FLAG":0,"BASE":1} Tuya 3 Gang {"NAME":"KING-Tuya-key","GPIO":[0,0,0,0,226,225,0,0,224,32,34,0,33,0],"FLAG":0,"BASE":18} +Tuya T1 2 Gang No Neutral {"NAME":"Tuya T1 Wifi 2 Gang No Neutral Switch","GPIO":[32,0,0,0,0,225,33,0,224,544,0,0,0,0],"FLAG":0,"BASE":18} +Tuya T1 3 Gang No Neutral {"NAME":"Tuya T1 Wifi 3 Gang No Neutral Switch","GPIO":[32,0,0,0,226,225,33,34,224,544,0,0,0,0],"FLAG":0,"BASE":18} TY-US-L1-W {"NAME":"TY-US-L1-W","GPIO":[0,0,0,0,0,32,0,0,0,224,0,0,576,0],"FLAG":0,"BASE":18} TY-US-L3-W {"NAME":"TY-US-L3-W","GPIO":[0,0,0,0,224,33,0,0,34,226,32,225,576,1],"FLAG":0,"BASE":18} Useelink 1 Gang {"NAME":"USEELINK-SW-1G","GPIO":[288,0,0,0,0,0,0,0,32,224,0,0,0,0],"FLAG":0,"BASE":18} @@ -2718,6 +2749,7 @@ Nous 1 Channel Touch {"NAME":"NOUS L1T","GPIO":[544,0,1,32,0,0,0,0,0,224 Nous 1/2 Channel {"NAME":"NOUS L13T Smart Switch Module","GPIO":[1,161,1,160,225,224,1,1,544,1,32,1,1,1],"FLAG":0,"BASE":18} Nous 2 Channel Touch {"NAME":"NOUS L2T","GPIO":[544,289,1,32,225,33,0,0,0,224,288,0,0,0],"FLAG":0,"BASE":1} Nova Digital Basic 1 MS101 {"NAME":"NovaDigBasic1","GPIO":[0,1,0,1,320,0,0,0,224,32,0,0,0,0],"FLAG":0,"BASE":18} +ONiOFF Smart Switch {"NAME":"ONOFF SmartSwitch","GPIO":[1,320,1,1,1,32,0,0,224,1,1,0,0,0],"FLAG":0,"BASE":1} PPA Contatto Wi-Fi {"NAME":"PPA Contatto","GPIO":[0,0,32,0,224,162,0,0,288,225,0,0,0,0],"FLAG":0,"BASE":18} PS-1604 16A {"NAME":"PS-1604 16A","GPIO":[32,1,1,1,1,0,0,0,224,320,1,0,0,0],"FLAG":0,"BASE":1} QS-WIFI-S03 {"NAME":"QS-WIFI-S03","GPIO":[32,1,1,1,1,0,0,0,192,224,0,0,0,0],"FLAG":0,"BASE":1} diff --git a/boards/esp32-fix.json b/boards/esp32-fix.json index a2a9bed87..8287019b8 100644 --- a/boards/esp32-fix.json +++ b/boards/esp32-fix.json @@ -31,7 +31,7 @@ "flash_extra_images": [ [ "0x10000", - "variants/tasmota/tasmota32-safeboot.bin" + "tasmota32-safeboot.bin" ] ] }, diff --git a/boards/esp32.json b/boards/esp32.json index 1e476569c..4dd2a3602 100644 --- a/boards/esp32.json +++ b/boards/esp32.json @@ -31,7 +31,7 @@ "flash_extra_images": [ [ "0x10000", - "variants/tasmota/tasmota32-safeboot.bin" + "tasmota32-safeboot.bin" ] ] }, diff --git a/boards/esp32_solo1.json b/boards/esp32_solo1.json index 3bb85fe05..f3d9913b0 100644 --- a/boards/esp32_solo1.json +++ b/boards/esp32_solo1.json @@ -31,7 +31,7 @@ "flash_extra_images": [ [ "0x10000", - "variants/tasmota/tasmota32solo1-safeboot.bin" + "tasmota32solo1-safeboot.bin" ] ] }, diff --git a/boards/esp32c2.json b/boards/esp32c2.json index 563a3357c..cabab4cb4 100644 --- a/boards/esp32c2.json +++ b/boards/esp32c2.json @@ -7,7 +7,7 @@ "extra_flags": "-DESP32_4M -DESP32C2", "f_cpu": "120000000L", "f_flash": "60000000L", - "flash_mode": "dio", + "flash_mode": "qio", "mcu": "esp32c2", "variant": "esp32c2", "partitions": "partitions/esp32_partition_app2880k_fs320k.csv" @@ -23,13 +23,13 @@ "arduino", "espidf" ], - "name": "Espressif Generic ESP32-C2 = 4M Flash", + "name": "Espressif Generic ESP32-C2 = 4M Flash, Tasmota 2880k Code/OTA, 320k FS", "upload": { "arduino": { "flash_extra_images": [ [ "0x10000", - "variants/tasmota/tasmota32c2-safeboot.bin" + "tasmota32c2-safeboot.bin" ] ] }, diff --git a/boards/esp32c2_2M.json b/boards/esp32c2_2M.json index 36f16ffe3..969ff519c 100644 --- a/boards/esp32c2_2M.json +++ b/boards/esp32c2_2M.json @@ -7,7 +7,7 @@ "extra_flags": "-DESP32_2M -DESP32C2", "f_cpu": "120000000L", "f_flash": "60000000L", - "flash_mode": "dio", + "flash_mode": "qio", "mcu": "esp32c2", "variant": "esp32c2", "partitions": "partitions/esp32_partition_app1245k_fs64k.csv" @@ -29,7 +29,7 @@ "flash_extra_images": [ [ "0x10000", - "variants/tasmota/tasmota32c2-safeboot.bin" + "tasmota32c2-safeboot.bin" ] ] }, diff --git a/boards/esp32c3.json b/boards/esp32c3.json index b7f74c3e5..2bb2f7660 100644 --- a/boards/esp32c3.json +++ b/boards/esp32c3.json @@ -29,7 +29,7 @@ "flash_extra_images": [ [ "0x10000", - "variants/tasmota/tasmota32c3-safeboot.bin" + "tasmota32c3-safeboot.bin" ] ] }, diff --git a/boards/esp32c3cdc.json b/boards/esp32c3cdc.json index 3d280a73b..8e46134b3 100644 --- a/boards/esp32c3cdc.json +++ b/boards/esp32c3cdc.json @@ -17,6 +17,10 @@ "bluetooth" ], "debug": { + "default_tool": "esp-builtin", + "onboard_tools": [ + "esp-builtin" + ], "openocd_target": "esp32c3.cfg" }, "frameworks": [ @@ -29,7 +33,7 @@ "flash_extra_images": [ [ "0x10000", - "variants/tasmota/tasmota32c3cdc-safeboot.bin" + "tasmota32c3cdc-safeboot.bin" ] ] }, @@ -37,7 +41,6 @@ "maximum_ram_size": 327680, "maximum_size": 4194304, "require_upload_port": true, - "before_reset": "usb_reset", "speed": 460800 }, "url": "https://docs.espressif.com/projects/esp-idf/en/latest/esp32c3/hw-reference/esp32c3/user-guide-devkitm-1.html", diff --git a/boards/esp32c6.json b/boards/esp32c6.json index 57dd9b8f4..76e7620db 100644 --- a/boards/esp32c6.json +++ b/boards/esp32c6.json @@ -29,7 +29,7 @@ "flash_extra_images": [ [ "0x10000", - "variants/tasmota/tasmota32c6-safeboot.bin" + "tasmota32c6-safeboot.bin" ] ] }, diff --git a/boards/esp32c6cdc.json b/boards/esp32c6cdc.json index 17932b7a8..eb8a6ffbb 100644 --- a/boards/esp32c6cdc.json +++ b/boards/esp32c6cdc.json @@ -17,6 +17,10 @@ "bluetooth" ], "debug": { + "default_tool": "esp-builtin", + "onboard_tools": [ + "esp-builtin" + ], "openocd_target": "esp32c6.cfg" }, "frameworks": [ @@ -29,7 +33,7 @@ "flash_extra_images": [ [ "0x10000", - "variants/tasmota/tasmota32c6cdc-safeboot.bin" + "tasmota32c6cdc-safeboot.bin" ] ] }, @@ -37,7 +41,6 @@ "maximum_ram_size": 327680, "maximum_size": 4194304, "require_upload_port": true, - "before_reset": "usb_reset", "speed": 460800 }, "url": "https://docs.espressif.com/projects/espressif-esp-dev-kits/en/latest/esp32c6/esp32-c6-devkitc-1/index.html", diff --git a/boards/esp32s2.json b/boards/esp32s2.json index d13f2a855..aa9efca8b 100644 --- a/boards/esp32s2.json +++ b/boards/esp32s2.json @@ -28,7 +28,7 @@ "flash_extra_images": [ [ "0x10000", - "variants/tasmota/tasmota32s2-safeboot.bin" + "tasmota32s2-safeboot.bin" ] ] }, diff --git a/boards/esp32s2cdc.json b/boards/esp32s2cdc.json index bdd230d5c..f9a302699 100644 --- a/boards/esp32s2cdc.json +++ b/boards/esp32s2cdc.json @@ -28,7 +28,7 @@ "flash_extra_images": [ [ "0x10000", - "variants/tasmota/tasmota32s2cdc-safeboot.bin" + "tasmota32s2cdc-safeboot.bin" ] ] }, @@ -37,7 +37,6 @@ "maximum_size": 4194304, "require_upload_port": true, "before_reset": "usb_reset", - "after_reset": "no_reset", "speed": 460800 }, "url": "https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/hw-reference/esp32s2/user-guide-saola-1-v1.2.html", diff --git a/boards/esp32s3-opi_opi.json b/boards/esp32s3-opi_opi.json new file mode 100644 index 000000000..aa7e5db2a --- /dev/null +++ b/boards/esp32s3-opi_opi.json @@ -0,0 +1,46 @@ +{ + "build": { + "arduino":{ + "ldscript": "esp32s3_out.ld", + "memory_type": "opi_opi" + }, + "core": "esp32", + "extra_flags": "-DBOARD_HAS_PSRAM -DESP32_4M -DESP32S3", + "f_cpu": "240000000L", + "f_flash": "80000000L", + "flash_mode": "dout", + "mcu": "esp32s3", + "variant": "esp32s3", + "partitions": "partitions/esp32_partition_app2880k_fs320k.csv" + }, + "connectivity": [ + "wifi", + "bluetooth", + "ethernet" + ], + "debug": { + "openocd_target": "esp32s3.cfg" + }, + "frameworks": [ + "espidf", + "arduino" + ], + "name": "Espressif Generic ESP32-S3 >= 4M OPI Flash + PSRAM, Tasmota 2880k Code/OTA, 320k FS", + "upload": { + "arduino": { + "flash_extra_images": [ + [ + "0x10000", + "tasmota32s3-safeboot.bin" + ] + ] + }, + "flash_size": "4MB", + "maximum_ram_size": 327680, + "maximum_size": 4194304, + "require_upload_port": true, + "speed": 460800 + }, + "url": "https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/hw-reference/esp32s3/", + "vendor": "Espressif" + } \ No newline at end of file diff --git a/boards/esp32s3-qio_opi.json b/boards/esp32s3-qio_opi.json index 498534e61..4f2a06c47 100644 --- a/boards/esp32s3-qio_opi.json +++ b/boards/esp32s3-qio_opi.json @@ -31,7 +31,7 @@ "flash_extra_images": [ [ "0x10000", - "variants/tasmota/tasmota32s3-safeboot.bin" + "tasmota32s3-safeboot.bin" ] ] }, diff --git a/boards/esp32s3-qio_qspi.json b/boards/esp32s3-qio_qspi.json index cdc6d70ca..42b20a4bc 100644 --- a/boards/esp32s3-qio_qspi.json +++ b/boards/esp32s3-qio_qspi.json @@ -31,7 +31,7 @@ "flash_extra_images": [ [ "0x10000", - "variants/tasmota/tasmota32s3-safeboot.bin" + "tasmota32s3-safeboot.bin" ] ] }, diff --git a/boards/esp32s3cdc-opi_opi.json b/boards/esp32s3cdc-opi_opi.json new file mode 100644 index 000000000..a5992333c --- /dev/null +++ b/boards/esp32s3cdc-opi_opi.json @@ -0,0 +1,56 @@ +{ + "build": { + "arduino":{ + "ldscript": "esp32s3_out.ld", + "memory_type": "opi_opi" + }, + "core": "esp32", + "extra_flags": "-DBOARD_HAS_PSRAM -DARDUINO_USB_MODE=1 -DUSE_USB_CDC_CONSOLE -DESP32_4M -DESP32S3", + "f_cpu": "240000000L", + "f_flash": "80000000L", + "flash_mode": "dout", + "hwids": [ + [ + "0x303A", + "0x1001" + ] + ], + "mcu": "esp32s3", + "variant": "esp32s3", + "partitions": "partitions/esp32_partition_app2880k_fs320k.csv" + }, + "connectivity": [ + "wifi", + "bluetooth", + "ethernet" + ], + "debug": { + "default_tool": "esp-builtin", + "onboard_tools": [ + "esp-builtin" + ], + "openocd_target": "esp32s3.cfg" + }, + "frameworks": [ + "espidf", + "arduino" + ], + "name": "Espressif Generic ESP32-S3 >= 4M OPI Flash + PSRAM, Tasmota 2880k Code/OTA, 320k FS", + "upload": { + "arduino": { + "flash_extra_images": [ + [ + "0x10000", + "tasmota32s3cdc-safeboot.bin" + ] + ] + }, + "flash_size": "4MB", + "maximum_ram_size": 327680, + "maximum_size": 4194304, + "require_upload_port": true, + "speed": 460800 + }, + "url": "https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/hw-reference/esp32s3/", + "vendor": "Espressif" + } \ No newline at end of file diff --git a/boards/esp32s3cdc-qio_opi.json b/boards/esp32s3cdc-qio_opi.json index 67dae1a6e..46ed77fca 100644 --- a/boards/esp32s3cdc-qio_opi.json +++ b/boards/esp32s3cdc-qio_opi.json @@ -41,7 +41,7 @@ "flash_extra_images": [ [ "0x10000", - "variants/tasmota/tasmota32s3cdc-safeboot.bin" + "tasmota32s3cdc-safeboot.bin" ] ] }, @@ -49,7 +49,6 @@ "maximum_ram_size": 327680, "maximum_size": 4194304, "require_upload_port": true, - "before_reset": "usb_reset", "speed": 460800 }, "url": "https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/hw-reference/esp32s3/", diff --git a/boards/esp32s3cdc-qio_qspi.json b/boards/esp32s3cdc-qio_qspi.json index f37a47bb5..7e80448e3 100644 --- a/boards/esp32s3cdc-qio_qspi.json +++ b/boards/esp32s3cdc-qio_qspi.json @@ -41,7 +41,7 @@ "flash_extra_images": [ [ "0x10000", - "variants/tasmota/tasmota32s3cdc-safeboot.bin" + "tasmota32s3cdc-safeboot.bin" ] ] }, @@ -49,7 +49,6 @@ "maximum_ram_size": 327680, "maximum_size": 4194304, "require_upload_port": true, - "before_reset": "usb_reset", "speed": 460800 }, "url": "https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/hw-reference/esp32s3/", diff --git a/include/esp32x_fixes.h b/include/esp32x_fixes.h index 13860477a..fe3e57cd6 100644 --- a/include/esp32x_fixes.h +++ b/include/esp32x_fixes.h @@ -58,38 +58,15 @@ #define FSPI_HOST SPI2_HOST #define HSPI_HOST SPI3_HOST #define VSPI_HOST SPI3_HOST -#ifndef REG_SPI_BASE -#define REG_SPI_BASE(i) (DR_REG_SPI1_BASE + (((i)>1) ? (((i)* 0x1000) + 0x20000) : (((~(i)) & 1)* 0x1000 ))) -// SPI_MOSI_DLEN_REG is not defined anymore in esp32s3, instead use SPI_MS_DLEN_REG +// SPI_MOSI_DLEN_REG is not defined anymore in esp32s3 #define SPI_MOSI_DLEN_REG(x) SPI_MS_DLEN_REG(x) -#endif // REG_SPI_BASE -#elif CONFIG_IDF_TARGET_ESP32C3 +#elif CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 #define SPI_HOST SPI1_HOST #define HSPI_HOST SPI2_HOST -#define VSPI_HOST SPI2_HOST /* No SPI3_host on C3 */ -#if ESP_IDF_VERSION_MAJOR < 5 -// fix a bug in esp-idf 4.4 for esp32c3 -#ifndef REG_SPI_BASE -#define REG_SPI_BASE(i) (DR_REG_SPI1_BASE + (((i)>1) ? (((i)* 0x1000) + 0x20000) : (((~(i)) & 1)* 0x1000 ))) -// SPI_MOSI_DLEN_REG is not defined anymore in esp32c3, instead use SPI_MS_DLEN_REG -#define SPI_MOSI_DLEN_REG(x) SPI_MS_DLEN_REG(x) -#endif // REG_SPI_BASE -#endif //ESP_IDF_VERSION_MAJOR < 5 - -#elif CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C6 -#define SPI_HOST SPI1_HOST -#define HSPI_HOST SPI1_HOST /* No SPI2_host on C2/C6 */ -#define VSPI_HOST SPI1_HOST /* No SPI3_host on C2/C6 */ +#define VSPI_HOST SPI2_HOST /* No SPI3_host on C2/C6 */ #define VSPI SPI -// #if ESP_IDF_VERSION_MAJOR < 5 -// // fix a bug in esp-idf 4.4 for esp32c3 -// #ifndef REG_SPI_BASE -// #define REG_SPI_BASE(i) (DR_REG_SPI1_BASE + (((i)>1) ? (((i)* 0x1000) + 0x20000) : (((~(i)) & 1)* 0x1000 ))) -// // SPI_MOSI_DLEN_REG is not defined anymore in esp32c3, instead use SPI_MS_DLEN_REG +// SPI_MOSI_DLEN_REG is not defined anymore #define SPI_MOSI_DLEN_REG(x) SPI_MS_DLEN_REG(x) -// #endif // REG_SPI_BASE -// #endif //ESP_IDF_VERSION_MAJOR < 5 - #endif // TARGET diff --git a/info/xdrv_57_tasmesh.md b/info/xdrv_57_tasmesh.md index 2da2fac19..ff7c3ee06 100644 --- a/info/xdrv_57_tasmesh.md +++ b/info/xdrv_57_tasmesh.md @@ -8,7 +8,7 @@ Automatic payload encryption is applied using the WiFi-password1 as the key. A m As ACK/NACK messages seem to be not reliable on both ESP-platforms, the method "send-and-pray" is used. -## Working priciple +## Working principle An ESP32 is needed as gateway/broker to connect the nodes (typically an ESP8266) to the WLAN. The ESP32 will receive the MQTT-topic of every node and subscribe to it as a proxy. If a MQTT-message in the form of 'cmnd/node_topic/...' is received, the broker will automatically send this to the referring node via ESP-NOW. diff --git a/lib/lib_basic/IRremoteESP8266/IRremoteESP8266/src/IRrecv.cpp b/lib/lib_basic/IRremoteESP8266/IRremoteESP8266/src/IRrecv.cpp index 764870706..67238bf69 100644 --- a/lib/lib_basic/IRremoteESP8266/IRremoteESP8266/src/IRrecv.cpp +++ b/lib/lib_basic/IRremoteESP8266/IRremoteESP8266/src/IRrecv.cpp @@ -248,8 +248,8 @@ static void USE_IRAM_ATTR gpio_intr() { timer->dev->config.alarm_en = 1; #else // _ESP32_IRRECV_TIMER_HACK #if ( defined(ESP_ARDUINO_VERSION_MAJOR) && (ESP_ARDUINO_VERSION_MAJOR >= 3) ) - timerAlarm(timer, MS_TO_USEC(params.timeout), ONCE, 0); - timerAttachInterrupt(timer, &read_timeout); + timerWrite(timer, 0); + timerStart(timer); #else // ESP_ARDUINO_VERSION_MAJOR >= 3 timerWrite(timer, 0); timerAlarmEnable(timer); @@ -344,7 +344,10 @@ IRrecv::IRrecv(const uint16_t recvpin, const uint16_t bufsize, IRrecv::~IRrecv(void) { disableIRIn(); #if defined(ESP32) - if (timer != NULL) timerEnd(timer); // Cleanup the ESP32 timeout timer. + if (timer != NULL) { + timerEnd(timer); // Cleanup the ESP32 timeout timer. + timer = NULL; + } #endif // ESP32 delete[] params.rawbuf; if (params_save != NULL) { @@ -370,9 +373,9 @@ void IRrecv::enableIRIn(const bool pullup) { // Initialise the ESP32 timer. // 80MHz / 80 = 1 uSec granularity. #if ( defined(ESP_ARDUINO_VERSION_MAJOR) && (ESP_ARDUINO_VERSION_MAJOR >= 3) ) - timer = timerBegin(80); + timer = timerBegin(1000000); // 1 MHz #else // ESP_ARDUINO_VERSION_MAJOR >= 3 - timer = timerBegin(_timer_num, 80, true); + timer = timerBegin(_timer_num, 80, true); // 1 MHz : 80 MHz with divider 80 #endif // ESP_ARDUINO_VERSION_MAJOR >= 3 #ifdef DEBUG if (timer == NULL) { @@ -382,8 +385,8 @@ void IRrecv::enableIRIn(const bool pullup) { #endif // DEBUG assert(timer != NULL); // Check we actually got the timer. #if ( defined(ESP_ARDUINO_VERSION_MAJOR) && (ESP_ARDUINO_VERSION_MAJOR >= 3) ) - timerAlarm(timer, MS_TO_USEC(params.timeout), ONCE, 0); timerAttachInterrupt(timer, &read_timeout); + timerAlarm(timer, MS_TO_USEC(params.timeout), ONCE, 0); #else // ESP_ARDUINO_VERSION_MAJOR >= 3 // Set the timer so it only fires once, and set it's trigger in uSeconds. timerAlarmWrite(timer, MS_TO_USEC(params.timeout), ONCE); @@ -418,6 +421,7 @@ void IRrecv::disableIRIn(void) { #endif // ESP8266 #if defined(ESP32) #if ( defined(ESP_ARDUINO_VERSION_MAJOR) && (ESP_ARDUINO_VERSION_MAJOR >= 3) ) + timerDetachInterrupt(timer); timerEnd(timer); #else // ESP_ARDUINO_VERSION_MAJOR >= 3 timerAlarmDisable(timer); @@ -450,7 +454,7 @@ void IRrecv::resume(void) { params.overflow = false; #if defined(ESP32) #if ( defined(ESP_ARDUINO_VERSION_MAJOR) && (ESP_ARDUINO_VERSION_MAJOR >= 3) ) - timerEnd(timer); + timerStop(timer); #else // ESP_ARDUINO_VERSION_MAJOR >= 3 timerAlarmDisable(timer); #endif // ESP_ARDUINO_VERSION_MAJOR >= 3 diff --git a/lib/lib_basic/NeoPixelBus/src/internal/NeoEsp32RmtMethod_idf5.h b/lib/lib_basic/NeoPixelBus/src/internal/NeoEsp32RmtMethod_idf5.h index 905710254..a86b05330 100644 --- a/lib/lib_basic/NeoPixelBus/src/internal/NeoEsp32RmtMethod_idf5.h +++ b/lib/lib_basic/NeoPixelBus/src/internal/NeoEsp32RmtMethod_idf5.h @@ -513,7 +513,7 @@ public: rmt_tx_channel_config_t config = {}; config.clk_src = RMT_CLK_SRC_DEFAULT; config.gpio_num = static_cast(_pin); - config.mem_block_symbols = 64; // memory block size, 64 * 4 = 256 Bytes + config.mem_block_symbols = 192; // memory block size, 64 * 4 = 256 Bytes config.resolution_hz = RMT_LED_STRIP_RESOLUTION_HZ; // 1 MHz tick resolution, i.e., 1 tick = 1 µs config.trans_queue_depth = 4; // set the number of transactions that can pend in the background config.flags.invert_out = false; // do not invert output signal @@ -529,7 +529,9 @@ public: // ESP_LOGI(TAG, "Enable RMT TX channel"); ret += rmt_enable(_channel.RmtChannelNumber); - AddLog(2,"RMT:initialized with error code: %u on pin: %u",ret, _pin); + // if (ret) { + // AddLog(2,"RMT: initialized with error code: %u on pin: %u",ret, _pin); + // } } void Update(bool maintainBufferConsistency) diff --git a/lib/lib_basic/NeoPixelBus/src/internal/NeoEsp32SpiMethod_idf5.h b/lib/lib_basic/NeoPixelBus/src/internal/NeoEsp32SpiMethod_idf5.h index 826d6ef99..b546ec845 100644 --- a/lib/lib_basic/NeoPixelBus/src/internal/NeoEsp32SpiMethod_idf5.h +++ b/lib/lib_basic/NeoPixelBus/src/internal/NeoEsp32SpiMethod_idf5.h @@ -328,8 +328,9 @@ public: _spi_strip->bytes_per_pixel = bytes_per_pixel; _spi_strip->strip_len = _pixelCount; - - AddLog(2,"SPI:initialized with error code: %u on pin: %u",ret, _pin); + // if (ret) { + // AddLog(2,"SPI: initialized with error code: %u on pin: %u",ret, _pin); + // } return; err: if (_spi_strip) { @@ -341,7 +342,9 @@ public: } free(_spi_strip); } - AddLog(2,"SPI-Error:initialized with error code: %u on pin: %u",ret, _pin); + // if (ret) { + // AddLog(2,"SPI-Error:initialized with error code: %u on pin: %u",ret, _pin); + // } return; } diff --git a/lib/libesp32/berry/berry.exe b/lib/libesp32/berry/berry.exe index 9d9068167..12351863c 100644 Binary files a/lib/libesp32/berry/berry.exe and b/lib/libesp32/berry/berry.exe differ diff --git a/lib/libesp32/berry/default/be_modtab.c b/lib/libesp32/berry/default/be_modtab.c index 121ccff49..0333db5ea 100644 --- a/lib/libesp32/berry/default/be_modtab.c +++ b/lib/libesp32/berry/default/be_modtab.c @@ -206,8 +206,10 @@ be_extern_native_class(AXP192); be_extern_native_class(AXP202); be_extern_native_class(OneWire); be_extern_native_class(Leds_ntv); +be_extern_native_class(Leds_frame); be_extern_native_class(Leds); be_extern_native_class(Leds_animator); +be_extern_native_class(Leds_pulse); be_extern_native_class(AudioGenerator); be_extern_native_class(AudioFileSource); be_extern_native_class(AudioOutputI2S); @@ -276,7 +278,9 @@ BERRY_LOCAL bclass_array be_class_table = { #ifdef USE_WS2812 &be_native_class(Leds_ntv), &be_native_class(Leds), + &be_native_class(Leds_frame), &be_native_class(Leds_animator), + &be_native_class(Leds_pulse), #endif // USE_WS2812 #ifdef USE_ENERGY_SENSOR &be_native_class(energy_struct), diff --git a/lib/libesp32/berry/src/be_bytecode.c b/lib/libesp32/berry/src/be_bytecode.c index 133a96618..a636567fa 100644 --- a/lib/libesp32/berry/src/be_bytecode.c +++ b/lib/libesp32/berry/src/be_bytecode.c @@ -596,6 +596,24 @@ void load_global_info(bvm *vm, void *fp) be_global_release_space(vm); } +bclosure* be_bytecode_load_from_fs(bvm *vm, void *fp) +{ + int version = load_head(fp); + if (version == BYTECODE_VERSION) { + bclosure *cl = be_newclosure(vm, 0); + var_setclosure(vm->top, cl); + be_stackpush(vm); + load_global_info(vm, fp); + load_proto(vm, fp, &cl->proto, -1, version); + be_stackpop(vm, 2); /* pop the closure and list */ + be_fclose(fp); + return cl; + } + bytecode_error(vm, be_pushfstring(vm, + "invalid bytecode version.")); + return NULL; +} + bclosure* be_bytecode_load(bvm *vm, const char *filename) { void *fp = be_fopen(filename, "rb"); @@ -603,22 +621,9 @@ bclosure* be_bytecode_load(bvm *vm, const char *filename) bytecode_error(vm, be_pushfstring(vm, "can not open file '%s'.", filename)); } else { - int version = load_head(fp); - if (version == BYTECODE_VERSION) { - bclosure *cl = be_newclosure(vm, 0); - var_setclosure(vm->top, cl); - be_stackpush(vm); - load_global_info(vm, fp); - load_proto(vm, fp, &cl->proto, -1, version); - be_stackpop(vm, 2); /* pop the closure and list */ - be_fclose(fp); - return cl; - } - bytecode_error(vm, be_pushfstring(vm, - "invalid bytecode version '%s'.", filename)); + return be_bytecode_load_from_fs(vm, fp); } - bytecode_error(vm, be_pushfstring(vm, - "invalid bytecode file '%s'.", filename)); return NULL; } + #endif /* BE_USE_BYTECODE_LOADER */ diff --git a/lib/libesp32/berry/src/be_bytecode.h b/lib/libesp32/berry/src/be_bytecode.h index 08affe1de..61223952c 100644 --- a/lib/libesp32/berry/src/be_bytecode.h +++ b/lib/libesp32/berry/src/be_bytecode.h @@ -12,6 +12,7 @@ void be_bytecode_save(bvm *vm, const char *filename, bproto *proto); bclosure* be_bytecode_load(bvm *vm, const char *filename); +bclosure* be_bytecode_load_from_fs(bvm *vm, void *fp); bbool be_bytecode_check(const char *path); #endif diff --git a/lib/libesp32/berry/src/be_byteslib.c b/lib/libesp32/berry/src/be_byteslib.c index 0a5c1747e..c26a45df2 100644 --- a/lib/libesp32/berry/src/be_byteslib.c +++ b/lib/libesp32/berry/src/be_byteslib.c @@ -364,7 +364,7 @@ static uint32_t buf_get3_le(buf_impl* attr, size_t offset) return 0; } -static uint16_t buf_get3_be(buf_impl* attr, size_t offset) +static uint32_t buf_get3_be(buf_impl* attr, size_t offset) { if ((int32_t)offset + 2 < attr->len) { return attr->bufptr[offset+2] | (attr->bufptr[offset+1] << 8) | (attr->bufptr[offset] << 16); diff --git a/lib/libesp32/berry/src/be_code.c b/lib/libesp32/berry/src/be_code.c index c6aa6e815..7a1b2bd00 100644 --- a/lib/libesp32/berry/src/be_code.c +++ b/lib/libesp32/berry/src/be_code.c @@ -478,11 +478,7 @@ static int exp2reg(bfuncinfo *finfo, bexpdesc *e, int dst) reg = e->v.idx; } else { /* otherwise, we allocate a new register or use the target provided */ - if (dst < 0) { - reg = be_code_allocregs(finfo, 1); - } else { - reg = dst; - } + reg = (dst < 0) ? be_code_allocregs(finfo, 1) : dst; } be_code_conjump(finfo, &e->t, jpt); pcf = code_bool(finfo, reg, 0, 1); @@ -690,16 +686,20 @@ static void setsfxvar(bfuncinfo *finfo, bopcode op, bexpdesc *e1, int src) /* Assign expr e2 to e1 */ /* e1 must be in a register and have a valid idx */ -/* if `keep_reg` is true, do not release registre */ +/* if `keep_reg` is true, do not release register */ /* return 1 if assignment was possible, 0 if type is not compatible */ int be_code_setvar(bfuncinfo *finfo, bexpdesc *e1, bexpdesc *e2, bbool keep_reg) { + /* free_e2 indicates special case where ETINDEX or ETMEMBER need to be freed if top of registers */ + bbool free_e2 = (e2->type == ETINDEX || e2->type == ETMEMBER) && (e2->v.ss.idx != e1->v.idx) && (e2->v.ss.idx == finfo->freereg - 1); int src = exp2reg(finfo, e2, e1->type == ETLOCAL ? e1->v.idx : -1); /* Convert e2 to kreg */ /* If e1 is a local variable, use the register */ if (!keep_reg && (e1->type != ETLOCAL || e1->v.idx != src)) { free_expreg(finfo, e2); /* free source (checks only ETREG) */ /* TODO e2 is at top */ + } else if (!keep_reg && free_e2) { + be_code_freeregs(finfo, 1); } switch (e1->type) { case ETLOCAL: /* It can't be ETREG. */ diff --git a/lib/libesp32/berry/src/be_debuglib.c b/lib/libesp32/berry/src/be_debuglib.c index 502935b6c..fac4bfb53 100644 --- a/lib/libesp32/berry/src/be_debuglib.c +++ b/lib/libesp32/berry/src/be_debuglib.c @@ -84,6 +84,19 @@ static int m_codedump(bvm *vm) be_return_nil(vm); } +static int m_gcdebug(bvm *vm) { + int argc = be_top(vm); + if (argc >= 1 && be_isbool(vm, 1)) { + if (be_tobool(vm, 1)) { + comp_set_gc_debug(vm); + } else { + comp_clear_gc_debug(vm); + } + } + be_pushbool(vm, comp_is_gc_debug(vm)); + be_return(vm); +} + static int m_traceback(bvm *vm) { be_tracestack(vm); @@ -223,6 +236,7 @@ be_native_module_attr_table(debug) { be_native_module_function("varname", m_varname), be_native_module_function("upvname", m_upvname) #endif + be_native_module_function("gcdebug", m_gcdebug) }; be_define_native_module(debug, NULL); @@ -242,6 +256,8 @@ module debug (scope: global, depend: BE_USE_DEBUG_MODULE) { allocs, func(m_allocs) frees, func(m_frees) reallocs, func(m_reallocs) + // GC debug mode + gcdebug, func(m_gcdebug) } @const_object_info_end */ #include "../generate/be_fixed_debug.h" diff --git a/lib/libesp32/berry/src/be_gc.c b/lib/libesp32/berry/src/be_gc.c index e66afa56d..ee5e1a062 100644 --- a/lib/libesp32/berry/src/be_gc.c +++ b/lib/libesp32/berry/src/be_gc.c @@ -545,15 +545,9 @@ static void reset_fixedlist(bvm *vm) void be_gc_auto(bvm *vm) { -#if BE_USE_DEBUG_GC - if (vm->gc.status & GC_PAUSE) { /* force gc each time it's possible */ + if (vm->gc.status & GC_PAUSE && (BE_USE_DEBUG_GC || vm->gc.usage > vm->gc.threshold || comp_is_gc_debug(vm))) { be_gc_collect(vm); } -#else - if (vm->gc.status & GC_PAUSE && vm->gc.usage > vm->gc.threshold) { - be_gc_collect(vm); - } -#endif } size_t be_gc_memcount(bvm *vm) diff --git a/lib/libesp32/berry/src/be_lexer.c b/lib/libesp32/berry/src/be_lexer.c index 8a038a507..90031d3f6 100644 --- a/lib/libesp32/berry/src/be_lexer.c +++ b/lib/libesp32/berry/src/be_lexer.c @@ -260,6 +260,7 @@ static void skip_comment(blexer *lexer) { next(lexer); /* skip '#' */ if (lgetc(lexer) == '-') { /* mult-line comment */ + int lno = lexer->linenumber; int mark, c = 'x'; /* skip first '-' (#- ... -#) */ do { mark = c == '-'; @@ -269,6 +270,9 @@ static void skip_comment(blexer *lexer) } c = next(lexer); } while (!(mark && c == '#') && c != EOS); + if (c == EOS) { + be_lexerror(lexer, be_pushfstring(lexer->vm, "unterminated comment block started in line %d", lno)); + } next(lexer); /* skip '#' */ } else { /* line comment */ while (!is_newline(lgetc(lexer)) && lgetc(lexer)) { diff --git a/lib/libesp32/berry/src/be_mem.c b/lib/libesp32/berry/src/be_mem.c index 36e30866a..24b75ec18 100644 --- a/lib/libesp32/berry/src/be_mem.c +++ b/lib/libesp32/berry/src/be_mem.c @@ -73,9 +73,9 @@ BERRY_API void* be_realloc(bvm *vm, void *ptr, size_t old_size, size_t new_size) vm->counter_mem_free++; #endif if (ptr == NULL) { return NULL; } /* safeguard */ -#if BE_USE_DEBUG_GC - memset(ptr, 0xFF, old_size); /* fill the structure with invalid pointers */ -#endif + if (BE_USE_DEBUG_GC || comp_is_gc_debug(vm)) { + memset(ptr, 0xFF, old_size); /* fill the structure with invalid pointers */ + } free_from_pool(vm, ptr, old_size); break; /* early exit */ } diff --git a/lib/libesp32/berry/src/be_string.c b/lib/libesp32/berry/src/be_string.c index 9fe32c04a..c6cb093c2 100644 --- a/lib/libesp32/berry/src/be_string.c +++ b/lib/libesp32/berry/src/be_string.c @@ -268,13 +268,13 @@ void be_gcstrtab(bvm *vm) } } } -#if BE_USE_DEBUG_GC == 0 - if (tab->count < size >> 2 && size > 8) { - resize(vm, size >> 1); + if (BE_USE_DEBUG_GC || comp_is_gc_debug(vm)) { + resize(vm, tab->count + 4); + } else { + if (tab->count < size >> 2 && size > 8) { + resize(vm, size >> 1); + } } -#else - resize(vm, tab->count + 4); -#endif } uint32_t be_strhash(const bstring *s) diff --git a/lib/libesp32/berry/src/be_vm.c b/lib/libesp32/berry/src/be_vm.c index b234308d0..a9de9675f 100644 --- a/lib/libesp32/berry/src/be_vm.c +++ b/lib/libesp32/berry/src/be_vm.c @@ -671,8 +671,17 @@ newframe: /* a new call frame */ if (var_isint(a) && var_isint(b)) { var_setint(dst, ibinop(-, a, b)); } else if (var_isnumber(a) && var_isnumber(b)) { +#if CONFIG_IDF_TARGET_ESP32 /* when running on ESP32 in IRAM, there is a bug in early chip revision */ + union bvaldata x, y; // TASMOTA workaround for ESP32 rev0 bug + x.i = a->v.i; + if (var_isint(a)) { x.r = (breal) x.i; } + y.i = b->v.i; + if (var_isint(b)) { y.r = (breal) y.i; } + var_setreal(dst, x.r - y.r); +#else // CONFIG_IDF_TARGET_ESP32 breal x = var2real(a), y = var2real(b); var_setreal(dst, x - y); +#endif // CONFIG_IDF_TARGET_ESP32 } else if (var_isinstance(a)) { ins_binop(vm, "-", ins); } else { @@ -685,8 +694,17 @@ newframe: /* a new call frame */ if (var_isint(a) && var_isint(b)) { var_setint(dst, ibinop(*, a, b)); } else if (var_isnumber(a) && var_isnumber(b)) { +#if CONFIG_IDF_TARGET_ESP32 /* when running on ESP32 in IRAM, there is a bug in early chip revision */ + union bvaldata x, y; // TASMOTA workaround for ESP32 rev0 bug + x.i = a->v.i; + if (var_isint(a)) { x.r = (breal) x.i; } + y.i = b->v.i; + if (var_isint(b)) { y.r = (breal) y.i; } + var_setreal(dst, x.r * y.r); +#else // CONFIG_IDF_TARGET_ESP32 breal x = var2real(a), y = var2real(b); var_setreal(dst, x * y); +#endif // CONFIG_IDF_TARGET_ESP32 } else if (var_isinstance(a)) { ins_binop(vm, "*", ins); } else { @@ -704,11 +722,23 @@ newframe: /* a new call frame */ var_setint(dst, x / y); } } else if (var_isnumber(a) && var_isnumber(b)) { +#if CONFIG_IDF_TARGET_ESP32 /* when running on ESP32 in IRAM, there is a bug in early chip revision */ + union bvaldata x, y; // TASMOTA workaround for ESP32 rev0 bug + x.i = a->v.i; + if (var_isint(a)) { x.r = (breal) x.i; } + y.i = b->v.i; + if (var_isint(b)) { y.r = (breal) y.i; } + if (y.r == cast(breal, 0)) { + vm_error(vm, "divzero_error", "division by zero"); + } + var_setreal(dst, x.r / y.r); +#else // CONFIG_IDF_TARGET_ESP32 breal x = var2real(a), y = var2real(b); if (y == cast(breal, 0)) { vm_error(vm, "divzero_error", "division by zero"); } var_setreal(dst, x / y); +#endif // CONFIG_IDF_TARGET_ESP32 } else if (var_isinstance(a)) { ins_binop(vm, "/", ins); } else { @@ -721,7 +751,16 @@ newframe: /* a new call frame */ if (var_isint(a) && var_isint(b)) { var_setint(dst, ibinop(%, a, b)); } else if (var_isnumber(a) && var_isnumber(b)) { +#if CONFIG_IDF_TARGET_ESP32 /* when running on ESP32 in IRAM, there is a bug in early chip revision */ + union bvaldata x, y; // TASMOTA workaround for ESP32 rev0 bug + x.i = a->v.i; + if (var_isint(a)) { x.r = (breal) x.i; } + y.i = b->v.i; + if (var_isint(b)) { y.r = (breal) y.i; } + var_setreal(dst, mathfunc(fmod)(x.r, y.r)); +#else // CONFIG_IDF_TARGET_ESP32 var_setreal(dst, mathfunc(fmod)(var_toreal(a), var_toreal(b))); +#endif // CONFIG_IDF_TARGET_ESP32 } else if (var_isinstance(a)) { ins_binop(vm, "%", ins); } else { diff --git a/lib/libesp32/berry/src/be_vm.h b/lib/libesp32/berry/src/be_vm.h index ba05579bf..c88609bbd 100644 --- a/lib/libesp32/berry/src/be_vm.h +++ b/lib/libesp32/berry/src/be_vm.h @@ -14,14 +14,19 @@ #define comp_set_named_gbl(vm) ((vm)->compopt |= (1<compopt &= ~(1<compopt & (1<compopt |= (1<compopt &= ~(1<compopt & (1<compopt |= (1<compopt &= ~(1<compopt & (1<compopt |= (1<compopt &= ~(1< 'attribute_error' - the 'range' object has no method '()' +# stack traceback: +# :5: in function `test` +# :7: in function `main` +def test() + var line = '1234567890' + line = line[3..7] +# print(line) + for n : 1..2 end +end +test() diff --git a/lib/libesp32/berry/tools/coc/coc_parser.py b/lib/libesp32/berry/tools/coc/coc_parser.py index 28bdfcdd7..c5603ebb7 100644 --- a/lib/libesp32/berry/tools/coc/coc_parser.py +++ b/lib/libesp32/berry/tools/coc/coc_parser.py @@ -104,7 +104,7 @@ class coc_parser: return r[0] def parse_object(self): - self.text = re.sub("\s+//.*?$", "", self.text, flags=re.MULTILINE) # remove trailing comments + self.text = re.sub(r"\s+//.*?$", "", self.text, flags=re.MULTILINE) # remove trailing comments while True: obj = self.parse_block() self.objects.append(obj) diff --git a/lib/libesp32/berry_matter/src/be_matter_module.c b/lib/libesp32/berry_matter/src/be_matter_module.c index f5a97b7ae..994703f8d 100644 --- a/lib/libesp32/berry_matter/src/be_matter_module.c +++ b/lib/libesp32/berry_matter/src/be_matter_module.c @@ -204,39 +204,41 @@ extern const bclass be_class_Matter_TLV; // need to declare it upfront because #include "solidify/solidified_Matter_Plugin_0.h" #include "solidify/solidified_Matter_Base38.h" #include "solidify/solidified_Matter_UI.h" -#include "solidify/solidified_Matter_Device.h" #include "solidify/solidified_Matter_Profiler.h" #include "../generate/be_matter_certs.h" #include "solidify/solidified_Matter_Plugin_1_Root.h" -#include "solidify/solidified_Matter_Plugin_2_Aggregator.h" +#include "solidify/solidified_Matter_Plugin_1_Aggregator.h" #include "solidify/solidified_Matter_Plugin_1_Device.h" #include "solidify/solidified_Matter_Plugin_2_OnOff.h" #include "solidify/solidified_Matter_Plugin_9_Virt_OnOff.h" -#include "solidify/solidified_Matter_Plugin_2_Light0.h" +#include "solidify/solidified_Matter_Plugin_3_Light0.h" #include "solidify/solidified_Matter_Plugin_9_Virt_Light0.h" -#include "solidify/solidified_Matter_Plugin_3_Light1.h" +#include "solidify/solidified_Matter_Plugin_2_Light1.h" #include "solidify/solidified_Matter_Plugin_9_Virt_Light1.h" -#include "solidify/solidified_Matter_Plugin_4_Light2.h" +#include "solidify/solidified_Matter_Plugin_3_Light2.h" #include "solidify/solidified_Matter_Plugin_9_Virt_Light2.h" -#include "solidify/solidified_Matter_Plugin_4_Light3.h" +#include "solidify/solidified_Matter_Plugin_3_Light3.h" #include "solidify/solidified_Matter_Plugin_9_Virt_Light3.h" #include "solidify/solidified_Matter_Plugin_2_Shutter.h" #include "solidify/solidified_Matter_Plugin_3_ShutterTilt.h" #include "solidify/solidified_Matter_Plugin_2_Sensor.h" #include "solidify/solidified_Matter_Plugin_3_Sensor_Pressure.h" +#include "solidify/solidified_Matter_Plugin_3_Sensor_Flow.h" #include "solidify/solidified_Matter_Plugin_9_Virt_Sensor_Pressure.h" +#include "solidify/solidified_Matter_Plugin_9_Virt_Sensor_Flow.h" #include "solidify/solidified_Matter_Plugin_3_Sensor_Temp.h" #include "solidify/solidified_Matter_Plugin_9_Virt_Sensor_Temp.h" #include "solidify/solidified_Matter_Plugin_3_Sensor_Illuminance.h" #include "solidify/solidified_Matter_Plugin_9_Virt_Sensor_Illuminance.h" #include "solidify/solidified_Matter_Plugin_3_Sensor_Humidity.h" #include "solidify/solidified_Matter_Plugin_9_Virt_Sensor_Humidity.h" -#include "solidify/solidified_Matter_Plugin_3_Sensor_Occupancy.h" -#include "solidify/solidified_Matter_Plugin_3_Sensor_OnOff.h" -#include "solidify/solidified_Matter_Plugin_3_Sensor_Contact.h" +#include "solidify/solidified_Matter_Plugin_2_Sensor_Occupancy.h" +#include "solidify/solidified_Matter_Plugin_2_Sensor_OnOff.h" +#include "solidify/solidified_Matter_Plugin_2_Sensor_Contact.h" #include "solidify/solidified_Matter_Plugin_9_Virt_Sensor_Contact.h" +#include "solidify/solidified_Matter_Plugin_9_Virt_Sensor_Occupancy.h" #include "solidify/solidified_Matter_Plugin_2_Bridge_HTTP.h" #include "solidify/solidified_Matter_Plugin_4_Bridge_OnOff.h" #include "solidify/solidified_Matter_Plugin_3_Bridge_Light0.h" @@ -248,8 +250,11 @@ extern const bclass be_class_Matter_TLV; // need to declare it upfront because #include "solidify/solidified_Matter_Plugin_4_Bridge_Sensor_Temp.h" #include "solidify/solidified_Matter_Plugin_4_Bridge_Sensor_Illuminance.h" #include "solidify/solidified_Matter_Plugin_4_Bridge_Sensor_Humidity.h" -#include "solidify/solidified_Matter_Plugin_4_Bridge_Sensor_Occupancy.h" -#include "solidify/solidified_Matter_Plugin_4_Bridge_Sensor_Contact.h" +#include "solidify/solidified_Matter_Plugin_3_Bridge_Sensor_Occupancy.h" +#include "solidify/solidified_Matter_Plugin_3_Bridge_Sensor_Contact.h" +#include "solidify/solidified_Matter_Plugin_4_Bridge_Sensor_Flow.h" +#include "solidify/solidified_Matter_Plugin_z_All.h" +#include "solidify/solidified_Matter_zz_Device.h" /*********************************************************************************************\ * Get a bytes() object of the certificate DAC/PAI_Cert @@ -429,48 +434,10 @@ module matter (scope: global, strings: weak) { DAC_Priv_FFF1_8000, func(matter_DAC_Priv_FFF1_8000) CD_FFF1_8000, func(matter_CD_FFF1_8000) // Certification Declaration - // Plugins + // Plugins - only the core classes, all others are taken from `matter_device.plugins_classes` Plugin_Root, class(be_class_Matter_Plugin_Root) // Generic behavior common to all devices Plugin_Aggregator, class(be_class_Matter_Plugin_Aggregator) // Aggregator - Plugin_Device, class(be_class_Matter_Plugin_Device) // Generic device (abstract) - Plugin_OnOff, class(be_class_Matter_Plugin_OnOff) // Relay/Light behavior (OnOff) - Plugin_Virt_OnOff, class(be_class_Matter_Plugin_Virt_OnOff) // Relay/Light virtual (OnOff) - Plugin_Light0, class(be_class_Matter_Plugin_Light0) // OnOff Light - Plugin_Virt_Light0, class(be_class_Matter_Plugin_Virt_Light0) // OnOff Light Virtual - Plugin_Light1, class(be_class_Matter_Plugin_Light1) // Dimmable Light - Plugin_Virt_Light1, class(be_class_Matter_Plugin_Virt_Light1) // Dimmable Light Virtual - Plugin_Light2, class(be_class_Matter_Plugin_Light2) // Color Temperature Light - Plugin_Virt_Light2, class(be_class_Matter_Plugin_Virt_Light2) // Color Temperature Light Virtual - Plugin_Light3, class(be_class_Matter_Plugin_Light3) // Extended Color Light - Plugin_Virt_Light3, class(be_class_Matter_Plugin_Virt_Light3) // Extended Color Light Virtual - Plugin_Shutter, class(be_class_Matter_Plugin_Shutter) // Shutter - Plugin_ShutterTilt, class(be_class_Matter_Plugin_ShutterTilt) // Shutter + Tilt - Plugin_Sensor, class(be_class_Matter_Plugin_Sensor) // Generic Sensor - Plugin_Sensor_Pressure, class(be_class_Matter_Plugin_Sensor_Pressure) // Pressure Sensor - Plugin_Sensor_Virt_Pressure, class(be_class_Matter_Plugin_Virt_Sensor_Pressure) // Pressure Virtual Sensor - Plugin_Sensor_Temp, class(be_class_Matter_Plugin_Sensor_Temp) // Temperature Sensor - Plugin_Virt_Sensor_Temp, class(be_class_Matter_Plugin_Virt_Sensor_Temp) // Temperature Sensor - Plugin_Sensor_Illuminance, class(be_class_Matter_Plugin_Sensor_Illuminance) // Illuminance Sensor - Plugin_Virt_Sensor_Illuminance, class(be_class_Matter_Plugin_Virt_Sensor_Illuminance) // Illuminance Virtual Sensor - Plugin_Sensor_Humidity, class(be_class_Matter_Plugin_Sensor_Humidity) // Humidity Sensor - Plugin_Sensor_Virt_Humidity, class(be_class_Matter_Plugin_Virt_Sensor_Humidity) // Humidity Virtual Sensor - Plugin_Sensor_Occupancy, class(be_class_Matter_Plugin_Sensor_Occupancy) // Occupancy Sensor - Plugin_Sensor_OnOff, class(be_class_Matter_Plugin_Sensor_OnOff) // Simple OnOff Sensor - Plugin_Sensor_Contact, class(be_class_Matter_Plugin_Sensor_Contact) // Contact Sensor - Plugin_Virt_Sensor_Contact, class(be_class_Matter_Plugin_Virt_Sensor_Contact) // Virtual Contact Sensor Plugin_Bridge_HTTP, class(be_class_Matter_Plugin_Bridge_HTTP) // HTTP bridge superclass - Plugin_Bridge_OnOff, class(be_class_Matter_Plugin_Bridge_OnOff) // HTTP Relay/Light behavior (OnOff) - Plugin_Bridge_Light0, class(be_class_Matter_Plugin_Bridge_Light0) // HTTP OnOff Light - Plugin_Bridge_Light1, class(be_class_Matter_Plugin_Bridge_Light1) // HTTP Dimmer Light - Plugin_Bridge_Light2, class(be_class_Matter_Plugin_Bridge_Light2) // HTTP CT Light - Plugin_Bridge_Light3, class(be_class_Matter_Plugin_Bridge_Light3) // HTTP RGB Light - Plugin_Bridge_Sensor, class(be_class_Matter_Plugin_Bridge_Sensor) // HTTP generic sensor - Plugin_Bridge_Sensor_Pressure, class(be_class_Matter_Plugin_Bridge_Sensor_Pressure) // HTTP Pressure sensor - Plugin_Bridge_Sensor_Temp, class(be_class_Matter_Plugin_Bridge_Sensor_Temp) // HTTP Temperature sensor - Plugin_Bridge_Sensor_Illuminance, class(be_class_Matter_Plugin_Bridge_Sensor_Illuminance) // HTTP Illuminance sensor - Plugin_Bridge_Sensor_Humidity, class(be_class_Matter_Plugin_Bridge_Sensor_Humidity) // HTTP Humidity sensor - Plugin_Bridge_Sensor_Occupancy, class(be_class_Matter_Plugin_Bridge_Sensor_Occupancy) // HTTP Occupancy sensor - Plugin_Bridge_Sensor_Contact, class(be_class_Matter_Plugin_Bridge_Sensor_Contact) // HTTP Contact sensor } @const_object_info_end */ diff --git a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_2_Aggregator.be b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_1_Aggregator.be similarity index 100% rename from lib/libesp32/berry_matter/src/embedded/Matter_Plugin_2_Aggregator.be rename to lib/libesp32/berry_matter/src/embedded/Matter_Plugin_1_Aggregator.be diff --git a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_2_Light0.be b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_2_Light0.be deleted file mode 100644 index 1dbdd2266..000000000 --- a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_2_Light0.be +++ /dev/null @@ -1,161 +0,0 @@ -# -# Matter_Plugin_Light0.be - implements the behavior for a generic Lighting (OnOff only) -# -# Copyright (C) 2023 Stephan Hadinger & Theo Arends -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# - -import matter - -# Matter plug-in for core behavior - -#@ solidify:Matter_Plugin_Light0,weak - -class Matter_Plugin_Light0 : Matter_Plugin_Device - static var TYPE = "light0" # name of the plug-in in json - static var DISPLAY_NAME = "Light 0 On" # display name of the plug-in - static var UPDATE_TIME = 250 # update every 250ms - static var CLUSTERS = matter.consolidate_clusters(_class, - { - # 0x001D: inherited # Descriptor Cluster 9.5 p.453 - # 0x0003: inherited # Identify 1.2 p.16 - # 0x0004: inherited # Groups 1.3 p.21 - # 0x0005: inherited # Scenes 1.4 p.30 - no writable - 0x0006: [0,0xFFFC,0xFFFD], # On/Off 1.5 p.48 - }) - static var UPDATE_COMMANDS = matter.UC_LIST(_class, "Power") - static var TYPES = { 0x0100: 2 } # OnOff Light, but not actually used because Relay is managed by OnOff - - # Inherited - # var device # reference to the `device` global object - # var endpoint # current endpoint - # var clusters # map from cluster to list of attributes, typically constructed from CLUSTERS hierachy - # var tick # tick value when it was last updated - # var node_label # name of the endpoint, used only in bridge mode, "" if none - var shadow_onoff # (bool) status of the light power on/off - - ############################################################# - # Constructor - def init(device, endpoint, config) - super(self).init(device, endpoint, config) - self.shadow_onoff = false - end - - ############################################################# - # Update shadow - # - def update_shadow() - if !self.VIRTUAL - import light - var light_status = light.get() - if light_status != nil - var pow = light_status.find('power', nil) - if pow != self.shadow_onoff - self.attribute_updated(0x0006, 0x0000) - self.shadow_onoff = pow - end - end - end - super(self).update_shadow() - end - - def set_onoff(pow) - if !self.VIRTUAL - import light - light.set({'power':pow}) - self.update_shadow() - else - if pow != self.shadow_onoff - self.attribute_updated(0x0006, 0x0000) - self.shadow_onoff = pow - end - end - end - - ############################################################# - # read an attribute - # - def read_attribute(session, ctx, tlv_solo) - var TLV = matter.TLV - var cluster = ctx.cluster - var attribute = ctx.attribute - - # ==================================================================================================== - if cluster == 0x0006 # ========== On/Off 1.5 p.48 ========== - self.update_shadow_lazy() - if attribute == 0x0000 # ---------- OnOff / bool ---------- - return tlv_solo.set(TLV.BOOL, self.shadow_onoff) - elif attribute == 0xFFFC # ---------- FeatureMap / map32 ---------- - return tlv_solo.set(TLV.U4, 0) # 0 = no Level Control for Lighting - elif attribute == 0xFFFD # ---------- ClusterRevision / u2 ---------- - return tlv_solo.set(TLV.U4, 4) # 0 = no Level Control for Lighting - end - - else - return super(self).read_attribute(session, ctx, tlv_solo) - end - end - - ############################################################# - # Invoke a command - # - # returns a TLV object if successful, contains the response - # or an `int` to indicate a status - def invoke_request(session, val, ctx) - import light - var TLV = matter.TLV - var cluster = ctx.cluster - var command = ctx.command - - # ==================================================================================================== - if cluster == 0x0006 # ========== On/Off 1.5 p.48 ========== - self.update_shadow_lazy() - if command == 0x0000 # ---------- Off ---------- - self.set_onoff(false) - self.publish_command('Power', 0) - return true - elif command == 0x0001 # ---------- On ---------- - self.set_onoff(true) - self.publish_command('Power', 1) - return true - elif command == 0x0002 # ---------- Toggle ---------- - self.set_onoff(!self.shadow_onoff) - self.publish_command('Power', self.shadow_onoff ? 1 : 0) - return true - end - end - end - - ############################################################# - # find_val_i - get value of map case insensitive - static def find_val_i(m, k) - var key_i = tasmota.find_key_i(m, k) - return m.find(key_i) - end - - ############################################################# - # update_virtual - # - # Update internal state for virtual devices - def update_virtual(payload_json) - var val_onoff = payload_json.find("Power") - if val_onoff != nil - self.set_onoff(bool(val_onoff)) - end - super(self).update_virtual(payload_json) - end - -end -matter.Plugin_Light0 = Matter_Plugin_Light0 diff --git a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_3_Light1.be b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_2_Light1.be similarity index 76% rename from lib/libesp32/berry_matter/src/embedded/Matter_Plugin_3_Light1.be rename to lib/libesp32/berry_matter/src/embedded/Matter_Plugin_2_Light1.be index 03a55b1c7..4ba09f081 100644 --- a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_3_Light1.be +++ b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_2_Light1.be @@ -23,18 +23,19 @@ import matter #@ solidify:Matter_Plugin_Light1,weak -class Matter_Plugin_Light1 : Matter_Plugin_Light0 +class Matter_Plugin_Light1 : Matter_Plugin_Device static var TYPE = "light1" # name of the plug-in in json static var DISPLAY_NAME = "Light 1 Dimmer" # display name of the plug-in + static var UPDATE_TIME = 250 # update every 250ms static var CLUSTERS = matter.consolidate_clusters(_class, { # 0x001D: inherited # Descriptor Cluster 9.5 p.453 # 0x0003: inherited # Identify 1.2 p.16 # 0x0004: inherited # Groups 1.3 p.21 # 0x0005: inherited # Scenes 1.4 p.30 - no writable - # 0x0006: inherited # On/Off 1.5 p.48 + 0x0006: [0,0xFFFC,0xFFFD], # On/Off 1.5 p.48 0x0008: [0,2,3,0x0F,0x11,0xFFFC,0xFFFD], # Level Control 1.6 p.57 }) - static var UPDATE_COMMANDS = matter.UC_LIST(_class, "Bri") + static var UPDATE_COMMANDS = matter.UC_LIST(_class, "Power", "Bri") static var TYPES = { 0x0101: 2 } # Dimmable Light # Inherited @@ -43,13 +44,14 @@ class Matter_Plugin_Light1 : Matter_Plugin_Light0 # var clusters # map from cluster to list of attributes, typically constructed from CLUSTERS hierachy # var tick # tick value when it was last updated # var node_label # name of the endpoint, used only in bridge mode, "" if none - # var shadow_onoff # (bool) status of the light power on/off + var shadow_onoff # (bool) status of the light power on/off var shadow_bri # (int 0..254) brightness before Gamma correction - as per Matter 255 is not allowed ############################################################# # Constructor def init(device, endpoint, arguments) super(self).init(device, endpoint, arguments) + self.shadow_onoff = false self.shadow_bri = 0 end @@ -61,6 +63,11 @@ class Matter_Plugin_Light1 : Matter_Plugin_Light0 import light var light_status = light.get() if light_status != nil + var pow = light_status.find('power', nil) + if pow != self.shadow_onoff + self.attribute_updated(0x0006, 0x0000) + self.shadow_onoff = pow + end var bri = light_status.find('bri', nil) if bri != nil bri = tasmota.scale_uint(bri, 0, 255, 0, 254) @@ -74,6 +81,19 @@ class Matter_Plugin_Light1 : Matter_Plugin_Light0 super(self).update_shadow() # superclass manages 'power' end + def set_onoff(pow) + if !self.VIRTUAL + import light + light.set({'power':pow}) + self.update_shadow() + else + if pow != self.shadow_onoff + self.attribute_updated(0x0006, 0x0000) + self.shadow_onoff = pow + end + end + end + ############################################################# # Set Bri # @@ -113,7 +133,18 @@ class Matter_Plugin_Light1 : Matter_Plugin_Light0 var attribute = ctx.attribute # ==================================================================================================== - if cluster == 0x0008 # ========== Level Control 1.6 p.57 ========== + if cluster == 0x0006 # ========== On/Off 1.5 p.48 ========== + self.update_shadow_lazy() + if attribute == 0x0000 # ---------- OnOff / bool ---------- + return tlv_solo.set(TLV.BOOL, self.shadow_onoff) + elif attribute == 0xFFFC # ---------- FeatureMap / map32 ---------- + return tlv_solo.set(TLV.U4, 0) # 0 = no Level Control for Lighting + elif attribute == 0xFFFD # ---------- ClusterRevision / u2 ---------- + return tlv_solo.set(TLV.U4, 4) # 0 = no Level Control for Lighting + end + + # ==================================================================================================== + elif cluster == 0x0008 # ========== Level Control 1.6 p.57 ========== self.update_shadow_lazy() if attribute == 0x0000 # ---------- CurrentLevel / u1 ---------- return tlv_solo.set(TLV.U1, self.shadow_bri) @@ -148,7 +179,23 @@ class Matter_Plugin_Light1 : Matter_Plugin_Light0 var command = ctx.command # ==================================================================================================== - if cluster == 0x0008 # ========== Level Control 1.6 p.57 ========== + if cluster == 0x0006 # ========== On/Off 1.5 p.48 ========== + self.update_shadow_lazy() + if command == 0x0000 # ---------- Off ---------- + self.set_onoff(false) + self.publish_command('Power', 0) + return true + elif command == 0x0001 # ---------- On ---------- + self.set_onoff(true) + self.publish_command('Power', 1) + return true + elif command == 0x0002 # ---------- Toggle ---------- + self.set_onoff(!self.shadow_onoff) + self.publish_command('Power', self.shadow_onoff ? 1 : 0) + return true + end + # ==================================================================================================== + elif cluster == 0x0008 # ========== Level Control 1.6 p.57 ========== self.update_shadow_lazy() if command == 0x0000 # ---------- MoveToLevel ---------- var bri_254 = val.findsubval(0) # Hue 0..254 @@ -198,6 +245,8 @@ class Matter_Plugin_Light1 : Matter_Plugin_Light0 if val_bri != nil self.set_bri(int(val_bri), val_onoff) return # don't call super() because we already handeld 'Power' + elif val_onoff != nil + self.set_onoff(bool(val_onoff)) end super(self).update_virtual(payload_json) end diff --git a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_2_Sensor.be b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_2_Sensor.be index bb44c91aa..cdeb53217 100644 --- a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_2_Sensor.be +++ b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_2_Sensor.be @@ -49,7 +49,7 @@ class Matter_Plugin_Sensor : Matter_Plugin_Device # The device calls regularly `tasmota.read_sensors()` and converts # it to json. def parse_sensors(payload) - if self.tasmota_sensor_matcher + if !self.VIRTUAL && self.tasmota_sensor_matcher var val = self.pre_value(real(self.tasmota_sensor_matcher.match(payload))) if val != nil if val != self.shadow_value diff --git a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_3_Sensor_Contact.be b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_2_Sensor_Contact.be similarity index 91% rename from lib/libesp32/berry_matter/src/embedded/Matter_Plugin_3_Sensor_Contact.be rename to lib/libesp32/berry_matter/src/embedded/Matter_Plugin_2_Sensor_Contact.be index e4c847ead..5932b0060 100644 --- a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_3_Sensor_Contact.be +++ b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_2_Sensor_Contact.be @@ -60,18 +60,19 @@ class Matter_Plugin_Sensor_Contact : Matter_Plugin_Device # def update_shadow() super(self).update_shadow() + if !self.VIRTUAL + import json + var ret = tasmota.cmd("Status 8", true) + if ret != nil + var j = json.load(ret) + if j != nil + var state = false + state = (j.find("Switch" + str(self.tasmota_switch_index)) == "ON") - import json - var ret = tasmota.cmd("Status 8", true) - if ret != nil - var j = json.load(ret) - if j != nil - var state = false - state = (j.find("Switch" + str(self.tasmota_switch_index)) == "ON") - - if self.shadow_contact != state - self.attribute_updated(0x0045, 0x0000) - self.shadow_contact = state + if self.shadow_contact != state + self.attribute_updated(0x0045, 0x0000) + self.shadow_contact = state + end end end end diff --git a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_3_Sensor_Occupancy.be b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_2_Sensor_Occupancy.be similarity index 91% rename from lib/libesp32/berry_matter/src/embedded/Matter_Plugin_3_Sensor_Occupancy.be rename to lib/libesp32/berry_matter/src/embedded/Matter_Plugin_2_Sensor_Occupancy.be index 5d9d4f18c..8ad690726 100644 --- a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_3_Sensor_Occupancy.be +++ b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_2_Sensor_Occupancy.be @@ -60,17 +60,19 @@ class Matter_Plugin_Sensor_Occupancy : Matter_Plugin_Device # def update_shadow() super(self).update_shadow() - var switch_str = "Switch" + str(self.tasmota_switch_index) + if !self.VIRTUAL + var switch_str = "Switch" + str(self.tasmota_switch_index) - var j = tasmota.cmd("Status 8", true) - if j != nil j = j.find("StatusSNS") end - if j != nil && j.contains(switch_str) - var state = (j.find(switch_str) == "ON") + var j = tasmota.cmd("Status 8", true) + if j != nil j = j.find("StatusSNS") end + if j != nil && j.contains(switch_str) + var state = (j.find(switch_str) == "ON") - if (self.shadow_occupancy != state) - self.attribute_updated(0x0406, 0x0000) + if (self.shadow_occupancy != state) + self.attribute_updated(0x0406, 0x0000) + end + self.shadow_occupancy = state end - self.shadow_occupancy = state end end diff --git a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_3_Sensor_OnOff.be b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_2_Sensor_OnOff.be similarity index 89% rename from lib/libesp32/berry_matter/src/embedded/Matter_Plugin_3_Sensor_OnOff.be rename to lib/libesp32/berry_matter/src/embedded/Matter_Plugin_2_Sensor_OnOff.be index 79eb51c62..b7b1eb758 100644 --- a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_3_Sensor_OnOff.be +++ b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_2_Sensor_OnOff.be @@ -50,17 +50,19 @@ class Matter_Plugin_Sensor_OnOff : Matter_Plugin_Device # def update_shadow() super(self).update_shadow() - var switch_str = "Switch" + str(self.tasmota_switch_index) + if !self.VIRTUAL + var switch_str = "Switch" + str(self.tasmota_switch_index) - var j = tasmota.cmd("Status 8", true) - if j != nil j = j.find("StatusSNS") end - if j != nil && j.contains(switch_str) - var state = (j.find(switch_str) == "ON") + var j = tasmota.cmd("Status 8", true) + if j != nil j = j.find("StatusSNS") end + if j != nil && j.contains(switch_str) + var state = (j.find(switch_str) == "ON") - if (self.shadow_onoff != state) - self.attribute_updated(0x0006, 0x0000) + if (self.shadow_onoff != state) + self.attribute_updated(0x0006, 0x0000) + end + self.shadow_onoff = state end - self.shadow_onoff = state end end diff --git a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_2_Shutter.be b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_2_Shutter.be index 54e832f85..424f74be8 100644 --- a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_2_Shutter.be +++ b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_2_Shutter.be @@ -78,10 +78,12 @@ class Matter_Plugin_Shutter : Matter_Plugin_Device # Update shadow # def update_shadow() - self.update_inverted() - var sp = tasmota.cmd("ShutterPosition" + str(self.tasmota_shutter_index + 1), true) - if sp - self.parse_sensors(sp) + if !self.VIRTUAL + self.update_inverted() + var sp = tasmota.cmd("ShutterPosition" + str(self.tasmota_shutter_index + 1), true) + if sp + self.parse_sensors(sp) + end end super(self).update_shadow() end diff --git a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_4_Bridge_Sensor_Contact.be b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_3_Bridge_Sensor_Contact.be similarity index 100% rename from lib/libesp32/berry_matter/src/embedded/Matter_Plugin_4_Bridge_Sensor_Contact.be rename to lib/libesp32/berry_matter/src/embedded/Matter_Plugin_3_Bridge_Sensor_Contact.be diff --git a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_4_Bridge_Sensor_Occupancy.be b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_3_Bridge_Sensor_Occupancy.be similarity index 100% rename from lib/libesp32/berry_matter/src/embedded/Matter_Plugin_4_Bridge_Sensor_Occupancy.be rename to lib/libesp32/berry_matter/src/embedded/Matter_Plugin_3_Bridge_Sensor_Occupancy.be diff --git a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_3_Light0.be b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_3_Light0.be new file mode 100644 index 000000000..9c2108ebf --- /dev/null +++ b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_3_Light0.be @@ -0,0 +1,40 @@ +# +# Matter_Plugin_Light0.be - implements the behavior for a generic Lighting (OnOff only) +# +# Copyright (C) 2023 Stephan Hadinger & Theo Arends +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +import matter + +# Matter plug-in for core behavior + +#@ solidify:Matter_Plugin_Light0,weak + +class Matter_Plugin_Light0 : Matter_Plugin_OnOff + static var TYPE = "light0" # name of the plug-in in json + static var DISPLAY_NAME = "Light 0 On" # display name of the plug-in + static var TYPES = { 0x0100: 2 } # OnOff Light, but not actually used because Relay is managed by OnOff + + # Inherited + # var device # reference to the `device` global object + # var endpoint # current endpoint + # var clusters # map from cluster to list of attributes, typically constructed from CLUSTERS hierachy + # var tick # tick value when it was last updated + # var node_label # name of the endpoint, used only in bridge mode, "" if none + # var shadow_onoff # (bool) status of the light power on/off + +end +matter.Plugin_Light0 = Matter_Plugin_Light0 diff --git a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_4_Light2.be b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_3_Light2.be similarity index 94% rename from lib/libesp32/berry_matter/src/embedded/Matter_Plugin_4_Light2.be rename to lib/libesp32/berry_matter/src/embedded/Matter_Plugin_3_Light2.be index c4d4f9317..9bc4584d9 100644 --- a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_4_Light2.be +++ b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_3_Light2.be @@ -61,17 +61,21 @@ class Matter_Plugin_Light2 : Matter_Plugin_Light1 # Update shadow # def update_shadow() - import light - self.update_ct_minmax() - super(self).update_shadow() - var light_status = light.get() - if light_status != nil - var ct = light_status.find('ct', nil) - if ct == nil ct = self.shadow_ct end - if ct != self.shadow_ct - self.attribute_updated(0x0300, 0x0007) - self.shadow_ct = ct + if !self.VIRTUAL + import light + self.update_ct_minmax() + super(self).update_shadow() + var light_status = light.get() + if light_status != nil + var ct = light_status.find('ct', nil) + if ct == nil ct = self.shadow_ct end + if ct != self.shadow_ct + self.attribute_updated(0x0300, 0x0007) + self.shadow_ct = ct + end end + else + super(self).update_shadow() end end diff --git a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_4_Light3.be b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_3_Light3.be similarity index 100% rename from lib/libesp32/berry_matter/src/embedded/Matter_Plugin_4_Light3.be rename to lib/libesp32/berry_matter/src/embedded/Matter_Plugin_3_Light3.be diff --git a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_3_Sensor_Flow.be b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_3_Sensor_Flow.be new file mode 100644 index 000000000..f7a12469d --- /dev/null +++ b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_3_Sensor_Flow.be @@ -0,0 +1,86 @@ +# +# Matter_Plugin_Sensor_Flow.be - implements the behavior for a Flow Sensor +# +# Copyright (C) 2023 Stephan Hadinger & Theo Arends +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +import matter + +# Matter plug-in for core behavior + +#@ solidify:Matter_Plugin_Sensor_Flow,weak + +class Matter_Plugin_Sensor_Flow : Matter_Plugin_Sensor + static var TYPE = "flow" # name of the plug-in in json + static var DISPLAY_NAME = "Flow" # display name of the plug-in + static var JSON_NAME = "Flow" # Name of the sensor attribute in JSON payloads + static var UPDATE_COMMANDS = matter.UC_LIST(_class, "Flow") + static var CLUSTERS = matter.consolidate_clusters(_class, { + 0x0404: [0,1,2,0xFFFC,0xFFFD], # Flow Measurement + }) + static var TYPES = { 0x0306: 1 } # Flow Sensor, rev 1 + + ############################################################# + # Pre-process value + # + # This must be overriden. + # This allows to convert the raw sensor value to the target one, typically int + def pre_value(val) + return val != nil ? int(val * 10) : nil # MeasuredValue represents 10 x flow in m3/h + end + + ############################################################# + # Called when the value changed compared to shadow value + # + # This must be overriden. + # This is where you call `self.attribute_updated(, )` + def value_changed() + self.attribute_updated(0x0404, 0x0000) + end + + ############################################################# + # read an attribute + # + def read_attribute(session, ctx, tlv_solo) + var TLV = matter.TLV + var cluster = ctx.cluster + var attribute = ctx.attribute + + # ==================================================================================================== + if cluster == 0x0404 # ========== Flow Measurement 2.4 p.98 ========== + if attribute == 0x0000 # ---------- MeasuredValue / i16 ---------- + if self.shadow_value != nil + return tlv_solo.set(TLV.U2, int(self.shadow_value)) # MeasuredValue represents 10 x flow in m3/h. + else + return tlv_solo.set(TLV.NULL, nil) + end + elif attribute == 0x0001 # ---------- MinMeasuredValue / i16 ---------- + return tlv_solo.set(TLV.U2, 0) # 0 m3/h + elif attribute == 0x0002 # ---------- MaxMeasuredValue / i16 ---------- + return tlv_solo.set(TLV.U2, 65534) # 65534 m3/h + elif attribute == 0xFFFC # ---------- FeatureMap / map32 ---------- + return tlv_solo.set(TLV.U4, 0) # 0 = no Extended Range + elif attribute == 0xFFFD # ---------- ClusterRevision / u2 ---------- + return tlv_solo.set(TLV.U4, 3) # 3 = New data model format and notation + end + + else + return super(self).read_attribute(session, ctx, tlv_solo) + end + end + +end +matter.Plugin_Sensor_Flow = Matter_Plugin_Sensor_Flow diff --git a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_4_Bridge_Sensor_Flow.be b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_4_Bridge_Sensor_Flow.be new file mode 100644 index 000000000..ddd0bd1e2 --- /dev/null +++ b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_4_Bridge_Sensor_Flow.be @@ -0,0 +1,96 @@ +# +# Matter_Plugin_Bridge_Sensor_Flow.be - implements base class for a Flow Sensor via HTTP to Tasmota +# +# Copyright (C) 2023 Stephan Hadinger & Theo Arends +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +import matter + +# Matter plug-in for core behavior + +#@ solidify:Matter_Plugin_Bridge_Sensor_Flow,weak + +class Matter_Plugin_Bridge_Sensor_Flow : Matter_Plugin_Bridge_Sensor + static var TYPE = "http_flow" # name of the plug-in in json + static var DISPLAY_NAME = "Flow" # display name of the plug-in + + static var CLUSTERS = matter.consolidate_clusters(_class, { + 0x0404: [0,1,2,0xFFFC,0xFFFD], # Flow Measurement + }) + static var TYPES = { 0x0306: 1 } # Flow Sensor, rev 1 + + ############################################################# + # Called when the value changed compared to shadow value + # + # This must be overriden. + # This is where you call `self.attribute_updated(, )` + def value_changed() + self.attribute_updated(0x0404, 0x0000) + end + + ############################################################# + # Pre-process value + # + # This must be overriden. + # This allows to convert the raw sensor value to the target one, typically int + def pre_value(val) + return val != nil ? int(val * 10) : nil # MeasuredValue represents 10 x flow in m3/h + end + + ############################################################# + # read an attribute + # + def read_attribute(session, ctx, tlv_solo) + var TLV = matter.TLV + var cluster = ctx.cluster + var attribute = ctx.attribute + + # ==================================================================================================== + if cluster == 0x0404 # ========== Flow Measurement 2.1.2 p.127 ========== + if attribute == 0x0000 # ---------- MeasuredValue / i16 ---------- + if self.shadow_value != nil + return tlv_solo.set(TLV.U2, int(self.shadow_value)) # MeasuredValue represents 10 x flow in m3/h. + else + return tlv_solo.set(TLV.NULL, nil) + end + elif attribute == 0x0001 # ---------- MinMeasuredValue / i16 ---------- + return tlv_solo.set(TLV.U2, 0) # 0 m3/h + elif attribute == 0x0002 # ---------- MaxMeasuredValue / i16 ---------- + return tlv_solo.set(TLV.U2, 65534) # 65534 m3/h + elif attribute == 0xFFFC # ---------- FeatureMap / map32 ---------- + return tlv_solo.set(TLV.U4, 0) # 0 = no Extended Range + elif attribute == 0xFFFD # ---------- ClusterRevision / u2 ---------- + return tlv_solo.set(TLV.U4, 3) # 3 = New data model format and notation + end + + else + return super(self).read_attribute(session, ctx, tlv_solo) + end + end + + ############################################################# + # web_values + # + # Show values of the remote device as HTML + def web_values() + import webserver + self.web_values_prefix() # display '| ' and name if present + webserver.content_send(format("⛅ %i m3/h", + int(self.shadow_value))) + end + +end +matter.Plugin_Bridge_Sensor_Flow = Matter_Plugin_Bridge_Sensor_Flow diff --git a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_9_Virt_Sensor_Flow.be b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_9_Virt_Sensor_Flow.be new file mode 100644 index 000000000..e915ab77e --- /dev/null +++ b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_9_Virt_Sensor_Flow.be @@ -0,0 +1,34 @@ +# +# Matter_Plugin_9_Virt_Sensor_Flow.be - implements the behavior for a Flow Sensor +# +# Copyright (C) 2023 Stephan Hadinger & Theo Arends +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +import matter + +# Matter plug-in for core behavior + +#@ solidify:Matter_Plugin_Virt_Sensor_Flow,weak + +class Matter_Plugin_Virt_Sensor_Flow : Matter_Plugin_Sensor_Flow + static var TYPE = "v_flow" # name of the plug-in in json + static var DISPLAY_NAME = "v.Flow" # display name of the plug-in + static var ARG = "" # no arg for virtual device + static var ARG_HINT = "_Not used_" # Hint for entering the Argument (inside 'placeholder') + static var VIRTUAL = true # virtual device + +end +matter.Plugin_Virt_Sensor_Flow = Matter_Plugin_Virt_Sensor_Flow diff --git a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_9_Virt_Sensor_Occupancy.be b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_9_Virt_Sensor_Occupancy.be new file mode 100644 index 000000000..9b4f82004 --- /dev/null +++ b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_9_Virt_Sensor_Occupancy.be @@ -0,0 +1,34 @@ +# +# Matter_Plugin_9_Virt_Sensor_Occupancy.be - implements the behavior for a Virtual Occupancy Sensor +# +# Copyright (C) 2023 Stephan Hadinger & Theo Arends +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +import matter + +# Matter plug-in for core behavior + +#@ solidify:Matter_Plugin_Virt_Sensor_Occupancy,weak + +class Matter_Plugin_Virt_Sensor_Occupancy : Matter_Plugin_Sensor_Occupancy + static var TYPE = "v_occupancy" # name of the plug-in in json + static var DISPLAY_NAME = "v.Occupancy" # display name of the plug-in + static var ARG = "" # no arg for virtual device + static var ARG_HINT = "_Not used_" # Hint for entering the Argument (inside 'placeholder') + static var VIRTUAL = true # virtual device + +end +matter.Plugin_Virt_Sensor_Occupancy = Matter_Plugin_Virt_Sensor_Occupancy diff --git a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_z_All.be b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_z_All.be new file mode 100644 index 000000000..8aa126950 --- /dev/null +++ b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_z_All.be @@ -0,0 +1,43 @@ +# +# Matter_Plugin_z_All.be - list all plugin classes in a solidified map +# +# Copyright (C) 2023 Stephan Hadinger & Theo Arends +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +import matter + +# this is used to solidify plugins list in Matter_Device + +def register_native_classes() + var plugins_classes = {} + # try to register any class that starts with 'Plugin_' + import introspect + import string + for k: introspect.members(matter) + var v = introspect.get(matter, k) + if type(v) == 'class' && string.find(k, "Plugin_") == 0 + var typ = introspect.get(v, 'TYPE') # make sure we don't crash if TYPE does not exist + if typ + plugins_classes[typ] = v + end + end + end + return plugins_classes +end + +plugins_classes = register_native_classes() + +matter.plugins_classes = plugins_classes diff --git a/lib/libesp32/berry_matter/src/embedded/Matter_UI.be b/lib/libesp32/berry_matter/src/embedded/Matter_UI.be index 278d8c250..a8b372f2c 100644 --- a/lib/libesp32/berry_matter/src/embedded/Matter_UI.be +++ b/lib/libesp32/berry_matter/src/embedded/Matter_UI.be @@ -33,13 +33,13 @@ import matter ################################################################################# class Matter_UI static var _CLASSES_TYPES = "|relay|light0|light1|light2|light3|shutter|shutter+tilt" - "|temperature|pressure|illuminance|humidity|occupancy|onoff|contact" + "|temperature|pressure|illuminance|humidity|occupancy|onoff|contact|flow" "|-virtual|v_relay|v_light0|v_light1|v_light2|v_light3" - "|v_temp|v_pressure|v_illuminance|v_humidity|v_contact" + "|v_temp|v_pressure|v_illuminance|v_humidity|v_occupancy|v_contact|v_flow" # static var _CLASSES_HTTP = "-http" static var _CLASSES_TYPES2= "|http_relay|http_light0|http_light1|http_light2|http_light3" "|http_temperature|http_pressure|http_illuminance|http_humidity" - "|http_occupancy|http_contact" + "|http_occupancy|http_contact|http_flow" var device # #################################################################################################### diff --git a/lib/libesp32/berry_matter/src/embedded/Matter_Device.be b/lib/libesp32/berry_matter/src/embedded/Matter_zz_Device.be similarity index 98% rename from lib/libesp32/berry_matter/src/embedded/Matter_Device.be rename to lib/libesp32/berry_matter/src/embedded/Matter_zz_Device.be index 64915824a..b0b01434d 100644 --- a/lib/libesp32/berry_matter/src/embedded/Matter_Device.be +++ b/lib/libesp32/berry_matter/src/embedded/Matter_zz_Device.be @@ -1,5 +1,5 @@ # -# Matter_Device.be - implements a generic Matter device (commissionee) +# Matter_zz_Device.be - implements a generic Matter device (commissionee) # # Copyright (C) 2023 Stephan Hadinger & Theo Arends # @@ -31,7 +31,7 @@ class Matter_Device var started # is the Matter Device started (configured, mDNS and UDPServer started) var plugins # list of plugins instances var plugins_persist # true if plugins configuration needs to be saved - var plugins_classes # map of registered classes by type name + static var plugins_classes = matter.plugins_classes # map of registered classes by type name var plugins_config # map of JSON configuration for plugins var plugins_config_remotes # map of information on each remote under "remotes" key, '{}' when empty var udp_server # `matter.UDPServer()` object @@ -86,9 +86,7 @@ class Matter_Device self.tick = 0 self.plugins = [] self.plugins_persist = false # plugins need to saved only when the first fabric is associated - self.plugins_classes = {} self.plugins_config_remotes = {} - self.register_native_classes() # register all native classes self.vendorid = self.VENDOR_ID self.productid = self.PRODUCT_ID self.root_iterations = self.PBKDF_ITERATIONS @@ -1270,18 +1268,6 @@ class Matter_Device for i:1..size(l)-1 var k = l[i] var j = i while (j > 0) && (l[j-1] > k) l[j] = l[j-1] j -= 1 end l[j] = k end return l end - ############################################################# - # register_plugin_class - # - # Adds a class by name - def register_plugin_class(cl) - import introspect - var typ = introspect.get(cl, 'TYPE') # make sure we don't crash if TYPE does not exist - if typ - self.plugins_classes[typ] = cl - end - end - ############################################################# # get_plugin_class_displayname # @@ -1300,23 +1286,6 @@ class Matter_Device return cl ? cl.ARG : "" end - ############################################################# - # register_native_classes - # - # Adds a class by name - def register_native_classes(name, cl) - # try to register any class that starts with 'Plugin_' - import introspect - import string - for k: introspect.members(matter) - var v = introspect.get(matter, k) - if type(v) == 'class' && string.find(k, "Plugin_") == 0 - self.register_plugin_class(v) - end - end - # tasmota.log("MTR: registered classes "+str(self.k2l(self.plugins_classes)), 3) - end - ############################################################# # Dynamic adding and removal of endpoints (bridge mode) ############################################################# diff --git a/lib/libesp32/berry_matter/src/solidify/solidified_Matter_IM.h b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_IM.h index 94c9b58fd..64088807c 100644 --- a/lib/libesp32/berry_matter/src/solidify/solidified_Matter_IM.h +++ b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_IM.h @@ -2455,19 +2455,19 @@ be_local_closure(Matter_IM__inner_process_read_request, /* name */ 0x882C0121, // 00C6 GETMBR R11 R0 K33 0x5431FFFE, // 00C7 LDINT R12 -1 0x942C160C, // 00C8 GETIDX R11 R11 R12 - 0x6034000C, // 00C9 GETGBL R13 G12 - 0x5C381600, // 00CA MOVE R14 R11 - 0x7C340200, // 00CB CALL R13 1 - 0x6038000C, // 00CC GETGBL R14 G12 - 0x5C3C1400, // 00CD MOVE R15 R10 - 0x7C380200, // 00CE CALL R14 1 - 0x00341A0E, // 00CF ADD R13 R13 R14 - 0xB83A0000, // 00D0 GETNGBL R14 K0 - 0x88381D0E, // 00D1 GETMBR R14 R14 K14 - 0x88381D0F, // 00D2 GETMBR R14 R14 K15 - 0x18341A0E, // 00D3 LE R13 R13 R14 - 0x78360001, // 00D4 JMPF R13 #00D7 - 0x4034160A, // 00D5 CONNECT R13 R11 R10 + 0x6030000C, // 00C9 GETGBL R12 G12 + 0x5C341600, // 00CA MOVE R13 R11 + 0x7C300200, // 00CB CALL R12 1 + 0x6034000C, // 00CC GETGBL R13 G12 + 0x5C381400, // 00CD MOVE R14 R10 + 0x7C340200, // 00CE CALL R13 1 + 0x0030180D, // 00CF ADD R12 R12 R13 + 0xB8360000, // 00D0 GETNGBL R13 K0 + 0x88341B0E, // 00D1 GETMBR R13 R13 K14 + 0x88341B0F, // 00D2 GETMBR R13 R13 K15 + 0x1830180D, // 00D3 LE R12 R12 R13 + 0x78320001, // 00D4 JMPF R12 #00D7 + 0x4030160A, // 00D5 CONNECT R12 R11 R10 0x70020003, // 00D6 JMP #00DB 0x88300121, // 00D7 GETMBR R12 R0 K33 0x8C301912, // 00D8 GETMET R12 R12 K18 diff --git a/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_2_Aggregator.h b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_1_Aggregator.h similarity index 99% rename from lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_2_Aggregator.h rename to lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_1_Aggregator.h index af4ea7333..c9c2db74a 100644 --- a/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_2_Aggregator.h +++ b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_1_Aggregator.h @@ -1,4 +1,4 @@ -/* Solidification of Matter_Plugin_2_Aggregator.h */ +/* Solidification of Matter_Plugin_1_Aggregator.h */ /********************************************************************\ * Generated code, don't edit * \********************************************************************/ diff --git a/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_1_Root.h b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_1_Root.h index b435e2ca6..a001bfaa2 100644 --- a/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_1_Root.h +++ b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_1_Root.h @@ -1341,7 +1341,7 @@ be_local_closure(Matter_Plugin_Root_invoke_request, /* name */ }), be_str_weak(invoke_request), &be_const_str_solidified, - ( &(const binstruction[713]) { /* code */ + ( &(const binstruction[712]) { /* code */ 0xA4120000, // 0000 IMPORT R4 K0 0xB8160200, // 0001 GETNGBL R5 K1 0x88140B02, // 0002 GETMBR R5 R5 K2 @@ -1442,10 +1442,10 @@ be_local_closure(Matter_Plugin_Root_invoke_request, /* name */ 0x80041000, // 0061 RET 1 R8 0x70020000, // 0062 JMP #0064 0xB0063119, // 0063 RAISE 1 K24 K25 - 0x70020261, // 0064 JMP #02C7 + 0x70020260, // 0064 JMP #02C6 0x5422003D, // 0065 LDINT R8 62 0x1C200C08, // 0066 EQ R8 R6 R8 - 0x782201C2, // 0067 JMPF R8 #022B + 0x782201C1, // 0067 JMPF R8 #022A 0x1C200F0E, // 0068 EQ R8 R7 K14 0x7822001D, // 0069 JMPF R8 #0088 0x8C200506, // 006A GETMET R8 R2 K6 @@ -1477,7 +1477,7 @@ be_local_closure(Matter_Plugin_Root_invoke_request, /* name */ 0x7C280800, // 0084 CALL R10 4 0x900E0910, // 0085 SETMBR R3 K4 K16 0x80041200, // 0086 RET 1 R9 - 0x700201A1, // 0087 JMP #022A + 0x700201A0, // 0087 JMP #0229 0x1C200F05, // 0088 EQ R8 R7 K5 0x7822003C, // 0089 JMPF R8 #00C7 0x8C200506, // 008A GETMET R8 R2 K6 @@ -1540,7 +1540,7 @@ be_local_closure(Matter_Plugin_Root_invoke_request, /* name */ 0x7C3C0800, // 00C3 CALL R15 4 0x900E0907, // 00C4 SETMBR R3 K4 K7 0x80041C00, // 00C5 RET 1 R14 - 0x70020162, // 00C6 JMP #022A + 0x70020161, // 00C6 JMP #0229 0x54220003, // 00C7 LDINT R8 4 0x1C200E08, // 00C8 EQ R8 R7 R8 0x7822003C, // 00C9 JMPF R8 #0107 @@ -1604,7 +1604,7 @@ be_local_closure(Matter_Plugin_Root_invoke_request, /* name */ 0x54420004, // 0103 LDINT R16 5 0x900E0810, // 0104 SETMBR R3 K4 R16 0x80041E00, // 0105 RET 1 R15 - 0x70020122, // 0106 JMP #022A + 0x70020121, // 0106 JMP #0229 0x5422000A, // 0107 LDINT R8 11 0x1C200E08, // 0108 EQ R8 R7 R8 0x7822000B, // 0109 JMPF R8 #0116 @@ -1619,10 +1619,10 @@ be_local_closure(Matter_Plugin_Root_invoke_request, /* name */ 0x900E3409, // 0112 SETMBR R3 K26 R9 0x4C240000, // 0113 LDNIL R9 0x80041200, // 0114 RET 1 R9 - 0x70020113, // 0115 JMP #022A + 0x70020112, // 0115 JMP #0229 0x54220005, // 0116 LDINT R8 6 0x1C200E08, // 0117 EQ R8 R7 R8 - 0x782200B9, // 0118 JMPF R8 #01D3 + 0x782200B8, // 0118 JMPF R8 #01D2 0xB8224400, // 0119 GETNGBL R8 K34 0x8C20112C, // 011A GETMET R8 R8 K44 0x60280008, // 011B GETGBL R10 G8 @@ -1748,313 +1748,312 @@ be_local_closure(Matter_Plugin_Root_invoke_request, /* name */ 0x7C480200, // 0193 CALL R18 1 0x404E0F40, // 0194 CONNECT R19 K7 K64 0x94482413, // 0195 GETIDX R18 R18 R19 - 0x60500015, // 0196 GETGBL R20 G21 - 0x7C500000, // 0197 CALL R20 0 - 0x8C502941, // 0198 GETMET R20 R20 K65 - 0x58580042, // 0199 LDCONST R22 K66 - 0x7C500400, // 019A CALL R20 2 - 0x5C4C2800, // 019B MOVE R19 R20 - 0x8C500943, // 019C GETMET R20 R4 K67 - 0x7C500200, // 019D CALL R20 1 - 0x8C542144, // 019E GETMET R21 R16 K68 - 0x7C540200, // 019F CALL R21 1 - 0x8C542B45, // 01A0 GETMET R21 R21 K69 - 0x7C540200, // 01A1 CALL R21 1 - 0x8C582946, // 01A2 GETMET R22 R20 K70 - 0x5C602400, // 01A3 MOVE R24 R18 - 0x5C642A00, // 01A4 MOVE R25 R21 - 0x5C682600, // 01A5 MOVE R26 R19 - 0x546E0007, // 01A6 LDINT R27 8 - 0x7C580A00, // 01A7 CALL R22 5 - 0x885C0312, // 01A8 GETMBR R23 R1 K18 - 0x785E0001, // 01A9 JMPF R23 #01AC - 0x885C0312, // 01AA GETMBR R23 R1 K18 - 0x70020001, // 01AB JMP #01AE - 0x885C0116, // 01AC GETMBR R23 R0 K22 - 0x885C2F47, // 01AD GETMBR R23 R23 K71 - 0x8C601B48, // 01AE GETMET R24 R13 K72 - 0x5C682000, // 01AF MOVE R26 R16 - 0x5C6C2200, // 01B0 MOVE R27 R17 - 0x5C702C00, // 01B1 MOVE R28 R22 - 0x5C742E00, // 01B2 MOVE R29 R23 - 0x7C600A00, // 01B3 CALL R24 5 - 0x8C601B49, // 01B4 GETMET R24 R13 K73 - 0x7C600200, // 01B5 CALL R24 1 - 0x88600116, // 01B6 GETMBR R24 R0 K22 - 0x8C60314A, // 01B7 GETMET R24 R24 K74 - 0x5C681A00, // 01B8 MOVE R26 R13 - 0x7C600400, // 01B9 CALL R24 2 - 0x8C60034B, // 01BA GETMET R24 R1 K75 - 0x7C600200, // 01BB CALL R24 1 - 0x78620002, // 01BC JMPF R24 #01C0 - 0x8C60034C, // 01BD GETMET R24 R1 K76 - 0x546A003B, // 01BE LDINT R26 60 - 0x7C600400, // 01BF CALL R24 2 - 0x8C601B4D, // 01C0 GETMET R24 R13 K77 - 0x7C600200, // 01C1 CALL R24 1 - 0x8C600B09, // 01C2 GETMET R24 R5 K9 - 0x7C600200, // 01C3 CALL R24 1 - 0x8C64310A, // 01C4 GETMET R25 R24 K10 - 0x586C0005, // 01C5 LDCONST R27 K5 - 0x88700B0B, // 01C6 GETMBR R28 R5 K11 - 0xB8760200, // 01C7 GETNGBL R29 K1 - 0x88743B2B, // 01C8 GETMBR R29 R29 K43 - 0x7C640800, // 01C9 CALL R25 4 - 0x8C64310A, // 01CA GETMET R25 R24 K10 - 0x586C0007, // 01CB LDCONST R27 K7 - 0x88700B0B, // 01CC GETMBR R28 R5 K11 - 0x58740007, // 01CD LDCONST R29 K7 - 0x7C640800, // 01CE CALL R25 4 - 0x54660007, // 01CF LDINT R25 8 - 0x900E0819, // 01D0 SETMBR R3 K4 R25 - 0x80043000, // 01D1 RET 1 R24 - 0x70020056, // 01D2 JMP #022A - 0x54220008, // 01D3 LDINT R8 9 - 0x1C200E08, // 01D4 EQ R8 R7 R8 - 0x7822001E, // 01D5 JMPF R8 #01F5 - 0x8C200506, // 01D6 GETMET R8 R2 K6 - 0x58280005, // 01D7 LDCONST R10 K5 - 0x7C200400, // 01D8 CALL R8 2 - 0x8C24034E, // 01D9 GETMET R9 R1 K78 - 0x5C2C1000, // 01DA MOVE R11 R8 - 0x7C240400, // 01DB CALL R9 2 - 0xB8264400, // 01DC GETNGBL R9 K34 - 0x8C24132C, // 01DD GETMET R9 R9 K44 - 0x602C0018, // 01DE GETGBL R11 G24 - 0x5830004F, // 01DF LDCONST R12 K79 - 0x88340312, // 01E0 GETMBR R13 R1 K18 - 0x8C341B50, // 01E1 GETMET R13 R13 K80 - 0x7C340200, // 01E2 CALL R13 1 - 0x8C341B44, // 01E3 GETMET R13 R13 K68 - 0x7C340200, // 01E4 CALL R13 1 - 0x8C341B45, // 01E5 GETMET R13 R13 K69 - 0x7C340200, // 01E6 CALL R13 1 - 0x8C341B51, // 01E7 GETMET R13 R13 K81 - 0x7C340200, // 01E8 CALL R13 1 - 0x60380008, // 01E9 GETGBL R14 G8 - 0x5C3C1000, // 01EA MOVE R15 R8 - 0x7C380200, // 01EB CALL R14 1 - 0x7C2C0600, // 01EC CALL R11 3 - 0x58300010, // 01ED LDCONST R12 K16 - 0x7C240600, // 01EE CALL R9 3 - 0xB8260200, // 01EF GETNGBL R9 K1 - 0x8824132B, // 01F0 GETMBR R9 R9 K43 - 0x900E3409, // 01F1 SETMBR R3 K26 R9 - 0x4C240000, // 01F2 LDNIL R9 - 0x80041200, // 01F3 RET 1 R9 - 0x70020034, // 01F4 JMP #022A - 0x54220009, // 01F5 LDINT R8 10 - 0x1C200E08, // 01F6 EQ R8 R7 R8 - 0x78220031, // 01F7 JMPF R8 #022A - 0x8C200506, // 01F8 GETMET R8 R2 K6 - 0x58280005, // 01F9 LDCONST R10 K5 - 0x7C200400, // 01FA CALL R8 2 - 0x60240008, // 01FB GETGBL R9 G8 - 0x5C281000, // 01FC MOVE R10 R8 - 0x7C240200, // 01FD CALL R9 1 - 0x0026A409, // 01FE ADD R9 K82 R9 - 0x900E5809, // 01FF SETMBR R3 K44 R9 - 0x60240010, // 0200 GETGBL R9 G16 - 0x88280116, // 0201 GETMBR R10 R0 K22 - 0x88281530, // 0202 GETMBR R10 R10 K48 - 0x8C281553, // 0203 GETMET R10 R10 K83 - 0x7C280200, // 0204 CALL R10 1 - 0x7C240200, // 0205 CALL R9 1 - 0xA8020010, // 0206 EXBLK 0 #0218 - 0x5C281200, // 0207 MOVE R10 R9 - 0x7C280000, // 0208 CALL R10 0 - 0x8C2C1554, // 0209 GETMET R11 R10 K84 - 0x7C2C0200, // 020A CALL R11 1 - 0x1C2C1608, // 020B EQ R11 R11 R8 - 0x782E0008, // 020C JMPF R11 #0216 - 0xB82E4400, // 020D GETNGBL R11 K34 - 0x8C2C1755, // 020E GETMET R11 R11 K85 - 0x543607CF, // 020F LDINT R13 2000 - 0x84380000, // 0210 CLOSURE R14 P0 - 0x7C2C0600, // 0211 CALL R11 3 - 0x502C0200, // 0212 LDBOOL R11 1 0 - 0xA0000000, // 0213 CLOSE R0 - 0xA8040001, // 0214 EXBLK 1 1 - 0x80041600, // 0215 RET 1 R11 - 0xA0240000, // 0216 CLOSE R9 - 0x7001FFEE, // 0217 JMP #0207 - 0x58240056, // 0218 LDCONST R9 K86 - 0xAC240200, // 0219 CATCH R9 1 0 - 0xB0080000, // 021A RAISE 2 R0 R0 - 0xB8264400, // 021B GETNGBL R9 K34 - 0x8C24132C, // 021C GETMET R9 R9 K44 - 0x602C0008, // 021D GETGBL R11 G8 - 0x5C301000, // 021E MOVE R12 R8 - 0x7C2C0200, // 021F CALL R11 1 - 0x002EAE0B, // 0220 ADD R11 K87 R11 - 0x002C1758, // 0221 ADD R11 R11 K88 - 0x5830000E, // 0222 LDCONST R12 K14 - 0x7C240600, // 0223 CALL R9 3 - 0xB8260200, // 0224 GETNGBL R9 K1 - 0x88241359, // 0225 GETMBR R9 R9 K89 - 0x900E3409, // 0226 SETMBR R3 K26 R9 - 0x4C240000, // 0227 LDNIL R9 - 0xA0000000, // 0228 CLOSE R0 - 0x80041200, // 0229 RET 1 R9 - 0x7002009B, // 022A JMP #02C7 - 0x5422003B, // 022B LDINT R8 60 - 0x1C200C08, // 022C EQ R8 R6 R8 - 0x78220085, // 022D JMPF R8 #02B4 - 0x1C200F05, // 022E EQ R8 R7 K5 - 0x78220065, // 022F JMPF R8 #0296 - 0x8C200506, // 0230 GETMET R8 R2 K6 - 0x58280005, // 0231 LDCONST R10 K5 - 0x7C200400, // 0232 CALL R8 2 - 0x8C240506, // 0233 GETMET R9 R2 K6 - 0x582C0007, // 0234 LDCONST R11 K7 - 0x7C240400, // 0235 CALL R9 2 - 0x8C280506, // 0236 GETMET R10 R2 K6 - 0x5830000E, // 0237 LDCONST R12 K14 - 0x7C280400, // 0238 CALL R10 2 - 0x8C2C0506, // 0239 GETMET R11 R2 K6 - 0x58340010, // 023A LDCONST R13 K16 - 0x7C2C0400, // 023B CALL R11 2 - 0x8C300506, // 023C GETMET R12 R2 K6 - 0x543A0003, // 023D LDINT R14 4 - 0x7C300400, // 023E CALL R12 2 - 0xB8364400, // 023F GETNGBL R13 K34 - 0x8C341B2C, // 0240 GETMET R13 R13 K44 - 0x603C0018, // 0241 GETGBL R15 G24 - 0x5840005A, // 0242 LDCONST R16 K90 - 0x5C441000, // 0243 MOVE R17 R8 - 0x8C481351, // 0244 GETMET R18 R9 K81 - 0x7C480200, // 0245 CALL R18 1 - 0x5C4C1400, // 0246 MOVE R19 R10 - 0x5C501600, // 0247 MOVE R20 R11 - 0x8C541951, // 0248 GETMET R21 R12 K81 - 0x7C540200, // 0249 CALL R21 1 - 0x7C3C0C00, // 024A CALL R15 6 - 0x54420003, // 024B LDINT R16 4 - 0x7C340600, // 024C CALL R13 3 - 0x4C340000, // 024D LDNIL R13 - 0x1C34100D, // 024E EQ R13 R8 R13 - 0x7436000B, // 024F JMPT R13 #025C - 0x4C340000, // 0250 LDNIL R13 - 0x1C34120D, // 0251 EQ R13 R9 R13 - 0x74360008, // 0252 JMPT R13 #025C - 0x4C340000, // 0253 LDNIL R13 - 0x1C34140D, // 0254 EQ R13 R10 R13 - 0x74360005, // 0255 JMPT R13 #025C - 0x4C340000, // 0256 LDNIL R13 - 0x1C34160D, // 0257 EQ R13 R11 R13 - 0x74360002, // 0258 JMPT R13 #025C - 0x4C340000, // 0259 LDNIL R13 - 0x1C34180D, // 025A EQ R13 R12 R13 - 0x78360005, // 025B JMPF R13 #0262 - 0xB8360200, // 025C GETNGBL R13 K1 - 0x88341B5B, // 025D GETMBR R13 R13 K91 - 0x900E340D, // 025E SETMBR R3 K26 R13 - 0x4C340000, // 025F LDNIL R13 - 0xA0000000, // 0260 CLOSE R0 - 0x80041A00, // 0261 RET 1 R13 - 0x6034000C, // 0262 GETGBL R13 G12 - 0x5C381200, // 0263 MOVE R14 R9 - 0x7C340200, // 0264 CALL R13 1 - 0x543A001F, // 0265 LDINT R14 32 - 0x543E0040, // 0266 LDINT R15 65 - 0x00381C0F, // 0267 ADD R14 R14 R15 - 0x20341A0E, // 0268 NE R13 R13 R14 - 0x7436000B, // 0269 JMPT R13 #0276 - 0x6034000C, // 026A GETGBL R13 G12 - 0x5C381800, // 026B MOVE R14 R12 - 0x7C340200, // 026C CALL R13 1 - 0x543A000F, // 026D LDINT R14 16 - 0x14341A0E, // 026E LT R13 R13 R14 - 0x74360005, // 026F JMPT R13 #0276 - 0x6034000C, // 0270 GETGBL R13 G12 - 0x5C381800, // 0271 MOVE R14 R12 - 0x7C340200, // 0272 CALL R13 1 - 0x543A001F, // 0273 LDINT R14 32 - 0x24341A0E, // 0274 GT R13 R13 R14 - 0x7836000A, // 0275 JMPF R13 #0281 - 0xB8364400, // 0276 GETNGBL R13 K34 - 0x8C341B2C, // 0277 GETMET R13 R13 K44 - 0x583C005C, // 0278 LDCONST R15 K92 - 0x5840000E, // 0279 LDCONST R16 K14 - 0x7C340600, // 027A CALL R13 3 - 0xB8360200, // 027B GETNGBL R13 K1 - 0x88341B5D, // 027C GETMBR R13 R13 K93 - 0x900E340D, // 027D SETMBR R3 K26 R13 - 0x4C340000, // 027E LDNIL R13 - 0xA0000000, // 027F CLOSE R0 - 0x80041A00, // 0280 RET 1 R13 - 0x5436001E, // 0281 LDINT R13 31 - 0x40360A0D, // 0282 CONNECT R13 K5 R13 - 0x9434120D, // 0283 GETIDX R13 R9 R13 - 0x543A001F, // 0284 LDINT R14 32 - 0x40381D40, // 0285 CONNECT R14 R14 K64 - 0x9438120E, // 0286 GETIDX R14 R9 R14 - 0x883C0116, // 0287 GETMBR R15 R0 K22 - 0x8C3C1F5E, // 0288 GETMET R15 R15 K94 - 0x5C441000, // 0289 MOVE R17 R8 - 0x5C481600, // 028A MOVE R18 R11 - 0x5C4C1400, // 028B MOVE R19 R10 - 0x5C501800, // 028C MOVE R20 R12 - 0x5C541A00, // 028D MOVE R21 R13 - 0x5C581C00, // 028E MOVE R22 R14 - 0x8C5C035F, // 028F GETMET R23 R1 K95 - 0x7C5C0200, // 0290 CALL R23 1 - 0x7C3C1000, // 0291 CALL R15 8 - 0x503C0200, // 0292 LDBOOL R15 1 0 - 0xA0000000, // 0293 CLOSE R0 - 0x80041E00, // 0294 RET 1 R15 - 0x7002001C, // 0295 JMP #02B3 - 0x1C200F07, // 0296 EQ R8 R7 K7 - 0x78220012, // 0297 JMPF R8 #02AB - 0x8C200506, // 0298 GETMET R8 R2 K6 - 0x58280005, // 0299 LDCONST R10 K5 - 0x7C200400, // 029A CALL R8 2 - 0xB8264400, // 029B GETNGBL R9 K34 - 0x8C24132C, // 029C GETMET R9 R9 K44 - 0x602C0008, // 029D GETGBL R11 G8 - 0x5C301000, // 029E MOVE R12 R8 - 0x7C2C0200, // 029F CALL R11 1 - 0x002EC00B, // 02A0 ADD R11 K96 R11 - 0x58300010, // 02A1 LDCONST R12 K16 - 0x7C240600, // 02A2 CALL R9 3 - 0x88240116, // 02A3 GETMBR R9 R0 K22 - 0x8C241361, // 02A4 GETMET R9 R9 K97 - 0x5C2C1000, // 02A5 MOVE R11 R8 - 0x7C240400, // 02A6 CALL R9 2 - 0x50240200, // 02A7 LDBOOL R9 1 0 - 0xA0000000, // 02A8 CLOSE R0 - 0x80041200, // 02A9 RET 1 R9 - 0x70020007, // 02AA JMP #02B3 - 0x1C200F0E, // 02AB EQ R8 R7 K14 - 0x78220005, // 02AC JMPF R8 #02B3 - 0x88200116, // 02AD GETMBR R8 R0 K22 - 0x8C201162, // 02AE GETMET R8 R8 K98 - 0x7C200200, // 02AF CALL R8 1 - 0x50200200, // 02B0 LDBOOL R8 1 0 - 0xA0000000, // 02B1 CLOSE R0 - 0x80041000, // 02B2 RET 1 R8 - 0x70020012, // 02B3 JMP #02C7 - 0x54220029, // 02B4 LDINT R8 42 - 0x1C200C08, // 02B5 EQ R8 R6 R8 - 0x78220005, // 02B6 JMPF R8 #02BD - 0x1C200F05, // 02B7 EQ R8 R7 K5 - 0x78220002, // 02B8 JMPF R8 #02BC - 0x50200200, // 02B9 LDBOOL R8 1 0 - 0xA0000000, // 02BA CLOSE R0 - 0x80041000, // 02BB RET 1 R8 - 0x70020009, // 02BC JMP #02C7 - 0x60200003, // 02BD GETGBL R8 G3 - 0x5C240000, // 02BE MOVE R9 R0 - 0x7C200200, // 02BF CALL R8 1 - 0x8C201163, // 02C0 GETMET R8 R8 K99 - 0x5C280200, // 02C1 MOVE R10 R1 - 0x5C2C0400, // 02C2 MOVE R11 R2 - 0x5C300600, // 02C3 MOVE R12 R3 - 0x7C200800, // 02C4 CALL R8 4 - 0xA0000000, // 02C5 CLOSE R0 - 0x80041000, // 02C6 RET 1 R8 - 0xA0000000, // 02C7 CLOSE R0 - 0x80000000, // 02C8 RET 0 + 0x604C0015, // 0196 GETGBL R19 G21 + 0x7C4C0000, // 0197 CALL R19 0 + 0x8C4C2741, // 0198 GETMET R19 R19 K65 + 0x58540042, // 0199 LDCONST R21 K66 + 0x7C4C0400, // 019A CALL R19 2 + 0x8C500943, // 019B GETMET R20 R4 K67 + 0x7C500200, // 019C CALL R20 1 + 0x8C542144, // 019D GETMET R21 R16 K68 + 0x7C540200, // 019E CALL R21 1 + 0x8C542B45, // 019F GETMET R21 R21 K69 + 0x7C540200, // 01A0 CALL R21 1 + 0x8C582946, // 01A1 GETMET R22 R20 K70 + 0x5C602400, // 01A2 MOVE R24 R18 + 0x5C642A00, // 01A3 MOVE R25 R21 + 0x5C682600, // 01A4 MOVE R26 R19 + 0x546E0007, // 01A5 LDINT R27 8 + 0x7C580A00, // 01A6 CALL R22 5 + 0x885C0312, // 01A7 GETMBR R23 R1 K18 + 0x785E0001, // 01A8 JMPF R23 #01AB + 0x885C0312, // 01A9 GETMBR R23 R1 K18 + 0x70020001, // 01AA JMP #01AD + 0x885C0116, // 01AB GETMBR R23 R0 K22 + 0x885C2F47, // 01AC GETMBR R23 R23 K71 + 0x8C601B48, // 01AD GETMET R24 R13 K72 + 0x5C682000, // 01AE MOVE R26 R16 + 0x5C6C2200, // 01AF MOVE R27 R17 + 0x5C702C00, // 01B0 MOVE R28 R22 + 0x5C742E00, // 01B1 MOVE R29 R23 + 0x7C600A00, // 01B2 CALL R24 5 + 0x8C601B49, // 01B3 GETMET R24 R13 K73 + 0x7C600200, // 01B4 CALL R24 1 + 0x88600116, // 01B5 GETMBR R24 R0 K22 + 0x8C60314A, // 01B6 GETMET R24 R24 K74 + 0x5C681A00, // 01B7 MOVE R26 R13 + 0x7C600400, // 01B8 CALL R24 2 + 0x8C60034B, // 01B9 GETMET R24 R1 K75 + 0x7C600200, // 01BA CALL R24 1 + 0x78620002, // 01BB JMPF R24 #01BF + 0x8C60034C, // 01BC GETMET R24 R1 K76 + 0x546A003B, // 01BD LDINT R26 60 + 0x7C600400, // 01BE CALL R24 2 + 0x8C601B4D, // 01BF GETMET R24 R13 K77 + 0x7C600200, // 01C0 CALL R24 1 + 0x8C600B09, // 01C1 GETMET R24 R5 K9 + 0x7C600200, // 01C2 CALL R24 1 + 0x8C64310A, // 01C3 GETMET R25 R24 K10 + 0x586C0005, // 01C4 LDCONST R27 K5 + 0x88700B0B, // 01C5 GETMBR R28 R5 K11 + 0xB8760200, // 01C6 GETNGBL R29 K1 + 0x88743B2B, // 01C7 GETMBR R29 R29 K43 + 0x7C640800, // 01C8 CALL R25 4 + 0x8C64310A, // 01C9 GETMET R25 R24 K10 + 0x586C0007, // 01CA LDCONST R27 K7 + 0x88700B0B, // 01CB GETMBR R28 R5 K11 + 0x58740007, // 01CC LDCONST R29 K7 + 0x7C640800, // 01CD CALL R25 4 + 0x54660007, // 01CE LDINT R25 8 + 0x900E0819, // 01CF SETMBR R3 K4 R25 + 0x80043000, // 01D0 RET 1 R24 + 0x70020056, // 01D1 JMP #0229 + 0x54220008, // 01D2 LDINT R8 9 + 0x1C200E08, // 01D3 EQ R8 R7 R8 + 0x7822001E, // 01D4 JMPF R8 #01F4 + 0x8C200506, // 01D5 GETMET R8 R2 K6 + 0x58280005, // 01D6 LDCONST R10 K5 + 0x7C200400, // 01D7 CALL R8 2 + 0x8C24034E, // 01D8 GETMET R9 R1 K78 + 0x5C2C1000, // 01D9 MOVE R11 R8 + 0x7C240400, // 01DA CALL R9 2 + 0xB8264400, // 01DB GETNGBL R9 K34 + 0x8C24132C, // 01DC GETMET R9 R9 K44 + 0x602C0018, // 01DD GETGBL R11 G24 + 0x5830004F, // 01DE LDCONST R12 K79 + 0x88340312, // 01DF GETMBR R13 R1 K18 + 0x8C341B50, // 01E0 GETMET R13 R13 K80 + 0x7C340200, // 01E1 CALL R13 1 + 0x8C341B44, // 01E2 GETMET R13 R13 K68 + 0x7C340200, // 01E3 CALL R13 1 + 0x8C341B45, // 01E4 GETMET R13 R13 K69 + 0x7C340200, // 01E5 CALL R13 1 + 0x8C341B51, // 01E6 GETMET R13 R13 K81 + 0x7C340200, // 01E7 CALL R13 1 + 0x60380008, // 01E8 GETGBL R14 G8 + 0x5C3C1000, // 01E9 MOVE R15 R8 + 0x7C380200, // 01EA CALL R14 1 + 0x7C2C0600, // 01EB CALL R11 3 + 0x58300010, // 01EC LDCONST R12 K16 + 0x7C240600, // 01ED CALL R9 3 + 0xB8260200, // 01EE GETNGBL R9 K1 + 0x8824132B, // 01EF GETMBR R9 R9 K43 + 0x900E3409, // 01F0 SETMBR R3 K26 R9 + 0x4C240000, // 01F1 LDNIL R9 + 0x80041200, // 01F2 RET 1 R9 + 0x70020034, // 01F3 JMP #0229 + 0x54220009, // 01F4 LDINT R8 10 + 0x1C200E08, // 01F5 EQ R8 R7 R8 + 0x78220031, // 01F6 JMPF R8 #0229 + 0x8C200506, // 01F7 GETMET R8 R2 K6 + 0x58280005, // 01F8 LDCONST R10 K5 + 0x7C200400, // 01F9 CALL R8 2 + 0x60240008, // 01FA GETGBL R9 G8 + 0x5C281000, // 01FB MOVE R10 R8 + 0x7C240200, // 01FC CALL R9 1 + 0x0026A409, // 01FD ADD R9 K82 R9 + 0x900E5809, // 01FE SETMBR R3 K44 R9 + 0x60240010, // 01FF GETGBL R9 G16 + 0x88280116, // 0200 GETMBR R10 R0 K22 + 0x88281530, // 0201 GETMBR R10 R10 K48 + 0x8C281553, // 0202 GETMET R10 R10 K83 + 0x7C280200, // 0203 CALL R10 1 + 0x7C240200, // 0204 CALL R9 1 + 0xA8020010, // 0205 EXBLK 0 #0217 + 0x5C281200, // 0206 MOVE R10 R9 + 0x7C280000, // 0207 CALL R10 0 + 0x8C2C1554, // 0208 GETMET R11 R10 K84 + 0x7C2C0200, // 0209 CALL R11 1 + 0x1C2C1608, // 020A EQ R11 R11 R8 + 0x782E0008, // 020B JMPF R11 #0215 + 0xB82E4400, // 020C GETNGBL R11 K34 + 0x8C2C1755, // 020D GETMET R11 R11 K85 + 0x543607CF, // 020E LDINT R13 2000 + 0x84380000, // 020F CLOSURE R14 P0 + 0x7C2C0600, // 0210 CALL R11 3 + 0x502C0200, // 0211 LDBOOL R11 1 0 + 0xA0000000, // 0212 CLOSE R0 + 0xA8040001, // 0213 EXBLK 1 1 + 0x80041600, // 0214 RET 1 R11 + 0xA0240000, // 0215 CLOSE R9 + 0x7001FFEE, // 0216 JMP #0206 + 0x58240056, // 0217 LDCONST R9 K86 + 0xAC240200, // 0218 CATCH R9 1 0 + 0xB0080000, // 0219 RAISE 2 R0 R0 + 0xB8264400, // 021A GETNGBL R9 K34 + 0x8C24132C, // 021B GETMET R9 R9 K44 + 0x602C0008, // 021C GETGBL R11 G8 + 0x5C301000, // 021D MOVE R12 R8 + 0x7C2C0200, // 021E CALL R11 1 + 0x002EAE0B, // 021F ADD R11 K87 R11 + 0x002C1758, // 0220 ADD R11 R11 K88 + 0x5830000E, // 0221 LDCONST R12 K14 + 0x7C240600, // 0222 CALL R9 3 + 0xB8260200, // 0223 GETNGBL R9 K1 + 0x88241359, // 0224 GETMBR R9 R9 K89 + 0x900E3409, // 0225 SETMBR R3 K26 R9 + 0x4C240000, // 0226 LDNIL R9 + 0xA0000000, // 0227 CLOSE R0 + 0x80041200, // 0228 RET 1 R9 + 0x7002009B, // 0229 JMP #02C6 + 0x5422003B, // 022A LDINT R8 60 + 0x1C200C08, // 022B EQ R8 R6 R8 + 0x78220085, // 022C JMPF R8 #02B3 + 0x1C200F05, // 022D EQ R8 R7 K5 + 0x78220065, // 022E JMPF R8 #0295 + 0x8C200506, // 022F GETMET R8 R2 K6 + 0x58280005, // 0230 LDCONST R10 K5 + 0x7C200400, // 0231 CALL R8 2 + 0x8C240506, // 0232 GETMET R9 R2 K6 + 0x582C0007, // 0233 LDCONST R11 K7 + 0x7C240400, // 0234 CALL R9 2 + 0x8C280506, // 0235 GETMET R10 R2 K6 + 0x5830000E, // 0236 LDCONST R12 K14 + 0x7C280400, // 0237 CALL R10 2 + 0x8C2C0506, // 0238 GETMET R11 R2 K6 + 0x58340010, // 0239 LDCONST R13 K16 + 0x7C2C0400, // 023A CALL R11 2 + 0x8C300506, // 023B GETMET R12 R2 K6 + 0x543A0003, // 023C LDINT R14 4 + 0x7C300400, // 023D CALL R12 2 + 0xB8364400, // 023E GETNGBL R13 K34 + 0x8C341B2C, // 023F GETMET R13 R13 K44 + 0x603C0018, // 0240 GETGBL R15 G24 + 0x5840005A, // 0241 LDCONST R16 K90 + 0x5C441000, // 0242 MOVE R17 R8 + 0x8C481351, // 0243 GETMET R18 R9 K81 + 0x7C480200, // 0244 CALL R18 1 + 0x5C4C1400, // 0245 MOVE R19 R10 + 0x5C501600, // 0246 MOVE R20 R11 + 0x8C541951, // 0247 GETMET R21 R12 K81 + 0x7C540200, // 0248 CALL R21 1 + 0x7C3C0C00, // 0249 CALL R15 6 + 0x54420003, // 024A LDINT R16 4 + 0x7C340600, // 024B CALL R13 3 + 0x4C340000, // 024C LDNIL R13 + 0x1C34100D, // 024D EQ R13 R8 R13 + 0x7436000B, // 024E JMPT R13 #025B + 0x4C340000, // 024F LDNIL R13 + 0x1C34120D, // 0250 EQ R13 R9 R13 + 0x74360008, // 0251 JMPT R13 #025B + 0x4C340000, // 0252 LDNIL R13 + 0x1C34140D, // 0253 EQ R13 R10 R13 + 0x74360005, // 0254 JMPT R13 #025B + 0x4C340000, // 0255 LDNIL R13 + 0x1C34160D, // 0256 EQ R13 R11 R13 + 0x74360002, // 0257 JMPT R13 #025B + 0x4C340000, // 0258 LDNIL R13 + 0x1C34180D, // 0259 EQ R13 R12 R13 + 0x78360005, // 025A JMPF R13 #0261 + 0xB8360200, // 025B GETNGBL R13 K1 + 0x88341B5B, // 025C GETMBR R13 R13 K91 + 0x900E340D, // 025D SETMBR R3 K26 R13 + 0x4C340000, // 025E LDNIL R13 + 0xA0000000, // 025F CLOSE R0 + 0x80041A00, // 0260 RET 1 R13 + 0x6034000C, // 0261 GETGBL R13 G12 + 0x5C381200, // 0262 MOVE R14 R9 + 0x7C340200, // 0263 CALL R13 1 + 0x543A001F, // 0264 LDINT R14 32 + 0x543E0040, // 0265 LDINT R15 65 + 0x00381C0F, // 0266 ADD R14 R14 R15 + 0x20341A0E, // 0267 NE R13 R13 R14 + 0x7436000B, // 0268 JMPT R13 #0275 + 0x6034000C, // 0269 GETGBL R13 G12 + 0x5C381800, // 026A MOVE R14 R12 + 0x7C340200, // 026B CALL R13 1 + 0x543A000F, // 026C LDINT R14 16 + 0x14341A0E, // 026D LT R13 R13 R14 + 0x74360005, // 026E JMPT R13 #0275 + 0x6034000C, // 026F GETGBL R13 G12 + 0x5C381800, // 0270 MOVE R14 R12 + 0x7C340200, // 0271 CALL R13 1 + 0x543A001F, // 0272 LDINT R14 32 + 0x24341A0E, // 0273 GT R13 R13 R14 + 0x7836000A, // 0274 JMPF R13 #0280 + 0xB8364400, // 0275 GETNGBL R13 K34 + 0x8C341B2C, // 0276 GETMET R13 R13 K44 + 0x583C005C, // 0277 LDCONST R15 K92 + 0x5840000E, // 0278 LDCONST R16 K14 + 0x7C340600, // 0279 CALL R13 3 + 0xB8360200, // 027A GETNGBL R13 K1 + 0x88341B5D, // 027B GETMBR R13 R13 K93 + 0x900E340D, // 027C SETMBR R3 K26 R13 + 0x4C340000, // 027D LDNIL R13 + 0xA0000000, // 027E CLOSE R0 + 0x80041A00, // 027F RET 1 R13 + 0x5436001E, // 0280 LDINT R13 31 + 0x40360A0D, // 0281 CONNECT R13 K5 R13 + 0x9434120D, // 0282 GETIDX R13 R9 R13 + 0x543A001F, // 0283 LDINT R14 32 + 0x40381D40, // 0284 CONNECT R14 R14 K64 + 0x9438120E, // 0285 GETIDX R14 R9 R14 + 0x883C0116, // 0286 GETMBR R15 R0 K22 + 0x8C3C1F5E, // 0287 GETMET R15 R15 K94 + 0x5C441000, // 0288 MOVE R17 R8 + 0x5C481600, // 0289 MOVE R18 R11 + 0x5C4C1400, // 028A MOVE R19 R10 + 0x5C501800, // 028B MOVE R20 R12 + 0x5C541A00, // 028C MOVE R21 R13 + 0x5C581C00, // 028D MOVE R22 R14 + 0x8C5C035F, // 028E GETMET R23 R1 K95 + 0x7C5C0200, // 028F CALL R23 1 + 0x7C3C1000, // 0290 CALL R15 8 + 0x503C0200, // 0291 LDBOOL R15 1 0 + 0xA0000000, // 0292 CLOSE R0 + 0x80041E00, // 0293 RET 1 R15 + 0x7002001C, // 0294 JMP #02B2 + 0x1C200F07, // 0295 EQ R8 R7 K7 + 0x78220012, // 0296 JMPF R8 #02AA + 0x8C200506, // 0297 GETMET R8 R2 K6 + 0x58280005, // 0298 LDCONST R10 K5 + 0x7C200400, // 0299 CALL R8 2 + 0xB8264400, // 029A GETNGBL R9 K34 + 0x8C24132C, // 029B GETMET R9 R9 K44 + 0x602C0008, // 029C GETGBL R11 G8 + 0x5C301000, // 029D MOVE R12 R8 + 0x7C2C0200, // 029E CALL R11 1 + 0x002EC00B, // 029F ADD R11 K96 R11 + 0x58300010, // 02A0 LDCONST R12 K16 + 0x7C240600, // 02A1 CALL R9 3 + 0x88240116, // 02A2 GETMBR R9 R0 K22 + 0x8C241361, // 02A3 GETMET R9 R9 K97 + 0x5C2C1000, // 02A4 MOVE R11 R8 + 0x7C240400, // 02A5 CALL R9 2 + 0x50240200, // 02A6 LDBOOL R9 1 0 + 0xA0000000, // 02A7 CLOSE R0 + 0x80041200, // 02A8 RET 1 R9 + 0x70020007, // 02A9 JMP #02B2 + 0x1C200F0E, // 02AA EQ R8 R7 K14 + 0x78220005, // 02AB JMPF R8 #02B2 + 0x88200116, // 02AC GETMBR R8 R0 K22 + 0x8C201162, // 02AD GETMET R8 R8 K98 + 0x7C200200, // 02AE CALL R8 1 + 0x50200200, // 02AF LDBOOL R8 1 0 + 0xA0000000, // 02B0 CLOSE R0 + 0x80041000, // 02B1 RET 1 R8 + 0x70020012, // 02B2 JMP #02C6 + 0x54220029, // 02B3 LDINT R8 42 + 0x1C200C08, // 02B4 EQ R8 R6 R8 + 0x78220005, // 02B5 JMPF R8 #02BC + 0x1C200F05, // 02B6 EQ R8 R7 K5 + 0x78220002, // 02B7 JMPF R8 #02BB + 0x50200200, // 02B8 LDBOOL R8 1 0 + 0xA0000000, // 02B9 CLOSE R0 + 0x80041000, // 02BA RET 1 R8 + 0x70020009, // 02BB JMP #02C6 + 0x60200003, // 02BC GETGBL R8 G3 + 0x5C240000, // 02BD MOVE R9 R0 + 0x7C200200, // 02BE CALL R8 1 + 0x8C201163, // 02BF GETMET R8 R8 K99 + 0x5C280200, // 02C0 MOVE R10 R1 + 0x5C2C0400, // 02C1 MOVE R11 R2 + 0x5C300600, // 02C2 MOVE R12 R3 + 0x7C200800, // 02C3 CALL R8 4 + 0xA0000000, // 02C4 CLOSE R0 + 0x80041000, // 02C5 RET 1 R8 + 0xA0000000, // 02C6 CLOSE R0 + 0x80000000, // 02C7 RET 0 }) ) ); diff --git a/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_2_Light0.h b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_2_Light0.h deleted file mode 100644 index bd25d7a01..000000000 --- a/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_2_Light0.h +++ /dev/null @@ -1,511 +0,0 @@ -/* Solidification of Matter_Plugin_2_Light0.h */ -/********************************************************************\ -* Generated code, don't edit * -\********************************************************************/ -#include "be_constobj.h" - -extern const bclass be_class_Matter_Plugin_Light0; - -/******************************************************************** -** Solidified function: read_attribute -********************************************************************/ -be_local_closure(Matter_Plugin_Light0_read_attribute, /* name */ - be_nested_proto( - 12, /* nstack */ - 4, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[11]) { /* constants */ - /* K0 */ be_nested_str_weak(matter), - /* K1 */ be_nested_str_weak(TLV), - /* K2 */ be_nested_str_weak(cluster), - /* K3 */ be_nested_str_weak(attribute), - /* K4 */ be_nested_str_weak(update_shadow_lazy), - /* K5 */ be_const_int(0), - /* K6 */ be_nested_str_weak(set), - /* K7 */ be_nested_str_weak(BOOL), - /* K8 */ be_nested_str_weak(shadow_onoff), - /* K9 */ be_nested_str_weak(U4), - /* K10 */ be_nested_str_weak(read_attribute), - }), - be_str_weak(read_attribute), - &be_const_str_solidified, - ( &(const binstruction[45]) { /* code */ - 0xB8120000, // 0000 GETNGBL R4 K0 - 0x88100901, // 0001 GETMBR R4 R4 K1 - 0x88140502, // 0002 GETMBR R5 R2 K2 - 0x88180503, // 0003 GETMBR R6 R2 K3 - 0x541E0005, // 0004 LDINT R7 6 - 0x1C1C0A07, // 0005 EQ R7 R5 R7 - 0x781E001B, // 0006 JMPF R7 #0023 - 0x8C1C0104, // 0007 GETMET R7 R0 K4 - 0x7C1C0200, // 0008 CALL R7 1 - 0x1C1C0D05, // 0009 EQ R7 R6 K5 - 0x781E0005, // 000A JMPF R7 #0011 - 0x8C1C0706, // 000B GETMET R7 R3 K6 - 0x88240907, // 000C GETMBR R9 R4 K7 - 0x88280108, // 000D GETMBR R10 R0 K8 - 0x7C1C0600, // 000E CALL R7 3 - 0x80040E00, // 000F RET 1 R7 - 0x70020010, // 0010 JMP #0022 - 0x541EFFFB, // 0011 LDINT R7 65532 - 0x1C1C0C07, // 0012 EQ R7 R6 R7 - 0x781E0005, // 0013 JMPF R7 #001A - 0x8C1C0706, // 0014 GETMET R7 R3 K6 - 0x88240909, // 0015 GETMBR R9 R4 K9 - 0x58280005, // 0016 LDCONST R10 K5 - 0x7C1C0600, // 0017 CALL R7 3 - 0x80040E00, // 0018 RET 1 R7 - 0x70020007, // 0019 JMP #0022 - 0x541EFFFC, // 001A LDINT R7 65533 - 0x1C1C0C07, // 001B EQ R7 R6 R7 - 0x781E0004, // 001C JMPF R7 #0022 - 0x8C1C0706, // 001D GETMET R7 R3 K6 - 0x88240909, // 001E GETMBR R9 R4 K9 - 0x542A0003, // 001F LDINT R10 4 - 0x7C1C0600, // 0020 CALL R7 3 - 0x80040E00, // 0021 RET 1 R7 - 0x70020008, // 0022 JMP #002C - 0x601C0003, // 0023 GETGBL R7 G3 - 0x5C200000, // 0024 MOVE R8 R0 - 0x7C1C0200, // 0025 CALL R7 1 - 0x8C1C0F0A, // 0026 GETMET R7 R7 K10 - 0x5C240200, // 0027 MOVE R9 R1 - 0x5C280400, // 0028 MOVE R10 R2 - 0x5C2C0600, // 0029 MOVE R11 R3 - 0x7C1C0800, // 002A CALL R7 4 - 0x80040E00, // 002B RET 1 R7 - 0x80000000, // 002C RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: set_onoff -********************************************************************/ -be_local_closure(Matter_Plugin_Light0_set_onoff, /* name */ - be_nested_proto( - 6, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 8]) { /* constants */ - /* K0 */ be_nested_str_weak(VIRTUAL), - /* K1 */ be_nested_str_weak(light), - /* K2 */ be_nested_str_weak(set), - /* K3 */ be_nested_str_weak(power), - /* K4 */ be_nested_str_weak(update_shadow), - /* K5 */ be_nested_str_weak(shadow_onoff), - /* K6 */ be_nested_str_weak(attribute_updated), - /* K7 */ be_const_int(0), - }), - be_str_weak(set_onoff), - &be_const_str_solidified, - ( &(const binstruction[20]) { /* code */ - 0x88080100, // 0000 GETMBR R2 R0 K0 - 0x740A0008, // 0001 JMPT R2 #000B - 0xA40A0200, // 0002 IMPORT R2 K1 - 0x8C0C0502, // 0003 GETMET R3 R2 K2 - 0x60140013, // 0004 GETGBL R5 G19 - 0x7C140000, // 0005 CALL R5 0 - 0x98160601, // 0006 SETIDX R5 K3 R1 - 0x7C0C0400, // 0007 CALL R3 2 - 0x8C0C0104, // 0008 GETMET R3 R0 K4 - 0x7C0C0200, // 0009 CALL R3 1 - 0x70020007, // 000A JMP #0013 - 0x88080105, // 000B GETMBR R2 R0 K5 - 0x20080202, // 000C NE R2 R1 R2 - 0x780A0004, // 000D JMPF R2 #0013 - 0x8C080106, // 000E GETMET R2 R0 K6 - 0x54120005, // 000F LDINT R4 6 - 0x58140007, // 0010 LDCONST R5 K7 - 0x7C080600, // 0011 CALL R2 3 - 0x90020A01, // 0012 SETMBR R0 K5 R1 - 0x80000000, // 0013 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: update_virtual -********************************************************************/ -be_local_closure(Matter_Plugin_Light0_update_virtual, /* name */ - be_nested_proto( - 7, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 4]) { /* constants */ - /* K0 */ be_nested_str_weak(find), - /* K1 */ be_nested_str_weak(Power), - /* K2 */ be_nested_str_weak(set_onoff), - /* K3 */ be_nested_str_weak(update_virtual), - }), - be_str_weak(update_virtual), - &be_const_str_solidified, - ( &(const binstruction[18]) { /* code */ - 0x8C080300, // 0000 GETMET R2 R1 K0 - 0x58100001, // 0001 LDCONST R4 K1 - 0x7C080400, // 0002 CALL R2 2 - 0x4C0C0000, // 0003 LDNIL R3 - 0x200C0403, // 0004 NE R3 R2 R3 - 0x780E0004, // 0005 JMPF R3 #000B - 0x8C0C0102, // 0006 GETMET R3 R0 K2 - 0x60140017, // 0007 GETGBL R5 G23 - 0x5C180400, // 0008 MOVE R6 R2 - 0x7C140200, // 0009 CALL R5 1 - 0x7C0C0400, // 000A CALL R3 2 - 0x600C0003, // 000B GETGBL R3 G3 - 0x5C100000, // 000C MOVE R4 R0 - 0x7C0C0200, // 000D CALL R3 1 - 0x8C0C0703, // 000E GETMET R3 R3 K3 - 0x5C140200, // 000F MOVE R5 R1 - 0x7C0C0400, // 0010 CALL R3 2 - 0x80000000, // 0011 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: init -********************************************************************/ -be_local_closure(Matter_Plugin_Light0_init, /* name */ - be_nested_proto( - 9, /* nstack */ - 4, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 2]) { /* constants */ - /* K0 */ be_nested_str_weak(init), - /* K1 */ be_nested_str_weak(shadow_onoff), - }), - be_str_weak(init), - &be_const_str_solidified, - ( &(const binstruction[11]) { /* code */ - 0x60100003, // 0000 GETGBL R4 G3 - 0x5C140000, // 0001 MOVE R5 R0 - 0x7C100200, // 0002 CALL R4 1 - 0x8C100900, // 0003 GETMET R4 R4 K0 - 0x5C180200, // 0004 MOVE R6 R1 - 0x5C1C0400, // 0005 MOVE R7 R2 - 0x5C200600, // 0006 MOVE R8 R3 - 0x7C100800, // 0007 CALL R4 4 - 0x50100000, // 0008 LDBOOL R4 0 0 - 0x90020204, // 0009 SETMBR R0 K1 R4 - 0x80000000, // 000A RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: update_shadow -********************************************************************/ -be_local_closure(Matter_Plugin_Light0_update_shadow, /* name */ - be_nested_proto( - 8, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 9]) { /* constants */ - /* K0 */ be_nested_str_weak(VIRTUAL), - /* K1 */ be_nested_str_weak(light), - /* K2 */ be_nested_str_weak(get), - /* K3 */ be_nested_str_weak(find), - /* K4 */ be_nested_str_weak(power), - /* K5 */ be_nested_str_weak(shadow_onoff), - /* K6 */ be_nested_str_weak(attribute_updated), - /* K7 */ be_const_int(0), - /* K8 */ be_nested_str_weak(update_shadow), - }), - be_str_weak(update_shadow), - &be_const_str_solidified, - ( &(const binstruction[26]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x74060011, // 0001 JMPT R1 #0014 - 0xA4060200, // 0002 IMPORT R1 K1 - 0x8C080302, // 0003 GETMET R2 R1 K2 - 0x7C080200, // 0004 CALL R2 1 - 0x4C0C0000, // 0005 LDNIL R3 - 0x200C0403, // 0006 NE R3 R2 R3 - 0x780E000B, // 0007 JMPF R3 #0014 - 0x8C0C0503, // 0008 GETMET R3 R2 K3 - 0x58140004, // 0009 LDCONST R5 K4 - 0x4C180000, // 000A LDNIL R6 - 0x7C0C0600, // 000B CALL R3 3 - 0x88100105, // 000C GETMBR R4 R0 K5 - 0x20100604, // 000D NE R4 R3 R4 - 0x78120004, // 000E JMPF R4 #0014 - 0x8C100106, // 000F GETMET R4 R0 K6 - 0x541A0005, // 0010 LDINT R6 6 - 0x581C0007, // 0011 LDCONST R7 K7 - 0x7C100600, // 0012 CALL R4 3 - 0x90020A03, // 0013 SETMBR R0 K5 R3 - 0x60040003, // 0014 GETGBL R1 G3 - 0x5C080000, // 0015 MOVE R2 R0 - 0x7C040200, // 0016 CALL R1 1 - 0x8C040308, // 0017 GETMET R1 R1 K8 - 0x7C040200, // 0018 CALL R1 1 - 0x80000000, // 0019 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: invoke_request -********************************************************************/ -be_local_closure(Matter_Plugin_Light0_invoke_request, /* name */ - be_nested_proto( - 12, /* nstack */ - 4, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[13]) { /* constants */ - /* K0 */ be_nested_str_weak(light), - /* K1 */ be_nested_str_weak(matter), - /* K2 */ be_nested_str_weak(TLV), - /* K3 */ be_nested_str_weak(cluster), - /* K4 */ be_nested_str_weak(command), - /* K5 */ be_nested_str_weak(update_shadow_lazy), - /* K6 */ be_const_int(0), - /* K7 */ be_nested_str_weak(set_onoff), - /* K8 */ be_nested_str_weak(publish_command), - /* K9 */ be_nested_str_weak(Power), - /* K10 */ be_const_int(1), - /* K11 */ be_const_int(2), - /* K12 */ be_nested_str_weak(shadow_onoff), - }), - be_str_weak(invoke_request), - &be_const_str_solidified, - ( &(const binstruction[53]) { /* code */ - 0xA4120000, // 0000 IMPORT R4 K0 - 0xB8160200, // 0001 GETNGBL R5 K1 - 0x88140B02, // 0002 GETMBR R5 R5 K2 - 0x88180703, // 0003 GETMBR R6 R3 K3 - 0x881C0704, // 0004 GETMBR R7 R3 K4 - 0x54220005, // 0005 LDINT R8 6 - 0x1C200C08, // 0006 EQ R8 R6 R8 - 0x7822002B, // 0007 JMPF R8 #0034 - 0x8C200105, // 0008 GETMET R8 R0 K5 - 0x7C200200, // 0009 CALL R8 1 - 0x1C200F06, // 000A EQ R8 R7 K6 - 0x78220009, // 000B JMPF R8 #0016 - 0x8C200107, // 000C GETMET R8 R0 K7 - 0x50280000, // 000D LDBOOL R10 0 0 - 0x7C200400, // 000E CALL R8 2 - 0x8C200108, // 000F GETMET R8 R0 K8 - 0x58280009, // 0010 LDCONST R10 K9 - 0x582C0006, // 0011 LDCONST R11 K6 - 0x7C200600, // 0012 CALL R8 3 - 0x50200200, // 0013 LDBOOL R8 1 0 - 0x80041000, // 0014 RET 1 R8 - 0x7002001D, // 0015 JMP #0034 - 0x1C200F0A, // 0016 EQ R8 R7 K10 - 0x78220009, // 0017 JMPF R8 #0022 - 0x8C200107, // 0018 GETMET R8 R0 K7 - 0x50280200, // 0019 LDBOOL R10 1 0 - 0x7C200400, // 001A CALL R8 2 - 0x8C200108, // 001B GETMET R8 R0 K8 - 0x58280009, // 001C LDCONST R10 K9 - 0x582C000A, // 001D LDCONST R11 K10 - 0x7C200600, // 001E CALL R8 3 - 0x50200200, // 001F LDBOOL R8 1 0 - 0x80041000, // 0020 RET 1 R8 - 0x70020011, // 0021 JMP #0034 - 0x1C200F0B, // 0022 EQ R8 R7 K11 - 0x7822000F, // 0023 JMPF R8 #0034 - 0x8C200107, // 0024 GETMET R8 R0 K7 - 0x8828010C, // 0025 GETMBR R10 R0 K12 - 0x782A0000, // 0026 JMPF R10 #0028 - 0x50280001, // 0027 LDBOOL R10 0 1 - 0x50280200, // 0028 LDBOOL R10 1 0 - 0x7C200400, // 0029 CALL R8 2 - 0x8C200108, // 002A GETMET R8 R0 K8 - 0x58280009, // 002B LDCONST R10 K9 - 0x882C010C, // 002C GETMBR R11 R0 K12 - 0x782E0001, // 002D JMPF R11 #0030 - 0x582C000A, // 002E LDCONST R11 K10 - 0x70020000, // 002F JMP #0031 - 0x582C0006, // 0030 LDCONST R11 K6 - 0x7C200600, // 0031 CALL R8 3 - 0x50200200, // 0032 LDBOOL R8 1 0 - 0x80041000, // 0033 RET 1 R8 - 0x80000000, // 0034 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: find_val_i -********************************************************************/ -be_local_closure(Matter_Plugin_Light0_find_val_i, /* name */ - be_nested_proto( - 7, /* nstack */ - 2, /* argc */ - 4, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 4]) { /* constants */ - /* K0 */ be_const_class(be_class_Matter_Plugin_Light0), - /* K1 */ be_nested_str_weak(tasmota), - /* K2 */ be_nested_str_weak(find_key_i), - /* K3 */ be_nested_str_weak(find), - }), - be_str_weak(find_val_i), - &be_const_str_solidified, - ( &(const binstruction[10]) { /* code */ - 0x58080000, // 0000 LDCONST R2 K0 - 0xB80E0200, // 0001 GETNGBL R3 K1 - 0x8C0C0702, // 0002 GETMET R3 R3 K2 - 0x5C140000, // 0003 MOVE R5 R0 - 0x5C180200, // 0004 MOVE R6 R1 - 0x7C0C0600, // 0005 CALL R3 3 - 0x8C100103, // 0006 GETMET R4 R0 K3 - 0x5C180600, // 0007 MOVE R6 R3 - 0x7C100400, // 0008 CALL R4 2 - 0x80040800, // 0009 RET 1 R4 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified class: Matter_Plugin_Light0 -********************************************************************/ -extern const bclass be_class_Matter_Plugin_Device; -be_local_class(Matter_Plugin_Light0, - 1, - &be_class_Matter_Plugin_Device, - be_nested_map(14, - ( (struct bmapnode*) &(const bmapnode[]) { - { be_const_key_weak(read_attribute, 9), be_const_closure(Matter_Plugin_Light0_read_attribute_closure) }, - { be_const_key_weak(UPDATE_TIME, 4), be_const_int(250) }, - { be_const_key_weak(update_virtual, 1), be_const_closure(Matter_Plugin_Light0_update_virtual_closure) }, - { be_const_key_weak(UPDATE_COMMANDS, 13), be_const_simple_instance(be_nested_simple_instance(&be_class_list, { - be_const_list( * be_nested_list(1, - ( (struct bvalue*) &(const bvalue[]) { - be_nested_str_weak(Power), - })) ) } )) }, - { be_const_key_weak(find_val_i, -1), be_const_static_closure(Matter_Plugin_Light0_find_val_i_closure) }, - { be_const_key_weak(init, 11), be_const_closure(Matter_Plugin_Light0_init_closure) }, - { be_const_key_weak(set_onoff, 12), be_const_closure(Matter_Plugin_Light0_set_onoff_closure) }, - { be_const_key_weak(update_shadow, 8), be_const_closure(Matter_Plugin_Light0_update_shadow_closure) }, - { be_const_key_weak(invoke_request, -1), be_const_closure(Matter_Plugin_Light0_invoke_request_closure) }, - { be_const_key_weak(CLUSTERS, -1), be_const_simple_instance(be_nested_simple_instance(&be_class_map, { - be_const_map( * be_nested_map(6, - ( (struct bmapnode*) &(const bmapnode[]) { - { be_const_key_int(6, -1), be_const_simple_instance(be_nested_simple_instance(&be_class_list, { - be_const_list( * be_nested_list(3, - ( (struct bvalue*) &(const bvalue[]) { - be_const_int(0), - be_const_int(65532), - be_const_int(65533), - })) ) } )) }, - { be_const_key_int(5, -1), be_const_simple_instance(be_nested_simple_instance(&be_class_list, { - be_const_list( * be_nested_list(8, - ( (struct bvalue*) &(const bvalue[]) { - be_const_int(0), - be_const_int(1), - be_const_int(2), - be_const_int(3), - be_const_int(4), - be_const_int(5), - be_const_int(65532), - be_const_int(65533), - })) ) } )) }, - { be_const_key_int(57, -1), be_const_simple_instance(be_nested_simple_instance(&be_class_list, { - be_const_list( * be_nested_list(7, - ( (struct bvalue*) &(const bvalue[]) { - be_const_int(17), - be_const_int(3), - be_const_int(5), - be_const_int(10), - be_const_int(15), - be_const_int(17), - be_const_int(18), - })) ) } )) }, - { be_const_key_int(3, 2), be_const_simple_instance(be_nested_simple_instance(&be_class_list, { - be_const_list( * be_nested_list(4, - ( (struct bvalue*) &(const bvalue[]) { - be_const_int(0), - be_const_int(1), - be_const_int(65532), - be_const_int(65533), - })) ) } )) }, - { be_const_key_int(4, -1), be_const_simple_instance(be_nested_simple_instance(&be_class_list, { - be_const_list( * be_nested_list(3, - ( (struct bvalue*) &(const bvalue[]) { - be_const_int(0), - be_const_int(65532), - be_const_int(65533), - })) ) } )) }, - { be_const_key_int(29, 1), be_const_simple_instance(be_nested_simple_instance(&be_class_list, { - be_const_list( * be_nested_list(6, - ( (struct bvalue*) &(const bvalue[]) { - be_const_int(0), - be_const_int(1), - be_const_int(2), - be_const_int(3), - be_const_int(65532), - be_const_int(65533), - })) ) } )) }, - })) ) } )) }, - { be_const_key_weak(TYPES, -1), be_const_simple_instance(be_nested_simple_instance(&be_class_map, { - be_const_map( * be_nested_map(1, - ( (struct bmapnode*) &(const bmapnode[]) { - { be_const_key_int(256, -1), be_const_int(2) }, - })) ) } )) }, - { be_const_key_weak(DISPLAY_NAME, -1), be_nested_str_weak(Light_X200_X20On) }, - { be_const_key_weak(shadow_onoff, -1), be_const_var(0) }, - { be_const_key_weak(TYPE, -1), be_nested_str_weak(light0) }, - })), - be_str_weak(Matter_Plugin_Light0) -); -/*******************************************************************/ - -void be_load_Matter_Plugin_Light0_class(bvm *vm) { - be_pushntvclass(vm, &be_class_Matter_Plugin_Light0); - be_setglobal(vm, "Matter_Plugin_Light0"); - be_pop(vm, 1); -} -/********************************************************************/ -/* End of solidification */ diff --git a/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_2_Light1.h b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_2_Light1.h new file mode 100644 index 000000000..d802a1c5f --- /dev/null +++ b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_2_Light1.h @@ -0,0 +1,828 @@ +/* Solidification of Matter_Plugin_2_Light1.h */ +/********************************************************************\ +* Generated code, don't edit * +\********************************************************************/ +#include "be_constobj.h" + +extern const bclass be_class_Matter_Plugin_Light1; + +/******************************************************************** +** Solidified function: init +********************************************************************/ +be_local_closure(Matter_Plugin_Light1_init, /* name */ + be_nested_proto( + 9, /* nstack */ + 4, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 4]) { /* constants */ + /* K0 */ be_nested_str_weak(init), + /* K1 */ be_nested_str_weak(shadow_onoff), + /* K2 */ be_nested_str_weak(shadow_bri), + /* K3 */ be_const_int(0), + }), + be_str_weak(init), + &be_const_str_solidified, + ( &(const binstruction[12]) { /* code */ + 0x60100003, // 0000 GETGBL R4 G3 + 0x5C140000, // 0001 MOVE R5 R0 + 0x7C100200, // 0002 CALL R4 1 + 0x8C100900, // 0003 GETMET R4 R4 K0 + 0x5C180200, // 0004 MOVE R6 R1 + 0x5C1C0400, // 0005 MOVE R7 R2 + 0x5C200600, // 0006 MOVE R8 R3 + 0x7C100800, // 0007 CALL R4 4 + 0x50100000, // 0008 LDBOOL R4 0 0 + 0x90020204, // 0009 SETMBR R0 K1 R4 + 0x90020503, // 000A SETMBR R0 K2 K3 + 0x80000000, // 000B RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: invoke_request +********************************************************************/ +be_local_closure(Matter_Plugin_Light1_invoke_request, /* name */ + be_nested_proto( + 22, /* nstack */ + 4, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[23]) { /* constants */ + /* K0 */ be_nested_str_weak(light), + /* K1 */ be_nested_str_weak(matter), + /* K2 */ be_nested_str_weak(TLV), + /* K3 */ be_nested_str_weak(cluster), + /* K4 */ be_nested_str_weak(command), + /* K5 */ be_nested_str_weak(update_shadow_lazy), + /* K6 */ be_const_int(0), + /* K7 */ be_nested_str_weak(set_onoff), + /* K8 */ be_nested_str_weak(publish_command), + /* K9 */ be_nested_str_weak(Power), + /* K10 */ be_const_int(1), + /* K11 */ be_const_int(2), + /* K12 */ be_nested_str_weak(shadow_onoff), + /* K13 */ be_nested_str_weak(findsubval), + /* K14 */ be_nested_str_weak(set_bri), + /* K15 */ be_nested_str_weak(log), + /* K16 */ be_nested_str_weak(bri_X3A), + /* K17 */ be_nested_str_weak(Bri), + /* K18 */ be_nested_str_weak(Dimmer), + /* K19 */ be_nested_str_weak(tasmota), + /* K20 */ be_nested_str_weak(scale_uint), + /* K21 */ be_const_int(3), + /* K22 */ be_nested_str_weak(invoke_request), + }), + be_str_weak(invoke_request), + &be_const_str_solidified, + ( &(const binstruction[167]) { /* code */ + 0xA4120000, // 0000 IMPORT R4 K0 + 0xB8160200, // 0001 GETNGBL R5 K1 + 0x88140B02, // 0002 GETMBR R5 R5 K2 + 0x88180703, // 0003 GETMBR R6 R3 K3 + 0x881C0704, // 0004 GETMBR R7 R3 K4 + 0x54220005, // 0005 LDINT R8 6 + 0x1C200C08, // 0006 EQ R8 R6 R8 + 0x7822002C, // 0007 JMPF R8 #0035 + 0x8C200105, // 0008 GETMET R8 R0 K5 + 0x7C200200, // 0009 CALL R8 1 + 0x1C200F06, // 000A EQ R8 R7 K6 + 0x78220009, // 000B JMPF R8 #0016 + 0x8C200107, // 000C GETMET R8 R0 K7 + 0x50280000, // 000D LDBOOL R10 0 0 + 0x7C200400, // 000E CALL R8 2 + 0x8C200108, // 000F GETMET R8 R0 K8 + 0x58280009, // 0010 LDCONST R10 K9 + 0x582C0006, // 0011 LDCONST R11 K6 + 0x7C200600, // 0012 CALL R8 3 + 0x50200200, // 0013 LDBOOL R8 1 0 + 0x80041000, // 0014 RET 1 R8 + 0x7002001D, // 0015 JMP #0034 + 0x1C200F0A, // 0016 EQ R8 R7 K10 + 0x78220009, // 0017 JMPF R8 #0022 + 0x8C200107, // 0018 GETMET R8 R0 K7 + 0x50280200, // 0019 LDBOOL R10 1 0 + 0x7C200400, // 001A CALL R8 2 + 0x8C200108, // 001B GETMET R8 R0 K8 + 0x58280009, // 001C LDCONST R10 K9 + 0x582C000A, // 001D LDCONST R11 K10 + 0x7C200600, // 001E CALL R8 3 + 0x50200200, // 001F LDBOOL R8 1 0 + 0x80041000, // 0020 RET 1 R8 + 0x70020011, // 0021 JMP #0034 + 0x1C200F0B, // 0022 EQ R8 R7 K11 + 0x7822000F, // 0023 JMPF R8 #0034 + 0x8C200107, // 0024 GETMET R8 R0 K7 + 0x8828010C, // 0025 GETMBR R10 R0 K12 + 0x782A0000, // 0026 JMPF R10 #0028 + 0x50280001, // 0027 LDBOOL R10 0 1 + 0x50280200, // 0028 LDBOOL R10 1 0 + 0x7C200400, // 0029 CALL R8 2 + 0x8C200108, // 002A GETMET R8 R0 K8 + 0x58280009, // 002B LDCONST R10 K9 + 0x882C010C, // 002C GETMBR R11 R0 K12 + 0x782E0001, // 002D JMPF R11 #0030 + 0x582C000A, // 002E LDCONST R11 K10 + 0x70020000, // 002F JMP #0031 + 0x582C0006, // 0030 LDCONST R11 K6 + 0x7C200600, // 0031 CALL R8 3 + 0x50200200, // 0032 LDBOOL R8 1 0 + 0x80041000, // 0033 RET 1 R8 + 0x70020070, // 0034 JMP #00A6 + 0x54220007, // 0035 LDINT R8 8 + 0x1C200C08, // 0036 EQ R8 R6 R8 + 0x78220064, // 0037 JMPF R8 #009D + 0x8C200105, // 0038 GETMET R8 R0 K5 + 0x7C200200, // 0039 CALL R8 1 + 0x1C200F06, // 003A EQ R8 R7 K6 + 0x7822001A, // 003B JMPF R8 #0057 + 0x8C20050D, // 003C GETMET R8 R2 K13 + 0x58280006, // 003D LDCONST R10 K6 + 0x7C200400, // 003E CALL R8 2 + 0x8C24010E, // 003F GETMET R9 R0 K14 + 0x5C2C1000, // 0040 MOVE R11 R8 + 0x7C240400, // 0041 CALL R9 2 + 0x60240008, // 0042 GETGBL R9 G8 + 0x5C281000, // 0043 MOVE R10 R8 + 0x7C240200, // 0044 CALL R9 1 + 0x00262009, // 0045 ADD R9 K16 R9 + 0x900E1E09, // 0046 SETMBR R3 K15 R9 + 0x8C240108, // 0047 GETMET R9 R0 K8 + 0x582C0011, // 0048 LDCONST R11 K17 + 0x5C301000, // 0049 MOVE R12 R8 + 0x58340012, // 004A LDCONST R13 K18 + 0xB83A2600, // 004B GETNGBL R14 K19 + 0x8C381D14, // 004C GETMET R14 R14 K20 + 0x5C401000, // 004D MOVE R16 R8 + 0x58440006, // 004E LDCONST R17 K6 + 0x544A00FD, // 004F LDINT R18 254 + 0x584C0006, // 0050 LDCONST R19 K6 + 0x54520063, // 0051 LDINT R20 100 + 0x7C380C00, // 0052 CALL R14 6 + 0x7C240A00, // 0053 CALL R9 5 + 0x50240200, // 0054 LDBOOL R9 1 0 + 0x80041200, // 0055 RET 1 R9 + 0x70020044, // 0056 JMP #009C + 0x1C200F0A, // 0057 EQ R8 R7 K10 + 0x78220002, // 0058 JMPF R8 #005C + 0x50200200, // 0059 LDBOOL R8 1 0 + 0x80041000, // 005A RET 1 R8 + 0x7002003F, // 005B JMP #009C + 0x1C200F0B, // 005C EQ R8 R7 K11 + 0x78220002, // 005D JMPF R8 #0061 + 0x50200200, // 005E LDBOOL R8 1 0 + 0x80041000, // 005F RET 1 R8 + 0x7002003A, // 0060 JMP #009C + 0x1C200F15, // 0061 EQ R8 R7 K21 + 0x78220002, // 0062 JMPF R8 #0066 + 0x50200200, // 0063 LDBOOL R8 1 0 + 0x80041000, // 0064 RET 1 R8 + 0x70020035, // 0065 JMP #009C + 0x54220003, // 0066 LDINT R8 4 + 0x1C200E08, // 0067 EQ R8 R7 R8 + 0x78220021, // 0068 JMPF R8 #008B + 0x8C20050D, // 0069 GETMET R8 R2 K13 + 0x58280006, // 006A LDCONST R10 K6 + 0x7C200400, // 006B CALL R8 2 + 0x24241106, // 006C GT R9 R8 K6 + 0x8C28010E, // 006D GETMET R10 R0 K14 + 0x5C301000, // 006E MOVE R12 R8 + 0x5C341200, // 006F MOVE R13 R9 + 0x7C280600, // 0070 CALL R10 3 + 0x60280008, // 0071 GETGBL R10 G8 + 0x5C2C1000, // 0072 MOVE R11 R8 + 0x7C280200, // 0073 CALL R10 1 + 0x002A200A, // 0074 ADD R10 K16 R10 + 0x900E1E0A, // 0075 SETMBR R3 K15 R10 + 0x8C280108, // 0076 GETMET R10 R0 K8 + 0x58300011, // 0077 LDCONST R12 K17 + 0x5C341000, // 0078 MOVE R13 R8 + 0x58380012, // 0079 LDCONST R14 K18 + 0xB83E2600, // 007A GETNGBL R15 K19 + 0x8C3C1F14, // 007B GETMET R15 R15 K20 + 0x5C441000, // 007C MOVE R17 R8 + 0x58480006, // 007D LDCONST R18 K6 + 0x544E00FD, // 007E LDINT R19 254 + 0x58500006, // 007F LDCONST R20 K6 + 0x54560063, // 0080 LDINT R21 100 + 0x7C3C0C00, // 0081 CALL R15 6 + 0x58400009, // 0082 LDCONST R16 K9 + 0x78260001, // 0083 JMPF R9 #0086 + 0x5844000A, // 0084 LDCONST R17 K10 + 0x70020000, // 0085 JMP #0087 + 0x58440006, // 0086 LDCONST R17 K6 + 0x7C280E00, // 0087 CALL R10 7 + 0x50280200, // 0088 LDBOOL R10 1 0 + 0x80041400, // 0089 RET 1 R10 + 0x70020010, // 008A JMP #009C + 0x54220004, // 008B LDINT R8 5 + 0x1C200E08, // 008C EQ R8 R7 R8 + 0x78220002, // 008D JMPF R8 #0091 + 0x50200200, // 008E LDBOOL R8 1 0 + 0x80041000, // 008F RET 1 R8 + 0x7002000A, // 0090 JMP #009C + 0x54220005, // 0091 LDINT R8 6 + 0x1C200E08, // 0092 EQ R8 R7 R8 + 0x78220002, // 0093 JMPF R8 #0097 + 0x50200200, // 0094 LDBOOL R8 1 0 + 0x80041000, // 0095 RET 1 R8 + 0x70020004, // 0096 JMP #009C + 0x54220006, // 0097 LDINT R8 7 + 0x1C200E08, // 0098 EQ R8 R7 R8 + 0x78220001, // 0099 JMPF R8 #009C + 0x50200200, // 009A LDBOOL R8 1 0 + 0x80041000, // 009B RET 1 R8 + 0x70020008, // 009C JMP #00A6 + 0x60200003, // 009D GETGBL R8 G3 + 0x5C240000, // 009E MOVE R9 R0 + 0x7C200200, // 009F CALL R8 1 + 0x8C201116, // 00A0 GETMET R8 R8 K22 + 0x5C280200, // 00A1 MOVE R10 R1 + 0x5C2C0400, // 00A2 MOVE R11 R2 + 0x5C300600, // 00A3 MOVE R12 R3 + 0x7C200800, // 00A4 CALL R8 4 + 0x80041000, // 00A5 RET 1 R8 + 0x80000000, // 00A6 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_onoff +********************************************************************/ +be_local_closure(Matter_Plugin_Light1_set_onoff, /* name */ + be_nested_proto( + 6, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 8]) { /* constants */ + /* K0 */ be_nested_str_weak(VIRTUAL), + /* K1 */ be_nested_str_weak(light), + /* K2 */ be_nested_str_weak(set), + /* K3 */ be_nested_str_weak(power), + /* K4 */ be_nested_str_weak(update_shadow), + /* K5 */ be_nested_str_weak(shadow_onoff), + /* K6 */ be_nested_str_weak(attribute_updated), + /* K7 */ be_const_int(0), + }), + be_str_weak(set_onoff), + &be_const_str_solidified, + ( &(const binstruction[20]) { /* code */ + 0x88080100, // 0000 GETMBR R2 R0 K0 + 0x740A0008, // 0001 JMPT R2 #000B + 0xA40A0200, // 0002 IMPORT R2 K1 + 0x8C0C0502, // 0003 GETMET R3 R2 K2 + 0x60140013, // 0004 GETGBL R5 G19 + 0x7C140000, // 0005 CALL R5 0 + 0x98160601, // 0006 SETIDX R5 K3 R1 + 0x7C0C0400, // 0007 CALL R3 2 + 0x8C0C0104, // 0008 GETMET R3 R0 K4 + 0x7C0C0200, // 0009 CALL R3 1 + 0x70020007, // 000A JMP #0013 + 0x88080105, // 000B GETMBR R2 R0 K5 + 0x20080202, // 000C NE R2 R1 R2 + 0x780A0004, // 000D JMPF R2 #0013 + 0x8C080106, // 000E GETMET R2 R0 K6 + 0x54120005, // 000F LDINT R4 6 + 0x58140007, // 0010 LDCONST R5 K7 + 0x7C080600, // 0011 CALL R2 3 + 0x90020A01, // 0012 SETMBR R0 K5 R1 + 0x80000000, // 0013 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: update_shadow +********************************************************************/ +be_local_closure(Matter_Plugin_Light1_update_shadow, /* name */ + be_nested_proto( + 12, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[13]) { /* constants */ + /* K0 */ be_nested_str_weak(VIRTUAL), + /* K1 */ be_nested_str_weak(light), + /* K2 */ be_nested_str_weak(get), + /* K3 */ be_nested_str_weak(find), + /* K4 */ be_nested_str_weak(power), + /* K5 */ be_nested_str_weak(shadow_onoff), + /* K6 */ be_nested_str_weak(attribute_updated), + /* K7 */ be_const_int(0), + /* K8 */ be_nested_str_weak(bri), + /* K9 */ be_nested_str_weak(tasmota), + /* K10 */ be_nested_str_weak(scale_uint), + /* K11 */ be_nested_str_weak(shadow_bri), + /* K12 */ be_nested_str_weak(update_shadow), + }), + be_str_weak(update_shadow), + &be_const_str_solidified, + ( &(const binstruction[50]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x74060029, // 0001 JMPT R1 #002C + 0xA4060200, // 0002 IMPORT R1 K1 + 0x8C080302, // 0003 GETMET R2 R1 K2 + 0x7C080200, // 0004 CALL R2 1 + 0x4C0C0000, // 0005 LDNIL R3 + 0x200C0403, // 0006 NE R3 R2 R3 + 0x780E0023, // 0007 JMPF R3 #002C + 0x8C0C0503, // 0008 GETMET R3 R2 K3 + 0x58140004, // 0009 LDCONST R5 K4 + 0x4C180000, // 000A LDNIL R6 + 0x7C0C0600, // 000B CALL R3 3 + 0x88100105, // 000C GETMBR R4 R0 K5 + 0x20100604, // 000D NE R4 R3 R4 + 0x78120004, // 000E JMPF R4 #0014 + 0x8C100106, // 000F GETMET R4 R0 K6 + 0x541A0005, // 0010 LDINT R6 6 + 0x581C0007, // 0011 LDCONST R7 K7 + 0x7C100600, // 0012 CALL R4 3 + 0x90020A03, // 0013 SETMBR R0 K5 R3 + 0x8C100503, // 0014 GETMET R4 R2 K3 + 0x58180008, // 0015 LDCONST R6 K8 + 0x4C1C0000, // 0016 LDNIL R7 + 0x7C100600, // 0017 CALL R4 3 + 0x4C140000, // 0018 LDNIL R5 + 0x20140805, // 0019 NE R5 R4 R5 + 0x78160010, // 001A JMPF R5 #002C + 0xB8161200, // 001B GETNGBL R5 K9 + 0x8C140B0A, // 001C GETMET R5 R5 K10 + 0x5C1C0800, // 001D MOVE R7 R4 + 0x58200007, // 001E LDCONST R8 K7 + 0x542600FE, // 001F LDINT R9 255 + 0x58280007, // 0020 LDCONST R10 K7 + 0x542E00FD, // 0021 LDINT R11 254 + 0x7C140C00, // 0022 CALL R5 6 + 0x5C100A00, // 0023 MOVE R4 R5 + 0x8814010B, // 0024 GETMBR R5 R0 K11 + 0x20140805, // 0025 NE R5 R4 R5 + 0x78160004, // 0026 JMPF R5 #002C + 0x8C140106, // 0027 GETMET R5 R0 K6 + 0x541E0007, // 0028 LDINT R7 8 + 0x58200007, // 0029 LDCONST R8 K7 + 0x7C140600, // 002A CALL R5 3 + 0x90021604, // 002B SETMBR R0 K11 R4 + 0x60040003, // 002C GETGBL R1 G3 + 0x5C080000, // 002D MOVE R2 R0 + 0x7C040200, // 002E CALL R1 1 + 0x8C04030C, // 002F GETMET R1 R1 K12 + 0x7C040200, // 0030 CALL R1 1 + 0x80000000, // 0031 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: update_virtual +********************************************************************/ +be_local_closure(Matter_Plugin_Light1_update_virtual, /* name */ + be_nested_proto( + 8, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 6]) { /* constants */ + /* K0 */ be_nested_str_weak(find), + /* K1 */ be_nested_str_weak(Power), + /* K2 */ be_nested_str_weak(Bri), + /* K3 */ be_nested_str_weak(set_bri), + /* K4 */ be_nested_str_weak(set_onoff), + /* K5 */ be_nested_str_weak(update_virtual), + }), + be_str_weak(update_virtual), + &be_const_str_solidified, + ( &(const binstruction[32]) { /* code */ + 0x8C080300, // 0000 GETMET R2 R1 K0 + 0x58100001, // 0001 LDCONST R4 K1 + 0x7C080400, // 0002 CALL R2 2 + 0x8C0C0300, // 0003 GETMET R3 R1 K0 + 0x58140002, // 0004 LDCONST R5 K2 + 0x7C0C0400, // 0005 CALL R3 2 + 0x4C100000, // 0006 LDNIL R4 + 0x20100604, // 0007 NE R4 R3 R4 + 0x78120007, // 0008 JMPF R4 #0011 + 0x8C100103, // 0009 GETMET R4 R0 K3 + 0x60180009, // 000A GETGBL R6 G9 + 0x5C1C0600, // 000B MOVE R7 R3 + 0x7C180200, // 000C CALL R6 1 + 0x5C1C0400, // 000D MOVE R7 R2 + 0x7C100600, // 000E CALL R4 3 + 0x80000800, // 000F RET 0 + 0x70020007, // 0010 JMP #0019 + 0x4C100000, // 0011 LDNIL R4 + 0x20100404, // 0012 NE R4 R2 R4 + 0x78120004, // 0013 JMPF R4 #0019 + 0x8C100104, // 0014 GETMET R4 R0 K4 + 0x60180017, // 0015 GETGBL R6 G23 + 0x5C1C0400, // 0016 MOVE R7 R2 + 0x7C180200, // 0017 CALL R6 1 + 0x7C100400, // 0018 CALL R4 2 + 0x60100003, // 0019 GETGBL R4 G3 + 0x5C140000, // 001A MOVE R5 R0 + 0x7C100200, // 001B CALL R4 1 + 0x8C100905, // 001C GETMET R4 R4 K5 + 0x5C180200, // 001D MOVE R6 R1 + 0x7C100400, // 001E CALL R4 2 + 0x80000000, // 001F RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: read_attribute +********************************************************************/ +be_local_closure(Matter_Plugin_Light1_read_attribute, /* name */ + be_nested_proto( + 12, /* nstack */ + 4, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[16]) { /* constants */ + /* K0 */ be_nested_str_weak(matter), + /* K1 */ be_nested_str_weak(TLV), + /* K2 */ be_nested_str_weak(cluster), + /* K3 */ be_nested_str_weak(attribute), + /* K4 */ be_nested_str_weak(update_shadow_lazy), + /* K5 */ be_const_int(0), + /* K6 */ be_nested_str_weak(set), + /* K7 */ be_nested_str_weak(BOOL), + /* K8 */ be_nested_str_weak(shadow_onoff), + /* K9 */ be_nested_str_weak(U4), + /* K10 */ be_nested_str_weak(U1), + /* K11 */ be_nested_str_weak(shadow_bri), + /* K12 */ be_const_int(2), + /* K13 */ be_const_int(3), + /* K14 */ be_const_int(1), + /* K15 */ be_nested_str_weak(read_attribute), + }), + be_str_weak(read_attribute), + &be_const_str_solidified, + ( &(const binstruction[110]) { /* code */ + 0xB8120000, // 0000 GETNGBL R4 K0 + 0x88100901, // 0001 GETMBR R4 R4 K1 + 0x88140502, // 0002 GETMBR R5 R2 K2 + 0x88180503, // 0003 GETMBR R6 R2 K3 + 0x541E0005, // 0004 LDINT R7 6 + 0x1C1C0A07, // 0005 EQ R7 R5 R7 + 0x781E001B, // 0006 JMPF R7 #0023 + 0x8C1C0104, // 0007 GETMET R7 R0 K4 + 0x7C1C0200, // 0008 CALL R7 1 + 0x1C1C0D05, // 0009 EQ R7 R6 K5 + 0x781E0005, // 000A JMPF R7 #0011 + 0x8C1C0706, // 000B GETMET R7 R3 K6 + 0x88240907, // 000C GETMBR R9 R4 K7 + 0x88280108, // 000D GETMBR R10 R0 K8 + 0x7C1C0600, // 000E CALL R7 3 + 0x80040E00, // 000F RET 1 R7 + 0x70020010, // 0010 JMP #0022 + 0x541EFFFB, // 0011 LDINT R7 65532 + 0x1C1C0C07, // 0012 EQ R7 R6 R7 + 0x781E0005, // 0013 JMPF R7 #001A + 0x8C1C0706, // 0014 GETMET R7 R3 K6 + 0x88240909, // 0015 GETMBR R9 R4 K9 + 0x58280005, // 0016 LDCONST R10 K5 + 0x7C1C0600, // 0017 CALL R7 3 + 0x80040E00, // 0018 RET 1 R7 + 0x70020007, // 0019 JMP #0022 + 0x541EFFFC, // 001A LDINT R7 65533 + 0x1C1C0C07, // 001B EQ R7 R6 R7 + 0x781E0004, // 001C JMPF R7 #0022 + 0x8C1C0706, // 001D GETMET R7 R3 K6 + 0x88240909, // 001E GETMBR R9 R4 K9 + 0x542A0003, // 001F LDINT R10 4 + 0x7C1C0600, // 0020 CALL R7 3 + 0x80040E00, // 0021 RET 1 R7 + 0x70020049, // 0022 JMP #006D + 0x541E0007, // 0023 LDINT R7 8 + 0x1C1C0A07, // 0024 EQ R7 R5 R7 + 0x781E003D, // 0025 JMPF R7 #0064 + 0x8C1C0104, // 0026 GETMET R7 R0 K4 + 0x7C1C0200, // 0027 CALL R7 1 + 0x1C1C0D05, // 0028 EQ R7 R6 K5 + 0x781E0005, // 0029 JMPF R7 #0030 + 0x8C1C0706, // 002A GETMET R7 R3 K6 + 0x8824090A, // 002B GETMBR R9 R4 K10 + 0x8828010B, // 002C GETMBR R10 R0 K11 + 0x7C1C0600, // 002D CALL R7 3 + 0x80040E00, // 002E RET 1 R7 + 0x70020032, // 002F JMP #0063 + 0x1C1C0D0C, // 0030 EQ R7 R6 K12 + 0x781E0005, // 0031 JMPF R7 #0038 + 0x8C1C0706, // 0032 GETMET R7 R3 K6 + 0x8824090A, // 0033 GETMBR R9 R4 K10 + 0x58280005, // 0034 LDCONST R10 K5 + 0x7C1C0600, // 0035 CALL R7 3 + 0x80040E00, // 0036 RET 1 R7 + 0x7002002A, // 0037 JMP #0063 + 0x1C1C0D0D, // 0038 EQ R7 R6 K13 + 0x781E0005, // 0039 JMPF R7 #0040 + 0x8C1C0706, // 003A GETMET R7 R3 K6 + 0x8824090A, // 003B GETMBR R9 R4 K10 + 0x542A00FD, // 003C LDINT R10 254 + 0x7C1C0600, // 003D CALL R7 3 + 0x80040E00, // 003E RET 1 R7 + 0x70020022, // 003F JMP #0063 + 0x541E000E, // 0040 LDINT R7 15 + 0x1C1C0C07, // 0041 EQ R7 R6 R7 + 0x781E0005, // 0042 JMPF R7 #0049 + 0x8C1C0706, // 0043 GETMET R7 R3 K6 + 0x8824090A, // 0044 GETMBR R9 R4 K10 + 0x58280005, // 0045 LDCONST R10 K5 + 0x7C1C0600, // 0046 CALL R7 3 + 0x80040E00, // 0047 RET 1 R7 + 0x70020019, // 0048 JMP #0063 + 0x541E0010, // 0049 LDINT R7 17 + 0x1C1C0C07, // 004A EQ R7 R6 R7 + 0x781E0005, // 004B JMPF R7 #0052 + 0x8C1C0706, // 004C GETMET R7 R3 K6 + 0x8824090A, // 004D GETMBR R9 R4 K10 + 0x8828010B, // 004E GETMBR R10 R0 K11 + 0x7C1C0600, // 004F CALL R7 3 + 0x80040E00, // 0050 RET 1 R7 + 0x70020010, // 0051 JMP #0063 + 0x541EFFFB, // 0052 LDINT R7 65532 + 0x1C1C0C07, // 0053 EQ R7 R6 R7 + 0x781E0005, // 0054 JMPF R7 #005B + 0x8C1C0706, // 0055 GETMET R7 R3 K6 + 0x88240909, // 0056 GETMBR R9 R4 K9 + 0x5828000E, // 0057 LDCONST R10 K14 + 0x7C1C0600, // 0058 CALL R7 3 + 0x80040E00, // 0059 RET 1 R7 + 0x70020007, // 005A JMP #0063 + 0x541EFFFC, // 005B LDINT R7 65533 + 0x1C1C0C07, // 005C EQ R7 R6 R7 + 0x781E0004, // 005D JMPF R7 #0063 + 0x8C1C0706, // 005E GETMET R7 R3 K6 + 0x88240909, // 005F GETMBR R9 R4 K9 + 0x542A0004, // 0060 LDINT R10 5 + 0x7C1C0600, // 0061 CALL R7 3 + 0x80040E00, // 0062 RET 1 R7 + 0x70020008, // 0063 JMP #006D + 0x601C0003, // 0064 GETGBL R7 G3 + 0x5C200000, // 0065 MOVE R8 R0 + 0x7C1C0200, // 0066 CALL R7 1 + 0x8C1C0F0F, // 0067 GETMET R7 R7 K15 + 0x5C240200, // 0068 MOVE R9 R1 + 0x5C280400, // 0069 MOVE R10 R2 + 0x5C2C0600, // 006A MOVE R11 R3 + 0x7C1C0800, // 006B CALL R7 4 + 0x80040E00, // 006C RET 1 R7 + 0x80000000, // 006D RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_bri +********************************************************************/ +be_local_closure(Matter_Plugin_Light1_set_bri, /* name */ + be_nested_proto( + 11, /* nstack */ + 3, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[12]) { /* constants */ + /* K0 */ be_const_int(0), + /* K1 */ be_nested_str_weak(VIRTUAL), + /* K2 */ be_nested_str_weak(light), + /* K3 */ be_nested_str_weak(tasmota), + /* K4 */ be_nested_str_weak(scale_uint), + /* K5 */ be_nested_str_weak(set), + /* K6 */ be_nested_str_weak(bri), + /* K7 */ be_nested_str_weak(power), + /* K8 */ be_nested_str_weak(update_shadow), + /* K9 */ be_nested_str_weak(shadow_onoff), + /* K10 */ be_nested_str_weak(attribute_updated), + /* K11 */ be_nested_str_weak(shadow_bri), + }), + be_str_weak(set_bri), + &be_const_str_solidified, + ( &(const binstruction[65]) { /* code */ + 0x140C0300, // 0000 LT R3 R1 K0 + 0x780E0000, // 0001 JMPF R3 #0003 + 0x58040000, // 0002 LDCONST R1 K0 + 0x540E00FD, // 0003 LDINT R3 254 + 0x240C0203, // 0004 GT R3 R1 R3 + 0x780E0000, // 0005 JMPF R3 #0007 + 0x540600FD, // 0006 LDINT R1 254 + 0x4C0C0000, // 0007 LDNIL R3 + 0x200C0403, // 0008 NE R3 R2 R3 + 0x780E0003, // 0009 JMPF R3 #000E + 0x600C0017, // 000A GETGBL R3 G23 + 0x5C100400, // 000B MOVE R4 R2 + 0x7C0C0200, // 000C CALL R3 1 + 0x70020000, // 000D JMP #000F + 0x4C0C0000, // 000E LDNIL R3 + 0x5C080600, // 000F MOVE R2 R3 + 0x880C0101, // 0010 GETMBR R3 R0 K1 + 0x740E001A, // 0011 JMPT R3 #002D + 0xA40E0400, // 0012 IMPORT R3 K2 + 0xB8120600, // 0013 GETNGBL R4 K3 + 0x8C100904, // 0014 GETMET R4 R4 K4 + 0x5C180200, // 0015 MOVE R6 R1 + 0x581C0000, // 0016 LDCONST R7 K0 + 0x542200FD, // 0017 LDINT R8 254 + 0x58240000, // 0018 LDCONST R9 K0 + 0x542A00FE, // 0019 LDINT R10 255 + 0x7C100C00, // 001A CALL R4 6 + 0x4C140000, // 001B LDNIL R5 + 0x1C140405, // 001C EQ R5 R2 R5 + 0x78160005, // 001D JMPF R5 #0024 + 0x8C140705, // 001E GETMET R5 R3 K5 + 0x601C0013, // 001F GETGBL R7 G19 + 0x7C1C0000, // 0020 CALL R7 0 + 0x981E0C04, // 0021 SETIDX R7 K6 R4 + 0x7C140400, // 0022 CALL R5 2 + 0x70020005, // 0023 JMP #002A + 0x8C140705, // 0024 GETMET R5 R3 K5 + 0x601C0013, // 0025 GETGBL R7 G19 + 0x7C1C0000, // 0026 CALL R7 0 + 0x981E0C04, // 0027 SETIDX R7 K6 R4 + 0x981E0E02, // 0028 SETIDX R7 K7 R2 + 0x7C140400, // 0029 CALL R5 2 + 0x8C140108, // 002A GETMET R5 R0 K8 + 0x7C140200, // 002B CALL R5 1 + 0x70020012, // 002C JMP #0040 + 0x4C0C0000, // 002D LDNIL R3 + 0x200C0403, // 002E NE R3 R2 R3 + 0x780E0007, // 002F JMPF R3 #0038 + 0x880C0109, // 0030 GETMBR R3 R0 K9 + 0x200C0403, // 0031 NE R3 R2 R3 + 0x780E0004, // 0032 JMPF R3 #0038 + 0x8C0C010A, // 0033 GETMET R3 R0 K10 + 0x54160005, // 0034 LDINT R5 6 + 0x58180000, // 0035 LDCONST R6 K0 + 0x7C0C0600, // 0036 CALL R3 3 + 0x90021202, // 0037 SETMBR R0 K9 R2 + 0x880C010B, // 0038 GETMBR R3 R0 K11 + 0x200C0203, // 0039 NE R3 R1 R3 + 0x780E0004, // 003A JMPF R3 #0040 + 0x8C0C010A, // 003B GETMET R3 R0 K10 + 0x54160007, // 003C LDINT R5 8 + 0x58180000, // 003D LDCONST R6 K0 + 0x7C0C0600, // 003E CALL R3 3 + 0x90021601, // 003F SETMBR R0 K11 R1 + 0x80000000, // 0040 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified class: Matter_Plugin_Light1 +********************************************************************/ +extern const bclass be_class_Matter_Plugin_Device; +be_local_class(Matter_Plugin_Light1, + 2, + &be_class_Matter_Plugin_Device, + be_nested_map(15, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_const_key_weak(init, -1), be_const_closure(Matter_Plugin_Light1_init_closure) }, + { be_const_key_weak(update_shadow, -1), be_const_closure(Matter_Plugin_Light1_update_shadow_closure) }, + { be_const_key_weak(invoke_request, -1), be_const_closure(Matter_Plugin_Light1_invoke_request_closure) }, + { be_const_key_weak(set_onoff, -1), be_const_closure(Matter_Plugin_Light1_set_onoff_closure) }, + { be_const_key_weak(TYPE, 10), be_nested_str_weak(light1) }, + { be_const_key_weak(update_virtual, 11), be_const_closure(Matter_Plugin_Light1_update_virtual_closure) }, + { be_const_key_weak(UPDATE_TIME, 8), be_const_int(250) }, + { be_const_key_weak(shadow_bri, 1), be_const_var(1) }, + { be_const_key_weak(DISPLAY_NAME, -1), be_nested_str_weak(Light_X201_X20Dimmer) }, + { be_const_key_weak(UPDATE_COMMANDS, -1), be_const_simple_instance(be_nested_simple_instance(&be_class_list, { + be_const_list( * be_nested_list(2, + ( (struct bvalue*) &(const bvalue[]) { + be_nested_str_weak(Power), + be_nested_str_weak(Bri), + })) ) } )) }, + { be_const_key_weak(CLUSTERS, 7), be_const_simple_instance(be_nested_simple_instance(&be_class_map, { + be_const_map( * be_nested_map(7, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_const_key_int(29, 2), be_const_simple_instance(be_nested_simple_instance(&be_class_list, { + be_const_list( * be_nested_list(6, + ( (struct bvalue*) &(const bvalue[]) { + be_const_int(0), + be_const_int(1), + be_const_int(2), + be_const_int(3), + be_const_int(65532), + be_const_int(65533), + })) ) } )) }, + { be_const_key_int(8, 0), be_const_simple_instance(be_nested_simple_instance(&be_class_list, { + be_const_list( * be_nested_list(7, + ( (struct bvalue*) &(const bvalue[]) { + be_const_int(0), + be_const_int(2), + be_const_int(3), + be_const_int(15), + be_const_int(17), + be_const_int(65532), + be_const_int(65533), + })) ) } )) }, + { be_const_key_int(57, -1), be_const_simple_instance(be_nested_simple_instance(&be_class_list, { + be_const_list( * be_nested_list(7, + ( (struct bvalue*) &(const bvalue[]) { + be_const_int(17), + be_const_int(3), + be_const_int(5), + be_const_int(10), + be_const_int(15), + be_const_int(17), + be_const_int(18), + })) ) } )) }, + { be_const_key_int(3, -1), be_const_simple_instance(be_nested_simple_instance(&be_class_list, { + be_const_list( * be_nested_list(4, + ( (struct bvalue*) &(const bvalue[]) { + be_const_int(0), + be_const_int(1), + be_const_int(65532), + be_const_int(65533), + })) ) } )) }, + { be_const_key_int(4, -1), be_const_simple_instance(be_nested_simple_instance(&be_class_list, { + be_const_list( * be_nested_list(3, + ( (struct bvalue*) &(const bvalue[]) { + be_const_int(0), + be_const_int(65532), + be_const_int(65533), + })) ) } )) }, + { be_const_key_int(5, -1), be_const_simple_instance(be_nested_simple_instance(&be_class_list, { + be_const_list( * be_nested_list(8, + ( (struct bvalue*) &(const bvalue[]) { + be_const_int(0), + be_const_int(1), + be_const_int(2), + be_const_int(3), + be_const_int(4), + be_const_int(5), + be_const_int(65532), + be_const_int(65533), + })) ) } )) }, + { be_const_key_int(6, -1), be_const_simple_instance(be_nested_simple_instance(&be_class_list, { + be_const_list( * be_nested_list(3, + ( (struct bvalue*) &(const bvalue[]) { + be_const_int(0), + be_const_int(65532), + be_const_int(65533), + })) ) } )) }, + })) ) } )) }, + { be_const_key_weak(TYPES, -1), be_const_simple_instance(be_nested_simple_instance(&be_class_map, { + be_const_map( * be_nested_map(1, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_const_key_int(257, -1), be_const_int(2) }, + })) ) } )) }, + { be_const_key_weak(read_attribute, -1), be_const_closure(Matter_Plugin_Light1_read_attribute_closure) }, + { be_const_key_weak(shadow_onoff, -1), be_const_var(0) }, + { be_const_key_weak(set_bri, -1), be_const_closure(Matter_Plugin_Light1_set_bri_closure) }, + })), + be_str_weak(Matter_Plugin_Light1) +); +/*******************************************************************/ + +void be_load_Matter_Plugin_Light1_class(bvm *vm) { + be_pushntvclass(vm, &be_class_Matter_Plugin_Light1); + be_setglobal(vm, "Matter_Plugin_Light1"); + be_pop(vm, 1); +} +/********************************************************************/ +/* End of solidification */ diff --git a/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_2_Sensor.h b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_2_Sensor.h index adb3bf9c8..2a86d3ae8 100644 --- a/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_2_Sensor.h +++ b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_2_Sensor.h @@ -77,36 +77,39 @@ be_local_closure(Matter_Plugin_Sensor_parse_sensors, /* name */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[ 5]) { /* constants */ - /* K0 */ be_nested_str_weak(tasmota_sensor_matcher), - /* K1 */ be_nested_str_weak(pre_value), - /* K2 */ be_nested_str_weak(match), - /* K3 */ be_nested_str_weak(shadow_value), - /* K4 */ be_nested_str_weak(value_changed), + ( &(const bvalue[ 6]) { /* constants */ + /* K0 */ be_nested_str_weak(VIRTUAL), + /* K1 */ be_nested_str_weak(tasmota_sensor_matcher), + /* K2 */ be_nested_str_weak(pre_value), + /* K3 */ be_nested_str_weak(match), + /* K4 */ be_nested_str_weak(shadow_value), + /* K5 */ be_nested_str_weak(value_changed), }), be_str_weak(parse_sensors), &be_const_str_solidified, - ( &(const binstruction[20]) { /* code */ + ( &(const binstruction[22]) { /* code */ 0x88080100, // 0000 GETMBR R2 R0 K0 - 0x780A0010, // 0001 JMPF R2 #0013 - 0x8C080101, // 0002 GETMET R2 R0 K1 - 0x6010000A, // 0003 GETGBL R4 G10 - 0x88140100, // 0004 GETMBR R5 R0 K0 - 0x8C140B02, // 0005 GETMET R5 R5 K2 - 0x5C1C0200, // 0006 MOVE R7 R1 - 0x7C140400, // 0007 CALL R5 2 - 0x7C100200, // 0008 CALL R4 1 - 0x7C080400, // 0009 CALL R2 2 - 0x4C0C0000, // 000A LDNIL R3 - 0x200C0403, // 000B NE R3 R2 R3 - 0x780E0005, // 000C JMPF R3 #0013 - 0x880C0103, // 000D GETMBR R3 R0 K3 - 0x200C0403, // 000E NE R3 R2 R3 - 0x780E0002, // 000F JMPF R3 #0013 - 0x8C0C0104, // 0010 GETMET R3 R0 K4 - 0x7C0C0200, // 0011 CALL R3 1 - 0x90020602, // 0012 SETMBR R0 K3 R2 - 0x80000000, // 0013 RET 0 + 0x740A0012, // 0001 JMPT R2 #0015 + 0x88080101, // 0002 GETMBR R2 R0 K1 + 0x780A0010, // 0003 JMPF R2 #0015 + 0x8C080102, // 0004 GETMET R2 R0 K2 + 0x6010000A, // 0005 GETGBL R4 G10 + 0x88140101, // 0006 GETMBR R5 R0 K1 + 0x8C140B03, // 0007 GETMET R5 R5 K3 + 0x5C1C0200, // 0008 MOVE R7 R1 + 0x7C140400, // 0009 CALL R5 2 + 0x7C100200, // 000A CALL R4 1 + 0x7C080400, // 000B CALL R2 2 + 0x4C0C0000, // 000C LDNIL R3 + 0x200C0403, // 000D NE R3 R2 R3 + 0x780E0005, // 000E JMPF R3 #0015 + 0x880C0104, // 000F GETMBR R3 R0 K4 + 0x200C0403, // 0010 NE R3 R2 R3 + 0x780E0002, // 0011 JMPF R3 #0015 + 0x8C0C0105, // 0012 GETMET R3 R0 K5 + 0x7C0C0200, // 0013 CALL R3 1 + 0x90020802, // 0014 SETMBR R0 K4 R2 + 0x80000000, // 0015 RET 0 }) ) ); diff --git a/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_3_Sensor_Contact.h b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_2_Sensor_Contact.h similarity index 88% rename from lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_3_Sensor_Contact.h rename to lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_2_Sensor_Contact.h index 7a33f6a30..d097a5ba3 100644 --- a/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_3_Sensor_Contact.h +++ b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_2_Sensor_Contact.h @@ -1,4 +1,4 @@ -/* Solidification of Matter_Plugin_3_Sensor_Contact.h */ +/* Solidification of Matter_Plugin_2_Sensor_Contact.h */ /********************************************************************\ * Generated code, don't edit * \********************************************************************/ @@ -93,62 +93,65 @@ be_local_closure(Matter_Plugin_Sensor_Contact_update_shadow, /* name */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[13]) { /* constants */ + ( &(const bvalue[14]) { /* constants */ /* K0 */ be_nested_str_weak(update_shadow), - /* K1 */ be_nested_str_weak(json), - /* K2 */ be_nested_str_weak(tasmota), - /* K3 */ be_nested_str_weak(cmd), - /* K4 */ be_nested_str_weak(Status_X208), - /* K5 */ be_nested_str_weak(load), - /* K6 */ be_nested_str_weak(find), - /* K7 */ be_nested_str_weak(Switch), - /* K8 */ be_nested_str_weak(tasmota_switch_index), - /* K9 */ be_nested_str_weak(ON), - /* K10 */ be_nested_str_weak(shadow_contact), - /* K11 */ be_nested_str_weak(attribute_updated), - /* K12 */ be_const_int(0), + /* K1 */ be_nested_str_weak(VIRTUAL), + /* K2 */ be_nested_str_weak(json), + /* K3 */ be_nested_str_weak(tasmota), + /* K4 */ be_nested_str_weak(cmd), + /* K5 */ be_nested_str_weak(Status_X208), + /* K6 */ be_nested_str_weak(load), + /* K7 */ be_nested_str_weak(find), + /* K8 */ be_nested_str_weak(Switch), + /* K9 */ be_nested_str_weak(tasmota_switch_index), + /* K10 */ be_nested_str_weak(ON), + /* K11 */ be_nested_str_weak(shadow_contact), + /* K12 */ be_nested_str_weak(attribute_updated), + /* K13 */ be_const_int(0), }), be_str_weak(update_shadow), &be_const_str_solidified, - ( &(const binstruction[38]) { /* code */ + ( &(const binstruction[40]) { /* code */ 0x60040003, // 0000 GETGBL R1 G3 0x5C080000, // 0001 MOVE R2 R0 0x7C040200, // 0002 CALL R1 1 0x8C040300, // 0003 GETMET R1 R1 K0 0x7C040200, // 0004 CALL R1 1 - 0xA4060200, // 0005 IMPORT R1 K1 - 0xB80A0400, // 0006 GETNGBL R2 K2 - 0x8C080503, // 0007 GETMET R2 R2 K3 - 0x58100004, // 0008 LDCONST R4 K4 - 0x50140200, // 0009 LDBOOL R5 1 0 - 0x7C080600, // 000A CALL R2 3 - 0x4C0C0000, // 000B LDNIL R3 - 0x200C0403, // 000C NE R3 R2 R3 - 0x780E0016, // 000D JMPF R3 #0025 - 0x8C0C0305, // 000E GETMET R3 R1 K5 - 0x5C140400, // 000F MOVE R5 R2 - 0x7C0C0400, // 0010 CALL R3 2 - 0x4C100000, // 0011 LDNIL R4 - 0x20100604, // 0012 NE R4 R3 R4 - 0x78120010, // 0013 JMPF R4 #0025 - 0x50100000, // 0014 LDBOOL R4 0 0 - 0x8C140706, // 0015 GETMET R5 R3 K6 - 0x601C0008, // 0016 GETGBL R7 G8 - 0x88200108, // 0017 GETMBR R8 R0 K8 - 0x7C1C0200, // 0018 CALL R7 1 - 0x001E0E07, // 0019 ADD R7 K7 R7 - 0x7C140400, // 001A CALL R5 2 - 0x1C140B09, // 001B EQ R5 R5 K9 - 0x5C100A00, // 001C MOVE R4 R5 - 0x8814010A, // 001D GETMBR R5 R0 K10 - 0x20140A04, // 001E NE R5 R5 R4 - 0x78160004, // 001F JMPF R5 #0025 - 0x8C14010B, // 0020 GETMET R5 R0 K11 - 0x541E0044, // 0021 LDINT R7 69 - 0x5820000C, // 0022 LDCONST R8 K12 - 0x7C140600, // 0023 CALL R5 3 - 0x90021404, // 0024 SETMBR R0 K10 R4 - 0x80000000, // 0025 RET 0 + 0x88040101, // 0005 GETMBR R1 R0 K1 + 0x7406001F, // 0006 JMPT R1 #0027 + 0xA4060400, // 0007 IMPORT R1 K2 + 0xB80A0600, // 0008 GETNGBL R2 K3 + 0x8C080504, // 0009 GETMET R2 R2 K4 + 0x58100005, // 000A LDCONST R4 K5 + 0x50140200, // 000B LDBOOL R5 1 0 + 0x7C080600, // 000C CALL R2 3 + 0x4C0C0000, // 000D LDNIL R3 + 0x200C0403, // 000E NE R3 R2 R3 + 0x780E0016, // 000F JMPF R3 #0027 + 0x8C0C0306, // 0010 GETMET R3 R1 K6 + 0x5C140400, // 0011 MOVE R5 R2 + 0x7C0C0400, // 0012 CALL R3 2 + 0x4C100000, // 0013 LDNIL R4 + 0x20100604, // 0014 NE R4 R3 R4 + 0x78120010, // 0015 JMPF R4 #0027 + 0x50100000, // 0016 LDBOOL R4 0 0 + 0x8C140707, // 0017 GETMET R5 R3 K7 + 0x601C0008, // 0018 GETGBL R7 G8 + 0x88200109, // 0019 GETMBR R8 R0 K9 + 0x7C1C0200, // 001A CALL R7 1 + 0x001E1007, // 001B ADD R7 K8 R7 + 0x7C140400, // 001C CALL R5 2 + 0x1C140B0A, // 001D EQ R5 R5 K10 + 0x5C100A00, // 001E MOVE R4 R5 + 0x8814010B, // 001F GETMBR R5 R0 K11 + 0x20140A04, // 0020 NE R5 R5 R4 + 0x78160004, // 0021 JMPF R5 #0027 + 0x8C14010C, // 0022 GETMET R5 R0 K12 + 0x541E0044, // 0023 LDINT R7 69 + 0x5820000D, // 0024 LDCONST R8 K13 + 0x7C140600, // 0025 CALL R5 3 + 0x90021604, // 0026 SETMBR R0 K11 R4 + 0x80000000, // 0027 RET 0 }) ) ); diff --git a/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_3_Sensor_Occupancy.h b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_2_Sensor_Occupancy.h similarity index 88% rename from lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_3_Sensor_Occupancy.h rename to lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_2_Sensor_Occupancy.h index a2585b7a0..d49d927cc 100644 --- a/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_3_Sensor_Occupancy.h +++ b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_2_Sensor_Occupancy.h @@ -1,4 +1,4 @@ -/* Solidification of Matter_Plugin_3_Sensor_Occupancy.h */ +/* Solidification of Matter_Plugin_2_Sensor_Occupancy.h */ /********************************************************************\ * Generated code, don't edit * \********************************************************************/ @@ -93,65 +93,68 @@ be_local_closure(Matter_Plugin_Sensor_Occupancy_update_shadow, /* name */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[13]) { /* constants */ + ( &(const bvalue[14]) { /* constants */ /* K0 */ be_nested_str_weak(update_shadow), - /* K1 */ be_nested_str_weak(Switch), - /* K2 */ be_nested_str_weak(tasmota_switch_index), - /* K3 */ be_nested_str_weak(tasmota), - /* K4 */ be_nested_str_weak(cmd), - /* K5 */ be_nested_str_weak(Status_X208), - /* K6 */ be_nested_str_weak(find), - /* K7 */ be_nested_str_weak(StatusSNS), - /* K8 */ be_nested_str_weak(contains), - /* K9 */ be_nested_str_weak(ON), - /* K10 */ be_nested_str_weak(shadow_occupancy), - /* K11 */ be_nested_str_weak(attribute_updated), - /* K12 */ be_const_int(0), + /* K1 */ be_nested_str_weak(VIRTUAL), + /* K2 */ be_nested_str_weak(Switch), + /* K3 */ be_nested_str_weak(tasmota_switch_index), + /* K4 */ be_nested_str_weak(tasmota), + /* K5 */ be_nested_str_weak(cmd), + /* K6 */ be_nested_str_weak(Status_X208), + /* K7 */ be_nested_str_weak(find), + /* K8 */ be_nested_str_weak(StatusSNS), + /* K9 */ be_nested_str_weak(contains), + /* K10 */ be_nested_str_weak(ON), + /* K11 */ be_nested_str_weak(shadow_occupancy), + /* K12 */ be_nested_str_weak(attribute_updated), + /* K13 */ be_const_int(0), }), be_str_weak(update_shadow), &be_const_str_solidified, - ( &(const binstruction[41]) { /* code */ + ( &(const binstruction[43]) { /* code */ 0x60040003, // 0000 GETGBL R1 G3 0x5C080000, // 0001 MOVE R2 R0 0x7C040200, // 0002 CALL R1 1 0x8C040300, // 0003 GETMET R1 R1 K0 0x7C040200, // 0004 CALL R1 1 - 0x60040008, // 0005 GETGBL R1 G8 - 0x88080102, // 0006 GETMBR R2 R0 K2 - 0x7C040200, // 0007 CALL R1 1 - 0x00060201, // 0008 ADD R1 K1 R1 - 0xB80A0600, // 0009 GETNGBL R2 K3 - 0x8C080504, // 000A GETMET R2 R2 K4 - 0x58100005, // 000B LDCONST R4 K5 - 0x50140200, // 000C LDBOOL R5 1 0 - 0x7C080600, // 000D CALL R2 3 - 0x4C0C0000, // 000E LDNIL R3 - 0x200C0403, // 000F NE R3 R2 R3 - 0x780E0003, // 0010 JMPF R3 #0015 - 0x8C0C0506, // 0011 GETMET R3 R2 K6 - 0x58140007, // 0012 LDCONST R5 K7 - 0x7C0C0400, // 0013 CALL R3 2 - 0x5C080600, // 0014 MOVE R2 R3 - 0x4C0C0000, // 0015 LDNIL R3 - 0x200C0403, // 0016 NE R3 R2 R3 - 0x780E000F, // 0017 JMPF R3 #0028 - 0x8C0C0508, // 0018 GETMET R3 R2 K8 - 0x5C140200, // 0019 MOVE R5 R1 - 0x7C0C0400, // 001A CALL R3 2 - 0x780E000B, // 001B JMPF R3 #0028 - 0x8C0C0506, // 001C GETMET R3 R2 K6 - 0x5C140200, // 001D MOVE R5 R1 - 0x7C0C0400, // 001E CALL R3 2 - 0x1C0C0709, // 001F EQ R3 R3 K9 - 0x8810010A, // 0020 GETMBR R4 R0 K10 - 0x20100803, // 0021 NE R4 R4 R3 - 0x78120003, // 0022 JMPF R4 #0027 - 0x8C10010B, // 0023 GETMET R4 R0 K11 - 0x541A0405, // 0024 LDINT R6 1030 - 0x581C000C, // 0025 LDCONST R7 K12 - 0x7C100600, // 0026 CALL R4 3 - 0x90021403, // 0027 SETMBR R0 K10 R3 - 0x80000000, // 0028 RET 0 + 0x88040101, // 0005 GETMBR R1 R0 K1 + 0x74060022, // 0006 JMPT R1 #002A + 0x60040008, // 0007 GETGBL R1 G8 + 0x88080103, // 0008 GETMBR R2 R0 K3 + 0x7C040200, // 0009 CALL R1 1 + 0x00060401, // 000A ADD R1 K2 R1 + 0xB80A0800, // 000B GETNGBL R2 K4 + 0x8C080505, // 000C GETMET R2 R2 K5 + 0x58100006, // 000D LDCONST R4 K6 + 0x50140200, // 000E LDBOOL R5 1 0 + 0x7C080600, // 000F CALL R2 3 + 0x4C0C0000, // 0010 LDNIL R3 + 0x200C0403, // 0011 NE R3 R2 R3 + 0x780E0003, // 0012 JMPF R3 #0017 + 0x8C0C0507, // 0013 GETMET R3 R2 K7 + 0x58140008, // 0014 LDCONST R5 K8 + 0x7C0C0400, // 0015 CALL R3 2 + 0x5C080600, // 0016 MOVE R2 R3 + 0x4C0C0000, // 0017 LDNIL R3 + 0x200C0403, // 0018 NE R3 R2 R3 + 0x780E000F, // 0019 JMPF R3 #002A + 0x8C0C0509, // 001A GETMET R3 R2 K9 + 0x5C140200, // 001B MOVE R5 R1 + 0x7C0C0400, // 001C CALL R3 2 + 0x780E000B, // 001D JMPF R3 #002A + 0x8C0C0507, // 001E GETMET R3 R2 K7 + 0x5C140200, // 001F MOVE R5 R1 + 0x7C0C0400, // 0020 CALL R3 2 + 0x1C0C070A, // 0021 EQ R3 R3 K10 + 0x8810010B, // 0022 GETMBR R4 R0 K11 + 0x20100803, // 0023 NE R4 R4 R3 + 0x78120003, // 0024 JMPF R4 #0029 + 0x8C10010C, // 0025 GETMET R4 R0 K12 + 0x541A0405, // 0026 LDINT R6 1030 + 0x581C000D, // 0027 LDCONST R7 K13 + 0x7C100600, // 0028 CALL R4 3 + 0x90021603, // 0029 SETMBR R0 K11 R3 + 0x80000000, // 002A RET 0 }) ) ); diff --git a/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_3_Sensor_OnOff.h b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_2_Sensor_OnOff.h similarity index 84% rename from lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_3_Sensor_OnOff.h rename to lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_2_Sensor_OnOff.h index 4bb8243a0..b0847cd19 100644 --- a/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_3_Sensor_OnOff.h +++ b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_2_Sensor_OnOff.h @@ -1,4 +1,4 @@ -/* Solidification of Matter_Plugin_3_Sensor_OnOff.h */ +/* Solidification of Matter_Plugin_2_Sensor_OnOff.h */ /********************************************************************\ * Generated code, don't edit * \********************************************************************/ @@ -46,65 +46,68 @@ be_local_closure(Matter_Plugin_Sensor_OnOff_update_shadow, /* name */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[13]) { /* constants */ + ( &(const bvalue[14]) { /* constants */ /* K0 */ be_nested_str_weak(update_shadow), - /* K1 */ be_nested_str_weak(Switch), - /* K2 */ be_nested_str_weak(tasmota_switch_index), - /* K3 */ be_nested_str_weak(tasmota), - /* K4 */ be_nested_str_weak(cmd), - /* K5 */ be_nested_str_weak(Status_X208), - /* K6 */ be_nested_str_weak(find), - /* K7 */ be_nested_str_weak(StatusSNS), - /* K8 */ be_nested_str_weak(contains), - /* K9 */ be_nested_str_weak(ON), - /* K10 */ be_nested_str_weak(shadow_onoff), - /* K11 */ be_nested_str_weak(attribute_updated), - /* K12 */ be_const_int(0), + /* K1 */ be_nested_str_weak(VIRTUAL), + /* K2 */ be_nested_str_weak(Switch), + /* K3 */ be_nested_str_weak(tasmota_switch_index), + /* K4 */ be_nested_str_weak(tasmota), + /* K5 */ be_nested_str_weak(cmd), + /* K6 */ be_nested_str_weak(Status_X208), + /* K7 */ be_nested_str_weak(find), + /* K8 */ be_nested_str_weak(StatusSNS), + /* K9 */ be_nested_str_weak(contains), + /* K10 */ be_nested_str_weak(ON), + /* K11 */ be_nested_str_weak(shadow_onoff), + /* K12 */ be_nested_str_weak(attribute_updated), + /* K13 */ be_const_int(0), }), be_str_weak(update_shadow), &be_const_str_solidified, - ( &(const binstruction[41]) { /* code */ + ( &(const binstruction[43]) { /* code */ 0x60040003, // 0000 GETGBL R1 G3 0x5C080000, // 0001 MOVE R2 R0 0x7C040200, // 0002 CALL R1 1 0x8C040300, // 0003 GETMET R1 R1 K0 0x7C040200, // 0004 CALL R1 1 - 0x60040008, // 0005 GETGBL R1 G8 - 0x88080102, // 0006 GETMBR R2 R0 K2 - 0x7C040200, // 0007 CALL R1 1 - 0x00060201, // 0008 ADD R1 K1 R1 - 0xB80A0600, // 0009 GETNGBL R2 K3 - 0x8C080504, // 000A GETMET R2 R2 K4 - 0x58100005, // 000B LDCONST R4 K5 - 0x50140200, // 000C LDBOOL R5 1 0 - 0x7C080600, // 000D CALL R2 3 - 0x4C0C0000, // 000E LDNIL R3 - 0x200C0403, // 000F NE R3 R2 R3 - 0x780E0003, // 0010 JMPF R3 #0015 - 0x8C0C0506, // 0011 GETMET R3 R2 K6 - 0x58140007, // 0012 LDCONST R5 K7 - 0x7C0C0400, // 0013 CALL R3 2 - 0x5C080600, // 0014 MOVE R2 R3 - 0x4C0C0000, // 0015 LDNIL R3 - 0x200C0403, // 0016 NE R3 R2 R3 - 0x780E000F, // 0017 JMPF R3 #0028 - 0x8C0C0508, // 0018 GETMET R3 R2 K8 - 0x5C140200, // 0019 MOVE R5 R1 - 0x7C0C0400, // 001A CALL R3 2 - 0x780E000B, // 001B JMPF R3 #0028 - 0x8C0C0506, // 001C GETMET R3 R2 K6 - 0x5C140200, // 001D MOVE R5 R1 - 0x7C0C0400, // 001E CALL R3 2 - 0x1C0C0709, // 001F EQ R3 R3 K9 - 0x8810010A, // 0020 GETMBR R4 R0 K10 - 0x20100803, // 0021 NE R4 R4 R3 - 0x78120003, // 0022 JMPF R4 #0027 - 0x8C10010B, // 0023 GETMET R4 R0 K11 - 0x541A0005, // 0024 LDINT R6 6 - 0x581C000C, // 0025 LDCONST R7 K12 - 0x7C100600, // 0026 CALL R4 3 - 0x90021403, // 0027 SETMBR R0 K10 R3 - 0x80000000, // 0028 RET 0 + 0x88040101, // 0005 GETMBR R1 R0 K1 + 0x74060022, // 0006 JMPT R1 #002A + 0x60040008, // 0007 GETGBL R1 G8 + 0x88080103, // 0008 GETMBR R2 R0 K3 + 0x7C040200, // 0009 CALL R1 1 + 0x00060401, // 000A ADD R1 K2 R1 + 0xB80A0800, // 000B GETNGBL R2 K4 + 0x8C080505, // 000C GETMET R2 R2 K5 + 0x58100006, // 000D LDCONST R4 K6 + 0x50140200, // 000E LDBOOL R5 1 0 + 0x7C080600, // 000F CALL R2 3 + 0x4C0C0000, // 0010 LDNIL R3 + 0x200C0403, // 0011 NE R3 R2 R3 + 0x780E0003, // 0012 JMPF R3 #0017 + 0x8C0C0507, // 0013 GETMET R3 R2 K7 + 0x58140008, // 0014 LDCONST R5 K8 + 0x7C0C0400, // 0015 CALL R3 2 + 0x5C080600, // 0016 MOVE R2 R3 + 0x4C0C0000, // 0017 LDNIL R3 + 0x200C0403, // 0018 NE R3 R2 R3 + 0x780E000F, // 0019 JMPF R3 #002A + 0x8C0C0509, // 001A GETMET R3 R2 K9 + 0x5C140200, // 001B MOVE R5 R1 + 0x7C0C0400, // 001C CALL R3 2 + 0x780E000B, // 001D JMPF R3 #002A + 0x8C0C0507, // 001E GETMET R3 R2 K7 + 0x5C140200, // 001F MOVE R5 R1 + 0x7C0C0400, // 0020 CALL R3 2 + 0x1C0C070A, // 0021 EQ R3 R3 K10 + 0x8810010B, // 0022 GETMBR R4 R0 K11 + 0x20100803, // 0023 NE R4 R4 R3 + 0x78120003, // 0024 JMPF R4 #0029 + 0x8C10010C, // 0025 GETMET R4 R0 K12 + 0x541A0005, // 0026 LDINT R6 6 + 0x581C000D, // 0027 LDCONST R7 K13 + 0x7C100600, // 0028 CALL R4 3 + 0x90021603, // 0029 SETMBR R0 K11 R3 + 0x80000000, // 002A RET 0 }) ) ); diff --git a/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_2_Shutter.h b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_2_Shutter.h index 30f6d8348..16c73a9ed 100644 --- a/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_2_Shutter.h +++ b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_2_Shutter.h @@ -606,40 +606,43 @@ be_local_closure(Matter_Plugin_Shutter_update_shadow, /* name */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[ 8]) { /* constants */ - /* K0 */ be_nested_str_weak(update_inverted), - /* K1 */ be_nested_str_weak(tasmota), - /* K2 */ be_nested_str_weak(cmd), - /* K3 */ be_nested_str_weak(ShutterPosition), - /* K4 */ be_nested_str_weak(tasmota_shutter_index), - /* K5 */ be_const_int(1), - /* K6 */ be_nested_str_weak(parse_sensors), - /* K7 */ be_nested_str_weak(update_shadow), + ( &(const bvalue[ 9]) { /* constants */ + /* K0 */ be_nested_str_weak(VIRTUAL), + /* K1 */ be_nested_str_weak(update_inverted), + /* K2 */ be_nested_str_weak(tasmota), + /* K3 */ be_nested_str_weak(cmd), + /* K4 */ be_nested_str_weak(ShutterPosition), + /* K5 */ be_nested_str_weak(tasmota_shutter_index), + /* K6 */ be_const_int(1), + /* K7 */ be_nested_str_weak(parse_sensors), + /* K8 */ be_nested_str_weak(update_shadow), }), be_str_weak(update_shadow), &be_const_str_solidified, - ( &(const binstruction[21]) { /* code */ - 0x8C040100, // 0000 GETMET R1 R0 K0 - 0x7C040200, // 0001 CALL R1 1 - 0xB8060200, // 0002 GETNGBL R1 K1 - 0x8C040302, // 0003 GETMET R1 R1 K2 - 0x600C0008, // 0004 GETGBL R3 G8 - 0x88100104, // 0005 GETMBR R4 R0 K4 - 0x00100905, // 0006 ADD R4 R4 K5 - 0x7C0C0200, // 0007 CALL R3 1 - 0x000E0603, // 0008 ADD R3 K3 R3 - 0x50100200, // 0009 LDBOOL R4 1 0 - 0x7C040600, // 000A CALL R1 3 - 0x78060002, // 000B JMPF R1 #000F - 0x8C080106, // 000C GETMET R2 R0 K6 - 0x5C100200, // 000D MOVE R4 R1 - 0x7C080400, // 000E CALL R2 2 - 0x60080003, // 000F GETGBL R2 G3 - 0x5C0C0000, // 0010 MOVE R3 R0 - 0x7C080200, // 0011 CALL R2 1 - 0x8C080507, // 0012 GETMET R2 R2 K7 - 0x7C080200, // 0013 CALL R2 1 - 0x80000000, // 0014 RET 0 + ( &(const binstruction[23]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x7406000E, // 0001 JMPT R1 #0011 + 0x8C040101, // 0002 GETMET R1 R0 K1 + 0x7C040200, // 0003 CALL R1 1 + 0xB8060400, // 0004 GETNGBL R1 K2 + 0x8C040303, // 0005 GETMET R1 R1 K3 + 0x600C0008, // 0006 GETGBL R3 G8 + 0x88100105, // 0007 GETMBR R4 R0 K5 + 0x00100906, // 0008 ADD R4 R4 K6 + 0x7C0C0200, // 0009 CALL R3 1 + 0x000E0803, // 000A ADD R3 K4 R3 + 0x50100200, // 000B LDBOOL R4 1 0 + 0x7C040600, // 000C CALL R1 3 + 0x78060002, // 000D JMPF R1 #0011 + 0x8C080107, // 000E GETMET R2 R0 K7 + 0x5C100200, // 000F MOVE R4 R1 + 0x7C080400, // 0010 CALL R2 2 + 0x60040003, // 0011 GETGBL R1 G3 + 0x5C080000, // 0012 MOVE R2 R0 + 0x7C040200, // 0013 CALL R1 1 + 0x8C040308, // 0014 GETMET R1 R1 K8 + 0x7C040200, // 0015 CALL R1 1 + 0x80000000, // 0016 RET 0 }) ) ); diff --git a/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_4_Bridge_Sensor_Contact.h b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_3_Bridge_Sensor_Contact.h similarity index 99% rename from lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_4_Bridge_Sensor_Contact.h rename to lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_3_Bridge_Sensor_Contact.h index ded960e54..5f072e844 100644 --- a/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_4_Bridge_Sensor_Contact.h +++ b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_3_Bridge_Sensor_Contact.h @@ -1,4 +1,4 @@ -/* Solidification of Matter_Plugin_4_Bridge_Sensor_Contact.h */ +/* Solidification of Matter_Plugin_3_Bridge_Sensor_Contact.h */ /********************************************************************\ * Generated code, don't edit * \********************************************************************/ diff --git a/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_4_Bridge_Sensor_Occupancy.h b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_3_Bridge_Sensor_Occupancy.h similarity index 99% rename from lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_4_Bridge_Sensor_Occupancy.h rename to lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_3_Bridge_Sensor_Occupancy.h index b19d193b9..f79147599 100644 --- a/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_4_Bridge_Sensor_Occupancy.h +++ b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_3_Bridge_Sensor_Occupancy.h @@ -1,4 +1,4 @@ -/* Solidification of Matter_Plugin_4_Bridge_Sensor_Occupancy.h */ +/* Solidification of Matter_Plugin_3_Bridge_Sensor_Occupancy.h */ /********************************************************************\ * Generated code, don't edit * \********************************************************************/ diff --git a/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_3_Light0.h b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_3_Light0.h new file mode 100644 index 000000000..617c428aa --- /dev/null +++ b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_3_Light0.h @@ -0,0 +1,36 @@ +/* Solidification of Matter_Plugin_3_Light0.h */ +/********************************************************************\ +* Generated code, don't edit * +\********************************************************************/ +#include "be_constobj.h" + +extern const bclass be_class_Matter_Plugin_Light0; + +/******************************************************************** +** Solidified class: Matter_Plugin_Light0 +********************************************************************/ +extern const bclass be_class_Matter_Plugin_OnOff; +be_local_class(Matter_Plugin_Light0, + 0, + &be_class_Matter_Plugin_OnOff, + be_nested_map(3, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_const_key_weak(DISPLAY_NAME, -1), be_nested_str_weak(Light_X200_X20On) }, + { be_const_key_weak(TYPE, -1), be_nested_str_weak(light0) }, + { be_const_key_weak(TYPES, -1), be_const_simple_instance(be_nested_simple_instance(&be_class_map, { + be_const_map( * be_nested_map(1, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_const_key_int(256, -1), be_const_int(2) }, + })) ) } )) }, + })), + be_str_weak(Matter_Plugin_Light0) +); +/*******************************************************************/ + +void be_load_Matter_Plugin_Light0_class(bvm *vm) { + be_pushntvclass(vm, &be_class_Matter_Plugin_Light0); + be_setglobal(vm, "Matter_Plugin_Light0"); + be_pop(vm, 1); +} +/********************************************************************/ +/* End of solidification */ diff --git a/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_3_Light1.h b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_3_Light1.h deleted file mode 100644 index 2d227550a..000000000 --- a/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_3_Light1.h +++ /dev/null @@ -1,663 +0,0 @@ -/* Solidification of Matter_Plugin_3_Light1.h */ -/********************************************************************\ -* Generated code, don't edit * -\********************************************************************/ -#include "be_constobj.h" - -extern const bclass be_class_Matter_Plugin_Light1; - -/******************************************************************** -** Solidified function: set_bri -********************************************************************/ -be_local_closure(Matter_Plugin_Light1_set_bri, /* name */ - be_nested_proto( - 11, /* nstack */ - 3, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[12]) { /* constants */ - /* K0 */ be_const_int(0), - /* K1 */ be_nested_str_weak(VIRTUAL), - /* K2 */ be_nested_str_weak(light), - /* K3 */ be_nested_str_weak(tasmota), - /* K4 */ be_nested_str_weak(scale_uint), - /* K5 */ be_nested_str_weak(set), - /* K6 */ be_nested_str_weak(bri), - /* K7 */ be_nested_str_weak(power), - /* K8 */ be_nested_str_weak(update_shadow), - /* K9 */ be_nested_str_weak(shadow_onoff), - /* K10 */ be_nested_str_weak(attribute_updated), - /* K11 */ be_nested_str_weak(shadow_bri), - }), - be_str_weak(set_bri), - &be_const_str_solidified, - ( &(const binstruction[65]) { /* code */ - 0x140C0300, // 0000 LT R3 R1 K0 - 0x780E0000, // 0001 JMPF R3 #0003 - 0x58040000, // 0002 LDCONST R1 K0 - 0x540E00FD, // 0003 LDINT R3 254 - 0x240C0203, // 0004 GT R3 R1 R3 - 0x780E0000, // 0005 JMPF R3 #0007 - 0x540600FD, // 0006 LDINT R1 254 - 0x4C0C0000, // 0007 LDNIL R3 - 0x200C0403, // 0008 NE R3 R2 R3 - 0x780E0003, // 0009 JMPF R3 #000E - 0x600C0017, // 000A GETGBL R3 G23 - 0x5C100400, // 000B MOVE R4 R2 - 0x7C0C0200, // 000C CALL R3 1 - 0x70020000, // 000D JMP #000F - 0x4C0C0000, // 000E LDNIL R3 - 0x5C080600, // 000F MOVE R2 R3 - 0x880C0101, // 0010 GETMBR R3 R0 K1 - 0x740E001A, // 0011 JMPT R3 #002D - 0xA40E0400, // 0012 IMPORT R3 K2 - 0xB8120600, // 0013 GETNGBL R4 K3 - 0x8C100904, // 0014 GETMET R4 R4 K4 - 0x5C180200, // 0015 MOVE R6 R1 - 0x581C0000, // 0016 LDCONST R7 K0 - 0x542200FD, // 0017 LDINT R8 254 - 0x58240000, // 0018 LDCONST R9 K0 - 0x542A00FE, // 0019 LDINT R10 255 - 0x7C100C00, // 001A CALL R4 6 - 0x4C140000, // 001B LDNIL R5 - 0x1C140405, // 001C EQ R5 R2 R5 - 0x78160005, // 001D JMPF R5 #0024 - 0x8C140705, // 001E GETMET R5 R3 K5 - 0x601C0013, // 001F GETGBL R7 G19 - 0x7C1C0000, // 0020 CALL R7 0 - 0x981E0C04, // 0021 SETIDX R7 K6 R4 - 0x7C140400, // 0022 CALL R5 2 - 0x70020005, // 0023 JMP #002A - 0x8C140705, // 0024 GETMET R5 R3 K5 - 0x601C0013, // 0025 GETGBL R7 G19 - 0x7C1C0000, // 0026 CALL R7 0 - 0x981E0C04, // 0027 SETIDX R7 K6 R4 - 0x981E0E02, // 0028 SETIDX R7 K7 R2 - 0x7C140400, // 0029 CALL R5 2 - 0x8C140108, // 002A GETMET R5 R0 K8 - 0x7C140200, // 002B CALL R5 1 - 0x70020012, // 002C JMP #0040 - 0x4C0C0000, // 002D LDNIL R3 - 0x200C0403, // 002E NE R3 R2 R3 - 0x780E0007, // 002F JMPF R3 #0038 - 0x880C0109, // 0030 GETMBR R3 R0 K9 - 0x200C0403, // 0031 NE R3 R2 R3 - 0x780E0004, // 0032 JMPF R3 #0038 - 0x8C0C010A, // 0033 GETMET R3 R0 K10 - 0x54160005, // 0034 LDINT R5 6 - 0x58180000, // 0035 LDCONST R6 K0 - 0x7C0C0600, // 0036 CALL R3 3 - 0x90021202, // 0037 SETMBR R0 K9 R2 - 0x880C010B, // 0038 GETMBR R3 R0 K11 - 0x200C0203, // 0039 NE R3 R1 R3 - 0x780E0004, // 003A JMPF R3 #0040 - 0x8C0C010A, // 003B GETMET R3 R0 K10 - 0x54160007, // 003C LDINT R5 8 - 0x58180000, // 003D LDCONST R6 K0 - 0x7C0C0600, // 003E CALL R3 3 - 0x90021601, // 003F SETMBR R0 K11 R1 - 0x80000000, // 0040 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: init -********************************************************************/ -be_local_closure(Matter_Plugin_Light1_init, /* name */ - be_nested_proto( - 9, /* nstack */ - 4, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 3]) { /* constants */ - /* K0 */ be_nested_str_weak(init), - /* K1 */ be_nested_str_weak(shadow_bri), - /* K2 */ be_const_int(0), - }), - be_str_weak(init), - &be_const_str_solidified, - ( &(const binstruction[10]) { /* code */ - 0x60100003, // 0000 GETGBL R4 G3 - 0x5C140000, // 0001 MOVE R5 R0 - 0x7C100200, // 0002 CALL R4 1 - 0x8C100900, // 0003 GETMET R4 R4 K0 - 0x5C180200, // 0004 MOVE R6 R1 - 0x5C1C0400, // 0005 MOVE R7 R2 - 0x5C200600, // 0006 MOVE R8 R3 - 0x7C100800, // 0007 CALL R4 4 - 0x90020302, // 0008 SETMBR R0 K1 K2 - 0x80000000, // 0009 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: update_shadow -********************************************************************/ -be_local_closure(Matter_Plugin_Light1_update_shadow, /* name */ - be_nested_proto( - 11, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[11]) { /* constants */ - /* K0 */ be_nested_str_weak(VIRTUAL), - /* K1 */ be_nested_str_weak(light), - /* K2 */ be_nested_str_weak(get), - /* K3 */ be_nested_str_weak(find), - /* K4 */ be_nested_str_weak(bri), - /* K5 */ be_nested_str_weak(tasmota), - /* K6 */ be_nested_str_weak(scale_uint), - /* K7 */ be_const_int(0), - /* K8 */ be_nested_str_weak(shadow_bri), - /* K9 */ be_nested_str_weak(attribute_updated), - /* K10 */ be_nested_str_weak(update_shadow), - }), - be_str_weak(update_shadow), - &be_const_str_solidified, - ( &(const binstruction[38]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x7406001D, // 0001 JMPT R1 #0020 - 0xA4060200, // 0002 IMPORT R1 K1 - 0x8C080302, // 0003 GETMET R2 R1 K2 - 0x7C080200, // 0004 CALL R2 1 - 0x4C0C0000, // 0005 LDNIL R3 - 0x200C0403, // 0006 NE R3 R2 R3 - 0x780E0017, // 0007 JMPF R3 #0020 - 0x8C0C0503, // 0008 GETMET R3 R2 K3 - 0x58140004, // 0009 LDCONST R5 K4 - 0x4C180000, // 000A LDNIL R6 - 0x7C0C0600, // 000B CALL R3 3 - 0x4C100000, // 000C LDNIL R4 - 0x20100604, // 000D NE R4 R3 R4 - 0x78120010, // 000E JMPF R4 #0020 - 0xB8120A00, // 000F GETNGBL R4 K5 - 0x8C100906, // 0010 GETMET R4 R4 K6 - 0x5C180600, // 0011 MOVE R6 R3 - 0x581C0007, // 0012 LDCONST R7 K7 - 0x542200FE, // 0013 LDINT R8 255 - 0x58240007, // 0014 LDCONST R9 K7 - 0x542A00FD, // 0015 LDINT R10 254 - 0x7C100C00, // 0016 CALL R4 6 - 0x5C0C0800, // 0017 MOVE R3 R4 - 0x88100108, // 0018 GETMBR R4 R0 K8 - 0x20100604, // 0019 NE R4 R3 R4 - 0x78120004, // 001A JMPF R4 #0020 - 0x8C100109, // 001B GETMET R4 R0 K9 - 0x541A0007, // 001C LDINT R6 8 - 0x581C0007, // 001D LDCONST R7 K7 - 0x7C100600, // 001E CALL R4 3 - 0x90021003, // 001F SETMBR R0 K8 R3 - 0x60040003, // 0020 GETGBL R1 G3 - 0x5C080000, // 0021 MOVE R2 R0 - 0x7C040200, // 0022 CALL R1 1 - 0x8C04030A, // 0023 GETMET R1 R1 K10 - 0x7C040200, // 0024 CALL R1 1 - 0x80000000, // 0025 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: read_attribute -********************************************************************/ -be_local_closure(Matter_Plugin_Light1_read_attribute, /* name */ - be_nested_proto( - 12, /* nstack */ - 4, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[14]) { /* constants */ - /* K0 */ be_nested_str_weak(matter), - /* K1 */ be_nested_str_weak(TLV), - /* K2 */ be_nested_str_weak(cluster), - /* K3 */ be_nested_str_weak(attribute), - /* K4 */ be_nested_str_weak(update_shadow_lazy), - /* K5 */ be_const_int(0), - /* K6 */ be_nested_str_weak(set), - /* K7 */ be_nested_str_weak(U1), - /* K8 */ be_nested_str_weak(shadow_bri), - /* K9 */ be_const_int(2), - /* K10 */ be_const_int(3), - /* K11 */ be_nested_str_weak(U4), - /* K12 */ be_const_int(1), - /* K13 */ be_nested_str_weak(read_attribute), - }), - be_str_weak(read_attribute), - &be_const_str_solidified, - ( &(const binstruction[79]) { /* code */ - 0xB8120000, // 0000 GETNGBL R4 K0 - 0x88100901, // 0001 GETMBR R4 R4 K1 - 0x88140502, // 0002 GETMBR R5 R2 K2 - 0x88180503, // 0003 GETMBR R6 R2 K3 - 0x541E0007, // 0004 LDINT R7 8 - 0x1C1C0A07, // 0005 EQ R7 R5 R7 - 0x781E003D, // 0006 JMPF R7 #0045 - 0x8C1C0104, // 0007 GETMET R7 R0 K4 - 0x7C1C0200, // 0008 CALL R7 1 - 0x1C1C0D05, // 0009 EQ R7 R6 K5 - 0x781E0005, // 000A JMPF R7 #0011 - 0x8C1C0706, // 000B GETMET R7 R3 K6 - 0x88240907, // 000C GETMBR R9 R4 K7 - 0x88280108, // 000D GETMBR R10 R0 K8 - 0x7C1C0600, // 000E CALL R7 3 - 0x80040E00, // 000F RET 1 R7 - 0x70020032, // 0010 JMP #0044 - 0x1C1C0D09, // 0011 EQ R7 R6 K9 - 0x781E0005, // 0012 JMPF R7 #0019 - 0x8C1C0706, // 0013 GETMET R7 R3 K6 - 0x88240907, // 0014 GETMBR R9 R4 K7 - 0x58280005, // 0015 LDCONST R10 K5 - 0x7C1C0600, // 0016 CALL R7 3 - 0x80040E00, // 0017 RET 1 R7 - 0x7002002A, // 0018 JMP #0044 - 0x1C1C0D0A, // 0019 EQ R7 R6 K10 - 0x781E0005, // 001A JMPF R7 #0021 - 0x8C1C0706, // 001B GETMET R7 R3 K6 - 0x88240907, // 001C GETMBR R9 R4 K7 - 0x542A00FD, // 001D LDINT R10 254 - 0x7C1C0600, // 001E CALL R7 3 - 0x80040E00, // 001F RET 1 R7 - 0x70020022, // 0020 JMP #0044 - 0x541E000E, // 0021 LDINT R7 15 - 0x1C1C0C07, // 0022 EQ R7 R6 R7 - 0x781E0005, // 0023 JMPF R7 #002A - 0x8C1C0706, // 0024 GETMET R7 R3 K6 - 0x88240907, // 0025 GETMBR R9 R4 K7 - 0x58280005, // 0026 LDCONST R10 K5 - 0x7C1C0600, // 0027 CALL R7 3 - 0x80040E00, // 0028 RET 1 R7 - 0x70020019, // 0029 JMP #0044 - 0x541E0010, // 002A LDINT R7 17 - 0x1C1C0C07, // 002B EQ R7 R6 R7 - 0x781E0005, // 002C JMPF R7 #0033 - 0x8C1C0706, // 002D GETMET R7 R3 K6 - 0x88240907, // 002E GETMBR R9 R4 K7 - 0x88280108, // 002F GETMBR R10 R0 K8 - 0x7C1C0600, // 0030 CALL R7 3 - 0x80040E00, // 0031 RET 1 R7 - 0x70020010, // 0032 JMP #0044 - 0x541EFFFB, // 0033 LDINT R7 65532 - 0x1C1C0C07, // 0034 EQ R7 R6 R7 - 0x781E0005, // 0035 JMPF R7 #003C - 0x8C1C0706, // 0036 GETMET R7 R3 K6 - 0x8824090B, // 0037 GETMBR R9 R4 K11 - 0x5828000C, // 0038 LDCONST R10 K12 - 0x7C1C0600, // 0039 CALL R7 3 - 0x80040E00, // 003A RET 1 R7 - 0x70020007, // 003B JMP #0044 - 0x541EFFFC, // 003C LDINT R7 65533 - 0x1C1C0C07, // 003D EQ R7 R6 R7 - 0x781E0004, // 003E JMPF R7 #0044 - 0x8C1C0706, // 003F GETMET R7 R3 K6 - 0x8824090B, // 0040 GETMBR R9 R4 K11 - 0x542A0004, // 0041 LDINT R10 5 - 0x7C1C0600, // 0042 CALL R7 3 - 0x80040E00, // 0043 RET 1 R7 - 0x70020008, // 0044 JMP #004E - 0x601C0003, // 0045 GETGBL R7 G3 - 0x5C200000, // 0046 MOVE R8 R0 - 0x7C1C0200, // 0047 CALL R7 1 - 0x8C1C0F0D, // 0048 GETMET R7 R7 K13 - 0x5C240200, // 0049 MOVE R9 R1 - 0x5C280400, // 004A MOVE R10 R2 - 0x5C2C0600, // 004B MOVE R11 R3 - 0x7C1C0800, // 004C CALL R7 4 - 0x80040E00, // 004D RET 1 R7 - 0x80000000, // 004E RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: update_virtual -********************************************************************/ -be_local_closure(Matter_Plugin_Light1_update_virtual, /* name */ - be_nested_proto( - 8, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 5]) { /* constants */ - /* K0 */ be_nested_str_weak(find), - /* K1 */ be_nested_str_weak(Power), - /* K2 */ be_nested_str_weak(Bri), - /* K3 */ be_nested_str_weak(set_bri), - /* K4 */ be_nested_str_weak(update_virtual), - }), - be_str_weak(update_virtual), - &be_const_str_solidified, - ( &(const binstruction[23]) { /* code */ - 0x8C080300, // 0000 GETMET R2 R1 K0 - 0x58100001, // 0001 LDCONST R4 K1 - 0x7C080400, // 0002 CALL R2 2 - 0x8C0C0300, // 0003 GETMET R3 R1 K0 - 0x58140002, // 0004 LDCONST R5 K2 - 0x7C0C0400, // 0005 CALL R3 2 - 0x4C100000, // 0006 LDNIL R4 - 0x20100604, // 0007 NE R4 R3 R4 - 0x78120006, // 0008 JMPF R4 #0010 - 0x8C100103, // 0009 GETMET R4 R0 K3 - 0x60180009, // 000A GETGBL R6 G9 - 0x5C1C0600, // 000B MOVE R7 R3 - 0x7C180200, // 000C CALL R6 1 - 0x5C1C0400, // 000D MOVE R7 R2 - 0x7C100600, // 000E CALL R4 3 - 0x80000800, // 000F RET 0 - 0x60100003, // 0010 GETGBL R4 G3 - 0x5C140000, // 0011 MOVE R5 R0 - 0x7C100200, // 0012 CALL R4 1 - 0x8C100904, // 0013 GETMET R4 R4 K4 - 0x5C180200, // 0014 MOVE R6 R1 - 0x7C100400, // 0015 CALL R4 2 - 0x80000000, // 0016 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: invoke_request -********************************************************************/ -be_local_closure(Matter_Plugin_Light1_invoke_request, /* name */ - be_nested_proto( - 22, /* nstack */ - 4, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[21]) { /* constants */ - /* K0 */ be_nested_str_weak(light), - /* K1 */ be_nested_str_weak(matter), - /* K2 */ be_nested_str_weak(TLV), - /* K3 */ be_nested_str_weak(cluster), - /* K4 */ be_nested_str_weak(command), - /* K5 */ be_nested_str_weak(update_shadow_lazy), - /* K6 */ be_const_int(0), - /* K7 */ be_nested_str_weak(findsubval), - /* K8 */ be_nested_str_weak(set_bri), - /* K9 */ be_nested_str_weak(log), - /* K10 */ be_nested_str_weak(bri_X3A), - /* K11 */ be_nested_str_weak(publish_command), - /* K12 */ be_nested_str_weak(Bri), - /* K13 */ be_nested_str_weak(Dimmer), - /* K14 */ be_nested_str_weak(tasmota), - /* K15 */ be_nested_str_weak(scale_uint), - /* K16 */ be_const_int(1), - /* K17 */ be_const_int(2), - /* K18 */ be_const_int(3), - /* K19 */ be_nested_str_weak(Power), - /* K20 */ be_nested_str_weak(invoke_request), - }), - be_str_weak(invoke_request), - &be_const_str_solidified, - ( &(const binstruction[119]) { /* code */ - 0xA4120000, // 0000 IMPORT R4 K0 - 0xB8160200, // 0001 GETNGBL R5 K1 - 0x88140B02, // 0002 GETMBR R5 R5 K2 - 0x88180703, // 0003 GETMBR R6 R3 K3 - 0x881C0704, // 0004 GETMBR R7 R3 K4 - 0x54220007, // 0005 LDINT R8 8 - 0x1C200C08, // 0006 EQ R8 R6 R8 - 0x78220064, // 0007 JMPF R8 #006D - 0x8C200105, // 0008 GETMET R8 R0 K5 - 0x7C200200, // 0009 CALL R8 1 - 0x1C200F06, // 000A EQ R8 R7 K6 - 0x7822001A, // 000B JMPF R8 #0027 - 0x8C200507, // 000C GETMET R8 R2 K7 - 0x58280006, // 000D LDCONST R10 K6 - 0x7C200400, // 000E CALL R8 2 - 0x8C240108, // 000F GETMET R9 R0 K8 - 0x5C2C1000, // 0010 MOVE R11 R8 - 0x7C240400, // 0011 CALL R9 2 - 0x60240008, // 0012 GETGBL R9 G8 - 0x5C281000, // 0013 MOVE R10 R8 - 0x7C240200, // 0014 CALL R9 1 - 0x00261409, // 0015 ADD R9 K10 R9 - 0x900E1209, // 0016 SETMBR R3 K9 R9 - 0x8C24010B, // 0017 GETMET R9 R0 K11 - 0x582C000C, // 0018 LDCONST R11 K12 - 0x5C301000, // 0019 MOVE R12 R8 - 0x5834000D, // 001A LDCONST R13 K13 - 0xB83A1C00, // 001B GETNGBL R14 K14 - 0x8C381D0F, // 001C GETMET R14 R14 K15 - 0x5C401000, // 001D MOVE R16 R8 - 0x58440006, // 001E LDCONST R17 K6 - 0x544A00FD, // 001F LDINT R18 254 - 0x584C0006, // 0020 LDCONST R19 K6 - 0x54520063, // 0021 LDINT R20 100 - 0x7C380C00, // 0022 CALL R14 6 - 0x7C240A00, // 0023 CALL R9 5 - 0x50240200, // 0024 LDBOOL R9 1 0 - 0x80041200, // 0025 RET 1 R9 - 0x70020044, // 0026 JMP #006C - 0x1C200F10, // 0027 EQ R8 R7 K16 - 0x78220002, // 0028 JMPF R8 #002C - 0x50200200, // 0029 LDBOOL R8 1 0 - 0x80041000, // 002A RET 1 R8 - 0x7002003F, // 002B JMP #006C - 0x1C200F11, // 002C EQ R8 R7 K17 - 0x78220002, // 002D JMPF R8 #0031 - 0x50200200, // 002E LDBOOL R8 1 0 - 0x80041000, // 002F RET 1 R8 - 0x7002003A, // 0030 JMP #006C - 0x1C200F12, // 0031 EQ R8 R7 K18 - 0x78220002, // 0032 JMPF R8 #0036 - 0x50200200, // 0033 LDBOOL R8 1 0 - 0x80041000, // 0034 RET 1 R8 - 0x70020035, // 0035 JMP #006C - 0x54220003, // 0036 LDINT R8 4 - 0x1C200E08, // 0037 EQ R8 R7 R8 - 0x78220021, // 0038 JMPF R8 #005B - 0x8C200507, // 0039 GETMET R8 R2 K7 - 0x58280006, // 003A LDCONST R10 K6 - 0x7C200400, // 003B CALL R8 2 - 0x24241106, // 003C GT R9 R8 K6 - 0x8C280108, // 003D GETMET R10 R0 K8 - 0x5C301000, // 003E MOVE R12 R8 - 0x5C341200, // 003F MOVE R13 R9 - 0x7C280600, // 0040 CALL R10 3 - 0x60280008, // 0041 GETGBL R10 G8 - 0x5C2C1000, // 0042 MOVE R11 R8 - 0x7C280200, // 0043 CALL R10 1 - 0x002A140A, // 0044 ADD R10 K10 R10 - 0x900E120A, // 0045 SETMBR R3 K9 R10 - 0x8C28010B, // 0046 GETMET R10 R0 K11 - 0x5830000C, // 0047 LDCONST R12 K12 - 0x5C341000, // 0048 MOVE R13 R8 - 0x5838000D, // 0049 LDCONST R14 K13 - 0xB83E1C00, // 004A GETNGBL R15 K14 - 0x8C3C1F0F, // 004B GETMET R15 R15 K15 - 0x5C441000, // 004C MOVE R17 R8 - 0x58480006, // 004D LDCONST R18 K6 - 0x544E00FD, // 004E LDINT R19 254 - 0x58500006, // 004F LDCONST R20 K6 - 0x54560063, // 0050 LDINT R21 100 - 0x7C3C0C00, // 0051 CALL R15 6 - 0x58400013, // 0052 LDCONST R16 K19 - 0x78260001, // 0053 JMPF R9 #0056 - 0x58440010, // 0054 LDCONST R17 K16 - 0x70020000, // 0055 JMP #0057 - 0x58440006, // 0056 LDCONST R17 K6 - 0x7C280E00, // 0057 CALL R10 7 - 0x50280200, // 0058 LDBOOL R10 1 0 - 0x80041400, // 0059 RET 1 R10 - 0x70020010, // 005A JMP #006C - 0x54220004, // 005B LDINT R8 5 - 0x1C200E08, // 005C EQ R8 R7 R8 - 0x78220002, // 005D JMPF R8 #0061 - 0x50200200, // 005E LDBOOL R8 1 0 - 0x80041000, // 005F RET 1 R8 - 0x7002000A, // 0060 JMP #006C - 0x54220005, // 0061 LDINT R8 6 - 0x1C200E08, // 0062 EQ R8 R7 R8 - 0x78220002, // 0063 JMPF R8 #0067 - 0x50200200, // 0064 LDBOOL R8 1 0 - 0x80041000, // 0065 RET 1 R8 - 0x70020004, // 0066 JMP #006C - 0x54220006, // 0067 LDINT R8 7 - 0x1C200E08, // 0068 EQ R8 R7 R8 - 0x78220001, // 0069 JMPF R8 #006C - 0x50200200, // 006A LDBOOL R8 1 0 - 0x80041000, // 006B RET 1 R8 - 0x70020008, // 006C JMP #0076 - 0x60200003, // 006D GETGBL R8 G3 - 0x5C240000, // 006E MOVE R9 R0 - 0x7C200200, // 006F CALL R8 1 - 0x8C201114, // 0070 GETMET R8 R8 K20 - 0x5C280200, // 0071 MOVE R10 R1 - 0x5C2C0400, // 0072 MOVE R11 R2 - 0x5C300600, // 0073 MOVE R12 R3 - 0x7C200800, // 0074 CALL R8 4 - 0x80041000, // 0075 RET 1 R8 - 0x80000000, // 0076 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified class: Matter_Plugin_Light1 -********************************************************************/ -extern const bclass be_class_Matter_Plugin_Light0; -be_local_class(Matter_Plugin_Light1, - 1, - &be_class_Matter_Plugin_Light0, - be_nested_map(12, - ( (struct bmapnode*) &(const bmapnode[]) { - { be_const_key_weak(invoke_request, -1), be_const_closure(Matter_Plugin_Light1_invoke_request_closure) }, - { be_const_key_weak(shadow_bri, 7), be_const_var(0) }, - { be_const_key_weak(TYPES, -1), be_const_simple_instance(be_nested_simple_instance(&be_class_map, { - be_const_map( * be_nested_map(1, - ( (struct bmapnode*) &(const bmapnode[]) { - { be_const_key_int(257, -1), be_const_int(2) }, - })) ) } )) }, - { be_const_key_weak(UPDATE_COMMANDS, 4), be_const_simple_instance(be_nested_simple_instance(&be_class_list, { - be_const_list( * be_nested_list(2, - ( (struct bvalue*) &(const bvalue[]) { - be_nested_str_weak(Power), - be_nested_str_weak(Bri), - })) ) } )) }, - { be_const_key_weak(init, -1), be_const_closure(Matter_Plugin_Light1_init_closure) }, - { be_const_key_weak(update_shadow, -1), be_const_closure(Matter_Plugin_Light1_update_shadow_closure) }, - { be_const_key_weak(read_attribute, -1), be_const_closure(Matter_Plugin_Light1_read_attribute_closure) }, - { be_const_key_weak(TYPE, 5), be_nested_str_weak(light1) }, - { be_const_key_weak(update_virtual, -1), be_const_closure(Matter_Plugin_Light1_update_virtual_closure) }, - { be_const_key_weak(DISPLAY_NAME, -1), be_nested_str_weak(Light_X201_X20Dimmer) }, - { be_const_key_weak(CLUSTERS, -1), be_const_simple_instance(be_nested_simple_instance(&be_class_map, { - be_const_map( * be_nested_map(7, - ( (struct bmapnode*) &(const bmapnode[]) { - { be_const_key_int(29, 2), be_const_simple_instance(be_nested_simple_instance(&be_class_list, { - be_const_list( * be_nested_list(6, - ( (struct bvalue*) &(const bvalue[]) { - be_const_int(0), - be_const_int(1), - be_const_int(2), - be_const_int(3), - be_const_int(65532), - be_const_int(65533), - })) ) } )) }, - { be_const_key_int(8, 0), be_const_simple_instance(be_nested_simple_instance(&be_class_list, { - be_const_list( * be_nested_list(7, - ( (struct bvalue*) &(const bvalue[]) { - be_const_int(0), - be_const_int(2), - be_const_int(3), - be_const_int(15), - be_const_int(17), - be_const_int(65532), - be_const_int(65533), - })) ) } )) }, - { be_const_key_int(57, -1), be_const_simple_instance(be_nested_simple_instance(&be_class_list, { - be_const_list( * be_nested_list(7, - ( (struct bvalue*) &(const bvalue[]) { - be_const_int(17), - be_const_int(3), - be_const_int(5), - be_const_int(10), - be_const_int(15), - be_const_int(17), - be_const_int(18), - })) ) } )) }, - { be_const_key_int(3, -1), be_const_simple_instance(be_nested_simple_instance(&be_class_list, { - be_const_list( * be_nested_list(4, - ( (struct bvalue*) &(const bvalue[]) { - be_const_int(0), - be_const_int(1), - be_const_int(65532), - be_const_int(65533), - })) ) } )) }, - { be_const_key_int(4, -1), be_const_simple_instance(be_nested_simple_instance(&be_class_list, { - be_const_list( * be_nested_list(3, - ( (struct bvalue*) &(const bvalue[]) { - be_const_int(0), - be_const_int(65532), - be_const_int(65533), - })) ) } )) }, - { be_const_key_int(5, -1), be_const_simple_instance(be_nested_simple_instance(&be_class_list, { - be_const_list( * be_nested_list(8, - ( (struct bvalue*) &(const bvalue[]) { - be_const_int(0), - be_const_int(1), - be_const_int(2), - be_const_int(3), - be_const_int(4), - be_const_int(5), - be_const_int(65532), - be_const_int(65533), - })) ) } )) }, - { be_const_key_int(6, -1), be_const_simple_instance(be_nested_simple_instance(&be_class_list, { - be_const_list( * be_nested_list(3, - ( (struct bvalue*) &(const bvalue[]) { - be_const_int(0), - be_const_int(65532), - be_const_int(65533), - })) ) } )) }, - })) ) } )) }, - { be_const_key_weak(set_bri, 0), be_const_closure(Matter_Plugin_Light1_set_bri_closure) }, - })), - be_str_weak(Matter_Plugin_Light1) -); -/*******************************************************************/ - -void be_load_Matter_Plugin_Light1_class(bvm *vm) { - be_pushntvclass(vm, &be_class_Matter_Plugin_Light1); - be_setglobal(vm, "Matter_Plugin_Light1"); - be_pop(vm, 1); -} -/********************************************************************/ -/* End of solidification */ diff --git a/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_4_Light2.h b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_3_Light2.h similarity index 91% rename from lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_4_Light2.h rename to lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_3_Light2.h index a52eb7229..8f157b0f3 100644 --- a/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_4_Light2.h +++ b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_3_Light2.h @@ -1,4 +1,4 @@ -/* Solidification of Matter_Plugin_4_Light2.h */ +/* Solidification of Matter_Plugin_3_Light2.h */ /********************************************************************\ * Generated code, don't edit * \********************************************************************/ @@ -156,49 +156,58 @@ be_local_closure(Matter_Plugin_Light2_update_shadow, /* name */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[ 8]) { /* constants */ - /* K0 */ be_nested_str_weak(light), - /* K1 */ be_nested_str_weak(update_ct_minmax), - /* K2 */ be_nested_str_weak(update_shadow), - /* K3 */ be_nested_str_weak(get), - /* K4 */ be_nested_str_weak(find), - /* K5 */ be_nested_str_weak(ct), - /* K6 */ be_nested_str_weak(shadow_ct), - /* K7 */ be_nested_str_weak(attribute_updated), + ( &(const bvalue[ 9]) { /* constants */ + /* K0 */ be_nested_str_weak(VIRTUAL), + /* K1 */ be_nested_str_weak(light), + /* K2 */ be_nested_str_weak(update_ct_minmax), + /* K3 */ be_nested_str_weak(update_shadow), + /* K4 */ be_nested_str_weak(get), + /* K5 */ be_nested_str_weak(find), + /* K6 */ be_nested_str_weak(ct), + /* K7 */ be_nested_str_weak(shadow_ct), + /* K8 */ be_nested_str_weak(attribute_updated), }), be_str_weak(update_shadow), &be_const_str_solidified, - ( &(const binstruction[30]) { /* code */ - 0xA4060000, // 0000 IMPORT R1 K0 - 0x8C080101, // 0001 GETMET R2 R0 K1 - 0x7C080200, // 0002 CALL R2 1 - 0x60080003, // 0003 GETGBL R2 G3 - 0x5C0C0000, // 0004 MOVE R3 R0 - 0x7C080200, // 0005 CALL R2 1 - 0x8C080502, // 0006 GETMET R2 R2 K2 + ( &(const binstruction[38]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x7406001D, // 0001 JMPT R1 #0020 + 0xA4060200, // 0002 IMPORT R1 K1 + 0x8C080102, // 0003 GETMET R2 R0 K2 + 0x7C080200, // 0004 CALL R2 1 + 0x60080003, // 0005 GETGBL R2 G3 + 0x5C0C0000, // 0006 MOVE R3 R0 0x7C080200, // 0007 CALL R2 1 - 0x8C080303, // 0008 GETMET R2 R1 K3 + 0x8C080503, // 0008 GETMET R2 R2 K3 0x7C080200, // 0009 CALL R2 1 - 0x4C0C0000, // 000A LDNIL R3 - 0x200C0403, // 000B NE R3 R2 R3 - 0x780E000F, // 000C JMPF R3 #001D - 0x8C0C0504, // 000D GETMET R3 R2 K4 - 0x58140005, // 000E LDCONST R5 K5 - 0x4C180000, // 000F LDNIL R6 - 0x7C0C0600, // 0010 CALL R3 3 - 0x4C100000, // 0011 LDNIL R4 - 0x1C100604, // 0012 EQ R4 R3 R4 - 0x78120000, // 0013 JMPF R4 #0015 - 0x880C0106, // 0014 GETMBR R3 R0 K6 - 0x88100106, // 0015 GETMBR R4 R0 K6 - 0x20100604, // 0016 NE R4 R3 R4 - 0x78120004, // 0017 JMPF R4 #001D - 0x8C100107, // 0018 GETMET R4 R0 K7 - 0x541A02FF, // 0019 LDINT R6 768 - 0x541E0006, // 001A LDINT R7 7 - 0x7C100600, // 001B CALL R4 3 - 0x90020C03, // 001C SETMBR R0 K6 R3 - 0x80000000, // 001D RET 0 + 0x8C080304, // 000A GETMET R2 R1 K4 + 0x7C080200, // 000B CALL R2 1 + 0x4C0C0000, // 000C LDNIL R3 + 0x200C0403, // 000D NE R3 R2 R3 + 0x780E000F, // 000E JMPF R3 #001F + 0x8C0C0505, // 000F GETMET R3 R2 K5 + 0x58140006, // 0010 LDCONST R5 K6 + 0x4C180000, // 0011 LDNIL R6 + 0x7C0C0600, // 0012 CALL R3 3 + 0x4C100000, // 0013 LDNIL R4 + 0x1C100604, // 0014 EQ R4 R3 R4 + 0x78120000, // 0015 JMPF R4 #0017 + 0x880C0107, // 0016 GETMBR R3 R0 K7 + 0x88100107, // 0017 GETMBR R4 R0 K7 + 0x20100604, // 0018 NE R4 R3 R4 + 0x78120004, // 0019 JMPF R4 #001F + 0x8C100108, // 001A GETMET R4 R0 K8 + 0x541A02FF, // 001B LDINT R6 768 + 0x541E0006, // 001C LDINT R7 7 + 0x7C100600, // 001D CALL R4 3 + 0x90020E03, // 001E SETMBR R0 K7 R3 + 0x70020004, // 001F JMP #0025 + 0x60040003, // 0020 GETGBL R1 G3 + 0x5C080000, // 0021 MOVE R2 R0 + 0x7C040200, // 0022 CALL R1 1 + 0x8C040303, // 0023 GETMET R1 R1 K3 + 0x7C040200, // 0024 CALL R1 1 + 0x80000000, // 0025 RET 0 }) ) ); diff --git a/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_4_Light3.h b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_3_Light3.h similarity index 99% rename from lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_4_Light3.h rename to lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_3_Light3.h index 538d02b80..8d3ee8ad0 100644 --- a/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_4_Light3.h +++ b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_3_Light3.h @@ -1,4 +1,4 @@ -/* Solidification of Matter_Plugin_4_Light3.h */ +/* Solidification of Matter_Plugin_3_Light3.h */ /********************************************************************\ * Generated code, don't edit * \********************************************************************/ diff --git a/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_3_Sensor_Flow.h b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_3_Sensor_Flow.h new file mode 100644 index 000000000..30208cb57 --- /dev/null +++ b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_3_Sensor_Flow.h @@ -0,0 +1,279 @@ +/* Solidification of Matter_Plugin_3_Sensor_Flow.h */ +/********************************************************************\ +* Generated code, don't edit * +\********************************************************************/ +#include "be_constobj.h" + +extern const bclass be_class_Matter_Plugin_Sensor_Flow; + +/******************************************************************** +** Solidified function: value_changed +********************************************************************/ +be_local_closure(Matter_Plugin_Sensor_Flow_value_changed, /* name */ + be_nested_proto( + 5, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str_weak(attribute_updated), + /* K1 */ be_const_int(0), + }), + be_str_weak(value_changed), + &be_const_str_solidified, + ( &(const binstruction[ 5]) { /* code */ + 0x8C040100, // 0000 GETMET R1 R0 K0 + 0x540E0403, // 0001 LDINT R3 1028 + 0x58100001, // 0002 LDCONST R4 K1 + 0x7C040600, // 0003 CALL R1 3 + 0x80000000, // 0004 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: read_attribute +********************************************************************/ +be_local_closure(Matter_Plugin_Sensor_Flow_read_attribute, /* name */ + be_nested_proto( + 12, /* nstack */ + 4, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[14]) { /* constants */ + /* K0 */ be_nested_str_weak(matter), + /* K1 */ be_nested_str_weak(TLV), + /* K2 */ be_nested_str_weak(cluster), + /* K3 */ be_nested_str_weak(attribute), + /* K4 */ be_const_int(0), + /* K5 */ be_nested_str_weak(shadow_value), + /* K6 */ be_nested_str_weak(set), + /* K7 */ be_nested_str_weak(U2), + /* K8 */ be_nested_str_weak(NULL), + /* K9 */ be_const_int(1), + /* K10 */ be_const_int(2), + /* K11 */ be_nested_str_weak(U4), + /* K12 */ be_const_int(3), + /* K13 */ be_nested_str_weak(read_attribute), + }), + be_str_weak(read_attribute), + &be_const_str_solidified, + ( &(const binstruction[71]) { /* code */ + 0xB8120000, // 0000 GETNGBL R4 K0 + 0x88100901, // 0001 GETMBR R4 R4 K1 + 0x88140502, // 0002 GETMBR R5 R2 K2 + 0x88180503, // 0003 GETMBR R6 R2 K3 + 0x541E0403, // 0004 LDINT R7 1028 + 0x1C1C0A07, // 0005 EQ R7 R5 R7 + 0x781E0035, // 0006 JMPF R7 #003D + 0x1C1C0D04, // 0007 EQ R7 R6 K4 + 0x781E0011, // 0008 JMPF R7 #001B + 0x881C0105, // 0009 GETMBR R7 R0 K5 + 0x4C200000, // 000A LDNIL R8 + 0x201C0E08, // 000B NE R7 R7 R8 + 0x781E0007, // 000C JMPF R7 #0015 + 0x8C1C0706, // 000D GETMET R7 R3 K6 + 0x88240907, // 000E GETMBR R9 R4 K7 + 0x60280009, // 000F GETGBL R10 G9 + 0x882C0105, // 0010 GETMBR R11 R0 K5 + 0x7C280200, // 0011 CALL R10 1 + 0x7C1C0600, // 0012 CALL R7 3 + 0x80040E00, // 0013 RET 1 R7 + 0x70020004, // 0014 JMP #001A + 0x8C1C0706, // 0015 GETMET R7 R3 K6 + 0x88240908, // 0016 GETMBR R9 R4 K8 + 0x4C280000, // 0017 LDNIL R10 + 0x7C1C0600, // 0018 CALL R7 3 + 0x80040E00, // 0019 RET 1 R7 + 0x70020020, // 001A JMP #003C + 0x1C1C0D09, // 001B EQ R7 R6 K9 + 0x781E0005, // 001C JMPF R7 #0023 + 0x8C1C0706, // 001D GETMET R7 R3 K6 + 0x88240907, // 001E GETMBR R9 R4 K7 + 0x58280004, // 001F LDCONST R10 K4 + 0x7C1C0600, // 0020 CALL R7 3 + 0x80040E00, // 0021 RET 1 R7 + 0x70020018, // 0022 JMP #003C + 0x1C1C0D0A, // 0023 EQ R7 R6 K10 + 0x781E0005, // 0024 JMPF R7 #002B + 0x8C1C0706, // 0025 GETMET R7 R3 K6 + 0x88240907, // 0026 GETMBR R9 R4 K7 + 0x542AFFFD, // 0027 LDINT R10 65534 + 0x7C1C0600, // 0028 CALL R7 3 + 0x80040E00, // 0029 RET 1 R7 + 0x70020010, // 002A JMP #003C + 0x541EFFFB, // 002B LDINT R7 65532 + 0x1C1C0C07, // 002C EQ R7 R6 R7 + 0x781E0005, // 002D JMPF R7 #0034 + 0x8C1C0706, // 002E GETMET R7 R3 K6 + 0x8824090B, // 002F GETMBR R9 R4 K11 + 0x58280004, // 0030 LDCONST R10 K4 + 0x7C1C0600, // 0031 CALL R7 3 + 0x80040E00, // 0032 RET 1 R7 + 0x70020007, // 0033 JMP #003C + 0x541EFFFC, // 0034 LDINT R7 65533 + 0x1C1C0C07, // 0035 EQ R7 R6 R7 + 0x781E0004, // 0036 JMPF R7 #003C + 0x8C1C0706, // 0037 GETMET R7 R3 K6 + 0x8824090B, // 0038 GETMBR R9 R4 K11 + 0x5828000C, // 0039 LDCONST R10 K12 + 0x7C1C0600, // 003A CALL R7 3 + 0x80040E00, // 003B RET 1 R7 + 0x70020008, // 003C JMP #0046 + 0x601C0003, // 003D GETGBL R7 G3 + 0x5C200000, // 003E MOVE R8 R0 + 0x7C1C0200, // 003F CALL R7 1 + 0x8C1C0F0D, // 0040 GETMET R7 R7 K13 + 0x5C240200, // 0041 MOVE R9 R1 + 0x5C280400, // 0042 MOVE R10 R2 + 0x5C2C0600, // 0043 MOVE R11 R3 + 0x7C1C0800, // 0044 CALL R7 4 + 0x80040E00, // 0045 RET 1 R7 + 0x80000000, // 0046 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: pre_value +********************************************************************/ +be_local_closure(Matter_Plugin_Sensor_Flow_pre_value, /* name */ + be_nested_proto( + 4, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 0, /* has constants */ + NULL, /* no const */ + be_str_weak(pre_value), + &be_const_str_solidified, + ( &(const binstruction[10]) { /* code */ + 0x4C080000, // 0000 LDNIL R2 + 0x20080202, // 0001 NE R2 R1 R2 + 0x780A0004, // 0002 JMPF R2 #0008 + 0x60080009, // 0003 GETGBL R2 G9 + 0x540E0009, // 0004 LDINT R3 10 + 0x080C0203, // 0005 MUL R3 R1 R3 + 0x7C080200, // 0006 CALL R2 1 + 0x70020000, // 0007 JMP #0009 + 0x4C080000, // 0008 LDNIL R2 + 0x80040400, // 0009 RET 1 R2 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified class: Matter_Plugin_Sensor_Flow +********************************************************************/ +extern const bclass be_class_Matter_Plugin_Sensor; +be_local_class(Matter_Plugin_Sensor_Flow, + 0, + &be_class_Matter_Plugin_Sensor, + be_nested_map(9, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_const_key_weak(DISPLAY_NAME, -1), be_nested_str_weak(Flow) }, + { be_const_key_weak(TYPE, -1), be_nested_str_weak(flow) }, + { be_const_key_weak(TYPES, 8), be_const_simple_instance(be_nested_simple_instance(&be_class_map, { + be_const_map( * be_nested_map(1, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_const_key_int(774, -1), be_const_int(1) }, + })) ) } )) }, + { be_const_key_weak(UPDATE_COMMANDS, -1), be_const_simple_instance(be_nested_simple_instance(&be_class_list, { + be_const_list( * be_nested_list(1, + ( (struct bvalue*) &(const bvalue[]) { + be_nested_str_weak(Flow), + })) ) } )) }, + { be_const_key_weak(value_changed, 7), be_const_closure(Matter_Plugin_Sensor_Flow_value_changed_closure) }, + { be_const_key_weak(JSON_NAME, -1), be_nested_str_weak(Flow) }, + { be_const_key_weak(read_attribute, -1), be_const_closure(Matter_Plugin_Sensor_Flow_read_attribute_closure) }, + { be_const_key_weak(CLUSTERS, -1), be_const_simple_instance(be_nested_simple_instance(&be_class_map, { + be_const_map( * be_nested_map(6, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_const_key_int(5, -1), be_const_simple_instance(be_nested_simple_instance(&be_class_list, { + be_const_list( * be_nested_list(8, + ( (struct bvalue*) &(const bvalue[]) { + be_const_int(0), + be_const_int(1), + be_const_int(2), + be_const_int(3), + be_const_int(4), + be_const_int(5), + be_const_int(65532), + be_const_int(65533), + })) ) } )) }, + { be_const_key_int(57, -1), be_const_simple_instance(be_nested_simple_instance(&be_class_list, { + be_const_list( * be_nested_list(7, + ( (struct bvalue*) &(const bvalue[]) { + be_const_int(17), + be_const_int(3), + be_const_int(5), + be_const_int(10), + be_const_int(15), + be_const_int(17), + be_const_int(18), + })) ) } )) }, + { be_const_key_int(1028, -1), be_const_simple_instance(be_nested_simple_instance(&be_class_list, { + be_const_list( * be_nested_list(5, + ( (struct bvalue*) &(const bvalue[]) { + be_const_int(0), + be_const_int(1), + be_const_int(2), + be_const_int(65532), + be_const_int(65533), + })) ) } )) }, + { be_const_key_int(3, 1), be_const_simple_instance(be_nested_simple_instance(&be_class_list, { + be_const_list( * be_nested_list(4, + ( (struct bvalue*) &(const bvalue[]) { + be_const_int(0), + be_const_int(1), + be_const_int(65532), + be_const_int(65533), + })) ) } )) }, + { be_const_key_int(4, -1), be_const_simple_instance(be_nested_simple_instance(&be_class_list, { + be_const_list( * be_nested_list(3, + ( (struct bvalue*) &(const bvalue[]) { + be_const_int(0), + be_const_int(65532), + be_const_int(65533), + })) ) } )) }, + { be_const_key_int(29, 0), be_const_simple_instance(be_nested_simple_instance(&be_class_list, { + be_const_list( * be_nested_list(6, + ( (struct bvalue*) &(const bvalue[]) { + be_const_int(0), + be_const_int(1), + be_const_int(2), + be_const_int(3), + be_const_int(65532), + be_const_int(65533), + })) ) } )) }, + })) ) } )) }, + { be_const_key_weak(pre_value, -1), be_const_closure(Matter_Plugin_Sensor_Flow_pre_value_closure) }, + })), + be_str_weak(Matter_Plugin_Sensor_Flow) +); +/*******************************************************************/ + +void be_load_Matter_Plugin_Sensor_Flow_class(bvm *vm) { + be_pushntvclass(vm, &be_class_Matter_Plugin_Sensor_Flow); + be_setglobal(vm, "Matter_Plugin_Sensor_Flow"); + be_pop(vm, 1); +} +/********************************************************************/ +/* End of solidification */ diff --git a/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_4_Bridge_Sensor_Flow.h b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_4_Bridge_Sensor_Flow.h new file mode 100644 index 000000000..fb56e9907 --- /dev/null +++ b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_4_Bridge_Sensor_Flow.h @@ -0,0 +1,315 @@ +/* Solidification of Matter_Plugin_4_Bridge_Sensor_Flow.h */ +/********************************************************************\ +* Generated code, don't edit * +\********************************************************************/ +#include "be_constobj.h" + +extern const bclass be_class_Matter_Plugin_Bridge_Sensor_Flow; + +/******************************************************************** +** Solidified function: pre_value +********************************************************************/ +be_local_closure(Matter_Plugin_Bridge_Sensor_Flow_pre_value, /* name */ + be_nested_proto( + 4, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 0, /* has constants */ + NULL, /* no const */ + be_str_weak(pre_value), + &be_const_str_solidified, + ( &(const binstruction[10]) { /* code */ + 0x4C080000, // 0000 LDNIL R2 + 0x20080202, // 0001 NE R2 R1 R2 + 0x780A0004, // 0002 JMPF R2 #0008 + 0x60080009, // 0003 GETGBL R2 G9 + 0x540E0009, // 0004 LDINT R3 10 + 0x080C0203, // 0005 MUL R3 R1 R3 + 0x7C080200, // 0006 CALL R2 1 + 0x70020000, // 0007 JMP #0009 + 0x4C080000, // 0008 LDNIL R2 + 0x80040400, // 0009 RET 1 R2 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: value_changed +********************************************************************/ +be_local_closure(Matter_Plugin_Bridge_Sensor_Flow_value_changed, /* name */ + be_nested_proto( + 5, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str_weak(attribute_updated), + /* K1 */ be_const_int(0), + }), + be_str_weak(value_changed), + &be_const_str_solidified, + ( &(const binstruction[ 5]) { /* code */ + 0x8C040100, // 0000 GETMET R1 R0 K0 + 0x540E0403, // 0001 LDINT R3 1028 + 0x58100001, // 0002 LDCONST R4 K1 + 0x7C040600, // 0003 CALL R1 3 + 0x80000000, // 0004 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: read_attribute +********************************************************************/ +be_local_closure(Matter_Plugin_Bridge_Sensor_Flow_read_attribute, /* name */ + be_nested_proto( + 12, /* nstack */ + 4, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[14]) { /* constants */ + /* K0 */ be_nested_str_weak(matter), + /* K1 */ be_nested_str_weak(TLV), + /* K2 */ be_nested_str_weak(cluster), + /* K3 */ be_nested_str_weak(attribute), + /* K4 */ be_const_int(0), + /* K5 */ be_nested_str_weak(shadow_value), + /* K6 */ be_nested_str_weak(set), + /* K7 */ be_nested_str_weak(U2), + /* K8 */ be_nested_str_weak(NULL), + /* K9 */ be_const_int(1), + /* K10 */ be_const_int(2), + /* K11 */ be_nested_str_weak(U4), + /* K12 */ be_const_int(3), + /* K13 */ be_nested_str_weak(read_attribute), + }), + be_str_weak(read_attribute), + &be_const_str_solidified, + ( &(const binstruction[71]) { /* code */ + 0xB8120000, // 0000 GETNGBL R4 K0 + 0x88100901, // 0001 GETMBR R4 R4 K1 + 0x88140502, // 0002 GETMBR R5 R2 K2 + 0x88180503, // 0003 GETMBR R6 R2 K3 + 0x541E0403, // 0004 LDINT R7 1028 + 0x1C1C0A07, // 0005 EQ R7 R5 R7 + 0x781E0035, // 0006 JMPF R7 #003D + 0x1C1C0D04, // 0007 EQ R7 R6 K4 + 0x781E0011, // 0008 JMPF R7 #001B + 0x881C0105, // 0009 GETMBR R7 R0 K5 + 0x4C200000, // 000A LDNIL R8 + 0x201C0E08, // 000B NE R7 R7 R8 + 0x781E0007, // 000C JMPF R7 #0015 + 0x8C1C0706, // 000D GETMET R7 R3 K6 + 0x88240907, // 000E GETMBR R9 R4 K7 + 0x60280009, // 000F GETGBL R10 G9 + 0x882C0105, // 0010 GETMBR R11 R0 K5 + 0x7C280200, // 0011 CALL R10 1 + 0x7C1C0600, // 0012 CALL R7 3 + 0x80040E00, // 0013 RET 1 R7 + 0x70020004, // 0014 JMP #001A + 0x8C1C0706, // 0015 GETMET R7 R3 K6 + 0x88240908, // 0016 GETMBR R9 R4 K8 + 0x4C280000, // 0017 LDNIL R10 + 0x7C1C0600, // 0018 CALL R7 3 + 0x80040E00, // 0019 RET 1 R7 + 0x70020020, // 001A JMP #003C + 0x1C1C0D09, // 001B EQ R7 R6 K9 + 0x781E0005, // 001C JMPF R7 #0023 + 0x8C1C0706, // 001D GETMET R7 R3 K6 + 0x88240907, // 001E GETMBR R9 R4 K7 + 0x58280004, // 001F LDCONST R10 K4 + 0x7C1C0600, // 0020 CALL R7 3 + 0x80040E00, // 0021 RET 1 R7 + 0x70020018, // 0022 JMP #003C + 0x1C1C0D0A, // 0023 EQ R7 R6 K10 + 0x781E0005, // 0024 JMPF R7 #002B + 0x8C1C0706, // 0025 GETMET R7 R3 K6 + 0x88240907, // 0026 GETMBR R9 R4 K7 + 0x542AFFFD, // 0027 LDINT R10 65534 + 0x7C1C0600, // 0028 CALL R7 3 + 0x80040E00, // 0029 RET 1 R7 + 0x70020010, // 002A JMP #003C + 0x541EFFFB, // 002B LDINT R7 65532 + 0x1C1C0C07, // 002C EQ R7 R6 R7 + 0x781E0005, // 002D JMPF R7 #0034 + 0x8C1C0706, // 002E GETMET R7 R3 K6 + 0x8824090B, // 002F GETMBR R9 R4 K11 + 0x58280004, // 0030 LDCONST R10 K4 + 0x7C1C0600, // 0031 CALL R7 3 + 0x80040E00, // 0032 RET 1 R7 + 0x70020007, // 0033 JMP #003C + 0x541EFFFC, // 0034 LDINT R7 65533 + 0x1C1C0C07, // 0035 EQ R7 R6 R7 + 0x781E0004, // 0036 JMPF R7 #003C + 0x8C1C0706, // 0037 GETMET R7 R3 K6 + 0x8824090B, // 0038 GETMBR R9 R4 K11 + 0x5828000C, // 0039 LDCONST R10 K12 + 0x7C1C0600, // 003A CALL R7 3 + 0x80040E00, // 003B RET 1 R7 + 0x70020008, // 003C JMP #0046 + 0x601C0003, // 003D GETGBL R7 G3 + 0x5C200000, // 003E MOVE R8 R0 + 0x7C1C0200, // 003F CALL R7 1 + 0x8C1C0F0D, // 0040 GETMET R7 R7 K13 + 0x5C240200, // 0041 MOVE R9 R1 + 0x5C280400, // 0042 MOVE R10 R2 + 0x5C2C0600, // 0043 MOVE R11 R3 + 0x7C1C0800, // 0044 CALL R7 4 + 0x80040E00, // 0045 RET 1 R7 + 0x80000000, // 0046 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: web_values +********************************************************************/ +be_local_closure(Matter_Plugin_Bridge_Sensor_Flow_web_values, /* name */ + be_nested_proto( + 8, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 5]) { /* constants */ + /* K0 */ be_nested_str_weak(webserver), + /* K1 */ be_nested_str_weak(web_values_prefix), + /* K2 */ be_nested_str_weak(content_send), + /* K3 */ be_nested_str_weak(_X26_X23x26C5_X3B_X20_X25i_X20m3_X2Fh), + /* K4 */ be_nested_str_weak(shadow_value), + }), + be_str_weak(web_values), + &be_const_str_solidified, + ( &(const binstruction[12]) { /* code */ + 0xA4060000, // 0000 IMPORT R1 K0 + 0x8C080101, // 0001 GETMET R2 R0 K1 + 0x7C080200, // 0002 CALL R2 1 + 0x8C080302, // 0003 GETMET R2 R1 K2 + 0x60100018, // 0004 GETGBL R4 G24 + 0x58140003, // 0005 LDCONST R5 K3 + 0x60180009, // 0006 GETGBL R6 G9 + 0x881C0104, // 0007 GETMBR R7 R0 K4 + 0x7C180200, // 0008 CALL R6 1 + 0x7C100400, // 0009 CALL R4 2 + 0x7C080400, // 000A CALL R2 2 + 0x80000000, // 000B RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified class: Matter_Plugin_Bridge_Sensor_Flow +********************************************************************/ +extern const bclass be_class_Matter_Plugin_Bridge_Sensor; +be_local_class(Matter_Plugin_Bridge_Sensor_Flow, + 0, + &be_class_Matter_Plugin_Bridge_Sensor, + be_nested_map(8, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_const_key_weak(pre_value, 1), be_const_closure(Matter_Plugin_Bridge_Sensor_Flow_pre_value_closure) }, + { be_const_key_weak(web_values, -1), be_const_closure(Matter_Plugin_Bridge_Sensor_Flow_web_values_closure) }, + { be_const_key_weak(TYPES, 3), be_const_simple_instance(be_nested_simple_instance(&be_class_map, { + be_const_map( * be_nested_map(1, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_const_key_int(774, -1), be_const_int(1) }, + })) ) } )) }, + { be_const_key_weak(read_attribute, 7), be_const_closure(Matter_Plugin_Bridge_Sensor_Flow_read_attribute_closure) }, + { be_const_key_weak(value_changed, 6), be_const_closure(Matter_Plugin_Bridge_Sensor_Flow_value_changed_closure) }, + { be_const_key_weak(DISPLAY_NAME, 4), be_nested_str_weak(Flow) }, + { be_const_key_weak(TYPE, -1), be_nested_str_weak(http_flow) }, + { be_const_key_weak(CLUSTERS, -1), be_const_simple_instance(be_nested_simple_instance(&be_class_map, { + be_const_map( * be_nested_map(6, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_const_key_int(5, -1), be_const_simple_instance(be_nested_simple_instance(&be_class_list, { + be_const_list( * be_nested_list(8, + ( (struct bvalue*) &(const bvalue[]) { + be_const_int(0), + be_const_int(1), + be_const_int(2), + be_const_int(3), + be_const_int(4), + be_const_int(5), + be_const_int(65532), + be_const_int(65533), + })) ) } )) }, + { be_const_key_int(57, -1), be_const_simple_instance(be_nested_simple_instance(&be_class_list, { + be_const_list( * be_nested_list(7, + ( (struct bvalue*) &(const bvalue[]) { + be_const_int(17), + be_const_int(3), + be_const_int(5), + be_const_int(10), + be_const_int(15), + be_const_int(17), + be_const_int(18), + })) ) } )) }, + { be_const_key_int(1028, -1), be_const_simple_instance(be_nested_simple_instance(&be_class_list, { + be_const_list( * be_nested_list(5, + ( (struct bvalue*) &(const bvalue[]) { + be_const_int(0), + be_const_int(1), + be_const_int(2), + be_const_int(65532), + be_const_int(65533), + })) ) } )) }, + { be_const_key_int(3, 1), be_const_simple_instance(be_nested_simple_instance(&be_class_list, { + be_const_list( * be_nested_list(4, + ( (struct bvalue*) &(const bvalue[]) { + be_const_int(0), + be_const_int(1), + be_const_int(65532), + be_const_int(65533), + })) ) } )) }, + { be_const_key_int(4, -1), be_const_simple_instance(be_nested_simple_instance(&be_class_list, { + be_const_list( * be_nested_list(3, + ( (struct bvalue*) &(const bvalue[]) { + be_const_int(0), + be_const_int(65532), + be_const_int(65533), + })) ) } )) }, + { be_const_key_int(29, 0), be_const_simple_instance(be_nested_simple_instance(&be_class_list, { + be_const_list( * be_nested_list(6, + ( (struct bvalue*) &(const bvalue[]) { + be_const_int(0), + be_const_int(1), + be_const_int(2), + be_const_int(3), + be_const_int(65532), + be_const_int(65533), + })) ) } )) }, + })) ) } )) }, + })), + be_str_weak(Matter_Plugin_Bridge_Sensor_Flow) +); +/*******************************************************************/ + +void be_load_Matter_Plugin_Bridge_Sensor_Flow_class(bvm *vm) { + be_pushntvclass(vm, &be_class_Matter_Plugin_Bridge_Sensor_Flow); + be_setglobal(vm, "Matter_Plugin_Bridge_Sensor_Flow"); + be_pop(vm, 1); +} +/********************************************************************/ +/* End of solidification */ diff --git a/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_9_Virt_Sensor_Flow.h b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_9_Virt_Sensor_Flow.h new file mode 100644 index 000000000..d557dabb9 --- /dev/null +++ b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_9_Virt_Sensor_Flow.h @@ -0,0 +1,34 @@ +/* Solidification of Matter_Plugin_9_Virt_Sensor_Flow.h */ +/********************************************************************\ +* Generated code, don't edit * +\********************************************************************/ +#include "be_constobj.h" + +extern const bclass be_class_Matter_Plugin_Virt_Sensor_Flow; + +/******************************************************************** +** Solidified class: Matter_Plugin_Virt_Sensor_Flow +********************************************************************/ +extern const bclass be_class_Matter_Plugin_Sensor_Flow; +be_local_class(Matter_Plugin_Virt_Sensor_Flow, + 0, + &be_class_Matter_Plugin_Sensor_Flow, + be_nested_map(5, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_const_key_weak(VIRTUAL, 3), be_const_bool(1) }, + { be_const_key_weak(DISPLAY_NAME, -1), be_nested_str_weak(v_X2EFlow) }, + { be_const_key_weak(TYPE, -1), be_nested_str_weak(v_flow) }, + { be_const_key_weak(ARG_HINT, -1), be_nested_str_weak(_Not_X20used_) }, + { be_const_key_weak(ARG, 2), be_nested_str_weak() }, + })), + be_str_weak(Matter_Plugin_Virt_Sensor_Flow) +); +/*******************************************************************/ + +void be_load_Matter_Plugin_Virt_Sensor_Flow_class(bvm *vm) { + be_pushntvclass(vm, &be_class_Matter_Plugin_Virt_Sensor_Flow); + be_setglobal(vm, "Matter_Plugin_Virt_Sensor_Flow"); + be_pop(vm, 1); +} +/********************************************************************/ +/* End of solidification */ diff --git a/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_9_Virt_Sensor_Occupancy.h b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_9_Virt_Sensor_Occupancy.h new file mode 100644 index 000000000..11e4261a4 --- /dev/null +++ b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_9_Virt_Sensor_Occupancy.h @@ -0,0 +1,34 @@ +/* Solidification of Matter_Plugin_9_Virt_Sensor_Occupancy.h */ +/********************************************************************\ +* Generated code, don't edit * +\********************************************************************/ +#include "be_constobj.h" + +extern const bclass be_class_Matter_Plugin_Virt_Sensor_Occupancy; + +/******************************************************************** +** Solidified class: Matter_Plugin_Virt_Sensor_Occupancy +********************************************************************/ +extern const bclass be_class_Matter_Plugin_Sensor_Occupancy; +be_local_class(Matter_Plugin_Virt_Sensor_Occupancy, + 0, + &be_class_Matter_Plugin_Sensor_Occupancy, + be_nested_map(5, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_const_key_weak(VIRTUAL, 3), be_const_bool(1) }, + { be_const_key_weak(DISPLAY_NAME, -1), be_nested_str_weak(v_X2EOccupancy) }, + { be_const_key_weak(TYPE, -1), be_nested_str_weak(v_occupancy) }, + { be_const_key_weak(ARG_HINT, -1), be_nested_str_weak(_Not_X20used_) }, + { be_const_key_weak(ARG, 2), be_nested_str_weak() }, + })), + be_str_weak(Matter_Plugin_Virt_Sensor_Occupancy) +); +/*******************************************************************/ + +void be_load_Matter_Plugin_Virt_Sensor_Occupancy_class(bvm *vm) { + be_pushntvclass(vm, &be_class_Matter_Plugin_Virt_Sensor_Occupancy); + be_setglobal(vm, "Matter_Plugin_Virt_Sensor_Occupancy"); + be_pop(vm, 1); +} +/********************************************************************/ +/* End of solidification */ diff --git a/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_z_All.h b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_z_All.h new file mode 100644 index 000000000..0e624cd4f --- /dev/null +++ b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Plugin_z_All.h @@ -0,0 +1,7 @@ +/* Solidification of Matter_Plugin_z_All.h */ +/********************************************************************\ +* Generated code, don't edit * +\********************************************************************/ +#include "be_constobj.h" +/********************************************************************/ +/* End of solidification */ diff --git a/lib/libesp32/berry_matter/src/solidify/solidified_Matter_UI.h b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_UI.h index ea7755189..58097a058 100644 --- a/lib/libesp32/berry_matter/src/solidify/solidified_Matter_UI.h +++ b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_UI.h @@ -3360,7 +3360,7 @@ be_local_class(Matter_UI, ( (struct bmapnode*) &(const bmapnode[]) { { be_const_key_weak(equal_map, -1), be_const_static_closure(Matter_UI_equal_map_closure) }, { be_const_key_weak(page_part_mgr_adv, -1), be_const_closure(Matter_UI_page_part_mgr_adv_closure) }, - { be_const_key_weak(_CLASSES_TYPES2, -1), be_nested_str_weak(_X7Chttp_relay_X7Chttp_light0_X7Chttp_light1_X7Chttp_light2_X7Chttp_light3_X7Chttp_temperature_X7Chttp_pressure_X7Chttp_illuminance_X7Chttp_humidity_X7Chttp_occupancy_X7Chttp_contact) }, + { be_const_key_weak(_CLASSES_TYPES2, -1), be_nested_str_weak(_X7Chttp_relay_X7Chttp_light0_X7Chttp_light1_X7Chttp_light2_X7Chttp_light3_X7Chttp_temperature_X7Chttp_pressure_X7Chttp_illuminance_X7Chttp_humidity_X7Chttp_occupancy_X7Chttp_contact_X7Chttp_flow) }, { be_const_key_weak(page_part_mgr, 25), be_const_closure(Matter_UI_page_part_mgr_closure) }, { be_const_key_weak(show_plugins_hints_js, -1), be_const_closure(Matter_UI_show_plugins_hints_js_closure) }, { be_const_key_weak(show_enable, -1), be_const_closure(Matter_UI_show_enable_closure) }, @@ -3372,7 +3372,7 @@ be_local_class(Matter_UI, { be_const_key_weak(show_commissioning_info, -1), be_const_closure(Matter_UI_show_commissioning_info_closure) }, { be_const_key_weak(page_part_ctl, 18), be_const_closure(Matter_UI_page_part_ctl_closure) }, { be_const_key_weak(show_fabric_info, -1), be_const_closure(Matter_UI_show_fabric_info_closure) }, - { be_const_key_weak(_CLASSES_TYPES, 4), be_nested_str_weak(_X7Crelay_X7Clight0_X7Clight1_X7Clight2_X7Clight3_X7Cshutter_X7Cshutter_X2Btilt_X7Ctemperature_X7Cpressure_X7Cilluminance_X7Chumidity_X7Coccupancy_X7Conoff_X7Ccontact_X7C_X2Dvirtual_X7Cv_relay_X7Cv_light0_X7Cv_light1_X7Cv_light2_X7Cv_light3_X7Cv_temp_X7Cv_pressure_X7Cv_illuminance_X7Cv_humidity_X7Cv_contact) }, + { be_const_key_weak(_CLASSES_TYPES, 4), be_nested_str_weak(_X7Crelay_X7Clight0_X7Clight1_X7Clight2_X7Clight3_X7Cshutter_X7Cshutter_X2Btilt_X7Ctemperature_X7Cpressure_X7Cilluminance_X7Chumidity_X7Coccupancy_X7Conoff_X7Ccontact_X7Cflow_X7C_X2Dvirtual_X7Cv_relay_X7Cv_light0_X7Cv_light1_X7Cv_light2_X7Cv_light3_X7Cv_temp_X7Cv_pressure_X7Cv_illuminance_X7Cv_humidity_X7Cv_occupancy_X7Cv_contact_X7Cv_flow) }, { be_const_key_weak(web_get_arg, -1), be_const_closure(Matter_UI_web_get_arg_closure) }, { be_const_key_weak(plugin_option, 5), be_const_closure(Matter_UI_plugin_option_closure) }, { be_const_key_weak(web_add_config_button, -1), be_const_closure(Matter_UI_web_add_config_button_closure) }, diff --git a/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Device.h b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_zz_Device.h similarity index 94% rename from lib/libesp32/berry_matter/src/solidify/solidified_Matter_Device.h rename to lib/libesp32/berry_matter/src/solidify/solidified_Matter_zz_Device.h index 64b35f2bb..a008118ea 100644 --- a/lib/libesp32/berry_matter/src/solidify/solidified_Matter_Device.h +++ b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_zz_Device.h @@ -1,4 +1,4 @@ -/* Solidification of Matter_Device.h */ +/* Solidification of Matter_zz_Device.h */ /********************************************************************\ * Generated code, don't edit * \********************************************************************/ @@ -7,9 +7,40 @@ extern const bclass be_class_Matter_Device; /******************************************************************** -** Solidified function: get_plugin_class_displayname +** Solidified function: save_before_restart ********************************************************************/ -be_local_closure(Matter_Device_get_plugin_class_displayname, /* name */ +be_local_closure(Matter_Device_save_before_restart, /* name */ + be_nested_proto( + 3, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str_weak(stop_basic_commissioning), + /* K1 */ be_nested_str_weak(mdns_remove_op_discovery_all_fabrics), + }), + be_str_weak(save_before_restart), + &be_const_str_solidified, + ( &(const binstruction[ 5]) { /* code */ + 0x8C040100, // 0000 GETMET R1 R0 K0 + 0x7C040200, // 0001 CALL R1 1 + 0x8C040101, // 0002 GETMET R1 R0 K1 + 0x7C040200, // 0003 CALL R1 1 + 0x80000000, // 0004 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: msg_send +********************************************************************/ +be_local_closure(Matter_Device_msg_send, /* name */ be_nested_proto( 5, /* nstack */ 2, /* argc */ @@ -19,24 +50,18 @@ be_local_closure(Matter_Device_get_plugin_class_displayname, /* name */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[ 4]) { /* constants */ - /* K0 */ be_nested_str_weak(plugins_classes), - /* K1 */ be_nested_str_weak(find), - /* K2 */ be_nested_str_weak(DISPLAY_NAME), - /* K3 */ be_nested_str_weak(), + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str_weak(udp_server), + /* K1 */ be_nested_str_weak(send_UDP), }), - be_str_weak(get_plugin_class_displayname), + be_str_weak(msg_send), &be_const_str_solidified, - ( &(const binstruction[ 9]) { /* code */ + ( &(const binstruction[ 5]) { /* code */ 0x88080100, // 0000 GETMBR R2 R0 K0 0x8C080501, // 0001 GETMET R2 R2 K1 0x5C100200, // 0002 MOVE R4 R1 0x7C080400, // 0003 CALL R2 2 - 0x780A0001, // 0004 JMPF R2 #0007 - 0x880C0502, // 0005 GETMBR R3 R2 K2 - 0x70020000, // 0006 JMP #0008 - 0x580C0003, // 0007 LDCONST R3 K3 - 0x80040600, // 0008 RET 1 R3 + 0x80040400, // 0004 RET 1 R2 }) ) ); @@ -282,11 +307,11 @@ be_local_closure(Matter_Device__init_basic_commissioning, /* name */ /******************************************************************** -** Solidified function: compute_manual_pairing_code +** Solidified function: every_250ms ********************************************************************/ -be_local_closure(Matter_Device_compute_manual_pairing_code, /* name */ +be_local_closure(Matter_Device_every_250ms, /* name */ be_nested_proto( - 9, /* nstack */ + 4, /* nstack */ 1, /* argc */ 2, /* varg */ 0, /* has upvals */ @@ -294,47 +319,32 @@ be_local_closure(Matter_Device_compute_manual_pairing_code, /* name */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[ 6]) { /* constants */ - /* K0 */ be_nested_str_weak(root_discriminator), - /* K1 */ be_nested_str_weak(root_passcode), - /* K2 */ be_nested_str_weak(_X251i_X2505i_X2504i), - /* K3 */ be_nested_str_weak(matter), - /* K4 */ be_nested_str_weak(Verhoeff), - /* K5 */ be_nested_str_weak(checksum), + ( &(const bvalue[ 5]) { /* constants */ + /* K0 */ be_nested_str_weak(message_handler), + /* K1 */ be_nested_str_weak(every_250ms), + /* K2 */ be_const_int(0), + /* K3 */ be_nested_str_weak(plugins), + /* K4 */ be_const_int(1), }), - be_str_weak(compute_manual_pairing_code), + be_str_weak(every_250ms), &be_const_str_solidified, - ( &(const binstruction[30]) { /* code */ + ( &(const binstruction[16]) { /* code */ 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x540A0FFE, // 0001 LDINT R2 4095 - 0x2C040202, // 0002 AND R1 R1 R2 - 0x540A0009, // 0003 LDINT R2 10 - 0x3C040202, // 0004 SHR R1 R1 R2 - 0x88080100, // 0005 GETMBR R2 R0 K0 - 0x540E02FF, // 0006 LDINT R3 768 - 0x2C080403, // 0007 AND R2 R2 R3 - 0x540E0005, // 0008 LDINT R3 6 - 0x38080403, // 0009 SHL R2 R2 R3 - 0x880C0101, // 000A GETMBR R3 R0 K1 - 0x54123FFE, // 000B LDINT R4 16383 - 0x2C0C0604, // 000C AND R3 R3 R4 - 0x30080403, // 000D OR R2 R2 R3 - 0x880C0101, // 000E GETMBR R3 R0 K1 - 0x5412000D, // 000F LDINT R4 14 - 0x3C0C0604, // 0010 SHR R3 R3 R4 - 0x60100018, // 0011 GETGBL R4 G24 - 0x58140002, // 0012 LDCONST R5 K2 - 0x5C180200, // 0013 MOVE R6 R1 - 0x5C1C0400, // 0014 MOVE R7 R2 - 0x5C200600, // 0015 MOVE R8 R3 - 0x7C100800, // 0016 CALL R4 4 - 0xB8160600, // 0017 GETNGBL R5 K3 - 0x88140B04, // 0018 GETMBR R5 R5 K4 - 0x8C140B05, // 0019 GETMET R5 R5 K5 - 0x5C1C0800, // 001A MOVE R7 R4 - 0x7C140400, // 001B CALL R5 2 - 0x00100805, // 001C ADD R4 R4 R5 - 0x80040800, // 001D RET 1 R4 + 0x8C040301, // 0001 GETMET R1 R1 K1 + 0x7C040200, // 0002 CALL R1 1 + 0x58040002, // 0003 LDCONST R1 K2 + 0x6008000C, // 0004 GETGBL R2 G12 + 0x880C0103, // 0005 GETMBR R3 R0 K3 + 0x7C080200, // 0006 CALL R2 1 + 0x14080202, // 0007 LT R2 R1 R2 + 0x780A0005, // 0008 JMPF R2 #000F + 0x88080103, // 0009 GETMBR R2 R0 K3 + 0x94080401, // 000A GETIDX R2 R2 R1 + 0x8C080501, // 000B GETMET R2 R2 K1 + 0x7C080200, // 000C CALL R2 1 + 0x00040304, // 000D ADD R1 R1 K4 + 0x7001FFF4, // 000E JMP #0004 + 0x80000000, // 000F RET 0 }) ) ); @@ -398,12 +408,737 @@ be_local_closure(Matter_Device_invoke_request, /* name */ /******************************************************************** -** Solidified function: stop +** Solidified function: start_operational_discovery_deferred ********************************************************************/ -be_local_closure(Matter_Device_stop, /* name */ +be_local_closure(Matter_Device_start_operational_discovery_deferred, /* name */ be_nested_proto( - 4, /* nstack */ - 1, /* argc */ + 6, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 1, /* has sup protos */ + ( &(const struct bproto*[ 1]) { + be_nested_proto( + 3, /* nstack */ + 0, /* argc */ + 0, /* varg */ + 1, /* has upvals */ + ( &(const bupvaldesc[ 2]) { /* upvals */ + be_local_const_upval(1, 0), + be_local_const_upval(1, 1), + }), + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str_weak(start_operational_discovery), + }), + be_str_weak(_X3Clambda_X3E), + &be_const_str_solidified, + ( &(const binstruction[ 5]) { /* code */ + 0x68000000, // 0000 GETUPV R0 U0 + 0x8C000100, // 0001 GETMET R0 R0 K0 + 0x68080001, // 0002 GETUPV R2 U1 + 0x7C000400, // 0003 CALL R0 2 + 0x80040000, // 0004 RET 1 R0 + }) + ), + }), + 1, /* has constants */ + ( &(const bvalue[ 3]) { /* constants */ + /* K0 */ be_nested_str_weak(tasmota), + /* K1 */ be_nested_str_weak(set_timer), + /* K2 */ be_const_int(0), + }), + be_str_weak(start_operational_discovery_deferred), + &be_const_str_solidified, + ( &(const binstruction[ 7]) { /* code */ + 0xB80A0000, // 0000 GETNGBL R2 K0 + 0x8C080501, // 0001 GETMET R2 R2 K1 + 0x58100002, // 0002 LDCONST R4 K2 + 0x84140000, // 0003 CLOSURE R5 P0 + 0x7C080600, // 0004 CALL R2 3 + 0xA0000000, // 0005 CLOSE R0 + 0x80000000, // 0006 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: get_active_endpoints +********************************************************************/ +be_local_closure(Matter_Device_get_active_endpoints, /* name */ + be_nested_proto( + 9, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 6]) { /* constants */ + /* K0 */ be_nested_str_weak(plugins), + /* K1 */ be_nested_str_weak(get_endpoint), + /* K2 */ be_const_int(0), + /* K3 */ be_nested_str_weak(find), + /* K4 */ be_nested_str_weak(push), + /* K5 */ be_nested_str_weak(stop_iteration), + }), + be_str_weak(get_active_endpoints), + &be_const_str_solidified, + ( &(const binstruction[28]) { /* code */ + 0x60080012, // 0000 GETGBL R2 G18 + 0x7C080000, // 0001 CALL R2 0 + 0x600C0010, // 0002 GETGBL R3 G16 + 0x88100100, // 0003 GETMBR R4 R0 K0 + 0x7C0C0200, // 0004 CALL R3 1 + 0xA8020011, // 0005 EXBLK 0 #0018 + 0x5C100600, // 0006 MOVE R4 R3 + 0x7C100000, // 0007 CALL R4 0 + 0x8C140901, // 0008 GETMET R5 R4 K1 + 0x7C140200, // 0009 CALL R5 1 + 0x78060002, // 000A JMPF R1 #000E + 0x1C180B02, // 000B EQ R6 R5 K2 + 0x781A0000, // 000C JMPF R6 #000E + 0x7001FFF7, // 000D JMP #0006 + 0x8C180503, // 000E GETMET R6 R2 K3 + 0x5C200A00, // 000F MOVE R8 R5 + 0x7C180400, // 0010 CALL R6 2 + 0x4C1C0000, // 0011 LDNIL R7 + 0x1C180C07, // 0012 EQ R6 R6 R7 + 0x781A0002, // 0013 JMPF R6 #0017 + 0x8C180504, // 0014 GETMET R6 R2 K4 + 0x5C200A00, // 0015 MOVE R8 R5 + 0x7C180400, // 0016 CALL R6 2 + 0x7001FFED, // 0017 JMP #0006 + 0x580C0005, // 0018 LDCONST R3 K5 + 0xAC0C0200, // 0019 CATCH R3 1 0 + 0xB0080000, // 001A RAISE 2 R0 R0 + 0x80040400, // 001B RET 1 R2 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: start_commissioning_complete_deferred +********************************************************************/ +be_local_closure(Matter_Device_start_commissioning_complete_deferred, /* name */ + be_nested_proto( + 6, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 1, /* has sup protos */ + ( &(const struct bproto*[ 1]) { + be_nested_proto( + 3, /* nstack */ + 0, /* argc */ + 0, /* varg */ + 1, /* has upvals */ + ( &(const bupvaldesc[ 2]) { /* upvals */ + be_local_const_upval(1, 0), + be_local_const_upval(1, 1), + }), + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str_weak(start_commissioning_complete), + }), + be_str_weak(_X3Clambda_X3E), + &be_const_str_solidified, + ( &(const binstruction[ 5]) { /* code */ + 0x68000000, // 0000 GETUPV R0 U0 + 0x8C000100, // 0001 GETMET R0 R0 K0 + 0x68080001, // 0002 GETUPV R2 U1 + 0x7C000400, // 0003 CALL R0 2 + 0x80040000, // 0004 RET 1 R0 + }) + ), + }), + 1, /* has constants */ + ( &(const bvalue[ 3]) { /* constants */ + /* K0 */ be_nested_str_weak(tasmota), + /* K1 */ be_nested_str_weak(set_timer), + /* K2 */ be_const_int(0), + }), + be_str_weak(start_commissioning_complete_deferred), + &be_const_str_solidified, + ( &(const binstruction[ 7]) { /* code */ + 0xB80A0000, // 0000 GETNGBL R2 K0 + 0x8C080501, // 0001 GETMET R2 R2 K1 + 0x58100002, // 0002 LDCONST R4 K2 + 0x84140000, // 0003 CLOSURE R5 P0 + 0x7C080600, // 0004 CALL R2 3 + 0xA0000000, // 0005 CLOSE R0 + 0x80000000, // 0006 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: _instantiate_plugins_from_config +********************************************************************/ +be_local_closure(Matter_Device__instantiate_plugins_from_config, /* name */ + be_nested_proto( + 18, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[30]) { /* constants */ + /* K0 */ be_nested_str_weak(k2l_num), + /* K1 */ be_nested_str_weak(tasmota), + /* K2 */ be_nested_str_weak(log), + /* K3 */ be_nested_str_weak(MTR_X3A_X20Configuring_X20endpoints), + /* K4 */ be_const_int(2), + /* K5 */ be_nested_str_weak(plugins), + /* K6 */ be_nested_str_weak(push), + /* K7 */ be_nested_str_weak(matter), + /* K8 */ be_nested_str_weak(Plugin_Root), + /* K9 */ be_const_int(0), + /* K10 */ be_nested_str_weak(MTR_X3A_X20_X20_X20endpoint_X20_X3D_X20_X255i_X20type_X3A_X25s_X25s), + /* K11 */ be_nested_str_weak(root), + /* K12 */ be_nested_str_weak(), + /* K13 */ be_nested_str_weak(Plugin_Aggregator), + /* K14 */ be_nested_str_weak(find), + /* K15 */ be_nested_str_weak(type), + /* K16 */ be_nested_str_weak(MTR_X3A_X20no_X20class_X20name_X2C_X20skipping), + /* K17 */ be_const_int(3), + /* K18 */ be_nested_str_weak(MTR_X3A_X20only_X20one_X20root_X20node_X20allowed), + /* K19 */ be_nested_str_weak(plugins_classes), + /* K20 */ be_nested_str_weak(MTR_X3A_X20unknown_X20class_X20name_X20_X27), + /* K21 */ be_nested_str_weak(_X27_X20skipping), + /* K22 */ be_nested_str_weak(conf_to_log), + /* K23 */ be_nested_str_weak(MTR_X3A_X20Exception), + /* K24 */ be_nested_str_weak(_X7C), + /* K25 */ be_nested_str_weak(stop_iteration), + /* K26 */ be_nested_str_weak(aggregator), + /* K27 */ be_nested_str_weak(publish_result), + /* K28 */ be_nested_str_weak(_X7B_X22Matter_X22_X3A_X7B_X22Initialized_X22_X3A1_X7D_X7D), + /* K29 */ be_nested_str_weak(Matter), + }), + be_str_weak(_instantiate_plugins_from_config), + &be_const_str_solidified, + ( &(const binstruction[152]) { /* code */ + 0x8C080100, // 0000 GETMET R2 R0 K0 + 0x5C100200, // 0001 MOVE R4 R1 + 0x7C080400, // 0002 CALL R2 2 + 0xB80E0200, // 0003 GETNGBL R3 K1 + 0x8C0C0702, // 0004 GETMET R3 R3 K2 + 0x58140003, // 0005 LDCONST R5 K3 + 0x58180004, // 0006 LDCONST R6 K4 + 0x7C0C0600, // 0007 CALL R3 3 + 0x880C0105, // 0008 GETMBR R3 R0 K5 + 0x8C0C0706, // 0009 GETMET R3 R3 K6 + 0xB8160E00, // 000A GETNGBL R5 K7 + 0x8C140B08, // 000B GETMET R5 R5 K8 + 0x5C1C0000, // 000C MOVE R7 R0 + 0x58200009, // 000D LDCONST R8 K9 + 0x60240013, // 000E GETGBL R9 G19 + 0x7C240000, // 000F CALL R9 0 + 0x7C140800, // 0010 CALL R5 4 + 0x7C0C0400, // 0011 CALL R3 2 + 0xB80E0200, // 0012 GETNGBL R3 K1 + 0x8C0C0702, // 0013 GETMET R3 R3 K2 + 0x60140018, // 0014 GETGBL R5 G24 + 0x5818000A, // 0015 LDCONST R6 K10 + 0x581C0009, // 0016 LDCONST R7 K9 + 0x5820000B, // 0017 LDCONST R8 K11 + 0x5824000C, // 0018 LDCONST R9 K12 + 0x7C140800, // 0019 CALL R5 4 + 0x58180004, // 001A LDCONST R6 K4 + 0x7C0C0600, // 001B CALL R3 3 + 0x880C0105, // 001C GETMBR R3 R0 K5 + 0x8C0C0706, // 001D GETMET R3 R3 K6 + 0xB8160E00, // 001E GETNGBL R5 K7 + 0x8C140B0D, // 001F GETMET R5 R5 K13 + 0x5C1C0000, // 0020 MOVE R7 R0 + 0x5422FEFF, // 0021 LDINT R8 65280 + 0x60240013, // 0022 GETGBL R9 G19 + 0x7C240000, // 0023 CALL R9 0 + 0x7C140800, // 0024 CALL R5 4 + 0x7C0C0400, // 0025 CALL R3 2 + 0x600C0010, // 0026 GETGBL R3 G16 + 0x5C100400, // 0027 MOVE R4 R2 + 0x7C0C0200, // 0028 CALL R3 1 + 0xA802005A, // 0029 EXBLK 0 #0085 + 0x5C100600, // 002A MOVE R4 R3 + 0x7C100000, // 002B CALL R4 0 + 0x1C140909, // 002C EQ R5 R4 K9 + 0x78160000, // 002D JMPF R5 #002F + 0x7001FFFA, // 002E JMP #002A + 0xA8020042, // 002F EXBLK 0 #0073 + 0x60140008, // 0030 GETGBL R5 G8 + 0x5C180800, // 0031 MOVE R6 R4 + 0x7C140200, // 0032 CALL R5 1 + 0x94140205, // 0033 GETIDX R5 R1 R5 + 0x8C180B0E, // 0034 GETMET R6 R5 K14 + 0x5820000F, // 0035 LDCONST R8 K15 + 0x7C180400, // 0036 CALL R6 2 + 0x4C1C0000, // 0037 LDNIL R7 + 0x1C1C0C07, // 0038 EQ R7 R6 R7 + 0x781E0006, // 0039 JMPF R7 #0041 + 0xB81E0200, // 003A GETNGBL R7 K1 + 0x8C1C0F02, // 003B GETMET R7 R7 K2 + 0x58240010, // 003C LDCONST R9 K16 + 0x58280011, // 003D LDCONST R10 K17 + 0x7C1C0600, // 003E CALL R7 3 + 0xA8040001, // 003F EXBLK 1 1 + 0x7001FFE8, // 0040 JMP #002A + 0x1C1C0D0B, // 0041 EQ R7 R6 K11 + 0x781E0006, // 0042 JMPF R7 #004A + 0xB81E0200, // 0043 GETNGBL R7 K1 + 0x8C1C0F02, // 0044 GETMET R7 R7 K2 + 0x58240012, // 0045 LDCONST R9 K18 + 0x58280011, // 0046 LDCONST R10 K17 + 0x7C1C0600, // 0047 CALL R7 3 + 0xA8040001, // 0048 EXBLK 1 1 + 0x7001FFDF, // 0049 JMP #002A + 0x881C0113, // 004A GETMBR R7 R0 K19 + 0x8C1C0F0E, // 004B GETMET R7 R7 K14 + 0x5C240C00, // 004C MOVE R9 R6 + 0x7C1C0400, // 004D CALL R7 2 + 0x4C200000, // 004E LDNIL R8 + 0x1C200E08, // 004F EQ R8 R7 R8 + 0x7822000A, // 0050 JMPF R8 #005C + 0xB8220200, // 0051 GETNGBL R8 K1 + 0x8C201102, // 0052 GETMET R8 R8 K2 + 0x60280008, // 0053 GETGBL R10 G8 + 0x5C2C0C00, // 0054 MOVE R11 R6 + 0x7C280200, // 0055 CALL R10 1 + 0x002A280A, // 0056 ADD R10 K20 R10 + 0x00281515, // 0057 ADD R10 R10 K21 + 0x582C0004, // 0058 LDCONST R11 K4 + 0x7C200600, // 0059 CALL R8 3 + 0xA8040001, // 005A EXBLK 1 1 + 0x7001FFCD, // 005B JMP #002A + 0x5C200E00, // 005C MOVE R8 R7 + 0x5C240000, // 005D MOVE R9 R0 + 0x5C280800, // 005E MOVE R10 R4 + 0x5C2C0A00, // 005F MOVE R11 R5 + 0x7C200600, // 0060 CALL R8 3 + 0x88240105, // 0061 GETMBR R9 R0 K5 + 0x8C241306, // 0062 GETMET R9 R9 K6 + 0x5C2C1000, // 0063 MOVE R11 R8 + 0x7C240400, // 0064 CALL R9 2 + 0xB8260200, // 0065 GETNGBL R9 K1 + 0x8C241302, // 0066 GETMET R9 R9 K2 + 0x602C0018, // 0067 GETGBL R11 G24 + 0x5830000A, // 0068 LDCONST R12 K10 + 0x5C340800, // 0069 MOVE R13 R4 + 0x5C380C00, // 006A MOVE R14 R6 + 0x8C3C0116, // 006B GETMET R15 R0 K22 + 0x5C440A00, // 006C MOVE R17 R5 + 0x7C3C0400, // 006D CALL R15 2 + 0x7C2C0800, // 006E CALL R11 4 + 0x58300004, // 006F LDCONST R12 K4 + 0x7C240600, // 0070 CALL R9 3 + 0xA8040001, // 0071 EXBLK 1 1 + 0x70020010, // 0072 JMP #0084 + 0xAC140002, // 0073 CATCH R5 0 2 + 0x7002000D, // 0074 JMP #0083 + 0xB81E0200, // 0075 GETNGBL R7 K1 + 0x8C1C0F02, // 0076 GETMET R7 R7 K2 + 0x60240008, // 0077 GETGBL R9 G8 + 0x5C280A00, // 0078 MOVE R10 R5 + 0x7C240200, // 0079 CALL R9 1 + 0x00262E09, // 007A ADD R9 K23 R9 + 0x00241318, // 007B ADD R9 R9 K24 + 0x60280008, // 007C GETGBL R10 G8 + 0x5C2C0C00, // 007D MOVE R11 R6 + 0x7C280200, // 007E CALL R10 1 + 0x0024120A, // 007F ADD R9 R9 R10 + 0x58280004, // 0080 LDCONST R10 K4 + 0x7C1C0600, // 0081 CALL R7 3 + 0x70020000, // 0082 JMP #0084 + 0xB0080000, // 0083 RAISE 2 R0 R0 + 0x7001FFA4, // 0084 JMP #002A + 0x580C0019, // 0085 LDCONST R3 K25 + 0xAC0C0200, // 0086 CATCH R3 1 0 + 0xB0080000, // 0087 RAISE 2 R0 R0 + 0xB80E0200, // 0088 GETNGBL R3 K1 + 0x8C0C0702, // 0089 GETMET R3 R3 K2 + 0x60140018, // 008A GETGBL R5 G24 + 0x5818000A, // 008B LDCONST R6 K10 + 0x541EFEFF, // 008C LDINT R7 65280 + 0x5820001A, // 008D LDCONST R8 K26 + 0x5824000C, // 008E LDCONST R9 K12 + 0x7C140800, // 008F CALL R5 4 + 0x58180004, // 0090 LDCONST R6 K4 + 0x7C0C0600, // 0091 CALL R3 3 + 0xB80E0200, // 0092 GETNGBL R3 K1 + 0x8C0C071B, // 0093 GETMET R3 R3 K27 + 0x5814001C, // 0094 LDCONST R5 K28 + 0x5818001D, // 0095 LDCONST R6 K29 + 0x7C0C0600, // 0096 CALL R3 3 + 0x80000000, // 0097 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: start_operational_discovery +********************************************************************/ +be_local_closure(Matter_Device_start_operational_discovery, /* name */ + be_nested_proto( + 7, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 6]) { /* constants */ + /* K0 */ be_nested_str_weak(crypto), + /* K1 */ be_nested_str_weak(mdns), + /* K2 */ be_nested_str_weak(stop_basic_commissioning), + /* K3 */ be_nested_str_weak(root_w0), + /* K4 */ be_nested_str_weak(root_L), + /* K5 */ be_nested_str_weak(mdns_announce_op_discovery), + }), + be_str_weak(start_operational_discovery), + &be_const_str_solidified, + ( &(const binstruction[12]) { /* code */ + 0xA40A0000, // 0000 IMPORT R2 K0 + 0xA40E0200, // 0001 IMPORT R3 K1 + 0x8C100102, // 0002 GETMET R4 R0 K2 + 0x7C100200, // 0003 CALL R4 1 + 0x4C100000, // 0004 LDNIL R4 + 0x90020604, // 0005 SETMBR R0 K3 R4 + 0x4C100000, // 0006 LDNIL R4 + 0x90020804, // 0007 SETMBR R0 K4 R4 + 0x8C100105, // 0008 GETMET R4 R0 K5 + 0x5C180200, // 0009 MOVE R6 R1 + 0x7C100400, // 000A CALL R4 2 + 0x80000000, // 000B RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: _mdns_announce_hostname +********************************************************************/ +be_local_closure(Matter_Device__mdns_announce_hostname, /* name */ + be_nested_proto( + 14, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[27]) { /* constants */ + /* K0 */ be_nested_str_weak(mdns), + /* K1 */ be_nested_str_weak(string), + /* K2 */ be_nested_str_weak(start), + /* K3 */ be_nested_str_weak(tasmota), + /* K4 */ be_nested_str_weak(eth), + /* K5 */ be_nested_str_weak(hostname_eth), + /* K6 */ be_nested_str_weak(replace), + /* K7 */ be_nested_str_weak(find), + /* K8 */ be_nested_str_weak(mac), + /* K9 */ be_nested_str_weak(_X3A), + /* K10 */ be_nested_str_weak(), + /* K11 */ be_nested_str_weak(ipv4only), + /* K12 */ be_nested_str_weak(contains), + /* K13 */ be_nested_str_weak(ip6local), + /* K14 */ be_nested_str_weak(add_hostname), + /* K15 */ be_nested_str_weak(ip), + /* K16 */ be_nested_str_weak(ip6), + /* K17 */ be_nested_str_weak(log), + /* K18 */ be_nested_str_weak(MTR_X3A_X20calling_X20mdns_X2Eadd_hostname_X28_X25s_X2C_X20_X25s_X29), + /* K19 */ be_const_int(3), + /* K20 */ be_nested_str_weak(wifi), + /* K21 */ be_nested_str_weak(hostname_wifi), + /* K22 */ be_nested_str_weak(MTR_X3A_X20start_X20mDNS_X20on_X20_X25s_X20host_X20_X27_X25s_X2Elocal_X27), + /* K23 */ be_nested_str_weak(MTR_X3A_X20Exception), + /* K24 */ be_nested_str_weak(_X7C), + /* K25 */ be_const_int(2), + /* K26 */ be_nested_str_weak(mdns_announce_op_discovery_all_fabrics), + }), + be_str_weak(_mdns_announce_hostname), + &be_const_str_solidified, + ( &(const binstruction[148]) { /* code */ + 0xA40A0000, // 0000 IMPORT R2 K0 + 0xA40E0200, // 0001 IMPORT R3 K1 + 0x8C100502, // 0002 GETMET R4 R2 K2 + 0x7C100200, // 0003 CALL R4 1 + 0xA802007A, // 0004 EXBLK 0 #0080 + 0x78060034, // 0005 JMPF R1 #003B + 0xB8120600, // 0006 GETNGBL R4 K3 + 0x8C100904, // 0007 GETMET R4 R4 K4 + 0x7C100200, // 0008 CALL R4 1 + 0x8C140706, // 0009 GETMET R5 R3 K6 + 0x8C1C0907, // 000A GETMET R7 R4 K7 + 0x58240008, // 000B LDCONST R9 K8 + 0x7C1C0400, // 000C CALL R7 2 + 0x58200009, // 000D LDCONST R8 K9 + 0x5824000A, // 000E LDCONST R9 K10 + 0x7C140800, // 000F CALL R5 4 + 0x90020A05, // 0010 SETMBR R0 K5 R5 + 0x8814010B, // 0011 GETMBR R5 R0 K11 + 0x78160003, // 0012 JMPF R5 #0017 + 0x8C14090C, // 0013 GETMET R5 R4 K12 + 0x581C000D, // 0014 LDCONST R7 K13 + 0x7C140400, // 0015 CALL R5 2 + 0x7416000F, // 0016 JMPT R5 #0027 + 0x8C14050E, // 0017 GETMET R5 R2 K14 + 0x881C0105, // 0018 GETMBR R7 R0 K5 + 0x8C200907, // 0019 GETMET R8 R4 K7 + 0x5828000D, // 001A LDCONST R10 K13 + 0x582C000A, // 001B LDCONST R11 K10 + 0x7C200600, // 001C CALL R8 3 + 0x8C240907, // 001D GETMET R9 R4 K7 + 0x582C000F, // 001E LDCONST R11 K15 + 0x5830000A, // 001F LDCONST R12 K10 + 0x7C240600, // 0020 CALL R9 3 + 0x8C280907, // 0021 GETMET R10 R4 K7 + 0x58300010, // 0022 LDCONST R12 K16 + 0x5834000A, // 0023 LDCONST R13 K10 + 0x7C280600, // 0024 CALL R10 3 + 0x7C140A00, // 0025 CALL R5 5 + 0x70020012, // 0026 JMP #003A + 0xB8160600, // 0027 GETNGBL R5 K3 + 0x8C140B11, // 0028 GETMET R5 R5 K17 + 0x601C0018, // 0029 GETGBL R7 G24 + 0x58200012, // 002A LDCONST R8 K18 + 0x88240105, // 002B GETMBR R9 R0 K5 + 0x8C280907, // 002C GETMET R10 R4 K7 + 0x5830000F, // 002D LDCONST R12 K15 + 0x5834000A, // 002E LDCONST R13 K10 + 0x7C280600, // 002F CALL R10 3 + 0x7C1C0600, // 0030 CALL R7 3 + 0x58200013, // 0031 LDCONST R8 K19 + 0x7C140600, // 0032 CALL R5 3 + 0x8C14050E, // 0033 GETMET R5 R2 K14 + 0x881C0105, // 0034 GETMBR R7 R0 K5 + 0x8C200907, // 0035 GETMET R8 R4 K7 + 0x5828000F, // 0036 LDCONST R10 K15 + 0x582C000A, // 0037 LDCONST R11 K10 + 0x7C200600, // 0038 CALL R8 3 + 0x7C140600, // 0039 CALL R5 3 + 0x70020033, // 003A JMP #006F + 0xB8120600, // 003B GETNGBL R4 K3 + 0x8C100914, // 003C GETMET R4 R4 K20 + 0x7C100200, // 003D CALL R4 1 + 0x8C140706, // 003E GETMET R5 R3 K6 + 0x8C1C0907, // 003F GETMET R7 R4 K7 + 0x58240008, // 0040 LDCONST R9 K8 + 0x7C1C0400, // 0041 CALL R7 2 + 0x58200009, // 0042 LDCONST R8 K9 + 0x5824000A, // 0043 LDCONST R9 K10 + 0x7C140800, // 0044 CALL R5 4 + 0x90022A05, // 0045 SETMBR R0 K21 R5 + 0x8814010B, // 0046 GETMBR R5 R0 K11 + 0x78160003, // 0047 JMPF R5 #004C + 0x8C14090C, // 0048 GETMET R5 R4 K12 + 0x581C000D, // 0049 LDCONST R7 K13 + 0x7C140400, // 004A CALL R5 2 + 0x7416000F, // 004B JMPT R5 #005C + 0x8C14050E, // 004C GETMET R5 R2 K14 + 0x881C0115, // 004D GETMBR R7 R0 K21 + 0x8C200907, // 004E GETMET R8 R4 K7 + 0x5828000D, // 004F LDCONST R10 K13 + 0x582C000A, // 0050 LDCONST R11 K10 + 0x7C200600, // 0051 CALL R8 3 + 0x8C240907, // 0052 GETMET R9 R4 K7 + 0x582C000F, // 0053 LDCONST R11 K15 + 0x5830000A, // 0054 LDCONST R12 K10 + 0x7C240600, // 0055 CALL R9 3 + 0x8C280907, // 0056 GETMET R10 R4 K7 + 0x58300010, // 0057 LDCONST R12 K16 + 0x5834000A, // 0058 LDCONST R13 K10 + 0x7C280600, // 0059 CALL R10 3 + 0x7C140A00, // 005A CALL R5 5 + 0x70020012, // 005B JMP #006F + 0xB8160600, // 005C GETNGBL R5 K3 + 0x8C140B11, // 005D GETMET R5 R5 K17 + 0x601C0018, // 005E GETGBL R7 G24 + 0x58200012, // 005F LDCONST R8 K18 + 0x88240115, // 0060 GETMBR R9 R0 K21 + 0x8C280907, // 0061 GETMET R10 R4 K7 + 0x5830000F, // 0062 LDCONST R12 K15 + 0x5834000A, // 0063 LDCONST R13 K10 + 0x7C280600, // 0064 CALL R10 3 + 0x7C1C0600, // 0065 CALL R7 3 + 0x58200013, // 0066 LDCONST R8 K19 + 0x7C140600, // 0067 CALL R5 3 + 0x8C14050E, // 0068 GETMET R5 R2 K14 + 0x881C0115, // 0069 GETMBR R7 R0 K21 + 0x8C200907, // 006A GETMET R8 R4 K7 + 0x5828000F, // 006B LDCONST R10 K15 + 0x582C000A, // 006C LDCONST R11 K10 + 0x7C200600, // 006D CALL R8 3 + 0x7C140600, // 006E CALL R5 3 + 0xB8120600, // 006F GETNGBL R4 K3 + 0x8C100911, // 0070 GETMET R4 R4 K17 + 0x60180018, // 0071 GETGBL R6 G24 + 0x581C0016, // 0072 LDCONST R7 K22 + 0x78060001, // 0073 JMPF R1 #0076 + 0x58200004, // 0074 LDCONST R8 K4 + 0x70020000, // 0075 JMP #0077 + 0x58200014, // 0076 LDCONST R8 K20 + 0x78060001, // 0077 JMPF R1 #007A + 0x88240105, // 0078 GETMBR R9 R0 K5 + 0x70020000, // 0079 JMP #007B + 0x88240115, // 007A GETMBR R9 R0 K21 + 0x7C180600, // 007B CALL R6 3 + 0x581C0013, // 007C LDCONST R7 K19 + 0x7C100600, // 007D CALL R4 3 + 0xA8040001, // 007E EXBLK 1 1 + 0x70020010, // 007F JMP #0091 + 0xAC100002, // 0080 CATCH R4 0 2 + 0x7002000D, // 0081 JMP #0090 + 0xB81A0600, // 0082 GETNGBL R6 K3 + 0x8C180D11, // 0083 GETMET R6 R6 K17 + 0x60200008, // 0084 GETGBL R8 G8 + 0x5C240800, // 0085 MOVE R9 R4 + 0x7C200200, // 0086 CALL R8 1 + 0x00222E08, // 0087 ADD R8 K23 R8 + 0x00201118, // 0088 ADD R8 R8 K24 + 0x60240008, // 0089 GETGBL R9 G8 + 0x5C280A00, // 008A MOVE R10 R5 + 0x7C240200, // 008B CALL R9 1 + 0x00201009, // 008C ADD R8 R8 R9 + 0x58240019, // 008D LDCONST R9 K25 + 0x7C180600, // 008E CALL R6 3 + 0x70020000, // 008F JMP #0091 + 0xB0080000, // 0090 RAISE 2 R0 R0 + 0x8C10011A, // 0091 GETMET R4 R0 K26 + 0x7C100200, // 0092 CALL R4 1 + 0x80000000, // 0093 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: bridge_remove_endpoint +********************************************************************/ +be_local_closure(Matter_Device_bridge_remove_endpoint, /* name */ + be_nested_proto( + 11, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[18]) { /* constants */ + /* K0 */ be_nested_str_weak(json), + /* K1 */ be_nested_str_weak(plugins_config), + /* K2 */ be_nested_str_weak(contains), + /* K3 */ be_nested_str_weak(tasmota), + /* K4 */ be_nested_str_weak(log), + /* K5 */ be_nested_str_weak(MTR_X3A_X20Cannot_X20remove_X20an_X20enpoint_X20not_X20configured_X3A_X20), + /* K6 */ be_const_int(3), + /* K7 */ be_nested_str_weak(MTR_X3A_X20deleting_X20endpoint_X20_X3D_X20_X25i), + /* K8 */ be_const_int(2), + /* K9 */ be_nested_str_weak(remove), + /* K10 */ be_nested_str_weak(plugins_persist), + /* K11 */ be_const_int(0), + /* K12 */ be_nested_str_weak(plugins), + /* K13 */ be_nested_str_weak(get_endpoint), + /* K14 */ be_const_int(1), + /* K15 */ be_nested_str_weak(clean_remotes), + /* K16 */ be_nested_str_weak(save_param), + /* K17 */ be_nested_str_weak(signal_endpoints_changed), + }), + be_str_weak(bridge_remove_endpoint), + &be_const_str_solidified, + ( &(const binstruction[58]) { /* code */ + 0xA40A0000, // 0000 IMPORT R2 K0 + 0x600C0008, // 0001 GETGBL R3 G8 + 0x5C100200, // 0002 MOVE R4 R1 + 0x7C0C0200, // 0003 CALL R3 1 + 0x4C100000, // 0004 LDNIL R4 + 0x4C140000, // 0005 LDNIL R5 + 0x88180101, // 0006 GETMBR R6 R0 K1 + 0x8C180D02, // 0007 GETMET R6 R6 K2 + 0x5C200600, // 0008 MOVE R8 R3 + 0x7C180400, // 0009 CALL R6 2 + 0x741A0005, // 000A JMPT R6 #0011 + 0xB81A0600, // 000B GETNGBL R6 K3 + 0x8C180D04, // 000C GETMET R6 R6 K4 + 0x00220A03, // 000D ADD R8 K5 R3 + 0x58240006, // 000E LDCONST R9 K6 + 0x7C180600, // 000F CALL R6 3 + 0x80000C00, // 0010 RET 0 + 0xB81A0600, // 0011 GETNGBL R6 K3 + 0x8C180D04, // 0012 GETMET R6 R6 K4 + 0x60200018, // 0013 GETGBL R8 G24 + 0x58240007, // 0014 LDCONST R9 K7 + 0x5C280200, // 0015 MOVE R10 R1 + 0x7C200400, // 0016 CALL R8 2 + 0x58240008, // 0017 LDCONST R9 K8 + 0x7C180600, // 0018 CALL R6 3 + 0x88180101, // 0019 GETMBR R6 R0 K1 + 0x8C180D09, // 001A GETMET R6 R6 K9 + 0x5C200600, // 001B MOVE R8 R3 + 0x7C180400, // 001C CALL R6 2 + 0x50180200, // 001D LDBOOL R6 1 0 + 0x90021406, // 001E SETMBR R0 K10 R6 + 0x5818000B, // 001F LDCONST R6 K11 + 0x601C000C, // 0020 GETGBL R7 G12 + 0x8820010C, // 0021 GETMBR R8 R0 K12 + 0x7C1C0200, // 0022 CALL R7 1 + 0x141C0C07, // 0023 LT R7 R6 R7 + 0x781E000D, // 0024 JMPF R7 #0033 + 0x881C010C, // 0025 GETMBR R7 R0 K12 + 0x941C0E06, // 0026 GETIDX R7 R7 R6 + 0x8C1C0F0D, // 0027 GETMET R7 R7 K13 + 0x7C1C0200, // 0028 CALL R7 1 + 0x1C1C0207, // 0029 EQ R7 R1 R7 + 0x781E0005, // 002A JMPF R7 #0031 + 0x881C010C, // 002B GETMBR R7 R0 K12 + 0x8C1C0F09, // 002C GETMET R7 R7 K9 + 0x5C240C00, // 002D MOVE R9 R6 + 0x7C1C0400, // 002E CALL R7 2 + 0x70020002, // 002F JMP #0033 + 0x70020000, // 0030 JMP #0032 + 0x00180D0E, // 0031 ADD R6 R6 K14 + 0x7001FFEC, // 0032 JMP #0020 + 0x8C1C010F, // 0033 GETMET R7 R0 K15 + 0x7C1C0200, // 0034 CALL R7 1 + 0x8C1C0110, // 0035 GETMET R7 R0 K16 + 0x7C1C0200, // 0036 CALL R7 1 + 0x8C1C0111, // 0037 GETMET R7 R0 K17 + 0x7C1C0200, // 0038 CALL R7 1 + 0x80000000, // 0039 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: find_plugin_by_endpoint +********************************************************************/ +be_local_closure(Matter_Device_find_plugin_by_endpoint, /* name */ + be_nested_proto( + 6, /* nstack */ + 2, /* argc */ 2, /* varg */ 0, /* has upvals */ NULL, /* no upvals */ @@ -411,24 +1146,484 @@ be_local_closure(Matter_Device_stop, /* name */ NULL, /* no sub protos */ 1, /* has constants */ ( &(const bvalue[ 4]) { /* constants */ - /* K0 */ be_nested_str_weak(tasmota), - /* K1 */ be_nested_str_weak(remove_driver), - /* K2 */ be_nested_str_weak(udp_server), - /* K3 */ be_nested_str_weak(stop), + /* K0 */ be_const_int(0), + /* K1 */ be_nested_str_weak(plugins), + /* K2 */ be_nested_str_weak(get_endpoint), + /* K3 */ be_const_int(1), }), - be_str_weak(stop), + be_str_weak(find_plugin_by_endpoint), &be_const_str_solidified, - ( &(const binstruction[10]) { /* code */ + ( &(const binstruction[17]) { /* code */ + 0x58080000, // 0000 LDCONST R2 K0 + 0x600C000C, // 0001 GETGBL R3 G12 + 0x88100101, // 0002 GETMBR R4 R0 K1 + 0x7C0C0200, // 0003 CALL R3 1 + 0x140C0403, // 0004 LT R3 R2 R3 + 0x780E0008, // 0005 JMPF R3 #000F + 0x880C0101, // 0006 GETMBR R3 R0 K1 + 0x940C0602, // 0007 GETIDX R3 R3 R2 + 0x8C100702, // 0008 GETMET R4 R3 K2 + 0x7C100200, // 0009 CALL R4 1 + 0x1C100801, // 000A EQ R4 R4 R1 + 0x78120000, // 000B JMPF R4 #000D + 0x80040600, // 000C RET 1 R3 + 0x00080503, // 000D ADD R2 R2 K3 + 0x7001FFF1, // 000E JMP #0001 + 0x4C0C0000, // 000F LDNIL R3 + 0x80040600, // 0010 RET 1 R3 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: start_mdns_announce_hostnames +********************************************************************/ +be_local_closure(Matter_Device_start_mdns_announce_hostnames, /* name */ + be_nested_proto( + 6, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 1, /* has sup protos */ + ( &(const struct bproto*[ 2]) { + be_nested_proto( + 4, /* nstack */ + 0, /* argc */ + 0, /* varg */ + 1, /* has upvals */ + ( &(const bupvaldesc[ 1]) { /* upvals */ + be_local_const_upval(1, 0), + }), + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 5]) { /* constants */ + /* K0 */ be_nested_str_weak(_mdns_announce_hostname), + /* K1 */ be_nested_str_weak(tasmota), + /* K2 */ be_nested_str_weak(remove_rule), + /* K3 */ be_nested_str_weak(Wifi_X23Connected), + /* K4 */ be_nested_str_weak(matter_mdns_host), + }), + be_str_weak(_anonymous_), + &be_const_str_solidified, + ( &(const binstruction[10]) { /* code */ + 0x68000000, // 0000 GETUPV R0 U0 + 0x8C000100, // 0001 GETMET R0 R0 K0 + 0x50080000, // 0002 LDBOOL R2 0 0 + 0x7C000400, // 0003 CALL R0 2 + 0xB8020200, // 0004 GETNGBL R0 K1 + 0x8C000102, // 0005 GETMET R0 R0 K2 + 0x58080003, // 0006 LDCONST R2 K3 + 0x580C0004, // 0007 LDCONST R3 K4 + 0x7C000600, // 0008 CALL R0 3 + 0x80000000, // 0009 RET 0 + }) + ), + be_nested_proto( + 4, /* nstack */ + 0, /* argc */ + 0, /* varg */ + 1, /* has upvals */ + ( &(const bupvaldesc[ 1]) { /* upvals */ + be_local_const_upval(1, 0), + }), + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 5]) { /* constants */ + /* K0 */ be_nested_str_weak(_mdns_announce_hostname), + /* K1 */ be_nested_str_weak(tasmota), + /* K2 */ be_nested_str_weak(remove_rule), + /* K3 */ be_nested_str_weak(Eth_X23Connected), + /* K4 */ be_nested_str_weak(matter_mdns_host), + }), + be_str_weak(_anonymous_), + &be_const_str_solidified, + ( &(const binstruction[10]) { /* code */ + 0x68000000, // 0000 GETUPV R0 U0 + 0x8C000100, // 0001 GETMET R0 R0 K0 + 0x50080200, // 0002 LDBOOL R2 1 0 + 0x7C000400, // 0003 CALL R0 2 + 0xB8020200, // 0004 GETNGBL R0 K1 + 0x8C000102, // 0005 GETMET R0 R0 K2 + 0x58080003, // 0006 LDCONST R2 K3 + 0x580C0004, // 0007 LDCONST R3 K4 + 0x7C000600, // 0008 CALL R0 3 + 0x80000000, // 0009 RET 0 + }) + ), + }), + 1, /* has constants */ + ( &(const bvalue[ 9]) { /* constants */ + /* K0 */ be_nested_str_weak(tasmota), + /* K1 */ be_nested_str_weak(wifi), + /* K2 */ be_nested_str_weak(up), + /* K3 */ be_nested_str_weak(_mdns_announce_hostname), + /* K4 */ be_nested_str_weak(add_rule), + /* K5 */ be_nested_str_weak(Wifi_X23Connected), + /* K6 */ be_nested_str_weak(matter_mdns_host), + /* K7 */ be_nested_str_weak(eth), + /* K8 */ be_nested_str_weak(Eth_X23Connected), + }), + be_str_weak(start_mdns_announce_hostnames), + &be_const_str_solidified, + ( &(const binstruction[32]) { /* code */ 0xB8060000, // 0000 GETNGBL R1 K0 0x8C040301, // 0001 GETMET R1 R1 K1 - 0x5C0C0000, // 0002 MOVE R3 R0 - 0x7C040400, // 0003 CALL R1 2 - 0x88040102, // 0004 GETMBR R1 R0 K2 - 0x78060002, // 0005 JMPF R1 #0009 - 0x88040102, // 0006 GETMBR R1 R0 K2 - 0x8C040303, // 0007 GETMET R1 R1 K3 - 0x7C040200, // 0008 CALL R1 1 - 0x80000000, // 0009 RET 0 + 0x7C040200, // 0002 CALL R1 1 + 0x94040302, // 0003 GETIDX R1 R1 K2 + 0x78060003, // 0004 JMPF R1 #0009 + 0x8C040103, // 0005 GETMET R1 R0 K3 + 0x500C0000, // 0006 LDBOOL R3 0 0 + 0x7C040400, // 0007 CALL R1 2 + 0x70020005, // 0008 JMP #000F + 0xB8060000, // 0009 GETNGBL R1 K0 + 0x8C040304, // 000A GETMET R1 R1 K4 + 0x580C0005, // 000B LDCONST R3 K5 + 0x84100000, // 000C CLOSURE R4 P0 + 0x58140006, // 000D LDCONST R5 K6 + 0x7C040800, // 000E CALL R1 4 + 0xB8060000, // 000F GETNGBL R1 K0 + 0x8C040307, // 0010 GETMET R1 R1 K7 + 0x7C040200, // 0011 CALL R1 1 + 0x94040302, // 0012 GETIDX R1 R1 K2 + 0x78060003, // 0013 JMPF R1 #0018 + 0x8C040103, // 0014 GETMET R1 R0 K3 + 0x500C0200, // 0015 LDBOOL R3 1 0 + 0x7C040400, // 0016 CALL R1 2 + 0x70020005, // 0017 JMP #001E + 0xB8060000, // 0018 GETNGBL R1 K0 + 0x8C040304, // 0019 GETMET R1 R1 K4 + 0x580C0008, // 001A LDCONST R3 K8 + 0x84100001, // 001B CLOSURE R4 P1 + 0x58140006, // 001C LDCONST R5 K6 + 0x7C040800, // 001D CALL R1 4 + 0xA0000000, // 001E CLOSE R0 + 0x80000000, // 001F RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: _start_udp +********************************************************************/ +be_local_closure(Matter_Device__start_udp, /* name */ + be_nested_proto( + 7, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 1, /* has sup protos */ + ( &(const struct bproto*[ 1]) { + be_nested_proto( + 8, /* nstack */ + 3, /* argc */ + 0, /* varg */ + 1, /* has upvals */ + ( &(const bupvaldesc[ 1]) { /* upvals */ + be_local_const_upval(1, 0), + }), + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str_weak(msg_received), + }), + be_str_weak(_X3Clambda_X3E), + &be_const_str_solidified, + ( &(const binstruction[ 7]) { /* code */ + 0x680C0000, // 0000 GETUPV R3 U0 + 0x8C0C0700, // 0001 GETMET R3 R3 K0 + 0x5C140000, // 0002 MOVE R5 R0 + 0x5C180200, // 0003 MOVE R6 R1 + 0x5C1C0400, // 0004 MOVE R7 R2 + 0x7C0C0800, // 0005 CALL R3 4 + 0x80040600, // 0006 RET 1 R3 + }) + ), + }), + 1, /* has constants */ + ( &(const bvalue[ 9]) { /* constants */ + /* K0 */ be_nested_str_weak(udp_server), + /* K1 */ be_nested_str_weak(tasmota), + /* K2 */ be_nested_str_weak(log), + /* K3 */ be_nested_str_weak(MTR_X3A_X20Starting_X20UDP_X20server_X20on_X20port_X3A_X20), + /* K4 */ be_const_int(2), + /* K5 */ be_nested_str_weak(matter), + /* K6 */ be_nested_str_weak(UDPServer), + /* K7 */ be_nested_str_weak(), + /* K8 */ be_nested_str_weak(start), + }), + be_str_weak(_start_udp), + &be_const_str_solidified, + ( &(const binstruction[28]) { /* code */ + 0x88080100, // 0000 GETMBR R2 R0 K0 + 0x780A0000, // 0001 JMPF R2 #0003 + 0x80000400, // 0002 RET 0 + 0x4C080000, // 0003 LDNIL R2 + 0x1C080202, // 0004 EQ R2 R1 R2 + 0x780A0000, // 0005 JMPF R2 #0007 + 0x540615A3, // 0006 LDINT R1 5540 + 0xB80A0200, // 0007 GETNGBL R2 K1 + 0x8C080502, // 0008 GETMET R2 R2 K2 + 0x60100008, // 0009 GETGBL R4 G8 + 0x5C140200, // 000A MOVE R5 R1 + 0x7C100200, // 000B CALL R4 1 + 0x00120604, // 000C ADD R4 K3 R4 + 0x58140004, // 000D LDCONST R5 K4 + 0x7C080600, // 000E CALL R2 3 + 0xB80A0A00, // 000F GETNGBL R2 K5 + 0x8C080506, // 0010 GETMET R2 R2 K6 + 0x5C100000, // 0011 MOVE R4 R0 + 0x58140007, // 0012 LDCONST R5 K7 + 0x5C180200, // 0013 MOVE R6 R1 + 0x7C080800, // 0014 CALL R2 4 + 0x90020002, // 0015 SETMBR R0 K0 R2 + 0x88080100, // 0016 GETMBR R2 R0 K0 + 0x8C080508, // 0017 GETMET R2 R2 K8 + 0x84100000, // 0018 CLOSURE R4 P0 + 0x7C080400, // 0019 CALL R2 2 + 0xA0000000, // 001A CLOSE R0 + 0x80000000, // 001B RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: signal_endpoints_changed +********************************************************************/ +be_local_closure(Matter_Device_signal_endpoints_changed, /* name */ + be_nested_proto( + 7, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 3]) { /* constants */ + /* K0 */ be_nested_str_weak(attribute_updated), + /* K1 */ be_const_int(0), + /* K2 */ be_const_int(3), + }), + be_str_weak(signal_endpoints_changed), + &be_const_str_solidified, + ( &(const binstruction[13]) { /* code */ + 0x8C040100, // 0000 GETMET R1 R0 K0 + 0x580C0001, // 0001 LDCONST R3 K1 + 0x5412001C, // 0002 LDINT R4 29 + 0x58140002, // 0003 LDCONST R5 K2 + 0x50180000, // 0004 LDBOOL R6 0 0 + 0x7C040A00, // 0005 CALL R1 5 + 0x8C040100, // 0006 GETMET R1 R0 K0 + 0x540EFEFF, // 0007 LDINT R3 65280 + 0x5412001C, // 0008 LDINT R4 29 + 0x58140002, // 0009 LDCONST R5 K2 + 0x50180000, // 000A LDBOOL R6 0 0 + 0x7C040A00, // 000B CALL R1 5 + 0x80000000, // 000C RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: sort_distinct +********************************************************************/ +be_local_closure(Matter_Device_sort_distinct, /* name */ + be_nested_proto( + 7, /* nstack */ + 1, /* argc */ + 4, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 5]) { /* constants */ + /* K0 */ be_const_class(be_class_Matter_Device), + /* K1 */ be_const_int(1), + /* K2 */ be_const_int(0), + /* K3 */ be_nested_str_weak(stop_iteration), + /* K4 */ be_nested_str_weak(remove), + }), + be_str_weak(sort_distinct), + &be_const_str_solidified, + ( &(const binstruction[53]) { /* code */ + 0x58040000, // 0000 LDCONST R1 K0 + 0x60080010, // 0001 GETGBL R2 G16 + 0x600C000C, // 0002 GETGBL R3 G12 + 0x5C100000, // 0003 MOVE R4 R0 + 0x7C0C0200, // 0004 CALL R3 1 + 0x040C0701, // 0005 SUB R3 R3 K1 + 0x400E0203, // 0006 CONNECT R3 K1 R3 + 0x7C080200, // 0007 CALL R2 1 + 0xA8020010, // 0008 EXBLK 0 #001A + 0x5C0C0400, // 0009 MOVE R3 R2 + 0x7C0C0000, // 000A CALL R3 0 + 0x94100003, // 000B GETIDX R4 R0 R3 + 0x5C140600, // 000C MOVE R5 R3 + 0x24180B02, // 000D GT R6 R5 K2 + 0x781A0008, // 000E JMPF R6 #0018 + 0x04180B01, // 000F SUB R6 R5 K1 + 0x94180006, // 0010 GETIDX R6 R0 R6 + 0x24180C04, // 0011 GT R6 R6 R4 + 0x781A0004, // 0012 JMPF R6 #0018 + 0x04180B01, // 0013 SUB R6 R5 K1 + 0x94180006, // 0014 GETIDX R6 R0 R6 + 0x98000A06, // 0015 SETIDX R0 R5 R6 + 0x04140B01, // 0016 SUB R5 R5 K1 + 0x7001FFF4, // 0017 JMP #000D + 0x98000A04, // 0018 SETIDX R0 R5 R4 + 0x7001FFEE, // 0019 JMP #0009 + 0x58080003, // 001A LDCONST R2 K3 + 0xAC080200, // 001B CATCH R2 1 0 + 0xB0080000, // 001C RAISE 2 R0 R0 + 0x58080001, // 001D LDCONST R2 K1 + 0x600C000C, // 001E GETGBL R3 G12 + 0x5C100000, // 001F MOVE R4 R0 + 0x7C0C0200, // 0020 CALL R3 1 + 0x180C0701, // 0021 LE R3 R3 K1 + 0x780E0000, // 0022 JMPF R3 #0024 + 0x80040000, // 0023 RET 1 R0 + 0x940C0102, // 0024 GETIDX R3 R0 K2 + 0x6010000C, // 0025 GETGBL R4 G12 + 0x5C140000, // 0026 MOVE R5 R0 + 0x7C100200, // 0027 CALL R4 1 + 0x14100404, // 0028 LT R4 R2 R4 + 0x78120009, // 0029 JMPF R4 #0034 + 0x94100002, // 002A GETIDX R4 R0 R2 + 0x1C100803, // 002B EQ R4 R4 R3 + 0x78120003, // 002C JMPF R4 #0031 + 0x8C100104, // 002D GETMET R4 R0 K4 + 0x5C180400, // 002E MOVE R6 R2 + 0x7C100400, // 002F CALL R4 2 + 0x70020001, // 0030 JMP #0033 + 0x940C0002, // 0031 GETIDX R3 R0 R2 + 0x00080501, // 0032 ADD R2 R2 K1 + 0x7001FFF0, // 0033 JMP #0025 + 0x80040000, // 0034 RET 1 R0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: is_root_commissioning_open +********************************************************************/ +be_local_closure(Matter_Device_is_root_commissioning_open, /* name */ + be_nested_proto( + 3, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str_weak(commissioning_open), + /* K1 */ be_nested_str_weak(commissioning_admin_fabric), + }), + be_str_weak(is_root_commissioning_open), + &be_const_str_solidified, + ( &(const binstruction[11]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x4C080000, // 0001 LDNIL R2 + 0x20040202, // 0002 NE R1 R1 R2 + 0x78060003, // 0003 JMPF R1 #0008 + 0x88040101, // 0004 GETMBR R1 R0 K1 + 0x4C080000, // 0005 LDNIL R2 + 0x1C040202, // 0006 EQ R1 R1 R2 + 0x74060000, // 0007 JMPT R1 #0009 + 0x50040001, // 0008 LDBOOL R1 0 1 + 0x50040200, // 0009 LDBOOL R1 1 0 + 0x80040200, // 000A RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: register_http_remote +********************************************************************/ +be_local_closure(Matter_Device_register_http_remote, /* name */ + be_nested_proto( + 9, /* nstack */ + 3, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 8]) { /* constants */ + /* K0 */ be_nested_str_weak(http_remotes), + /* K1 */ be_nested_str_weak(contains), + /* K2 */ be_nested_str_weak(get_timeout), + /* K3 */ be_nested_str_weak(set_timeout), + /* K4 */ be_nested_str_weak(matter), + /* K5 */ be_nested_str_weak(HTTP_remote), + /* K6 */ be_nested_str_weak(plugins_config_remotes), + /* K7 */ be_nested_str_weak(set_info), + }), + be_str_weak(register_http_remote), + &be_const_str_solidified, + ( &(const binstruction[42]) { /* code */ + 0x880C0100, // 0000 GETMBR R3 R0 K0 + 0x4C100000, // 0001 LDNIL R4 + 0x1C0C0604, // 0002 EQ R3 R3 R4 + 0x780E0002, // 0003 JMPF R3 #0007 + 0x600C0013, // 0004 GETGBL R3 G19 + 0x7C0C0000, // 0005 CALL R3 0 + 0x90020003, // 0006 SETMBR R0 K0 R3 + 0x4C0C0000, // 0007 LDNIL R3 + 0x88100100, // 0008 GETMBR R4 R0 K0 + 0x8C100901, // 0009 GETMET R4 R4 K1 + 0x5C180200, // 000A MOVE R6 R1 + 0x7C100400, // 000B CALL R4 2 + 0x78120009, // 000C JMPF R4 #0017 + 0x88100100, // 000D GETMBR R4 R0 K0 + 0x940C0801, // 000E GETIDX R3 R4 R1 + 0x8C140702, // 000F GETMET R5 R3 K2 + 0x7C140200, // 0010 CALL R5 1 + 0x14140405, // 0011 LT R5 R2 R5 + 0x78160002, // 0012 JMPF R5 #0016 + 0x8C140703, // 0013 GETMET R5 R3 K3 + 0x5C1C0400, // 0014 MOVE R7 R2 + 0x7C140400, // 0015 CALL R5 2 + 0x70020011, // 0016 JMP #0029 + 0xB8120800, // 0017 GETNGBL R4 K4 + 0x8C100905, // 0018 GETMET R4 R4 K5 + 0x5C180000, // 0019 MOVE R6 R0 + 0x5C1C0200, // 001A MOVE R7 R1 + 0x5C200400, // 001B MOVE R8 R2 + 0x7C100800, // 001C CALL R4 4 + 0x5C0C0800, // 001D MOVE R3 R4 + 0x88100106, // 001E GETMBR R4 R0 K6 + 0x8C100901, // 001F GETMET R4 R4 K1 + 0x5C180200, // 0020 MOVE R6 R1 + 0x7C100400, // 0021 CALL R4 2 + 0x78120003, // 0022 JMPF R4 #0027 + 0x8C100707, // 0023 GETMET R4 R3 K7 + 0x88180106, // 0024 GETMBR R6 R0 K6 + 0x94180C01, // 0025 GETIDX R6 R6 R1 + 0x7C100400, // 0026 CALL R4 2 + 0x88100100, // 0027 GETMBR R4 R0 K0 + 0x98100203, // 0028 SETIDX R4 R1 R3 + 0x80040600, // 0029 RET 1 R3 }) ) ); @@ -551,126 +1746,51 @@ be_local_closure(Matter_Device_bridge_add_endpoint, /* name */ /******************************************************************** -** Solidified function: mdns_remove_op_discovery +** Solidified function: mdns_remove_op_discovery_all_fabrics ********************************************************************/ -be_local_closure(Matter_Device_mdns_remove_op_discovery, /* name */ +be_local_closure(Matter_Device_mdns_remove_op_discovery_all_fabrics, /* name */ be_nested_proto( - 12, /* nstack */ - 2, /* argc */ + 6, /* nstack */ + 1, /* argc */ 2, /* varg */ 0, /* has upvals */ NULL, /* no upvals */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[23]) { /* constants */ - /* K0 */ be_nested_str_weak(mdns), - /* K1 */ be_nested_str_weak(get_device_id), - /* K2 */ be_nested_str_weak(copy), - /* K3 */ be_nested_str_weak(reverse), - /* K4 */ be_nested_str_weak(get_fabric_compressed), - /* K5 */ be_nested_str_weak(tohex), - /* K6 */ be_nested_str_weak(_X2D), - /* K7 */ be_nested_str_weak(tasmota), - /* K8 */ be_nested_str_weak(eth), - /* K9 */ be_nested_str_weak(find), - /* K10 */ be_nested_str_weak(up), - /* K11 */ be_nested_str_weak(log), - /* K12 */ be_nested_str_weak(MTR_X3A_X20remove_X20mDNS_X20on_X20_X25s_X20_X27_X25s_X27), - /* K13 */ be_const_int(3), - /* K14 */ be_nested_str_weak(remove_service), - /* K15 */ be_nested_str_weak(_matter), - /* K16 */ be_nested_str_weak(_tcp), - /* K17 */ be_nested_str_weak(hostname_eth), - /* K18 */ be_nested_str_weak(wifi), - /* K19 */ be_nested_str_weak(hostname_wifi), - /* K20 */ be_nested_str_weak(MTR_X3A_X20Exception), - /* K21 */ be_nested_str_weak(_X7C), - /* K22 */ be_const_int(2), + ( &(const bvalue[ 6]) { /* constants */ + /* K0 */ be_nested_str_weak(sessions), + /* K1 */ be_nested_str_weak(active_fabrics), + /* K2 */ be_nested_str_weak(get_device_id), + /* K3 */ be_nested_str_weak(get_fabric_id), + /* K4 */ be_nested_str_weak(mdns_remove_op_discovery), + /* K5 */ be_nested_str_weak(stop_iteration), }), - be_str_weak(mdns_remove_op_discovery), + be_str_weak(mdns_remove_op_discovery_all_fabrics), &be_const_str_solidified, - ( &(const binstruction[80]) { /* code */ - 0xA40A0000, // 0000 IMPORT R2 K0 - 0xA802003B, // 0001 EXBLK 0 #003E - 0x8C0C0301, // 0002 GETMET R3 R1 K1 - 0x7C0C0200, // 0003 CALL R3 1 - 0x8C0C0702, // 0004 GETMET R3 R3 K2 - 0x7C0C0200, // 0005 CALL R3 1 - 0x8C0C0703, // 0006 GETMET R3 R3 K3 - 0x7C0C0200, // 0007 CALL R3 1 - 0x8C100304, // 0008 GETMET R4 R1 K4 - 0x7C100200, // 0009 CALL R4 1 - 0x8C140905, // 000A GETMET R5 R4 K5 - 0x7C140200, // 000B CALL R5 1 - 0x00140B06, // 000C ADD R5 R5 K6 - 0x8C180705, // 000D GETMET R6 R3 K5 - 0x7C180200, // 000E CALL R6 1 - 0x00140A06, // 000F ADD R5 R5 R6 - 0xB81A0E00, // 0010 GETNGBL R6 K7 - 0x8C180D08, // 0011 GETMET R6 R6 K8 - 0x7C180200, // 0012 CALL R6 1 - 0x8C180D09, // 0013 GETMET R6 R6 K9 - 0x5820000A, // 0014 LDCONST R8 K10 - 0x7C180400, // 0015 CALL R6 2 - 0x781A000E, // 0016 JMPF R6 #0026 - 0xB81A0E00, // 0017 GETNGBL R6 K7 - 0x8C180D0B, // 0018 GETMET R6 R6 K11 - 0x60200018, // 0019 GETGBL R8 G24 - 0x5824000C, // 001A LDCONST R9 K12 - 0x58280008, // 001B LDCONST R10 K8 - 0x5C2C0A00, // 001C MOVE R11 R5 - 0x7C200600, // 001D CALL R8 3 - 0x5824000D, // 001E LDCONST R9 K13 - 0x7C180600, // 001F CALL R6 3 - 0x8C18050E, // 0020 GETMET R6 R2 K14 - 0x5820000F, // 0021 LDCONST R8 K15 - 0x58240010, // 0022 LDCONST R9 K16 - 0x5C280A00, // 0023 MOVE R10 R5 - 0x882C0111, // 0024 GETMBR R11 R0 K17 - 0x7C180A00, // 0025 CALL R6 5 - 0xB81A0E00, // 0026 GETNGBL R6 K7 - 0x8C180D12, // 0027 GETMET R6 R6 K18 - 0x7C180200, // 0028 CALL R6 1 - 0x8C180D09, // 0029 GETMET R6 R6 K9 - 0x5820000A, // 002A LDCONST R8 K10 - 0x7C180400, // 002B CALL R6 2 - 0x781A000E, // 002C JMPF R6 #003C - 0xB81A0E00, // 002D GETNGBL R6 K7 - 0x8C180D0B, // 002E GETMET R6 R6 K11 - 0x60200018, // 002F GETGBL R8 G24 - 0x5824000C, // 0030 LDCONST R9 K12 - 0x58280012, // 0031 LDCONST R10 K18 - 0x5C2C0A00, // 0032 MOVE R11 R5 - 0x7C200600, // 0033 CALL R8 3 - 0x5824000D, // 0034 LDCONST R9 K13 - 0x7C180600, // 0035 CALL R6 3 - 0x8C18050E, // 0036 GETMET R6 R2 K14 - 0x5820000F, // 0037 LDCONST R8 K15 - 0x58240010, // 0038 LDCONST R9 K16 - 0x5C280A00, // 0039 MOVE R10 R5 - 0x882C0113, // 003A GETMBR R11 R0 K19 - 0x7C180A00, // 003B CALL R6 5 - 0xA8040001, // 003C EXBLK 1 1 - 0x70020010, // 003D JMP #004F - 0xAC0C0002, // 003E CATCH R3 0 2 - 0x7002000D, // 003F JMP #004E - 0xB8160E00, // 0040 GETNGBL R5 K7 - 0x8C140B0B, // 0041 GETMET R5 R5 K11 - 0x601C0008, // 0042 GETGBL R7 G8 - 0x5C200600, // 0043 MOVE R8 R3 - 0x7C1C0200, // 0044 CALL R7 1 - 0x001E2807, // 0045 ADD R7 K20 R7 - 0x001C0F15, // 0046 ADD R7 R7 K21 - 0x60200008, // 0047 GETGBL R8 G8 - 0x5C240800, // 0048 MOVE R9 R4 - 0x7C200200, // 0049 CALL R8 1 - 0x001C0E08, // 004A ADD R7 R7 R8 - 0x58200016, // 004B LDCONST R8 K22 - 0x7C140600, // 004C CALL R5 3 - 0x70020000, // 004D JMP #004F - 0xB0080000, // 004E RAISE 2 R0 R0 - 0x80000000, // 004F RET 0 + ( &(const binstruction[22]) { /* code */ + 0x60040010, // 0000 GETGBL R1 G16 + 0x88080100, // 0001 GETMBR R2 R0 K0 + 0x8C080501, // 0002 GETMET R2 R2 K1 + 0x7C080200, // 0003 CALL R2 1 + 0x7C040200, // 0004 CALL R1 1 + 0xA802000B, // 0005 EXBLK 0 #0012 + 0x5C080200, // 0006 MOVE R2 R1 + 0x7C080000, // 0007 CALL R2 0 + 0x8C0C0502, // 0008 GETMET R3 R2 K2 + 0x7C0C0200, // 0009 CALL R3 1 + 0x780E0005, // 000A JMPF R3 #0011 + 0x8C0C0503, // 000B GETMET R3 R2 K3 + 0x7C0C0200, // 000C CALL R3 1 + 0x780E0002, // 000D JMPF R3 #0011 + 0x8C0C0104, // 000E GETMET R3 R0 K4 + 0x5C140400, // 000F MOVE R5 R2 + 0x7C0C0400, // 0010 CALL R3 2 + 0x7001FFF3, // 0011 JMP #0006 + 0x58040005, // 0012 LDCONST R1 K5 + 0xAC040200, // 0013 CATCH R1 1 0 + 0xB0080000, // 0014 RAISE 2 R0 R0 + 0x80000000, // 0015 RET 0 }) ) ); @@ -678,12 +1798,875 @@ be_local_closure(Matter_Device_mdns_remove_op_discovery, /* name */ /******************************************************************** -** Solidified function: get_plugin_remote_info +** Solidified function: load_param ********************************************************************/ -be_local_closure(Matter_Device_get_plugin_remote_info, /* name */ +be_local_closure(Matter_Device_load_param, /* name */ be_nested_proto( - 6, /* nstack */ - 2, /* argc */ + 11, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[35]) { /* constants */ + /* K0 */ be_nested_str_weak(crypto), + /* K1 */ be_nested_str_weak(FILENAME), + /* K2 */ be_nested_str_weak(read), + /* K3 */ be_nested_str_weak(close), + /* K4 */ be_nested_str_weak(json), + /* K5 */ be_nested_str_weak(load), + /* K6 */ be_nested_str_weak(root_discriminator), + /* K7 */ be_nested_str_weak(find), + /* K8 */ be_nested_str_weak(distinguish), + /* K9 */ be_nested_str_weak(root_passcode), + /* K10 */ be_nested_str_weak(passcode), + /* K11 */ be_nested_str_weak(ipv4only), + /* K12 */ be_nested_str_weak(disable_bridge_mode), + /* K13 */ be_nested_str_weak(next_ep), + /* K14 */ be_nested_str_weak(nextep), + /* K15 */ be_nested_str_weak(plugins_config), + /* K16 */ be_nested_str_weak(config), + /* K17 */ be_nested_str_weak(tasmota), + /* K18 */ be_nested_str_weak(log), + /* K19 */ be_nested_str_weak(MTR_X3A_X20load_config_X20_X3D_X20), + /* K20 */ be_const_int(3), + /* K21 */ be_nested_str_weak(adjust_next_ep), + /* K22 */ be_nested_str_weak(plugins_persist), + /* K23 */ be_nested_str_weak(plugins_config_remotes), + /* K24 */ be_nested_str_weak(remotes), + /* K25 */ be_nested_str_weak(MTR_X3A_X20load_remotes_X20_X3D_X20), + /* K26 */ be_nested_str_weak(io_error), + /* K27 */ be_nested_str_weak(MTR_X3A_X20Session_Store_X3A_X3Aload_X20Exception_X3A), + /* K28 */ be_nested_str_weak(_X7C), + /* K29 */ be_const_int(2), + /* K30 */ be_nested_str_weak(random), + /* K31 */ be_nested_str_weak(get), + /* K32 */ be_const_int(0), + /* K33 */ be_nested_str_weak(generate_random_passcode), + /* K34 */ be_nested_str_weak(save_param), + }), + be_str_weak(load_param), + &be_const_str_solidified, + ( &(const binstruction[127]) { /* code */ + 0xA4060000, // 0000 IMPORT R1 K0 + 0xA802004D, // 0001 EXBLK 0 #0050 + 0x60080011, // 0002 GETGBL R2 G17 + 0x880C0101, // 0003 GETMBR R3 R0 K1 + 0x7C080200, // 0004 CALL R2 1 + 0x8C0C0502, // 0005 GETMET R3 R2 K2 + 0x7C0C0200, // 0006 CALL R3 1 + 0x8C100503, // 0007 GETMET R4 R2 K3 + 0x7C100200, // 0008 CALL R4 1 + 0xA4120800, // 0009 IMPORT R4 K4 + 0x8C140905, // 000A GETMET R5 R4 K5 + 0x5C1C0600, // 000B MOVE R7 R3 + 0x7C140400, // 000C CALL R5 2 + 0x8C180B07, // 000D GETMET R6 R5 K7 + 0x58200008, // 000E LDCONST R8 K8 + 0x88240106, // 000F GETMBR R9 R0 K6 + 0x7C180600, // 0010 CALL R6 3 + 0x90020C06, // 0011 SETMBR R0 K6 R6 + 0x8C180B07, // 0012 GETMET R6 R5 K7 + 0x5820000A, // 0013 LDCONST R8 K10 + 0x88240109, // 0014 GETMBR R9 R0 K9 + 0x7C180600, // 0015 CALL R6 3 + 0x90021206, // 0016 SETMBR R0 K9 R6 + 0x60180017, // 0017 GETGBL R6 G23 + 0x8C1C0B07, // 0018 GETMET R7 R5 K7 + 0x5824000B, // 0019 LDCONST R9 K11 + 0x50280000, // 001A LDBOOL R10 0 0 + 0x7C1C0600, // 001B CALL R7 3 + 0x7C180200, // 001C CALL R6 1 + 0x90021606, // 001D SETMBR R0 K11 R6 + 0x60180017, // 001E GETGBL R6 G23 + 0x8C1C0B07, // 001F GETMET R7 R5 K7 + 0x5824000C, // 0020 LDCONST R9 K12 + 0x50280000, // 0021 LDBOOL R10 0 0 + 0x7C1C0600, // 0022 CALL R7 3 + 0x7C180200, // 0023 CALL R6 1 + 0x90021806, // 0024 SETMBR R0 K12 R6 + 0x8C180B07, // 0025 GETMET R6 R5 K7 + 0x5820000E, // 0026 LDCONST R8 K14 + 0x8824010D, // 0027 GETMBR R9 R0 K13 + 0x7C180600, // 0028 CALL R6 3 + 0x90021A06, // 0029 SETMBR R0 K13 R6 + 0x8C180B07, // 002A GETMET R6 R5 K7 + 0x58200010, // 002B LDCONST R8 K16 + 0x7C180400, // 002C CALL R6 2 + 0x90021E06, // 002D SETMBR R0 K15 R6 + 0x8818010F, // 002E GETMBR R6 R0 K15 + 0x4C1C0000, // 002F LDNIL R7 + 0x20180C07, // 0030 NE R6 R6 R7 + 0x781A000B, // 0031 JMPF R6 #003E + 0xB81A2200, // 0032 GETNGBL R6 K17 + 0x8C180D12, // 0033 GETMET R6 R6 K18 + 0x60200008, // 0034 GETGBL R8 G8 + 0x8824010F, // 0035 GETMBR R9 R0 K15 + 0x7C200200, // 0036 CALL R8 1 + 0x00222608, // 0037 ADD R8 K19 R8 + 0x58240014, // 0038 LDCONST R9 K20 + 0x7C180600, // 0039 CALL R6 3 + 0x8C180115, // 003A GETMET R6 R0 K21 + 0x7C180200, // 003B CALL R6 1 + 0x50180200, // 003C LDBOOL R6 1 0 + 0x90022C06, // 003D SETMBR R0 K22 R6 + 0x8C180B07, // 003E GETMET R6 R5 K7 + 0x58200018, // 003F LDCONST R8 K24 + 0x60240013, // 0040 GETGBL R9 G19 + 0x7C240000, // 0041 CALL R9 0 + 0x7C180600, // 0042 CALL R6 3 + 0x90022E06, // 0043 SETMBR R0 K23 R6 + 0x88180117, // 0044 GETMBR R6 R0 K23 + 0x781A0007, // 0045 JMPF R6 #004E + 0xB81A2200, // 0046 GETNGBL R6 K17 + 0x8C180D12, // 0047 GETMET R6 R6 K18 + 0x60200008, // 0048 GETGBL R8 G8 + 0x88240117, // 0049 GETMBR R9 R0 K23 + 0x7C200200, // 004A CALL R8 1 + 0x00223208, // 004B ADD R8 K25 R8 + 0x58240014, // 004C LDCONST R9 K20 + 0x7C180600, // 004D CALL R6 3 + 0xA8040001, // 004E EXBLK 1 1 + 0x70020012, // 004F JMP #0063 + 0xAC080002, // 0050 CATCH R2 0 2 + 0x7002000F, // 0051 JMP #0062 + 0x2010051A, // 0052 NE R4 R2 K26 + 0x7812000C, // 0053 JMPF R4 #0061 + 0xB8122200, // 0054 GETNGBL R4 K17 + 0x8C100912, // 0055 GETMET R4 R4 K18 + 0x60180008, // 0056 GETGBL R6 G8 + 0x5C1C0400, // 0057 MOVE R7 R2 + 0x7C180200, // 0058 CALL R6 1 + 0x001A3606, // 0059 ADD R6 K27 R6 + 0x00180D1C, // 005A ADD R6 R6 K28 + 0x601C0008, // 005B GETGBL R7 G8 + 0x5C200600, // 005C MOVE R8 R3 + 0x7C1C0200, // 005D CALL R7 1 + 0x00180C07, // 005E ADD R6 R6 R7 + 0x581C001D, // 005F LDCONST R7 K29 + 0x7C100600, // 0060 CALL R4 3 + 0x70020000, // 0061 JMP #0063 + 0xB0080000, // 0062 RAISE 2 R0 R0 + 0x50080000, // 0063 LDBOOL R2 0 0 + 0x880C0106, // 0064 GETMBR R3 R0 K6 + 0x4C100000, // 0065 LDNIL R4 + 0x1C0C0604, // 0066 EQ R3 R3 R4 + 0x780E000A, // 0067 JMPF R3 #0073 + 0x8C0C031E, // 0068 GETMET R3 R1 K30 + 0x5814001D, // 0069 LDCONST R5 K29 + 0x7C0C0400, // 006A CALL R3 2 + 0x8C0C071F, // 006B GETMET R3 R3 K31 + 0x58140020, // 006C LDCONST R5 K32 + 0x5818001D, // 006D LDCONST R6 K29 + 0x7C0C0600, // 006E CALL R3 3 + 0x54120FFE, // 006F LDINT R4 4095 + 0x2C0C0604, // 0070 AND R3 R3 R4 + 0x90020C03, // 0071 SETMBR R0 K6 R3 + 0x50080200, // 0072 LDBOOL R2 1 0 + 0x880C0109, // 0073 GETMBR R3 R0 K9 + 0x4C100000, // 0074 LDNIL R4 + 0x1C0C0604, // 0075 EQ R3 R3 R4 + 0x780E0003, // 0076 JMPF R3 #007B + 0x8C0C0121, // 0077 GETMET R3 R0 K33 + 0x7C0C0200, // 0078 CALL R3 1 + 0x90021203, // 0079 SETMBR R0 K9 R3 + 0x50080200, // 007A LDBOOL R2 1 0 + 0x780A0001, // 007B JMPF R2 #007E + 0x8C0C0122, // 007C GETMET R3 R0 K34 + 0x7C0C0200, // 007D CALL R3 1 + 0x80000000, // 007E RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: attribute_updated +********************************************************************/ +be_local_closure(Matter_Device_attribute_updated, /* name */ + be_nested_proto( + 10, /* nstack */ + 5, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 9]) { /* constants */ + /* K0 */ be_nested_str_weak(matter), + /* K1 */ be_nested_str_weak(Path), + /* K2 */ be_nested_str_weak(endpoint), + /* K3 */ be_nested_str_weak(cluster), + /* K4 */ be_nested_str_weak(attribute), + /* K5 */ be_nested_str_weak(message_handler), + /* K6 */ be_nested_str_weak(im), + /* K7 */ be_nested_str_weak(subs_shop), + /* K8 */ be_nested_str_weak(attribute_updated_ctx), + }), + be_str_weak(attribute_updated), + &be_const_str_solidified, + ( &(const binstruction[18]) { /* code */ + 0x4C140000, // 0000 LDNIL R5 + 0x1C140805, // 0001 EQ R5 R4 R5 + 0x78160000, // 0002 JMPF R5 #0004 + 0x50100000, // 0003 LDBOOL R4 0 0 + 0xB8160000, // 0004 GETNGBL R5 K0 + 0x8C140B01, // 0005 GETMET R5 R5 K1 + 0x7C140200, // 0006 CALL R5 1 + 0x90160401, // 0007 SETMBR R5 K2 R1 + 0x90160602, // 0008 SETMBR R5 K3 R2 + 0x90160803, // 0009 SETMBR R5 K4 R3 + 0x88180105, // 000A GETMBR R6 R0 K5 + 0x88180D06, // 000B GETMBR R6 R6 K6 + 0x88180D07, // 000C GETMBR R6 R6 K7 + 0x8C180D08, // 000D GETMET R6 R6 K8 + 0x5C200A00, // 000E MOVE R8 R5 + 0x5C240800, // 000F MOVE R9 R4 + 0x7C180600, // 0010 CALL R6 3 + 0x80000000, // 0011 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: k2l +********************************************************************/ +be_local_closure(Matter_Device_k2l, /* name */ + be_nested_proto( + 8, /* nstack */ + 1, /* argc */ + 4, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 6]) { /* constants */ + /* K0 */ be_const_class(be_class_Matter_Device), + /* K1 */ be_nested_str_weak(keys), + /* K2 */ be_nested_str_weak(push), + /* K3 */ be_nested_str_weak(stop_iteration), + /* K4 */ be_const_int(1), + /* K5 */ be_const_int(0), + }), + be_str_weak(k2l), + &be_const_str_solidified, + ( &(const binstruction[50]) { /* code */ + 0x58040000, // 0000 LDCONST R1 K0 + 0x60080012, // 0001 GETGBL R2 G18 + 0x7C080000, // 0002 CALL R2 0 + 0x4C0C0000, // 0003 LDNIL R3 + 0x1C0C0003, // 0004 EQ R3 R0 R3 + 0x780E0000, // 0005 JMPF R3 #0007 + 0x80040400, // 0006 RET 1 R2 + 0x600C0010, // 0007 GETGBL R3 G16 + 0x8C100101, // 0008 GETMET R4 R0 K1 + 0x7C100200, // 0009 CALL R4 1 + 0x7C0C0200, // 000A CALL R3 1 + 0xA8020005, // 000B EXBLK 0 #0012 + 0x5C100600, // 000C MOVE R4 R3 + 0x7C100000, // 000D CALL R4 0 + 0x8C140502, // 000E GETMET R5 R2 K2 + 0x5C1C0800, // 000F MOVE R7 R4 + 0x7C140400, // 0010 CALL R5 2 + 0x7001FFF9, // 0011 JMP #000C + 0x580C0003, // 0012 LDCONST R3 K3 + 0xAC0C0200, // 0013 CATCH R3 1 0 + 0xB0080000, // 0014 RAISE 2 R0 R0 + 0x600C0010, // 0015 GETGBL R3 G16 + 0x6010000C, // 0016 GETGBL R4 G12 + 0x5C140400, // 0017 MOVE R5 R2 + 0x7C100200, // 0018 CALL R4 1 + 0x04100904, // 0019 SUB R4 R4 K4 + 0x40120804, // 001A CONNECT R4 K4 R4 + 0x7C0C0200, // 001B CALL R3 1 + 0xA8020010, // 001C EXBLK 0 #002E + 0x5C100600, // 001D MOVE R4 R3 + 0x7C100000, // 001E CALL R4 0 + 0x94140404, // 001F GETIDX R5 R2 R4 + 0x5C180800, // 0020 MOVE R6 R4 + 0x241C0D05, // 0021 GT R7 R6 K5 + 0x781E0008, // 0022 JMPF R7 #002C + 0x041C0D04, // 0023 SUB R7 R6 K4 + 0x941C0407, // 0024 GETIDX R7 R2 R7 + 0x241C0E05, // 0025 GT R7 R7 R5 + 0x781E0004, // 0026 JMPF R7 #002C + 0x041C0D04, // 0027 SUB R7 R6 K4 + 0x941C0407, // 0028 GETIDX R7 R2 R7 + 0x98080C07, // 0029 SETIDX R2 R6 R7 + 0x04180D04, // 002A SUB R6 R6 K4 + 0x7001FFF4, // 002B JMP #0021 + 0x98080C05, // 002C SETIDX R2 R6 R5 + 0x7001FFEE, // 002D JMP #001D + 0x580C0003, // 002E LDCONST R3 K3 + 0xAC0C0200, // 002F CATCH R3 1 0 + 0xB0080000, // 0030 RAISE 2 R0 R0 + 0x80040400, // 0031 RET 1 R2 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: _compute_pbkdf +********************************************************************/ +be_local_closure(Matter_Device__compute_pbkdf, /* name */ + be_nested_proto( + 13, /* nstack */ + 4, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[10]) { /* constants */ + /* K0 */ be_nested_str_weak(crypto), + /* K1 */ be_nested_str_weak(add), + /* K2 */ be_nested_str_weak(PBKDF2_HMAC_SHA256), + /* K3 */ be_nested_str_weak(derive), + /* K4 */ be_const_int(0), + /* K5 */ be_nested_str_weak(root_w0), + /* K6 */ be_nested_str_weak(EC_P256), + /* K7 */ be_nested_str_weak(mod), + /* K8 */ be_nested_str_weak(root_L), + /* K9 */ be_nested_str_weak(public_key), + }), + be_str_weak(_compute_pbkdf), + &be_const_str_solidified, + ( &(const binstruction[40]) { /* code */ + 0xA4120000, // 0000 IMPORT R4 K0 + 0x60140015, // 0001 GETGBL R5 G21 + 0x7C140000, // 0002 CALL R5 0 + 0x8C140B01, // 0003 GETMET R5 R5 K1 + 0x5C1C0200, // 0004 MOVE R7 R1 + 0x54220003, // 0005 LDINT R8 4 + 0x7C140600, // 0006 CALL R5 3 + 0x8C180902, // 0007 GETMET R6 R4 K2 + 0x7C180200, // 0008 CALL R6 1 + 0x8C180D03, // 0009 GETMET R6 R6 K3 + 0x5C200A00, // 000A MOVE R8 R5 + 0x5C240600, // 000B MOVE R9 R3 + 0x5C280400, // 000C MOVE R10 R2 + 0x542E004F, // 000D LDINT R11 80 + 0x7C180A00, // 000E CALL R6 5 + 0x541E0026, // 000F LDINT R7 39 + 0x401E0807, // 0010 CONNECT R7 K4 R7 + 0x941C0C07, // 0011 GETIDX R7 R6 R7 + 0x54220027, // 0012 LDINT R8 40 + 0x5426004E, // 0013 LDINT R9 79 + 0x40201009, // 0014 CONNECT R8 R8 R9 + 0x94200C08, // 0015 GETIDX R8 R6 R8 + 0x8C240906, // 0016 GETMET R9 R4 K6 + 0x7C240200, // 0017 CALL R9 1 + 0x8C241307, // 0018 GETMET R9 R9 K7 + 0x5C2C0E00, // 0019 MOVE R11 R7 + 0x7C240400, // 001A CALL R9 2 + 0x90020A09, // 001B SETMBR R0 K5 R9 + 0x8C240906, // 001C GETMET R9 R4 K6 + 0x7C240200, // 001D CALL R9 1 + 0x8C241307, // 001E GETMET R9 R9 K7 + 0x5C2C1000, // 001F MOVE R11 R8 + 0x7C240400, // 0020 CALL R9 2 + 0x8C280906, // 0021 GETMET R10 R4 K6 + 0x7C280200, // 0022 CALL R10 1 + 0x8C281509, // 0023 GETMET R10 R10 K9 + 0x5C301200, // 0024 MOVE R12 R9 + 0x7C280400, // 0025 CALL R10 2 + 0x9002100A, // 0026 SETMBR R0 K8 R10 + 0x80000000, // 0027 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: register_commands +********************************************************************/ +be_local_closure(Matter_Device_register_commands, /* name */ + be_nested_proto( + 5, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 1, /* has sup protos */ + ( &(const struct bproto*[ 3]) { + be_nested_proto( + 10, /* nstack */ + 4, /* argc */ + 0, /* varg */ + 1, /* has upvals */ + ( &(const bupvaldesc[ 1]) { /* upvals */ + be_local_const_upval(1, 0), + }), + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str_weak(MtrJoin), + }), + be_str_weak(_X3Clambda_X3E), + &be_const_str_solidified, + ( &(const binstruction[ 8]) { /* code */ + 0x68100000, // 0000 GETUPV R4 U0 + 0x8C100900, // 0001 GETMET R4 R4 K0 + 0x5C180000, // 0002 MOVE R6 R0 + 0x5C1C0200, // 0003 MOVE R7 R1 + 0x5C200400, // 0004 MOVE R8 R2 + 0x5C240600, // 0005 MOVE R9 R3 + 0x7C100A00, // 0006 CALL R4 5 + 0x80040800, // 0007 RET 1 R4 + }) + ), + be_nested_proto( + 10, /* nstack */ + 4, /* argc */ + 0, /* varg */ + 1, /* has upvals */ + ( &(const bupvaldesc[ 1]) { /* upvals */ + be_local_const_upval(1, 0), + }), + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str_weak(MtrUpdate), + }), + be_str_weak(_X3Clambda_X3E), + &be_const_str_solidified, + ( &(const binstruction[ 8]) { /* code */ + 0x68100000, // 0000 GETUPV R4 U0 + 0x8C100900, // 0001 GETMET R4 R4 K0 + 0x5C180000, // 0002 MOVE R6 R0 + 0x5C1C0200, // 0003 MOVE R7 R1 + 0x5C200400, // 0004 MOVE R8 R2 + 0x5C240600, // 0005 MOVE R9 R3 + 0x7C100A00, // 0006 CALL R4 5 + 0x80040800, // 0007 RET 1 R4 + }) + ), + be_nested_proto( + 10, /* nstack */ + 4, /* argc */ + 0, /* varg */ + 1, /* has upvals */ + ( &(const bupvaldesc[ 1]) { /* upvals */ + be_local_const_upval(1, 0), + }), + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str_weak(MtrInfo), + }), + be_str_weak(_X3Clambda_X3E), + &be_const_str_solidified, + ( &(const binstruction[ 8]) { /* code */ + 0x68100000, // 0000 GETUPV R4 U0 + 0x8C100900, // 0001 GETMET R4 R4 K0 + 0x5C180000, // 0002 MOVE R6 R0 + 0x5C1C0200, // 0003 MOVE R7 R1 + 0x5C200400, // 0004 MOVE R8 R2 + 0x5C240600, // 0005 MOVE R9 R3 + 0x7C100A00, // 0006 CALL R4 5 + 0x80040800, // 0007 RET 1 R4 + }) + ), + }), + 1, /* has constants */ + ( &(const bvalue[ 5]) { /* constants */ + /* K0 */ be_nested_str_weak(tasmota), + /* K1 */ be_nested_str_weak(add_cmd), + /* K2 */ be_nested_str_weak(MtrJoin), + /* K3 */ be_nested_str_weak(MtrUpdate), + /* K4 */ be_nested_str_weak(MtrInfo), + }), + be_str_weak(register_commands), + &be_const_str_solidified, + ( &(const binstruction[17]) { /* code */ + 0xB8060000, // 0000 GETNGBL R1 K0 + 0x8C040301, // 0001 GETMET R1 R1 K1 + 0x580C0002, // 0002 LDCONST R3 K2 + 0x84100000, // 0003 CLOSURE R4 P0 + 0x7C040600, // 0004 CALL R1 3 + 0xB8060000, // 0005 GETNGBL R1 K0 + 0x8C040301, // 0006 GETMET R1 R1 K1 + 0x580C0003, // 0007 LDCONST R3 K3 + 0x84100001, // 0008 CLOSURE R4 P1 + 0x7C040600, // 0009 CALL R1 3 + 0xB8060000, // 000A GETNGBL R1 K0 + 0x8C040301, // 000B GETMET R1 R1 K1 + 0x580C0004, // 000C LDCONST R3 K4 + 0x84100002, // 000D CLOSURE R4 P2 + 0x7C040600, // 000E CALL R1 3 + 0xA0000000, // 000F CLOSE R0 + 0x80000000, // 0010 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: init +********************************************************************/ +be_local_closure(Matter_Device_init, /* name */ + be_nested_proto( + 7, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 1, /* has sup protos */ + ( &(const struct bproto*[ 2]) { + be_nested_proto( + 4, /* nstack */ + 0, /* argc */ + 0, /* varg */ + 1, /* has upvals */ + ( &(const bupvaldesc[ 1]) { /* upvals */ + be_local_const_upval(1, 0), + }), + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 5]) { /* constants */ + /* K0 */ be_nested_str_weak(start), + /* K1 */ be_nested_str_weak(tasmota), + /* K2 */ be_nested_str_weak(remove_rule), + /* K3 */ be_nested_str_weak(Wifi_X23Connected), + /* K4 */ be_nested_str_weak(matter_start), + }), + be_str_weak(_anonymous_), + &be_const_str_solidified, + ( &(const binstruction[ 9]) { /* code */ + 0x68000000, // 0000 GETUPV R0 U0 + 0x8C000100, // 0001 GETMET R0 R0 K0 + 0x7C000200, // 0002 CALL R0 1 + 0xB8020200, // 0003 GETNGBL R0 K1 + 0x8C000102, // 0004 GETMET R0 R0 K2 + 0x58080003, // 0005 LDCONST R2 K3 + 0x580C0004, // 0006 LDCONST R3 K4 + 0x7C000600, // 0007 CALL R0 3 + 0x80000000, // 0008 RET 0 + }) + ), + be_nested_proto( + 4, /* nstack */ + 0, /* argc */ + 0, /* varg */ + 1, /* has upvals */ + ( &(const bupvaldesc[ 1]) { /* upvals */ + be_local_const_upval(1, 0), + }), + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 5]) { /* constants */ + /* K0 */ be_nested_str_weak(start), + /* K1 */ be_nested_str_weak(tasmota), + /* K2 */ be_nested_str_weak(remove_rule), + /* K3 */ be_nested_str_weak(Eth_X23Connected), + /* K4 */ be_nested_str_weak(matter_start), + }), + be_str_weak(_anonymous_), + &be_const_str_solidified, + ( &(const binstruction[ 9]) { /* code */ + 0x68000000, // 0000 GETUPV R0 U0 + 0x8C000100, // 0001 GETMET R0 R0 K0 + 0x7C000200, // 0002 CALL R0 1 + 0xB8020200, // 0003 GETNGBL R0 K1 + 0x8C000102, // 0004 GETMET R0 R0 K2 + 0x58080003, // 0005 LDCONST R2 K3 + 0x580C0004, // 0006 LDCONST R3 K4 + 0x7C000600, // 0007 CALL R0 3 + 0x80000000, // 0008 RET 0 + }) + ), + }), + 1, /* has constants */ + ( &(const bvalue[44]) { /* constants */ + /* K0 */ be_nested_str_weak(crypto), + /* K1 */ be_nested_str_weak(tasmota), + /* K2 */ be_nested_str_weak(get_option), + /* K3 */ be_nested_str_weak(matter), + /* K4 */ be_nested_str_weak(MATTER_OPTION), + /* K5 */ be_nested_str_weak(UI), + /* K6 */ be_nested_str_weak(profiler), + /* K7 */ be_nested_str_weak(Profiler), + /* K8 */ be_nested_str_weak(started), + /* K9 */ be_nested_str_weak(tick), + /* K10 */ be_const_int(0), + /* K11 */ be_nested_str_weak(plugins), + /* K12 */ be_nested_str_weak(plugins_persist), + /* K13 */ be_nested_str_weak(plugins_config_remotes), + /* K14 */ be_nested_str_weak(vendorid), + /* K15 */ be_nested_str_weak(VENDOR_ID), + /* K16 */ be_nested_str_weak(productid), + /* K17 */ be_nested_str_weak(PRODUCT_ID), + /* K18 */ be_nested_str_weak(root_iterations), + /* K19 */ be_nested_str_weak(PBKDF_ITERATIONS), + /* K20 */ be_nested_str_weak(next_ep), + /* K21 */ be_const_int(1), + /* K22 */ be_nested_str_weak(root_salt), + /* K23 */ be_nested_str_weak(random), + /* K24 */ be_nested_str_weak(ipv4only), + /* K25 */ be_nested_str_weak(disable_bridge_mode), + /* K26 */ be_nested_str_weak(load_param), + /* K27 */ be_nested_str_weak(sessions), + /* K28 */ be_nested_str_weak(Session_Store), + /* K29 */ be_nested_str_weak(load_fabrics), + /* K30 */ be_nested_str_weak(message_handler), + /* K31 */ be_nested_str_weak(MessageHandler), + /* K32 */ be_nested_str_weak(ui), + /* K33 */ be_nested_str_weak(wifi), + /* K34 */ be_nested_str_weak(up), + /* K35 */ be_nested_str_weak(eth), + /* K36 */ be_nested_str_weak(start), + /* K37 */ be_nested_str_weak(add_rule), + /* K38 */ be_nested_str_weak(Wifi_X23Connected), + /* K39 */ be_nested_str_weak(matter_start), + /* K40 */ be_nested_str_weak(Eth_X23Connected), + /* K41 */ be_nested_str_weak(_init_basic_commissioning), + /* K42 */ be_nested_str_weak(add_driver), + /* K43 */ be_nested_str_weak(register_commands), + }), + be_str_weak(init), + &be_const_str_solidified, + ( &(const binstruction[107]) { /* code */ + 0xA4060000, // 0000 IMPORT R1 K0 + 0xB80A0200, // 0001 GETNGBL R2 K1 + 0x8C080502, // 0002 GETMET R2 R2 K2 + 0xB8120600, // 0003 GETNGBL R4 K3 + 0x88100904, // 0004 GETMBR R4 R4 K4 + 0x7C080400, // 0005 CALL R2 2 + 0x740A0004, // 0006 JMPT R2 #000C + 0xB80A0600, // 0007 GETNGBL R2 K3 + 0x8C080505, // 0008 GETMET R2 R2 K5 + 0x5C100000, // 0009 MOVE R4 R0 + 0x7C080400, // 000A CALL R2 2 + 0x80000400, // 000B RET 0 + 0xB80A0600, // 000C GETNGBL R2 K3 + 0xB80E0600, // 000D GETNGBL R3 K3 + 0x8C0C0707, // 000E GETMET R3 R3 K7 + 0x7C0C0200, // 000F CALL R3 1 + 0x900A0C03, // 0010 SETMBR R2 K6 R3 + 0x50080000, // 0011 LDBOOL R2 0 0 + 0x90021002, // 0012 SETMBR R0 K8 R2 + 0x9002130A, // 0013 SETMBR R0 K9 K10 + 0x60080012, // 0014 GETGBL R2 G18 + 0x7C080000, // 0015 CALL R2 0 + 0x90021602, // 0016 SETMBR R0 K11 R2 + 0x50080000, // 0017 LDBOOL R2 0 0 + 0x90021802, // 0018 SETMBR R0 K12 R2 + 0x60080013, // 0019 GETGBL R2 G19 + 0x7C080000, // 001A CALL R2 0 + 0x90021A02, // 001B SETMBR R0 K13 R2 + 0x8808010F, // 001C GETMBR R2 R0 K15 + 0x90021C02, // 001D SETMBR R0 K14 R2 + 0x88080111, // 001E GETMBR R2 R0 K17 + 0x90022002, // 001F SETMBR R0 K16 R2 + 0x88080113, // 0020 GETMBR R2 R0 K19 + 0x90022402, // 0021 SETMBR R0 K18 R2 + 0x90022915, // 0022 SETMBR R0 K20 K21 + 0x8C080317, // 0023 GETMET R2 R1 K23 + 0x5412000F, // 0024 LDINT R4 16 + 0x7C080400, // 0025 CALL R2 2 + 0x90022C02, // 0026 SETMBR R0 K22 R2 + 0x50080000, // 0027 LDBOOL R2 0 0 + 0x90023002, // 0028 SETMBR R0 K24 R2 + 0x50080000, // 0029 LDBOOL R2 0 0 + 0x90023202, // 002A SETMBR R0 K25 R2 + 0x8C08011A, // 002B GETMET R2 R0 K26 + 0x7C080200, // 002C CALL R2 1 + 0xB80A0600, // 002D GETNGBL R2 K3 + 0x8C08051C, // 002E GETMET R2 R2 K28 + 0x5C100000, // 002F MOVE R4 R0 + 0x7C080400, // 0030 CALL R2 2 + 0x90023602, // 0031 SETMBR R0 K27 R2 + 0x8808011B, // 0032 GETMBR R2 R0 K27 + 0x8C08051D, // 0033 GETMET R2 R2 K29 + 0x7C080200, // 0034 CALL R2 1 + 0xB80A0600, // 0035 GETNGBL R2 K3 + 0x8C08051F, // 0036 GETMET R2 R2 K31 + 0x5C100000, // 0037 MOVE R4 R0 + 0x7C080400, // 0038 CALL R2 2 + 0x90023C02, // 0039 SETMBR R0 K30 R2 + 0xB80A0600, // 003A GETNGBL R2 K3 + 0x8C080505, // 003B GETMET R2 R2 K5 + 0x5C100000, // 003C MOVE R4 R0 + 0x7C080400, // 003D CALL R2 2 + 0x90024002, // 003E SETMBR R0 K32 R2 + 0xB80A0200, // 003F GETNGBL R2 K1 + 0x8C080521, // 0040 GETMET R2 R2 K33 + 0x7C080200, // 0041 CALL R2 1 + 0x94080522, // 0042 GETIDX R2 R2 K34 + 0x740A0004, // 0043 JMPT R2 #0049 + 0xB80A0200, // 0044 GETNGBL R2 K1 + 0x8C080523, // 0045 GETMET R2 R2 K35 + 0x7C080200, // 0046 CALL R2 1 + 0x94080522, // 0047 GETIDX R2 R2 K34 + 0x780A0001, // 0048 JMPF R2 #004B + 0x8C080124, // 0049 GETMET R2 R0 K36 + 0x7C080200, // 004A CALL R2 1 + 0xB80A0200, // 004B GETNGBL R2 K1 + 0x8C080521, // 004C GETMET R2 R2 K33 + 0x7C080200, // 004D CALL R2 1 + 0x94080522, // 004E GETIDX R2 R2 K34 + 0x740A0005, // 004F JMPT R2 #0056 + 0xB80A0200, // 0050 GETNGBL R2 K1 + 0x8C080525, // 0051 GETMET R2 R2 K37 + 0x58100026, // 0052 LDCONST R4 K38 + 0x84140000, // 0053 CLOSURE R5 P0 + 0x58180027, // 0054 LDCONST R6 K39 + 0x7C080800, // 0055 CALL R2 4 + 0xB80A0200, // 0056 GETNGBL R2 K1 + 0x8C080523, // 0057 GETMET R2 R2 K35 + 0x7C080200, // 0058 CALL R2 1 + 0x94080522, // 0059 GETIDX R2 R2 K34 + 0x740A0005, // 005A JMPT R2 #0061 + 0xB80A0200, // 005B GETNGBL R2 K1 + 0x8C080525, // 005C GETMET R2 R2 K37 + 0x58100028, // 005D LDCONST R4 K40 + 0x84140001, // 005E CLOSURE R5 P1 + 0x58180027, // 005F LDCONST R6 K39 + 0x7C080800, // 0060 CALL R2 4 + 0x8C080129, // 0061 GETMET R2 R0 K41 + 0x7C080200, // 0062 CALL R2 1 + 0xB80A0200, // 0063 GETNGBL R2 K1 + 0x8C08052A, // 0064 GETMET R2 R2 K42 + 0x5C100000, // 0065 MOVE R4 R0 + 0x7C080400, // 0066 CALL R2 2 + 0x8C08012B, // 0067 GETMET R2 R0 K43 + 0x7C080200, // 0068 CALL R2 1 + 0xA0000000, // 0069 CLOSE R0 + 0x80000000, // 006A RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: adjust_next_ep +********************************************************************/ +be_local_closure(Matter_Device_adjust_next_ep, /* name */ + be_nested_proto( + 5, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 5]) { /* constants */ + /* K0 */ be_nested_str_weak(plugins_config), + /* K1 */ be_nested_str_weak(keys), + /* K2 */ be_nested_str_weak(next_ep), + /* K3 */ be_const_int(1), + /* K4 */ be_nested_str_weak(stop_iteration), + }), + be_str_weak(adjust_next_ep), + &be_const_str_solidified, + ( &(const binstruction[21]) { /* code */ + 0x60040010, // 0000 GETGBL R1 G16 + 0x88080100, // 0001 GETMBR R2 R0 K0 + 0x8C080501, // 0002 GETMET R2 R2 K1 + 0x7C080200, // 0003 CALL R2 1 + 0x7C040200, // 0004 CALL R1 1 + 0xA802000A, // 0005 EXBLK 0 #0011 + 0x5C080200, // 0006 MOVE R2 R1 + 0x7C080000, // 0007 CALL R2 0 + 0x600C0009, // 0008 GETGBL R3 G9 + 0x5C100400, // 0009 MOVE R4 R2 + 0x7C0C0200, // 000A CALL R3 1 + 0x88100102, // 000B GETMBR R4 R0 K2 + 0x28100604, // 000C GE R4 R3 R4 + 0x78120001, // 000D JMPF R4 #0010 + 0x00100703, // 000E ADD R4 R3 K3 + 0x90020404, // 000F SETMBR R0 K2 R4 + 0x7001FFF4, // 0010 JMP #0006 + 0x58040004, // 0011 LDCONST R1 K4 + 0xAC040200, // 0012 CATCH R1 1 0 + 0xB0080000, // 0013 RAISE 2 R0 R0 + 0x80000000, // 0014 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: conf_to_log +********************************************************************/ +be_local_closure(Matter_Device_conf_to_log, /* name */ + be_nested_proto( + 9, /* nstack */ + 1, /* argc */ + 4, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 6]) { /* constants */ + /* K0 */ be_const_class(be_class_Matter_Device), + /* K1 */ be_nested_str_weak(), + /* K2 */ be_nested_str_weak(k2l), + /* K3 */ be_nested_str_weak(type), + /* K4 */ be_nested_str_weak(_X20_X25s_X3A_X25s), + /* K5 */ be_nested_str_weak(stop_iteration), + }), + be_str_weak(conf_to_log), + &be_const_str_solidified, + ( &(const binstruction[24]) { /* code */ + 0x58040000, // 0000 LDCONST R1 K0 + 0x58080001, // 0001 LDCONST R2 K1 + 0x600C0010, // 0002 GETGBL R3 G16 + 0x8C100302, // 0003 GETMET R4 R1 K2 + 0x5C180000, // 0004 MOVE R6 R0 + 0x7C100400, // 0005 CALL R4 2 + 0x7C0C0200, // 0006 CALL R3 1 + 0xA802000B, // 0007 EXBLK 0 #0014 + 0x5C100600, // 0008 MOVE R4 R3 + 0x7C100000, // 0009 CALL R4 0 + 0x1C140903, // 000A EQ R5 R4 K3 + 0x78160000, // 000B JMPF R5 #000D + 0x7001FFFA, // 000C JMP #0008 + 0x60140018, // 000D GETGBL R5 G24 + 0x58180004, // 000E LDCONST R6 K4 + 0x5C1C0800, // 000F MOVE R7 R4 + 0x94200004, // 0010 GETIDX R8 R0 R4 + 0x7C140600, // 0011 CALL R5 3 + 0x00080405, // 0012 ADD R2 R2 R5 + 0x7001FFF3, // 0013 JMP #0008 + 0x580C0005, // 0014 LDCONST R3 K5 + 0xAC0C0200, // 0015 CATCH R3 1 0 + 0xB0080000, // 0016 RAISE 2 R0 R0 + 0x80040400, // 0017 RET 1 R2 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: every_50ms +********************************************************************/ +be_local_closure(Matter_Device_every_50ms, /* name */ + be_nested_proto( + 2, /* nstack */ + 1, /* argc */ 2, /* varg */ 0, /* has upvals */ NULL, /* no upvals */ @@ -691,19 +2674,135 @@ be_local_closure(Matter_Device_get_plugin_remote_info, /* name */ NULL, /* no sub protos */ 1, /* has constants */ ( &(const bvalue[ 2]) { /* constants */ - /* K0 */ be_nested_str_weak(plugins_config_remotes), - /* K1 */ be_nested_str_weak(find), + /* K0 */ be_nested_str_weak(tick), + /* K1 */ be_const_int(1), }), - be_str_weak(get_plugin_remote_info), + be_str_weak(every_50ms), &be_const_str_solidified, - ( &(const binstruction[ 7]) { /* code */ + ( &(const binstruction[ 4]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x00040301, // 0001 ADD R1 R1 K1 + 0x90020001, // 0002 SETMBR R0 K0 R1 + 0x80000000, // 0003 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: k2l_num +********************************************************************/ +be_local_closure(Matter_Device_k2l_num, /* name */ + be_nested_proto( + 9, /* nstack */ + 1, /* argc */ + 4, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 6]) { /* constants */ + /* K0 */ be_const_class(be_class_Matter_Device), + /* K1 */ be_nested_str_weak(keys), + /* K2 */ be_nested_str_weak(push), + /* K3 */ be_nested_str_weak(stop_iteration), + /* K4 */ be_const_int(1), + /* K5 */ be_const_int(0), + }), + be_str_weak(k2l_num), + &be_const_str_solidified, + ( &(const binstruction[52]) { /* code */ + 0x58040000, // 0000 LDCONST R1 K0 + 0x60080012, // 0001 GETGBL R2 G18 + 0x7C080000, // 0002 CALL R2 0 + 0x4C0C0000, // 0003 LDNIL R3 + 0x1C0C0003, // 0004 EQ R3 R0 R3 + 0x780E0000, // 0005 JMPF R3 #0007 + 0x80040400, // 0006 RET 1 R2 + 0x600C0010, // 0007 GETGBL R3 G16 + 0x8C100101, // 0008 GETMET R4 R0 K1 + 0x7C100200, // 0009 CALL R4 1 + 0x7C0C0200, // 000A CALL R3 1 + 0xA8020007, // 000B EXBLK 0 #0014 + 0x5C100600, // 000C MOVE R4 R3 + 0x7C100000, // 000D CALL R4 0 + 0x8C140502, // 000E GETMET R5 R2 K2 + 0x601C0009, // 000F GETGBL R7 G9 + 0x5C200800, // 0010 MOVE R8 R4 + 0x7C1C0200, // 0011 CALL R7 1 + 0x7C140400, // 0012 CALL R5 2 + 0x7001FFF7, // 0013 JMP #000C + 0x580C0003, // 0014 LDCONST R3 K3 + 0xAC0C0200, // 0015 CATCH R3 1 0 + 0xB0080000, // 0016 RAISE 2 R0 R0 + 0x600C0010, // 0017 GETGBL R3 G16 + 0x6010000C, // 0018 GETGBL R4 G12 + 0x5C140400, // 0019 MOVE R5 R2 + 0x7C100200, // 001A CALL R4 1 + 0x04100904, // 001B SUB R4 R4 K4 + 0x40120804, // 001C CONNECT R4 K4 R4 + 0x7C0C0200, // 001D CALL R3 1 + 0xA8020010, // 001E EXBLK 0 #0030 + 0x5C100600, // 001F MOVE R4 R3 + 0x7C100000, // 0020 CALL R4 0 + 0x94140404, // 0021 GETIDX R5 R2 R4 + 0x5C180800, // 0022 MOVE R6 R4 + 0x241C0D05, // 0023 GT R7 R6 K5 + 0x781E0008, // 0024 JMPF R7 #002E + 0x041C0D04, // 0025 SUB R7 R6 K4 + 0x941C0407, // 0026 GETIDX R7 R2 R7 + 0x241C0E05, // 0027 GT R7 R7 R5 + 0x781E0004, // 0028 JMPF R7 #002E + 0x041C0D04, // 0029 SUB R7 R6 K4 + 0x941C0407, // 002A GETIDX R7 R2 R7 + 0x98080C07, // 002B SETIDX R2 R6 R7 + 0x04180D04, // 002C SUB R6 R6 K4 + 0x7001FFF4, // 002D JMP #0023 + 0x98080C05, // 002E SETIDX R2 R6 R5 + 0x7001FFEE, // 002F JMP #001F + 0x580C0003, // 0030 LDCONST R3 K3 + 0xAC0C0200, // 0031 CATCH R3 1 0 + 0xB0080000, // 0032 RAISE 2 R0 R0 + 0x80040400, // 0033 RET 1 R2 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: get_plugin_class_arg +********************************************************************/ +be_local_closure(Matter_Device_get_plugin_class_arg, /* name */ + be_nested_proto( + 5, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 4]) { /* constants */ + /* K0 */ be_nested_str_weak(plugins_classes), + /* K1 */ be_nested_str_weak(find), + /* K2 */ be_nested_str_weak(ARG), + /* K3 */ be_nested_str_weak(), + }), + be_str_weak(get_plugin_class_arg), + &be_const_str_solidified, + ( &(const binstruction[ 9]) { /* code */ 0x88080100, // 0000 GETMBR R2 R0 K0 0x8C080501, // 0001 GETMET R2 R2 K1 0x5C100200, // 0002 MOVE R4 R1 - 0x60140013, // 0003 GETGBL R5 G19 - 0x7C140000, // 0004 CALL R5 0 - 0x7C080600, // 0005 CALL R2 3 - 0x80040400, // 0006 RET 1 R2 + 0x7C080400, // 0003 CALL R2 2 + 0x780A0001, // 0004 JMPF R2 #0007 + 0x880C0502, // 0005 GETMBR R3 R2 K2 + 0x70020000, // 0006 JMP #0008 + 0x580C0003, // 0007 LDCONST R3 K3 + 0x80040600, // 0008 RET 1 R3 }) ) ); @@ -968,129 +3067,6 @@ be_local_closure(Matter_Device_autoconf_device_map, /* name */ /*******************************************************************/ -/******************************************************************** -** Solidified function: clean_remotes -********************************************************************/ -be_local_closure(Matter_Device_clean_remotes, /* name */ - be_nested_proto( - 10, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[18]) { /* constants */ - /* K0 */ be_nested_str_weak(introspect), - /* K1 */ be_nested_str_weak(http_remotes), - /* K2 */ be_const_int(0), - /* K3 */ be_nested_str_weak(stop_iteration), - /* K4 */ be_nested_str_weak(plugins), - /* K5 */ be_nested_str_weak(get), - /* K6 */ be_nested_str_weak(http_remote), - /* K7 */ be_nested_str_weak(find), - /* K8 */ be_const_int(1), - /* K9 */ be_nested_str_weak(keys), - /* K10 */ be_nested_str_weak(push), - /* K11 */ be_nested_str_weak(tasmota), - /* K12 */ be_nested_str_weak(log), - /* K13 */ be_nested_str_weak(MTR_X3A_X20remove_X20unused_X20remote_X3A_X20), - /* K14 */ be_nested_str_weak(addr), - /* K15 */ be_const_int(3), - /* K16 */ be_nested_str_weak(close), - /* K17 */ be_nested_str_weak(remove), - }), - be_str_weak(clean_remotes), - &be_const_str_solidified, - ( &(const binstruction[81]) { /* code */ - 0xA4060000, // 0000 IMPORT R1 K0 - 0x88080101, // 0001 GETMBR R2 R0 K1 - 0x780A004C, // 0002 JMPF R2 #0050 - 0x60080013, // 0003 GETGBL R2 G19 - 0x7C080000, // 0004 CALL R2 0 - 0x600C0010, // 0005 GETGBL R3 G16 - 0x88100101, // 0006 GETMBR R4 R0 K1 - 0x7C0C0200, // 0007 CALL R3 1 - 0xA8020003, // 0008 EXBLK 0 #000D - 0x5C100600, // 0009 MOVE R4 R3 - 0x7C100000, // 000A CALL R4 0 - 0x98080902, // 000B SETIDX R2 R4 K2 - 0x7001FFFB, // 000C JMP #0009 - 0x580C0003, // 000D LDCONST R3 K3 - 0xAC0C0200, // 000E CATCH R3 1 0 - 0xB0080000, // 000F RAISE 2 R0 R0 - 0x600C0010, // 0010 GETGBL R3 G16 - 0x88100104, // 0011 GETMBR R4 R0 K4 - 0x7C0C0200, // 0012 CALL R3 1 - 0xA802000F, // 0013 EXBLK 0 #0024 - 0x5C100600, // 0014 MOVE R4 R3 - 0x7C100000, // 0015 CALL R4 0 - 0x8C140305, // 0016 GETMET R5 R1 K5 - 0x5C1C0800, // 0017 MOVE R7 R4 - 0x58200006, // 0018 LDCONST R8 K6 - 0x7C140600, // 0019 CALL R5 3 - 0x4C180000, // 001A LDNIL R6 - 0x20180A06, // 001B NE R6 R5 R6 - 0x781A0005, // 001C JMPF R6 #0023 - 0x8C180507, // 001D GETMET R6 R2 K7 - 0x5C200A00, // 001E MOVE R8 R5 - 0x58240002, // 001F LDCONST R9 K2 - 0x7C180600, // 0020 CALL R6 3 - 0x00180D08, // 0021 ADD R6 R6 K8 - 0x98080A06, // 0022 SETIDX R2 R5 R6 - 0x7001FFEF, // 0023 JMP #0014 - 0x580C0003, // 0024 LDCONST R3 K3 - 0xAC0C0200, // 0025 CATCH R3 1 0 - 0xB0080000, // 0026 RAISE 2 R0 R0 - 0x600C0012, // 0027 GETGBL R3 G18 - 0x7C0C0000, // 0028 CALL R3 0 - 0x60100010, // 0029 GETGBL R4 G16 - 0x8C140509, // 002A GETMET R5 R2 K9 - 0x7C140200, // 002B CALL R5 1 - 0x7C100200, // 002C CALL R4 1 - 0xA8020008, // 002D EXBLK 0 #0037 - 0x5C140800, // 002E MOVE R5 R4 - 0x7C140000, // 002F CALL R5 0 - 0x94180405, // 0030 GETIDX R6 R2 R5 - 0x1C180D02, // 0031 EQ R6 R6 K2 - 0x781A0002, // 0032 JMPF R6 #0036 - 0x8C18070A, // 0033 GETMET R6 R3 K10 - 0x5C200A00, // 0034 MOVE R8 R5 - 0x7C180400, // 0035 CALL R6 2 - 0x7001FFF6, // 0036 JMP #002E - 0x58100003, // 0037 LDCONST R4 K3 - 0xAC100200, // 0038 CATCH R4 1 0 - 0xB0080000, // 0039 RAISE 2 R0 R0 - 0x60100010, // 003A GETGBL R4 G16 - 0x5C140600, // 003B MOVE R5 R3 - 0x7C100200, // 003C CALL R4 1 - 0xA802000E, // 003D EXBLK 0 #004D - 0x5C140800, // 003E MOVE R5 R4 - 0x7C140000, // 003F CALL R5 0 - 0xB81A1600, // 0040 GETNGBL R6 K11 - 0x8C180D0C, // 0041 GETMET R6 R6 K12 - 0x88200B0E, // 0042 GETMBR R8 R5 K14 - 0x00221A08, // 0043 ADD R8 K13 R8 - 0x5824000F, // 0044 LDCONST R9 K15 - 0x7C180600, // 0045 CALL R6 3 - 0x8C180B10, // 0046 GETMET R6 R5 K16 - 0x7C180200, // 0047 CALL R6 1 - 0x88180101, // 0048 GETMBR R6 R0 K1 - 0x8C180D11, // 0049 GETMET R6 R6 K17 - 0x88200B0E, // 004A GETMBR R8 R5 K14 - 0x7C180400, // 004B CALL R6 2 - 0x7001FFF0, // 004C JMP #003E - 0x58100003, // 004D LDCONST R4 K3 - 0xAC100200, // 004E CATCH R4 1 0 - 0xB0080000, // 004F RAISE 2 R0 R0 - 0x80000000, // 0050 RET 0 - }) - ) -); -/*******************************************************************/ - - /******************************************************************** ** Solidified function: remove_fabric ********************************************************************/ @@ -1165,9 +3141,47 @@ be_local_closure(Matter_Device_remove_fabric, /* name */ /******************************************************************** -** Solidified function: _mdns_announce_hostname +** Solidified function: stop ********************************************************************/ -be_local_closure(Matter_Device__mdns_announce_hostname, /* name */ +be_local_closure(Matter_Device_stop, /* name */ + be_nested_proto( + 4, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 4]) { /* constants */ + /* K0 */ be_nested_str_weak(tasmota), + /* K1 */ be_nested_str_weak(remove_driver), + /* K2 */ be_nested_str_weak(udp_server), + /* K3 */ be_nested_str_weak(stop), + }), + be_str_weak(stop), + &be_const_str_solidified, + ( &(const binstruction[10]) { /* code */ + 0xB8060000, // 0000 GETNGBL R1 K0 + 0x8C040301, // 0001 GETMET R1 R1 K1 + 0x5C0C0000, // 0002 MOVE R3 R0 + 0x7C040400, // 0003 CALL R1 2 + 0x88040102, // 0004 GETMBR R1 R0 K2 + 0x78060002, // 0005 JMPF R1 #0009 + 0x88040102, // 0006 GETMBR R1 R0 K2 + 0x8C040303, // 0007 GETMET R1 R1 K3 + 0x7C040200, // 0008 CALL R1 1 + 0x80000000, // 0009 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: mdns_announce_op_discovery +********************************************************************/ +be_local_closure(Matter_Device_mdns_announce_op_discovery, /* name */ be_nested_proto( 14, /* nstack */ 2, /* argc */ @@ -1179,1168 +3193,157 @@ be_local_closure(Matter_Device__mdns_announce_hostname, /* name */ 1, /* has constants */ ( &(const bvalue[27]) { /* constants */ /* K0 */ be_nested_str_weak(mdns), - /* K1 */ be_nested_str_weak(string), - /* K2 */ be_nested_str_weak(start), - /* K3 */ be_nested_str_weak(tasmota), - /* K4 */ be_nested_str_weak(eth), - /* K5 */ be_nested_str_weak(hostname_eth), - /* K6 */ be_nested_str_weak(replace), - /* K7 */ be_nested_str_weak(find), - /* K8 */ be_nested_str_weak(mac), - /* K9 */ be_nested_str_weak(_X3A), - /* K10 */ be_nested_str_weak(), - /* K11 */ be_nested_str_weak(ipv4only), - /* K12 */ be_nested_str_weak(contains), - /* K13 */ be_nested_str_weak(ip6local), - /* K14 */ be_nested_str_weak(add_hostname), - /* K15 */ be_nested_str_weak(ip), - /* K16 */ be_nested_str_weak(ip6), - /* K17 */ be_nested_str_weak(log), - /* K18 */ be_nested_str_weak(MTR_X3A_X20calling_X20mdns_X2Eadd_hostname_X28_X25s_X2C_X20_X25s_X29), - /* K19 */ be_const_int(3), - /* K20 */ be_nested_str_weak(wifi), - /* K21 */ be_nested_str_weak(hostname_wifi), - /* K22 */ be_nested_str_weak(MTR_X3A_X20start_X20mDNS_X20on_X20_X25s_X20host_X20_X27_X25s_X2Elocal_X27), - /* K23 */ be_nested_str_weak(MTR_X3A_X20Exception), - /* K24 */ be_nested_str_weak(_X7C), - /* K25 */ be_const_int(2), - /* K26 */ be_nested_str_weak(mdns_announce_op_discovery_all_fabrics), - }), - be_str_weak(_mdns_announce_hostname), - &be_const_str_solidified, - ( &(const binstruction[148]) { /* code */ - 0xA40A0000, // 0000 IMPORT R2 K0 - 0xA40E0200, // 0001 IMPORT R3 K1 - 0x8C100502, // 0002 GETMET R4 R2 K2 - 0x7C100200, // 0003 CALL R4 1 - 0xA802007A, // 0004 EXBLK 0 #0080 - 0x78060034, // 0005 JMPF R1 #003B - 0xB8120600, // 0006 GETNGBL R4 K3 - 0x8C100904, // 0007 GETMET R4 R4 K4 - 0x7C100200, // 0008 CALL R4 1 - 0x8C140706, // 0009 GETMET R5 R3 K6 - 0x8C1C0907, // 000A GETMET R7 R4 K7 - 0x58240008, // 000B LDCONST R9 K8 - 0x7C1C0400, // 000C CALL R7 2 - 0x58200009, // 000D LDCONST R8 K9 - 0x5824000A, // 000E LDCONST R9 K10 - 0x7C140800, // 000F CALL R5 4 - 0x90020A05, // 0010 SETMBR R0 K5 R5 - 0x8814010B, // 0011 GETMBR R5 R0 K11 - 0x78160003, // 0012 JMPF R5 #0017 - 0x8C14090C, // 0013 GETMET R5 R4 K12 - 0x581C000D, // 0014 LDCONST R7 K13 - 0x7C140400, // 0015 CALL R5 2 - 0x7416000F, // 0016 JMPT R5 #0027 - 0x8C14050E, // 0017 GETMET R5 R2 K14 - 0x881C0105, // 0018 GETMBR R7 R0 K5 - 0x8C200907, // 0019 GETMET R8 R4 K7 - 0x5828000D, // 001A LDCONST R10 K13 - 0x582C000A, // 001B LDCONST R11 K10 - 0x7C200600, // 001C CALL R8 3 - 0x8C240907, // 001D GETMET R9 R4 K7 - 0x582C000F, // 001E LDCONST R11 K15 - 0x5830000A, // 001F LDCONST R12 K10 - 0x7C240600, // 0020 CALL R9 3 - 0x8C280907, // 0021 GETMET R10 R4 K7 - 0x58300010, // 0022 LDCONST R12 K16 - 0x5834000A, // 0023 LDCONST R13 K10 - 0x7C280600, // 0024 CALL R10 3 - 0x7C140A00, // 0025 CALL R5 5 - 0x70020012, // 0026 JMP #003A - 0xB8160600, // 0027 GETNGBL R5 K3 - 0x8C140B11, // 0028 GETMET R5 R5 K17 - 0x601C0018, // 0029 GETGBL R7 G24 - 0x58200012, // 002A LDCONST R8 K18 - 0x88240105, // 002B GETMBR R9 R0 K5 - 0x8C280907, // 002C GETMET R10 R4 K7 - 0x5830000F, // 002D LDCONST R12 K15 - 0x5834000A, // 002E LDCONST R13 K10 - 0x7C280600, // 002F CALL R10 3 - 0x7C1C0600, // 0030 CALL R7 3 - 0x58200013, // 0031 LDCONST R8 K19 - 0x7C140600, // 0032 CALL R5 3 - 0x8C14050E, // 0033 GETMET R5 R2 K14 - 0x881C0105, // 0034 GETMBR R7 R0 K5 - 0x8C200907, // 0035 GETMET R8 R4 K7 - 0x5828000F, // 0036 LDCONST R10 K15 - 0x582C000A, // 0037 LDCONST R11 K10 - 0x7C200600, // 0038 CALL R8 3 - 0x7C140600, // 0039 CALL R5 3 - 0x70020033, // 003A JMP #006F - 0xB8120600, // 003B GETNGBL R4 K3 - 0x8C100914, // 003C GETMET R4 R4 K20 - 0x7C100200, // 003D CALL R4 1 - 0x8C140706, // 003E GETMET R5 R3 K6 - 0x8C1C0907, // 003F GETMET R7 R4 K7 - 0x58240008, // 0040 LDCONST R9 K8 - 0x7C1C0400, // 0041 CALL R7 2 - 0x58200009, // 0042 LDCONST R8 K9 - 0x5824000A, // 0043 LDCONST R9 K10 - 0x7C140800, // 0044 CALL R5 4 - 0x90022A05, // 0045 SETMBR R0 K21 R5 - 0x8814010B, // 0046 GETMBR R5 R0 K11 - 0x78160003, // 0047 JMPF R5 #004C - 0x8C14090C, // 0048 GETMET R5 R4 K12 - 0x581C000D, // 0049 LDCONST R7 K13 - 0x7C140400, // 004A CALL R5 2 - 0x7416000F, // 004B JMPT R5 #005C - 0x8C14050E, // 004C GETMET R5 R2 K14 - 0x881C0115, // 004D GETMBR R7 R0 K21 - 0x8C200907, // 004E GETMET R8 R4 K7 - 0x5828000D, // 004F LDCONST R10 K13 - 0x582C000A, // 0050 LDCONST R11 K10 - 0x7C200600, // 0051 CALL R8 3 - 0x8C240907, // 0052 GETMET R9 R4 K7 - 0x582C000F, // 0053 LDCONST R11 K15 - 0x5830000A, // 0054 LDCONST R12 K10 - 0x7C240600, // 0055 CALL R9 3 - 0x8C280907, // 0056 GETMET R10 R4 K7 - 0x58300010, // 0057 LDCONST R12 K16 - 0x5834000A, // 0058 LDCONST R13 K10 - 0x7C280600, // 0059 CALL R10 3 - 0x7C140A00, // 005A CALL R5 5 - 0x70020012, // 005B JMP #006F - 0xB8160600, // 005C GETNGBL R5 K3 - 0x8C140B11, // 005D GETMET R5 R5 K17 - 0x601C0018, // 005E GETGBL R7 G24 - 0x58200012, // 005F LDCONST R8 K18 - 0x88240115, // 0060 GETMBR R9 R0 K21 - 0x8C280907, // 0061 GETMET R10 R4 K7 - 0x5830000F, // 0062 LDCONST R12 K15 - 0x5834000A, // 0063 LDCONST R13 K10 - 0x7C280600, // 0064 CALL R10 3 - 0x7C1C0600, // 0065 CALL R7 3 - 0x58200013, // 0066 LDCONST R8 K19 - 0x7C140600, // 0067 CALL R5 3 - 0x8C14050E, // 0068 GETMET R5 R2 K14 - 0x881C0115, // 0069 GETMBR R7 R0 K21 - 0x8C200907, // 006A GETMET R8 R4 K7 - 0x5828000F, // 006B LDCONST R10 K15 - 0x582C000A, // 006C LDCONST R11 K10 - 0x7C200600, // 006D CALL R8 3 - 0x7C140600, // 006E CALL R5 3 - 0xB8120600, // 006F GETNGBL R4 K3 - 0x8C100911, // 0070 GETMET R4 R4 K17 - 0x60180018, // 0071 GETGBL R6 G24 - 0x581C0016, // 0072 LDCONST R7 K22 - 0x78060001, // 0073 JMPF R1 #0076 - 0x58200004, // 0074 LDCONST R8 K4 - 0x70020000, // 0075 JMP #0077 - 0x58200014, // 0076 LDCONST R8 K20 - 0x78060001, // 0077 JMPF R1 #007A - 0x88240105, // 0078 GETMBR R9 R0 K5 - 0x70020000, // 0079 JMP #007B - 0x88240115, // 007A GETMBR R9 R0 K21 - 0x7C180600, // 007B CALL R6 3 - 0x581C0013, // 007C LDCONST R7 K19 - 0x7C100600, // 007D CALL R4 3 - 0xA8040001, // 007E EXBLK 1 1 - 0x70020010, // 007F JMP #0091 - 0xAC100002, // 0080 CATCH R4 0 2 - 0x7002000D, // 0081 JMP #0090 - 0xB81A0600, // 0082 GETNGBL R6 K3 - 0x8C180D11, // 0083 GETMET R6 R6 K17 - 0x60200008, // 0084 GETGBL R8 G8 - 0x5C240800, // 0085 MOVE R9 R4 - 0x7C200200, // 0086 CALL R8 1 - 0x00222E08, // 0087 ADD R8 K23 R8 - 0x00201118, // 0088 ADD R8 R8 K24 - 0x60240008, // 0089 GETGBL R9 G8 - 0x5C280A00, // 008A MOVE R10 R5 - 0x7C240200, // 008B CALL R9 1 - 0x00201009, // 008C ADD R8 R8 R9 - 0x58240019, // 008D LDCONST R9 K25 - 0x7C180600, // 008E CALL R6 3 - 0x70020000, // 008F JMP #0091 - 0xB0080000, // 0090 RAISE 2 R0 R0 - 0x8C10011A, // 0091 GETMET R4 R0 K26 - 0x7C100200, // 0092 CALL R4 1 - 0x80000000, // 0093 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: register_native_classes -********************************************************************/ -be_local_closure(Matter_Device_register_native_classes, /* name */ - be_nested_proto( - 12, /* nstack */ - 3, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[11]) { /* constants */ - /* K0 */ be_nested_str_weak(introspect), - /* K1 */ be_nested_str_weak(string), - /* K2 */ be_nested_str_weak(members), - /* K3 */ be_nested_str_weak(matter), - /* K4 */ be_nested_str_weak(get), - /* K5 */ be_nested_str_weak(class), - /* K6 */ be_nested_str_weak(find), - /* K7 */ be_nested_str_weak(Plugin_), - /* K8 */ be_const_int(0), - /* K9 */ be_nested_str_weak(register_plugin_class), - /* K10 */ be_nested_str_weak(stop_iteration), - }), - be_str_weak(register_native_classes), - &be_const_str_solidified, - ( &(const binstruction[33]) { /* code */ - 0xA40E0000, // 0000 IMPORT R3 K0 - 0xA4120200, // 0001 IMPORT R4 K1 - 0x60140010, // 0002 GETGBL R5 G16 - 0x8C180702, // 0003 GETMET R6 R3 K2 - 0xB8220600, // 0004 GETNGBL R8 K3 - 0x7C180400, // 0005 CALL R6 2 - 0x7C140200, // 0006 CALL R5 1 - 0xA8020014, // 0007 EXBLK 0 #001D - 0x5C180A00, // 0008 MOVE R6 R5 - 0x7C180000, // 0009 CALL R6 0 - 0x8C1C0704, // 000A GETMET R7 R3 K4 - 0xB8260600, // 000B GETNGBL R9 K3 - 0x5C280C00, // 000C MOVE R10 R6 - 0x7C1C0600, // 000D CALL R7 3 - 0x60200004, // 000E GETGBL R8 G4 - 0x5C240E00, // 000F MOVE R9 R7 - 0x7C200200, // 0010 CALL R8 1 - 0x1C201105, // 0011 EQ R8 R8 K5 - 0x78220008, // 0012 JMPF R8 #001C - 0x8C200906, // 0013 GETMET R8 R4 K6 - 0x5C280C00, // 0014 MOVE R10 R6 - 0x582C0007, // 0015 LDCONST R11 K7 - 0x7C200600, // 0016 CALL R8 3 - 0x1C201108, // 0017 EQ R8 R8 K8 - 0x78220002, // 0018 JMPF R8 #001C - 0x8C200109, // 0019 GETMET R8 R0 K9 - 0x5C280E00, // 001A MOVE R10 R7 - 0x7C200400, // 001B CALL R8 2 - 0x7001FFEA, // 001C JMP #0008 - 0x5814000A, // 001D LDCONST R5 K10 - 0xAC140200, // 001E CATCH R5 1 0 - 0xB0080000, // 001F RAISE 2 R0 R0 - 0x80000000, // 0020 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: mdns_remove_op_discovery_all_fabrics -********************************************************************/ -be_local_closure(Matter_Device_mdns_remove_op_discovery_all_fabrics, /* name */ - be_nested_proto( - 6, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 6]) { /* constants */ - /* K0 */ be_nested_str_weak(sessions), - /* K1 */ be_nested_str_weak(active_fabrics), - /* K2 */ be_nested_str_weak(get_device_id), - /* K3 */ be_nested_str_weak(get_fabric_id), - /* K4 */ be_nested_str_weak(mdns_remove_op_discovery), - /* K5 */ be_nested_str_weak(stop_iteration), - }), - be_str_weak(mdns_remove_op_discovery_all_fabrics), - &be_const_str_solidified, - ( &(const binstruction[22]) { /* code */ - 0x60040010, // 0000 GETGBL R1 G16 - 0x88080100, // 0001 GETMBR R2 R0 K0 - 0x8C080501, // 0002 GETMET R2 R2 K1 - 0x7C080200, // 0003 CALL R2 1 - 0x7C040200, // 0004 CALL R1 1 - 0xA802000B, // 0005 EXBLK 0 #0012 - 0x5C080200, // 0006 MOVE R2 R1 - 0x7C080000, // 0007 CALL R2 0 - 0x8C0C0502, // 0008 GETMET R3 R2 K2 - 0x7C0C0200, // 0009 CALL R3 1 - 0x780E0005, // 000A JMPF R3 #0011 - 0x8C0C0503, // 000B GETMET R3 R2 K3 - 0x7C0C0200, // 000C CALL R3 1 - 0x780E0002, // 000D JMPF R3 #0011 - 0x8C0C0104, // 000E GETMET R3 R0 K4 - 0x5C140400, // 000F MOVE R5 R2 - 0x7C0C0400, // 0010 CALL R3 2 - 0x7001FFF3, // 0011 JMP #0006 - 0x58040005, // 0012 LDCONST R1 K5 - 0xAC040200, // 0013 CATCH R1 1 0 - 0xB0080000, // 0014 RAISE 2 R0 R0 - 0x80000000, // 0015 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: is_root_commissioning_open -********************************************************************/ -be_local_closure(Matter_Device_is_root_commissioning_open, /* name */ - be_nested_proto( - 3, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 2]) { /* constants */ - /* K0 */ be_nested_str_weak(commissioning_open), - /* K1 */ be_nested_str_weak(commissioning_admin_fabric), - }), - be_str_weak(is_root_commissioning_open), - &be_const_str_solidified, - ( &(const binstruction[11]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x4C080000, // 0001 LDNIL R2 - 0x20040202, // 0002 NE R1 R1 R2 - 0x78060003, // 0003 JMPF R1 #0008 - 0x88040101, // 0004 GETMBR R1 R0 K1 - 0x4C080000, // 0005 LDNIL R2 - 0x1C040202, // 0006 EQ R1 R1 R2 - 0x74060000, // 0007 JMPT R1 #0009 - 0x50040001, // 0008 LDBOOL R1 0 1 - 0x50040200, // 0009 LDBOOL R1 1 0 - 0x80040200, // 000A RET 1 R1 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: msg_send -********************************************************************/ -be_local_closure(Matter_Device_msg_send, /* name */ - be_nested_proto( - 5, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 2]) { /* constants */ - /* K0 */ be_nested_str_weak(udp_server), - /* K1 */ be_nested_str_weak(send_UDP), - }), - be_str_weak(msg_send), - &be_const_str_solidified, - ( &(const binstruction[ 5]) { /* code */ - 0x88080100, // 0000 GETMBR R2 R0 K0 - 0x8C080501, // 0001 GETMET R2 R2 K1 - 0x5C100200, // 0002 MOVE R4 R1 - 0x7C080400, // 0003 CALL R2 2 - 0x80040400, // 0004 RET 1 R2 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: process_attribute_read_solo -********************************************************************/ -be_local_closure(Matter_Device_process_attribute_read_solo, /* name */ - be_nested_proto( - 10, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[11]) { /* constants */ - /* K0 */ be_nested_str_weak(endpoint), - /* K1 */ be_nested_str_weak(cluster), - /* K2 */ be_nested_str_weak(attribute), - /* K3 */ be_nested_str_weak(find_plugin_by_endpoint), - /* K4 */ be_nested_str_weak(status), - /* K5 */ be_nested_str_weak(matter), - /* K6 */ be_nested_str_weak(UNSUPPORTED_ENDPOINT), - /* K7 */ be_nested_str_weak(contains_cluster), - /* K8 */ be_nested_str_weak(UNSUPPORTED_CLUSTER), - /* K9 */ be_nested_str_weak(contains_attribute), - /* K10 */ be_nested_str_weak(UNSUPPORTED_ATTRIBUTE), - }), - be_str_weak(process_attribute_read_solo), - &be_const_str_solidified, - ( &(const binstruction[45]) { /* code */ - 0x88080300, // 0000 GETMBR R2 R1 K0 - 0x880C0301, // 0001 GETMBR R3 R1 K1 - 0x88100302, // 0002 GETMBR R4 R1 K2 - 0x4C140000, // 0003 LDNIL R5 - 0x1C140405, // 0004 EQ R5 R2 R5 - 0x74160005, // 0005 JMPT R5 #000C - 0x4C140000, // 0006 LDNIL R5 - 0x1C140605, // 0007 EQ R5 R3 R5 - 0x74160002, // 0008 JMPT R5 #000C - 0x4C140000, // 0009 LDNIL R5 - 0x1C140805, // 000A EQ R5 R4 R5 - 0x78160001, // 000B JMPF R5 #000E - 0x4C140000, // 000C LDNIL R5 - 0x80040A00, // 000D RET 1 R5 - 0x8C140103, // 000E GETMET R5 R0 K3 - 0x5C1C0400, // 000F MOVE R7 R2 - 0x7C140400, // 0010 CALL R5 2 - 0x4C180000, // 0011 LDNIL R6 - 0x1C180A06, // 0012 EQ R6 R5 R6 - 0x781A0004, // 0013 JMPF R6 #0019 - 0xB81A0A00, // 0014 GETNGBL R6 K5 - 0x88180D06, // 0015 GETMBR R6 R6 K6 - 0x90060806, // 0016 SETMBR R1 K4 R6 - 0x4C180000, // 0017 LDNIL R6 - 0x80040C00, // 0018 RET 1 R6 - 0x8C180B07, // 0019 GETMET R6 R5 K7 - 0x5C200600, // 001A MOVE R8 R3 - 0x7C180400, // 001B CALL R6 2 - 0x741A0004, // 001C JMPT R6 #0022 - 0xB81A0A00, // 001D GETNGBL R6 K5 - 0x88180D08, // 001E GETMBR R6 R6 K8 - 0x90060806, // 001F SETMBR R1 K4 R6 - 0x4C180000, // 0020 LDNIL R6 - 0x80040C00, // 0021 RET 1 R6 - 0x8C180B09, // 0022 GETMET R6 R5 K9 - 0x5C200600, // 0023 MOVE R8 R3 - 0x5C240800, // 0024 MOVE R9 R4 - 0x7C180600, // 0025 CALL R6 3 - 0x741A0004, // 0026 JMPT R6 #002C - 0xB81A0A00, // 0027 GETNGBL R6 K5 - 0x88180D0A, // 0028 GETMBR R6 R6 K10 - 0x90060806, // 0029 SETMBR R1 K4 R6 - 0x4C180000, // 002A LDNIL R6 - 0x80040C00, // 002B RET 1 R6 - 0x80040A00, // 002C RET 1 R5 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: autoconf_device -********************************************************************/ -be_local_closure(Matter_Device_autoconf_device, /* name */ - be_nested_proto( - 6, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[16]) { /* constants */ - /* K0 */ be_nested_str_weak(json), - /* K1 */ be_nested_str_weak(plugins), - /* K2 */ be_const_int(0), - /* K3 */ be_nested_str_weak(plugins_persist), - /* K4 */ be_nested_str_weak(plugins_config), - /* K5 */ be_nested_str_weak(autoconf_device_map), - /* K6 */ be_nested_str_weak(plugins_config_remotes), - /* K7 */ be_nested_str_weak(adjust_next_ep), - /* K8 */ be_nested_str_weak(tasmota), - /* K9 */ be_nested_str_weak(log), - /* K10 */ be_nested_str_weak(MTR_X3A_X20autoconfig_X20_X3D_X20), - /* K11 */ be_const_int(3), - /* K12 */ be_nested_str_weak(_instantiate_plugins_from_config), - /* K13 */ be_nested_str_weak(sessions), - /* K14 */ be_nested_str_weak(count_active_fabrics), - /* K15 */ be_nested_str_weak(save_param), - }), - be_str_weak(autoconf_device), - &be_const_str_solidified, - ( &(const binstruction[40]) { /* code */ - 0xA4060000, // 0000 IMPORT R1 K0 - 0x6008000C, // 0001 GETGBL R2 G12 - 0x880C0101, // 0002 GETMBR R3 R0 K1 - 0x7C080200, // 0003 CALL R2 1 - 0x24080502, // 0004 GT R2 R2 K2 - 0x780A0000, // 0005 JMPF R2 #0007 - 0x80000400, // 0006 RET 0 - 0x88080103, // 0007 GETMBR R2 R0 K3 - 0x740A000F, // 0008 JMPT R2 #0019 - 0x8C080105, // 0009 GETMET R2 R0 K5 - 0x7C080200, // 000A CALL R2 1 - 0x90020802, // 000B SETMBR R0 K4 R2 - 0x60080013, // 000C GETGBL R2 G19 - 0x7C080000, // 000D CALL R2 0 - 0x90020C02, // 000E SETMBR R0 K6 R2 - 0x8C080107, // 000F GETMET R2 R0 K7 - 0x7C080200, // 0010 CALL R2 1 - 0xB80A1000, // 0011 GETNGBL R2 K8 - 0x8C080509, // 0012 GETMET R2 R2 K9 - 0x60100008, // 0013 GETGBL R4 G8 - 0x88140104, // 0014 GETMBR R5 R0 K4 - 0x7C100200, // 0015 CALL R4 1 - 0x00121404, // 0016 ADD R4 K10 R4 - 0x5814000B, // 0017 LDCONST R5 K11 - 0x7C080600, // 0018 CALL R2 3 - 0x8C08010C, // 0019 GETMET R2 R0 K12 - 0x88100104, // 001A GETMBR R4 R0 K4 - 0x7C080400, // 001B CALL R2 2 - 0x88080103, // 001C GETMBR R2 R0 K3 - 0x740A0008, // 001D JMPT R2 #0027 - 0x8808010D, // 001E GETMBR R2 R0 K13 - 0x8C08050E, // 001F GETMET R2 R2 K14 - 0x7C080200, // 0020 CALL R2 1 - 0x24080502, // 0021 GT R2 R2 K2 - 0x780A0003, // 0022 JMPF R2 #0027 - 0x50080200, // 0023 LDBOOL R2 1 0 - 0x90020602, // 0024 SETMBR R0 K3 R2 - 0x8C08010F, // 0025 GETMET R2 R0 K15 - 0x7C080200, // 0026 CALL R2 1 - 0x80000000, // 0027 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: register_http_remote -********************************************************************/ -be_local_closure(Matter_Device_register_http_remote, /* name */ - be_nested_proto( - 9, /* nstack */ - 3, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 8]) { /* constants */ - /* K0 */ be_nested_str_weak(http_remotes), - /* K1 */ be_nested_str_weak(contains), - /* K2 */ be_nested_str_weak(get_timeout), - /* K3 */ be_nested_str_weak(set_timeout), - /* K4 */ be_nested_str_weak(matter), - /* K5 */ be_nested_str_weak(HTTP_remote), - /* K6 */ be_nested_str_weak(plugins_config_remotes), - /* K7 */ be_nested_str_weak(set_info), - }), - be_str_weak(register_http_remote), - &be_const_str_solidified, - ( &(const binstruction[42]) { /* code */ - 0x880C0100, // 0000 GETMBR R3 R0 K0 - 0x4C100000, // 0001 LDNIL R4 - 0x1C0C0604, // 0002 EQ R3 R3 R4 - 0x780E0002, // 0003 JMPF R3 #0007 - 0x600C0013, // 0004 GETGBL R3 G19 - 0x7C0C0000, // 0005 CALL R3 0 - 0x90020003, // 0006 SETMBR R0 K0 R3 - 0x4C0C0000, // 0007 LDNIL R3 - 0x88100100, // 0008 GETMBR R4 R0 K0 - 0x8C100901, // 0009 GETMET R4 R4 K1 - 0x5C180200, // 000A MOVE R6 R1 - 0x7C100400, // 000B CALL R4 2 - 0x78120009, // 000C JMPF R4 #0017 - 0x88100100, // 000D GETMBR R4 R0 K0 - 0x940C0801, // 000E GETIDX R3 R4 R1 - 0x8C140702, // 000F GETMET R5 R3 K2 - 0x7C140200, // 0010 CALL R5 1 - 0x14140405, // 0011 LT R5 R2 R5 - 0x78160002, // 0012 JMPF R5 #0016 - 0x8C140703, // 0013 GETMET R5 R3 K3 - 0x5C1C0400, // 0014 MOVE R7 R2 - 0x7C140400, // 0015 CALL R5 2 - 0x70020011, // 0016 JMP #0029 - 0xB8120800, // 0017 GETNGBL R4 K4 - 0x8C100905, // 0018 GETMET R4 R4 K5 - 0x5C180000, // 0019 MOVE R6 R0 - 0x5C1C0200, // 001A MOVE R7 R1 - 0x5C200400, // 001B MOVE R8 R2 - 0x7C100800, // 001C CALL R4 4 - 0x5C0C0800, // 001D MOVE R3 R4 - 0x88100106, // 001E GETMBR R4 R0 K6 - 0x8C100901, // 001F GETMET R4 R4 K1 - 0x5C180200, // 0020 MOVE R6 R1 - 0x7C100400, // 0021 CALL R4 2 - 0x78120003, // 0022 JMPF R4 #0027 - 0x8C100707, // 0023 GETMET R4 R3 K7 - 0x88180106, // 0024 GETMBR R6 R0 K6 - 0x94180C01, // 0025 GETIDX R6 R6 R1 - 0x7C100400, // 0026 CALL R4 2 - 0x88100100, // 0027 GETMBR R4 R0 K0 - 0x98100203, // 0028 SETIDX R4 R1 R3 - 0x80040600, // 0029 RET 1 R3 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: attribute_updated -********************************************************************/ -be_local_closure(Matter_Device_attribute_updated, /* name */ - be_nested_proto( - 10, /* nstack */ - 5, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 9]) { /* constants */ - /* K0 */ be_nested_str_weak(matter), - /* K1 */ be_nested_str_weak(Path), - /* K2 */ be_nested_str_weak(endpoint), - /* K3 */ be_nested_str_weak(cluster), - /* K4 */ be_nested_str_weak(attribute), - /* K5 */ be_nested_str_weak(message_handler), - /* K6 */ be_nested_str_weak(im), - /* K7 */ be_nested_str_weak(subs_shop), - /* K8 */ be_nested_str_weak(attribute_updated_ctx), - }), - be_str_weak(attribute_updated), - &be_const_str_solidified, - ( &(const binstruction[18]) { /* code */ - 0x4C140000, // 0000 LDNIL R5 - 0x1C140805, // 0001 EQ R5 R4 R5 - 0x78160000, // 0002 JMPF R5 #0004 - 0x50100000, // 0003 LDBOOL R4 0 0 - 0xB8160000, // 0004 GETNGBL R5 K0 - 0x8C140B01, // 0005 GETMET R5 R5 K1 - 0x7C140200, // 0006 CALL R5 1 - 0x90160401, // 0007 SETMBR R5 K2 R1 - 0x90160602, // 0008 SETMBR R5 K3 R2 - 0x90160803, // 0009 SETMBR R5 K4 R3 - 0x88180105, // 000A GETMBR R6 R0 K5 - 0x88180D06, // 000B GETMBR R6 R6 K6 - 0x88180D07, // 000C GETMBR R6 R6 K7 - 0x8C180D08, // 000D GETMET R6 R6 K8 - 0x5C200A00, // 000E MOVE R8 R5 - 0x5C240800, // 000F MOVE R9 R4 - 0x7C180600, // 0010 CALL R6 3 - 0x80000000, // 0011 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: every_250ms -********************************************************************/ -be_local_closure(Matter_Device_every_250ms, /* name */ - be_nested_proto( - 4, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 5]) { /* constants */ - /* K0 */ be_nested_str_weak(message_handler), - /* K1 */ be_nested_str_weak(every_250ms), - /* K2 */ be_const_int(0), - /* K3 */ be_nested_str_weak(plugins), - /* K4 */ be_const_int(1), - }), - be_str_weak(every_250ms), - &be_const_str_solidified, - ( &(const binstruction[16]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x8C040301, // 0001 GETMET R1 R1 K1 - 0x7C040200, // 0002 CALL R1 1 - 0x58040002, // 0003 LDCONST R1 K2 - 0x6008000C, // 0004 GETGBL R2 G12 - 0x880C0103, // 0005 GETMBR R3 R0 K3 - 0x7C080200, // 0006 CALL R2 1 - 0x14080202, // 0007 LT R2 R1 R2 - 0x780A0005, // 0008 JMPF R2 #000F - 0x88080103, // 0009 GETMBR R2 R0 K3 - 0x94080401, // 000A GETIDX R2 R2 R1 - 0x8C080501, // 000B GETMET R2 R2 K1 - 0x7C080200, // 000C CALL R2 1 - 0x00040304, // 000D ADD R1 R1 K4 - 0x7001FFF4, // 000E JMP #0004 - 0x80000000, // 000F RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: get_active_endpoints -********************************************************************/ -be_local_closure(Matter_Device_get_active_endpoints, /* name */ - be_nested_proto( - 9, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 6]) { /* constants */ - /* K0 */ be_nested_str_weak(plugins), - /* K1 */ be_nested_str_weak(get_endpoint), - /* K2 */ be_const_int(0), - /* K3 */ be_nested_str_weak(find), - /* K4 */ be_nested_str_weak(push), - /* K5 */ be_nested_str_weak(stop_iteration), - }), - be_str_weak(get_active_endpoints), - &be_const_str_solidified, - ( &(const binstruction[28]) { /* code */ - 0x60080012, // 0000 GETGBL R2 G18 - 0x7C080000, // 0001 CALL R2 0 - 0x600C0010, // 0002 GETGBL R3 G16 - 0x88100100, // 0003 GETMBR R4 R0 K0 - 0x7C0C0200, // 0004 CALL R3 1 - 0xA8020011, // 0005 EXBLK 0 #0018 - 0x5C100600, // 0006 MOVE R4 R3 - 0x7C100000, // 0007 CALL R4 0 - 0x8C140901, // 0008 GETMET R5 R4 K1 - 0x7C140200, // 0009 CALL R5 1 - 0x78060002, // 000A JMPF R1 #000E - 0x1C180B02, // 000B EQ R6 R5 K2 - 0x781A0000, // 000C JMPF R6 #000E - 0x7001FFF7, // 000D JMP #0006 - 0x8C180503, // 000E GETMET R6 R2 K3 - 0x5C200A00, // 000F MOVE R8 R5 - 0x7C180400, // 0010 CALL R6 2 - 0x4C1C0000, // 0011 LDNIL R7 - 0x1C180C07, // 0012 EQ R6 R6 R7 - 0x781A0002, // 0013 JMPF R6 #0017 - 0x8C180504, // 0014 GETMET R6 R2 K4 - 0x5C200A00, // 0015 MOVE R8 R5 - 0x7C180400, // 0016 CALL R6 2 - 0x7001FFED, // 0017 JMP #0006 - 0x580C0005, // 0018 LDCONST R3 K5 - 0xAC0C0200, // 0019 CATCH R3 1 0 - 0xB0080000, // 001A RAISE 2 R0 R0 - 0x80040400, // 001B RET 1 R2 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: _start_udp -********************************************************************/ -be_local_closure(Matter_Device__start_udp, /* name */ - be_nested_proto( - 7, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 1, /* has sup protos */ - ( &(const struct bproto*[ 1]) { - be_nested_proto( - 8, /* nstack */ - 3, /* argc */ - 0, /* varg */ - 1, /* has upvals */ - ( &(const bupvaldesc[ 1]) { /* upvals */ - be_local_const_upval(1, 0), - }), - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str_weak(msg_received), - }), - be_str_weak(_X3Clambda_X3E), - &be_const_str_solidified, - ( &(const binstruction[ 7]) { /* code */ - 0x680C0000, // 0000 GETUPV R3 U0 - 0x8C0C0700, // 0001 GETMET R3 R3 K0 - 0x5C140000, // 0002 MOVE R5 R0 - 0x5C180200, // 0003 MOVE R6 R1 - 0x5C1C0400, // 0004 MOVE R7 R2 - 0x7C0C0800, // 0005 CALL R3 4 - 0x80040600, // 0006 RET 1 R3 - }) - ), - }), - 1, /* has constants */ - ( &(const bvalue[ 9]) { /* constants */ - /* K0 */ be_nested_str_weak(udp_server), - /* K1 */ be_nested_str_weak(tasmota), - /* K2 */ be_nested_str_weak(log), - /* K3 */ be_nested_str_weak(MTR_X3A_X20Starting_X20UDP_X20server_X20on_X20port_X3A_X20), - /* K4 */ be_const_int(2), - /* K5 */ be_nested_str_weak(matter), - /* K6 */ be_nested_str_weak(UDPServer), - /* K7 */ be_nested_str_weak(), - /* K8 */ be_nested_str_weak(start), - }), - be_str_weak(_start_udp), - &be_const_str_solidified, - ( &(const binstruction[28]) { /* code */ - 0x88080100, // 0000 GETMBR R2 R0 K0 - 0x780A0000, // 0001 JMPF R2 #0003 - 0x80000400, // 0002 RET 0 - 0x4C080000, // 0003 LDNIL R2 - 0x1C080202, // 0004 EQ R2 R1 R2 - 0x780A0000, // 0005 JMPF R2 #0007 - 0x540615A3, // 0006 LDINT R1 5540 - 0xB80A0200, // 0007 GETNGBL R2 K1 - 0x8C080502, // 0008 GETMET R2 R2 K2 - 0x60100008, // 0009 GETGBL R4 G8 - 0x5C140200, // 000A MOVE R5 R1 - 0x7C100200, // 000B CALL R4 1 - 0x00120604, // 000C ADD R4 K3 R4 - 0x58140004, // 000D LDCONST R5 K4 - 0x7C080600, // 000E CALL R2 3 - 0xB80A0A00, // 000F GETNGBL R2 K5 - 0x8C080506, // 0010 GETMET R2 R2 K6 - 0x5C100000, // 0011 MOVE R4 R0 - 0x58140007, // 0012 LDCONST R5 K7 - 0x5C180200, // 0013 MOVE R6 R1 - 0x7C080800, // 0014 CALL R2 4 - 0x90020002, // 0015 SETMBR R0 K0 R2 - 0x88080100, // 0016 GETMBR R2 R0 K0 - 0x8C080508, // 0017 GETMET R2 R2 K8 - 0x84100000, // 0018 CLOSURE R4 P0 - 0x7C080400, // 0019 CALL R2 2 - 0xA0000000, // 001A CLOSE R0 - 0x80000000, // 001B RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: start_basic_commissioning -********************************************************************/ -be_local_closure(Matter_Device_start_basic_commissioning, /* name */ - be_nested_proto( - 13, /* nstack */ - 8, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 1, /* has sup protos */ - ( &(const struct bproto*[ 2]) { - be_nested_proto( - 4, /* nstack */ - 0, /* argc */ - 0, /* varg */ - 1, /* has upvals */ - ( &(const bupvaldesc[ 1]) { /* upvals */ - be_local_const_upval(1, 0), - }), - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 4]) { /* constants */ - /* K0 */ be_nested_str_weak(mdns_announce_PASE), - /* K1 */ be_nested_str_weak(tasmota), - /* K2 */ be_nested_str_weak(remove_rule), - /* K3 */ be_nested_str_weak(Wifi_X23Connected), - }), - be_str_weak(_anonymous_), - &be_const_str_solidified, - ( &(const binstruction[ 9]) { /* code */ - 0x68000000, // 0000 GETUPV R0 U0 - 0x8C000100, // 0001 GETMET R0 R0 K0 - 0x7C000200, // 0002 CALL R0 1 - 0xB8020200, // 0003 GETNGBL R0 K1 - 0x8C000102, // 0004 GETMET R0 R0 K2 - 0x58080003, // 0005 LDCONST R2 K3 - 0x580C0000, // 0006 LDCONST R3 K0 - 0x7C000600, // 0007 CALL R0 3 - 0x80000000, // 0008 RET 0 - }) - ), - be_nested_proto( - 4, /* nstack */ - 0, /* argc */ - 0, /* varg */ - 1, /* has upvals */ - ( &(const bupvaldesc[ 1]) { /* upvals */ - be_local_const_upval(1, 0), - }), - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 4]) { /* constants */ - /* K0 */ be_nested_str_weak(mdns_announce_PASE), - /* K1 */ be_nested_str_weak(tasmota), - /* K2 */ be_nested_str_weak(remove_rule), - /* K3 */ be_nested_str_weak(Eth_X23Connected), - }), - be_str_weak(_anonymous_), - &be_const_str_solidified, - ( &(const binstruction[ 9]) { /* code */ - 0x68000000, // 0000 GETUPV R0 U0 - 0x8C000100, // 0001 GETMET R0 R0 K0 - 0x7C000200, // 0002 CALL R0 1 - 0xB8020200, // 0003 GETNGBL R0 K1 - 0x8C000102, // 0004 GETMET R0 R0 K2 - 0x58080003, // 0005 LDCONST R2 K3 - 0x580C0000, // 0006 LDCONST R3 K0 - 0x7C000600, // 0007 CALL R0 3 - 0x80000000, // 0008 RET 0 - }) - ), - }), - 1, /* has constants */ - ( &(const bvalue[16]) { /* constants */ - /* K0 */ be_nested_str_weak(commissioning_open), - /* K1 */ be_nested_str_weak(tasmota), - /* K2 */ be_nested_str_weak(millis), - /* K3 */ be_nested_str_weak(commissioning_iterations), - /* K4 */ be_nested_str_weak(commissioning_discriminator), - /* K5 */ be_nested_str_weak(commissioning_salt), - /* K6 */ be_nested_str_weak(commissioning_w0), - /* K7 */ be_nested_str_weak(commissioning_L), - /* K8 */ be_nested_str_weak(commissioning_admin_fabric), - /* K9 */ be_nested_str_weak(wifi), - /* K10 */ be_nested_str_weak(up), + /* K1 */ be_nested_str_weak(get_device_id), + /* K2 */ be_nested_str_weak(copy), + /* K3 */ be_nested_str_weak(reverse), + /* K4 */ be_nested_str_weak(get_fabric_compressed), + /* K5 */ be_nested_str_weak(tohex), + /* K6 */ be_nested_str_weak(_X2D), + /* K7 */ be_nested_str_weak(tasmota), + /* K8 */ be_nested_str_weak(log), + /* K9 */ be_nested_str_weak(MTR_X3A_X20Operational_X20Discovery_X20node_X20_X3D_X20), + /* K10 */ be_const_int(3), /* K11 */ be_nested_str_weak(eth), - /* K12 */ be_nested_str_weak(mdns_announce_PASE), - /* K13 */ be_nested_str_weak(add_rule), - /* K14 */ be_nested_str_weak(Wifi_X23Connected), - /* K15 */ be_nested_str_weak(Eth_X23Connected), + /* K12 */ be_nested_str_weak(find), + /* K13 */ be_nested_str_weak(up), + /* K14 */ be_nested_str_weak(MTR_X3A_X20adding_X20mDNS_X20on_X20_X25s_X20_X27_X25s_X27_X20ptr_X20to_X20_X60_X25s_X2Elocal_X60), + /* K15 */ be_nested_str_weak(hostname_eth), + /* K16 */ be_nested_str_weak(add_service), + /* K17 */ be_nested_str_weak(_matter), + /* K18 */ be_nested_str_weak(_tcp), + /* K19 */ be_nested_str_weak(_I), + /* K20 */ be_nested_str_weak(MTR_X3A_X20adding_X20subtype_X3A_X20), + /* K21 */ be_nested_str_weak(add_subtype), + /* K22 */ be_nested_str_weak(wifi), + /* K23 */ be_nested_str_weak(hostname_wifi), + /* K24 */ be_nested_str_weak(MTR_X3A_X20Exception), + /* K25 */ be_nested_str_weak(_X7C), + /* K26 */ be_const_int(2), }), - be_str_weak(start_basic_commissioning), + be_str_weak(mdns_announce_op_discovery), &be_const_str_solidified, - ( &(const binstruction[40]) { /* code */ - 0xB8220200, // 0000 GETNGBL R8 K1 - 0x8C201102, // 0001 GETMET R8 R8 K2 - 0x7C200200, // 0002 CALL R8 1 - 0x542603E7, // 0003 LDINT R9 1000 - 0x08240209, // 0004 MUL R9 R1 R9 - 0x00201009, // 0005 ADD R8 R8 R9 - 0x90020008, // 0006 SETMBR R0 K0 R8 - 0x90020602, // 0007 SETMBR R0 K3 R2 - 0x90020803, // 0008 SETMBR R0 K4 R3 - 0x90020A04, // 0009 SETMBR R0 K5 R4 - 0x90020C05, // 000A SETMBR R0 K6 R5 - 0x90020E06, // 000B SETMBR R0 K7 R6 - 0x90021007, // 000C SETMBR R0 K8 R7 - 0xB8220200, // 000D GETNGBL R8 K1 - 0x8C201109, // 000E GETMET R8 R8 K9 - 0x7C200200, // 000F CALL R8 1 - 0x9420110A, // 0010 GETIDX R8 R8 K10 - 0x74220004, // 0011 JMPT R8 #0017 - 0xB8220200, // 0012 GETNGBL R8 K1 - 0x8C20110B, // 0013 GETMET R8 R8 K11 - 0x7C200200, // 0014 CALL R8 1 - 0x9420110A, // 0015 GETIDX R8 R8 K10 - 0x78220002, // 0016 JMPF R8 #001A - 0x8C20010C, // 0017 GETMET R8 R0 K12 - 0x7C200200, // 0018 CALL R8 1 - 0x7002000B, // 0019 JMP #0026 - 0xB8220200, // 001A GETNGBL R8 K1 - 0x8C20110D, // 001B GETMET R8 R8 K13 - 0x5828000E, // 001C LDCONST R10 K14 - 0x842C0000, // 001D CLOSURE R11 P0 - 0x5830000C, // 001E LDCONST R12 K12 - 0x7C200800, // 001F CALL R8 4 - 0xB8220200, // 0020 GETNGBL R8 K1 - 0x8C20110D, // 0021 GETMET R8 R8 K13 - 0x5828000F, // 0022 LDCONST R10 K15 - 0x842C0001, // 0023 CLOSURE R11 P1 - 0x5830000C, // 0024 LDCONST R12 K12 - 0x7C200800, // 0025 CALL R8 4 - 0xA0000000, // 0026 CLOSE R0 - 0x80000000, // 0027 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: bridge_remove_endpoint -********************************************************************/ -be_local_closure(Matter_Device_bridge_remove_endpoint, /* name */ - be_nested_proto( - 11, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[18]) { /* constants */ - /* K0 */ be_nested_str_weak(json), - /* K1 */ be_nested_str_weak(plugins_config), - /* K2 */ be_nested_str_weak(contains), - /* K3 */ be_nested_str_weak(tasmota), - /* K4 */ be_nested_str_weak(log), - /* K5 */ be_nested_str_weak(MTR_X3A_X20Cannot_X20remove_X20an_X20enpoint_X20not_X20configured_X3A_X20), - /* K6 */ be_const_int(3), - /* K7 */ be_nested_str_weak(MTR_X3A_X20deleting_X20endpoint_X20_X3D_X20_X25i), - /* K8 */ be_const_int(2), - /* K9 */ be_nested_str_weak(remove), - /* K10 */ be_nested_str_weak(plugins_persist), - /* K11 */ be_const_int(0), - /* K12 */ be_nested_str_weak(plugins), - /* K13 */ be_nested_str_weak(get_endpoint), - /* K14 */ be_const_int(1), - /* K15 */ be_nested_str_weak(clean_remotes), - /* K16 */ be_nested_str_weak(save_param), - /* K17 */ be_nested_str_weak(signal_endpoints_changed), - }), - be_str_weak(bridge_remove_endpoint), - &be_const_str_solidified, - ( &(const binstruction[58]) { /* code */ + ( &(const binstruction[121]) { /* code */ 0xA40A0000, // 0000 IMPORT R2 K0 - 0x600C0008, // 0001 GETGBL R3 G8 - 0x5C100200, // 0002 MOVE R4 R1 + 0xA8020064, // 0001 EXBLK 0 #0067 + 0x8C0C0301, // 0002 GETMET R3 R1 K1 0x7C0C0200, // 0003 CALL R3 1 - 0x4C100000, // 0004 LDNIL R4 - 0x4C140000, // 0005 LDNIL R5 - 0x88180101, // 0006 GETMBR R6 R0 K1 - 0x8C180D02, // 0007 GETMET R6 R6 K2 - 0x5C200600, // 0008 MOVE R8 R3 - 0x7C180400, // 0009 CALL R6 2 - 0x741A0005, // 000A JMPT R6 #0011 - 0xB81A0600, // 000B GETNGBL R6 K3 - 0x8C180D04, // 000C GETMET R6 R6 K4 - 0x00220A03, // 000D ADD R8 K5 R3 - 0x58240006, // 000E LDCONST R9 K6 - 0x7C180600, // 000F CALL R6 3 - 0x80000C00, // 0010 RET 0 - 0xB81A0600, // 0011 GETNGBL R6 K3 - 0x8C180D04, // 0012 GETMET R6 R6 K4 - 0x60200018, // 0013 GETGBL R8 G24 - 0x58240007, // 0014 LDCONST R9 K7 - 0x5C280200, // 0015 MOVE R10 R1 - 0x7C200400, // 0016 CALL R8 2 - 0x58240008, // 0017 LDCONST R9 K8 - 0x7C180600, // 0018 CALL R6 3 - 0x88180101, // 0019 GETMBR R6 R0 K1 - 0x8C180D09, // 001A GETMET R6 R6 K9 - 0x5C200600, // 001B MOVE R8 R3 - 0x7C180400, // 001C CALL R6 2 - 0x50180200, // 001D LDBOOL R6 1 0 - 0x90021406, // 001E SETMBR R0 K10 R6 - 0x5818000B, // 001F LDCONST R6 K11 - 0x601C000C, // 0020 GETGBL R7 G12 - 0x8820010C, // 0021 GETMBR R8 R0 K12 - 0x7C1C0200, // 0022 CALL R7 1 - 0x141C0C07, // 0023 LT R7 R6 R7 - 0x781E000D, // 0024 JMPF R7 #0033 - 0x881C010C, // 0025 GETMBR R7 R0 K12 - 0x941C0E06, // 0026 GETIDX R7 R7 R6 - 0x8C1C0F0D, // 0027 GETMET R7 R7 K13 - 0x7C1C0200, // 0028 CALL R7 1 - 0x1C1C0207, // 0029 EQ R7 R1 R7 - 0x781E0005, // 002A JMPF R7 #0031 - 0x881C010C, // 002B GETMBR R7 R0 K12 - 0x8C1C0F09, // 002C GETMET R7 R7 K9 - 0x5C240C00, // 002D MOVE R9 R6 - 0x7C1C0400, // 002E CALL R7 2 - 0x70020002, // 002F JMP #0033 - 0x70020000, // 0030 JMP #0032 - 0x00180D0E, // 0031 ADD R6 R6 K14 - 0x7001FFEC, // 0032 JMP #0020 - 0x8C1C010F, // 0033 GETMET R7 R0 K15 - 0x7C1C0200, // 0034 CALL R7 1 - 0x8C1C0110, // 0035 GETMET R7 R0 K16 - 0x7C1C0200, // 0036 CALL R7 1 - 0x8C1C0111, // 0037 GETMET R7 R0 K17 - 0x7C1C0200, // 0038 CALL R7 1 - 0x80000000, // 0039 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: start -********************************************************************/ -be_local_closure(Matter_Device_start, /* name */ - be_nested_proto( - 6, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 1, /* has sup protos */ - ( &(const struct bproto*[ 1]) { - be_nested_proto( - 2, /* nstack */ - 0, /* argc */ - 0, /* varg */ - 1, /* has upvals */ - ( &(const bupvaldesc[ 1]) { /* upvals */ - be_local_const_upval(1, 0), - }), - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str_weak(_trigger_read_sensors), - }), - be_str_weak(_anonymous_), - &be_const_str_solidified, - ( &(const binstruction[ 4]) { /* code */ - 0x68000000, // 0000 GETUPV R0 U0 - 0x8C000100, // 0001 GETMET R0 R0 K0 - 0x7C000200, // 0002 CALL R0 1 - 0x80000000, // 0003 RET 0 - }) - ), - }), - 1, /* has constants */ - ( &(const bvalue[ 9]) { /* constants */ - /* K0 */ be_nested_str_weak(started), - /* K1 */ be_nested_str_weak(autoconf_device), - /* K2 */ be_nested_str_weak(tasmota), - /* K3 */ be_nested_str_weak(add_cron), - /* K4 */ be_nested_str_weak(_X2A_X2F30_X20_X2A_X20_X2A_X20_X2A_X20_X2A_X20_X2A), - /* K5 */ be_nested_str_weak(matter_sensors_30s), - /* K6 */ be_nested_str_weak(_start_udp), - /* K7 */ be_nested_str_weak(UDP_PORT), - /* K8 */ be_nested_str_weak(start_mdns_announce_hostnames), - }), - be_str_weak(start), - &be_const_str_solidified, - ( &(const binstruction[20]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x78060000, // 0001 JMPF R1 #0003 - 0x80000200, // 0002 RET 0 - 0x8C040101, // 0003 GETMET R1 R0 K1 - 0x7C040200, // 0004 CALL R1 1 - 0xB8060400, // 0005 GETNGBL R1 K2 - 0x8C040303, // 0006 GETMET R1 R1 K3 - 0x580C0004, // 0007 LDCONST R3 K4 - 0x84100000, // 0008 CLOSURE R4 P0 - 0x58140005, // 0009 LDCONST R5 K5 - 0x7C040800, // 000A CALL R1 4 - 0x8C040106, // 000B GETMET R1 R0 K6 - 0x880C0107, // 000C GETMBR R3 R0 K7 - 0x7C040400, // 000D CALL R1 2 - 0x8C040108, // 000E GETMET R1 R0 K8 - 0x7C040200, // 000F CALL R1 1 - 0x50040200, // 0010 LDBOOL R1 1 0 - 0x90020001, // 0011 SETMBR R0 K0 R1 - 0xA0000000, // 0012 CLOSE R0 - 0x80000000, // 0013 RET 0 + 0x8C0C0702, // 0004 GETMET R3 R3 K2 + 0x7C0C0200, // 0005 CALL R3 1 + 0x8C0C0703, // 0006 GETMET R3 R3 K3 + 0x7C0C0200, // 0007 CALL R3 1 + 0x8C100304, // 0008 GETMET R4 R1 K4 + 0x7C100200, // 0009 CALL R4 1 + 0x8C140905, // 000A GETMET R5 R4 K5 + 0x7C140200, // 000B CALL R5 1 + 0x00140B06, // 000C ADD R5 R5 K6 + 0x8C180705, // 000D GETMET R6 R3 K5 + 0x7C180200, // 000E CALL R6 1 + 0x00140A06, // 000F ADD R5 R5 R6 + 0xB81A0E00, // 0010 GETNGBL R6 K7 + 0x8C180D08, // 0011 GETMET R6 R6 K8 + 0x00221205, // 0012 ADD R8 K9 R5 + 0x5824000A, // 0013 LDCONST R9 K10 + 0x7C180600, // 0014 CALL R6 3 + 0xB81A0E00, // 0015 GETNGBL R6 K7 + 0x8C180D0B, // 0016 GETMET R6 R6 K11 + 0x7C180200, // 0017 CALL R6 1 + 0x8C180D0C, // 0018 GETMET R6 R6 K12 + 0x5820000D, // 0019 LDCONST R8 K13 + 0x7C180400, // 001A CALL R6 2 + 0x781A0020, // 001B JMPF R6 #003D + 0xB81A0E00, // 001C GETNGBL R6 K7 + 0x8C180D08, // 001D GETMET R6 R6 K8 + 0x60200018, // 001E GETGBL R8 G24 + 0x5824000E, // 001F LDCONST R9 K14 + 0x5828000B, // 0020 LDCONST R10 K11 + 0x5C2C0A00, // 0021 MOVE R11 R5 + 0x8830010F, // 0022 GETMBR R12 R0 K15 + 0x7C200800, // 0023 CALL R8 4 + 0x5824000A, // 0024 LDCONST R9 K10 + 0x7C180600, // 0025 CALL R6 3 + 0x8C180510, // 0026 GETMET R6 R2 K16 + 0x58200011, // 0027 LDCONST R8 K17 + 0x58240012, // 0028 LDCONST R9 K18 + 0x542A15A3, // 0029 LDINT R10 5540 + 0x4C2C0000, // 002A LDNIL R11 + 0x5C300A00, // 002B MOVE R12 R5 + 0x8834010F, // 002C GETMBR R13 R0 K15 + 0x7C180E00, // 002D CALL R6 7 + 0x8C180905, // 002E GETMET R6 R4 K5 + 0x7C180200, // 002F CALL R6 1 + 0x001A2606, // 0030 ADD R6 K19 R6 + 0xB81E0E00, // 0031 GETNGBL R7 K7 + 0x8C1C0F08, // 0032 GETMET R7 R7 K8 + 0x00262806, // 0033 ADD R9 K20 R6 + 0x5828000A, // 0034 LDCONST R10 K10 + 0x7C1C0600, // 0035 CALL R7 3 + 0x8C1C0515, // 0036 GETMET R7 R2 K21 + 0x58240011, // 0037 LDCONST R9 K17 + 0x58280012, // 0038 LDCONST R10 K18 + 0x5C2C0A00, // 0039 MOVE R11 R5 + 0x8830010F, // 003A GETMBR R12 R0 K15 + 0x5C340C00, // 003B MOVE R13 R6 + 0x7C1C0C00, // 003C CALL R7 6 + 0xB81A0E00, // 003D GETNGBL R6 K7 + 0x8C180D16, // 003E GETMET R6 R6 K22 + 0x7C180200, // 003F CALL R6 1 + 0x8C180D0C, // 0040 GETMET R6 R6 K12 + 0x5820000D, // 0041 LDCONST R8 K13 + 0x7C180400, // 0042 CALL R6 2 + 0x781A0020, // 0043 JMPF R6 #0065 + 0xB81A0E00, // 0044 GETNGBL R6 K7 + 0x8C180D08, // 0045 GETMET R6 R6 K8 + 0x60200018, // 0046 GETGBL R8 G24 + 0x5824000E, // 0047 LDCONST R9 K14 + 0x58280016, // 0048 LDCONST R10 K22 + 0x5C2C0A00, // 0049 MOVE R11 R5 + 0x88300117, // 004A GETMBR R12 R0 K23 + 0x7C200800, // 004B CALL R8 4 + 0x5824000A, // 004C LDCONST R9 K10 + 0x7C180600, // 004D CALL R6 3 + 0x8C180510, // 004E GETMET R6 R2 K16 + 0x58200011, // 004F LDCONST R8 K17 + 0x58240012, // 0050 LDCONST R9 K18 + 0x542A15A3, // 0051 LDINT R10 5540 + 0x4C2C0000, // 0052 LDNIL R11 + 0x5C300A00, // 0053 MOVE R12 R5 + 0x88340117, // 0054 GETMBR R13 R0 K23 + 0x7C180E00, // 0055 CALL R6 7 + 0x8C180905, // 0056 GETMET R6 R4 K5 + 0x7C180200, // 0057 CALL R6 1 + 0x001A2606, // 0058 ADD R6 K19 R6 + 0xB81E0E00, // 0059 GETNGBL R7 K7 + 0x8C1C0F08, // 005A GETMET R7 R7 K8 + 0x00262806, // 005B ADD R9 K20 R6 + 0x5828000A, // 005C LDCONST R10 K10 + 0x7C1C0600, // 005D CALL R7 3 + 0x8C1C0515, // 005E GETMET R7 R2 K21 + 0x58240011, // 005F LDCONST R9 K17 + 0x58280012, // 0060 LDCONST R10 K18 + 0x5C2C0A00, // 0061 MOVE R11 R5 + 0x88300117, // 0062 GETMBR R12 R0 K23 + 0x5C340C00, // 0063 MOVE R13 R6 + 0x7C1C0C00, // 0064 CALL R7 6 + 0xA8040001, // 0065 EXBLK 1 1 + 0x70020010, // 0066 JMP #0078 + 0xAC0C0002, // 0067 CATCH R3 0 2 + 0x7002000D, // 0068 JMP #0077 + 0xB8160E00, // 0069 GETNGBL R5 K7 + 0x8C140B08, // 006A GETMET R5 R5 K8 + 0x601C0008, // 006B GETGBL R7 G8 + 0x5C200600, // 006C MOVE R8 R3 + 0x7C1C0200, // 006D CALL R7 1 + 0x001E3007, // 006E ADD R7 K24 R7 + 0x001C0F19, // 006F ADD R7 R7 K25 + 0x60200008, // 0070 GETGBL R8 G8 + 0x5C240800, // 0071 MOVE R9 R4 + 0x7C200200, // 0072 CALL R8 1 + 0x001C0E08, // 0073 ADD R7 R7 R8 + 0x5820001A, // 0074 LDCONST R8 K26 + 0x7C140600, // 0075 CALL R5 3 + 0x70020000, // 0076 JMP #0078 + 0xB0080000, // 0077 RAISE 2 R0 R0 + 0x80000000, // 0078 RET 0 }) ) ); @@ -2409,456 +3412,6 @@ be_local_closure(Matter_Device_stop_basic_commissioning, /* name */ /*******************************************************************/ -/******************************************************************** -** Solidified function: init -********************************************************************/ -be_local_closure(Matter_Device_init, /* name */ - be_nested_proto( - 7, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 1, /* has sup protos */ - ( &(const struct bproto*[ 2]) { - be_nested_proto( - 4, /* nstack */ - 0, /* argc */ - 0, /* varg */ - 1, /* has upvals */ - ( &(const bupvaldesc[ 1]) { /* upvals */ - be_local_const_upval(1, 0), - }), - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 5]) { /* constants */ - /* K0 */ be_nested_str_weak(start), - /* K1 */ be_nested_str_weak(tasmota), - /* K2 */ be_nested_str_weak(remove_rule), - /* K3 */ be_nested_str_weak(Wifi_X23Connected), - /* K4 */ be_nested_str_weak(matter_start), - }), - be_str_weak(_anonymous_), - &be_const_str_solidified, - ( &(const binstruction[ 9]) { /* code */ - 0x68000000, // 0000 GETUPV R0 U0 - 0x8C000100, // 0001 GETMET R0 R0 K0 - 0x7C000200, // 0002 CALL R0 1 - 0xB8020200, // 0003 GETNGBL R0 K1 - 0x8C000102, // 0004 GETMET R0 R0 K2 - 0x58080003, // 0005 LDCONST R2 K3 - 0x580C0004, // 0006 LDCONST R3 K4 - 0x7C000600, // 0007 CALL R0 3 - 0x80000000, // 0008 RET 0 - }) - ), - be_nested_proto( - 4, /* nstack */ - 0, /* argc */ - 0, /* varg */ - 1, /* has upvals */ - ( &(const bupvaldesc[ 1]) { /* upvals */ - be_local_const_upval(1, 0), - }), - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 5]) { /* constants */ - /* K0 */ be_nested_str_weak(start), - /* K1 */ be_nested_str_weak(tasmota), - /* K2 */ be_nested_str_weak(remove_rule), - /* K3 */ be_nested_str_weak(Eth_X23Connected), - /* K4 */ be_nested_str_weak(matter_start), - }), - be_str_weak(_anonymous_), - &be_const_str_solidified, - ( &(const binstruction[ 9]) { /* code */ - 0x68000000, // 0000 GETUPV R0 U0 - 0x8C000100, // 0001 GETMET R0 R0 K0 - 0x7C000200, // 0002 CALL R0 1 - 0xB8020200, // 0003 GETNGBL R0 K1 - 0x8C000102, // 0004 GETMET R0 R0 K2 - 0x58080003, // 0005 LDCONST R2 K3 - 0x580C0004, // 0006 LDCONST R3 K4 - 0x7C000600, // 0007 CALL R0 3 - 0x80000000, // 0008 RET 0 - }) - ), - }), - 1, /* has constants */ - ( &(const bvalue[46]) { /* constants */ - /* K0 */ be_nested_str_weak(crypto), - /* K1 */ be_nested_str_weak(tasmota), - /* K2 */ be_nested_str_weak(get_option), - /* K3 */ be_nested_str_weak(matter), - /* K4 */ be_nested_str_weak(MATTER_OPTION), - /* K5 */ be_nested_str_weak(UI), - /* K6 */ be_nested_str_weak(profiler), - /* K7 */ be_nested_str_weak(Profiler), - /* K8 */ be_nested_str_weak(started), - /* K9 */ be_nested_str_weak(tick), - /* K10 */ be_const_int(0), - /* K11 */ be_nested_str_weak(plugins), - /* K12 */ be_nested_str_weak(plugins_persist), - /* K13 */ be_nested_str_weak(plugins_classes), - /* K14 */ be_nested_str_weak(plugins_config_remotes), - /* K15 */ be_nested_str_weak(register_native_classes), - /* K16 */ be_nested_str_weak(vendorid), - /* K17 */ be_nested_str_weak(VENDOR_ID), - /* K18 */ be_nested_str_weak(productid), - /* K19 */ be_nested_str_weak(PRODUCT_ID), - /* K20 */ be_nested_str_weak(root_iterations), - /* K21 */ be_nested_str_weak(PBKDF_ITERATIONS), - /* K22 */ be_nested_str_weak(next_ep), - /* K23 */ be_const_int(1), - /* K24 */ be_nested_str_weak(root_salt), - /* K25 */ be_nested_str_weak(random), - /* K26 */ be_nested_str_weak(ipv4only), - /* K27 */ be_nested_str_weak(disable_bridge_mode), - /* K28 */ be_nested_str_weak(load_param), - /* K29 */ be_nested_str_weak(sessions), - /* K30 */ be_nested_str_weak(Session_Store), - /* K31 */ be_nested_str_weak(load_fabrics), - /* K32 */ be_nested_str_weak(message_handler), - /* K33 */ be_nested_str_weak(MessageHandler), - /* K34 */ be_nested_str_weak(ui), - /* K35 */ be_nested_str_weak(wifi), - /* K36 */ be_nested_str_weak(up), - /* K37 */ be_nested_str_weak(eth), - /* K38 */ be_nested_str_weak(start), - /* K39 */ be_nested_str_weak(add_rule), - /* K40 */ be_nested_str_weak(Wifi_X23Connected), - /* K41 */ be_nested_str_weak(matter_start), - /* K42 */ be_nested_str_weak(Eth_X23Connected), - /* K43 */ be_nested_str_weak(_init_basic_commissioning), - /* K44 */ be_nested_str_weak(add_driver), - /* K45 */ be_nested_str_weak(register_commands), - }), - be_str_weak(init), - &be_const_str_solidified, - ( &(const binstruction[112]) { /* code */ - 0xA4060000, // 0000 IMPORT R1 K0 - 0xB80A0200, // 0001 GETNGBL R2 K1 - 0x8C080502, // 0002 GETMET R2 R2 K2 - 0xB8120600, // 0003 GETNGBL R4 K3 - 0x88100904, // 0004 GETMBR R4 R4 K4 - 0x7C080400, // 0005 CALL R2 2 - 0x740A0004, // 0006 JMPT R2 #000C - 0xB80A0600, // 0007 GETNGBL R2 K3 - 0x8C080505, // 0008 GETMET R2 R2 K5 - 0x5C100000, // 0009 MOVE R4 R0 - 0x7C080400, // 000A CALL R2 2 - 0x80000400, // 000B RET 0 - 0xB80A0600, // 000C GETNGBL R2 K3 - 0xB80E0600, // 000D GETNGBL R3 K3 - 0x8C0C0707, // 000E GETMET R3 R3 K7 - 0x7C0C0200, // 000F CALL R3 1 - 0x900A0C03, // 0010 SETMBR R2 K6 R3 - 0x50080000, // 0011 LDBOOL R2 0 0 - 0x90021002, // 0012 SETMBR R0 K8 R2 - 0x9002130A, // 0013 SETMBR R0 K9 K10 - 0x60080012, // 0014 GETGBL R2 G18 - 0x7C080000, // 0015 CALL R2 0 - 0x90021602, // 0016 SETMBR R0 K11 R2 - 0x50080000, // 0017 LDBOOL R2 0 0 - 0x90021802, // 0018 SETMBR R0 K12 R2 - 0x60080013, // 0019 GETGBL R2 G19 - 0x7C080000, // 001A CALL R2 0 - 0x90021A02, // 001B SETMBR R0 K13 R2 - 0x60080013, // 001C GETGBL R2 G19 - 0x7C080000, // 001D CALL R2 0 - 0x90021C02, // 001E SETMBR R0 K14 R2 - 0x8C08010F, // 001F GETMET R2 R0 K15 - 0x7C080200, // 0020 CALL R2 1 - 0x88080111, // 0021 GETMBR R2 R0 K17 - 0x90022002, // 0022 SETMBR R0 K16 R2 - 0x88080113, // 0023 GETMBR R2 R0 K19 - 0x90022402, // 0024 SETMBR R0 K18 R2 - 0x88080115, // 0025 GETMBR R2 R0 K21 - 0x90022802, // 0026 SETMBR R0 K20 R2 - 0x90022D17, // 0027 SETMBR R0 K22 K23 - 0x8C080319, // 0028 GETMET R2 R1 K25 - 0x5412000F, // 0029 LDINT R4 16 - 0x7C080400, // 002A CALL R2 2 - 0x90023002, // 002B SETMBR R0 K24 R2 - 0x50080000, // 002C LDBOOL R2 0 0 - 0x90023402, // 002D SETMBR R0 K26 R2 - 0x50080000, // 002E LDBOOL R2 0 0 - 0x90023602, // 002F SETMBR R0 K27 R2 - 0x8C08011C, // 0030 GETMET R2 R0 K28 - 0x7C080200, // 0031 CALL R2 1 - 0xB80A0600, // 0032 GETNGBL R2 K3 - 0x8C08051E, // 0033 GETMET R2 R2 K30 - 0x5C100000, // 0034 MOVE R4 R0 - 0x7C080400, // 0035 CALL R2 2 - 0x90023A02, // 0036 SETMBR R0 K29 R2 - 0x8808011D, // 0037 GETMBR R2 R0 K29 - 0x8C08051F, // 0038 GETMET R2 R2 K31 - 0x7C080200, // 0039 CALL R2 1 - 0xB80A0600, // 003A GETNGBL R2 K3 - 0x8C080521, // 003B GETMET R2 R2 K33 - 0x5C100000, // 003C MOVE R4 R0 - 0x7C080400, // 003D CALL R2 2 - 0x90024002, // 003E SETMBR R0 K32 R2 - 0xB80A0600, // 003F GETNGBL R2 K3 - 0x8C080505, // 0040 GETMET R2 R2 K5 - 0x5C100000, // 0041 MOVE R4 R0 - 0x7C080400, // 0042 CALL R2 2 - 0x90024402, // 0043 SETMBR R0 K34 R2 - 0xB80A0200, // 0044 GETNGBL R2 K1 - 0x8C080523, // 0045 GETMET R2 R2 K35 - 0x7C080200, // 0046 CALL R2 1 - 0x94080524, // 0047 GETIDX R2 R2 K36 - 0x740A0004, // 0048 JMPT R2 #004E - 0xB80A0200, // 0049 GETNGBL R2 K1 - 0x8C080525, // 004A GETMET R2 R2 K37 - 0x7C080200, // 004B CALL R2 1 - 0x94080524, // 004C GETIDX R2 R2 K36 - 0x780A0001, // 004D JMPF R2 #0050 - 0x8C080126, // 004E GETMET R2 R0 K38 - 0x7C080200, // 004F CALL R2 1 - 0xB80A0200, // 0050 GETNGBL R2 K1 - 0x8C080523, // 0051 GETMET R2 R2 K35 - 0x7C080200, // 0052 CALL R2 1 - 0x94080524, // 0053 GETIDX R2 R2 K36 - 0x740A0005, // 0054 JMPT R2 #005B - 0xB80A0200, // 0055 GETNGBL R2 K1 - 0x8C080527, // 0056 GETMET R2 R2 K39 - 0x58100028, // 0057 LDCONST R4 K40 - 0x84140000, // 0058 CLOSURE R5 P0 - 0x58180029, // 0059 LDCONST R6 K41 - 0x7C080800, // 005A CALL R2 4 - 0xB80A0200, // 005B GETNGBL R2 K1 - 0x8C080525, // 005C GETMET R2 R2 K37 - 0x7C080200, // 005D CALL R2 1 - 0x94080524, // 005E GETIDX R2 R2 K36 - 0x740A0005, // 005F JMPT R2 #0066 - 0xB80A0200, // 0060 GETNGBL R2 K1 - 0x8C080527, // 0061 GETMET R2 R2 K39 - 0x5810002A, // 0062 LDCONST R4 K42 - 0x84140001, // 0063 CLOSURE R5 P1 - 0x58180029, // 0064 LDCONST R6 K41 - 0x7C080800, // 0065 CALL R2 4 - 0x8C08012B, // 0066 GETMET R2 R0 K43 - 0x7C080200, // 0067 CALL R2 1 - 0xB80A0200, // 0068 GETNGBL R2 K1 - 0x8C08052C, // 0069 GETMET R2 R2 K44 - 0x5C100000, // 006A MOVE R4 R0 - 0x7C080400, // 006B CALL R2 2 - 0x8C08012D, // 006C GETMET R2 R0 K45 - 0x7C080200, // 006D CALL R2 1 - 0xA0000000, // 006E CLOSE R0 - 0x80000000, // 006F RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: adjust_next_ep -********************************************************************/ -be_local_closure(Matter_Device_adjust_next_ep, /* name */ - be_nested_proto( - 5, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 5]) { /* constants */ - /* K0 */ be_nested_str_weak(plugins_config), - /* K1 */ be_nested_str_weak(keys), - /* K2 */ be_nested_str_weak(next_ep), - /* K3 */ be_const_int(1), - /* K4 */ be_nested_str_weak(stop_iteration), - }), - be_str_weak(adjust_next_ep), - &be_const_str_solidified, - ( &(const binstruction[21]) { /* code */ - 0x60040010, // 0000 GETGBL R1 G16 - 0x88080100, // 0001 GETMBR R2 R0 K0 - 0x8C080501, // 0002 GETMET R2 R2 K1 - 0x7C080200, // 0003 CALL R2 1 - 0x7C040200, // 0004 CALL R1 1 - 0xA802000A, // 0005 EXBLK 0 #0011 - 0x5C080200, // 0006 MOVE R2 R1 - 0x7C080000, // 0007 CALL R2 0 - 0x600C0009, // 0008 GETGBL R3 G9 - 0x5C100400, // 0009 MOVE R4 R2 - 0x7C0C0200, // 000A CALL R3 1 - 0x88100102, // 000B GETMBR R4 R0 K2 - 0x28100604, // 000C GE R4 R3 R4 - 0x78120001, // 000D JMPF R4 #0010 - 0x00100703, // 000E ADD R4 R3 K3 - 0x90020404, // 000F SETMBR R0 K2 R4 - 0x7001FFF4, // 0010 JMP #0006 - 0x58040004, // 0011 LDCONST R1 K4 - 0xAC040200, // 0012 CATCH R1 1 0 - 0xB0080000, // 0013 RAISE 2 R0 R0 - 0x80000000, // 0014 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: MtrJoin -********************************************************************/ -be_local_closure(Matter_Device_MtrJoin, /* name */ - be_nested_proto( - 8, /* nstack */ - 5, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 4]) { /* constants */ - /* K0 */ be_nested_str_weak(start_root_basic_commissioning), - /* K1 */ be_nested_str_weak(stop_basic_commissioning), - /* K2 */ be_nested_str_weak(tasmota), - /* K3 */ be_nested_str_weak(resp_cmnd_done), - }), - be_str_weak(MtrJoin), - &be_const_str_solidified, - ( &(const binstruction[13]) { /* code */ - 0x60140009, // 0000 GETGBL R5 G9 - 0x5C180600, // 0001 MOVE R6 R3 - 0x7C140200, // 0002 CALL R5 1 - 0x78160002, // 0003 JMPF R5 #0007 - 0x8C180100, // 0004 GETMET R6 R0 K0 - 0x7C180200, // 0005 CALL R6 1 - 0x70020001, // 0006 JMP #0009 - 0x8C180101, // 0007 GETMET R6 R0 K1 - 0x7C180200, // 0008 CALL R6 1 - 0xB81A0400, // 0009 GETNGBL R6 K2 - 0x8C180D03, // 000A GETMET R6 R6 K3 - 0x7C180200, // 000B CALL R6 1 - 0x80000000, // 000C RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: every_50ms -********************************************************************/ -be_local_closure(Matter_Device_every_50ms, /* name */ - be_nested_proto( - 2, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 2]) { /* constants */ - /* K0 */ be_nested_str_weak(tick), - /* K1 */ be_const_int(1), - }), - be_str_weak(every_50ms), - &be_const_str_solidified, - ( &(const binstruction[ 4]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x00040301, // 0001 ADD R1 R1 K1 - 0x90020001, // 0002 SETMBR R0 K0 R1 - 0x80000000, // 0003 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: k2l_num -********************************************************************/ -be_local_closure(Matter_Device_k2l_num, /* name */ - be_nested_proto( - 9, /* nstack */ - 1, /* argc */ - 4, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 6]) { /* constants */ - /* K0 */ be_const_class(be_class_Matter_Device), - /* K1 */ be_nested_str_weak(keys), - /* K2 */ be_nested_str_weak(push), - /* K3 */ be_nested_str_weak(stop_iteration), - /* K4 */ be_const_int(1), - /* K5 */ be_const_int(0), - }), - be_str_weak(k2l_num), - &be_const_str_solidified, - ( &(const binstruction[52]) { /* code */ - 0x58040000, // 0000 LDCONST R1 K0 - 0x60080012, // 0001 GETGBL R2 G18 - 0x7C080000, // 0002 CALL R2 0 - 0x4C0C0000, // 0003 LDNIL R3 - 0x1C0C0003, // 0004 EQ R3 R0 R3 - 0x780E0000, // 0005 JMPF R3 #0007 - 0x80040400, // 0006 RET 1 R2 - 0x600C0010, // 0007 GETGBL R3 G16 - 0x8C100101, // 0008 GETMET R4 R0 K1 - 0x7C100200, // 0009 CALL R4 1 - 0x7C0C0200, // 000A CALL R3 1 - 0xA8020007, // 000B EXBLK 0 #0014 - 0x5C100600, // 000C MOVE R4 R3 - 0x7C100000, // 000D CALL R4 0 - 0x8C140502, // 000E GETMET R5 R2 K2 - 0x601C0009, // 000F GETGBL R7 G9 - 0x5C200800, // 0010 MOVE R8 R4 - 0x7C1C0200, // 0011 CALL R7 1 - 0x7C140400, // 0012 CALL R5 2 - 0x7001FFF7, // 0013 JMP #000C - 0x580C0003, // 0014 LDCONST R3 K3 - 0xAC0C0200, // 0015 CATCH R3 1 0 - 0xB0080000, // 0016 RAISE 2 R0 R0 - 0x600C0010, // 0017 GETGBL R3 G16 - 0x6010000C, // 0018 GETGBL R4 G12 - 0x5C140400, // 0019 MOVE R5 R2 - 0x7C100200, // 001A CALL R4 1 - 0x04100904, // 001B SUB R4 R4 K4 - 0x40120804, // 001C CONNECT R4 K4 R4 - 0x7C0C0200, // 001D CALL R3 1 - 0xA8020010, // 001E EXBLK 0 #0030 - 0x5C100600, // 001F MOVE R4 R3 - 0x7C100000, // 0020 CALL R4 0 - 0x94140404, // 0021 GETIDX R5 R2 R4 - 0x5C180800, // 0022 MOVE R6 R4 - 0x241C0D05, // 0023 GT R7 R6 K5 - 0x781E0008, // 0024 JMPF R7 #002E - 0x041C0D04, // 0025 SUB R7 R6 K4 - 0x941C0407, // 0026 GETIDX R7 R2 R7 - 0x241C0E05, // 0027 GT R7 R7 R5 - 0x781E0004, // 0028 JMPF R7 #002E - 0x041C0D04, // 0029 SUB R7 R6 K4 - 0x941C0407, // 002A GETIDX R7 R2 R7 - 0x98080C07, // 002B SETIDX R2 R6 R7 - 0x04180D04, // 002C SUB R6 R6 K4 - 0x7001FFF4, // 002D JMP #0023 - 0x98080C05, // 002E SETIDX R2 R6 R5 - 0x7001FFEE, // 002F JMP #001F - 0x580C0003, // 0030 LDCONST R3 K3 - 0xAC0C0200, // 0031 CATCH R3 1 0 - 0xB0080000, // 0032 RAISE 2 R0 R0 - 0x80040400, // 0033 RET 1 R2 - }) - ) -); -/*******************************************************************/ - - /******************************************************************** ** Solidified function: autoconf_sensors_list ********************************************************************/ @@ -3021,32 +3574,122 @@ be_local_closure(Matter_Device_autoconf_sensors_list, /* name */ /******************************************************************** -** Solidified function: msg_received +** Solidified function: clean_remotes ********************************************************************/ -be_local_closure(Matter_Device_msg_received, /* name */ +be_local_closure(Matter_Device_clean_remotes, /* name */ be_nested_proto( - 9, /* nstack */ - 4, /* argc */ + 10, /* nstack */ + 1, /* argc */ 2, /* varg */ 0, /* has upvals */ NULL, /* no upvals */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[ 2]) { /* constants */ - /* K0 */ be_nested_str_weak(message_handler), - /* K1 */ be_nested_str_weak(msg_received), + ( &(const bvalue[18]) { /* constants */ + /* K0 */ be_nested_str_weak(introspect), + /* K1 */ be_nested_str_weak(http_remotes), + /* K2 */ be_const_int(0), + /* K3 */ be_nested_str_weak(stop_iteration), + /* K4 */ be_nested_str_weak(plugins), + /* K5 */ be_nested_str_weak(get), + /* K6 */ be_nested_str_weak(http_remote), + /* K7 */ be_nested_str_weak(find), + /* K8 */ be_const_int(1), + /* K9 */ be_nested_str_weak(keys), + /* K10 */ be_nested_str_weak(push), + /* K11 */ be_nested_str_weak(tasmota), + /* K12 */ be_nested_str_weak(log), + /* K13 */ be_nested_str_weak(MTR_X3A_X20remove_X20unused_X20remote_X3A_X20), + /* K14 */ be_nested_str_weak(addr), + /* K15 */ be_const_int(3), + /* K16 */ be_nested_str_weak(close), + /* K17 */ be_nested_str_weak(remove), }), - be_str_weak(msg_received), + be_str_weak(clean_remotes), &be_const_str_solidified, - ( &(const binstruction[ 7]) { /* code */ - 0x88100100, // 0000 GETMBR R4 R0 K0 - 0x8C100901, // 0001 GETMET R4 R4 K1 - 0x5C180200, // 0002 MOVE R6 R1 - 0x5C1C0400, // 0003 MOVE R7 R2 - 0x5C200600, // 0004 MOVE R8 R3 - 0x7C100800, // 0005 CALL R4 4 - 0x80040800, // 0006 RET 1 R4 + ( &(const binstruction[81]) { /* code */ + 0xA4060000, // 0000 IMPORT R1 K0 + 0x88080101, // 0001 GETMBR R2 R0 K1 + 0x780A004C, // 0002 JMPF R2 #0050 + 0x60080013, // 0003 GETGBL R2 G19 + 0x7C080000, // 0004 CALL R2 0 + 0x600C0010, // 0005 GETGBL R3 G16 + 0x88100101, // 0006 GETMBR R4 R0 K1 + 0x7C0C0200, // 0007 CALL R3 1 + 0xA8020003, // 0008 EXBLK 0 #000D + 0x5C100600, // 0009 MOVE R4 R3 + 0x7C100000, // 000A CALL R4 0 + 0x98080902, // 000B SETIDX R2 R4 K2 + 0x7001FFFB, // 000C JMP #0009 + 0x580C0003, // 000D LDCONST R3 K3 + 0xAC0C0200, // 000E CATCH R3 1 0 + 0xB0080000, // 000F RAISE 2 R0 R0 + 0x600C0010, // 0010 GETGBL R3 G16 + 0x88100104, // 0011 GETMBR R4 R0 K4 + 0x7C0C0200, // 0012 CALL R3 1 + 0xA802000F, // 0013 EXBLK 0 #0024 + 0x5C100600, // 0014 MOVE R4 R3 + 0x7C100000, // 0015 CALL R4 0 + 0x8C140305, // 0016 GETMET R5 R1 K5 + 0x5C1C0800, // 0017 MOVE R7 R4 + 0x58200006, // 0018 LDCONST R8 K6 + 0x7C140600, // 0019 CALL R5 3 + 0x4C180000, // 001A LDNIL R6 + 0x20180A06, // 001B NE R6 R5 R6 + 0x781A0005, // 001C JMPF R6 #0023 + 0x8C180507, // 001D GETMET R6 R2 K7 + 0x5C200A00, // 001E MOVE R8 R5 + 0x58240002, // 001F LDCONST R9 K2 + 0x7C180600, // 0020 CALL R6 3 + 0x00180D08, // 0021 ADD R6 R6 K8 + 0x98080A06, // 0022 SETIDX R2 R5 R6 + 0x7001FFEF, // 0023 JMP #0014 + 0x580C0003, // 0024 LDCONST R3 K3 + 0xAC0C0200, // 0025 CATCH R3 1 0 + 0xB0080000, // 0026 RAISE 2 R0 R0 + 0x600C0012, // 0027 GETGBL R3 G18 + 0x7C0C0000, // 0028 CALL R3 0 + 0x60100010, // 0029 GETGBL R4 G16 + 0x8C140509, // 002A GETMET R5 R2 K9 + 0x7C140200, // 002B CALL R5 1 + 0x7C100200, // 002C CALL R4 1 + 0xA8020008, // 002D EXBLK 0 #0037 + 0x5C140800, // 002E MOVE R5 R4 + 0x7C140000, // 002F CALL R5 0 + 0x94180405, // 0030 GETIDX R6 R2 R5 + 0x1C180D02, // 0031 EQ R6 R6 K2 + 0x781A0002, // 0032 JMPF R6 #0036 + 0x8C18070A, // 0033 GETMET R6 R3 K10 + 0x5C200A00, // 0034 MOVE R8 R5 + 0x7C180400, // 0035 CALL R6 2 + 0x7001FFF6, // 0036 JMP #002E + 0x58100003, // 0037 LDCONST R4 K3 + 0xAC100200, // 0038 CATCH R4 1 0 + 0xB0080000, // 0039 RAISE 2 R0 R0 + 0x60100010, // 003A GETGBL R4 G16 + 0x5C140600, // 003B MOVE R5 R3 + 0x7C100200, // 003C CALL R4 1 + 0xA802000E, // 003D EXBLK 0 #004D + 0x5C140800, // 003E MOVE R5 R4 + 0x7C140000, // 003F CALL R5 0 + 0xB81A1600, // 0040 GETNGBL R6 K11 + 0x8C180D0C, // 0041 GETMET R6 R6 K12 + 0x88200B0E, // 0042 GETMBR R8 R5 K14 + 0x00221A08, // 0043 ADD R8 K13 R8 + 0x5824000F, // 0044 LDCONST R9 K15 + 0x7C180600, // 0045 CALL R6 3 + 0x8C180B10, // 0046 GETMET R6 R5 K16 + 0x7C180200, // 0047 CALL R6 1 + 0x88180101, // 0048 GETMBR R6 R0 K1 + 0x8C180D11, // 0049 GETMET R6 R6 K17 + 0x88200B0E, // 004A GETMBR R8 R5 K14 + 0x7C180400, // 004B CALL R6 2 + 0x7001FFF0, // 004C JMP #003E + 0x58100003, // 004D LDCONST R4 K3 + 0xAC100200, // 004E CATCH R4 1 0 + 0xB0080000, // 004F RAISE 2 R0 R0 + 0x80000000, // 0050 RET 0 }) ) ); @@ -3116,6 +3759,123 @@ be_local_closure(Matter_Device_update_remotes_info, /* name */ /*******************************************************************/ +/******************************************************************** +** Solidified function: get_plugin_class_displayname +********************************************************************/ +be_local_closure(Matter_Device_get_plugin_class_displayname, /* name */ + be_nested_proto( + 5, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 4]) { /* constants */ + /* K0 */ be_nested_str_weak(plugins_classes), + /* K1 */ be_nested_str_weak(find), + /* K2 */ be_nested_str_weak(DISPLAY_NAME), + /* K3 */ be_nested_str_weak(), + }), + be_str_weak(get_plugin_class_displayname), + &be_const_str_solidified, + ( &(const binstruction[ 9]) { /* code */ + 0x88080100, // 0000 GETMBR R2 R0 K0 + 0x8C080501, // 0001 GETMET R2 R2 K1 + 0x5C100200, // 0002 MOVE R4 R1 + 0x7C080400, // 0003 CALL R2 2 + 0x780A0001, // 0004 JMPF R2 #0007 + 0x880C0502, // 0005 GETMBR R3 R2 K2 + 0x70020000, // 0006 JMP #0008 + 0x580C0003, // 0007 LDCONST R3 K3 + 0x80040600, // 0008 RET 1 R3 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: process_attribute_read_solo +********************************************************************/ +be_local_closure(Matter_Device_process_attribute_read_solo, /* name */ + be_nested_proto( + 10, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[11]) { /* constants */ + /* K0 */ be_nested_str_weak(endpoint), + /* K1 */ be_nested_str_weak(cluster), + /* K2 */ be_nested_str_weak(attribute), + /* K3 */ be_nested_str_weak(find_plugin_by_endpoint), + /* K4 */ be_nested_str_weak(status), + /* K5 */ be_nested_str_weak(matter), + /* K6 */ be_nested_str_weak(UNSUPPORTED_ENDPOINT), + /* K7 */ be_nested_str_weak(contains_cluster), + /* K8 */ be_nested_str_weak(UNSUPPORTED_CLUSTER), + /* K9 */ be_nested_str_weak(contains_attribute), + /* K10 */ be_nested_str_weak(UNSUPPORTED_ATTRIBUTE), + }), + be_str_weak(process_attribute_read_solo), + &be_const_str_solidified, + ( &(const binstruction[45]) { /* code */ + 0x88080300, // 0000 GETMBR R2 R1 K0 + 0x880C0301, // 0001 GETMBR R3 R1 K1 + 0x88100302, // 0002 GETMBR R4 R1 K2 + 0x4C140000, // 0003 LDNIL R5 + 0x1C140405, // 0004 EQ R5 R2 R5 + 0x74160005, // 0005 JMPT R5 #000C + 0x4C140000, // 0006 LDNIL R5 + 0x1C140605, // 0007 EQ R5 R3 R5 + 0x74160002, // 0008 JMPT R5 #000C + 0x4C140000, // 0009 LDNIL R5 + 0x1C140805, // 000A EQ R5 R4 R5 + 0x78160001, // 000B JMPF R5 #000E + 0x4C140000, // 000C LDNIL R5 + 0x80040A00, // 000D RET 1 R5 + 0x8C140103, // 000E GETMET R5 R0 K3 + 0x5C1C0400, // 000F MOVE R7 R2 + 0x7C140400, // 0010 CALL R5 2 + 0x4C180000, // 0011 LDNIL R6 + 0x1C180A06, // 0012 EQ R6 R5 R6 + 0x781A0004, // 0013 JMPF R6 #0019 + 0xB81A0A00, // 0014 GETNGBL R6 K5 + 0x88180D06, // 0015 GETMBR R6 R6 K6 + 0x90060806, // 0016 SETMBR R1 K4 R6 + 0x4C180000, // 0017 LDNIL R6 + 0x80040C00, // 0018 RET 1 R6 + 0x8C180B07, // 0019 GETMET R6 R5 K7 + 0x5C200600, // 001A MOVE R8 R3 + 0x7C180400, // 001B CALL R6 2 + 0x741A0004, // 001C JMPT R6 #0022 + 0xB81A0A00, // 001D GETNGBL R6 K5 + 0x88180D08, // 001E GETMBR R6 R6 K8 + 0x90060806, // 001F SETMBR R1 K4 R6 + 0x4C180000, // 0020 LDNIL R6 + 0x80040C00, // 0021 RET 1 R6 + 0x8C180B09, // 0022 GETMET R6 R5 K9 + 0x5C200600, // 0023 MOVE R8 R3 + 0x5C240800, // 0024 MOVE R9 R4 + 0x7C180600, // 0025 CALL R6 3 + 0x741A0004, // 0026 JMPT R6 #002C + 0xB81A0A00, // 0027 GETNGBL R6 K5 + 0x88180D0A, // 0028 GETMBR R6 R6 K10 + 0x90060806, // 0029 SETMBR R1 K4 R6 + 0x4C180000, // 002A LDNIL R6 + 0x80040C00, // 002B RET 1 R6 + 0x80040A00, // 002C RET 1 R5 + }) + ) +); +/*******************************************************************/ + + /******************************************************************** ** Solidified function: _trigger_read_sensors ********************************************************************/ @@ -3189,79 +3949,30 @@ be_local_closure(Matter_Device__trigger_read_sensors, /* name */ /******************************************************************** -** Solidified function: k2l +** Solidified function: received_ack ********************************************************************/ -be_local_closure(Matter_Device_k2l, /* name */ +be_local_closure(Matter_Device_received_ack, /* name */ be_nested_proto( - 8, /* nstack */ - 1, /* argc */ - 4, /* varg */ + 5, /* nstack */ + 2, /* argc */ + 2, /* varg */ 0, /* has upvals */ NULL, /* no upvals */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[ 6]) { /* constants */ - /* K0 */ be_const_class(be_class_Matter_Device), - /* K1 */ be_nested_str_weak(keys), - /* K2 */ be_nested_str_weak(push), - /* K3 */ be_nested_str_weak(stop_iteration), - /* K4 */ be_const_int(1), - /* K5 */ be_const_int(0), + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str_weak(udp_server), + /* K1 */ be_nested_str_weak(received_ack), }), - be_str_weak(k2l), + be_str_weak(received_ack), &be_const_str_solidified, - ( &(const binstruction[50]) { /* code */ - 0x58040000, // 0000 LDCONST R1 K0 - 0x60080012, // 0001 GETGBL R2 G18 - 0x7C080000, // 0002 CALL R2 0 - 0x4C0C0000, // 0003 LDNIL R3 - 0x1C0C0003, // 0004 EQ R3 R0 R3 - 0x780E0000, // 0005 JMPF R3 #0007 - 0x80040400, // 0006 RET 1 R2 - 0x600C0010, // 0007 GETGBL R3 G16 - 0x8C100101, // 0008 GETMET R4 R0 K1 - 0x7C100200, // 0009 CALL R4 1 - 0x7C0C0200, // 000A CALL R3 1 - 0xA8020005, // 000B EXBLK 0 #0012 - 0x5C100600, // 000C MOVE R4 R3 - 0x7C100000, // 000D CALL R4 0 - 0x8C140502, // 000E GETMET R5 R2 K2 - 0x5C1C0800, // 000F MOVE R7 R4 - 0x7C140400, // 0010 CALL R5 2 - 0x7001FFF9, // 0011 JMP #000C - 0x580C0003, // 0012 LDCONST R3 K3 - 0xAC0C0200, // 0013 CATCH R3 1 0 - 0xB0080000, // 0014 RAISE 2 R0 R0 - 0x600C0010, // 0015 GETGBL R3 G16 - 0x6010000C, // 0016 GETGBL R4 G12 - 0x5C140400, // 0017 MOVE R5 R2 - 0x7C100200, // 0018 CALL R4 1 - 0x04100904, // 0019 SUB R4 R4 K4 - 0x40120804, // 001A CONNECT R4 K4 R4 - 0x7C0C0200, // 001B CALL R3 1 - 0xA8020010, // 001C EXBLK 0 #002E - 0x5C100600, // 001D MOVE R4 R3 - 0x7C100000, // 001E CALL R4 0 - 0x94140404, // 001F GETIDX R5 R2 R4 - 0x5C180800, // 0020 MOVE R6 R4 - 0x241C0D05, // 0021 GT R7 R6 K5 - 0x781E0008, // 0022 JMPF R7 #002C - 0x041C0D04, // 0023 SUB R7 R6 K4 - 0x941C0407, // 0024 GETIDX R7 R2 R7 - 0x241C0E05, // 0025 GT R7 R7 R5 - 0x781E0004, // 0026 JMPF R7 #002C - 0x041C0D04, // 0027 SUB R7 R6 K4 - 0x941C0407, // 0028 GETIDX R7 R2 R7 - 0x98080C07, // 0029 SETIDX R2 R6 R7 - 0x04180D04, // 002A SUB R6 R6 K4 - 0x7001FFF4, // 002B JMP #0021 - 0x98080C05, // 002C SETIDX R2 R6 R5 - 0x7001FFEE, // 002D JMP #001D - 0x580C0003, // 002E LDCONST R3 K3 - 0xAC0C0200, // 002F CATCH R3 1 0 - 0xB0080000, // 0030 RAISE 2 R0 R0 - 0x80040400, // 0031 RET 1 R2 + ( &(const binstruction[ 5]) { /* code */ + 0x88080100, // 0000 GETMBR R2 R0 K0 + 0x8C080501, // 0001 GETMET R2 R2 K1 + 0x5C100200, // 0002 MOVE R4 R1 + 0x7C080400, // 0003 CALL R2 2 + 0x80040400, // 0004 RET 1 R2 }) ) ); @@ -3269,11 +3980,11 @@ be_local_closure(Matter_Device_k2l, /* name */ /******************************************************************** -** Solidified function: signal_endpoints_changed +** Solidified function: every_second ********************************************************************/ -be_local_closure(Matter_Device_signal_endpoints_changed, /* name */ +be_local_closure(Matter_Device_every_second, /* name */ be_nested_proto( - 7, /* nstack */ + 4, /* nstack */ 1, /* argc */ 2, /* varg */ 0, /* has upvals */ @@ -3281,27 +3992,392 @@ be_local_closure(Matter_Device_signal_endpoints_changed, /* name */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[ 3]) { /* constants */ - /* K0 */ be_nested_str_weak(attribute_updated), - /* K1 */ be_const_int(0), - /* K2 */ be_const_int(3), + ( &(const bvalue[ 6]) { /* constants */ + /* K0 */ be_nested_str_weak(sessions), + /* K1 */ be_nested_str_weak(every_second), + /* K2 */ be_nested_str_weak(message_handler), + /* K3 */ be_nested_str_weak(commissioning_open), + /* K4 */ be_nested_str_weak(tasmota), + /* K5 */ be_nested_str_weak(time_reached), }), - be_str_weak(signal_endpoints_changed), + be_str_weak(every_second), &be_const_str_solidified, - ( &(const binstruction[13]) { /* code */ - 0x8C040100, // 0000 GETMET R1 R0 K0 - 0x580C0001, // 0001 LDCONST R3 K1 - 0x5412001C, // 0002 LDINT R4 29 - 0x58140002, // 0003 LDCONST R5 K2 - 0x50180000, // 0004 LDBOOL R6 0 0 - 0x7C040A00, // 0005 CALL R1 5 - 0x8C040100, // 0006 GETMET R1 R0 K0 - 0x540EFEFF, // 0007 LDINT R3 65280 - 0x5412001C, // 0008 LDINT R4 29 - 0x58140002, // 0009 LDCONST R5 K2 - 0x50180000, // 000A LDBOOL R6 0 0 - 0x7C040A00, // 000B CALL R1 5 - 0x80000000, // 000C RET 0 + ( &(const binstruction[18]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x8C040301, // 0001 GETMET R1 R1 K1 + 0x7C040200, // 0002 CALL R1 1 + 0x88040102, // 0003 GETMBR R1 R0 K2 + 0x8C040301, // 0004 GETMET R1 R1 K1 + 0x7C040200, // 0005 CALL R1 1 + 0x88040103, // 0006 GETMBR R1 R0 K3 + 0x4C080000, // 0007 LDNIL R2 + 0x20040202, // 0008 NE R1 R1 R2 + 0x78060006, // 0009 JMPF R1 #0011 + 0xB8060800, // 000A GETNGBL R1 K4 + 0x8C040305, // 000B GETMET R1 R1 K5 + 0x880C0103, // 000C GETMBR R3 R0 K3 + 0x7C040400, // 000D CALL R1 2 + 0x78060001, // 000E JMPF R1 #0011 + 0x4C040000, // 000F LDNIL R1 + 0x90020601, // 0010 SETMBR R0 K3 R1 + 0x80000000, // 0011 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: start_basic_commissioning +********************************************************************/ +be_local_closure(Matter_Device_start_basic_commissioning, /* name */ + be_nested_proto( + 13, /* nstack */ + 8, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 1, /* has sup protos */ + ( &(const struct bproto*[ 2]) { + be_nested_proto( + 4, /* nstack */ + 0, /* argc */ + 0, /* varg */ + 1, /* has upvals */ + ( &(const bupvaldesc[ 1]) { /* upvals */ + be_local_const_upval(1, 0), + }), + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 4]) { /* constants */ + /* K0 */ be_nested_str_weak(mdns_announce_PASE), + /* K1 */ be_nested_str_weak(tasmota), + /* K2 */ be_nested_str_weak(remove_rule), + /* K3 */ be_nested_str_weak(Wifi_X23Connected), + }), + be_str_weak(_anonymous_), + &be_const_str_solidified, + ( &(const binstruction[ 9]) { /* code */ + 0x68000000, // 0000 GETUPV R0 U0 + 0x8C000100, // 0001 GETMET R0 R0 K0 + 0x7C000200, // 0002 CALL R0 1 + 0xB8020200, // 0003 GETNGBL R0 K1 + 0x8C000102, // 0004 GETMET R0 R0 K2 + 0x58080003, // 0005 LDCONST R2 K3 + 0x580C0000, // 0006 LDCONST R3 K0 + 0x7C000600, // 0007 CALL R0 3 + 0x80000000, // 0008 RET 0 + }) + ), + be_nested_proto( + 4, /* nstack */ + 0, /* argc */ + 0, /* varg */ + 1, /* has upvals */ + ( &(const bupvaldesc[ 1]) { /* upvals */ + be_local_const_upval(1, 0), + }), + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 4]) { /* constants */ + /* K0 */ be_nested_str_weak(mdns_announce_PASE), + /* K1 */ be_nested_str_weak(tasmota), + /* K2 */ be_nested_str_weak(remove_rule), + /* K3 */ be_nested_str_weak(Eth_X23Connected), + }), + be_str_weak(_anonymous_), + &be_const_str_solidified, + ( &(const binstruction[ 9]) { /* code */ + 0x68000000, // 0000 GETUPV R0 U0 + 0x8C000100, // 0001 GETMET R0 R0 K0 + 0x7C000200, // 0002 CALL R0 1 + 0xB8020200, // 0003 GETNGBL R0 K1 + 0x8C000102, // 0004 GETMET R0 R0 K2 + 0x58080003, // 0005 LDCONST R2 K3 + 0x580C0000, // 0006 LDCONST R3 K0 + 0x7C000600, // 0007 CALL R0 3 + 0x80000000, // 0008 RET 0 + }) + ), + }), + 1, /* has constants */ + ( &(const bvalue[16]) { /* constants */ + /* K0 */ be_nested_str_weak(commissioning_open), + /* K1 */ be_nested_str_weak(tasmota), + /* K2 */ be_nested_str_weak(millis), + /* K3 */ be_nested_str_weak(commissioning_iterations), + /* K4 */ be_nested_str_weak(commissioning_discriminator), + /* K5 */ be_nested_str_weak(commissioning_salt), + /* K6 */ be_nested_str_weak(commissioning_w0), + /* K7 */ be_nested_str_weak(commissioning_L), + /* K8 */ be_nested_str_weak(commissioning_admin_fabric), + /* K9 */ be_nested_str_weak(wifi), + /* K10 */ be_nested_str_weak(up), + /* K11 */ be_nested_str_weak(eth), + /* K12 */ be_nested_str_weak(mdns_announce_PASE), + /* K13 */ be_nested_str_weak(add_rule), + /* K14 */ be_nested_str_weak(Wifi_X23Connected), + /* K15 */ be_nested_str_weak(Eth_X23Connected), + }), + be_str_weak(start_basic_commissioning), + &be_const_str_solidified, + ( &(const binstruction[40]) { /* code */ + 0xB8220200, // 0000 GETNGBL R8 K1 + 0x8C201102, // 0001 GETMET R8 R8 K2 + 0x7C200200, // 0002 CALL R8 1 + 0x542603E7, // 0003 LDINT R9 1000 + 0x08240209, // 0004 MUL R9 R1 R9 + 0x00201009, // 0005 ADD R8 R8 R9 + 0x90020008, // 0006 SETMBR R0 K0 R8 + 0x90020602, // 0007 SETMBR R0 K3 R2 + 0x90020803, // 0008 SETMBR R0 K4 R3 + 0x90020A04, // 0009 SETMBR R0 K5 R4 + 0x90020C05, // 000A SETMBR R0 K6 R5 + 0x90020E06, // 000B SETMBR R0 K7 R6 + 0x90021007, // 000C SETMBR R0 K8 R7 + 0xB8220200, // 000D GETNGBL R8 K1 + 0x8C201109, // 000E GETMET R8 R8 K9 + 0x7C200200, // 000F CALL R8 1 + 0x9420110A, // 0010 GETIDX R8 R8 K10 + 0x74220004, // 0011 JMPT R8 #0017 + 0xB8220200, // 0012 GETNGBL R8 K1 + 0x8C20110B, // 0013 GETMET R8 R8 K11 + 0x7C200200, // 0014 CALL R8 1 + 0x9420110A, // 0015 GETIDX R8 R8 K10 + 0x78220002, // 0016 JMPF R8 #001A + 0x8C20010C, // 0017 GETMET R8 R0 K12 + 0x7C200200, // 0018 CALL R8 1 + 0x7002000B, // 0019 JMP #0026 + 0xB8220200, // 001A GETNGBL R8 K1 + 0x8C20110D, // 001B GETMET R8 R8 K13 + 0x5828000E, // 001C LDCONST R10 K14 + 0x842C0000, // 001D CLOSURE R11 P0 + 0x5830000C, // 001E LDCONST R12 K12 + 0x7C200800, // 001F CALL R8 4 + 0xB8220200, // 0020 GETNGBL R8 K1 + 0x8C20110D, // 0021 GETMET R8 R8 K13 + 0x5828000F, // 0022 LDCONST R10 K15 + 0x842C0001, // 0023 CLOSURE R11 P1 + 0x5830000C, // 0024 LDCONST R12 K12 + 0x7C200800, // 0025 CALL R8 4 + 0xA0000000, // 0026 CLOSE R0 + 0x80000000, // 0027 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: compute_manual_pairing_code +********************************************************************/ +be_local_closure(Matter_Device_compute_manual_pairing_code, /* name */ + be_nested_proto( + 9, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 6]) { /* constants */ + /* K0 */ be_nested_str_weak(root_discriminator), + /* K1 */ be_nested_str_weak(root_passcode), + /* K2 */ be_nested_str_weak(_X251i_X2505i_X2504i), + /* K3 */ be_nested_str_weak(matter), + /* K4 */ be_nested_str_weak(Verhoeff), + /* K5 */ be_nested_str_weak(checksum), + }), + be_str_weak(compute_manual_pairing_code), + &be_const_str_solidified, + ( &(const binstruction[30]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x540A0FFE, // 0001 LDINT R2 4095 + 0x2C040202, // 0002 AND R1 R1 R2 + 0x540A0009, // 0003 LDINT R2 10 + 0x3C040202, // 0004 SHR R1 R1 R2 + 0x88080100, // 0005 GETMBR R2 R0 K0 + 0x540E02FF, // 0006 LDINT R3 768 + 0x2C080403, // 0007 AND R2 R2 R3 + 0x540E0005, // 0008 LDINT R3 6 + 0x38080403, // 0009 SHL R2 R2 R3 + 0x880C0101, // 000A GETMBR R3 R0 K1 + 0x54123FFE, // 000B LDINT R4 16383 + 0x2C0C0604, // 000C AND R3 R3 R4 + 0x30080403, // 000D OR R2 R2 R3 + 0x880C0101, // 000E GETMBR R3 R0 K1 + 0x5412000D, // 000F LDINT R4 14 + 0x3C0C0604, // 0010 SHR R3 R3 R4 + 0x60100018, // 0011 GETGBL R4 G24 + 0x58140002, // 0012 LDCONST R5 K2 + 0x5C180200, // 0013 MOVE R6 R1 + 0x5C1C0400, // 0014 MOVE R7 R2 + 0x5C200600, // 0015 MOVE R8 R3 + 0x7C100800, // 0016 CALL R4 4 + 0xB8160600, // 0017 GETNGBL R5 K3 + 0x88140B04, // 0018 GETMBR R5 R5 K4 + 0x8C140B05, // 0019 GETMET R5 R5 K5 + 0x5C1C0800, // 001A MOVE R7 R4 + 0x7C140400, // 001B CALL R5 2 + 0x00100805, // 001C ADD R4 R4 R5 + 0x80040800, // 001D RET 1 R4 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: get_plugin_remote_info +********************************************************************/ +be_local_closure(Matter_Device_get_plugin_remote_info, /* name */ + be_nested_proto( + 6, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str_weak(plugins_config_remotes), + /* K1 */ be_nested_str_weak(find), + }), + be_str_weak(get_plugin_remote_info), + &be_const_str_solidified, + ( &(const binstruction[ 7]) { /* code */ + 0x88080100, // 0000 GETMBR R2 R0 K0 + 0x8C080501, // 0001 GETMET R2 R2 K1 + 0x5C100200, // 0002 MOVE R4 R1 + 0x60140013, // 0003 GETGBL R5 G19 + 0x7C140000, // 0004 CALL R5 0 + 0x7C080600, // 0005 CALL R2 3 + 0x80040400, // 0006 RET 1 R2 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: event_fabrics_saved +********************************************************************/ +be_local_closure(Matter_Device_event_fabrics_saved, /* name */ + be_nested_proto( + 3, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 5]) { /* constants */ + /* K0 */ be_nested_str_weak(sessions), + /* K1 */ be_nested_str_weak(count_active_fabrics), + /* K2 */ be_const_int(0), + /* K3 */ be_nested_str_weak(plugins_persist), + /* K4 */ be_nested_str_weak(save_param), + }), + be_str_weak(event_fabrics_saved), + &be_const_str_solidified, + ( &(const binstruction[12]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x8C040301, // 0001 GETMET R1 R1 K1 + 0x7C040200, // 0002 CALL R1 1 + 0x24040302, // 0003 GT R1 R1 K2 + 0x78060005, // 0004 JMPF R1 #000B + 0x88040103, // 0005 GETMBR R1 R0 K3 + 0x74060003, // 0006 JMPT R1 #000B + 0x50040200, // 0007 LDBOOL R1 1 0 + 0x90020601, // 0008 SETMBR R0 K3 R1 + 0x8C040104, // 0009 GETMET R1 R0 K4 + 0x7C040200, // 000A CALL R1 1 + 0x80000000, // 000B RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: autoconf_device +********************************************************************/ +be_local_closure(Matter_Device_autoconf_device, /* name */ + be_nested_proto( + 6, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[16]) { /* constants */ + /* K0 */ be_nested_str_weak(json), + /* K1 */ be_nested_str_weak(plugins), + /* K2 */ be_const_int(0), + /* K3 */ be_nested_str_weak(plugins_persist), + /* K4 */ be_nested_str_weak(plugins_config), + /* K5 */ be_nested_str_weak(autoconf_device_map), + /* K6 */ be_nested_str_weak(plugins_config_remotes), + /* K7 */ be_nested_str_weak(adjust_next_ep), + /* K8 */ be_nested_str_weak(tasmota), + /* K9 */ be_nested_str_weak(log), + /* K10 */ be_nested_str_weak(MTR_X3A_X20autoconfig_X20_X3D_X20), + /* K11 */ be_const_int(3), + /* K12 */ be_nested_str_weak(_instantiate_plugins_from_config), + /* K13 */ be_nested_str_weak(sessions), + /* K14 */ be_nested_str_weak(count_active_fabrics), + /* K15 */ be_nested_str_weak(save_param), + }), + be_str_weak(autoconf_device), + &be_const_str_solidified, + ( &(const binstruction[40]) { /* code */ + 0xA4060000, // 0000 IMPORT R1 K0 + 0x6008000C, // 0001 GETGBL R2 G12 + 0x880C0101, // 0002 GETMBR R3 R0 K1 + 0x7C080200, // 0003 CALL R2 1 + 0x24080502, // 0004 GT R2 R2 K2 + 0x780A0000, // 0005 JMPF R2 #0007 + 0x80000400, // 0006 RET 0 + 0x88080103, // 0007 GETMBR R2 R0 K3 + 0x740A000F, // 0008 JMPT R2 #0019 + 0x8C080105, // 0009 GETMET R2 R0 K5 + 0x7C080200, // 000A CALL R2 1 + 0x90020802, // 000B SETMBR R0 K4 R2 + 0x60080013, // 000C GETGBL R2 G19 + 0x7C080000, // 000D CALL R2 0 + 0x90020C02, // 000E SETMBR R0 K6 R2 + 0x8C080107, // 000F GETMET R2 R0 K7 + 0x7C080200, // 0010 CALL R2 1 + 0xB80A1000, // 0011 GETNGBL R2 K8 + 0x8C080509, // 0012 GETMET R2 R2 K9 + 0x60100008, // 0013 GETGBL R4 G8 + 0x88140104, // 0014 GETMBR R5 R0 K4 + 0x7C100200, // 0015 CALL R4 1 + 0x00121404, // 0016 ADD R4 K10 R4 + 0x5814000B, // 0017 LDCONST R5 K11 + 0x7C080600, // 0018 CALL R2 3 + 0x8C08010C, // 0019 GETMET R2 R0 K12 + 0x88100104, // 001A GETMBR R4 R0 K4 + 0x7C080400, // 001B CALL R2 2 + 0x88080103, // 001C GETMBR R2 R0 K3 + 0x740A0008, // 001D JMPT R2 #0027 + 0x8808010D, // 001E GETMBR R2 R0 K13 + 0x8C08050E, // 001F GETMET R2 R2 K14 + 0x7C080200, // 0020 CALL R2 1 + 0x24080502, // 0021 GT R2 R2 K2 + 0x780A0003, // 0022 JMPF R2 #0027 + 0x50080200, // 0023 LDBOOL R2 1 0 + 0x90020602, // 0024 SETMBR R0 K3 R2 + 0x8C08010F, // 0025 GETMET R2 R0 K15 + 0x7C080200, // 0026 CALL R2 1 + 0x80000000, // 0027 RET 0 }) ) ); @@ -3391,283 +4467,11 @@ be_local_closure(Matter_Device_start_root_basic_commissioning, /* name */ /******************************************************************** -** Solidified function: save_before_restart +** Solidified function: mdns_announce_op_discovery_all_fabrics ********************************************************************/ -be_local_closure(Matter_Device_save_before_restart, /* name */ +be_local_closure(Matter_Device_mdns_announce_op_discovery_all_fabrics, /* name */ be_nested_proto( - 3, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 2]) { /* constants */ - /* K0 */ be_nested_str_weak(stop_basic_commissioning), - /* K1 */ be_nested_str_weak(mdns_remove_op_discovery_all_fabrics), - }), - be_str_weak(save_before_restart), - &be_const_str_solidified, - ( &(const binstruction[ 5]) { /* code */ - 0x8C040100, // 0000 GETMET R1 R0 K0 - 0x7C040200, // 0001 CALL R1 1 - 0x8C040101, // 0002 GETMET R1 R0 K1 - 0x7C040200, // 0003 CALL R1 1 - 0x80000000, // 0004 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: register_commands -********************************************************************/ -be_local_closure(Matter_Device_register_commands, /* name */ - be_nested_proto( - 5, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 1, /* has sup protos */ - ( &(const struct bproto*[ 3]) { - be_nested_proto( - 10, /* nstack */ - 4, /* argc */ - 0, /* varg */ - 1, /* has upvals */ - ( &(const bupvaldesc[ 1]) { /* upvals */ - be_local_const_upval(1, 0), - }), - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str_weak(MtrJoin), - }), - be_str_weak(_X3Clambda_X3E), - &be_const_str_solidified, - ( &(const binstruction[ 8]) { /* code */ - 0x68100000, // 0000 GETUPV R4 U0 - 0x8C100900, // 0001 GETMET R4 R4 K0 - 0x5C180000, // 0002 MOVE R6 R0 - 0x5C1C0200, // 0003 MOVE R7 R1 - 0x5C200400, // 0004 MOVE R8 R2 - 0x5C240600, // 0005 MOVE R9 R3 - 0x7C100A00, // 0006 CALL R4 5 - 0x80040800, // 0007 RET 1 R4 - }) - ), - be_nested_proto( - 10, /* nstack */ - 4, /* argc */ - 0, /* varg */ - 1, /* has upvals */ - ( &(const bupvaldesc[ 1]) { /* upvals */ - be_local_const_upval(1, 0), - }), - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str_weak(MtrUpdate), - }), - be_str_weak(_X3Clambda_X3E), - &be_const_str_solidified, - ( &(const binstruction[ 8]) { /* code */ - 0x68100000, // 0000 GETUPV R4 U0 - 0x8C100900, // 0001 GETMET R4 R4 K0 - 0x5C180000, // 0002 MOVE R6 R0 - 0x5C1C0200, // 0003 MOVE R7 R1 - 0x5C200400, // 0004 MOVE R8 R2 - 0x5C240600, // 0005 MOVE R9 R3 - 0x7C100A00, // 0006 CALL R4 5 - 0x80040800, // 0007 RET 1 R4 - }) - ), - be_nested_proto( - 10, /* nstack */ - 4, /* argc */ - 0, /* varg */ - 1, /* has upvals */ - ( &(const bupvaldesc[ 1]) { /* upvals */ - be_local_const_upval(1, 0), - }), - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str_weak(MtrInfo), - }), - be_str_weak(_X3Clambda_X3E), - &be_const_str_solidified, - ( &(const binstruction[ 8]) { /* code */ - 0x68100000, // 0000 GETUPV R4 U0 - 0x8C100900, // 0001 GETMET R4 R4 K0 - 0x5C180000, // 0002 MOVE R6 R0 - 0x5C1C0200, // 0003 MOVE R7 R1 - 0x5C200400, // 0004 MOVE R8 R2 - 0x5C240600, // 0005 MOVE R9 R3 - 0x7C100A00, // 0006 CALL R4 5 - 0x80040800, // 0007 RET 1 R4 - }) - ), - }), - 1, /* has constants */ - ( &(const bvalue[ 5]) { /* constants */ - /* K0 */ be_nested_str_weak(tasmota), - /* K1 */ be_nested_str_weak(add_cmd), - /* K2 */ be_nested_str_weak(MtrJoin), - /* K3 */ be_nested_str_weak(MtrUpdate), - /* K4 */ be_nested_str_weak(MtrInfo), - }), - be_str_weak(register_commands), - &be_const_str_solidified, - ( &(const binstruction[17]) { /* code */ - 0xB8060000, // 0000 GETNGBL R1 K0 - 0x8C040301, // 0001 GETMET R1 R1 K1 - 0x580C0002, // 0002 LDCONST R3 K2 - 0x84100000, // 0003 CLOSURE R4 P0 - 0x7C040600, // 0004 CALL R1 3 - 0xB8060000, // 0005 GETNGBL R1 K0 - 0x8C040301, // 0006 GETMET R1 R1 K1 - 0x580C0003, // 0007 LDCONST R3 K3 - 0x84100001, // 0008 CLOSURE R4 P1 - 0x7C040600, // 0009 CALL R1 3 - 0xB8060000, // 000A GETNGBL R1 K0 - 0x8C040301, // 000B GETMET R1 R1 K1 - 0x580C0004, // 000C LDCONST R3 K4 - 0x84100002, // 000D CLOSURE R4 P2 - 0x7C040600, // 000E CALL R1 3 - 0xA0000000, // 000F CLOSE R0 - 0x80000000, // 0010 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: MtrInfo_one -********************************************************************/ -be_local_closure(Matter_Device_MtrInfo_one, /* name */ - be_nested_proto( - 9, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 6]) { /* constants */ - /* K0 */ be_nested_str_weak(find_plugin_by_endpoint), - /* K1 */ be_nested_str_weak(state_json), - /* K2 */ be_nested_str_weak(_X7B_X22MtrInfo_X22_X3A_X25s_X7D), - /* K3 */ be_nested_str_weak(tasmota), - /* K4 */ be_nested_str_weak(publish_result), - /* K5 */ be_nested_str_weak(), - }), - be_str_weak(MtrInfo_one), - &be_const_str_solidified, - ( &(const binstruction[20]) { /* code */ - 0x8C080100, // 0000 GETMET R2 R0 K0 - 0x5C100200, // 0001 MOVE R4 R1 - 0x7C080400, // 0002 CALL R2 2 - 0x4C0C0000, // 0003 LDNIL R3 - 0x1C0C0403, // 0004 EQ R3 R2 R3 - 0x780E0000, // 0005 JMPF R3 #0007 - 0x80000600, // 0006 RET 0 - 0x8C0C0501, // 0007 GETMET R3 R2 K1 - 0x7C0C0200, // 0008 CALL R3 1 - 0x780E0008, // 0009 JMPF R3 #0013 - 0x60100018, // 000A GETGBL R4 G24 - 0x58140002, // 000B LDCONST R5 K2 - 0x5C180600, // 000C MOVE R6 R3 - 0x7C100400, // 000D CALL R4 2 - 0xB8160600, // 000E GETNGBL R5 K3 - 0x8C140B04, // 000F GETMET R5 R5 K4 - 0x5C1C0800, // 0010 MOVE R7 R4 - 0x58200005, // 0011 LDCONST R8 K5 - 0x7C140600, // 0012 CALL R5 3 - 0x80000000, // 0013 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: find_plugin_by_friendly_name -********************************************************************/ -be_local_closure(Matter_Device_find_plugin_by_friendly_name, /* name */ - be_nested_proto( - 7, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 4]) { /* constants */ - /* K0 */ be_const_int(0), - /* K1 */ be_nested_str_weak(plugins), - /* K2 */ be_nested_str_weak(get_name), - /* K3 */ be_const_int(1), - }), - be_str_weak(find_plugin_by_friendly_name), - &be_const_str_solidified, - ( &(const binstruction[35]) { /* code */ - 0x4C080000, // 0000 LDNIL R2 - 0x1C080202, // 0001 EQ R2 R1 R2 - 0x740A0004, // 0002 JMPT R2 #0008 - 0x6008000C, // 0003 GETGBL R2 G12 - 0x5C0C0200, // 0004 MOVE R3 R1 - 0x7C080200, // 0005 CALL R2 1 - 0x1C080500, // 0006 EQ R2 R2 K0 - 0x780A0001, // 0007 JMPF R2 #000A - 0x4C080000, // 0008 LDNIL R2 - 0x80040400, // 0009 RET 1 R2 - 0x58080000, // 000A LDCONST R2 K0 - 0x600C000C, // 000B GETGBL R3 G12 - 0x88100101, // 000C GETMBR R4 R0 K1 - 0x7C0C0200, // 000D CALL R3 1 - 0x140C0403, // 000E LT R3 R2 R3 - 0x780E0010, // 000F JMPF R3 #0021 - 0x880C0101, // 0010 GETMBR R3 R0 K1 - 0x940C0602, // 0011 GETIDX R3 R3 R2 - 0x8C100702, // 0012 GETMET R4 R3 K2 - 0x7C100200, // 0013 CALL R4 1 - 0x4C140000, // 0014 LDNIL R5 - 0x20140805, // 0015 NE R5 R4 R5 - 0x78160007, // 0016 JMPF R5 #001F - 0x6014000C, // 0017 GETGBL R5 G12 - 0x5C180800, // 0018 MOVE R6 R4 - 0x7C140200, // 0019 CALL R5 1 - 0x24140B00, // 001A GT R5 R5 K0 - 0x78160002, // 001B JMPF R5 #001F - 0x1C140801, // 001C EQ R5 R4 R1 - 0x78160000, // 001D JMPF R5 #001F - 0x80040600, // 001E RET 1 R3 - 0x00080503, // 001F ADD R2 R2 K3 - 0x7001FFE9, // 0020 JMP #000B - 0x4C0C0000, // 0021 LDNIL R3 - 0x80040600, // 0022 RET 1 R3 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: every_second -********************************************************************/ -be_local_closure(Matter_Device_every_second, /* name */ - be_nested_proto( - 4, /* nstack */ + 6, /* nstack */ 1, /* argc */ 2, /* varg */ 0, /* has upvals */ @@ -3677,33 +4481,37 @@ be_local_closure(Matter_Device_every_second, /* name */ 1, /* has constants */ ( &(const bvalue[ 6]) { /* constants */ /* K0 */ be_nested_str_weak(sessions), - /* K1 */ be_nested_str_weak(every_second), - /* K2 */ be_nested_str_weak(message_handler), - /* K3 */ be_nested_str_weak(commissioning_open), - /* K4 */ be_nested_str_weak(tasmota), - /* K5 */ be_nested_str_weak(time_reached), + /* K1 */ be_nested_str_weak(active_fabrics), + /* K2 */ be_nested_str_weak(get_device_id), + /* K3 */ be_nested_str_weak(get_fabric_id), + /* K4 */ be_nested_str_weak(mdns_announce_op_discovery), + /* K5 */ be_nested_str_weak(stop_iteration), }), - be_str_weak(every_second), + be_str_weak(mdns_announce_op_discovery_all_fabrics), &be_const_str_solidified, - ( &(const binstruction[18]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x8C040301, // 0001 GETMET R1 R1 K1 - 0x7C040200, // 0002 CALL R1 1 - 0x88040102, // 0003 GETMBR R1 R0 K2 - 0x8C040301, // 0004 GETMET R1 R1 K1 - 0x7C040200, // 0005 CALL R1 1 - 0x88040103, // 0006 GETMBR R1 R0 K3 - 0x4C080000, // 0007 LDNIL R2 - 0x20040202, // 0008 NE R1 R1 R2 - 0x78060006, // 0009 JMPF R1 #0011 - 0xB8060800, // 000A GETNGBL R1 K4 - 0x8C040305, // 000B GETMET R1 R1 K5 - 0x880C0103, // 000C GETMBR R3 R0 K3 - 0x7C040400, // 000D CALL R1 2 - 0x78060001, // 000E JMPF R1 #0011 - 0x4C040000, // 000F LDNIL R1 - 0x90020601, // 0010 SETMBR R0 K3 R1 - 0x80000000, // 0011 RET 0 + ( &(const binstruction[22]) { /* code */ + 0x60040010, // 0000 GETGBL R1 G16 + 0x88080100, // 0001 GETMBR R2 R0 K0 + 0x8C080501, // 0002 GETMET R2 R2 K1 + 0x7C080200, // 0003 CALL R2 1 + 0x7C040200, // 0004 CALL R1 1 + 0xA802000B, // 0005 EXBLK 0 #0012 + 0x5C080200, // 0006 MOVE R2 R1 + 0x7C080000, // 0007 CALL R2 0 + 0x8C0C0502, // 0008 GETMET R3 R2 K2 + 0x7C0C0200, // 0009 CALL R3 1 + 0x780E0005, // 000A JMPF R3 #0011 + 0x8C0C0503, // 000B GETMET R3 R2 K3 + 0x7C0C0200, // 000C CALL R3 1 + 0x780E0002, // 000D JMPF R3 #0011 + 0x8C0C0104, // 000E GETMET R3 R0 K4 + 0x5C140400, // 000F MOVE R5 R2 + 0x7C0C0400, // 0010 CALL R3 2 + 0x7001FFF3, // 0011 JMP #0006 + 0x58040005, // 0012 LDCONST R1 K5 + 0xAC040200, // 0013 CATCH R1 1 0 + 0xB0080000, // 0014 RAISE 2 R0 R0 + 0x80000000, // 0015 RET 0 }) ) ); @@ -3711,197 +4519,11 @@ be_local_closure(Matter_Device_every_second, /* name */ /******************************************************************** -** Solidified function: load_param +** Solidified function: mdns_remove_op_discovery ********************************************************************/ -be_local_closure(Matter_Device_load_param, /* name */ +be_local_closure(Matter_Device_mdns_remove_op_discovery, /* name */ be_nested_proto( - 11, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[35]) { /* constants */ - /* K0 */ be_nested_str_weak(crypto), - /* K1 */ be_nested_str_weak(FILENAME), - /* K2 */ be_nested_str_weak(read), - /* K3 */ be_nested_str_weak(close), - /* K4 */ be_nested_str_weak(json), - /* K5 */ be_nested_str_weak(load), - /* K6 */ be_nested_str_weak(root_discriminator), - /* K7 */ be_nested_str_weak(find), - /* K8 */ be_nested_str_weak(distinguish), - /* K9 */ be_nested_str_weak(root_passcode), - /* K10 */ be_nested_str_weak(passcode), - /* K11 */ be_nested_str_weak(ipv4only), - /* K12 */ be_nested_str_weak(disable_bridge_mode), - /* K13 */ be_nested_str_weak(next_ep), - /* K14 */ be_nested_str_weak(nextep), - /* K15 */ be_nested_str_weak(plugins_config), - /* K16 */ be_nested_str_weak(config), - /* K17 */ be_nested_str_weak(tasmota), - /* K18 */ be_nested_str_weak(log), - /* K19 */ be_nested_str_weak(MTR_X3A_X20load_config_X20_X3D_X20), - /* K20 */ be_const_int(3), - /* K21 */ be_nested_str_weak(adjust_next_ep), - /* K22 */ be_nested_str_weak(plugins_persist), - /* K23 */ be_nested_str_weak(plugins_config_remotes), - /* K24 */ be_nested_str_weak(remotes), - /* K25 */ be_nested_str_weak(MTR_X3A_X20load_remotes_X20_X3D_X20), - /* K26 */ be_nested_str_weak(io_error), - /* K27 */ be_nested_str_weak(MTR_X3A_X20Session_Store_X3A_X3Aload_X20Exception_X3A), - /* K28 */ be_nested_str_weak(_X7C), - /* K29 */ be_const_int(2), - /* K30 */ be_nested_str_weak(random), - /* K31 */ be_nested_str_weak(get), - /* K32 */ be_const_int(0), - /* K33 */ be_nested_str_weak(generate_random_passcode), - /* K34 */ be_nested_str_weak(save_param), - }), - be_str_weak(load_param), - &be_const_str_solidified, - ( &(const binstruction[127]) { /* code */ - 0xA4060000, // 0000 IMPORT R1 K0 - 0xA802004D, // 0001 EXBLK 0 #0050 - 0x60080011, // 0002 GETGBL R2 G17 - 0x880C0101, // 0003 GETMBR R3 R0 K1 - 0x7C080200, // 0004 CALL R2 1 - 0x8C0C0502, // 0005 GETMET R3 R2 K2 - 0x7C0C0200, // 0006 CALL R3 1 - 0x8C100503, // 0007 GETMET R4 R2 K3 - 0x7C100200, // 0008 CALL R4 1 - 0xA4120800, // 0009 IMPORT R4 K4 - 0x8C140905, // 000A GETMET R5 R4 K5 - 0x5C1C0600, // 000B MOVE R7 R3 - 0x7C140400, // 000C CALL R5 2 - 0x8C180B07, // 000D GETMET R6 R5 K7 - 0x58200008, // 000E LDCONST R8 K8 - 0x88240106, // 000F GETMBR R9 R0 K6 - 0x7C180600, // 0010 CALL R6 3 - 0x90020C06, // 0011 SETMBR R0 K6 R6 - 0x8C180B07, // 0012 GETMET R6 R5 K7 - 0x5820000A, // 0013 LDCONST R8 K10 - 0x88240109, // 0014 GETMBR R9 R0 K9 - 0x7C180600, // 0015 CALL R6 3 - 0x90021206, // 0016 SETMBR R0 K9 R6 - 0x60180017, // 0017 GETGBL R6 G23 - 0x8C1C0B07, // 0018 GETMET R7 R5 K7 - 0x5824000B, // 0019 LDCONST R9 K11 - 0x50280000, // 001A LDBOOL R10 0 0 - 0x7C1C0600, // 001B CALL R7 3 - 0x7C180200, // 001C CALL R6 1 - 0x90021606, // 001D SETMBR R0 K11 R6 - 0x60180017, // 001E GETGBL R6 G23 - 0x8C1C0B07, // 001F GETMET R7 R5 K7 - 0x5824000C, // 0020 LDCONST R9 K12 - 0x50280000, // 0021 LDBOOL R10 0 0 - 0x7C1C0600, // 0022 CALL R7 3 - 0x7C180200, // 0023 CALL R6 1 - 0x90021806, // 0024 SETMBR R0 K12 R6 - 0x8C180B07, // 0025 GETMET R6 R5 K7 - 0x5820000E, // 0026 LDCONST R8 K14 - 0x8824010D, // 0027 GETMBR R9 R0 K13 - 0x7C180600, // 0028 CALL R6 3 - 0x90021A06, // 0029 SETMBR R0 K13 R6 - 0x8C180B07, // 002A GETMET R6 R5 K7 - 0x58200010, // 002B LDCONST R8 K16 - 0x7C180400, // 002C CALL R6 2 - 0x90021E06, // 002D SETMBR R0 K15 R6 - 0x8818010F, // 002E GETMBR R6 R0 K15 - 0x4C1C0000, // 002F LDNIL R7 - 0x20180C07, // 0030 NE R6 R6 R7 - 0x781A000B, // 0031 JMPF R6 #003E - 0xB81A2200, // 0032 GETNGBL R6 K17 - 0x8C180D12, // 0033 GETMET R6 R6 K18 - 0x60200008, // 0034 GETGBL R8 G8 - 0x8824010F, // 0035 GETMBR R9 R0 K15 - 0x7C200200, // 0036 CALL R8 1 - 0x00222608, // 0037 ADD R8 K19 R8 - 0x58240014, // 0038 LDCONST R9 K20 - 0x7C180600, // 0039 CALL R6 3 - 0x8C180115, // 003A GETMET R6 R0 K21 - 0x7C180200, // 003B CALL R6 1 - 0x50180200, // 003C LDBOOL R6 1 0 - 0x90022C06, // 003D SETMBR R0 K22 R6 - 0x8C180B07, // 003E GETMET R6 R5 K7 - 0x58200018, // 003F LDCONST R8 K24 - 0x60240013, // 0040 GETGBL R9 G19 - 0x7C240000, // 0041 CALL R9 0 - 0x7C180600, // 0042 CALL R6 3 - 0x90022E06, // 0043 SETMBR R0 K23 R6 - 0x88180117, // 0044 GETMBR R6 R0 K23 - 0x781A0007, // 0045 JMPF R6 #004E - 0xB81A2200, // 0046 GETNGBL R6 K17 - 0x8C180D12, // 0047 GETMET R6 R6 K18 - 0x60200008, // 0048 GETGBL R8 G8 - 0x88240117, // 0049 GETMBR R9 R0 K23 - 0x7C200200, // 004A CALL R8 1 - 0x00223208, // 004B ADD R8 K25 R8 - 0x58240014, // 004C LDCONST R9 K20 - 0x7C180600, // 004D CALL R6 3 - 0xA8040001, // 004E EXBLK 1 1 - 0x70020012, // 004F JMP #0063 - 0xAC080002, // 0050 CATCH R2 0 2 - 0x7002000F, // 0051 JMP #0062 - 0x2010051A, // 0052 NE R4 R2 K26 - 0x7812000C, // 0053 JMPF R4 #0061 - 0xB8122200, // 0054 GETNGBL R4 K17 - 0x8C100912, // 0055 GETMET R4 R4 K18 - 0x60180008, // 0056 GETGBL R6 G8 - 0x5C1C0400, // 0057 MOVE R7 R2 - 0x7C180200, // 0058 CALL R6 1 - 0x001A3606, // 0059 ADD R6 K27 R6 - 0x00180D1C, // 005A ADD R6 R6 K28 - 0x601C0008, // 005B GETGBL R7 G8 - 0x5C200600, // 005C MOVE R8 R3 - 0x7C1C0200, // 005D CALL R7 1 - 0x00180C07, // 005E ADD R6 R6 R7 - 0x581C001D, // 005F LDCONST R7 K29 - 0x7C100600, // 0060 CALL R4 3 - 0x70020000, // 0061 JMP #0063 - 0xB0080000, // 0062 RAISE 2 R0 R0 - 0x50080000, // 0063 LDBOOL R2 0 0 - 0x880C0106, // 0064 GETMBR R3 R0 K6 - 0x4C100000, // 0065 LDNIL R4 - 0x1C0C0604, // 0066 EQ R3 R3 R4 - 0x780E000A, // 0067 JMPF R3 #0073 - 0x8C0C031E, // 0068 GETMET R3 R1 K30 - 0x5814001D, // 0069 LDCONST R5 K29 - 0x7C0C0400, // 006A CALL R3 2 - 0x8C0C071F, // 006B GETMET R3 R3 K31 - 0x58140020, // 006C LDCONST R5 K32 - 0x5818001D, // 006D LDCONST R6 K29 - 0x7C0C0600, // 006E CALL R3 3 - 0x54120FFE, // 006F LDINT R4 4095 - 0x2C0C0604, // 0070 AND R3 R3 R4 - 0x90020C03, // 0071 SETMBR R0 K6 R3 - 0x50080200, // 0072 LDBOOL R2 1 0 - 0x880C0109, // 0073 GETMBR R3 R0 K9 - 0x4C100000, // 0074 LDNIL R4 - 0x1C0C0604, // 0075 EQ R3 R3 R4 - 0x780E0003, // 0076 JMPF R3 #007B - 0x8C0C0121, // 0077 GETMET R3 R0 K33 - 0x7C0C0200, // 0078 CALL R3 1 - 0x90021203, // 0079 SETMBR R0 K9 R3 - 0x50080200, // 007A LDBOOL R2 1 0 - 0x780A0001, // 007B JMPF R2 #007E - 0x8C0C0122, // 007C GETMET R3 R0 K34 - 0x7C0C0200, // 007D CALL R3 1 - 0x80000000, // 007E RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: register_plugin_class -********************************************************************/ -be_local_closure(Matter_Device_register_plugin_class, /* name */ - be_nested_proto( - 7, /* nstack */ + 12, /* nstack */ 2, /* argc */ 2, /* varg */ 0, /* has upvals */ @@ -3909,24 +4531,763 @@ be_local_closure(Matter_Device_register_plugin_class, /* name */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[ 4]) { /* constants */ - /* K0 */ be_nested_str_weak(introspect), - /* K1 */ be_nested_str_weak(get), - /* K2 */ be_nested_str_weak(TYPE), - /* K3 */ be_nested_str_weak(plugins_classes), + ( &(const bvalue[23]) { /* constants */ + /* K0 */ be_nested_str_weak(mdns), + /* K1 */ be_nested_str_weak(get_device_id), + /* K2 */ be_nested_str_weak(copy), + /* K3 */ be_nested_str_weak(reverse), + /* K4 */ be_nested_str_weak(get_fabric_compressed), + /* K5 */ be_nested_str_weak(tohex), + /* K6 */ be_nested_str_weak(_X2D), + /* K7 */ be_nested_str_weak(tasmota), + /* K8 */ be_nested_str_weak(eth), + /* K9 */ be_nested_str_weak(find), + /* K10 */ be_nested_str_weak(up), + /* K11 */ be_nested_str_weak(log), + /* K12 */ be_nested_str_weak(MTR_X3A_X20remove_X20mDNS_X20on_X20_X25s_X20_X27_X25s_X27), + /* K13 */ be_const_int(3), + /* K14 */ be_nested_str_weak(remove_service), + /* K15 */ be_nested_str_weak(_matter), + /* K16 */ be_nested_str_weak(_tcp), + /* K17 */ be_nested_str_weak(hostname_eth), + /* K18 */ be_nested_str_weak(wifi), + /* K19 */ be_nested_str_weak(hostname_wifi), + /* K20 */ be_nested_str_weak(MTR_X3A_X20Exception), + /* K21 */ be_nested_str_weak(_X7C), + /* K22 */ be_const_int(2), }), - be_str_weak(register_plugin_class), + be_str_weak(mdns_remove_op_discovery), &be_const_str_solidified, - ( &(const binstruction[ 9]) { /* code */ + ( &(const binstruction[80]) { /* code */ 0xA40A0000, // 0000 IMPORT R2 K0 - 0x8C0C0501, // 0001 GETMET R3 R2 K1 - 0x5C140200, // 0002 MOVE R5 R1 - 0x58180002, // 0003 LDCONST R6 K2 - 0x7C0C0600, // 0004 CALL R3 3 - 0x780E0001, // 0005 JMPF R3 #0008 - 0x88100103, // 0006 GETMBR R4 R0 K3 - 0x98100601, // 0007 SETIDX R4 R3 R1 - 0x80000000, // 0008 RET 0 + 0xA802003B, // 0001 EXBLK 0 #003E + 0x8C0C0301, // 0002 GETMET R3 R1 K1 + 0x7C0C0200, // 0003 CALL R3 1 + 0x8C0C0702, // 0004 GETMET R3 R3 K2 + 0x7C0C0200, // 0005 CALL R3 1 + 0x8C0C0703, // 0006 GETMET R3 R3 K3 + 0x7C0C0200, // 0007 CALL R3 1 + 0x8C100304, // 0008 GETMET R4 R1 K4 + 0x7C100200, // 0009 CALL R4 1 + 0x8C140905, // 000A GETMET R5 R4 K5 + 0x7C140200, // 000B CALL R5 1 + 0x00140B06, // 000C ADD R5 R5 K6 + 0x8C180705, // 000D GETMET R6 R3 K5 + 0x7C180200, // 000E CALL R6 1 + 0x00140A06, // 000F ADD R5 R5 R6 + 0xB81A0E00, // 0010 GETNGBL R6 K7 + 0x8C180D08, // 0011 GETMET R6 R6 K8 + 0x7C180200, // 0012 CALL R6 1 + 0x8C180D09, // 0013 GETMET R6 R6 K9 + 0x5820000A, // 0014 LDCONST R8 K10 + 0x7C180400, // 0015 CALL R6 2 + 0x781A000E, // 0016 JMPF R6 #0026 + 0xB81A0E00, // 0017 GETNGBL R6 K7 + 0x8C180D0B, // 0018 GETMET R6 R6 K11 + 0x60200018, // 0019 GETGBL R8 G24 + 0x5824000C, // 001A LDCONST R9 K12 + 0x58280008, // 001B LDCONST R10 K8 + 0x5C2C0A00, // 001C MOVE R11 R5 + 0x7C200600, // 001D CALL R8 3 + 0x5824000D, // 001E LDCONST R9 K13 + 0x7C180600, // 001F CALL R6 3 + 0x8C18050E, // 0020 GETMET R6 R2 K14 + 0x5820000F, // 0021 LDCONST R8 K15 + 0x58240010, // 0022 LDCONST R9 K16 + 0x5C280A00, // 0023 MOVE R10 R5 + 0x882C0111, // 0024 GETMBR R11 R0 K17 + 0x7C180A00, // 0025 CALL R6 5 + 0xB81A0E00, // 0026 GETNGBL R6 K7 + 0x8C180D12, // 0027 GETMET R6 R6 K18 + 0x7C180200, // 0028 CALL R6 1 + 0x8C180D09, // 0029 GETMET R6 R6 K9 + 0x5820000A, // 002A LDCONST R8 K10 + 0x7C180400, // 002B CALL R6 2 + 0x781A000E, // 002C JMPF R6 #003C + 0xB81A0E00, // 002D GETNGBL R6 K7 + 0x8C180D0B, // 002E GETMET R6 R6 K11 + 0x60200018, // 002F GETGBL R8 G24 + 0x5824000C, // 0030 LDCONST R9 K12 + 0x58280012, // 0031 LDCONST R10 K18 + 0x5C2C0A00, // 0032 MOVE R11 R5 + 0x7C200600, // 0033 CALL R8 3 + 0x5824000D, // 0034 LDCONST R9 K13 + 0x7C180600, // 0035 CALL R6 3 + 0x8C18050E, // 0036 GETMET R6 R2 K14 + 0x5820000F, // 0037 LDCONST R8 K15 + 0x58240010, // 0038 LDCONST R9 K16 + 0x5C280A00, // 0039 MOVE R10 R5 + 0x882C0113, // 003A GETMBR R11 R0 K19 + 0x7C180A00, // 003B CALL R6 5 + 0xA8040001, // 003C EXBLK 1 1 + 0x70020010, // 003D JMP #004F + 0xAC0C0002, // 003E CATCH R3 0 2 + 0x7002000D, // 003F JMP #004E + 0xB8160E00, // 0040 GETNGBL R5 K7 + 0x8C140B0B, // 0041 GETMET R5 R5 K11 + 0x601C0008, // 0042 GETGBL R7 G8 + 0x5C200600, // 0043 MOVE R8 R3 + 0x7C1C0200, // 0044 CALL R7 1 + 0x001E2807, // 0045 ADD R7 K20 R7 + 0x001C0F15, // 0046 ADD R7 R7 K21 + 0x60200008, // 0047 GETGBL R8 G8 + 0x5C240800, // 0048 MOVE R9 R4 + 0x7C200200, // 0049 CALL R8 1 + 0x001C0E08, // 004A ADD R7 R7 R8 + 0x58200016, // 004B LDCONST R8 K22 + 0x7C140600, // 004C CALL R5 3 + 0x70020000, // 004D JMP #004F + 0xB0080000, // 004E RAISE 2 R0 R0 + 0x80000000, // 004F RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: mdns_announce_PASE +********************************************************************/ +be_local_closure(Matter_Device_mdns_announce_PASE, /* name */ + be_nested_proto( + 12, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[41]) { /* constants */ + /* K0 */ be_nested_str_weak(mdns), + /* K1 */ be_nested_str_weak(crypto), + /* K2 */ be_nested_str_weak(VP), + /* K3 */ be_nested_str_weak(vendorid), + /* K4 */ be_nested_str_weak(_X2B), + /* K5 */ be_nested_str_weak(productid), + /* K6 */ be_nested_str_weak(D), + /* K7 */ be_nested_str_weak(commissioning_discriminator), + /* K8 */ be_nested_str_weak(CM), + /* K9 */ be_const_int(1), + /* K10 */ be_nested_str_weak(T), + /* K11 */ be_const_int(0), + /* K12 */ be_nested_str_weak(SII), + /* K13 */ be_nested_str_weak(SAI), + /* K14 */ be_nested_str_weak(commissioning_instance_wifi), + /* K15 */ be_nested_str_weak(random), + /* K16 */ be_nested_str_weak(tohex), + /* K17 */ be_nested_str_weak(commissioning_instance_eth), + /* K18 */ be_nested_str_weak(hostname_eth), + /* K19 */ be_nested_str_weak(add_service), + /* K20 */ be_nested_str_weak(_matterc), + /* K21 */ be_nested_str_weak(_udp), + /* K22 */ be_nested_str_weak(mdns_pase_eth), + /* K23 */ be_nested_str_weak(tasmota), + /* K24 */ be_nested_str_weak(log), + /* K25 */ be_nested_str_weak(MTR_X3A_X20announce_X20mDNS_X20on_X20_X25s_X20_X27_X25s_X27_X20ptr_X20to_X20_X60_X25s_X2Elocal_X60), + /* K26 */ be_nested_str_weak(eth), + /* K27 */ be_const_int(2), + /* K28 */ be_nested_str_weak(_L), + /* K29 */ be_nested_str_weak(MTR_X3A_X20adding_X20subtype_X3A_X20), + /* K30 */ be_const_int(3), + /* K31 */ be_nested_str_weak(add_subtype), + /* K32 */ be_nested_str_weak(_S), + /* K33 */ be_nested_str_weak(_V), + /* K34 */ be_nested_str_weak(_CM1), + /* K35 */ be_nested_str_weak(hostname_wifi), + /* K36 */ be_nested_str_weak(mdns_pase_wifi), + /* K37 */ be_nested_str_weak(MTR_X3A_X20starting_X20mDNS_X20on_X20_X25s_X20_X27_X25s_X27_X20ptr_X20to_X20_X60_X25s_X2Elocal_X60), + /* K38 */ be_nested_str_weak(wifi), + /* K39 */ be_nested_str_weak(MTR_X3A_X20Exception), + /* K40 */ be_nested_str_weak(_X7C), + }), + be_str_weak(mdns_announce_PASE), + &be_const_str_solidified, + ( &(const binstruction[236]) { /* code */ + 0xA4060000, // 0000 IMPORT R1 K0 + 0xA40A0200, // 0001 IMPORT R2 K1 + 0x600C0013, // 0002 GETGBL R3 G19 + 0x7C0C0000, // 0003 CALL R3 0 + 0x60100008, // 0004 GETGBL R4 G8 + 0x88140103, // 0005 GETMBR R5 R0 K3 + 0x7C100200, // 0006 CALL R4 1 + 0x00100904, // 0007 ADD R4 R4 K4 + 0x60140008, // 0008 GETGBL R5 G8 + 0x88180105, // 0009 GETMBR R6 R0 K5 + 0x7C140200, // 000A CALL R5 1 + 0x00100805, // 000B ADD R4 R4 R5 + 0x980E0404, // 000C SETIDX R3 K2 R4 + 0x88100107, // 000D GETMBR R4 R0 K7 + 0x980E0C04, // 000E SETIDX R3 K6 R4 + 0x980E1109, // 000F SETIDX R3 K8 K9 + 0x980E150B, // 0010 SETIDX R3 K10 K11 + 0x54121387, // 0011 LDINT R4 5000 + 0x980E1804, // 0012 SETIDX R3 K12 R4 + 0x5412012B, // 0013 LDINT R4 300 + 0x980E1A04, // 0014 SETIDX R3 K13 R4 + 0x8C10050F, // 0015 GETMET R4 R2 K15 + 0x541A0007, // 0016 LDINT R6 8 + 0x7C100400, // 0017 CALL R4 2 + 0x8C100910, // 0018 GETMET R4 R4 K16 + 0x7C100200, // 0019 CALL R4 1 + 0x90021C04, // 001A SETMBR R0 K14 R4 + 0x8C10050F, // 001B GETMET R4 R2 K15 + 0x541A0007, // 001C LDINT R6 8 + 0x7C100400, // 001D CALL R4 2 + 0x8C100910, // 001E GETMET R4 R4 K16 + 0x7C100200, // 001F CALL R4 1 + 0x90022204, // 0020 SETMBR R0 K17 R4 + 0xA80200B7, // 0021 EXBLK 0 #00DA + 0x88100112, // 0022 GETMBR R4 R0 K18 + 0x78120058, // 0023 JMPF R4 #007D + 0x8C100313, // 0024 GETMET R4 R1 K19 + 0x58180014, // 0025 LDCONST R6 K20 + 0x581C0015, // 0026 LDCONST R7 K21 + 0x542215A3, // 0027 LDINT R8 5540 + 0x5C240600, // 0028 MOVE R9 R3 + 0x88280111, // 0029 GETMBR R10 R0 K17 + 0x882C0112, // 002A GETMBR R11 R0 K18 + 0x7C100E00, // 002B CALL R4 7 + 0x50100200, // 002C LDBOOL R4 1 0 + 0x90022C04, // 002D SETMBR R0 K22 R4 + 0xB8122E00, // 002E GETNGBL R4 K23 + 0x8C100918, // 002F GETMET R4 R4 K24 + 0x60180018, // 0030 GETGBL R6 G24 + 0x581C0019, // 0031 LDCONST R7 K25 + 0x5820001A, // 0032 LDCONST R8 K26 + 0x88240111, // 0033 GETMBR R9 R0 K17 + 0x88280112, // 0034 GETMBR R10 R0 K18 + 0x7C180800, // 0035 CALL R6 4 + 0x581C001B, // 0036 LDCONST R7 K27 + 0x7C100600, // 0037 CALL R4 3 + 0x60100008, // 0038 GETGBL R4 G8 + 0x88140107, // 0039 GETMBR R5 R0 K7 + 0x541A0FFE, // 003A LDINT R6 4095 + 0x2C140A06, // 003B AND R5 R5 R6 + 0x7C100200, // 003C CALL R4 1 + 0x00123804, // 003D ADD R4 K28 R4 + 0xB8162E00, // 003E GETNGBL R5 K23 + 0x8C140B18, // 003F GETMET R5 R5 K24 + 0x001E3A04, // 0040 ADD R7 K29 R4 + 0x5820001E, // 0041 LDCONST R8 K30 + 0x7C140600, // 0042 CALL R5 3 + 0x8C14031F, // 0043 GETMET R5 R1 K31 + 0x581C0014, // 0044 LDCONST R7 K20 + 0x58200015, // 0045 LDCONST R8 K21 + 0x88240111, // 0046 GETMBR R9 R0 K17 + 0x88280112, // 0047 GETMBR R10 R0 K18 + 0x5C2C0800, // 0048 MOVE R11 R4 + 0x7C140C00, // 0049 CALL R5 6 + 0x60140008, // 004A GETGBL R5 G8 + 0x88180107, // 004B GETMBR R6 R0 K7 + 0x541E0EFF, // 004C LDINT R7 3840 + 0x2C180C07, // 004D AND R6 R6 R7 + 0x541E0007, // 004E LDINT R7 8 + 0x3C180C07, // 004F SHR R6 R6 R7 + 0x7C140200, // 0050 CALL R5 1 + 0x00164005, // 0051 ADD R5 K32 R5 + 0x5C100A00, // 0052 MOVE R4 R5 + 0xB8162E00, // 0053 GETNGBL R5 K23 + 0x8C140B18, // 0054 GETMET R5 R5 K24 + 0x001E3A04, // 0055 ADD R7 K29 R4 + 0x5820001E, // 0056 LDCONST R8 K30 + 0x7C140600, // 0057 CALL R5 3 + 0x8C14031F, // 0058 GETMET R5 R1 K31 + 0x581C0014, // 0059 LDCONST R7 K20 + 0x58200015, // 005A LDCONST R8 K21 + 0x88240111, // 005B GETMBR R9 R0 K17 + 0x88280112, // 005C GETMBR R10 R0 K18 + 0x5C2C0800, // 005D MOVE R11 R4 + 0x7C140C00, // 005E CALL R5 6 + 0x60140008, // 005F GETGBL R5 G8 + 0x88180103, // 0060 GETMBR R6 R0 K3 + 0x7C140200, // 0061 CALL R5 1 + 0x00164205, // 0062 ADD R5 K33 R5 + 0x5C100A00, // 0063 MOVE R4 R5 + 0xB8162E00, // 0064 GETNGBL R5 K23 + 0x8C140B18, // 0065 GETMET R5 R5 K24 + 0x001E3A04, // 0066 ADD R7 K29 R4 + 0x5820001E, // 0067 LDCONST R8 K30 + 0x7C140600, // 0068 CALL R5 3 + 0x8C14031F, // 0069 GETMET R5 R1 K31 + 0x581C0014, // 006A LDCONST R7 K20 + 0x58200015, // 006B LDCONST R8 K21 + 0x88240111, // 006C GETMBR R9 R0 K17 + 0x88280112, // 006D GETMBR R10 R0 K18 + 0x5C2C0800, // 006E MOVE R11 R4 + 0x7C140C00, // 006F CALL R5 6 + 0x58100022, // 0070 LDCONST R4 K34 + 0xB8162E00, // 0071 GETNGBL R5 K23 + 0x8C140B18, // 0072 GETMET R5 R5 K24 + 0x001E3A04, // 0073 ADD R7 K29 R4 + 0x5820001E, // 0074 LDCONST R8 K30 + 0x7C140600, // 0075 CALL R5 3 + 0x8C14031F, // 0076 GETMET R5 R1 K31 + 0x581C0014, // 0077 LDCONST R7 K20 + 0x58200015, // 0078 LDCONST R8 K21 + 0x88240111, // 0079 GETMBR R9 R0 K17 + 0x88280112, // 007A GETMBR R10 R0 K18 + 0x5C2C0800, // 007B MOVE R11 R4 + 0x7C140C00, // 007C CALL R5 6 + 0x88100123, // 007D GETMBR R4 R0 K35 + 0x78120058, // 007E JMPF R4 #00D8 + 0x8C100313, // 007F GETMET R4 R1 K19 + 0x58180014, // 0080 LDCONST R6 K20 + 0x581C0015, // 0081 LDCONST R7 K21 + 0x542215A3, // 0082 LDINT R8 5540 + 0x5C240600, // 0083 MOVE R9 R3 + 0x8828010E, // 0084 GETMBR R10 R0 K14 + 0x882C0123, // 0085 GETMBR R11 R0 K35 + 0x7C100E00, // 0086 CALL R4 7 + 0x50100200, // 0087 LDBOOL R4 1 0 + 0x90024804, // 0088 SETMBR R0 K36 R4 + 0xB8122E00, // 0089 GETNGBL R4 K23 + 0x8C100918, // 008A GETMET R4 R4 K24 + 0x60180018, // 008B GETGBL R6 G24 + 0x581C0025, // 008C LDCONST R7 K37 + 0x58200026, // 008D LDCONST R8 K38 + 0x8824010E, // 008E GETMBR R9 R0 K14 + 0x88280123, // 008F GETMBR R10 R0 K35 + 0x7C180800, // 0090 CALL R6 4 + 0x581C001E, // 0091 LDCONST R7 K30 + 0x7C100600, // 0092 CALL R4 3 + 0x60100008, // 0093 GETGBL R4 G8 + 0x88140107, // 0094 GETMBR R5 R0 K7 + 0x541A0FFE, // 0095 LDINT R6 4095 + 0x2C140A06, // 0096 AND R5 R5 R6 + 0x7C100200, // 0097 CALL R4 1 + 0x00123804, // 0098 ADD R4 K28 R4 + 0xB8162E00, // 0099 GETNGBL R5 K23 + 0x8C140B18, // 009A GETMET R5 R5 K24 + 0x001E3A04, // 009B ADD R7 K29 R4 + 0x5820001E, // 009C LDCONST R8 K30 + 0x7C140600, // 009D CALL R5 3 + 0x8C14031F, // 009E GETMET R5 R1 K31 + 0x581C0014, // 009F LDCONST R7 K20 + 0x58200015, // 00A0 LDCONST R8 K21 + 0x8824010E, // 00A1 GETMBR R9 R0 K14 + 0x88280123, // 00A2 GETMBR R10 R0 K35 + 0x5C2C0800, // 00A3 MOVE R11 R4 + 0x7C140C00, // 00A4 CALL R5 6 + 0x60140008, // 00A5 GETGBL R5 G8 + 0x88180107, // 00A6 GETMBR R6 R0 K7 + 0x541E0EFF, // 00A7 LDINT R7 3840 + 0x2C180C07, // 00A8 AND R6 R6 R7 + 0x541E0007, // 00A9 LDINT R7 8 + 0x3C180C07, // 00AA SHR R6 R6 R7 + 0x7C140200, // 00AB CALL R5 1 + 0x00164005, // 00AC ADD R5 K32 R5 + 0x5C100A00, // 00AD MOVE R4 R5 + 0xB8162E00, // 00AE GETNGBL R5 K23 + 0x8C140B18, // 00AF GETMET R5 R5 K24 + 0x001E3A04, // 00B0 ADD R7 K29 R4 + 0x5820001E, // 00B1 LDCONST R8 K30 + 0x7C140600, // 00B2 CALL R5 3 + 0x8C14031F, // 00B3 GETMET R5 R1 K31 + 0x581C0014, // 00B4 LDCONST R7 K20 + 0x58200015, // 00B5 LDCONST R8 K21 + 0x8824010E, // 00B6 GETMBR R9 R0 K14 + 0x88280123, // 00B7 GETMBR R10 R0 K35 + 0x5C2C0800, // 00B8 MOVE R11 R4 + 0x7C140C00, // 00B9 CALL R5 6 + 0x60140008, // 00BA GETGBL R5 G8 + 0x88180103, // 00BB GETMBR R6 R0 K3 + 0x7C140200, // 00BC CALL R5 1 + 0x00164205, // 00BD ADD R5 K33 R5 + 0x5C100A00, // 00BE MOVE R4 R5 + 0xB8162E00, // 00BF GETNGBL R5 K23 + 0x8C140B18, // 00C0 GETMET R5 R5 K24 + 0x001E3A04, // 00C1 ADD R7 K29 R4 + 0x5820001E, // 00C2 LDCONST R8 K30 + 0x7C140600, // 00C3 CALL R5 3 + 0x8C14031F, // 00C4 GETMET R5 R1 K31 + 0x581C0014, // 00C5 LDCONST R7 K20 + 0x58200015, // 00C6 LDCONST R8 K21 + 0x8824010E, // 00C7 GETMBR R9 R0 K14 + 0x88280123, // 00C8 GETMBR R10 R0 K35 + 0x5C2C0800, // 00C9 MOVE R11 R4 + 0x7C140C00, // 00CA CALL R5 6 + 0x58100022, // 00CB LDCONST R4 K34 + 0xB8162E00, // 00CC GETNGBL R5 K23 + 0x8C140B18, // 00CD GETMET R5 R5 K24 + 0x001E3A04, // 00CE ADD R7 K29 R4 + 0x5820001E, // 00CF LDCONST R8 K30 + 0x7C140600, // 00D0 CALL R5 3 + 0x8C14031F, // 00D1 GETMET R5 R1 K31 + 0x581C0014, // 00D2 LDCONST R7 K20 + 0x58200015, // 00D3 LDCONST R8 K21 + 0x8824010E, // 00D4 GETMBR R9 R0 K14 + 0x88280123, // 00D5 GETMBR R10 R0 K35 + 0x5C2C0800, // 00D6 MOVE R11 R4 + 0x7C140C00, // 00D7 CALL R5 6 + 0xA8040001, // 00D8 EXBLK 1 1 + 0x70020010, // 00D9 JMP #00EB + 0xAC100002, // 00DA CATCH R4 0 2 + 0x7002000D, // 00DB JMP #00EA + 0xB81A2E00, // 00DC GETNGBL R6 K23 + 0x8C180D18, // 00DD GETMET R6 R6 K24 + 0x60200008, // 00DE GETGBL R8 G8 + 0x5C240800, // 00DF MOVE R9 R4 + 0x7C200200, // 00E0 CALL R8 1 + 0x00224E08, // 00E1 ADD R8 K39 R8 + 0x00201128, // 00E2 ADD R8 R8 K40 + 0x60240008, // 00E3 GETGBL R9 G8 + 0x5C280A00, // 00E4 MOVE R10 R5 + 0x7C240200, // 00E5 CALL R9 1 + 0x00201009, // 00E6 ADD R8 R8 R9 + 0x5824001B, // 00E7 LDCONST R9 K27 + 0x7C180600, // 00E8 CALL R6 3 + 0x70020000, // 00E9 JMP #00EB + 0xB0080000, // 00EA RAISE 2 R0 R0 + 0x80000000, // 00EB RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: start_commissioning_complete +********************************************************************/ +be_local_closure(Matter_Device_start_commissioning_complete, /* name */ + be_nested_proto( + 11, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[11]) { /* constants */ + /* K0 */ be_nested_str_weak(get_fabric), + /* K1 */ be_nested_str_weak(get_fabric_id), + /* K2 */ be_nested_str_weak(copy), + /* K3 */ be_nested_str_weak(reverse), + /* K4 */ be_nested_str_weak(tohex), + /* K5 */ be_nested_str_weak(get_admin_vendor_name), + /* K6 */ be_nested_str_weak(tasmota), + /* K7 */ be_nested_str_weak(log), + /* K8 */ be_nested_str_weak(MTR_X3A_X20_X2D_X2D_X2D_X20Commissioning_X20complete_X20for_X20Fabric_X20_X27_X25s_X27_X20_X28Vendor_X20_X25s_X29_X20_X2D_X2D_X2D), + /* K9 */ be_const_int(2), + /* K10 */ be_nested_str_weak(stop_basic_commissioning), + }), + be_str_weak(start_commissioning_complete), + &be_const_str_solidified, + ( &(const binstruction[24]) { /* code */ + 0x8C080300, // 0000 GETMET R2 R1 K0 + 0x7C080200, // 0001 CALL R2 1 + 0x8C0C0501, // 0002 GETMET R3 R2 K1 + 0x7C0C0200, // 0003 CALL R3 1 + 0x8C0C0702, // 0004 GETMET R3 R3 K2 + 0x7C0C0200, // 0005 CALL R3 1 + 0x8C0C0703, // 0006 GETMET R3 R3 K3 + 0x7C0C0200, // 0007 CALL R3 1 + 0x8C0C0704, // 0008 GETMET R3 R3 K4 + 0x7C0C0200, // 0009 CALL R3 1 + 0x8C100505, // 000A GETMET R4 R2 K5 + 0x7C100200, // 000B CALL R4 1 + 0xB8160C00, // 000C GETNGBL R5 K6 + 0x8C140B07, // 000D GETMET R5 R5 K7 + 0x601C0018, // 000E GETGBL R7 G24 + 0x58200008, // 000F LDCONST R8 K8 + 0x5C240600, // 0010 MOVE R9 R3 + 0x5C280800, // 0011 MOVE R10 R4 + 0x7C1C0600, // 0012 CALL R7 3 + 0x58200009, // 0013 LDCONST R8 K9 + 0x7C140600, // 0014 CALL R5 3 + 0x8C14010A, // 0015 GETMET R5 R0 K10 + 0x7C140200, // 0016 CALL R5 1 + 0x80000000, // 0017 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: MtrInfo +********************************************************************/ +be_local_closure(Matter_Device_MtrInfo, /* name */ + be_nested_proto( + 10, /* nstack */ + 5, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 9]) { /* constants */ + /* K0 */ be_nested_str_weak(), + /* K1 */ be_nested_str_weak(plugins), + /* K2 */ be_nested_str_weak(MtrInfo_one), + /* K3 */ be_nested_str_weak(endpoint), + /* K4 */ be_nested_str_weak(stop_iteration), + /* K5 */ be_nested_str_weak(int), + /* K6 */ be_nested_str_weak(find_plugin_by_friendly_name), + /* K7 */ be_nested_str_weak(tasmota), + /* K8 */ be_nested_str_weak(resp_cmnd_done), + }), + be_str_weak(MtrInfo), + &be_const_str_solidified, + ( &(const binstruction[40]) { /* code */ + 0x1C140700, // 0000 EQ R5 R3 K0 + 0x7815FFFF, // 0001 JMPF R5 #0002 + 0x1C140700, // 0002 EQ R5 R3 K0 + 0x7816000D, // 0003 JMPF R5 #0012 + 0x60140010, // 0004 GETGBL R5 G16 + 0x88180101, // 0005 GETMBR R6 R0 K1 + 0x7C140200, // 0006 CALL R5 1 + 0xA8020005, // 0007 EXBLK 0 #000E + 0x5C180A00, // 0008 MOVE R6 R5 + 0x7C180000, // 0009 CALL R6 0 + 0x8C1C0102, // 000A GETMET R7 R0 K2 + 0x88240D03, // 000B GETMBR R9 R6 K3 + 0x7C1C0400, // 000C CALL R7 2 + 0x7001FFF9, // 000D JMP #0008 + 0x58140004, // 000E LDCONST R5 K4 + 0xAC140200, // 000F CATCH R5 1 0 + 0xB0080000, // 0010 RAISE 2 R0 R0 + 0x70020011, // 0011 JMP #0024 + 0x60140004, // 0012 GETGBL R5 G4 + 0x5C180800, // 0013 MOVE R6 R4 + 0x7C140200, // 0014 CALL R5 1 + 0x1C140B05, // 0015 EQ R5 R5 K5 + 0x78160003, // 0016 JMPF R5 #001B + 0x8C140102, // 0017 GETMET R5 R0 K2 + 0x5C1C0800, // 0018 MOVE R7 R4 + 0x7C140400, // 0019 CALL R5 2 + 0x70020008, // 001A JMP #0024 + 0x8C140106, // 001B GETMET R5 R0 K6 + 0x5C1C0600, // 001C MOVE R7 R3 + 0x7C140400, // 001D CALL R5 2 + 0x4C180000, // 001E LDNIL R6 + 0x20180A06, // 001F NE R6 R5 R6 + 0x781A0002, // 0020 JMPF R6 #0024 + 0x8C180102, // 0021 GETMET R6 R0 K2 + 0x88200B03, // 0022 GETMBR R8 R5 K3 + 0x7C180400, // 0023 CALL R6 2 + 0xB8160E00, // 0024 GETNGBL R5 K7 + 0x8C140B08, // 0025 GETMET R5 R5 K8 + 0x7C140200, // 0026 CALL R5 1 + 0x80000000, // 0027 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: MtrUpdate +********************************************************************/ +be_local_closure(Matter_Device_MtrUpdate, /* name */ + be_nested_proto( + 18, /* nstack */ + 5, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[25]) { /* constants */ + /* K0 */ be_nested_str_weak(tasmota), + /* K1 */ be_nested_str_weak(resp_cmnd_str), + /* K2 */ be_nested_str_weak(Invalid_X20JSON), + /* K3 */ be_nested_str_weak(find_key_i), + /* K4 */ be_nested_str_weak(Ep), + /* K5 */ be_nested_str_weak(Name), + /* K6 */ be_const_int(0), + /* K7 */ be_nested_str_weak(Invalid_X20_X27Ep_X27_X20attribute), + /* K8 */ be_nested_str_weak(find_plugin_by_endpoint), + /* K9 */ be_nested_str_weak(remove), + /* K10 */ be_nested_str_weak(find_plugin_by_friendly_name), + /* K11 */ be_nested_str_weak(Invalid_X20Device), + /* K12 */ be_nested_str_weak(VIRTUAL), + /* K13 */ be_nested_str_weak(Device_X20is_X20not_X20virtual), + /* K14 */ be_nested_str_weak(consolidate_update_commands), + /* K15 */ be_nested_str_weak(keys), + /* K16 */ be_nested_str_weak(find_list_i), + /* K17 */ be_nested_str_weak(Invalid_X20attribute_X20_X27_X25s_X27), + /* K18 */ be_nested_str_weak(stop_iteration), + /* K19 */ be_nested_str_weak(update_virtual), + /* K20 */ be_nested_str_weak(state_json), + /* K21 */ be_nested_str_weak(_X7B_X22_X25s_X22_X3A_X25s_X7D), + /* K22 */ be_nested_str_weak(resp_cmnd), + /* K23 */ be_nested_str_weak(resp_cmnd_done), + /* K24 */ be_nested_str_weak(Missing_X20_X27Device_X27_X20attribute), + }), + be_str_weak(MtrUpdate), + &be_const_str_solidified, + ( &(const binstruction[126]) { /* code */ + 0x4C140000, // 0000 LDNIL R5 + 0x1C140805, // 0001 EQ R5 R4 R5 + 0x78160004, // 0002 JMPF R5 #0008 + 0xB8160000, // 0003 GETNGBL R5 K0 + 0x8C140B01, // 0004 GETMET R5 R5 K1 + 0x581C0002, // 0005 LDCONST R7 K2 + 0x7C140400, // 0006 CALL R5 2 + 0x80040A00, // 0007 RET 1 R5 + 0xB8160000, // 0008 GETNGBL R5 K0 + 0x8C140B03, // 0009 GETMET R5 R5 K3 + 0x5C1C0800, // 000A MOVE R7 R4 + 0x58200004, // 000B LDCONST R8 K4 + 0x7C140600, // 000C CALL R5 3 + 0xB81A0000, // 000D GETNGBL R6 K0 + 0x8C180D03, // 000E GETMET R6 R6 K3 + 0x5C200800, // 000F MOVE R8 R4 + 0x58240005, // 0010 LDCONST R9 K5 + 0x7C180600, // 0011 CALL R6 3 + 0x74160000, // 0012 JMPT R5 #0014 + 0x781A0064, // 0013 JMPF R6 #0079 + 0x4C1C0000, // 0014 LDNIL R7 + 0x78160010, // 0015 JMPF R5 #0027 + 0x60200009, // 0016 GETGBL R8 G9 + 0x94240805, // 0017 GETIDX R9 R4 R5 + 0x7C200200, // 0018 CALL R8 1 + 0x18241106, // 0019 LE R9 R8 K6 + 0x78260004, // 001A JMPF R9 #0020 + 0xB8260000, // 001B GETNGBL R9 K0 + 0x8C241301, // 001C GETMET R9 R9 K1 + 0x582C0007, // 001D LDCONST R11 K7 + 0x7C240400, // 001E CALL R9 2 + 0x80041200, // 001F RET 1 R9 + 0x8C240108, // 0020 GETMET R9 R0 K8 + 0x5C2C1000, // 0021 MOVE R11 R8 + 0x7C240400, // 0022 CALL R9 2 + 0x5C1C1200, // 0023 MOVE R7 R9 + 0x8C240909, // 0024 GETMET R9 R4 K9 + 0x5C2C0A00, // 0025 MOVE R11 R5 + 0x7C240400, // 0026 CALL R9 2 + 0x781A0009, // 0027 JMPF R6 #0032 + 0x4C200000, // 0028 LDNIL R8 + 0x1C200E08, // 0029 EQ R8 R7 R8 + 0x78220003, // 002A JMPF R8 #002F + 0x8C20010A, // 002B GETMET R8 R0 K10 + 0x94280806, // 002C GETIDX R10 R4 R6 + 0x7C200400, // 002D CALL R8 2 + 0x5C1C1000, // 002E MOVE R7 R8 + 0x8C200909, // 002F GETMET R8 R4 K9 + 0x5C280C00, // 0030 MOVE R10 R6 + 0x7C200400, // 0031 CALL R8 2 + 0x4C200000, // 0032 LDNIL R8 + 0x1C200E08, // 0033 EQ R8 R7 R8 + 0x78220004, // 0034 JMPF R8 #003A + 0xB8220000, // 0035 GETNGBL R8 K0 + 0x8C201101, // 0036 GETMET R8 R8 K1 + 0x5828000B, // 0037 LDCONST R10 K11 + 0x7C200400, // 0038 CALL R8 2 + 0x80041000, // 0039 RET 1 R8 + 0x88200F0C, // 003A GETMBR R8 R7 K12 + 0x74220004, // 003B JMPT R8 #0041 + 0xB8220000, // 003C GETNGBL R8 K0 + 0x8C201101, // 003D GETMET R8 R8 K1 + 0x5828000D, // 003E LDCONST R10 K13 + 0x7C200400, // 003F CALL R8 2 + 0x80041000, // 0040 RET 1 R8 + 0x8C200F0E, // 0041 GETMET R8 R7 K14 + 0x7C200200, // 0042 CALL R8 1 + 0x60240013, // 0043 GETGBL R9 G19 + 0x7C240000, // 0044 CALL R9 0 + 0x60280010, // 0045 GETGBL R10 G16 + 0x8C2C090F, // 0046 GETMET R11 R4 K15 + 0x7C2C0200, // 0047 CALL R11 1 + 0x7C280200, // 0048 CALL R10 1 + 0xA8020016, // 0049 EXBLK 0 #0061 + 0x5C2C1400, // 004A MOVE R11 R10 + 0x7C2C0000, // 004B CALL R11 0 + 0xB8320000, // 004C GETNGBL R12 K0 + 0x8C301910, // 004D GETMET R12 R12 K16 + 0x5C381000, // 004E MOVE R14 R8 + 0x5C3C1600, // 004F MOVE R15 R11 + 0x7C300600, // 0050 CALL R12 3 + 0x4C340000, // 0051 LDNIL R13 + 0x1C34180D, // 0052 EQ R13 R12 R13 + 0x78360008, // 0053 JMPF R13 #005D + 0xB8360000, // 0054 GETNGBL R13 K0 + 0x8C341B01, // 0055 GETMET R13 R13 K1 + 0x603C0018, // 0056 GETGBL R15 G24 + 0x58400011, // 0057 LDCONST R16 K17 + 0x5C441600, // 0058 MOVE R17 R11 + 0x7C3C0400, // 0059 CALL R15 2 + 0x7C340400, // 005A CALL R13 2 + 0xA8040001, // 005B EXBLK 1 1 + 0x80001A00, // 005C RET 0 + 0x9434100C, // 005D GETIDX R13 R8 R12 + 0x9438080B, // 005E GETIDX R14 R4 R11 + 0x98241A0E, // 005F SETIDX R9 R13 R14 + 0x7001FFE8, // 0060 JMP #004A + 0x58280012, // 0061 LDCONST R10 K18 + 0xAC280200, // 0062 CATCH R10 1 0 + 0xB0080000, // 0063 RAISE 2 R0 R0 + 0x8C280F13, // 0064 GETMET R10 R7 K19 + 0x5C301200, // 0065 MOVE R12 R9 + 0x7C280400, // 0066 CALL R10 2 + 0x8C280F14, // 0067 GETMET R10 R7 K20 + 0x7C280200, // 0068 CALL R10 1 + 0x782A000A, // 0069 JMPF R10 #0075 + 0x602C0018, // 006A GETGBL R11 G24 + 0x58300015, // 006B LDCONST R12 K21 + 0x5C340200, // 006C MOVE R13 R1 + 0x5C381400, // 006D MOVE R14 R10 + 0x7C2C0600, // 006E CALL R11 3 + 0xB8320000, // 006F GETNGBL R12 K0 + 0x8C301916, // 0070 GETMET R12 R12 K22 + 0x5C381600, // 0071 MOVE R14 R11 + 0x7C300400, // 0072 CALL R12 2 + 0x80041800, // 0073 RET 1 R12 + 0x70020003, // 0074 JMP #0079 + 0xB82E0000, // 0075 GETNGBL R11 K0 + 0x8C2C1717, // 0076 GETMET R11 R11 K23 + 0x7C2C0200, // 0077 CALL R11 1 + 0x80041600, // 0078 RET 1 R11 + 0xB81E0000, // 0079 GETNGBL R7 K0 + 0x8C1C0F01, // 007A GETMET R7 R7 K1 + 0x58240018, // 007B LDCONST R9 K24 + 0x7C1C0400, // 007C CALL R7 2 + 0x80000000, // 007D RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: MtrJoin +********************************************************************/ +be_local_closure(Matter_Device_MtrJoin, /* name */ + be_nested_proto( + 8, /* nstack */ + 5, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 4]) { /* constants */ + /* K0 */ be_nested_str_weak(start_root_basic_commissioning), + /* K1 */ be_nested_str_weak(stop_basic_commissioning), + /* K2 */ be_nested_str_weak(tasmota), + /* K3 */ be_nested_str_weak(resp_cmnd_done), + }), + be_str_weak(MtrJoin), + &be_const_str_solidified, + ( &(const binstruction[13]) { /* code */ + 0x60140009, // 0000 GETGBL R5 G9 + 0x5C180600, // 0001 MOVE R6 R3 + 0x7C140200, // 0002 CALL R5 1 + 0x78160002, // 0003 JMPF R5 #0007 + 0x8C180100, // 0004 GETMET R6 R0 K0 + 0x7C180200, // 0005 CALL R6 1 + 0x70020001, // 0006 JMP #0009 + 0x8C180101, // 0007 GETMET R6 R0 K1 + 0x7C180200, // 0008 CALL R6 1 + 0xB81A0400, // 0009 GETNGBL R6 K2 + 0x8C180D03, // 000A GETMET R6 R6 K3 + 0x7C180200, // 000B CALL R6 1 + 0x80000000, // 000C RET 0 }) ) ); @@ -4244,98 +5605,9 @@ be_local_closure(Matter_Device_process_attribute_expansion, /* name */ /******************************************************************** -** Solidified function: is_commissioning_open +** Solidified function: find_plugin_by_friendly_name ********************************************************************/ -be_local_closure(Matter_Device_is_commissioning_open, /* name */ - be_nested_proto( - 3, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str_weak(commissioning_open), - }), - be_str_weak(is_commissioning_open), - &be_const_str_solidified, - ( &(const binstruction[ 4]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x4C080000, // 0001 LDNIL R2 - 0x20040202, // 0002 NE R1 R1 R2 - 0x80040200, // 0003 RET 1 R1 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: start_commissioning_complete_deferred -********************************************************************/ -be_local_closure(Matter_Device_start_commissioning_complete_deferred, /* name */ - be_nested_proto( - 6, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 1, /* has sup protos */ - ( &(const struct bproto*[ 1]) { - be_nested_proto( - 3, /* nstack */ - 0, /* argc */ - 0, /* varg */ - 1, /* has upvals */ - ( &(const bupvaldesc[ 2]) { /* upvals */ - be_local_const_upval(1, 0), - be_local_const_upval(1, 1), - }), - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str_weak(start_commissioning_complete), - }), - be_str_weak(_X3Clambda_X3E), - &be_const_str_solidified, - ( &(const binstruction[ 5]) { /* code */ - 0x68000000, // 0000 GETUPV R0 U0 - 0x8C000100, // 0001 GETMET R0 R0 K0 - 0x68080001, // 0002 GETUPV R2 U1 - 0x7C000400, // 0003 CALL R0 2 - 0x80040000, // 0004 RET 1 R0 - }) - ), - }), - 1, /* has constants */ - ( &(const bvalue[ 3]) { /* constants */ - /* K0 */ be_nested_str_weak(tasmota), - /* K1 */ be_nested_str_weak(set_timer), - /* K2 */ be_const_int(0), - }), - be_str_weak(start_commissioning_complete_deferred), - &be_const_str_solidified, - ( &(const binstruction[ 7]) { /* code */ - 0xB80A0000, // 0000 GETNGBL R2 K0 - 0x8C080501, // 0001 GETMET R2 R2 K1 - 0x58100002, // 0002 LDCONST R4 K2 - 0x84140000, // 0003 CLOSURE R5 P0 - 0x7C080600, // 0004 CALL R2 3 - 0xA0000000, // 0005 CLOSE R0 - 0x80000000, // 0006 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: start_operational_discovery -********************************************************************/ -be_local_closure(Matter_Device_start_operational_discovery, /* name */ +be_local_closure(Matter_Device_find_plugin_by_friendly_name, /* name */ be_nested_proto( 7, /* nstack */ 2, /* argc */ @@ -4345,1389 +5617,50 @@ be_local_closure(Matter_Device_start_operational_discovery, /* name */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[ 6]) { /* constants */ - /* K0 */ be_nested_str_weak(crypto), - /* K1 */ be_nested_str_weak(mdns), - /* K2 */ be_nested_str_weak(stop_basic_commissioning), - /* K3 */ be_nested_str_weak(root_w0), - /* K4 */ be_nested_str_weak(root_L), - /* K5 */ be_nested_str_weak(mdns_announce_op_discovery), - }), - be_str_weak(start_operational_discovery), - &be_const_str_solidified, - ( &(const binstruction[12]) { /* code */ - 0xA40A0000, // 0000 IMPORT R2 K0 - 0xA40E0200, // 0001 IMPORT R3 K1 - 0x8C100102, // 0002 GETMET R4 R0 K2 - 0x7C100200, // 0003 CALL R4 1 - 0x4C100000, // 0004 LDNIL R4 - 0x90020604, // 0005 SETMBR R0 K3 R4 - 0x4C100000, // 0006 LDNIL R4 - 0x90020804, // 0007 SETMBR R0 K4 R4 - 0x8C100105, // 0008 GETMET R4 R0 K5 - 0x5C180200, // 0009 MOVE R6 R1 - 0x7C100400, // 000A CALL R4 2 - 0x80000000, // 000B RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: MtrInfo -********************************************************************/ -be_local_closure(Matter_Device_MtrInfo, /* name */ - be_nested_proto( - 10, /* nstack */ - 5, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 9]) { /* constants */ - /* K0 */ be_nested_str_weak(), - /* K1 */ be_nested_str_weak(plugins), - /* K2 */ be_nested_str_weak(MtrInfo_one), - /* K3 */ be_nested_str_weak(endpoint), - /* K4 */ be_nested_str_weak(stop_iteration), - /* K5 */ be_nested_str_weak(int), - /* K6 */ be_nested_str_weak(find_plugin_by_friendly_name), - /* K7 */ be_nested_str_weak(tasmota), - /* K8 */ be_nested_str_weak(resp_cmnd_done), - }), - be_str_weak(MtrInfo), - &be_const_str_solidified, - ( &(const binstruction[40]) { /* code */ - 0x1C140700, // 0000 EQ R5 R3 K0 - 0x7815FFFF, // 0001 JMPF R5 #0002 - 0x1C140700, // 0002 EQ R5 R3 K0 - 0x7816000D, // 0003 JMPF R5 #0012 - 0x60140010, // 0004 GETGBL R5 G16 - 0x88180101, // 0005 GETMBR R6 R0 K1 - 0x7C140200, // 0006 CALL R5 1 - 0xA8020005, // 0007 EXBLK 0 #000E - 0x5C180A00, // 0008 MOVE R6 R5 - 0x7C180000, // 0009 CALL R6 0 - 0x8C1C0102, // 000A GETMET R7 R0 K2 - 0x88240D03, // 000B GETMBR R9 R6 K3 - 0x7C1C0400, // 000C CALL R7 2 - 0x7001FFF9, // 000D JMP #0008 - 0x58140004, // 000E LDCONST R5 K4 - 0xAC140200, // 000F CATCH R5 1 0 - 0xB0080000, // 0010 RAISE 2 R0 R0 - 0x70020011, // 0011 JMP #0024 - 0x60140004, // 0012 GETGBL R5 G4 - 0x5C180800, // 0013 MOVE R6 R4 - 0x7C140200, // 0014 CALL R5 1 - 0x1C140B05, // 0015 EQ R5 R5 K5 - 0x78160003, // 0016 JMPF R5 #001B - 0x8C140102, // 0017 GETMET R5 R0 K2 - 0x5C1C0800, // 0018 MOVE R7 R4 - 0x7C140400, // 0019 CALL R5 2 - 0x70020008, // 001A JMP #0024 - 0x8C140106, // 001B GETMET R5 R0 K6 - 0x5C1C0600, // 001C MOVE R7 R3 - 0x7C140400, // 001D CALL R5 2 - 0x4C180000, // 001E LDNIL R6 - 0x20180A06, // 001F NE R6 R5 R6 - 0x781A0002, // 0020 JMPF R6 #0024 - 0x8C180102, // 0021 GETMET R6 R0 K2 - 0x88200B03, // 0022 GETMBR R8 R5 K3 - 0x7C180400, // 0023 CALL R6 2 - 0xB8160E00, // 0024 GETNGBL R5 K7 - 0x8C140B08, // 0025 GETMET R5 R5 K8 - 0x7C140200, // 0026 CALL R5 1 - 0x80000000, // 0027 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: mdns_announce_op_discovery -********************************************************************/ -be_local_closure(Matter_Device_mdns_announce_op_discovery, /* name */ - be_nested_proto( - 14, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[27]) { /* constants */ - /* K0 */ be_nested_str_weak(mdns), - /* K1 */ be_nested_str_weak(get_device_id), - /* K2 */ be_nested_str_weak(copy), - /* K3 */ be_nested_str_weak(reverse), - /* K4 */ be_nested_str_weak(get_fabric_compressed), - /* K5 */ be_nested_str_weak(tohex), - /* K6 */ be_nested_str_weak(_X2D), - /* K7 */ be_nested_str_weak(tasmota), - /* K8 */ be_nested_str_weak(log), - /* K9 */ be_nested_str_weak(MTR_X3A_X20Operational_X20Discovery_X20node_X20_X3D_X20), - /* K10 */ be_const_int(3), - /* K11 */ be_nested_str_weak(eth), - /* K12 */ be_nested_str_weak(find), - /* K13 */ be_nested_str_weak(up), - /* K14 */ be_nested_str_weak(MTR_X3A_X20adding_X20mDNS_X20on_X20_X25s_X20_X27_X25s_X27_X20ptr_X20to_X20_X60_X25s_X2Elocal_X60), - /* K15 */ be_nested_str_weak(hostname_eth), - /* K16 */ be_nested_str_weak(add_service), - /* K17 */ be_nested_str_weak(_matter), - /* K18 */ be_nested_str_weak(_tcp), - /* K19 */ be_nested_str_weak(_I), - /* K20 */ be_nested_str_weak(MTR_X3A_X20adding_X20subtype_X3A_X20), - /* K21 */ be_nested_str_weak(add_subtype), - /* K22 */ be_nested_str_weak(wifi), - /* K23 */ be_nested_str_weak(hostname_wifi), - /* K24 */ be_nested_str_weak(MTR_X3A_X20Exception), - /* K25 */ be_nested_str_weak(_X7C), - /* K26 */ be_const_int(2), - }), - be_str_weak(mdns_announce_op_discovery), - &be_const_str_solidified, - ( &(const binstruction[121]) { /* code */ - 0xA40A0000, // 0000 IMPORT R2 K0 - 0xA8020064, // 0001 EXBLK 0 #0067 - 0x8C0C0301, // 0002 GETMET R3 R1 K1 - 0x7C0C0200, // 0003 CALL R3 1 - 0x8C0C0702, // 0004 GETMET R3 R3 K2 - 0x7C0C0200, // 0005 CALL R3 1 - 0x8C0C0703, // 0006 GETMET R3 R3 K3 - 0x7C0C0200, // 0007 CALL R3 1 - 0x8C100304, // 0008 GETMET R4 R1 K4 - 0x7C100200, // 0009 CALL R4 1 - 0x8C140905, // 000A GETMET R5 R4 K5 - 0x7C140200, // 000B CALL R5 1 - 0x00140B06, // 000C ADD R5 R5 K6 - 0x8C180705, // 000D GETMET R6 R3 K5 - 0x7C180200, // 000E CALL R6 1 - 0x00140A06, // 000F ADD R5 R5 R6 - 0xB81A0E00, // 0010 GETNGBL R6 K7 - 0x8C180D08, // 0011 GETMET R6 R6 K8 - 0x00221205, // 0012 ADD R8 K9 R5 - 0x5824000A, // 0013 LDCONST R9 K10 - 0x7C180600, // 0014 CALL R6 3 - 0xB81A0E00, // 0015 GETNGBL R6 K7 - 0x8C180D0B, // 0016 GETMET R6 R6 K11 - 0x7C180200, // 0017 CALL R6 1 - 0x8C180D0C, // 0018 GETMET R6 R6 K12 - 0x5820000D, // 0019 LDCONST R8 K13 - 0x7C180400, // 001A CALL R6 2 - 0x781A0020, // 001B JMPF R6 #003D - 0xB81A0E00, // 001C GETNGBL R6 K7 - 0x8C180D08, // 001D GETMET R6 R6 K8 - 0x60200018, // 001E GETGBL R8 G24 - 0x5824000E, // 001F LDCONST R9 K14 - 0x5828000B, // 0020 LDCONST R10 K11 - 0x5C2C0A00, // 0021 MOVE R11 R5 - 0x8830010F, // 0022 GETMBR R12 R0 K15 - 0x7C200800, // 0023 CALL R8 4 - 0x5824000A, // 0024 LDCONST R9 K10 - 0x7C180600, // 0025 CALL R6 3 - 0x8C180510, // 0026 GETMET R6 R2 K16 - 0x58200011, // 0027 LDCONST R8 K17 - 0x58240012, // 0028 LDCONST R9 K18 - 0x542A15A3, // 0029 LDINT R10 5540 - 0x4C2C0000, // 002A LDNIL R11 - 0x5C300A00, // 002B MOVE R12 R5 - 0x8834010F, // 002C GETMBR R13 R0 K15 - 0x7C180E00, // 002D CALL R6 7 - 0x8C180905, // 002E GETMET R6 R4 K5 - 0x7C180200, // 002F CALL R6 1 - 0x001A2606, // 0030 ADD R6 K19 R6 - 0xB81E0E00, // 0031 GETNGBL R7 K7 - 0x8C1C0F08, // 0032 GETMET R7 R7 K8 - 0x00262806, // 0033 ADD R9 K20 R6 - 0x5828000A, // 0034 LDCONST R10 K10 - 0x7C1C0600, // 0035 CALL R7 3 - 0x8C1C0515, // 0036 GETMET R7 R2 K21 - 0x58240011, // 0037 LDCONST R9 K17 - 0x58280012, // 0038 LDCONST R10 K18 - 0x5C2C0A00, // 0039 MOVE R11 R5 - 0x8830010F, // 003A GETMBR R12 R0 K15 - 0x5C340C00, // 003B MOVE R13 R6 - 0x7C1C0C00, // 003C CALL R7 6 - 0xB81A0E00, // 003D GETNGBL R6 K7 - 0x8C180D16, // 003E GETMET R6 R6 K22 - 0x7C180200, // 003F CALL R6 1 - 0x8C180D0C, // 0040 GETMET R6 R6 K12 - 0x5820000D, // 0041 LDCONST R8 K13 - 0x7C180400, // 0042 CALL R6 2 - 0x781A0020, // 0043 JMPF R6 #0065 - 0xB81A0E00, // 0044 GETNGBL R6 K7 - 0x8C180D08, // 0045 GETMET R6 R6 K8 - 0x60200018, // 0046 GETGBL R8 G24 - 0x5824000E, // 0047 LDCONST R9 K14 - 0x58280016, // 0048 LDCONST R10 K22 - 0x5C2C0A00, // 0049 MOVE R11 R5 - 0x88300117, // 004A GETMBR R12 R0 K23 - 0x7C200800, // 004B CALL R8 4 - 0x5824000A, // 004C LDCONST R9 K10 - 0x7C180600, // 004D CALL R6 3 - 0x8C180510, // 004E GETMET R6 R2 K16 - 0x58200011, // 004F LDCONST R8 K17 - 0x58240012, // 0050 LDCONST R9 K18 - 0x542A15A3, // 0051 LDINT R10 5540 - 0x4C2C0000, // 0052 LDNIL R11 - 0x5C300A00, // 0053 MOVE R12 R5 - 0x88340117, // 0054 GETMBR R13 R0 K23 - 0x7C180E00, // 0055 CALL R6 7 - 0x8C180905, // 0056 GETMET R6 R4 K5 - 0x7C180200, // 0057 CALL R6 1 - 0x001A2606, // 0058 ADD R6 K19 R6 - 0xB81E0E00, // 0059 GETNGBL R7 K7 - 0x8C1C0F08, // 005A GETMET R7 R7 K8 - 0x00262806, // 005B ADD R9 K20 R6 - 0x5828000A, // 005C LDCONST R10 K10 - 0x7C1C0600, // 005D CALL R7 3 - 0x8C1C0515, // 005E GETMET R7 R2 K21 - 0x58240011, // 005F LDCONST R9 K17 - 0x58280012, // 0060 LDCONST R10 K18 - 0x5C2C0A00, // 0061 MOVE R11 R5 - 0x88300117, // 0062 GETMBR R12 R0 K23 - 0x5C340C00, // 0063 MOVE R13 R6 - 0x7C1C0C00, // 0064 CALL R7 6 - 0xA8040001, // 0065 EXBLK 1 1 - 0x70020010, // 0066 JMP #0078 - 0xAC0C0002, // 0067 CATCH R3 0 2 - 0x7002000D, // 0068 JMP #0077 - 0xB8160E00, // 0069 GETNGBL R5 K7 - 0x8C140B08, // 006A GETMET R5 R5 K8 - 0x601C0008, // 006B GETGBL R7 G8 - 0x5C200600, // 006C MOVE R8 R3 - 0x7C1C0200, // 006D CALL R7 1 - 0x001E3007, // 006E ADD R7 K24 R7 - 0x001C0F19, // 006F ADD R7 R7 K25 - 0x60200008, // 0070 GETGBL R8 G8 - 0x5C240800, // 0071 MOVE R9 R4 - 0x7C200200, // 0072 CALL R8 1 - 0x001C0E08, // 0073 ADD R7 R7 R8 - 0x5820001A, // 0074 LDCONST R8 K26 - 0x7C140600, // 0075 CALL R5 3 - 0x70020000, // 0076 JMP #0078 - 0xB0080000, // 0077 RAISE 2 R0 R0 - 0x80000000, // 0078 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: start_operational_discovery_deferred -********************************************************************/ -be_local_closure(Matter_Device_start_operational_discovery_deferred, /* name */ - be_nested_proto( - 6, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 1, /* has sup protos */ - ( &(const struct bproto*[ 1]) { - be_nested_proto( - 3, /* nstack */ - 0, /* argc */ - 0, /* varg */ - 1, /* has upvals */ - ( &(const bupvaldesc[ 2]) { /* upvals */ - be_local_const_upval(1, 0), - be_local_const_upval(1, 1), - }), - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str_weak(start_operational_discovery), - }), - be_str_weak(_X3Clambda_X3E), - &be_const_str_solidified, - ( &(const binstruction[ 5]) { /* code */ - 0x68000000, // 0000 GETUPV R0 U0 - 0x8C000100, // 0001 GETMET R0 R0 K0 - 0x68080001, // 0002 GETUPV R2 U1 - 0x7C000400, // 0003 CALL R0 2 - 0x80040000, // 0004 RET 1 R0 - }) - ), - }), - 1, /* has constants */ - ( &(const bvalue[ 3]) { /* constants */ - /* K0 */ be_nested_str_weak(tasmota), - /* K1 */ be_nested_str_weak(set_timer), - /* K2 */ be_const_int(0), - }), - be_str_weak(start_operational_discovery_deferred), - &be_const_str_solidified, - ( &(const binstruction[ 7]) { /* code */ - 0xB80A0000, // 0000 GETNGBL R2 K0 - 0x8C080501, // 0001 GETMET R2 R2 K1 - 0x58100002, // 0002 LDCONST R4 K2 - 0x84140000, // 0003 CLOSURE R5 P0 - 0x7C080600, // 0004 CALL R2 3 - 0xA0000000, // 0005 CLOSE R0 - 0x80000000, // 0006 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: start_commissioning_complete -********************************************************************/ -be_local_closure(Matter_Device_start_commissioning_complete, /* name */ - be_nested_proto( - 11, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[11]) { /* constants */ - /* K0 */ be_nested_str_weak(get_fabric), - /* K1 */ be_nested_str_weak(get_fabric_id), - /* K2 */ be_nested_str_weak(copy), - /* K3 */ be_nested_str_weak(reverse), - /* K4 */ be_nested_str_weak(tohex), - /* K5 */ be_nested_str_weak(get_admin_vendor_name), - /* K6 */ be_nested_str_weak(tasmota), - /* K7 */ be_nested_str_weak(log), - /* K8 */ be_nested_str_weak(MTR_X3A_X20_X2D_X2D_X2D_X20Commissioning_X20complete_X20for_X20Fabric_X20_X27_X25s_X27_X20_X28Vendor_X20_X25s_X29_X20_X2D_X2D_X2D), - /* K9 */ be_const_int(2), - /* K10 */ be_nested_str_weak(stop_basic_commissioning), - }), - be_str_weak(start_commissioning_complete), - &be_const_str_solidified, - ( &(const binstruction[24]) { /* code */ - 0x8C080300, // 0000 GETMET R2 R1 K0 - 0x7C080200, // 0001 CALL R2 1 - 0x8C0C0501, // 0002 GETMET R3 R2 K1 - 0x7C0C0200, // 0003 CALL R3 1 - 0x8C0C0702, // 0004 GETMET R3 R3 K2 - 0x7C0C0200, // 0005 CALL R3 1 - 0x8C0C0703, // 0006 GETMET R3 R3 K3 - 0x7C0C0200, // 0007 CALL R3 1 - 0x8C0C0704, // 0008 GETMET R3 R3 K4 - 0x7C0C0200, // 0009 CALL R3 1 - 0x8C100505, // 000A GETMET R4 R2 K5 - 0x7C100200, // 000B CALL R4 1 - 0xB8160C00, // 000C GETNGBL R5 K6 - 0x8C140B07, // 000D GETMET R5 R5 K7 - 0x601C0018, // 000E GETGBL R7 G24 - 0x58200008, // 000F LDCONST R8 K8 - 0x5C240600, // 0010 MOVE R9 R3 - 0x5C280800, // 0011 MOVE R10 R4 - 0x7C1C0600, // 0012 CALL R7 3 - 0x58200009, // 0013 LDCONST R8 K9 - 0x7C140600, // 0014 CALL R5 3 - 0x8C14010A, // 0015 GETMET R5 R0 K10 - 0x7C140200, // 0016 CALL R5 1 - 0x80000000, // 0017 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: MtrUpdate -********************************************************************/ -be_local_closure(Matter_Device_MtrUpdate, /* name */ - be_nested_proto( - 18, /* nstack */ - 5, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[25]) { /* constants */ - /* K0 */ be_nested_str_weak(tasmota), - /* K1 */ be_nested_str_weak(resp_cmnd_str), - /* K2 */ be_nested_str_weak(Invalid_X20JSON), - /* K3 */ be_nested_str_weak(find_key_i), - /* K4 */ be_nested_str_weak(Ep), - /* K5 */ be_nested_str_weak(Name), - /* K6 */ be_const_int(0), - /* K7 */ be_nested_str_weak(Invalid_X20_X27Ep_X27_X20attribute), - /* K8 */ be_nested_str_weak(find_plugin_by_endpoint), - /* K9 */ be_nested_str_weak(remove), - /* K10 */ be_nested_str_weak(find_plugin_by_friendly_name), - /* K11 */ be_nested_str_weak(Invalid_X20Device), - /* K12 */ be_nested_str_weak(VIRTUAL), - /* K13 */ be_nested_str_weak(Device_X20is_X20not_X20virtual), - /* K14 */ be_nested_str_weak(consolidate_update_commands), - /* K15 */ be_nested_str_weak(keys), - /* K16 */ be_nested_str_weak(find_list_i), - /* K17 */ be_nested_str_weak(Invalid_X20attribute_X20_X27_X25s_X27), - /* K18 */ be_nested_str_weak(stop_iteration), - /* K19 */ be_nested_str_weak(update_virtual), - /* K20 */ be_nested_str_weak(state_json), - /* K21 */ be_nested_str_weak(_X7B_X22_X25s_X22_X3A_X25s_X7D), - /* K22 */ be_nested_str_weak(resp_cmnd), - /* K23 */ be_nested_str_weak(resp_cmnd_done), - /* K24 */ be_nested_str_weak(Missing_X20_X27Device_X27_X20attribute), - }), - be_str_weak(MtrUpdate), - &be_const_str_solidified, - ( &(const binstruction[126]) { /* code */ - 0x4C140000, // 0000 LDNIL R5 - 0x1C140805, // 0001 EQ R5 R4 R5 - 0x78160004, // 0002 JMPF R5 #0008 - 0xB8160000, // 0003 GETNGBL R5 K0 - 0x8C140B01, // 0004 GETMET R5 R5 K1 - 0x581C0002, // 0005 LDCONST R7 K2 - 0x7C140400, // 0006 CALL R5 2 - 0x80040A00, // 0007 RET 1 R5 - 0xB8160000, // 0008 GETNGBL R5 K0 - 0x8C140B03, // 0009 GETMET R5 R5 K3 - 0x5C1C0800, // 000A MOVE R7 R4 - 0x58200004, // 000B LDCONST R8 K4 - 0x7C140600, // 000C CALL R5 3 - 0xB81A0000, // 000D GETNGBL R6 K0 - 0x8C180D03, // 000E GETMET R6 R6 K3 - 0x5C200800, // 000F MOVE R8 R4 - 0x58240005, // 0010 LDCONST R9 K5 - 0x7C180600, // 0011 CALL R6 3 - 0x74160000, // 0012 JMPT R5 #0014 - 0x781A0064, // 0013 JMPF R6 #0079 - 0x4C1C0000, // 0014 LDNIL R7 - 0x78160010, // 0015 JMPF R5 #0027 - 0x60200009, // 0016 GETGBL R8 G9 - 0x94240805, // 0017 GETIDX R9 R4 R5 - 0x7C200200, // 0018 CALL R8 1 - 0x18241106, // 0019 LE R9 R8 K6 - 0x78260004, // 001A JMPF R9 #0020 - 0xB8260000, // 001B GETNGBL R9 K0 - 0x8C241301, // 001C GETMET R9 R9 K1 - 0x582C0007, // 001D LDCONST R11 K7 - 0x7C240400, // 001E CALL R9 2 - 0x80041200, // 001F RET 1 R9 - 0x8C240108, // 0020 GETMET R9 R0 K8 - 0x5C2C1000, // 0021 MOVE R11 R8 - 0x7C240400, // 0022 CALL R9 2 - 0x5C1C1200, // 0023 MOVE R7 R9 - 0x8C240909, // 0024 GETMET R9 R4 K9 - 0x5C2C0A00, // 0025 MOVE R11 R5 - 0x7C240400, // 0026 CALL R9 2 - 0x781A0009, // 0027 JMPF R6 #0032 - 0x4C200000, // 0028 LDNIL R8 - 0x1C200E08, // 0029 EQ R8 R7 R8 - 0x78220003, // 002A JMPF R8 #002F - 0x8C20010A, // 002B GETMET R8 R0 K10 - 0x94280806, // 002C GETIDX R10 R4 R6 - 0x7C200400, // 002D CALL R8 2 - 0x5C1C1000, // 002E MOVE R7 R8 - 0x8C200909, // 002F GETMET R8 R4 K9 - 0x5C280C00, // 0030 MOVE R10 R6 - 0x7C200400, // 0031 CALL R8 2 - 0x4C200000, // 0032 LDNIL R8 - 0x1C200E08, // 0033 EQ R8 R7 R8 - 0x78220004, // 0034 JMPF R8 #003A - 0xB8220000, // 0035 GETNGBL R8 K0 - 0x8C201101, // 0036 GETMET R8 R8 K1 - 0x5828000B, // 0037 LDCONST R10 K11 - 0x7C200400, // 0038 CALL R8 2 - 0x80041000, // 0039 RET 1 R8 - 0x88200F0C, // 003A GETMBR R8 R7 K12 - 0x74220004, // 003B JMPT R8 #0041 - 0xB8220000, // 003C GETNGBL R8 K0 - 0x8C201101, // 003D GETMET R8 R8 K1 - 0x5828000D, // 003E LDCONST R10 K13 - 0x7C200400, // 003F CALL R8 2 - 0x80041000, // 0040 RET 1 R8 - 0x8C200F0E, // 0041 GETMET R8 R7 K14 - 0x7C200200, // 0042 CALL R8 1 - 0x60240013, // 0043 GETGBL R9 G19 - 0x7C240000, // 0044 CALL R9 0 - 0x60280010, // 0045 GETGBL R10 G16 - 0x8C2C090F, // 0046 GETMET R11 R4 K15 - 0x7C2C0200, // 0047 CALL R11 1 - 0x7C280200, // 0048 CALL R10 1 - 0xA8020016, // 0049 EXBLK 0 #0061 - 0x5C2C1400, // 004A MOVE R11 R10 - 0x7C2C0000, // 004B CALL R11 0 - 0xB8320000, // 004C GETNGBL R12 K0 - 0x8C301910, // 004D GETMET R12 R12 K16 - 0x5C381000, // 004E MOVE R14 R8 - 0x5C3C1600, // 004F MOVE R15 R11 - 0x7C300600, // 0050 CALL R12 3 - 0x4C340000, // 0051 LDNIL R13 - 0x1C34180D, // 0052 EQ R13 R12 R13 - 0x78360008, // 0053 JMPF R13 #005D - 0xB8360000, // 0054 GETNGBL R13 K0 - 0x8C341B01, // 0055 GETMET R13 R13 K1 - 0x603C0018, // 0056 GETGBL R15 G24 - 0x58400011, // 0057 LDCONST R16 K17 - 0x5C441600, // 0058 MOVE R17 R11 - 0x7C3C0400, // 0059 CALL R15 2 - 0x7C340400, // 005A CALL R13 2 - 0xA8040001, // 005B EXBLK 1 1 - 0x80001A00, // 005C RET 0 - 0x9434100C, // 005D GETIDX R13 R8 R12 - 0x9438080B, // 005E GETIDX R14 R4 R11 - 0x98241A0E, // 005F SETIDX R9 R13 R14 - 0x7001FFE8, // 0060 JMP #004A - 0x58280012, // 0061 LDCONST R10 K18 - 0xAC280200, // 0062 CATCH R10 1 0 - 0xB0080000, // 0063 RAISE 2 R0 R0 - 0x8C280F13, // 0064 GETMET R10 R7 K19 - 0x5C301200, // 0065 MOVE R12 R9 - 0x7C280400, // 0066 CALL R10 2 - 0x8C280F14, // 0067 GETMET R10 R7 K20 - 0x7C280200, // 0068 CALL R10 1 - 0x782A000A, // 0069 JMPF R10 #0075 - 0x602C0018, // 006A GETGBL R11 G24 - 0x58300015, // 006B LDCONST R12 K21 - 0x5C340200, // 006C MOVE R13 R1 - 0x5C381400, // 006D MOVE R14 R10 - 0x7C2C0600, // 006E CALL R11 3 - 0xB8320000, // 006F GETNGBL R12 K0 - 0x8C301916, // 0070 GETMET R12 R12 K22 - 0x5C381600, // 0071 MOVE R14 R11 - 0x7C300400, // 0072 CALL R12 2 - 0x80041800, // 0073 RET 1 R12 - 0x70020003, // 0074 JMP #0079 - 0xB82E0000, // 0075 GETNGBL R11 K0 - 0x8C2C1717, // 0076 GETMET R11 R11 K23 - 0x7C2C0200, // 0077 CALL R11 1 - 0x80041600, // 0078 RET 1 R11 - 0xB81E0000, // 0079 GETNGBL R7 K0 - 0x8C1C0F01, // 007A GETMET R7 R7 K1 - 0x58240018, // 007B LDCONST R9 K24 - 0x7C1C0400, // 007C CALL R7 2 - 0x80000000, // 007D RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: sort_distinct -********************************************************************/ -be_local_closure(Matter_Device_sort_distinct, /* name */ - be_nested_proto( - 7, /* nstack */ - 1, /* argc */ - 4, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 5]) { /* constants */ - /* K0 */ be_const_class(be_class_Matter_Device), - /* K1 */ be_const_int(1), - /* K2 */ be_const_int(0), - /* K3 */ be_nested_str_weak(stop_iteration), - /* K4 */ be_nested_str_weak(remove), - }), - be_str_weak(sort_distinct), - &be_const_str_solidified, - ( &(const binstruction[53]) { /* code */ - 0x58040000, // 0000 LDCONST R1 K0 - 0x60080010, // 0001 GETGBL R2 G16 - 0x600C000C, // 0002 GETGBL R3 G12 - 0x5C100000, // 0003 MOVE R4 R0 - 0x7C0C0200, // 0004 CALL R3 1 - 0x040C0701, // 0005 SUB R3 R3 K1 - 0x400E0203, // 0006 CONNECT R3 K1 R3 - 0x7C080200, // 0007 CALL R2 1 - 0xA8020010, // 0008 EXBLK 0 #001A - 0x5C0C0400, // 0009 MOVE R3 R2 - 0x7C0C0000, // 000A CALL R3 0 - 0x94100003, // 000B GETIDX R4 R0 R3 - 0x5C140600, // 000C MOVE R5 R3 - 0x24180B02, // 000D GT R6 R5 K2 - 0x781A0008, // 000E JMPF R6 #0018 - 0x04180B01, // 000F SUB R6 R5 K1 - 0x94180006, // 0010 GETIDX R6 R0 R6 - 0x24180C04, // 0011 GT R6 R6 R4 - 0x781A0004, // 0012 JMPF R6 #0018 - 0x04180B01, // 0013 SUB R6 R5 K1 - 0x94180006, // 0014 GETIDX R6 R0 R6 - 0x98000A06, // 0015 SETIDX R0 R5 R6 - 0x04140B01, // 0016 SUB R5 R5 K1 - 0x7001FFF4, // 0017 JMP #000D - 0x98000A04, // 0018 SETIDX R0 R5 R4 - 0x7001FFEE, // 0019 JMP #0009 - 0x58080003, // 001A LDCONST R2 K3 - 0xAC080200, // 001B CATCH R2 1 0 - 0xB0080000, // 001C RAISE 2 R0 R0 - 0x58080001, // 001D LDCONST R2 K1 - 0x600C000C, // 001E GETGBL R3 G12 - 0x5C100000, // 001F MOVE R4 R0 - 0x7C0C0200, // 0020 CALL R3 1 - 0x180C0701, // 0021 LE R3 R3 K1 - 0x780E0000, // 0022 JMPF R3 #0024 - 0x80040000, // 0023 RET 1 R0 - 0x940C0102, // 0024 GETIDX R3 R0 K2 - 0x6010000C, // 0025 GETGBL R4 G12 - 0x5C140000, // 0026 MOVE R5 R0 - 0x7C100200, // 0027 CALL R4 1 - 0x14100404, // 0028 LT R4 R2 R4 - 0x78120009, // 0029 JMPF R4 #0034 - 0x94100002, // 002A GETIDX R4 R0 R2 - 0x1C100803, // 002B EQ R4 R4 R3 - 0x78120003, // 002C JMPF R4 #0031 - 0x8C100104, // 002D GETMET R4 R0 K4 - 0x5C180400, // 002E MOVE R6 R2 - 0x7C100400, // 002F CALL R4 2 - 0x70020001, // 0030 JMP #0033 - 0x940C0002, // 0031 GETIDX R3 R0 R2 - 0x00080501, // 0032 ADD R2 R2 K1 - 0x7001FFF0, // 0033 JMP #0025 - 0x80040000, // 0034 RET 1 R0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: conf_to_log -********************************************************************/ -be_local_closure(Matter_Device_conf_to_log, /* name */ - be_nested_proto( - 9, /* nstack */ - 1, /* argc */ - 4, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 6]) { /* constants */ - /* K0 */ be_const_class(be_class_Matter_Device), - /* K1 */ be_nested_str_weak(), - /* K2 */ be_nested_str_weak(k2l), - /* K3 */ be_nested_str_weak(type), - /* K4 */ be_nested_str_weak(_X20_X25s_X3A_X25s), - /* K5 */ be_nested_str_weak(stop_iteration), - }), - be_str_weak(conf_to_log), - &be_const_str_solidified, - ( &(const binstruction[24]) { /* code */ - 0x58040000, // 0000 LDCONST R1 K0 - 0x58080001, // 0001 LDCONST R2 K1 - 0x600C0010, // 0002 GETGBL R3 G16 - 0x8C100302, // 0003 GETMET R4 R1 K2 - 0x5C180000, // 0004 MOVE R6 R0 - 0x7C100400, // 0005 CALL R4 2 - 0x7C0C0200, // 0006 CALL R3 1 - 0xA802000B, // 0007 EXBLK 0 #0014 - 0x5C100600, // 0008 MOVE R4 R3 - 0x7C100000, // 0009 CALL R4 0 - 0x1C140903, // 000A EQ R5 R4 K3 - 0x78160000, // 000B JMPF R5 #000D - 0x7001FFFA, // 000C JMP #0008 - 0x60140018, // 000D GETGBL R5 G24 - 0x58180004, // 000E LDCONST R6 K4 - 0x5C1C0800, // 000F MOVE R7 R4 - 0x94200004, // 0010 GETIDX R8 R0 R4 - 0x7C140600, // 0011 CALL R5 3 - 0x00080405, // 0012 ADD R2 R2 R5 - 0x7001FFF3, // 0013 JMP #0008 - 0x580C0005, // 0014 LDCONST R3 K5 - 0xAC0C0200, // 0015 CATCH R3 1 0 - 0xB0080000, // 0016 RAISE 2 R0 R0 - 0x80040400, // 0017 RET 1 R2 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: find_plugin_by_endpoint -********************************************************************/ -be_local_closure(Matter_Device_find_plugin_by_endpoint, /* name */ - be_nested_proto( - 6, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ ( &(const bvalue[ 4]) { /* constants */ /* K0 */ be_const_int(0), /* K1 */ be_nested_str_weak(plugins), - /* K2 */ be_nested_str_weak(get_endpoint), + /* K2 */ be_nested_str_weak(get_name), /* K3 */ be_const_int(1), }), - be_str_weak(find_plugin_by_endpoint), - &be_const_str_solidified, - ( &(const binstruction[17]) { /* code */ - 0x58080000, // 0000 LDCONST R2 K0 - 0x600C000C, // 0001 GETGBL R3 G12 - 0x88100101, // 0002 GETMBR R4 R0 K1 - 0x7C0C0200, // 0003 CALL R3 1 - 0x140C0403, // 0004 LT R3 R2 R3 - 0x780E0008, // 0005 JMPF R3 #000F - 0x880C0101, // 0006 GETMBR R3 R0 K1 - 0x940C0602, // 0007 GETIDX R3 R3 R2 - 0x8C100702, // 0008 GETMET R4 R3 K2 - 0x7C100200, // 0009 CALL R4 1 - 0x1C100801, // 000A EQ R4 R4 R1 - 0x78120000, // 000B JMPF R4 #000D - 0x80040600, // 000C RET 1 R3 - 0x00080503, // 000D ADD R2 R2 K3 - 0x7001FFF1, // 000E JMP #0001 - 0x4C0C0000, // 000F LDNIL R3 - 0x80040600, // 0010 RET 1 R3 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: received_ack -********************************************************************/ -be_local_closure(Matter_Device_received_ack, /* name */ - be_nested_proto( - 5, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 2]) { /* constants */ - /* K0 */ be_nested_str_weak(udp_server), - /* K1 */ be_nested_str_weak(received_ack), - }), - be_str_weak(received_ack), - &be_const_str_solidified, - ( &(const binstruction[ 5]) { /* code */ - 0x88080100, // 0000 GETMBR R2 R0 K0 - 0x8C080501, // 0001 GETMET R2 R2 K1 - 0x5C100200, // 0002 MOVE R4 R1 - 0x7C080400, // 0003 CALL R2 2 - 0x80040400, // 0004 RET 1 R2 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: generate_random_passcode -********************************************************************/ -be_local_closure(Matter_Device_generate_random_passcode, /* name */ - be_nested_proto( - 7, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 8]) { /* constants */ - /* K0 */ be_nested_str_weak(crypto), - /* K1 */ be_nested_str_weak(random), - /* K2 */ be_nested_str_weak(get), - /* K3 */ be_const_int(0), - /* K4 */ be_const_int(134217727), - /* K5 */ be_const_int(99999998), - /* K6 */ be_nested_str_weak(PASSCODE_INVALID), - /* K7 */ be_nested_str_weak(stop_iteration), - }), - be_str_weak(generate_random_passcode), + be_str_weak(find_plugin_by_friendly_name), &be_const_str_solidified, ( &(const binstruction[35]) { /* code */ - 0xA4060000, // 0000 IMPORT R1 K0 - 0x4C080000, // 0001 LDNIL R2 - 0x500C0200, // 0002 LDBOOL R3 1 0 - 0x780E001D, // 0003 JMPF R3 #0022 - 0x8C0C0301, // 0004 GETMET R3 R1 K1 - 0x54160003, // 0005 LDINT R5 4 - 0x7C0C0400, // 0006 CALL R3 2 - 0x8C0C0702, // 0007 GETMET R3 R3 K2 - 0x58140003, // 0008 LDCONST R5 K3 - 0x541A0003, // 0009 LDINT R6 4 - 0x7C0C0600, // 000A CALL R3 3 - 0x2C0C0704, // 000B AND R3 R3 K4 - 0x5C080600, // 000C MOVE R2 R3 - 0x240C0505, // 000D GT R3 R2 K5 - 0x780E0000, // 000E JMPF R3 #0010 - 0x7001FFF1, // 000F JMP #0002 - 0x600C0010, // 0010 GETGBL R3 G16 - 0x88100106, // 0011 GETMBR R4 R0 K6 - 0x7C0C0200, // 0012 CALL R3 1 - 0xA8020005, // 0013 EXBLK 0 #001A - 0x5C100600, // 0014 MOVE R4 R3 - 0x7C100000, // 0015 CALL R4 0 - 0x1C140404, // 0016 EQ R5 R2 R4 - 0x78160000, // 0017 JMPF R5 #0019 - 0x4C080000, // 0018 LDNIL R2 - 0x7001FFF9, // 0019 JMP #0014 - 0x580C0007, // 001A LDCONST R3 K7 - 0xAC0C0200, // 001B CATCH R3 1 0 - 0xB0080000, // 001C RAISE 2 R0 R0 - 0x4C0C0000, // 001D LDNIL R3 - 0x200C0403, // 001E NE R3 R2 R3 - 0x780E0000, // 001F JMPF R3 #0021 - 0x80040400, // 0020 RET 1 R2 - 0x7001FFDF, // 0021 JMP #0002 - 0x80000000, // 0022 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: _instantiate_plugins_from_config -********************************************************************/ -be_local_closure(Matter_Device__instantiate_plugins_from_config, /* name */ - be_nested_proto( - 18, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[30]) { /* constants */ - /* K0 */ be_nested_str_weak(k2l_num), - /* K1 */ be_nested_str_weak(tasmota), - /* K2 */ be_nested_str_weak(log), - /* K3 */ be_nested_str_weak(MTR_X3A_X20Configuring_X20endpoints), - /* K4 */ be_const_int(2), - /* K5 */ be_nested_str_weak(plugins), - /* K6 */ be_nested_str_weak(push), - /* K7 */ be_nested_str_weak(matter), - /* K8 */ be_nested_str_weak(Plugin_Root), - /* K9 */ be_const_int(0), - /* K10 */ be_nested_str_weak(MTR_X3A_X20_X20_X20endpoint_X20_X3D_X20_X255i_X20type_X3A_X25s_X25s), - /* K11 */ be_nested_str_weak(root), - /* K12 */ be_nested_str_weak(), - /* K13 */ be_nested_str_weak(Plugin_Aggregator), - /* K14 */ be_nested_str_weak(find), - /* K15 */ be_nested_str_weak(type), - /* K16 */ be_nested_str_weak(MTR_X3A_X20no_X20class_X20name_X2C_X20skipping), - /* K17 */ be_const_int(3), - /* K18 */ be_nested_str_weak(MTR_X3A_X20only_X20one_X20root_X20node_X20allowed), - /* K19 */ be_nested_str_weak(plugins_classes), - /* K20 */ be_nested_str_weak(MTR_X3A_X20unknown_X20class_X20name_X20_X27), - /* K21 */ be_nested_str_weak(_X27_X20skipping), - /* K22 */ be_nested_str_weak(conf_to_log), - /* K23 */ be_nested_str_weak(MTR_X3A_X20Exception), - /* K24 */ be_nested_str_weak(_X7C), - /* K25 */ be_nested_str_weak(stop_iteration), - /* K26 */ be_nested_str_weak(aggregator), - /* K27 */ be_nested_str_weak(publish_result), - /* K28 */ be_nested_str_weak(_X7B_X22Matter_X22_X3A_X7B_X22Initialized_X22_X3A1_X7D_X7D), - /* K29 */ be_nested_str_weak(Matter), - }), - be_str_weak(_instantiate_plugins_from_config), - &be_const_str_solidified, - ( &(const binstruction[152]) { /* code */ - 0x8C080100, // 0000 GETMET R2 R0 K0 - 0x5C100200, // 0001 MOVE R4 R1 - 0x7C080400, // 0002 CALL R2 2 - 0xB80E0200, // 0003 GETNGBL R3 K1 - 0x8C0C0702, // 0004 GETMET R3 R3 K2 - 0x58140003, // 0005 LDCONST R5 K3 - 0x58180004, // 0006 LDCONST R6 K4 - 0x7C0C0600, // 0007 CALL R3 3 - 0x880C0105, // 0008 GETMBR R3 R0 K5 - 0x8C0C0706, // 0009 GETMET R3 R3 K6 - 0xB8160E00, // 000A GETNGBL R5 K7 - 0x8C140B08, // 000B GETMET R5 R5 K8 - 0x5C1C0000, // 000C MOVE R7 R0 - 0x58200009, // 000D LDCONST R8 K9 - 0x60240013, // 000E GETGBL R9 G19 - 0x7C240000, // 000F CALL R9 0 - 0x7C140800, // 0010 CALL R5 4 - 0x7C0C0400, // 0011 CALL R3 2 - 0xB80E0200, // 0012 GETNGBL R3 K1 - 0x8C0C0702, // 0013 GETMET R3 R3 K2 - 0x60140018, // 0014 GETGBL R5 G24 - 0x5818000A, // 0015 LDCONST R6 K10 - 0x581C0009, // 0016 LDCONST R7 K9 - 0x5820000B, // 0017 LDCONST R8 K11 - 0x5824000C, // 0018 LDCONST R9 K12 - 0x7C140800, // 0019 CALL R5 4 - 0x58180004, // 001A LDCONST R6 K4 - 0x7C0C0600, // 001B CALL R3 3 - 0x880C0105, // 001C GETMBR R3 R0 K5 - 0x8C0C0706, // 001D GETMET R3 R3 K6 - 0xB8160E00, // 001E GETNGBL R5 K7 - 0x8C140B0D, // 001F GETMET R5 R5 K13 - 0x5C1C0000, // 0020 MOVE R7 R0 - 0x5422FEFF, // 0021 LDINT R8 65280 - 0x60240013, // 0022 GETGBL R9 G19 - 0x7C240000, // 0023 CALL R9 0 - 0x7C140800, // 0024 CALL R5 4 - 0x7C0C0400, // 0025 CALL R3 2 - 0x600C0010, // 0026 GETGBL R3 G16 - 0x5C100400, // 0027 MOVE R4 R2 - 0x7C0C0200, // 0028 CALL R3 1 - 0xA802005A, // 0029 EXBLK 0 #0085 - 0x5C100600, // 002A MOVE R4 R3 - 0x7C100000, // 002B CALL R4 0 - 0x1C140909, // 002C EQ R5 R4 K9 - 0x78160000, // 002D JMPF R5 #002F - 0x7001FFFA, // 002E JMP #002A - 0xA8020042, // 002F EXBLK 0 #0073 - 0x60140008, // 0030 GETGBL R5 G8 - 0x5C180800, // 0031 MOVE R6 R4 - 0x7C140200, // 0032 CALL R5 1 - 0x94140205, // 0033 GETIDX R5 R1 R5 - 0x8C180B0E, // 0034 GETMET R6 R5 K14 - 0x5820000F, // 0035 LDCONST R8 K15 - 0x7C180400, // 0036 CALL R6 2 - 0x4C1C0000, // 0037 LDNIL R7 - 0x1C1C0C07, // 0038 EQ R7 R6 R7 - 0x781E0006, // 0039 JMPF R7 #0041 - 0xB81E0200, // 003A GETNGBL R7 K1 - 0x8C1C0F02, // 003B GETMET R7 R7 K2 - 0x58240010, // 003C LDCONST R9 K16 - 0x58280011, // 003D LDCONST R10 K17 - 0x7C1C0600, // 003E CALL R7 3 - 0xA8040001, // 003F EXBLK 1 1 - 0x7001FFE8, // 0040 JMP #002A - 0x1C1C0D0B, // 0041 EQ R7 R6 K11 - 0x781E0006, // 0042 JMPF R7 #004A - 0xB81E0200, // 0043 GETNGBL R7 K1 - 0x8C1C0F02, // 0044 GETMET R7 R7 K2 - 0x58240012, // 0045 LDCONST R9 K18 - 0x58280011, // 0046 LDCONST R10 K17 - 0x7C1C0600, // 0047 CALL R7 3 - 0xA8040001, // 0048 EXBLK 1 1 - 0x7001FFDF, // 0049 JMP #002A - 0x881C0113, // 004A GETMBR R7 R0 K19 - 0x8C1C0F0E, // 004B GETMET R7 R7 K14 - 0x5C240C00, // 004C MOVE R9 R6 - 0x7C1C0400, // 004D CALL R7 2 - 0x4C200000, // 004E LDNIL R8 - 0x1C200E08, // 004F EQ R8 R7 R8 - 0x7822000A, // 0050 JMPF R8 #005C - 0xB8220200, // 0051 GETNGBL R8 K1 - 0x8C201102, // 0052 GETMET R8 R8 K2 - 0x60280008, // 0053 GETGBL R10 G8 - 0x5C2C0C00, // 0054 MOVE R11 R6 - 0x7C280200, // 0055 CALL R10 1 - 0x002A280A, // 0056 ADD R10 K20 R10 - 0x00281515, // 0057 ADD R10 R10 K21 - 0x582C0004, // 0058 LDCONST R11 K4 - 0x7C200600, // 0059 CALL R8 3 - 0xA8040001, // 005A EXBLK 1 1 - 0x7001FFCD, // 005B JMP #002A - 0x5C200E00, // 005C MOVE R8 R7 - 0x5C240000, // 005D MOVE R9 R0 - 0x5C280800, // 005E MOVE R10 R4 - 0x5C2C0A00, // 005F MOVE R11 R5 - 0x7C200600, // 0060 CALL R8 3 - 0x88240105, // 0061 GETMBR R9 R0 K5 - 0x8C241306, // 0062 GETMET R9 R9 K6 - 0x5C2C1000, // 0063 MOVE R11 R8 - 0x7C240400, // 0064 CALL R9 2 - 0xB8260200, // 0065 GETNGBL R9 K1 - 0x8C241302, // 0066 GETMET R9 R9 K2 - 0x602C0018, // 0067 GETGBL R11 G24 - 0x5830000A, // 0068 LDCONST R12 K10 - 0x5C340800, // 0069 MOVE R13 R4 - 0x5C380C00, // 006A MOVE R14 R6 - 0x8C3C0116, // 006B GETMET R15 R0 K22 - 0x5C440A00, // 006C MOVE R17 R5 - 0x7C3C0400, // 006D CALL R15 2 - 0x7C2C0800, // 006E CALL R11 4 - 0x58300004, // 006F LDCONST R12 K4 - 0x7C240600, // 0070 CALL R9 3 - 0xA8040001, // 0071 EXBLK 1 1 - 0x70020010, // 0072 JMP #0084 - 0xAC140002, // 0073 CATCH R5 0 2 - 0x7002000D, // 0074 JMP #0083 - 0xB81E0200, // 0075 GETNGBL R7 K1 - 0x8C1C0F02, // 0076 GETMET R7 R7 K2 - 0x60240008, // 0077 GETGBL R9 G8 - 0x5C280A00, // 0078 MOVE R10 R5 - 0x7C240200, // 0079 CALL R9 1 - 0x00262E09, // 007A ADD R9 K23 R9 - 0x00241318, // 007B ADD R9 R9 K24 - 0x60280008, // 007C GETGBL R10 G8 - 0x5C2C0C00, // 007D MOVE R11 R6 - 0x7C280200, // 007E CALL R10 1 - 0x0024120A, // 007F ADD R9 R9 R10 - 0x58280004, // 0080 LDCONST R10 K4 - 0x7C1C0600, // 0081 CALL R7 3 - 0x70020000, // 0082 JMP #0084 - 0xB0080000, // 0083 RAISE 2 R0 R0 - 0x7001FFA4, // 0084 JMP #002A - 0x580C0019, // 0085 LDCONST R3 K25 - 0xAC0C0200, // 0086 CATCH R3 1 0 - 0xB0080000, // 0087 RAISE 2 R0 R0 - 0xB80E0200, // 0088 GETNGBL R3 K1 - 0x8C0C0702, // 0089 GETMET R3 R3 K2 - 0x60140018, // 008A GETGBL R5 G24 - 0x5818000A, // 008B LDCONST R6 K10 - 0x541EFEFF, // 008C LDINT R7 65280 - 0x5820001A, // 008D LDCONST R8 K26 - 0x5824000C, // 008E LDCONST R9 K12 - 0x7C140800, // 008F CALL R5 4 - 0x58180004, // 0090 LDCONST R6 K4 - 0x7C0C0600, // 0091 CALL R3 3 - 0xB80E0200, // 0092 GETNGBL R3 K1 - 0x8C0C071B, // 0093 GETMET R3 R3 K27 - 0x5814001C, // 0094 LDCONST R5 K28 - 0x5818001D, // 0095 LDCONST R6 K29 - 0x7C0C0600, // 0096 CALL R3 3 - 0x80000000, // 0097 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: _compute_pbkdf -********************************************************************/ -be_local_closure(Matter_Device__compute_pbkdf, /* name */ - be_nested_proto( - 13, /* nstack */ - 4, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[10]) { /* constants */ - /* K0 */ be_nested_str_weak(crypto), - /* K1 */ be_nested_str_weak(add), - /* K2 */ be_nested_str_weak(PBKDF2_HMAC_SHA256), - /* K3 */ be_nested_str_weak(derive), - /* K4 */ be_const_int(0), - /* K5 */ be_nested_str_weak(root_w0), - /* K6 */ be_nested_str_weak(EC_P256), - /* K7 */ be_nested_str_weak(mod), - /* K8 */ be_nested_str_weak(root_L), - /* K9 */ be_nested_str_weak(public_key), - }), - be_str_weak(_compute_pbkdf), - &be_const_str_solidified, - ( &(const binstruction[40]) { /* code */ - 0xA4120000, // 0000 IMPORT R4 K0 - 0x60140015, // 0001 GETGBL R5 G21 - 0x7C140000, // 0002 CALL R5 0 - 0x8C140B01, // 0003 GETMET R5 R5 K1 - 0x5C1C0200, // 0004 MOVE R7 R1 - 0x54220003, // 0005 LDINT R8 4 - 0x7C140600, // 0006 CALL R5 3 - 0x8C180902, // 0007 GETMET R6 R4 K2 - 0x7C180200, // 0008 CALL R6 1 - 0x8C180D03, // 0009 GETMET R6 R6 K3 - 0x5C200A00, // 000A MOVE R8 R5 - 0x5C240600, // 000B MOVE R9 R3 - 0x5C280400, // 000C MOVE R10 R2 - 0x542E004F, // 000D LDINT R11 80 - 0x7C180A00, // 000E CALL R6 5 - 0x541E0026, // 000F LDINT R7 39 - 0x401E0807, // 0010 CONNECT R7 K4 R7 - 0x941C0C07, // 0011 GETIDX R7 R6 R7 - 0x54220027, // 0012 LDINT R8 40 - 0x5426004E, // 0013 LDINT R9 79 - 0x40201009, // 0014 CONNECT R8 R8 R9 - 0x94200C08, // 0015 GETIDX R8 R6 R8 - 0x8C240906, // 0016 GETMET R9 R4 K6 - 0x7C240200, // 0017 CALL R9 1 - 0x8C241307, // 0018 GETMET R9 R9 K7 - 0x5C2C0E00, // 0019 MOVE R11 R7 - 0x7C240400, // 001A CALL R9 2 - 0x90020A09, // 001B SETMBR R0 K5 R9 - 0x8C240906, // 001C GETMET R9 R4 K6 - 0x7C240200, // 001D CALL R9 1 - 0x8C241307, // 001E GETMET R9 R9 K7 - 0x5C2C1000, // 001F MOVE R11 R8 - 0x7C240400, // 0020 CALL R9 2 - 0x8C280906, // 0021 GETMET R10 R4 K6 - 0x7C280200, // 0022 CALL R10 1 - 0x8C281509, // 0023 GETMET R10 R10 K9 - 0x5C301200, // 0024 MOVE R12 R9 - 0x7C280400, // 0025 CALL R10 2 - 0x9002100A, // 0026 SETMBR R0 K8 R10 - 0x80000000, // 0027 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: get_plugin_class_arg -********************************************************************/ -be_local_closure(Matter_Device_get_plugin_class_arg, /* name */ - be_nested_proto( - 5, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 4]) { /* constants */ - /* K0 */ be_nested_str_weak(plugins_classes), - /* K1 */ be_nested_str_weak(find), - /* K2 */ be_nested_str_weak(ARG), - /* K3 */ be_nested_str_weak(), - }), - be_str_weak(get_plugin_class_arg), - &be_const_str_solidified, - ( &(const binstruction[ 9]) { /* code */ - 0x88080100, // 0000 GETMBR R2 R0 K0 - 0x8C080501, // 0001 GETMET R2 R2 K1 - 0x5C100200, // 0002 MOVE R4 R1 - 0x7C080400, // 0003 CALL R2 2 - 0x780A0001, // 0004 JMPF R2 #0007 - 0x880C0502, // 0005 GETMBR R3 R2 K2 - 0x70020000, // 0006 JMP #0008 - 0x580C0003, // 0007 LDCONST R3 K3 - 0x80040600, // 0008 RET 1 R3 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: mdns_announce_op_discovery_all_fabrics -********************************************************************/ -be_local_closure(Matter_Device_mdns_announce_op_discovery_all_fabrics, /* name */ - be_nested_proto( - 6, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 6]) { /* constants */ - /* K0 */ be_nested_str_weak(sessions), - /* K1 */ be_nested_str_weak(active_fabrics), - /* K2 */ be_nested_str_weak(get_device_id), - /* K3 */ be_nested_str_weak(get_fabric_id), - /* K4 */ be_nested_str_weak(mdns_announce_op_discovery), - /* K5 */ be_nested_str_weak(stop_iteration), - }), - be_str_weak(mdns_announce_op_discovery_all_fabrics), - &be_const_str_solidified, - ( &(const binstruction[22]) { /* code */ - 0x60040010, // 0000 GETGBL R1 G16 - 0x88080100, // 0001 GETMBR R2 R0 K0 - 0x8C080501, // 0002 GETMET R2 R2 K1 - 0x7C080200, // 0003 CALL R2 1 - 0x7C040200, // 0004 CALL R1 1 - 0xA802000B, // 0005 EXBLK 0 #0012 - 0x5C080200, // 0006 MOVE R2 R1 - 0x7C080000, // 0007 CALL R2 0 - 0x8C0C0502, // 0008 GETMET R3 R2 K2 - 0x7C0C0200, // 0009 CALL R3 1 - 0x780E0005, // 000A JMPF R3 #0011 - 0x8C0C0503, // 000B GETMET R3 R2 K3 - 0x7C0C0200, // 000C CALL R3 1 - 0x780E0002, // 000D JMPF R3 #0011 - 0x8C0C0104, // 000E GETMET R3 R0 K4 - 0x5C140400, // 000F MOVE R5 R2 - 0x7C0C0400, // 0010 CALL R3 2 - 0x7001FFF3, // 0011 JMP #0006 - 0x58040005, // 0012 LDCONST R1 K5 - 0xAC040200, // 0013 CATCH R1 1 0 - 0xB0080000, // 0014 RAISE 2 R0 R0 - 0x80000000, // 0015 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: event_fabrics_saved -********************************************************************/ -be_local_closure(Matter_Device_event_fabrics_saved, /* name */ - be_nested_proto( - 3, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 5]) { /* constants */ - /* K0 */ be_nested_str_weak(sessions), - /* K1 */ be_nested_str_weak(count_active_fabrics), - /* K2 */ be_const_int(0), - /* K3 */ be_nested_str_weak(plugins_persist), - /* K4 */ be_nested_str_weak(save_param), - }), - be_str_weak(event_fabrics_saved), - &be_const_str_solidified, - ( &(const binstruction[12]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x8C040301, // 0001 GETMET R1 R1 K1 - 0x7C040200, // 0002 CALL R1 1 - 0x24040302, // 0003 GT R1 R1 K2 - 0x78060005, // 0004 JMPF R1 #000B - 0x88040103, // 0005 GETMBR R1 R0 K3 - 0x74060003, // 0006 JMPT R1 #000B - 0x50040200, // 0007 LDBOOL R1 1 0 - 0x90020601, // 0008 SETMBR R0 K3 R1 - 0x8C040104, // 0009 GETMET R1 R0 K4 - 0x7C040200, // 000A CALL R1 1 - 0x80000000, // 000B RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: start_mdns_announce_hostnames -********************************************************************/ -be_local_closure(Matter_Device_start_mdns_announce_hostnames, /* name */ - be_nested_proto( - 6, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 1, /* has sup protos */ - ( &(const struct bproto*[ 2]) { - be_nested_proto( - 4, /* nstack */ - 0, /* argc */ - 0, /* varg */ - 1, /* has upvals */ - ( &(const bupvaldesc[ 1]) { /* upvals */ - be_local_const_upval(1, 0), - }), - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 5]) { /* constants */ - /* K0 */ be_nested_str_weak(_mdns_announce_hostname), - /* K1 */ be_nested_str_weak(tasmota), - /* K2 */ be_nested_str_weak(remove_rule), - /* K3 */ be_nested_str_weak(Wifi_X23Connected), - /* K4 */ be_nested_str_weak(matter_mdns_host), - }), - be_str_weak(_anonymous_), - &be_const_str_solidified, - ( &(const binstruction[10]) { /* code */ - 0x68000000, // 0000 GETUPV R0 U0 - 0x8C000100, // 0001 GETMET R0 R0 K0 - 0x50080000, // 0002 LDBOOL R2 0 0 - 0x7C000400, // 0003 CALL R0 2 - 0xB8020200, // 0004 GETNGBL R0 K1 - 0x8C000102, // 0005 GETMET R0 R0 K2 - 0x58080003, // 0006 LDCONST R2 K3 - 0x580C0004, // 0007 LDCONST R3 K4 - 0x7C000600, // 0008 CALL R0 3 - 0x80000000, // 0009 RET 0 - }) - ), - be_nested_proto( - 4, /* nstack */ - 0, /* argc */ - 0, /* varg */ - 1, /* has upvals */ - ( &(const bupvaldesc[ 1]) { /* upvals */ - be_local_const_upval(1, 0), - }), - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 5]) { /* constants */ - /* K0 */ be_nested_str_weak(_mdns_announce_hostname), - /* K1 */ be_nested_str_weak(tasmota), - /* K2 */ be_nested_str_weak(remove_rule), - /* K3 */ be_nested_str_weak(Eth_X23Connected), - /* K4 */ be_nested_str_weak(matter_mdns_host), - }), - be_str_weak(_anonymous_), - &be_const_str_solidified, - ( &(const binstruction[10]) { /* code */ - 0x68000000, // 0000 GETUPV R0 U0 - 0x8C000100, // 0001 GETMET R0 R0 K0 - 0x50080200, // 0002 LDBOOL R2 1 0 - 0x7C000400, // 0003 CALL R0 2 - 0xB8020200, // 0004 GETNGBL R0 K1 - 0x8C000102, // 0005 GETMET R0 R0 K2 - 0x58080003, // 0006 LDCONST R2 K3 - 0x580C0004, // 0007 LDCONST R3 K4 - 0x7C000600, // 0008 CALL R0 3 - 0x80000000, // 0009 RET 0 - }) - ), - }), - 1, /* has constants */ - ( &(const bvalue[ 9]) { /* constants */ - /* K0 */ be_nested_str_weak(tasmota), - /* K1 */ be_nested_str_weak(wifi), - /* K2 */ be_nested_str_weak(up), - /* K3 */ be_nested_str_weak(_mdns_announce_hostname), - /* K4 */ be_nested_str_weak(add_rule), - /* K5 */ be_nested_str_weak(Wifi_X23Connected), - /* K6 */ be_nested_str_weak(matter_mdns_host), - /* K7 */ be_nested_str_weak(eth), - /* K8 */ be_nested_str_weak(Eth_X23Connected), - }), - be_str_weak(start_mdns_announce_hostnames), - &be_const_str_solidified, - ( &(const binstruction[32]) { /* code */ - 0xB8060000, // 0000 GETNGBL R1 K0 - 0x8C040301, // 0001 GETMET R1 R1 K1 - 0x7C040200, // 0002 CALL R1 1 - 0x94040302, // 0003 GETIDX R1 R1 K2 - 0x78060003, // 0004 JMPF R1 #0009 - 0x8C040103, // 0005 GETMET R1 R0 K3 - 0x500C0000, // 0006 LDBOOL R3 0 0 - 0x7C040400, // 0007 CALL R1 2 - 0x70020005, // 0008 JMP #000F - 0xB8060000, // 0009 GETNGBL R1 K0 - 0x8C040304, // 000A GETMET R1 R1 K4 - 0x580C0005, // 000B LDCONST R3 K5 - 0x84100000, // 000C CLOSURE R4 P0 - 0x58140006, // 000D LDCONST R5 K6 - 0x7C040800, // 000E CALL R1 4 - 0xB8060000, // 000F GETNGBL R1 K0 - 0x8C040307, // 0010 GETMET R1 R1 K7 - 0x7C040200, // 0011 CALL R1 1 - 0x94040302, // 0012 GETIDX R1 R1 K2 - 0x78060003, // 0013 JMPF R1 #0018 - 0x8C040103, // 0014 GETMET R1 R0 K3 - 0x500C0200, // 0015 LDBOOL R3 1 0 - 0x7C040400, // 0016 CALL R1 2 - 0x70020005, // 0017 JMP #001E - 0xB8060000, // 0018 GETNGBL R1 K0 - 0x8C040304, // 0019 GETMET R1 R1 K4 - 0x580C0008, // 001A LDCONST R3 K8 - 0x84100001, // 001B CLOSURE R4 P1 - 0x58140006, // 001C LDCONST R5 K6 - 0x7C040800, // 001D CALL R1 4 - 0xA0000000, // 001E CLOSE R0 - 0x80000000, // 001F RET 0 + 0x4C080000, // 0000 LDNIL R2 + 0x1C080202, // 0001 EQ R2 R1 R2 + 0x740A0004, // 0002 JMPT R2 #0008 + 0x6008000C, // 0003 GETGBL R2 G12 + 0x5C0C0200, // 0004 MOVE R3 R1 + 0x7C080200, // 0005 CALL R2 1 + 0x1C080500, // 0006 EQ R2 R2 K0 + 0x780A0001, // 0007 JMPF R2 #000A + 0x4C080000, // 0008 LDNIL R2 + 0x80040400, // 0009 RET 1 R2 + 0x58080000, // 000A LDCONST R2 K0 + 0x600C000C, // 000B GETGBL R3 G12 + 0x88100101, // 000C GETMBR R4 R0 K1 + 0x7C0C0200, // 000D CALL R3 1 + 0x140C0403, // 000E LT R3 R2 R3 + 0x780E0010, // 000F JMPF R3 #0021 + 0x880C0101, // 0010 GETMBR R3 R0 K1 + 0x940C0602, // 0011 GETIDX R3 R3 R2 + 0x8C100702, // 0012 GETMET R4 R3 K2 + 0x7C100200, // 0013 CALL R4 1 + 0x4C140000, // 0014 LDNIL R5 + 0x20140805, // 0015 NE R5 R4 R5 + 0x78160007, // 0016 JMPF R5 #001F + 0x6014000C, // 0017 GETGBL R5 G12 + 0x5C180800, // 0018 MOVE R6 R4 + 0x7C140200, // 0019 CALL R5 1 + 0x24140B00, // 001A GT R5 R5 K0 + 0x78160002, // 001B JMPF R5 #001F + 0x1C140801, // 001C EQ R5 R4 R1 + 0x78160000, // 001D JMPF R5 #001F + 0x80040600, // 001E RET 1 R3 + 0x00080503, // 001F ADD R2 R2 K3 + 0x7001FFE9, // 0020 JMP #000B + 0x4C0C0000, // 0021 LDNIL R3 + 0x80040600, // 0022 RET 1 R3 }) ) ); @@ -5871,11 +5804,11 @@ be_local_closure(Matter_Device_save_param, /* name */ /******************************************************************** -** Solidified function: mdns_announce_PASE +** Solidified function: generate_random_passcode ********************************************************************/ -be_local_closure(Matter_Device_mdns_announce_PASE, /* name */ +be_local_closure(Matter_Device_generate_random_passcode, /* name */ be_nested_proto( - 12, /* nstack */ + 7, /* nstack */ 1, /* argc */ 2, /* varg */ 0, /* has upvals */ @@ -5883,288 +5816,243 @@ be_local_closure(Matter_Device_mdns_announce_PASE, /* name */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[41]) { /* constants */ - /* K0 */ be_nested_str_weak(mdns), - /* K1 */ be_nested_str_weak(crypto), - /* K2 */ be_nested_str_weak(VP), - /* K3 */ be_nested_str_weak(vendorid), - /* K4 */ be_nested_str_weak(_X2B), - /* K5 */ be_nested_str_weak(productid), - /* K6 */ be_nested_str_weak(D), - /* K7 */ be_nested_str_weak(commissioning_discriminator), - /* K8 */ be_nested_str_weak(CM), - /* K9 */ be_const_int(1), - /* K10 */ be_nested_str_weak(T), - /* K11 */ be_const_int(0), - /* K12 */ be_nested_str_weak(SII), - /* K13 */ be_nested_str_weak(SAI), - /* K14 */ be_nested_str_weak(commissioning_instance_wifi), - /* K15 */ be_nested_str_weak(random), - /* K16 */ be_nested_str_weak(tohex), - /* K17 */ be_nested_str_weak(commissioning_instance_eth), - /* K18 */ be_nested_str_weak(hostname_eth), - /* K19 */ be_nested_str_weak(add_service), - /* K20 */ be_nested_str_weak(_matterc), - /* K21 */ be_nested_str_weak(_udp), - /* K22 */ be_nested_str_weak(mdns_pase_eth), - /* K23 */ be_nested_str_weak(tasmota), - /* K24 */ be_nested_str_weak(log), - /* K25 */ be_nested_str_weak(MTR_X3A_X20announce_X20mDNS_X20on_X20_X25s_X20_X27_X25s_X27_X20ptr_X20to_X20_X60_X25s_X2Elocal_X60), - /* K26 */ be_nested_str_weak(eth), - /* K27 */ be_const_int(2), - /* K28 */ be_nested_str_weak(_L), - /* K29 */ be_nested_str_weak(MTR_X3A_X20adding_X20subtype_X3A_X20), - /* K30 */ be_const_int(3), - /* K31 */ be_nested_str_weak(add_subtype), - /* K32 */ be_nested_str_weak(_S), - /* K33 */ be_nested_str_weak(_V), - /* K34 */ be_nested_str_weak(_CM1), - /* K35 */ be_nested_str_weak(hostname_wifi), - /* K36 */ be_nested_str_weak(mdns_pase_wifi), - /* K37 */ be_nested_str_weak(MTR_X3A_X20starting_X20mDNS_X20on_X20_X25s_X20_X27_X25s_X27_X20ptr_X20to_X20_X60_X25s_X2Elocal_X60), - /* K38 */ be_nested_str_weak(wifi), - /* K39 */ be_nested_str_weak(MTR_X3A_X20Exception), - /* K40 */ be_nested_str_weak(_X7C), + ( &(const bvalue[ 8]) { /* constants */ + /* K0 */ be_nested_str_weak(crypto), + /* K1 */ be_nested_str_weak(random), + /* K2 */ be_nested_str_weak(get), + /* K3 */ be_const_int(0), + /* K4 */ be_const_int(134217727), + /* K5 */ be_const_int(99999998), + /* K6 */ be_nested_str_weak(PASSCODE_INVALID), + /* K7 */ be_nested_str_weak(stop_iteration), }), - be_str_weak(mdns_announce_PASE), + be_str_weak(generate_random_passcode), &be_const_str_solidified, - ( &(const binstruction[236]) { /* code */ + ( &(const binstruction[35]) { /* code */ 0xA4060000, // 0000 IMPORT R1 K0 - 0xA40A0200, // 0001 IMPORT R2 K1 - 0x600C0013, // 0002 GETGBL R3 G19 - 0x7C0C0000, // 0003 CALL R3 0 - 0x60100008, // 0004 GETGBL R4 G8 - 0x88140103, // 0005 GETMBR R5 R0 K3 - 0x7C100200, // 0006 CALL R4 1 - 0x00100904, // 0007 ADD R4 R4 K4 - 0x60140008, // 0008 GETGBL R5 G8 - 0x88180105, // 0009 GETMBR R6 R0 K5 - 0x7C140200, // 000A CALL R5 1 - 0x00100805, // 000B ADD R4 R4 R5 - 0x980E0404, // 000C SETIDX R3 K2 R4 - 0x88100107, // 000D GETMBR R4 R0 K7 - 0x980E0C04, // 000E SETIDX R3 K6 R4 - 0x980E1109, // 000F SETIDX R3 K8 K9 - 0x980E150B, // 0010 SETIDX R3 K10 K11 - 0x54121387, // 0011 LDINT R4 5000 - 0x980E1804, // 0012 SETIDX R3 K12 R4 - 0x5412012B, // 0013 LDINT R4 300 - 0x980E1A04, // 0014 SETIDX R3 K13 R4 - 0x8C10050F, // 0015 GETMET R4 R2 K15 - 0x541A0007, // 0016 LDINT R6 8 - 0x7C100400, // 0017 CALL R4 2 - 0x8C100910, // 0018 GETMET R4 R4 K16 - 0x7C100200, // 0019 CALL R4 1 - 0x90021C04, // 001A SETMBR R0 K14 R4 - 0x8C10050F, // 001B GETMET R4 R2 K15 - 0x541A0007, // 001C LDINT R6 8 - 0x7C100400, // 001D CALL R4 2 - 0x8C100910, // 001E GETMET R4 R4 K16 - 0x7C100200, // 001F CALL R4 1 - 0x90022204, // 0020 SETMBR R0 K17 R4 - 0xA80200B7, // 0021 EXBLK 0 #00DA - 0x88100112, // 0022 GETMBR R4 R0 K18 - 0x78120058, // 0023 JMPF R4 #007D - 0x8C100313, // 0024 GETMET R4 R1 K19 - 0x58180014, // 0025 LDCONST R6 K20 - 0x581C0015, // 0026 LDCONST R7 K21 - 0x542215A3, // 0027 LDINT R8 5540 - 0x5C240600, // 0028 MOVE R9 R3 - 0x88280111, // 0029 GETMBR R10 R0 K17 - 0x882C0112, // 002A GETMBR R11 R0 K18 - 0x7C100E00, // 002B CALL R4 7 - 0x50100200, // 002C LDBOOL R4 1 0 - 0x90022C04, // 002D SETMBR R0 K22 R4 - 0xB8122E00, // 002E GETNGBL R4 K23 - 0x8C100918, // 002F GETMET R4 R4 K24 - 0x60180018, // 0030 GETGBL R6 G24 - 0x581C0019, // 0031 LDCONST R7 K25 - 0x5820001A, // 0032 LDCONST R8 K26 - 0x88240111, // 0033 GETMBR R9 R0 K17 - 0x88280112, // 0034 GETMBR R10 R0 K18 - 0x7C180800, // 0035 CALL R6 4 - 0x581C001B, // 0036 LDCONST R7 K27 - 0x7C100600, // 0037 CALL R4 3 - 0x60100008, // 0038 GETGBL R4 G8 - 0x88140107, // 0039 GETMBR R5 R0 K7 - 0x541A0FFE, // 003A LDINT R6 4095 - 0x2C140A06, // 003B AND R5 R5 R6 - 0x7C100200, // 003C CALL R4 1 - 0x00123804, // 003D ADD R4 K28 R4 - 0xB8162E00, // 003E GETNGBL R5 K23 - 0x8C140B18, // 003F GETMET R5 R5 K24 - 0x001E3A04, // 0040 ADD R7 K29 R4 - 0x5820001E, // 0041 LDCONST R8 K30 - 0x7C140600, // 0042 CALL R5 3 - 0x8C14031F, // 0043 GETMET R5 R1 K31 - 0x581C0014, // 0044 LDCONST R7 K20 - 0x58200015, // 0045 LDCONST R8 K21 - 0x88240111, // 0046 GETMBR R9 R0 K17 - 0x88280112, // 0047 GETMBR R10 R0 K18 - 0x5C2C0800, // 0048 MOVE R11 R4 - 0x7C140C00, // 0049 CALL R5 6 - 0x60140008, // 004A GETGBL R5 G8 - 0x88180107, // 004B GETMBR R6 R0 K7 - 0x541E0EFF, // 004C LDINT R7 3840 - 0x2C180C07, // 004D AND R6 R6 R7 - 0x541E0007, // 004E LDINT R7 8 - 0x3C180C07, // 004F SHR R6 R6 R7 - 0x7C140200, // 0050 CALL R5 1 - 0x00164005, // 0051 ADD R5 K32 R5 - 0x5C100A00, // 0052 MOVE R4 R5 - 0xB8162E00, // 0053 GETNGBL R5 K23 - 0x8C140B18, // 0054 GETMET R5 R5 K24 - 0x001E3A04, // 0055 ADD R7 K29 R4 - 0x5820001E, // 0056 LDCONST R8 K30 - 0x7C140600, // 0057 CALL R5 3 - 0x8C14031F, // 0058 GETMET R5 R1 K31 - 0x581C0014, // 0059 LDCONST R7 K20 - 0x58200015, // 005A LDCONST R8 K21 - 0x88240111, // 005B GETMBR R9 R0 K17 - 0x88280112, // 005C GETMBR R10 R0 K18 - 0x5C2C0800, // 005D MOVE R11 R4 - 0x7C140C00, // 005E CALL R5 6 - 0x60140008, // 005F GETGBL R5 G8 - 0x88180103, // 0060 GETMBR R6 R0 K3 - 0x7C140200, // 0061 CALL R5 1 - 0x00164205, // 0062 ADD R5 K33 R5 - 0x5C100A00, // 0063 MOVE R4 R5 - 0xB8162E00, // 0064 GETNGBL R5 K23 - 0x8C140B18, // 0065 GETMET R5 R5 K24 - 0x001E3A04, // 0066 ADD R7 K29 R4 - 0x5820001E, // 0067 LDCONST R8 K30 - 0x7C140600, // 0068 CALL R5 3 - 0x8C14031F, // 0069 GETMET R5 R1 K31 - 0x581C0014, // 006A LDCONST R7 K20 - 0x58200015, // 006B LDCONST R8 K21 - 0x88240111, // 006C GETMBR R9 R0 K17 - 0x88280112, // 006D GETMBR R10 R0 K18 - 0x5C2C0800, // 006E MOVE R11 R4 - 0x7C140C00, // 006F CALL R5 6 - 0x58100022, // 0070 LDCONST R4 K34 - 0xB8162E00, // 0071 GETNGBL R5 K23 - 0x8C140B18, // 0072 GETMET R5 R5 K24 - 0x001E3A04, // 0073 ADD R7 K29 R4 - 0x5820001E, // 0074 LDCONST R8 K30 - 0x7C140600, // 0075 CALL R5 3 - 0x8C14031F, // 0076 GETMET R5 R1 K31 - 0x581C0014, // 0077 LDCONST R7 K20 - 0x58200015, // 0078 LDCONST R8 K21 - 0x88240111, // 0079 GETMBR R9 R0 K17 - 0x88280112, // 007A GETMBR R10 R0 K18 - 0x5C2C0800, // 007B MOVE R11 R4 - 0x7C140C00, // 007C CALL R5 6 - 0x88100123, // 007D GETMBR R4 R0 K35 - 0x78120058, // 007E JMPF R4 #00D8 - 0x8C100313, // 007F GETMET R4 R1 K19 - 0x58180014, // 0080 LDCONST R6 K20 - 0x581C0015, // 0081 LDCONST R7 K21 - 0x542215A3, // 0082 LDINT R8 5540 - 0x5C240600, // 0083 MOVE R9 R3 - 0x8828010E, // 0084 GETMBR R10 R0 K14 - 0x882C0123, // 0085 GETMBR R11 R0 K35 - 0x7C100E00, // 0086 CALL R4 7 - 0x50100200, // 0087 LDBOOL R4 1 0 - 0x90024804, // 0088 SETMBR R0 K36 R4 - 0xB8122E00, // 0089 GETNGBL R4 K23 - 0x8C100918, // 008A GETMET R4 R4 K24 - 0x60180018, // 008B GETGBL R6 G24 - 0x581C0025, // 008C LDCONST R7 K37 - 0x58200026, // 008D LDCONST R8 K38 - 0x8824010E, // 008E GETMBR R9 R0 K14 - 0x88280123, // 008F GETMBR R10 R0 K35 - 0x7C180800, // 0090 CALL R6 4 - 0x581C001E, // 0091 LDCONST R7 K30 - 0x7C100600, // 0092 CALL R4 3 - 0x60100008, // 0093 GETGBL R4 G8 - 0x88140107, // 0094 GETMBR R5 R0 K7 - 0x541A0FFE, // 0095 LDINT R6 4095 - 0x2C140A06, // 0096 AND R5 R5 R6 - 0x7C100200, // 0097 CALL R4 1 - 0x00123804, // 0098 ADD R4 K28 R4 - 0xB8162E00, // 0099 GETNGBL R5 K23 - 0x8C140B18, // 009A GETMET R5 R5 K24 - 0x001E3A04, // 009B ADD R7 K29 R4 - 0x5820001E, // 009C LDCONST R8 K30 - 0x7C140600, // 009D CALL R5 3 - 0x8C14031F, // 009E GETMET R5 R1 K31 - 0x581C0014, // 009F LDCONST R7 K20 - 0x58200015, // 00A0 LDCONST R8 K21 - 0x8824010E, // 00A1 GETMBR R9 R0 K14 - 0x88280123, // 00A2 GETMBR R10 R0 K35 - 0x5C2C0800, // 00A3 MOVE R11 R4 - 0x7C140C00, // 00A4 CALL R5 6 - 0x60140008, // 00A5 GETGBL R5 G8 - 0x88180107, // 00A6 GETMBR R6 R0 K7 - 0x541E0EFF, // 00A7 LDINT R7 3840 - 0x2C180C07, // 00A8 AND R6 R6 R7 - 0x541E0007, // 00A9 LDINT R7 8 - 0x3C180C07, // 00AA SHR R6 R6 R7 - 0x7C140200, // 00AB CALL R5 1 - 0x00164005, // 00AC ADD R5 K32 R5 - 0x5C100A00, // 00AD MOVE R4 R5 - 0xB8162E00, // 00AE GETNGBL R5 K23 - 0x8C140B18, // 00AF GETMET R5 R5 K24 - 0x001E3A04, // 00B0 ADD R7 K29 R4 - 0x5820001E, // 00B1 LDCONST R8 K30 - 0x7C140600, // 00B2 CALL R5 3 - 0x8C14031F, // 00B3 GETMET R5 R1 K31 - 0x581C0014, // 00B4 LDCONST R7 K20 - 0x58200015, // 00B5 LDCONST R8 K21 - 0x8824010E, // 00B6 GETMBR R9 R0 K14 - 0x88280123, // 00B7 GETMBR R10 R0 K35 - 0x5C2C0800, // 00B8 MOVE R11 R4 - 0x7C140C00, // 00B9 CALL R5 6 - 0x60140008, // 00BA GETGBL R5 G8 - 0x88180103, // 00BB GETMBR R6 R0 K3 - 0x7C140200, // 00BC CALL R5 1 - 0x00164205, // 00BD ADD R5 K33 R5 - 0x5C100A00, // 00BE MOVE R4 R5 - 0xB8162E00, // 00BF GETNGBL R5 K23 - 0x8C140B18, // 00C0 GETMET R5 R5 K24 - 0x001E3A04, // 00C1 ADD R7 K29 R4 - 0x5820001E, // 00C2 LDCONST R8 K30 - 0x7C140600, // 00C3 CALL R5 3 - 0x8C14031F, // 00C4 GETMET R5 R1 K31 - 0x581C0014, // 00C5 LDCONST R7 K20 - 0x58200015, // 00C6 LDCONST R8 K21 - 0x8824010E, // 00C7 GETMBR R9 R0 K14 - 0x88280123, // 00C8 GETMBR R10 R0 K35 - 0x5C2C0800, // 00C9 MOVE R11 R4 - 0x7C140C00, // 00CA CALL R5 6 - 0x58100022, // 00CB LDCONST R4 K34 - 0xB8162E00, // 00CC GETNGBL R5 K23 - 0x8C140B18, // 00CD GETMET R5 R5 K24 - 0x001E3A04, // 00CE ADD R7 K29 R4 - 0x5820001E, // 00CF LDCONST R8 K30 - 0x7C140600, // 00D0 CALL R5 3 - 0x8C14031F, // 00D1 GETMET R5 R1 K31 - 0x581C0014, // 00D2 LDCONST R7 K20 - 0x58200015, // 00D3 LDCONST R8 K21 - 0x8824010E, // 00D4 GETMBR R9 R0 K14 - 0x88280123, // 00D5 GETMBR R10 R0 K35 - 0x5C2C0800, // 00D6 MOVE R11 R4 - 0x7C140C00, // 00D7 CALL R5 6 - 0xA8040001, // 00D8 EXBLK 1 1 - 0x70020010, // 00D9 JMP #00EB - 0xAC100002, // 00DA CATCH R4 0 2 - 0x7002000D, // 00DB JMP #00EA - 0xB81A2E00, // 00DC GETNGBL R6 K23 - 0x8C180D18, // 00DD GETMET R6 R6 K24 - 0x60200008, // 00DE GETGBL R8 G8 - 0x5C240800, // 00DF MOVE R9 R4 - 0x7C200200, // 00E0 CALL R8 1 - 0x00224E08, // 00E1 ADD R8 K39 R8 - 0x00201128, // 00E2 ADD R8 R8 K40 - 0x60240008, // 00E3 GETGBL R9 G8 - 0x5C280A00, // 00E4 MOVE R10 R5 - 0x7C240200, // 00E5 CALL R9 1 - 0x00201009, // 00E6 ADD R8 R8 R9 - 0x5824001B, // 00E7 LDCONST R9 K27 - 0x7C180600, // 00E8 CALL R6 3 - 0x70020000, // 00E9 JMP #00EB - 0xB0080000, // 00EA RAISE 2 R0 R0 - 0x80000000, // 00EB RET 0 + 0x4C080000, // 0001 LDNIL R2 + 0x500C0200, // 0002 LDBOOL R3 1 0 + 0x780E001D, // 0003 JMPF R3 #0022 + 0x8C0C0301, // 0004 GETMET R3 R1 K1 + 0x54160003, // 0005 LDINT R5 4 + 0x7C0C0400, // 0006 CALL R3 2 + 0x8C0C0702, // 0007 GETMET R3 R3 K2 + 0x58140003, // 0008 LDCONST R5 K3 + 0x541A0003, // 0009 LDINT R6 4 + 0x7C0C0600, // 000A CALL R3 3 + 0x2C0C0704, // 000B AND R3 R3 K4 + 0x5C080600, // 000C MOVE R2 R3 + 0x240C0505, // 000D GT R3 R2 K5 + 0x780E0000, // 000E JMPF R3 #0010 + 0x7001FFF1, // 000F JMP #0002 + 0x600C0010, // 0010 GETGBL R3 G16 + 0x88100106, // 0011 GETMBR R4 R0 K6 + 0x7C0C0200, // 0012 CALL R3 1 + 0xA8020005, // 0013 EXBLK 0 #001A + 0x5C100600, // 0014 MOVE R4 R3 + 0x7C100000, // 0015 CALL R4 0 + 0x1C140404, // 0016 EQ R5 R2 R4 + 0x78160000, // 0017 JMPF R5 #0019 + 0x4C080000, // 0018 LDNIL R2 + 0x7001FFF9, // 0019 JMP #0014 + 0x580C0007, // 001A LDCONST R3 K7 + 0xAC0C0200, // 001B CATCH R3 1 0 + 0xB0080000, // 001C RAISE 2 R0 R0 + 0x4C0C0000, // 001D LDNIL R3 + 0x200C0403, // 001E NE R3 R2 R3 + 0x780E0000, // 001F JMPF R3 #0021 + 0x80040400, // 0020 RET 1 R2 + 0x7001FFDF, // 0021 JMP #0002 + 0x80000000, // 0022 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: msg_received +********************************************************************/ +be_local_closure(Matter_Device_msg_received, /* name */ + be_nested_proto( + 9, /* nstack */ + 4, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str_weak(message_handler), + /* K1 */ be_nested_str_weak(msg_received), + }), + be_str_weak(msg_received), + &be_const_str_solidified, + ( &(const binstruction[ 7]) { /* code */ + 0x88100100, // 0000 GETMBR R4 R0 K0 + 0x8C100901, // 0001 GETMET R4 R4 K1 + 0x5C180200, // 0002 MOVE R6 R1 + 0x5C1C0400, // 0003 MOVE R7 R2 + 0x5C200600, // 0004 MOVE R8 R3 + 0x7C100800, // 0005 CALL R4 4 + 0x80040800, // 0006 RET 1 R4 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: is_commissioning_open +********************************************************************/ +be_local_closure(Matter_Device_is_commissioning_open, /* name */ + be_nested_proto( + 3, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str_weak(commissioning_open), + }), + be_str_weak(is_commissioning_open), + &be_const_str_solidified, + ( &(const binstruction[ 4]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x4C080000, // 0001 LDNIL R2 + 0x20040202, // 0002 NE R1 R1 R2 + 0x80040200, // 0003 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: MtrInfo_one +********************************************************************/ +be_local_closure(Matter_Device_MtrInfo_one, /* name */ + be_nested_proto( + 9, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 6]) { /* constants */ + /* K0 */ be_nested_str_weak(find_plugin_by_endpoint), + /* K1 */ be_nested_str_weak(state_json), + /* K2 */ be_nested_str_weak(_X7B_X22MtrInfo_X22_X3A_X25s_X7D), + /* K3 */ be_nested_str_weak(tasmota), + /* K4 */ be_nested_str_weak(publish_result), + /* K5 */ be_nested_str_weak(), + }), + be_str_weak(MtrInfo_one), + &be_const_str_solidified, + ( &(const binstruction[20]) { /* code */ + 0x8C080100, // 0000 GETMET R2 R0 K0 + 0x5C100200, // 0001 MOVE R4 R1 + 0x7C080400, // 0002 CALL R2 2 + 0x4C0C0000, // 0003 LDNIL R3 + 0x1C0C0403, // 0004 EQ R3 R2 R3 + 0x780E0000, // 0005 JMPF R3 #0007 + 0x80000600, // 0006 RET 0 + 0x8C0C0501, // 0007 GETMET R3 R2 K1 + 0x7C0C0200, // 0008 CALL R3 1 + 0x780E0008, // 0009 JMPF R3 #0013 + 0x60100018, // 000A GETGBL R4 G24 + 0x58140002, // 000B LDCONST R5 K2 + 0x5C180600, // 000C MOVE R6 R3 + 0x7C100400, // 000D CALL R4 2 + 0xB8160600, // 000E GETNGBL R5 K3 + 0x8C140B04, // 000F GETMET R5 R5 K4 + 0x5C1C0800, // 0010 MOVE R7 R4 + 0x58200005, // 0011 LDCONST R8 K5 + 0x7C140600, // 0012 CALL R5 3 + 0x80000000, // 0013 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: start +********************************************************************/ +be_local_closure(Matter_Device_start, /* name */ + be_nested_proto( + 6, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 1, /* has sup protos */ + ( &(const struct bproto*[ 1]) { + be_nested_proto( + 2, /* nstack */ + 0, /* argc */ + 0, /* varg */ + 1, /* has upvals */ + ( &(const bupvaldesc[ 1]) { /* upvals */ + be_local_const_upval(1, 0), + }), + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str_weak(_trigger_read_sensors), + }), + be_str_weak(_anonymous_), + &be_const_str_solidified, + ( &(const binstruction[ 4]) { /* code */ + 0x68000000, // 0000 GETUPV R0 U0 + 0x8C000100, // 0001 GETMET R0 R0 K0 + 0x7C000200, // 0002 CALL R0 1 + 0x80000000, // 0003 RET 0 + }) + ), + }), + 1, /* has constants */ + ( &(const bvalue[ 9]) { /* constants */ + /* K0 */ be_nested_str_weak(started), + /* K1 */ be_nested_str_weak(autoconf_device), + /* K2 */ be_nested_str_weak(tasmota), + /* K3 */ be_nested_str_weak(add_cron), + /* K4 */ be_nested_str_weak(_X2A_X2F30_X20_X2A_X20_X2A_X20_X2A_X20_X2A_X20_X2A), + /* K5 */ be_nested_str_weak(matter_sensors_30s), + /* K6 */ be_nested_str_weak(_start_udp), + /* K7 */ be_nested_str_weak(UDP_PORT), + /* K8 */ be_nested_str_weak(start_mdns_announce_hostnames), + }), + be_str_weak(start), + &be_const_str_solidified, + ( &(const binstruction[20]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x78060000, // 0001 JMPF R1 #0003 + 0x80000200, // 0002 RET 0 + 0x8C040101, // 0003 GETMET R1 R0 K1 + 0x7C040200, // 0004 CALL R1 1 + 0xB8060400, // 0005 GETNGBL R1 K2 + 0x8C040303, // 0006 GETMET R1 R1 K3 + 0x580C0004, // 0007 LDCONST R3 K4 + 0x84100000, // 0008 CLOSURE R4 P0 + 0x58140005, // 0009 LDCONST R5 K5 + 0x7C040800, // 000A CALL R1 4 + 0x8C040106, // 000B GETMET R1 R0 K6 + 0x880C0107, // 000C GETMBR R3 R0 K7 + 0x7C040400, // 000D CALL R1 2 + 0x8C040108, // 000E GETMET R1 R0 K8 + 0x7C040200, // 000F CALL R1 1 + 0x50040200, // 0010 LDBOOL R1 1 0 + 0x90020001, // 0011 SETMBR R0 K0 R1 + 0xA0000000, // 0012 CLOSE R0 + 0x80000000, // 0013 RET 0 }) ) ); @@ -6175,13 +6063,40 @@ be_local_closure(Matter_Device_mdns_announce_PASE, /* name */ ** Solidified class: Matter_Device ********************************************************************/ be_local_class(Matter_Device, - 37, + 36, NULL, - be_nested_map(114, + be_nested_map(112, ( (struct bmapnode*) &(const bmapnode[]) { - { be_const_key_weak(PRODUCT_ID, -1), be_const_int(32768) }, - { be_const_key_weak(autoconf_device_map, -1), be_const_closure(Matter_Device_autoconf_device_map_closure) }, - { be_const_key_weak(PASSCODE_INVALID, 23), be_const_simple_instance(be_nested_simple_instance(&be_class_list, { + { be_const_key_weak(signal_endpoints_changed, -1), be_const_closure(Matter_Device_signal_endpoints_changed_closure) }, + { be_const_key_weak(msg_send, 105), be_const_closure(Matter_Device_msg_send_closure) }, + { be_const_key_weak(sort_distinct, -1), be_const_static_closure(Matter_Device_sort_distinct_closure) }, + { be_const_key_weak(MtrInfo_one, -1), be_const_closure(Matter_Device_MtrInfo_one_closure) }, + { be_const_key_weak(plugins_persist, -1), be_const_var(2) }, + { be_const_key_weak(_init_basic_commissioning, -1), be_const_closure(Matter_Device__init_basic_commissioning_closure) }, + { be_const_key_weak(root_discriminator, -1), be_const_var(27) }, + { be_const_key_weak(hostname_wifi, 85), be_const_var(20) }, + { be_const_key_weak(plugins, 15), be_const_var(1) }, + { be_const_key_weak(start_operational_discovery_deferred, -1), be_const_closure(Matter_Device_start_operational_discovery_deferred_closure) }, + { be_const_key_weak(plugins_config, -1), be_const_var(3) }, + { be_const_key_weak(get_active_endpoints, -1), be_const_closure(Matter_Device_get_active_endpoints_closure) }, + { be_const_key_weak(is_commissioning_open, 56), be_const_closure(Matter_Device_is_commissioning_open_closure) }, + { be_const_key_weak(http_remotes, 34), be_const_var(26) }, + { be_const_key_weak(vendorid, -1), be_const_var(22) }, + { be_const_key_weak(ui, 77), be_const_var(9) }, + { be_const_key_weak(ipv4only, -1), be_const_var(29) }, + { be_const_key_weak(start_operational_discovery, 49), be_const_closure(Matter_Device_start_operational_discovery_closure) }, + { be_const_key_weak(_mdns_announce_hostname, -1), be_const_closure(Matter_Device__mdns_announce_hostname_closure) }, + { be_const_key_weak(bridge_remove_endpoint, 37), be_const_closure(Matter_Device_bridge_remove_endpoint_closure) }, + { be_const_key_weak(find_plugin_by_endpoint, -1), be_const_closure(Matter_Device_find_plugin_by_endpoint_closure) }, + { be_const_key_weak(start_mdns_announce_hostnames, -1), be_const_closure(Matter_Device_start_mdns_announce_hostnames_closure) }, + { be_const_key_weak(_start_udp, 2), be_const_closure(Matter_Device__start_udp_closure) }, + { be_const_key_weak(compute_qrcode_content, 0), be_const_closure(Matter_Device_compute_qrcode_content_closure) }, + { be_const_key_weak(msg_received, -1), be_const_closure(Matter_Device_msg_received_closure) }, + { be_const_key_weak(_instantiate_plugins_from_config, 75), be_const_closure(Matter_Device__instantiate_plugins_from_config_closure) }, + { be_const_key_weak(root_salt, 103), be_const_var(33) }, + { be_const_key_weak(udp_server, -1), be_const_var(5) }, + { be_const_key_weak(sessions, -1), be_const_var(8) }, + { be_const_key_weak(PASSCODE_INVALID, -1), be_const_simple_instance(be_nested_simple_instance(&be_class_list, { be_const_list( * be_nested_list(12, ( (struct bvalue*) &(const bvalue[]) { be_const_int(0), @@ -6197,117 +6112,132 @@ be_local_class(Matter_Device, be_const_int(12345678), be_const_int(87654321), })) ) } )) }, - { be_const_key_weak(remove_fabric, -1), be_const_closure(Matter_Device_remove_fabric_closure) }, - { be_const_key_weak(is_root_commissioning_open, -1), be_const_closure(Matter_Device_is_root_commissioning_open_closure) }, - { be_const_key_weak(_init_basic_commissioning, 4), be_const_closure(Matter_Device__init_basic_commissioning_closure) }, - { be_const_key_weak(compute_manual_pairing_code, -1), be_const_closure(Matter_Device_compute_manual_pairing_code_closure) }, - { be_const_key_weak(ui, -1), be_const_var(10) }, - { be_const_key_weak(vendorid, 50), be_const_var(23) }, - { be_const_key_weak(root_L, 87), be_const_var(36) }, - { be_const_key_weak(sessions, -1), be_const_var(9) }, - { be_const_key_weak(stop, -1), be_const_closure(Matter_Device_stop_closure) }, - { be_const_key_weak(bridge_add_endpoint, -1), be_const_closure(Matter_Device_bridge_add_endpoint_closure) }, - { be_const_key_weak(mdns_remove_op_discovery, -1), be_const_closure(Matter_Device_mdns_remove_op_discovery_closure) }, - { be_const_key_weak(start_mdns_announce_hostnames, 36), be_const_closure(Matter_Device_start_mdns_announce_hostnames_closure) }, - { be_const_key_weak(disable_bridge_mode, 17), be_const_var(31) }, - { be_const_key_weak(get_plugin_class_displayname, 1), be_const_closure(Matter_Device_get_plugin_class_displayname_closure) }, - { be_const_key_weak(http_remotes, -1), be_const_var(27) }, - { be_const_key_weak(clean_remotes, -1), be_const_closure(Matter_Device_clean_remotes_closure) }, - { be_const_key_weak(get_plugin_remote_info, 49), be_const_closure(Matter_Device_get_plugin_remote_info_closure) }, - { be_const_key_weak(_mdns_announce_hostname, -1), be_const_closure(Matter_Device__mdns_announce_hostname_closure) }, - { be_const_key_weak(register_native_classes, 55), be_const_closure(Matter_Device_register_native_classes_closure) }, - { be_const_key_weak(_start_udp, 109), be_const_closure(Matter_Device__start_udp_closure) }, - { be_const_key_weak(get_plugin_class_arg, 33), be_const_closure(Matter_Device_get_plugin_class_arg_closure) }, - { be_const_key_weak(commissioning_admin_fabric, -1), be_const_var(18) }, - { be_const_key_weak(msg_send, -1), be_const_closure(Matter_Device_msg_send_closure) }, - { be_const_key_weak(commissioning_w0, 102), be_const_var(16) }, - { be_const_key_weak(mdns_pase_eth, -1), be_const_var(25) }, - { be_const_key_weak(process_attribute_read_solo, -1), be_const_closure(Matter_Device_process_attribute_read_solo_closure) }, - { be_const_key_weak(invoke_request, 108), be_const_closure(Matter_Device_invoke_request_closure) }, - { be_const_key_weak(adjust_next_ep, 104), be_const_closure(Matter_Device_adjust_next_ep_closure) }, - { be_const_key_weak(attribute_updated, -1), be_const_closure(Matter_Device_attribute_updated_closure) }, - { be_const_key_weak(mdns_remove_PASE, 107), be_const_closure(Matter_Device_mdns_remove_PASE_closure) }, - { be_const_key_weak(_compute_pbkdf, 90), be_const_closure(Matter_Device__compute_pbkdf_closure) }, - { be_const_key_weak(ipv4only, 71), be_const_var(30) }, - { be_const_key_weak(get_active_endpoints, -1), be_const_closure(Matter_Device_get_active_endpoints_closure) }, - { be_const_key_weak(k2l_num, -1), be_const_static_closure(Matter_Device_k2l_num_closure) }, - { be_const_key_weak(autoconf_sensors_list, -1), be_const_closure(Matter_Device_autoconf_sensors_list_closure) }, - { be_const_key_weak(start_basic_commissioning, -1), be_const_closure(Matter_Device_start_basic_commissioning_closure) }, - { be_const_key_weak(bridge_remove_endpoint, 14), be_const_closure(Matter_Device_bridge_remove_endpoint_closure) }, - { be_const_key_weak(msg_received, -1), be_const_closure(Matter_Device_msg_received_closure) }, - { be_const_key_weak(start, -1), be_const_closure(Matter_Device_start_closure) }, - { be_const_key_weak(stop_basic_commissioning, -1), be_const_closure(Matter_Device_stop_basic_commissioning_closure) }, + { be_const_key_weak(started, 93), be_const_var(0) }, + { be_const_key_weak(profiler, -1), be_const_var(6) }, + { be_const_key_weak(bridge_add_endpoint, 46), be_const_closure(Matter_Device_bridge_add_endpoint_closure) }, + { be_const_key_weak(productid, -1), be_const_var(23) }, { be_const_key_weak(generate_random_passcode, -1), be_const_closure(Matter_Device_generate_random_passcode_closure) }, - { be_const_key_weak(started, 65), be_const_var(0) }, - { be_const_key_weak(signal_endpoints_changed, -1), be_const_closure(Matter_Device_signal_endpoints_changed_closure) }, - { be_const_key_weak(MtrJoin, 48), be_const_closure(Matter_Device_MtrJoin_closure) }, - { be_const_key_weak(productid, -1), be_const_var(24) }, - { be_const_key_weak(find_plugin_by_endpoint, -1), be_const_closure(Matter_Device_find_plugin_by_endpoint_closure) }, - { be_const_key_weak(PBKDF_ITERATIONS, 3), be_const_int(1000) }, - { be_const_key_weak(hostname_eth, 97), be_const_var(22) }, - { be_const_key_weak(init, 37), be_const_closure(Matter_Device_init_closure) }, - { be_const_key_weak(register_http_remote, 40), be_const_closure(Matter_Device_register_http_remote_closure) }, - { be_const_key_weak(commissioning_salt, 98), be_const_var(15) }, - { be_const_key_weak(mdns_pase_wifi, -1), be_const_var(26) }, { be_const_key_weak(load_param, -1), be_const_closure(Matter_Device_load_param_closure) }, - { be_const_key_weak(hostname_wifi, 93), be_const_var(21) }, - { be_const_key_weak(compute_qrcode_content, 45), be_const_closure(Matter_Device_compute_qrcode_content_closure) }, - { be_const_key_weak(plugins_config, -1), be_const_var(4) }, - { be_const_key_weak(start_root_basic_commissioning, -1), be_const_closure(Matter_Device_start_root_basic_commissioning_closure) }, - { be_const_key_weak(save_before_restart, -1), be_const_closure(Matter_Device_save_before_restart_closure) }, - { be_const_key_weak(register_commands, 54), be_const_closure(Matter_Device_register_commands_closure) }, - { be_const_key_weak(root_salt, -1), be_const_var(34) }, - { be_const_key_weak(commissioning_iterations, 2), be_const_var(13) }, - { be_const_key_weak(find_plugin_by_friendly_name, -1), be_const_closure(Matter_Device_find_plugin_by_friendly_name_closure) }, - { be_const_key_weak(plugins_persist, -1), be_const_var(2) }, - { be_const_key_weak(udp_server, -1), be_const_var(6) }, - { be_const_key_weak(next_ep, -1), be_const_var(32) }, - { be_const_key_weak(start_operational_discovery_deferred, 72), be_const_closure(Matter_Device_start_operational_discovery_deferred_closure) }, - { be_const_key_weak(every_second, -1), be_const_closure(Matter_Device_every_second_closure) }, - { be_const_key_weak(UDP_PORT, -1), be_const_int(5540) }, - { be_const_key_weak(mdns_announce_op_discovery, 30), be_const_closure(Matter_Device_mdns_announce_op_discovery_closure) }, - { be_const_key_weak(message_handler, -1), be_const_var(8) }, - { be_const_key_weak(process_attribute_expansion, 43), be_const_closure(Matter_Device_process_attribute_expansion_closure) }, - { be_const_key_weak(is_commissioning_open, 62), be_const_closure(Matter_Device_is_commissioning_open_closure) }, - { be_const_key_weak(start_commissioning_complete_deferred, -1), be_const_closure(Matter_Device_start_commissioning_complete_deferred_closure) }, - { be_const_key_weak(plugins_classes, 44), be_const_var(3) }, - { be_const_key_weak(start_operational_discovery, 68), be_const_closure(Matter_Device_start_operational_discovery_closure) }, - { be_const_key_weak(mdns_remove_op_discovery_all_fabrics, 9), be_const_closure(Matter_Device_mdns_remove_op_discovery_all_fabrics_closure) }, - { be_const_key_weak(commissioning_discriminator, -1), be_const_var(14) }, - { be_const_key_weak(FILENAME, -1), be_nested_str_weak(_matter_device_X2Ejson) }, - { be_const_key_weak(root_iterations, 112), be_const_var(33) }, - { be_const_key_weak(commissioning_open, -1), be_const_var(12) }, - { be_const_key_weak(_trigger_read_sensors, 82), be_const_closure(Matter_Device__trigger_read_sensors_closure) }, - { be_const_key_weak(commissioning_instance_wifi, 81), be_const_var(19) }, - { be_const_key_weak(VENDOR_ID, -1), be_const_int(65521) }, - { be_const_key_weak(tick, -1), be_const_var(11) }, - { be_const_key_weak(MtrInfo, -1), be_const_closure(Matter_Device_MtrInfo_closure) }, - { be_const_key_weak(root_discriminator, 67), be_const_var(28) }, - { be_const_key_weak(start_commissioning_complete, 7), be_const_closure(Matter_Device_start_commissioning_complete_closure) }, - { be_const_key_weak(register_plugin_class, 95), be_const_closure(Matter_Device_register_plugin_class_closure) }, + { be_const_key_weak(save_param, 62), be_const_closure(Matter_Device_save_param_closure) }, + { be_const_key_weak(init, -1), be_const_closure(Matter_Device_init_closure) }, + { be_const_key_weak(root_L, -1), be_const_var(35) }, + { be_const_key_weak(root_iterations, -1), be_const_var(32) }, + { be_const_key_weak(process_attribute_expansion, 86), be_const_closure(Matter_Device_process_attribute_expansion_closure) }, + { be_const_key_weak(_compute_pbkdf, -1), be_const_closure(Matter_Device__compute_pbkdf_closure) }, + { be_const_key_weak(commissioning_instance_wifi, -1), be_const_var(18) }, + { be_const_key_weak(register_commands, 45), be_const_closure(Matter_Device_register_commands_closure) }, + { be_const_key_weak(stop_basic_commissioning, -1), be_const_closure(Matter_Device_stop_basic_commissioning_closure) }, { be_const_key_weak(MtrUpdate, -1), be_const_closure(Matter_Device_MtrUpdate_closure) }, - { be_const_key_weak(sort_distinct, -1), be_const_static_closure(Matter_Device_sort_distinct_closure) }, - { be_const_key_weak(commissioning_instance_eth, -1), be_const_var(20) }, + { be_const_key_weak(commissioning_admin_fabric, -1), be_const_var(17) }, + { be_const_key_weak(commissioning_L, -1), be_const_var(16) }, { be_const_key_weak(conf_to_log, -1), be_const_static_closure(Matter_Device_conf_to_log_closure) }, - { be_const_key_weak(MtrInfo_one, -1), be_const_closure(Matter_Device_MtrInfo_one_closure) }, - { be_const_key_weak(received_ack, -1), be_const_closure(Matter_Device_received_ack_closure) }, - { be_const_key_weak(k2l, -1), be_const_static_closure(Matter_Device_k2l_closure) }, { be_const_key_weak(update_remotes_info, -1), be_const_closure(Matter_Device_update_remotes_info_closure) }, - { be_const_key_weak(plugins, -1), be_const_var(1) }, - { be_const_key_weak(profiler, -1), be_const_var(7) }, - { be_const_key_weak(_instantiate_plugins_from_config, -1), be_const_closure(Matter_Device__instantiate_plugins_from_config_closure) }, - { be_const_key_weak(every_50ms, 22), be_const_closure(Matter_Device_every_50ms_closure) }, - { be_const_key_weak(commissioning_L, -1), be_const_var(17) }, - { be_const_key_weak(PASE_TIMEOUT, -1), be_const_int(600) }, + { be_const_key_weak(get_plugin_class_displayname, -1), be_const_closure(Matter_Device_get_plugin_class_displayname_closure) }, + { be_const_key_weak(mdns_pase_eth, 65), be_const_var(24) }, + { be_const_key_weak(tick, -1), be_const_var(10) }, + { be_const_key_weak(mdns_pase_wifi, -1), be_const_var(25) }, + { be_const_key_weak(autoconf_device_map, -1), be_const_closure(Matter_Device_autoconf_device_map_closure) }, + { be_const_key_weak(remove_fabric, 67), be_const_closure(Matter_Device_remove_fabric_closure) }, + { be_const_key_weak(commissioning_instance_eth, -1), be_const_var(19) }, + { be_const_key_weak(start_commissioning_complete, 80), be_const_closure(Matter_Device_start_commissioning_complete_closure) }, + { be_const_key_weak(adjust_next_ep, 39), be_const_closure(Matter_Device_adjust_next_ep_closure) }, + { be_const_key_weak(commissioning_discriminator, 8), be_const_var(13) }, + { be_const_key_weak(PRODUCT_ID, 44), be_const_int(32768) }, + { be_const_key_weak(autoconf_sensors_list, -1), be_const_closure(Matter_Device_autoconf_sensors_list_closure) }, + { be_const_key_weak(UDP_PORT, 76), be_const_int(5540) }, + { be_const_key_weak(PBKDF_ITERATIONS, -1), be_const_int(1000) }, + { be_const_key_weak(every_250ms, 92), be_const_closure(Matter_Device_every_250ms_closure) }, + { be_const_key_weak(mdns_announce_PASE, 99), be_const_closure(Matter_Device_mdns_announce_PASE_closure) }, + { be_const_key_weak(mdns_remove_PASE, 50), be_const_closure(Matter_Device_mdns_remove_PASE_closure) }, + { be_const_key_weak(mdns_remove_op_discovery, -1), be_const_closure(Matter_Device_mdns_remove_op_discovery_closure) }, { be_const_key_weak(mdns_announce_op_discovery_all_fabrics, -1), be_const_closure(Matter_Device_mdns_announce_op_discovery_all_fabrics_closure) }, + { be_const_key_weak(received_ack, -1), be_const_closure(Matter_Device_received_ack_closure) }, + { be_const_key_weak(start_basic_commissioning, -1), be_const_closure(Matter_Device_start_basic_commissioning_closure) }, + { be_const_key_weak(_trigger_read_sensors, -1), be_const_closure(Matter_Device__trigger_read_sensors_closure) }, + { be_const_key_weak(every_50ms, 69), be_const_closure(Matter_Device_every_50ms_closure) }, + { be_const_key_weak(every_second, -1), be_const_closure(Matter_Device_every_second_closure) }, + { be_const_key_weak(plugins_config_remotes, 70), be_const_var(4) }, + { be_const_key_weak(VENDOR_ID, -1), be_const_int(65521) }, + { be_const_key_weak(compute_manual_pairing_code, -1), be_const_closure(Matter_Device_compute_manual_pairing_code_closure) }, + { be_const_key_weak(get_plugin_remote_info, -1), be_const_closure(Matter_Device_get_plugin_remote_info_closure) }, { be_const_key_weak(event_fabrics_saved, -1), be_const_closure(Matter_Device_event_fabrics_saved_closure) }, - { be_const_key_weak(every_250ms, -1), be_const_closure(Matter_Device_every_250ms_closure) }, { be_const_key_weak(autoconf_device, -1), be_const_closure(Matter_Device_autoconf_device_closure) }, - { be_const_key_weak(root_passcode, -1), be_const_var(29) }, - { be_const_key_weak(save_param, -1), be_const_closure(Matter_Device_save_param_closure) }, - { be_const_key_weak(mdns_announce_PASE, -1), be_const_closure(Matter_Device_mdns_announce_PASE_closure) }, - { be_const_key_weak(plugins_config_remotes, -1), be_const_var(5) }, - { be_const_key_weak(root_w0, -1), be_const_var(35) }, + { be_const_key_weak(message_handler, -1), be_const_var(7) }, + { be_const_key_weak(start_root_basic_commissioning, -1), be_const_closure(Matter_Device_start_root_basic_commissioning_closure) }, + { be_const_key_weak(commissioning_w0, -1), be_const_var(15) }, + { be_const_key_weak(start_commissioning_complete_deferred, 68), be_const_closure(Matter_Device_start_commissioning_complete_deferred_closure) }, + { be_const_key_weak(plugins_classes, -1), be_const_simple_instance(be_nested_simple_instance(&be_class_map, { + be_const_map( * be_nested_map(41, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_const_key_weak(aggregator, -1), be_const_class(be_class_Matter_Plugin_Aggregator) }, + { be_const_key_weak(light2, -1), be_const_class(be_class_Matter_Plugin_Light2) }, + { be_const_key_weak(v_light1, 26), be_const_class(be_class_Matter_Plugin_Virt_Light1) }, + { be_const_key_weak(v_light3, -1), be_const_class(be_class_Matter_Plugin_Virt_Light3) }, + { be_const_key_weak(v_flow, -1), be_const_class(be_class_Matter_Plugin_Virt_Sensor_Flow) }, + { be_const_key_weak(shutter, 14), be_const_class(be_class_Matter_Plugin_Shutter) }, + { be_const_key_weak(v_pressure, -1), be_const_class(be_class_Matter_Plugin_Virt_Sensor_Pressure) }, + { be_const_key_weak(v_temp, -1), be_const_class(be_class_Matter_Plugin_Virt_Sensor_Temp) }, + { be_const_key_weak(http_light2, 31), be_const_class(be_class_Matter_Plugin_Bridge_Light2) }, + { be_const_key_weak(http_humidity, 22), be_const_class(be_class_Matter_Plugin_Bridge_Sensor_Humidity) }, + { be_const_key_weak(pressure, 13), be_const_class(be_class_Matter_Plugin_Sensor_Pressure) }, + { be_const_key_weak(http_pressure, 29), be_const_class(be_class_Matter_Plugin_Bridge_Sensor_Pressure) }, + { be_const_key_weak(illuminance, -1), be_const_class(be_class_Matter_Plugin_Sensor_Illuminance) }, + { be_const_key_weak(light1, -1), be_const_class(be_class_Matter_Plugin_Light1) }, + { be_const_key_weak(http_light1, -1), be_const_class(be_class_Matter_Plugin_Bridge_Light1) }, + { be_const_key_weak(light3, 36), be_const_class(be_class_Matter_Plugin_Light3) }, + { be_const_key_weak(http_occupancy, 32), be_const_class(be_class_Matter_Plugin_Bridge_Sensor_Occupancy) }, + { be_const_key_weak(onoff, -1), be_const_class(be_class_Matter_Plugin_Sensor_OnOff) }, + { be_const_key_weak(contact, -1), be_const_class(be_class_Matter_Plugin_Sensor_Contact) }, + { be_const_key_weak(http_temperature, 8), be_const_class(be_class_Matter_Plugin_Bridge_Sensor_Temp) }, + { be_const_key_weak(v_occupancy, -1), be_const_class(be_class_Matter_Plugin_Virt_Sensor_Occupancy) }, + { be_const_key_weak(occupancy, -1), be_const_class(be_class_Matter_Plugin_Sensor_Occupancy) }, + { be_const_key_weak(temperature, 35), be_const_class(be_class_Matter_Plugin_Sensor_Temp) }, + { be_const_key_weak(flow, 4), be_const_class(be_class_Matter_Plugin_Sensor_Flow) }, + { be_const_key_weak(v_contact, 6), be_const_class(be_class_Matter_Plugin_Virt_Sensor_Contact) }, + { be_const_key_weak(http_relay, 3), be_const_class(be_class_Matter_Plugin_Bridge_OnOff) }, + { be_const_key_weak(v_relay, -1), be_const_class(be_class_Matter_Plugin_Virt_OnOff) }, + { be_const_key_weak(root, -1), be_const_class(be_class_Matter_Plugin_Root) }, + { be_const_key_weak(http_light3, 9), be_const_class(be_class_Matter_Plugin_Bridge_Light3) }, + { be_const_key_weak(http_contact, -1), be_const_class(be_class_Matter_Plugin_Bridge_Sensor_Contact) }, + { be_const_key_weak(http_illuminance, 17), be_const_class(be_class_Matter_Plugin_Bridge_Sensor_Illuminance) }, + { be_const_key_weak(light0, -1), be_const_class(be_class_Matter_Plugin_Light0) }, + { be_const_key_weak(v_light2, -1), be_const_class(be_class_Matter_Plugin_Virt_Light2) }, + { be_const_key_weak(v_humidity, 15), be_const_class(be_class_Matter_Plugin_Virt_Sensor_Humidity) }, + { be_const_key_weak(v_light0, -1), be_const_class(be_class_Matter_Plugin_Virt_Light0) }, + { be_const_key_weak(v_illuminance, -1), be_const_class(be_class_Matter_Plugin_Virt_Sensor_Illuminance) }, + { be_const_key_weak(relay, -1), be_const_class(be_class_Matter_Plugin_OnOff) }, + { be_const_key_weak(http_light0, -1), be_const_class(be_class_Matter_Plugin_Bridge_Light0) }, + { be_const_key_weak(shutter_X2Btilt, -1), be_const_class(be_class_Matter_Plugin_ShutterTilt) }, + { be_const_key_weak(humidity, -1), be_const_class(be_class_Matter_Plugin_Sensor_Humidity) }, + { be_const_key_weak(http_flow, -1), be_const_class(be_class_Matter_Plugin_Bridge_Sensor_Flow) }, + })) ) } )) }, + { be_const_key_weak(process_attribute_read_solo, -1), be_const_closure(Matter_Device_process_attribute_read_solo_closure) }, + { be_const_key_weak(attribute_updated, -1), be_const_closure(Matter_Device_attribute_updated_closure) }, + { be_const_key_weak(k2l_num, 57), be_const_static_closure(Matter_Device_k2l_num_closure) }, + { be_const_key_weak(FILENAME, 24), be_nested_str_weak(_matter_device_X2Ejson) }, + { be_const_key_weak(commissioning_open, -1), be_const_var(11) }, + { be_const_key_weak(MtrInfo, -1), be_const_closure(Matter_Device_MtrInfo_closure) }, + { be_const_key_weak(invoke_request, 47), be_const_closure(Matter_Device_invoke_request_closure) }, + { be_const_key_weak(next_ep, 84), be_const_var(31) }, + { be_const_key_weak(clean_remotes, -1), be_const_closure(Matter_Device_clean_remotes_closure) }, + { be_const_key_weak(MtrJoin, -1), be_const_closure(Matter_Device_MtrJoin_closure) }, + { be_const_key_weak(is_root_commissioning_open, 40), be_const_closure(Matter_Device_is_root_commissioning_open_closure) }, + { be_const_key_weak(find_plugin_by_friendly_name, -1), be_const_closure(Matter_Device_find_plugin_by_friendly_name_closure) }, + { be_const_key_weak(disable_bridge_mode, -1), be_const_var(30) }, + { be_const_key_weak(PASE_TIMEOUT, 36), be_const_int(600) }, + { be_const_key_weak(get_plugin_class_arg, -1), be_const_closure(Matter_Device_get_plugin_class_arg_closure) }, + { be_const_key_weak(register_http_remote, 31), be_const_closure(Matter_Device_register_http_remote_closure) }, + { be_const_key_weak(stop, 29), be_const_closure(Matter_Device_stop_closure) }, + { be_const_key_weak(mdns_announce_op_discovery, 27), be_const_closure(Matter_Device_mdns_announce_op_discovery_closure) }, + { be_const_key_weak(mdns_remove_op_discovery_all_fabrics, -1), be_const_closure(Matter_Device_mdns_remove_op_discovery_all_fabrics_closure) }, + { be_const_key_weak(hostname_eth, 16), be_const_var(21) }, + { be_const_key_weak(commissioning_salt, 107), be_const_var(14) }, + { be_const_key_weak(save_before_restart, 12), be_const_closure(Matter_Device_save_before_restart_closure) }, + { be_const_key_weak(root_w0, -1), be_const_var(34) }, + { be_const_key_weak(k2l, 7), be_const_static_closure(Matter_Device_k2l_closure) }, + { be_const_key_weak(commissioning_iterations, 3), be_const_var(12) }, + { be_const_key_weak(root_passcode, -1), be_const_var(28) }, + { be_const_key_weak(start, -1), be_const_closure(Matter_Device_start_closure) }, })), be_str_weak(Matter_Device) ); diff --git a/lib/libesp32/berry_tasmota/solidify_all.be b/lib/libesp32/berry_tasmota/solidify_all.be index bf2ebfc6a..8961f50af 100755 --- a/lib/libesp32/berry_tasmota/solidify_all.be +++ b/lib/libesp32/berry_tasmota/solidify_all.be @@ -5,7 +5,7 @@ import os import global import solidify -import string +import string as string2 import re import sys @@ -18,13 +18,27 @@ var globs = "path,ctypes_bytes_dyn,tasmota,ccronexpr,gpio,light,webclient,load,M "_lvgl," "int64" -for g:string.split(globs, ",") +for g:string2.split(globs, ",") global.(g) = nil end var prefix_dir = "src/embedded/" var prefix_out = "src/solidify/" +def sort(l) + # insertion sort + for i:1..size(l)-1 + var k = l[i] + var j = i + while (j > 0) && (l[j-1] > k) + l[j] = l[j-1] + j -= 1 + end + l[j] = k + end + return l +end + def clean_directory(dir) var file_list = os.listdir(dir) for f : file_list @@ -44,9 +58,9 @@ def parse_file(fname, prefix_out) var compiled = compile(src) compiled() # run the compile code to instanciate the classes and modules # output solidified - var fname_h = string.split(fname, '.be')[0] + '.h' # take whatever is before the first '.be' + var fname_h = string2.split(fname, '.be')[0] + '.h' # take whatever is before the first '.be' var fout = open(prefix_out + "solidified_" + fname_h, "w") - fout.write(format("/* Solidification of %s */\n", fname_h)) + fout.write(f"/* Solidification of {fname_h} */\n") fout.write("/********************************************************************\\\n") fout.write("* Generated code, don't edit *\n") fout.write("\\********************************************************************/\n") @@ -56,13 +70,13 @@ def parse_file(fname, prefix_out) # print(directives) for directive : directives - var object_list = string.split(directive[1], ',') + var object_list = string2.split(directive[1], ',') var object_name = object_list[0] var weak = (object_list.find('weak') != nil) # do we solidify with weak strings? var o = global var cl_name = nil var obj_name = nil - for subname : string.split(object_name, '.') + for subname : string2.split(object_name, '.') o = o.(subname) cl_name = obj_name obj_name = subname @@ -78,6 +92,7 @@ end clean_directory(prefix_out) var src_file_list = os.listdir(prefix_dir) +src_file_list = sort(src_file_list) for src_file : src_file_list if src_file[0] == '.' continue end parse_file(src_file, prefix_out) diff --git a/lib/libesp32/berry_tasmota/src/be_ULP_lib.c b/lib/libesp32/berry_tasmota/src/be_ULP_lib.c index a5fe0e417..d133b2241 100644 --- a/lib/libesp32/berry_tasmota/src/be_ULP_lib.c +++ b/lib/libesp32/berry_tasmota/src/be_ULP_lib.c @@ -8,11 +8,6 @@ #if defined(USE_BERRY_ULP) && (defined(CONFIG_IDF_TARGET_ESP32) || defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32S3)) -// #include "esp32/ulp.h" -#include "driver/rtc_io.h" -#include "driver/gpio.h" -#include "driver/adc.h" - extern void be_ULP_run(int32_t entry); BE_FUNC_CTYPE_DECLARE(be_ULP_run, "", "[i]"); @@ -25,10 +20,10 @@ BE_FUNC_CTYPE_DECLARE(be_ULP_set_mem, "i", "ii"); extern int32_t be_ULP_get_mem(int32_t pos); BE_FUNC_CTYPE_DECLARE(be_ULP_get_mem, "i", "i"); -extern int32_t be_ULP_gpio_init(gpio_num_t pin, rtc_gpio_mode_t mode); +extern int32_t be_ULP_gpio_init(int32_t pin, int32_t mode); BE_FUNC_CTYPE_DECLARE(be_ULP_gpio_init, "i", "ii"); -extern void be_ULP_adc_config(struct bvm *vm, adc1_channel_t channel, adc_atten_t attenuation, adc_bits_width_t width); +extern void be_ULP_adc_config(struct bvm *vm, int32_t channel, int32_t attenuation, int32_t width); BE_FUNC_CTYPE_DECLARE(be_ULP_adc_config, "", "@iii"); extern void be_ULP_sleep(int32_t wake_up_s); diff --git a/lib/libesp32/berry_tasmota/src/be_crypto_lib.c b/lib/libesp32/berry_tasmota/src/be_crypto_lib.c index 5cb5d7f10..4e32720a9 100644 --- a/lib/libesp32/berry_tasmota/src/be_crypto_lib.c +++ b/lib/libesp32/berry_tasmota/src/be_crypto_lib.c @@ -1,9 +1,9 @@ /******************************************************************** - * Berry module `webserver` + * Berry module `crypto` * - * To use: `import webserver` + * To use: `import crypto` * - * Allows to respond to HTTP request + * Allows to use crypto functions *******************************************************************/ #include "be_constobj.h" #include "be_mapping.h" @@ -29,6 +29,9 @@ extern int m_aes_ctr_init(bvm *vm); extern int m_aes_ctr_run(bvm *vm); extern int m_aes_ctr_tag(bvm *vm); +extern int m_aes_cbc_encrypt1(bvm *vm); +extern int m_aes_cbc_decrypt1(bvm *vm); + extern int m_ec_p256_pubkey(bvm *vm); extern int m_ec_p256_sharedkey(bvm *vm); extern int m_ec_p256_ecdsa_sign_sha256(bvm *vm); @@ -64,6 +67,7 @@ extern const bclass be_class_md5; #include "be_fixed_be_class_aes_ccm.h" #include "be_fixed_be_class_aes_gcm.h" #include "be_fixed_be_class_aes_ctr.h" +#include "be_fixed_be_class_aes_cbc.h" #include "be_fixed_be_class_ec_p256.h" #include "be_fixed_be_class_ec_c25519.h" #include "be_fixed_be_class_sha256.h" @@ -75,6 +79,10 @@ extern const bclass be_class_md5; const be_const_member_t be_crypto_members[] = { // name with prefix '/' indicates a Berry class // entries need to be sorted (ignoring the prefix char) +#ifdef USE_BERRY_CRYPTO_AES_CBC + { "/AES_CBC", (intptr_t) &be_class_aes_cbc }, +#endif // USE_BERRY_CRYPTO_AES_CBC + #ifdef USE_BERRY_CRYPTO_AES_CCM { "/AES_CCM", (intptr_t) &be_class_aes_ccm }, #endif // USE_BERRY_CRYPTO_AES_CTR @@ -162,6 +170,11 @@ class be_class_aes_ctr (scope: global, name: AES_CTR) { decrypt, func(m_aes_ctr_run) } +class be_class_aes_cbc (scope: global, name: AES_CBC) { + decrypt1, static_func(m_aes_cbc_decrypt1) + encrypt1, static_func(m_aes_cbc_encrypt1) +} + class be_class_ec_p256 (scope: global, name: EC_P256) { public_key, static_func(m_ec_p256_pubkey) shared_key, static_func(m_ec_p256_sharedkey) @@ -211,4 +224,4 @@ module crypto (scope: global) { random, func(m_crypto_random) } -@const_object_info_end */ +@const_object_info_end */ \ No newline at end of file diff --git a/lib/libesp32/berry_tasmota/src/be_leds_animator_lib.c b/lib/libesp32/berry_tasmota/src/be_leds_animator_class.c similarity index 81% rename from lib/libesp32/berry_tasmota/src/be_leds_animator_lib.c rename to lib/libesp32/berry_tasmota/src/be_leds_animator_class.c index 2c4f80ee8..3bf10367a 100644 --- a/lib/libesp32/berry_tasmota/src/be_leds_animator_lib.c +++ b/lib/libesp32/berry_tasmota/src/be_leds_animator_class.c @@ -4,6 +4,6 @@ *******************************************************************/ #ifdef USE_WS2812 -#include "solidify/solidified_leds_animator.h" +#include "solidify/solidified_leds_0_animator.h" #endif // USE_WS2812 diff --git a/lib/libesp32/berry_tasmota/src/be_leds_frame_lib.c b/lib/libesp32/berry_tasmota/src/be_leds_frame_lib.c new file mode 100644 index 000000000..a1b1c353b --- /dev/null +++ b/lib/libesp32/berry_tasmota/src/be_leds_frame_lib.c @@ -0,0 +1,39 @@ +/******************************************************************** + * Berry class `neopixelbus_ntv` + * + *******************************************************************/ + +#include "be_constobj.h" + +#ifdef USE_WS2812 + +extern int be_leds_blend(bvm *vm); +extern int be_leds_blend_pixels(bvm *vm); +extern int be_leds_fill_pixels(bvm *vm); +extern int be_leds_paste_pixels(bvm *vm); + +BE_EXPORT_VARIABLE extern const bclass be_class_bytes; + +#include "solidify/solidified_leds_frame_be_methods.h" + +/* @const_object_info_begin +class be_class_Leds_frame (scope: global, name: Leds_frame, super:be_class_bytes, strings: weak) { + pixel_size, var + + init, closure(Leds_frame_be_init_closure) + + item, closure(Leds_frame_be_item_closure) + setitem, closure(Leds_frame_be_setitem_closure) + set_pixel, closure(Leds_frame_be_set_pixel_closure) + + // the following are on buffers + blend, static_func(be_leds_blend) + fill_pixels, func(be_leds_fill_pixels) + blend_pixels, func(be_leds_blend_pixels) + paste_pixels, func(be_leds_paste_pixels) +} +@const_object_info_end */ + +#include "be_fixed_be_class_Leds_frame.h" + +#endif // USE_WS2812 diff --git a/lib/libesp32/berry_tasmota/src/be_leds_ntv_lib.c b/lib/libesp32/berry_tasmota/src/be_leds_ntv_lib.c index 5197df2e0..26ff0b69b 100644 --- a/lib/libesp32/berry_tasmota/src/be_leds_ntv_lib.c +++ b/lib/libesp32/berry_tasmota/src/be_leds_ntv_lib.c @@ -1,50 +1,31 @@ /******************************************************************** - * Berry class `neopixelbus_ntv` + * Berry class `Leds_ntv` * *******************************************************************/ -/* -class Leds_ntv - var _p # pointer to internal object of type `NeoPixelBus(uint16_t countPixels, uint8_t pin)` - var _t # type of led strip - static WS2812_GRB = 1 - static SK6812_GRBW = 2 - - # skeleton for native call - def call_native() end -end - -*/ #include "be_constobj.h" #ifdef USE_WS2812 extern int be_neopixelbus_call_native(bvm *vm); +extern int be_leds_blend_color(bvm *vm); +extern int be_leds_apply_bri_gamma(bvm *vm); +/* @const_object_info_begin +class be_class_Leds_ntv (scope: global, name: Leds_ntv, strings: weak) { + _p, var + _t, var -/******************************************************************** -** Solidified class: Leds_ntv -********************************************************************/ -be_local_class(Leds_ntv, - 2, - NULL, - be_nested_map(5, - ( (struct bmapnode*) &(const bmapnode[]) { - { be_const_key(call_native, -1), be_const_func(be_neopixelbus_call_native) }, - { be_const_key(_t, -1), be_const_var(1) }, - { be_const_key(_p, 3), be_const_var(0) }, - { be_const_key(SK6812_GRBW, 4), be_const_int(2) }, - { be_const_key(WS2812_GRB, -1), be_const_int(1) }, - })), - be_str_weak(Leds_ntv) -); -/*******************************************************************/ + WS2812_GRB, int(1) + SK6812_GRBW, int(2) -void be_load_Leds_ntv_class(bvm *vm) { - be_pushntvclass(vm, &be_class_Leds_ntv); - be_setglobal(vm, "Leds_ntv"); - be_pop(vm, 1); + call_native, func(be_neopixelbus_call_native) + + blend_color, static_func(be_leds_blend_color) + apply_bri_gamma, static_func(be_leds_apply_bri_gamma) } +@const_object_info_end */ + +#include "be_fixed_be_class_Leds_ntv.h" -// be_const_func(be_neopixelbus_call_native) #endif // USE_WS2812 diff --git a/lib/libesp32/berry_tasmota/src/be_leds_pulse_class.c b/lib/libesp32/berry_tasmota/src/be_leds_pulse_class.c new file mode 100644 index 000000000..3a2753b56 --- /dev/null +++ b/lib/libesp32/berry_tasmota/src/be_leds_pulse_class.c @@ -0,0 +1,9 @@ +/******************************************************************** + * Berry class `Leds_pulse` + * + *******************************************************************/ +#ifdef USE_WS2812 + +#include "solidify/solidified_leds_1_animate_effects.h" + +#endif // USE_WS2812 diff --git a/lib/libesp32/berry_tasmota/src/be_lv_haspmota.c b/lib/libesp32/berry_tasmota/src/be_lv_haspmota.c index 5ed132c19..bf20a03e5 100644 --- a/lib/libesp32/berry_tasmota/src/be_lv_haspmota.c +++ b/lib/libesp32/berry_tasmota/src/be_lv_haspmota.c @@ -212,13 +212,38 @@ be_local_closure(lvh_page_get_scr, /* name */ ********************************************************************/ be_local_closure(lvh_page_show, /* name */ be_nested_proto( - 14, /* nstack */ + 13, /* nstack */ 3, /* argc */ 2, /* varg */ 0, /* has upvals */ NULL, /* no upvals */ 1, /* has sup protos */ ( &(const struct bproto*[ 2]) { + be_nested_proto( + 3, /* nstack */ + 0, /* argc */ + 0, /* varg */ + 1, /* has upvals */ + ( &(const bupvaldesc[ 1]) { /* upvals */ + be_local_const_upval(1, 3), + }), + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str_weak(tasmota), + /* K1 */ be_nested_str_weak(publish_rule), + }), + be_str_weak(_X3Clambda_X3E), + &be_const_str_solidified, + ( &(const binstruction[ 5]) { /* code */ + 0xB8020000, // 0000 GETNGBL R0 K0 + 0x8C000101, // 0001 GETMET R0 R0 K1 + 0x68080000, // 0002 GETUPV R2 U0 + 0x7C000400, // 0003 CALL R0 2 + 0x80040000, // 0004 RET 1 R0 + }) + ), be_nested_proto( 3, /* nstack */ 0, /* argc */ @@ -244,34 +269,9 @@ be_local_closure(lvh_page_show, /* name */ 0x80040000, // 0004 RET 1 R0 }) ), - be_nested_proto( - 3, /* nstack */ - 0, /* argc */ - 0, /* varg */ - 1, /* has upvals */ - ( &(const bupvaldesc[ 1]) { /* upvals */ - be_local_const_upval(1, 5), - }), - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 2]) { /* constants */ - /* K0 */ be_nested_str_weak(tasmota), - /* K1 */ be_nested_str_weak(publish_rule), - }), - be_str_weak(_X3Clambda_X3E), - &be_const_str_solidified, - ( &(const binstruction[ 5]) { /* code */ - 0xB8020000, // 0000 GETNGBL R0 K0 - 0x8C000101, // 0001 GETMET R0 R0 K1 - 0x68080000, // 0002 GETUPV R2 U0 - 0x7C000400, // 0003 CALL R0 2 - 0x80040000, // 0004 RET 1 R0 - }) - ), }), 1, /* has constants */ - ( &(const bvalue[20]) { /* constants */ + ( &(const bvalue[18]) { /* constants */ /* K0 */ be_nested_str_weak(_lv_scr), /* K1 */ be_nested_str_weak(_p), /* K2 */ be_nested_str_weak(lv), @@ -279,23 +279,21 @@ be_local_closure(lvh_page_show, /* name */ /* K4 */ be_nested_str_weak(_oh), /* K5 */ be_nested_str_weak(page_dir_to), /* K6 */ be_nested_str_weak(id), - /* K7 */ be_nested_str_weak(string), - /* K8 */ be_nested_str_weak(format), - /* K9 */ be_nested_str_weak(_X7B_X22hasp_X22_X3A_X7B_X22p_X25i_X22_X3A_X22out_X22_X7D_X7D), - /* K10 */ be_nested_str_weak(lvh_page_cur_idx), - /* K11 */ be_nested_str_weak(tasmota), - /* K12 */ be_nested_str_weak(set_timer), - /* K13 */ be_const_int(0), - /* K14 */ be_nested_str_weak(_X7B_X22hasp_X22_X3A_X7B_X22p_X25i_X22_X3A_X22in_X22_X7D_X7D), - /* K15 */ be_nested_str_weak(_page_id), - /* K16 */ be_nested_str_weak(show_anim), - /* K17 */ be_nested_str_weak(find), - /* K18 */ be_nested_str_weak(SCR_LOAD_ANIM_NONE), - /* K19 */ be_nested_str_weak(scr_load_anim), + /* K7 */ be_nested_str_weak(_X7B_X22hasp_X22_X3A_X7B_X22p_X25i_X22_X3A_X22out_X22_X7D_X7D), + /* K8 */ be_nested_str_weak(lvh_page_cur_idx), + /* K9 */ be_nested_str_weak(tasmota), + /* K10 */ be_nested_str_weak(set_timer), + /* K11 */ be_const_int(0), + /* K12 */ be_nested_str_weak(_X7B_X22hasp_X22_X3A_X7B_X22p_X25i_X22_X3A_X22in_X22_X7D_X7D), + /* K13 */ be_nested_str_weak(_page_id), + /* K14 */ be_nested_str_weak(show_anim), + /* K15 */ be_nested_str_weak(find), + /* K16 */ be_nested_str_weak(SCR_LOAD_ANIM_NONE), + /* K17 */ be_nested_str_weak(scr_load_anim), }), be_str_weak(show), &be_const_str_solidified, - ( &(const binstruction[67]) { /* code */ + ( &(const binstruction[66]) { /* code */ 0x880C0100, // 0000 GETMBR R3 R0 K0 0x4C100000, // 0001 LDNIL R4 0x1C0C0604, // 0002 EQ R3 R3 R4 @@ -324,45 +322,44 @@ be_local_closure(lvh_page_show, /* name */ 0x7C140200, // 0019 CALL R5 1 0x7C0C0400, // 001A CALL R3 2 0x5C040600, // 001B MOVE R1 R3 - 0xA40E0E00, // 001C IMPORT R3 K7 - 0x8C100708, // 001D GETMET R4 R3 K8 - 0x58180009, // 001E LDCONST R6 K9 - 0x881C0104, // 001F GETMBR R7 R0 K4 - 0x881C0F0A, // 0020 GETMBR R7 R7 K10 - 0x7C100600, // 0021 CALL R4 3 - 0xB8161600, // 0022 GETNGBL R5 K11 - 0x8C140B0C, // 0023 GETMET R5 R5 K12 - 0x581C000D, // 0024 LDCONST R7 K13 - 0x84200000, // 0025 CLOSURE R8 P0 - 0x7C140600, // 0026 CALL R5 3 - 0x8C140708, // 0027 GETMET R5 R3 K8 - 0x581C000E, // 0028 LDCONST R7 K14 - 0x8820010F, // 0029 GETMBR R8 R0 K15 - 0x7C140600, // 002A CALL R5 3 - 0xB81A1600, // 002B GETNGBL R6 K11 - 0x8C180D0C, // 002C GETMET R6 R6 K12 - 0x5820000D, // 002D LDCONST R8 K13 - 0x84240001, // 002E CLOSURE R9 P1 - 0x7C180600, // 002F CALL R6 3 - 0x88180104, // 0030 GETMBR R6 R0 K4 - 0x881C010F, // 0031 GETMBR R7 R0 K15 - 0x901A1407, // 0032 SETMBR R6 K10 R7 - 0x88180110, // 0033 GETMBR R6 R0 K16 - 0x8C180D11, // 0034 GETMET R6 R6 K17 - 0x5C200200, // 0035 MOVE R8 R1 - 0xB8260400, // 0036 GETNGBL R9 K2 - 0x88241312, // 0037 GETMBR R9 R9 K18 - 0x7C180600, // 0038 CALL R6 3 - 0xB81E0400, // 0039 GETNGBL R7 K2 - 0x8C1C0F13, // 003A GETMET R7 R7 K19 - 0x88240100, // 003B GETMBR R9 R0 K0 - 0x5C280C00, // 003C MOVE R10 R6 - 0x5C2C0400, // 003D MOVE R11 R2 - 0x5830000D, // 003E LDCONST R12 K13 - 0x50340000, // 003F LDBOOL R13 0 0 - 0x7C1C0C00, // 0040 CALL R7 6 - 0xA0000000, // 0041 CLOSE R0 - 0x80000000, // 0042 RET 0 + 0x600C0018, // 001C GETGBL R3 G24 + 0x58100007, // 001D LDCONST R4 K7 + 0x88140104, // 001E GETMBR R5 R0 K4 + 0x88140B08, // 001F GETMBR R5 R5 K8 + 0x7C0C0400, // 0020 CALL R3 2 + 0xB8121200, // 0021 GETNGBL R4 K9 + 0x8C10090A, // 0022 GETMET R4 R4 K10 + 0x5818000B, // 0023 LDCONST R6 K11 + 0x841C0000, // 0024 CLOSURE R7 P0 + 0x7C100600, // 0025 CALL R4 3 + 0x60100018, // 0026 GETGBL R4 G24 + 0x5814000C, // 0027 LDCONST R5 K12 + 0x8818010D, // 0028 GETMBR R6 R0 K13 + 0x7C100400, // 0029 CALL R4 2 + 0xB8161200, // 002A GETNGBL R5 K9 + 0x8C140B0A, // 002B GETMET R5 R5 K10 + 0x581C000B, // 002C LDCONST R7 K11 + 0x84200001, // 002D CLOSURE R8 P1 + 0x7C140600, // 002E CALL R5 3 + 0x88140104, // 002F GETMBR R5 R0 K4 + 0x8818010D, // 0030 GETMBR R6 R0 K13 + 0x90161006, // 0031 SETMBR R5 K8 R6 + 0x8814010E, // 0032 GETMBR R5 R0 K14 + 0x8C140B0F, // 0033 GETMET R5 R5 K15 + 0x5C1C0200, // 0034 MOVE R7 R1 + 0xB8220400, // 0035 GETNGBL R8 K2 + 0x88201110, // 0036 GETMBR R8 R8 K16 + 0x7C140600, // 0037 CALL R5 3 + 0xB81A0400, // 0038 GETNGBL R6 K2 + 0x8C180D11, // 0039 GETMET R6 R6 K17 + 0x88200100, // 003A GETMBR R8 R0 K0 + 0x5C240A00, // 003B MOVE R9 R5 + 0x5C280400, // 003C MOVE R10 R2 + 0x582C000B, // 003D LDCONST R11 K11 + 0x50300000, // 003E LDBOOL R12 0 0 + 0x7C180C00, // 003F CALL R6 6 + 0xA0000000, // 0040 CLOSE R0 + 0x80000000, // 0041 RET 0 }) ) ); @@ -467,6 +464,2033 @@ void be_load_lvh_page_class(bvm *vm) { extern const bclass be_class_lvh_obj; +/******************************************************************** +** Solidified function: get_text_rule +********************************************************************/ +be_local_closure(lvh_obj_get_text_rule, /* name */ + be_nested_proto( + 2, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str_weak(_text_rule), + }), + be_str_weak(get_text_rule), + &be_const_str_solidified, + ( &(const binstruction[ 2]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x80040200, // 0001 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_val_rule +********************************************************************/ +be_local_closure(lvh_obj_set_val_rule, /* name */ + be_nested_proto( + 7, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 1, /* has sup protos */ + ( &(const struct bproto*[ 1]) { + be_nested_proto( + 4, /* nstack */ + 1, /* argc */ + 0, /* varg */ + 1, /* has upvals */ + ( &(const bupvaldesc[ 1]) { /* upvals */ + be_local_const_upval(1, 0), + }), + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str_weak(val_rule_matched), + }), + be_str_weak(_X3Clambda_X3E), + &be_const_str_solidified, + ( &(const binstruction[ 5]) { /* code */ + 0x68040000, // 0000 GETUPV R1 U0 + 0x8C040300, // 0001 GETMET R1 R1 K0 + 0x5C0C0000, // 0002 MOVE R3 R0 + 0x7C040400, // 0003 CALL R1 2 + 0x80040200, // 0004 RET 1 R1 + }) + ), + }), + 1, /* has constants */ + ( &(const bvalue[ 4]) { /* constants */ + /* K0 */ be_nested_str_weak(_val_rule), + /* K1 */ be_nested_str_weak(tasmota), + /* K2 */ be_nested_str_weak(remove_rule), + /* K3 */ be_nested_str_weak(add_rule), + }), + be_str_weak(set_val_rule), + &be_const_str_solidified, + ( &(const binstruction[21]) { /* code */ + 0x88080100, // 0000 GETMBR R2 R0 K0 + 0x4C0C0000, // 0001 LDNIL R3 + 0x20080403, // 0002 NE R2 R2 R3 + 0x780A0004, // 0003 JMPF R2 #0009 + 0xB80A0200, // 0004 GETNGBL R2 K1 + 0x8C080502, // 0005 GETMET R2 R2 K2 + 0x88100100, // 0006 GETMBR R4 R0 K0 + 0x5C140000, // 0007 MOVE R5 R0 + 0x7C080600, // 0008 CALL R2 3 + 0x60080008, // 0009 GETGBL R2 G8 + 0x5C0C0200, // 000A MOVE R3 R1 + 0x7C080200, // 000B CALL R2 1 + 0x90020002, // 000C SETMBR R0 K0 R2 + 0xB80A0200, // 000D GETNGBL R2 K1 + 0x8C080503, // 000E GETMET R2 R2 K3 + 0x88100100, // 000F GETMBR R4 R0 K0 + 0x84140000, // 0010 CLOSURE R5 P0 + 0x5C180000, // 0011 MOVE R6 R0 + 0x7C080800, // 0012 CALL R2 4 + 0xA0000000, // 0013 CLOSE R0 + 0x80000000, // 0014 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_value_str +********************************************************************/ +be_local_closure(lvh_obj_set_value_str, /* name */ + be_nested_proto( + 5, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str_weak(set_text), + }), + be_str_weak(set_value_str), + &be_const_str_solidified, + ( &(const binstruction[ 4]) { /* code */ + 0x8C080100, // 0000 GETMET R2 R0 K0 + 0x5C100200, // 0001 MOVE R4 R1 + 0x7C080400, // 0002 CALL R2 2 + 0x80000000, // 0003 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_text_color +********************************************************************/ +be_local_closure(lvh_obj_set_text_color, /* name */ + be_nested_proto( + 8, /* nstack */ + 3, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 3]) { /* constants */ + /* K0 */ be_nested_str_weak(_lv_obj), + /* K1 */ be_nested_str_weak(set_style_text_color), + /* K2 */ be_nested_str_weak(parse_color), + }), + be_str_weak(set_text_color), + &be_const_str_solidified, + ( &(const binstruction[ 8]) { /* code */ + 0x880C0100, // 0000 GETMBR R3 R0 K0 + 0x8C0C0701, // 0001 GETMET R3 R3 K1 + 0x8C140102, // 0002 GETMET R5 R0 K2 + 0x5C1C0200, // 0003 MOVE R7 R1 + 0x7C140400, // 0004 CALL R5 2 + 0x5C180400, // 0005 MOVE R6 R2 + 0x7C0C0600, // 0006 CALL R3 3 + 0x80000000, // 0007 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_align +********************************************************************/ +be_local_closure(lvh_obj_set_align, /* name */ + be_nested_proto( + 7, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[13]) { /* constants */ + /* K0 */ be_nested_str_weak(check_label), + /* K1 */ be_const_int(0), + /* K2 */ be_nested_str_weak(left), + /* K3 */ be_nested_str_weak(lv), + /* K4 */ be_nested_str_weak(TEXT_ALIGN_LEFT), + /* K5 */ be_const_int(1), + /* K6 */ be_nested_str_weak(center), + /* K7 */ be_nested_str_weak(TEXT_ALIGN_CENTER), + /* K8 */ be_const_int(2), + /* K9 */ be_nested_str_weak(right), + /* K10 */ be_nested_str_weak(TEXT_ALIGN_RIGHT), + /* K11 */ be_nested_str_weak(_lv_label), + /* K12 */ be_nested_str_weak(set_style_text_align), + }), + be_str_weak(set_align), + &be_const_str_solidified, + ( &(const binstruction[29]) { /* code */ + 0x4C080000, // 0000 LDNIL R2 + 0x8C0C0100, // 0001 GETMET R3 R0 K0 + 0x7C0C0200, // 0002 CALL R3 1 + 0x1C0C0301, // 0003 EQ R3 R1 K1 + 0x740E0001, // 0004 JMPT R3 #0007 + 0x1C0C0302, // 0005 EQ R3 R1 K2 + 0x780E0002, // 0006 JMPF R3 #000A + 0xB80E0600, // 0007 GETNGBL R3 K3 + 0x88080704, // 0008 GETMBR R2 R3 K4 + 0x7002000C, // 0009 JMP #0017 + 0x1C0C0305, // 000A EQ R3 R1 K5 + 0x740E0001, // 000B JMPT R3 #000E + 0x1C0C0306, // 000C EQ R3 R1 K6 + 0x780E0002, // 000D JMPF R3 #0011 + 0xB80E0600, // 000E GETNGBL R3 K3 + 0x88080707, // 000F GETMBR R2 R3 K7 + 0x70020005, // 0010 JMP #0017 + 0x1C0C0308, // 0011 EQ R3 R1 K8 + 0x740E0001, // 0012 JMPT R3 #0015 + 0x1C0C0309, // 0013 EQ R3 R1 K9 + 0x780E0001, // 0014 JMPF R3 #0017 + 0xB80E0600, // 0015 GETNGBL R3 K3 + 0x8808070A, // 0016 GETMBR R2 R3 K10 + 0x880C010B, // 0017 GETMBR R3 R0 K11 + 0x8C0C070C, // 0018 GETMET R3 R3 K12 + 0x5C140400, // 0019 MOVE R5 R2 + 0x58180001, // 001A LDCONST R6 K1 + 0x7C0C0600, // 001B CALL R3 3 + 0x80000000, // 001C RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_pad_bottom2 +********************************************************************/ +be_local_closure(lvh_obj_set_pad_bottom2, /* name */ + be_nested_proto( + 7, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 5]) { /* constants */ + /* K0 */ be_nested_str_weak(_lv_part2_selector), + /* K1 */ be_nested_str_weak(_lv_obj), + /* K2 */ be_nested_str_weak(set_style_pad_bottom), + /* K3 */ be_nested_str_weak(lv), + /* K4 */ be_nested_str_weak(STATE_DEFAULT), + }), + be_str_weak(set_pad_bottom2), + &be_const_str_solidified, + ( &(const binstruction[15]) { /* code */ + 0x88080100, // 0000 GETMBR R2 R0 K0 + 0x4C0C0000, // 0001 LDNIL R3 + 0x20080403, // 0002 NE R2 R2 R3 + 0x780A0009, // 0003 JMPF R2 #000E + 0x88080101, // 0004 GETMBR R2 R0 K1 + 0x8C080502, // 0005 GETMET R2 R2 K2 + 0x60100009, // 0006 GETGBL R4 G9 + 0x5C140200, // 0007 MOVE R5 R1 + 0x7C100200, // 0008 CALL R4 1 + 0x88140100, // 0009 GETMBR R5 R0 K0 + 0xB81A0600, // 000A GETNGBL R6 K3 + 0x88180D04, // 000B GETMBR R6 R6 K4 + 0x30140A06, // 000C OR R5 R5 R6 + 0x7C080600, // 000D CALL R2 3 + 0x80000000, // 000E RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_action +********************************************************************/ +be_local_closure(lvh_obj_set_action, /* name */ + be_nested_proto( + 4, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str_weak(_action), + }), + be_str_weak(set_action), + &be_const_str_solidified, + ( &(const binstruction[ 5]) { /* code */ + 0x60080008, // 0000 GETGBL R2 G8 + 0x5C0C0200, // 0001 MOVE R3 R1 + 0x7C080200, // 0002 CALL R2 1 + 0x90020002, // 0003 SETMBR R0 K0 R2 + 0x80000000, // 0004 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: event_cb +********************************************************************/ +be_local_closure(lvh_obj_event_cb, /* name */ + be_nested_proto( + 13, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 1, /* has sup protos */ + ( &(const struct bproto*[ 2]) { + be_nested_proto( + 4, /* nstack */ + 0, /* argc */ + 0, /* varg */ + 1, /* has upvals */ + ( &(const bupvaldesc[ 3]) { /* upvals */ + be_local_const_upval(1, 2), + be_local_const_upval(1, 0), + be_local_const_upval(1, 3), + }), + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str_weak(do_action), + }), + be_str_weak(_X3Clambda_X3E), + &be_const_str_solidified, + ( &(const binstruction[ 6]) { /* code */ + 0x68000000, // 0000 GETUPV R0 U0 + 0x8C000100, // 0001 GETMET R0 R0 K0 + 0x68080001, // 0002 GETUPV R2 U1 + 0x680C0002, // 0003 GETUPV R3 U2 + 0x7C000600, // 0004 CALL R0 3 + 0x80040000, // 0005 RET 1 R0 + }) + ), + be_nested_proto( + 3, /* nstack */ + 0, /* argc */ + 0, /* varg */ + 1, /* has upvals */ + ( &(const bupvaldesc[ 1]) { /* upvals */ + be_local_const_upval(1, 7), + }), + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str_weak(tasmota), + /* K1 */ be_nested_str_weak(publish_rule), + }), + be_str_weak(_X3Clambda_X3E), + &be_const_str_solidified, + ( &(const binstruction[ 5]) { /* code */ + 0xB8020000, // 0000 GETNGBL R0 K0 + 0x8C000101, // 0001 GETMET R0 R0 K1 + 0x68080000, // 0002 GETUPV R2 U0 + 0x7C000400, // 0003 CALL R0 2 + 0x80040000, // 0004 RET 1 R0 + }) + ), + }), + 1, /* has constants */ + ( &(const bvalue[22]) { /* constants */ + /* K0 */ be_nested_str_weak(_page), + /* K1 */ be_nested_str_weak(_oh), + /* K2 */ be_nested_str_weak(code), + /* K3 */ be_nested_str_weak(action), + /* K4 */ be_nested_str_weak(), + /* K5 */ be_nested_str_weak(lv), + /* K6 */ be_nested_str_weak(EVENT_CLICKED), + /* K7 */ be_nested_str_weak(tasmota), + /* K8 */ be_nested_str_weak(set_timer), + /* K9 */ be_const_int(0), + /* K10 */ be_nested_str_weak(_event_map), + /* K11 */ be_nested_str_weak(find), + /* K12 */ be_nested_str_weak(json), + /* K13 */ be_nested_str_weak(EVENT_VALUE_CHANGED), + /* K14 */ be_nested_str_weak(val), + /* K15 */ be_nested_str_weak(_X2C_X22val_X22_X3A_X25s), + /* K16 */ be_nested_str_weak(dump), + /* K17 */ be_nested_str_weak(text), + /* K18 */ be_nested_str_weak(_X2C_X22text_X22_X3A), + /* K19 */ be_nested_str_weak(_X7B_X22hasp_X22_X3A_X7B_X22p_X25ib_X25i_X22_X3A_X7B_X22event_X22_X3A_X22_X25s_X22_X25s_X7D_X7D_X7D), + /* K20 */ be_nested_str_weak(_page_id), + /* K21 */ be_nested_str_weak(id), + }), + be_str_weak(event_cb), + &be_const_str_solidified, + ( &(const binstruction[72]) { /* code */ + 0x88080100, // 0000 GETMBR R2 R0 K0 + 0x88080501, // 0001 GETMBR R2 R2 K1 + 0x880C0302, // 0002 GETMBR R3 R1 K2 + 0x88100103, // 0003 GETMBR R4 R0 K3 + 0x20100904, // 0004 NE R4 R4 K4 + 0x78120008, // 0005 JMPF R4 #000F + 0xB8120A00, // 0006 GETNGBL R4 K5 + 0x88100906, // 0007 GETMBR R4 R4 K6 + 0x1C100604, // 0008 EQ R4 R3 R4 + 0x78120004, // 0009 JMPF R4 #000F + 0xB8120E00, // 000A GETNGBL R4 K7 + 0x8C100908, // 000B GETMET R4 R4 K8 + 0x58180009, // 000C LDCONST R6 K9 + 0x841C0000, // 000D CLOSURE R7 P0 + 0x7C100600, // 000E CALL R4 3 + 0x8810010A, // 000F GETMBR R4 R0 K10 + 0x8C10090B, // 0010 GETMET R4 R4 K11 + 0x5C180600, // 0011 MOVE R6 R3 + 0x7C100400, // 0012 CALL R4 2 + 0x4C140000, // 0013 LDNIL R5 + 0x20140805, // 0014 NE R5 R4 R5 + 0x7816002F, // 0015 JMPF R5 #0046 + 0xA4161800, // 0016 IMPORT R5 K12 + 0x58180004, // 0017 LDCONST R6 K4 + 0x881C0302, // 0018 GETMBR R7 R1 K2 + 0xB8220A00, // 0019 GETNGBL R8 K5 + 0x8820110D, // 001A GETMBR R8 R8 K13 + 0x1C1C0E08, // 001B EQ R7 R7 R8 + 0x781E001A, // 001C JMPF R7 #0038 + 0xA8020015, // 001D EXBLK 0 #0034 + 0x881C010E, // 001E GETMBR R7 R0 K14 + 0x4C200000, // 001F LDNIL R8 + 0x20200E08, // 0020 NE R8 R7 R8 + 0x78220006, // 0021 JMPF R8 #0029 + 0x60200018, // 0022 GETGBL R8 G24 + 0x5824000F, // 0023 LDCONST R9 K15 + 0x8C280B10, // 0024 GETMET R10 R5 K16 + 0x5C300E00, // 0025 MOVE R12 R7 + 0x7C280400, // 0026 CALL R10 2 + 0x7C200400, // 0027 CALL R8 2 + 0x5C181000, // 0028 MOVE R6 R8 + 0x88200111, // 0029 GETMBR R8 R0 K17 + 0x4C240000, // 002A LDNIL R9 + 0x20241009, // 002B NE R9 R8 R9 + 0x78260004, // 002C JMPF R9 #0032 + 0x00180D12, // 002D ADD R6 R6 K18 + 0x8C240B10, // 002E GETMET R9 R5 K16 + 0x5C2C1000, // 002F MOVE R11 R8 + 0x7C240400, // 0030 CALL R9 2 + 0x00180C09, // 0031 ADD R6 R6 R9 + 0xA8040001, // 0032 EXBLK 1 1 + 0x70020003, // 0033 JMP #0038 + 0xAC1C0000, // 0034 CATCH R7 0 0 + 0x70020000, // 0035 JMP #0037 + 0x70020000, // 0036 JMP #0038 + 0xB0080000, // 0037 RAISE 2 R0 R0 + 0x601C0018, // 0038 GETGBL R7 G24 + 0x58200013, // 0039 LDCONST R8 K19 + 0x88240100, // 003A GETMBR R9 R0 K0 + 0x88241314, // 003B GETMBR R9 R9 K20 + 0x88280115, // 003C GETMBR R10 R0 K21 + 0x5C2C0800, // 003D MOVE R11 R4 + 0x5C300C00, // 003E MOVE R12 R6 + 0x7C1C0A00, // 003F CALL R7 5 + 0xB8220E00, // 0040 GETNGBL R8 K7 + 0x8C201108, // 0041 GETMET R8 R8 K8 + 0x58280009, // 0042 LDCONST R10 K9 + 0x842C0001, // 0043 CLOSURE R11 P1 + 0x7C200600, // 0044 CALL R8 3 + 0xA0140000, // 0045 CLOSE R5 + 0xA0000000, // 0046 CLOSE R0 + 0x80000000, // 0047 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_pad_all2 +********************************************************************/ +be_local_closure(lvh_obj_set_pad_all2, /* name */ + be_nested_proto( + 7, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 5]) { /* constants */ + /* K0 */ be_nested_str_weak(_lv_part2_selector), + /* K1 */ be_nested_str_weak(_lv_obj), + /* K2 */ be_nested_str_weak(set_style_pad_all), + /* K3 */ be_nested_str_weak(lv), + /* K4 */ be_nested_str_weak(STATE_DEFAULT), + }), + be_str_weak(set_pad_all2), + &be_const_str_solidified, + ( &(const binstruction[15]) { /* code */ + 0x88080100, // 0000 GETMBR R2 R0 K0 + 0x4C0C0000, // 0001 LDNIL R3 + 0x20080403, // 0002 NE R2 R2 R3 + 0x780A0009, // 0003 JMPF R2 #000E + 0x88080101, // 0004 GETMBR R2 R0 K1 + 0x8C080502, // 0005 GETMET R2 R2 K2 + 0x60100009, // 0006 GETGBL R4 G9 + 0x5C140200, // 0007 MOVE R5 R1 + 0x7C100200, // 0008 CALL R4 1 + 0x88140100, // 0009 GETMBR R5 R0 K0 + 0xB81A0600, // 000A GETNGBL R6 K3 + 0x88180D04, // 000B GETMBR R6 R6 K4 + 0x30140A06, // 000C OR R5 R5 R6 + 0x7C080600, // 000D CALL R2 3 + 0x80000000, // 000E RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: text_rule_matched +********************************************************************/ +be_local_closure(lvh_obj_text_rule_matched, /* name */ + be_nested_proto( + 10, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 7]) { /* constants */ + /* K0 */ be_nested_str_weak(int), + /* K1 */ be_nested_str_weak(_text_rule_function), + /* K2 */ be_nested_str_weak(HSP_X3A_X20failed_X20to_X20run_X20self_X2E_text_rule_function_X20_X2D_X20_X25s_X20_X28_X25s_X29), + /* K3 */ be_nested_str_weak(_text_rule_format), + /* K4 */ be_nested_str_weak(string), + /* K5 */ be_nested_str_weak(), + /* K6 */ be_nested_str_weak(text), + }), + be_str_weak(text_rule_matched), + &be_const_str_solidified, + ( &(const binstruction[47]) { /* code */ + 0x60080004, // 0000 GETGBL R2 G4 + 0x5C0C0200, // 0001 MOVE R3 R1 + 0x7C080200, // 0002 CALL R2 1 + 0x1C080500, // 0003 EQ R2 R2 K0 + 0x780A0003, // 0004 JMPF R2 #0009 + 0x6008000A, // 0005 GETGBL R2 G10 + 0x5C0C0200, // 0006 MOVE R3 R1 + 0x7C080200, // 0007 CALL R2 1 + 0x5C040400, // 0008 MOVE R1 R2 + 0x88080101, // 0009 GETMBR R2 R0 K1 + 0x4C0C0000, // 000A LDNIL R3 + 0x200C0403, // 000B NE R3 R2 R3 + 0x780E0011, // 000C JMPF R3 #001F + 0xA8020005, // 000D EXBLK 0 #0014 + 0x5C0C0400, // 000E MOVE R3 R2 + 0x5C100200, // 000F MOVE R4 R1 + 0x7C0C0200, // 0010 CALL R3 1 + 0x5C040600, // 0011 MOVE R1 R3 + 0xA8040001, // 0012 EXBLK 1 1 + 0x7002000A, // 0013 JMP #001F + 0xAC0C0002, // 0014 CATCH R3 0 2 + 0x70020007, // 0015 JMP #001E + 0x60140001, // 0016 GETGBL R5 G1 + 0x60180018, // 0017 GETGBL R6 G24 + 0x581C0002, // 0018 LDCONST R7 K2 + 0x5C200600, // 0019 MOVE R8 R3 + 0x5C240800, // 001A MOVE R9 R4 + 0x7C180600, // 001B CALL R6 3 + 0x7C140200, // 001C CALL R5 1 + 0x70020000, // 001D JMP #001F + 0xB0080000, // 001E RAISE 2 R0 R0 + 0x880C0103, // 001F GETMBR R3 R0 K3 + 0x60100004, // 0020 GETGBL R4 G4 + 0x5C140600, // 0021 MOVE R5 R3 + 0x7C100200, // 0022 CALL R4 1 + 0x1C100904, // 0023 EQ R4 R4 K4 + 0x78120005, // 0024 JMPF R4 #002B + 0x60100018, // 0025 GETGBL R4 G24 + 0x5C140600, // 0026 MOVE R5 R3 + 0x5C180200, // 0027 MOVE R6 R1 + 0x7C100400, // 0028 CALL R4 2 + 0x5C0C0800, // 0029 MOVE R3 R4 + 0x70020000, // 002A JMP #002C + 0x580C0005, // 002B LDCONST R3 K5 + 0x90020C03, // 002C SETMBR R0 K6 R3 + 0x50100000, // 002D LDBOOL R4 0 0 + 0x80040800, // 002E RET 1 R4 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_value_ofs_x +********************************************************************/ +be_local_closure(lvh_obj_set_value_ofs_x, /* name */ + be_nested_proto( + 6, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 3]) { /* constants */ + /* K0 */ be_nested_str_weak(check_label), + /* K1 */ be_nested_str_weak(_lv_label), + /* K2 */ be_nested_str_weak(set_x), + }), + be_str_weak(set_value_ofs_x), + &be_const_str_solidified, + ( &(const binstruction[ 9]) { /* code */ + 0x8C080100, // 0000 GETMET R2 R0 K0 + 0x7C080200, // 0001 CALL R2 1 + 0x88080101, // 0002 GETMBR R2 R0 K1 + 0x8C080502, // 0003 GETMET R2 R2 K2 + 0x60100009, // 0004 GETGBL R4 G9 + 0x5C140200, // 0005 MOVE R5 R1 + 0x7C100200, // 0006 CALL R4 1 + 0x7C080400, // 0007 CALL R2 2 + 0x80000000, // 0008 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_pad_right2 +********************************************************************/ +be_local_closure(lvh_obj_set_pad_right2, /* name */ + be_nested_proto( + 7, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 5]) { /* constants */ + /* K0 */ be_nested_str_weak(_lv_part2_selector), + /* K1 */ be_nested_str_weak(_lv_obj), + /* K2 */ be_nested_str_weak(set_style_pad_right), + /* K3 */ be_nested_str_weak(lv), + /* K4 */ be_nested_str_weak(STATE_DEFAULT), + }), + be_str_weak(set_pad_right2), + &be_const_str_solidified, + ( &(const binstruction[15]) { /* code */ + 0x88080100, // 0000 GETMBR R2 R0 K0 + 0x4C0C0000, // 0001 LDNIL R3 + 0x20080403, // 0002 NE R2 R2 R3 + 0x780A0009, // 0003 JMPF R2 #000E + 0x88080101, // 0004 GETMBR R2 R0 K1 + 0x8C080502, // 0005 GETMET R2 R2 K2 + 0x60100009, // 0006 GETGBL R4 G9 + 0x5C140200, // 0007 MOVE R5 R1 + 0x7C100200, // 0008 CALL R4 1 + 0x88140100, // 0009 GETMBR R5 R0 K0 + 0xB81A0600, // 000A GETNGBL R6 K3 + 0x88180D04, // 000B GETMBR R6 R6 K4 + 0x30140A06, // 000C OR R5 R5 R6 + 0x7C080600, // 000D CALL R2 3 + 0x80000000, // 000E RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: get_align +********************************************************************/ +be_local_closure(lvh_obj_get_align, /* name */ + be_nested_proto( + 5, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[10]) { /* constants */ + /* K0 */ be_nested_str_weak(_lv_label), + /* K1 */ be_nested_str_weak(get_style_text_align), + /* K2 */ be_const_int(0), + /* K3 */ be_nested_str_weak(lv), + /* K4 */ be_nested_str_weak(TEXT_ALIGN_LEFT), + /* K5 */ be_nested_str_weak(left), + /* K6 */ be_nested_str_weak(TEXT_ALIGN_CENTER), + /* K7 */ be_nested_str_weak(center), + /* K8 */ be_nested_str_weak(TEXT_ALIGN_RIGHT), + /* K9 */ be_nested_str_weak(right), + }), + be_str_weak(get_align), + &be_const_str_solidified, + ( &(const binstruction[32]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x4C080000, // 0001 LDNIL R2 + 0x1C040202, // 0002 EQ R1 R1 R2 + 0x78060001, // 0003 JMPF R1 #0006 + 0x4C040000, // 0004 LDNIL R1 + 0x80040200, // 0005 RET 1 R1 + 0x4C040000, // 0006 LDNIL R1 + 0x88080100, // 0007 GETMBR R2 R0 K0 + 0x8C080501, // 0008 GETMET R2 R2 K1 + 0x58100002, // 0009 LDCONST R4 K2 + 0x7C080400, // 000A CALL R2 2 + 0xB80A0600, // 000B GETNGBL R2 K3 + 0x88080504, // 000C GETMBR R2 R2 K4 + 0x1C080202, // 000D EQ R2 R1 R2 + 0x780A0001, // 000E JMPF R2 #0011 + 0x80060A00, // 000F RET 1 K5 + 0x7002000D, // 0010 JMP #001F + 0xB80A0600, // 0011 GETNGBL R2 K3 + 0x88080506, // 0012 GETMBR R2 R2 K6 + 0x1C080202, // 0013 EQ R2 R1 R2 + 0x780A0001, // 0014 JMPF R2 #0017 + 0x80060E00, // 0015 RET 1 K7 + 0x70020007, // 0016 JMP #001F + 0xB80A0600, // 0017 GETNGBL R2 K3 + 0x88080508, // 0018 GETMBR R2 R2 K8 + 0x1C080202, // 0019 EQ R2 R1 R2 + 0x780A0001, // 001A JMPF R2 #001D + 0x80061200, // 001B RET 1 K9 + 0x70020001, // 001C JMP #001F + 0x4C080000, // 001D LDNIL R2 + 0x80040400, // 001E RET 1 R2 + 0x80000000, // 001F RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: get_enabled +********************************************************************/ +be_local_closure(lvh_obj_get_enabled, /* name */ + be_nested_proto( + 4, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 4]) { /* constants */ + /* K0 */ be_nested_str_weak(_lv_obj), + /* K1 */ be_nested_str_weak(has_state), + /* K2 */ be_nested_str_weak(lv), + /* K3 */ be_nested_str_weak(STATE_DISABLED), + }), + be_str_weak(get_enabled), + &be_const_str_solidified, + ( &(const binstruction[ 9]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x8C040301, // 0001 GETMET R1 R1 K1 + 0xB80E0400, // 0002 GETNGBL R3 K2 + 0x880C0703, // 0003 GETMBR R3 R3 K3 + 0x7C040400, // 0004 CALL R1 2 + 0x78060000, // 0005 JMPF R1 #0007 + 0x50040001, // 0006 LDBOOL R1 0 1 + 0x50040200, // 0007 LDBOOL R1 1 0 + 0x80040200, // 0008 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: init +********************************************************************/ +be_local_closure(lvh_obj_init, /* name */ + be_nested_proto( + 8, /* nstack */ + 5, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 4]) { /* constants */ + /* K0 */ be_nested_str_weak(_page), + /* K1 */ be_nested_str_weak(_lv_class), + /* K2 */ be_nested_str_weak(_lv_obj), + /* K3 */ be_nested_str_weak(post_init), + }), + be_str_weak(init), + &be_const_str_solidified, + ( &(const binstruction[16]) { /* code */ + 0x90020002, // 0000 SETMBR R0 K0 R2 + 0x4C140000, // 0001 LDNIL R5 + 0x1C140805, // 0002 EQ R5 R4 R5 + 0x78160007, // 0003 JMPF R5 #000C + 0x88140101, // 0004 GETMBR R5 R0 K1 + 0x78160005, // 0005 JMPF R5 #000C + 0x88140101, // 0006 GETMBR R5 R0 K1 + 0x5C180A00, // 0007 MOVE R6 R5 + 0x5C1C0200, // 0008 MOVE R7 R1 + 0x7C180200, // 0009 CALL R6 1 + 0x90020406, // 000A SETMBR R0 K2 R6 + 0x70020000, // 000B JMP #000D + 0x90020404, // 000C SETMBR R0 K2 R4 + 0x8C140103, // 000D GETMET R5 R0 K3 + 0x7C140200, // 000E CALL R5 1 + 0x80000000, // 000F RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: get_text +********************************************************************/ +be_local_closure(lvh_obj_get_text, /* name */ + be_nested_proto( + 3, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str_weak(_lv_label), + /* K1 */ be_nested_str_weak(get_text), + }), + be_str_weak(get_text), + &be_const_str_solidified, + ( &(const binstruction[10]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x4C080000, // 0001 LDNIL R2 + 0x1C040202, // 0002 EQ R1 R1 R2 + 0x78060001, // 0003 JMPF R1 #0006 + 0x4C040000, // 0004 LDNIL R1 + 0x80040200, // 0005 RET 1 R1 + 0x88040100, // 0006 GETMBR R1 R0 K0 + 0x8C040301, // 0007 GETMET R1 R1 K1 + 0x7C040200, // 0008 CALL R1 1 + 0x80040200, // 0009 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: get_line_width +********************************************************************/ +be_local_closure(lvh_obj_get_line_width, /* name */ + be_nested_proto( + 5, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str_weak(_lv_obj), + /* K1 */ be_nested_str_weak(get_style_line_width), + }), + be_str_weak(get_line_width), + &be_const_str_solidified, + ( &(const binstruction[ 5]) { /* code */ + 0x88080100, // 0000 GETMBR R2 R0 K0 + 0x8C080501, // 0001 GETMET R2 R2 K1 + 0x5C100200, // 0002 MOVE R4 R1 + 0x7C080400, // 0003 CALL R2 2 + 0x80040400, // 0004 RET 1 R2 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: get_obj +********************************************************************/ +be_local_closure(lvh_obj_get_obj, /* name */ + be_nested_proto( + 2, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str_weak(_lv_obj), + }), + be_str_weak(get_obj), + &be_const_str_solidified, + ( &(const binstruction[ 2]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x80040200, // 0001 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_val_rule_formula +********************************************************************/ +be_local_closure(lvh_obj_set_val_rule_formula, /* name */ + be_nested_proto( + 11, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 5]) { /* constants */ + /* K0 */ be_nested_str_weak(_val_rule_formula), + /* K1 */ be_nested_str_weak(return_X20_X2F_X20val_X20_X2D_X3E_X20_X28), + /* K2 */ be_nested_str_weak(_X29), + /* K3 */ be_nested_str_weak(_val_rule_function), + /* K4 */ be_nested_str_weak(HSP_X3A_X20failed_X20to_X20compile_X20_X27_X25s_X27_X20_X2D_X20_X25s_X20_X28_X25s_X29), + }), + be_str_weak(set_val_rule_formula), + &be_const_str_solidified, + ( &(const binstruction[29]) { /* code */ + 0x60080008, // 0000 GETGBL R2 G8 + 0x5C0C0200, // 0001 MOVE R3 R1 + 0x7C080200, // 0002 CALL R2 1 + 0x90020002, // 0003 SETMBR R0 K0 R2 + 0x88080100, // 0004 GETMBR R2 R0 K0 + 0x000A0202, // 0005 ADD R2 K1 R2 + 0x00080502, // 0006 ADD R2 R2 K2 + 0xA8020007, // 0007 EXBLK 0 #0010 + 0x600C000D, // 0008 GETGBL R3 G13 + 0x5C100400, // 0009 MOVE R4 R2 + 0x7C0C0200, // 000A CALL R3 1 + 0x5C100600, // 000B MOVE R4 R3 + 0x7C100000, // 000C CALL R4 0 + 0x90020604, // 000D SETMBR R0 K3 R4 + 0xA8040001, // 000E EXBLK 1 1 + 0x7002000B, // 000F JMP #001C + 0xAC0C0002, // 0010 CATCH R3 0 2 + 0x70020008, // 0011 JMP #001B + 0x60140001, // 0012 GETGBL R5 G1 + 0x60180018, // 0013 GETGBL R6 G24 + 0x581C0004, // 0014 LDCONST R7 K4 + 0x5C200400, // 0015 MOVE R8 R2 + 0x5C240600, // 0016 MOVE R9 R3 + 0x5C280800, // 0017 MOVE R10 R4 + 0x7C180800, // 0018 CALL R6 4 + 0x7C140200, // 0019 CALL R5 1 + 0x70020000, // 001A JMP #001C + 0xB0080000, // 001B RAISE 2 R0 R0 + 0x80000000, // 001C RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: get_click +********************************************************************/ +be_local_closure(lvh_obj_get_click, /* name */ + be_nested_proto( + 3, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str_weak(get_enabled), + }), + be_str_weak(get_click), + &be_const_str_solidified, + ( &(const binstruction[ 3]) { /* code */ + 0x8C040100, // 0000 GETMET R1 R0 K0 + 0x7C040200, // 0001 CALL R1 1 + 0x80040200, // 0002 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_value_font +********************************************************************/ +be_local_closure(lvh_obj_set_value_font, /* name */ + be_nested_proto( + 5, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str_weak(set_text_font), + }), + be_str_weak(set_value_font), + &be_const_str_solidified, + ( &(const binstruction[ 4]) { /* code */ + 0x8C080100, // 0000 GETMET R2 R0 K0 + 0x5C100200, // 0001 MOVE R4 R1 + 0x7C080400, // 0002 CALL R2 2 + 0x80000000, // 0003 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_toggle +********************************************************************/ +be_local_closure(lvh_obj_set_toggle, /* name */ + be_nested_proto( + 7, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 9]) { /* constants */ + /* K0 */ be_nested_str_weak(string), + /* K1 */ be_nested_str_weak(toupper), + /* K2 */ be_nested_str_weak(TRUE), + /* K3 */ be_nested_str_weak(FALSE), + /* K4 */ be_nested_str_weak(_lv_obj), + /* K5 */ be_nested_str_weak(add_state), + /* K6 */ be_nested_str_weak(lv), + /* K7 */ be_nested_str_weak(STATE_CHECKED), + /* K8 */ be_nested_str_weak(clear_state), + }), + be_str_weak(set_toggle), + &be_const_str_solidified, + ( &(const binstruction[32]) { /* code */ + 0xA40A0000, // 0000 IMPORT R2 K0 + 0x600C0004, // 0001 GETGBL R3 G4 + 0x5C100200, // 0002 MOVE R4 R1 + 0x7C0C0200, // 0003 CALL R3 1 + 0x1C0C0700, // 0004 EQ R3 R3 K0 + 0x780E000C, // 0005 JMPF R3 #0013 + 0x8C0C0501, // 0006 GETMET R3 R2 K1 + 0x60140008, // 0007 GETGBL R5 G8 + 0x5C180200, // 0008 MOVE R6 R1 + 0x7C140200, // 0009 CALL R5 1 + 0x7C0C0400, // 000A CALL R3 2 + 0x5C040600, // 000B MOVE R1 R3 + 0x1C0C0302, // 000C EQ R3 R1 K2 + 0x780E0001, // 000D JMPF R3 #0010 + 0x50040200, // 000E LDBOOL R1 1 0 + 0x70020002, // 000F JMP #0013 + 0x1C0C0303, // 0010 EQ R3 R1 K3 + 0x780E0000, // 0011 JMPF R3 #0013 + 0x50040000, // 0012 LDBOOL R1 0 0 + 0x78060005, // 0013 JMPF R1 #001A + 0x880C0104, // 0014 GETMBR R3 R0 K4 + 0x8C0C0705, // 0015 GETMET R3 R3 K5 + 0xB8160C00, // 0016 GETNGBL R5 K6 + 0x88140B07, // 0017 GETMBR R5 R5 K7 + 0x7C0C0400, // 0018 CALL R3 2 + 0x70020004, // 0019 JMP #001F + 0x880C0104, // 001A GETMBR R3 R0 K4 + 0x8C0C0708, // 001B GETMET R3 R3 K8 + 0xB8160C00, // 001C GETNGBL R5 K6 + 0x88140B07, // 001D GETMBR R5 R5 K7 + 0x7C0C0400, // 001E CALL R3 2 + 0x80000000, // 001F RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: get_value_ofs_y +********************************************************************/ +be_local_closure(lvh_obj_get_value_ofs_y, /* name */ + be_nested_proto( + 3, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str_weak(_lv_label), + /* K1 */ be_nested_str_weak(get_y), + }), + be_str_weak(get_value_ofs_y), + &be_const_str_solidified, + ( &(const binstruction[ 4]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x8C040301, // 0001 GETMET R1 R1 K1 + 0x7C040200, // 0002 CALL R1 1 + 0x80040200, // 0003 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_text_rule_formula +********************************************************************/ +be_local_closure(lvh_obj_set_text_rule_formula, /* name */ + be_nested_proto( + 11, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 5]) { /* constants */ + /* K0 */ be_nested_str_weak(_text_rule_formula), + /* K1 */ be_nested_str_weak(return_X20_X2F_X20val_X20_X2D_X3E_X20_X28), + /* K2 */ be_nested_str_weak(_X29), + /* K3 */ be_nested_str_weak(_text_rule_function), + /* K4 */ be_nested_str_weak(HSP_X3A_X20failed_X20to_X20compile_X20_X27_X25s_X27_X20_X2D_X20_X25s_X20_X28_X25s_X29), + }), + be_str_weak(set_text_rule_formula), + &be_const_str_solidified, + ( &(const binstruction[29]) { /* code */ + 0x60080008, // 0000 GETGBL R2 G8 + 0x5C0C0200, // 0001 MOVE R3 R1 + 0x7C080200, // 0002 CALL R2 1 + 0x90020002, // 0003 SETMBR R0 K0 R2 + 0x88080100, // 0004 GETMBR R2 R0 K0 + 0x000A0202, // 0005 ADD R2 K1 R2 + 0x00080502, // 0006 ADD R2 R2 K2 + 0xA8020007, // 0007 EXBLK 0 #0010 + 0x600C000D, // 0008 GETGBL R3 G13 + 0x5C100400, // 0009 MOVE R4 R2 + 0x7C0C0200, // 000A CALL R3 1 + 0x5C100600, // 000B MOVE R4 R3 + 0x7C100000, // 000C CALL R4 0 + 0x90020604, // 000D SETMBR R0 K3 R4 + 0xA8040001, // 000E EXBLK 1 1 + 0x7002000B, // 000F JMP #001C + 0xAC0C0002, // 0010 CATCH R3 0 2 + 0x70020008, // 0011 JMP #001B + 0x60140001, // 0012 GETGBL R5 G1 + 0x60180018, // 0013 GETGBL R6 G24 + 0x581C0004, // 0014 LDCONST R7 K4 + 0x5C200400, // 0015 MOVE R8 R2 + 0x5C240600, // 0016 MOVE R9 R3 + 0x5C280800, // 0017 MOVE R10 R4 + 0x7C180800, // 0018 CALL R6 4 + 0x7C140200, // 0019 CALL R5 1 + 0x70020000, // 001A JMP #001C + 0xB0080000, // 001B RAISE 2 R0 R0 + 0x80000000, // 001C RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: register_event_cb +********************************************************************/ +be_local_closure(lvh_obj_register_event_cb, /* name */ + be_nested_proto( + 8, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 6]) { /* constants */ + /* K0 */ be_nested_str_weak(_page), + /* K1 */ be_nested_str_weak(_oh), + /* K2 */ be_nested_str_weak(_event_map), + /* K3 */ be_nested_str_weak(keys), + /* K4 */ be_nested_str_weak(register_event), + /* K5 */ be_nested_str_weak(stop_iteration), + }), + be_str_weak(register_event_cb), + &be_const_str_solidified, + ( &(const binstruction[19]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x88040301, // 0001 GETMBR R1 R1 K1 + 0x60080010, // 0002 GETGBL R2 G16 + 0x880C0102, // 0003 GETMBR R3 R0 K2 + 0x8C0C0703, // 0004 GETMET R3 R3 K3 + 0x7C0C0200, // 0005 CALL R3 1 + 0x7C080200, // 0006 CALL R2 1 + 0xA8020006, // 0007 EXBLK 0 #000F + 0x5C0C0400, // 0008 MOVE R3 R2 + 0x7C0C0000, // 0009 CALL R3 0 + 0x8C100304, // 000A GETMET R4 R1 K4 + 0x5C180000, // 000B MOVE R6 R0 + 0x5C1C0600, // 000C MOVE R7 R3 + 0x7C100600, // 000D CALL R4 3 + 0x7001FFF8, // 000E JMP #0008 + 0x58080005, // 000F LDCONST R2 K5 + 0xAC080200, // 0010 CATCH R2 1 0 + 0xB0080000, // 0011 RAISE 2 R0 R0 + 0x80000000, // 0012 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: digits_to_style +********************************************************************/ +be_local_closure(lvh_obj_digits_to_style, /* name */ + be_nested_proto( + 8, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 5]) { /* constants */ + /* K0 */ be_const_int(0), + /* K1 */ be_nested_str_weak(_digit2part), + /* K2 */ be_nested_str_weak(_digit2state), + /* K3 */ be_nested_str_weak(invalid_X20style_X20suffix_X20_X2502i), + /* K4 */ be_nested_str_weak(value_error), + }), + be_str_weak(digits_to_style), + &be_const_str_solidified, + ( &(const binstruction[44]) { /* code */ + 0x4C080000, // 0000 LDNIL R2 + 0x1C080202, // 0001 EQ R2 R1 R2 + 0x780A0000, // 0002 JMPF R2 #0004 + 0x80060000, // 0003 RET 1 K0 + 0x540A0009, // 0004 LDINT R2 10 + 0x0C080202, // 0005 DIV R2 R1 R2 + 0x540E0009, // 0006 LDINT R3 10 + 0x10080403, // 0007 MOD R2 R2 R3 + 0x540E0009, // 0008 LDINT R3 10 + 0x100C0203, // 0009 MOD R3 R1 R3 + 0x58100000, // 000A LDCONST R4 K0 + 0x28140500, // 000B GE R5 R2 K0 + 0x78160008, // 000C JMPF R5 #0016 + 0x6014000C, // 000D GETGBL R5 G12 + 0x88180101, // 000E GETMBR R6 R0 K1 + 0x7C140200, // 000F CALL R5 1 + 0x14140405, // 0010 LT R5 R2 R5 + 0x78160003, // 0011 JMPF R5 #0016 + 0x88140101, // 0012 GETMBR R5 R0 K1 + 0x94140A02, // 0013 GETIDX R5 R5 R2 + 0x30100805, // 0014 OR R4 R4 R5 + 0x70020000, // 0015 JMP #0017 + 0x4C100000, // 0016 LDNIL R4 + 0x28140700, // 0017 GE R5 R3 K0 + 0x78160008, // 0018 JMPF R5 #0022 + 0x6014000C, // 0019 GETGBL R5 G12 + 0x88180102, // 001A GETMBR R6 R0 K2 + 0x7C140200, // 001B CALL R5 1 + 0x14140605, // 001C LT R5 R3 R5 + 0x78160003, // 001D JMPF R5 #0022 + 0x88140102, // 001E GETMBR R5 R0 K2 + 0x94140A03, // 001F GETIDX R5 R5 R3 + 0x30100805, // 0020 OR R4 R4 R5 + 0x70020000, // 0021 JMP #0023 + 0x4C100000, // 0022 LDNIL R4 + 0x4C140000, // 0023 LDNIL R5 + 0x1C140805, // 0024 EQ R5 R4 R5 + 0x78160004, // 0025 JMPF R5 #002B + 0x60140018, // 0026 GETGBL R5 G24 + 0x58180003, // 0027 LDCONST R6 K3 + 0x5C1C0200, // 0028 MOVE R7 R1 + 0x7C140400, // 0029 CALL R5 2 + 0xB0060805, // 002A RAISE 1 K4 R5 + 0x80040800, // 002B RET 1 R4 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: get_value_color +********************************************************************/ +be_local_closure(lvh_obj_get_value_color, /* name */ + be_nested_proto( + 3, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str_weak(get_value_color), + }), + be_str_weak(get_value_color), + &be_const_str_solidified, + ( &(const binstruction[ 3]) { /* code */ + 0x8C040100, // 0000 GETMET R1 R0 K0 + 0x7C040200, // 0001 CALL R1 1 + 0x80040200, // 0002 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: get_text_color +********************************************************************/ +be_local_closure(lvh_obj_get_text_color, /* name */ + be_nested_proto( + 5, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str_weak(_lv_obj), + /* K1 */ be_nested_str_weak(get_style_text_color), + }), + be_str_weak(get_text_color), + &be_const_str_solidified, + ( &(const binstruction[ 5]) { /* code */ + 0x88080100, // 0000 GETMBR R2 R0 K0 + 0x8C080501, // 0001 GETMET R2 R2 K1 + 0x5C100200, // 0002 MOVE R4 R1 + 0x7C080400, // 0003 CALL R2 2 + 0x80040400, // 0004 RET 1 R2 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_val +********************************************************************/ +be_local_closure(lvh_obj_set_val, /* name */ + be_nested_proto( + 5, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str_weak(_lv_obj), + /* K1 */ be_nested_str_weak(set_value), + }), + be_str_weak(set_val), + &be_const_str_solidified, + ( &(const binstruction[ 5]) { /* code */ + 0x88080100, // 0000 GETMBR R2 R0 K0 + 0x8C080501, // 0001 GETMET R2 R2 K1 + 0x5C100200, // 0002 MOVE R4 R1 + 0x7C080400, // 0003 CALL R2 2 + 0x80000000, // 0004 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: setmember +********************************************************************/ +be_local_closure(lvh_obj_setmember, /* name */ + be_nested_proto( + 13, /* nstack */ + 3, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[22]) { /* constants */ + /* K0 */ be_nested_str_weak(string), + /* K1 */ be_nested_str_weak(introspect), + /* K2 */ be_const_int(0), + /* K3 */ be_const_int(3), + /* K4 */ be_nested_str_weak(set_), + /* K5 */ be_nested_str_weak(get_), + /* K6 */ be_nested_str_weak(byte), + /* K7 */ be_const_int(2147483647), + /* K8 */ be_nested_str_weak(digits_to_style), + /* K9 */ be_nested_str_weak(_attr_ignore), + /* K10 */ be_nested_str_weak(find), + /* K11 */ be_nested_str_weak(get), + /* K12 */ be_nested_str_weak(function), + /* K13 */ be_nested_str_weak(_attr_map), + /* K14 */ be_nested_str_weak(contains), + /* K15 */ be_nested_str_weak(_lv_obj), + /* K16 */ be_nested_str_weak(is_color_attribute), + /* K17 */ be_nested_str_weak(parse_color), + /* K18 */ be_nested_str_weak(style_), + /* K19 */ be_nested_str_weak(_X20for_X20), + /* K20 */ be_nested_str_weak(HSP_X3A_X20Could_X20not_X20find_X20function_X20set_), + /* K21 */ be_nested_str_weak(HSP_X3A_X20unknown_X20attribute_X3A), + }), + be_str_weak(setmember), + &be_const_str_solidified, + ( &(const binstruction[134]) { /* code */ + 0xA40E0000, // 0000 IMPORT R3 K0 + 0xA4120200, // 0001 IMPORT R4 K1 + 0x40160503, // 0002 CONNECT R5 K2 K3 + 0x94140205, // 0003 GETIDX R5 R1 R5 + 0x1C180B04, // 0004 EQ R6 R5 K4 + 0x741A0001, // 0005 JMPT R6 #0008 + 0x1C180B05, // 0006 EQ R6 R5 K5 + 0x781A0000, // 0007 JMPF R6 #0009 + 0x80000C00, // 0008 RET 0 + 0x58180002, // 0009 LDCONST R6 K2 + 0x601C000C, // 000A GETGBL R7 G12 + 0x5C200200, // 000B MOVE R8 R1 + 0x7C1C0200, // 000C CALL R7 1 + 0x281C0F03, // 000D GE R7 R7 K3 + 0x781E0021, // 000E JMPF R7 #0031 + 0x8C1C0706, // 000F GETMET R7 R3 K6 + 0x5425FFFE, // 0010 LDINT R9 -1 + 0x94240209, // 0011 GETIDX R9 R1 R9 + 0x7C1C0400, // 0012 CALL R7 2 + 0x8C200706, // 0013 GETMET R8 R3 K6 + 0x5429FFFD, // 0014 LDINT R10 -2 + 0x9428020A, // 0015 GETIDX R10 R1 R10 + 0x7C200400, // 0016 CALL R8 2 + 0x4C240000, // 0017 LDNIL R9 + 0x542A002F, // 0018 LDINT R10 48 + 0x28280E0A, // 0019 GE R10 R7 R10 + 0x782A0011, // 001A JMPF R10 #002D + 0x542A0038, // 001B LDINT R10 57 + 0x18280E0A, // 001C LE R10 R7 R10 + 0x782A000E, // 001D JMPF R10 #002D + 0x542A002F, // 001E LDINT R10 48 + 0x2828100A, // 001F GE R10 R8 R10 + 0x782A000B, // 0020 JMPF R10 #002D + 0x542A0038, // 0021 LDINT R10 57 + 0x1828100A, // 0022 LE R10 R8 R10 + 0x782A0008, // 0023 JMPF R10 #002D + 0x60280009, // 0024 GETGBL R10 G9 + 0x542DFFFD, // 0025 LDINT R11 -2 + 0x402C1707, // 0026 CONNECT R11 R11 K7 + 0x942C020B, // 0027 GETIDX R11 R1 R11 + 0x7C280200, // 0028 CALL R10 1 + 0x5C241400, // 0029 MOVE R9 R10 + 0x5429FFFC, // 002A LDINT R10 -3 + 0x402A040A, // 002B CONNECT R10 K2 R10 + 0x9404020A, // 002C GETIDX R1 R1 R10 + 0x8C280108, // 002D GETMET R10 R0 K8 + 0x5C301200, // 002E MOVE R12 R9 + 0x7C280400, // 002F CALL R10 2 + 0x5C181400, // 0030 MOVE R6 R10 + 0x881C0109, // 0031 GETMBR R7 R0 K9 + 0x8C1C0F0A, // 0032 GETMET R7 R7 K10 + 0x5C240200, // 0033 MOVE R9 R1 + 0x7C1C0400, // 0034 CALL R7 2 + 0x4C200000, // 0035 LDNIL R8 + 0x201C0E08, // 0036 NE R7 R7 R8 + 0x781E0000, // 0037 JMPF R7 #0039 + 0x80000E00, // 0038 RET 0 + 0x8C1C090B, // 0039 GETMET R7 R4 K11 + 0x5C240000, // 003A MOVE R9 R0 + 0x002A0801, // 003B ADD R10 K4 R1 + 0x7C1C0600, // 003C CALL R7 3 + 0x60200004, // 003D GETGBL R8 G4 + 0x5C240E00, // 003E MOVE R9 R7 + 0x7C200200, // 003F CALL R8 1 + 0x1C20110C, // 0040 EQ R8 R8 K12 + 0x78220005, // 0041 JMPF R8 #0048 + 0x5C200E00, // 0042 MOVE R8 R7 + 0x5C240000, // 0043 MOVE R9 R0 + 0x5C280400, // 0044 MOVE R10 R2 + 0x5C2C0C00, // 0045 MOVE R11 R6 + 0x7C200600, // 0046 CALL R8 3 + 0x80001000, // 0047 RET 0 + 0x8820010D, // 0048 GETMBR R8 R0 K13 + 0x8C20110E, // 0049 GETMET R8 R8 K14 + 0x5C280200, // 004A MOVE R10 R1 + 0x7C200400, // 004B CALL R8 2 + 0x78220033, // 004C JMPF R8 #0081 + 0x8820010D, // 004D GETMBR R8 R0 K13 + 0x94201001, // 004E GETIDX R8 R8 R1 + 0x8C24090B, // 004F GETMET R9 R4 K11 + 0x882C010F, // 0050 GETMBR R11 R0 K15 + 0x00320808, // 0051 ADD R12 K4 R8 + 0x7C240600, // 0052 CALL R9 3 + 0x5C1C1200, // 0053 MOVE R7 R9 + 0x8C240110, // 0054 GETMET R9 R0 K16 + 0x5C2C1000, // 0055 MOVE R11 R8 + 0x7C240400, // 0056 CALL R9 2 + 0x78260003, // 0057 JMPF R9 #005C + 0x8C240111, // 0058 GETMET R9 R0 K17 + 0x5C2C0400, // 0059 MOVE R11 R2 + 0x7C240400, // 005A CALL R9 2 + 0x5C081200, // 005B MOVE R2 R9 + 0x60240004, // 005C GETGBL R9 G4 + 0x5C280E00, // 005D MOVE R10 R7 + 0x7C240200, // 005E CALL R9 1 + 0x1C24130C, // 005F EQ R9 R9 K12 + 0x7826001B, // 0060 JMPF R9 #007D + 0xA8020011, // 0061 EXBLK 0 #0074 + 0x8C24070A, // 0062 GETMET R9 R3 K10 + 0x5C2C1000, // 0063 MOVE R11 R8 + 0x58300012, // 0064 LDCONST R12 K18 + 0x7C240600, // 0065 CALL R9 3 + 0x1C241302, // 0066 EQ R9 R9 K2 + 0x78260005, // 0067 JMPF R9 #006E + 0x5C240E00, // 0068 MOVE R9 R7 + 0x8828010F, // 0069 GETMBR R10 R0 K15 + 0x5C2C0400, // 006A MOVE R11 R2 + 0x5C300C00, // 006B MOVE R12 R6 + 0x7C240600, // 006C CALL R9 3 + 0x70020003, // 006D JMP #0072 + 0x5C240E00, // 006E MOVE R9 R7 + 0x8828010F, // 006F GETMBR R10 R0 K15 + 0x5C2C0400, // 0070 MOVE R11 R2 + 0x7C240400, // 0071 CALL R9 2 + 0xA8040001, // 0072 EXBLK 1 1 + 0x70020006, // 0073 JMP #007B + 0xAC240002, // 0074 CATCH R9 0 2 + 0x70020003, // 0075 JMP #007A + 0x002C1513, // 0076 ADD R11 R10 K19 + 0x002C1601, // 0077 ADD R11 R11 R1 + 0xB004120B, // 0078 RAISE 1 R9 R11 + 0x70020000, // 0079 JMP #007B + 0xB0080000, // 007A RAISE 2 R0 R0 + 0x80001200, // 007B RET 0 + 0x70020002, // 007C JMP #0080 + 0x60240001, // 007D GETGBL R9 G1 + 0x002A2808, // 007E ADD R10 K20 R8 + 0x7C240200, // 007F CALL R9 1 + 0x70020003, // 0080 JMP #0085 + 0x60200001, // 0081 GETGBL R8 G1 + 0x58240015, // 0082 LDCONST R9 K21 + 0x5C280200, // 0083 MOVE R10 R1 + 0x7C200400, // 0084 CALL R8 2 + 0x80000000, // 0085 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: check_label +********************************************************************/ +be_local_closure(lvh_obj_check_label, /* name */ + be_nested_proto( + 5, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 6]) { /* constants */ + /* K0 */ be_nested_str_weak(_lv_label), + /* K1 */ be_nested_str_weak(lv), + /* K2 */ be_nested_str_weak(label), + /* K3 */ be_nested_str_weak(get_obj), + /* K4 */ be_nested_str_weak(set_align), + /* K5 */ be_nested_str_weak(ALIGN_CENTER), + }), + be_str_weak(check_label), + &be_const_str_solidified, + ( &(const binstruction[16]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x4C080000, // 0001 LDNIL R2 + 0x1C040202, // 0002 EQ R1 R1 R2 + 0x7806000A, // 0003 JMPF R1 #000F + 0xB8060200, // 0004 GETNGBL R1 K1 + 0x8C040302, // 0005 GETMET R1 R1 K2 + 0x8C0C0103, // 0006 GETMET R3 R0 K3 + 0x7C0C0200, // 0007 CALL R3 1 + 0x7C040400, // 0008 CALL R1 2 + 0x90020001, // 0009 SETMBR R0 K0 R1 + 0x88040100, // 000A GETMBR R1 R0 K0 + 0x8C040304, // 000B GETMET R1 R1 K4 + 0xB80E0200, // 000C GETNGBL R3 K1 + 0x880C0705, // 000D GETMBR R3 R3 K5 + 0x7C040400, // 000E CALL R1 2 + 0x80000000, // 000F RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: get_mode +********************************************************************/ +be_local_closure(lvh_obj_get_mode, /* name */ + be_nested_proto( + 1, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 0, /* has constants */ + NULL, /* no const */ + be_str_weak(get_mode), + &be_const_str_solidified, + ( &(const binstruction[ 1]) { /* code */ + 0x80000000, // 0000 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_enabled +********************************************************************/ +be_local_closure(lvh_obj_set_enabled, /* name */ + be_nested_proto( + 5, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 5]) { /* constants */ + /* K0 */ be_nested_str_weak(_lv_obj), + /* K1 */ be_nested_str_weak(clear_state), + /* K2 */ be_nested_str_weak(lv), + /* K3 */ be_nested_str_weak(STATE_DISABLED), + /* K4 */ be_nested_str_weak(add_state), + }), + be_str_weak(set_enabled), + &be_const_str_solidified, + ( &(const binstruction[13]) { /* code */ + 0x78060005, // 0000 JMPF R1 #0007 + 0x88080100, // 0001 GETMBR R2 R0 K0 + 0x8C080501, // 0002 GETMET R2 R2 K1 + 0xB8120400, // 0003 GETNGBL R4 K2 + 0x88100903, // 0004 GETMBR R4 R4 K3 + 0x7C080400, // 0005 CALL R2 2 + 0x70020004, // 0006 JMP #000C + 0x88080100, // 0007 GETMBR R2 R0 K0 + 0x8C080504, // 0008 GETMET R2 R2 K4 + 0xB8120400, // 0009 GETNGBL R4 K2 + 0x88100903, // 000A GETMBR R4 R4 K3 + 0x7C080400, // 000B CALL R2 2 + 0x80000000, // 000C RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_pad_left2 +********************************************************************/ +be_local_closure(lvh_obj_set_pad_left2, /* name */ + be_nested_proto( + 7, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 5]) { /* constants */ + /* K0 */ be_nested_str_weak(_lv_part2_selector), + /* K1 */ be_nested_str_weak(_lv_obj), + /* K2 */ be_nested_str_weak(set_style_pad_left), + /* K3 */ be_nested_str_weak(lv), + /* K4 */ be_nested_str_weak(STATE_DEFAULT), + }), + be_str_weak(set_pad_left2), + &be_const_str_solidified, + ( &(const binstruction[15]) { /* code */ + 0x88080100, // 0000 GETMBR R2 R0 K0 + 0x4C0C0000, // 0001 LDNIL R3 + 0x20080403, // 0002 NE R2 R2 R3 + 0x780A0009, // 0003 JMPF R2 #000E + 0x88080101, // 0004 GETMBR R2 R0 K1 + 0x8C080502, // 0005 GETMET R2 R2 K2 + 0x60100009, // 0006 GETGBL R4 G9 + 0x5C140200, // 0007 MOVE R5 R1 + 0x7C100200, // 0008 CALL R4 1 + 0x88140100, // 0009 GETMBR R5 R0 K0 + 0xB81A0600, // 000A GETNGBL R6 K3 + 0x88180D04, // 000B GETMBR R6 R6 K4 + 0x30140A06, // 000C OR R5 R5 R6 + 0x7C080600, // 000D CALL R2 3 + 0x80000000, // 000E RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: get_pad_bottom +********************************************************************/ +be_local_closure(lvh_obj_get_pad_bottom, /* name */ + be_nested_proto( + 5, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 5]) { /* constants */ + /* K0 */ be_nested_str_weak(_lv_part2_selector), + /* K1 */ be_nested_str_weak(_lv_obj), + /* K2 */ be_nested_str_weak(get_style_pad_bottom), + /* K3 */ be_nested_str_weak(lv), + /* K4 */ be_nested_str_weak(STATE_DEFAULT), + }), + be_str_weak(get_pad_bottom), + &be_const_str_solidified, + ( &(const binstruction[13]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x4C080000, // 0001 LDNIL R2 + 0x20040202, // 0002 NE R1 R1 R2 + 0x78060007, // 0003 JMPF R1 #000C + 0x88040101, // 0004 GETMBR R1 R0 K1 + 0x8C040302, // 0005 GETMET R1 R1 K2 + 0x880C0100, // 0006 GETMBR R3 R0 K0 + 0xB8120600, // 0007 GETNGBL R4 K3 + 0x88100904, // 0008 GETMBR R4 R4 K4 + 0x300C0604, // 0009 OR R3 R3 R4 + 0x7C040400, // 000A CALL R1 2 + 0x80040200, // 000B RET 1 R1 + 0x80000000, // 000C RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: member +********************************************************************/ +be_local_closure(lvh_obj_member, /* name */ + be_nested_proto( + 12, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[19]) { /* constants */ + /* K0 */ be_nested_str_weak(string), + /* K1 */ be_nested_str_weak(introspect), + /* K2 */ be_const_int(0), + /* K3 */ be_const_int(3), + /* K4 */ be_nested_str_weak(set_), + /* K5 */ be_nested_str_weak(get_), + /* K6 */ be_nested_str_weak(byte), + /* K7 */ be_const_int(2147483647), + /* K8 */ be_nested_str_weak(digits_to_style), + /* K9 */ be_nested_str_weak(_attr_ignore), + /* K10 */ be_nested_str_weak(find), + /* K11 */ be_nested_str_weak(get), + /* K12 */ be_nested_str_weak(function), + /* K13 */ be_nested_str_weak(_attr_map), + /* K14 */ be_nested_str_weak(contains), + /* K15 */ be_nested_str_weak(_lv_obj), + /* K16 */ be_nested_str_weak(style_), + /* K17 */ be_nested_str_weak(unknown_X20attribute_X20), + /* K18 */ be_nested_str_weak(value_error), + }), + be_str_weak(member), + &be_const_str_solidified, + ( &(const binstruction[110]) { /* code */ + 0xA40A0000, // 0000 IMPORT R2 K0 + 0xA40E0200, // 0001 IMPORT R3 K1 + 0x40120503, // 0002 CONNECT R4 K2 K3 + 0x94100204, // 0003 GETIDX R4 R1 R4 + 0x1C140904, // 0004 EQ R5 R4 K4 + 0x74160001, // 0005 JMPT R5 #0008 + 0x1C140905, // 0006 EQ R5 R4 K5 + 0x78160000, // 0007 JMPF R5 #0009 + 0x80000A00, // 0008 RET 0 + 0x58140002, // 0009 LDCONST R5 K2 + 0x6018000C, // 000A GETGBL R6 G12 + 0x5C1C0200, // 000B MOVE R7 R1 + 0x7C180200, // 000C CALL R6 1 + 0x28180D03, // 000D GE R6 R6 K3 + 0x781A0021, // 000E JMPF R6 #0031 + 0x8C180506, // 000F GETMET R6 R2 K6 + 0x5421FFFE, // 0010 LDINT R8 -1 + 0x94200208, // 0011 GETIDX R8 R1 R8 + 0x7C180400, // 0012 CALL R6 2 + 0x8C1C0506, // 0013 GETMET R7 R2 K6 + 0x5425FFFD, // 0014 LDINT R9 -2 + 0x94240209, // 0015 GETIDX R9 R1 R9 + 0x7C1C0400, // 0016 CALL R7 2 + 0x4C200000, // 0017 LDNIL R8 + 0x5426002F, // 0018 LDINT R9 48 + 0x28240C09, // 0019 GE R9 R6 R9 + 0x78260011, // 001A JMPF R9 #002D + 0x54260038, // 001B LDINT R9 57 + 0x18240C09, // 001C LE R9 R6 R9 + 0x7826000E, // 001D JMPF R9 #002D + 0x5426002F, // 001E LDINT R9 48 + 0x28240E09, // 001F GE R9 R7 R9 + 0x7826000B, // 0020 JMPF R9 #002D + 0x54260038, // 0021 LDINT R9 57 + 0x18240E09, // 0022 LE R9 R7 R9 + 0x78260008, // 0023 JMPF R9 #002D + 0x60240009, // 0024 GETGBL R9 G9 + 0x5429FFFD, // 0025 LDINT R10 -2 + 0x40281507, // 0026 CONNECT R10 R10 K7 + 0x9428020A, // 0027 GETIDX R10 R1 R10 + 0x7C240200, // 0028 CALL R9 1 + 0x5C201200, // 0029 MOVE R8 R9 + 0x5425FFFC, // 002A LDINT R9 -3 + 0x40260409, // 002B CONNECT R9 K2 R9 + 0x94040209, // 002C GETIDX R1 R1 R9 + 0x8C240108, // 002D GETMET R9 R0 K8 + 0x5C2C1000, // 002E MOVE R11 R8 + 0x7C240400, // 002F CALL R9 2 + 0x5C141200, // 0030 MOVE R5 R9 + 0x88180109, // 0031 GETMBR R6 R0 K9 + 0x8C180D0A, // 0032 GETMET R6 R6 K10 + 0x5C200200, // 0033 MOVE R8 R1 + 0x7C180400, // 0034 CALL R6 2 + 0x4C1C0000, // 0035 LDNIL R7 + 0x20180C07, // 0036 NE R6 R6 R7 + 0x781A0000, // 0037 JMPF R6 #0039 + 0x80000C00, // 0038 RET 0 + 0x8C18070B, // 0039 GETMET R6 R3 K11 + 0x5C200000, // 003A MOVE R8 R0 + 0x00260A01, // 003B ADD R9 K5 R1 + 0x7C180600, // 003C CALL R6 3 + 0x601C0004, // 003D GETGBL R7 G4 + 0x5C200C00, // 003E MOVE R8 R6 + 0x7C1C0200, // 003F CALL R7 1 + 0x1C1C0F0C, // 0040 EQ R7 R7 K12 + 0x781E0004, // 0041 JMPF R7 #0047 + 0x5C1C0C00, // 0042 MOVE R7 R6 + 0x5C200000, // 0043 MOVE R8 R0 + 0x5C240A00, // 0044 MOVE R9 R5 + 0x7C1C0400, // 0045 CALL R7 2 + 0x80040E00, // 0046 RET 1 R7 + 0x881C010D, // 0047 GETMBR R7 R0 K13 + 0x8C1C0F0E, // 0048 GETMET R7 R7 K14 + 0x5C240200, // 0049 MOVE R9 R1 + 0x7C1C0400, // 004A CALL R7 2 + 0x781E001B, // 004B JMPF R7 #0068 + 0x881C010D, // 004C GETMBR R7 R0 K13 + 0x941C0E01, // 004D GETIDX R7 R7 R1 + 0x8C20070B, // 004E GETMET R8 R3 K11 + 0x8828010F, // 004F GETMBR R10 R0 K15 + 0x002E0A07, // 0050 ADD R11 K5 R7 + 0x7C200600, // 0051 CALL R8 3 + 0x5C181000, // 0052 MOVE R6 R8 + 0x60200004, // 0053 GETGBL R8 G4 + 0x5C240C00, // 0054 MOVE R9 R6 + 0x7C200200, // 0055 CALL R8 1 + 0x1C20110C, // 0056 EQ R8 R8 K12 + 0x7822000F, // 0057 JMPF R8 #0068 + 0x8C20050A, // 0058 GETMET R8 R2 K10 + 0x5C280E00, // 0059 MOVE R10 R7 + 0x582C0010, // 005A LDCONST R11 K16 + 0x7C200600, // 005B CALL R8 3 + 0x1C201102, // 005C EQ R8 R8 K2 + 0x78220005, // 005D JMPF R8 #0064 + 0x5C200C00, // 005E MOVE R8 R6 + 0x8824010F, // 005F GETMBR R9 R0 K15 + 0x5C280A00, // 0060 MOVE R10 R5 + 0x7C200400, // 0061 CALL R8 2 + 0x80041000, // 0062 RET 1 R8 + 0x70020003, // 0063 JMP #0068 + 0x5C200C00, // 0064 MOVE R8 R6 + 0x8824010F, // 0065 GETMBR R9 R0 K15 + 0x7C200200, // 0066 CALL R8 1 + 0x80041000, // 0067 RET 1 R8 + 0x601C0008, // 0068 GETGBL R7 G8 + 0x5C200200, // 0069 MOVE R8 R1 + 0x7C1C0200, // 006A CALL R7 1 + 0x001E2207, // 006B ADD R7 K17 R7 + 0xB0062407, // 006C RAISE 1 K18 R7 + 0x80000000, // 006D RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_line_width +********************************************************************/ +be_local_closure(lvh_obj_set_line_width, /* name */ + be_nested_proto( + 7, /* nstack */ + 3, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str_weak(_lv_obj), + /* K1 */ be_nested_str_weak(set_style_line_width), + }), + be_str_weak(set_line_width), + &be_const_str_solidified, + ( &(const binstruction[ 8]) { /* code */ + 0x880C0100, // 0000 GETMBR R3 R0 K0 + 0x8C0C0701, // 0001 GETMET R3 R3 K1 + 0x60140009, // 0002 GETGBL R5 G9 + 0x5C180200, // 0003 MOVE R6 R1 + 0x7C140200, // 0004 CALL R5 1 + 0x5C180400, // 0005 MOVE R6 R2 + 0x7C0C0600, // 0006 CALL R3 3 + 0x80000000, // 0007 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: get_text_rule_format +********************************************************************/ +be_local_closure(lvh_obj_get_text_rule_format, /* name */ + be_nested_proto( + 2, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str_weak(_text_rule_format), + }), + be_str_weak(get_text_rule_format), + &be_const_str_solidified, + ( &(const binstruction[ 2]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x80040200, // 0001 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_text +********************************************************************/ +be_local_closure(lvh_obj_set_text, /* name */ + be_nested_proto( + 6, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 3]) { /* constants */ + /* K0 */ be_nested_str_weak(check_label), + /* K1 */ be_nested_str_weak(_lv_label), + /* K2 */ be_nested_str_weak(set_text), + }), + be_str_weak(set_text), + &be_const_str_solidified, + ( &(const binstruction[ 9]) { /* code */ + 0x8C080100, // 0000 GETMET R2 R0 K0 + 0x7C080200, // 0001 CALL R2 1 + 0x88080101, // 0002 GETMBR R2 R0 K1 + 0x8C080502, // 0003 GETMET R2 R2 K2 + 0x60100008, // 0004 GETGBL R4 G8 + 0x5C140200, // 0005 MOVE R5 R1 + 0x7C100200, // 0006 CALL R4 1 + 0x7C080400, // 0007 CALL R2 2 + 0x80000000, // 0008 RET 0 + }) + ) +); +/*******************************************************************/ + + /******************************************************************** ** Solidified function: parse_color ********************************************************************/ @@ -629,55 +2653,11 @@ be_local_closure(lvh_obj_parse_color, /* name */ /******************************************************************** -** Solidified function: set_pad_top2 +** Solidified function: get_val ********************************************************************/ -be_local_closure(lvh_obj_set_pad_top2, /* name */ +be_local_closure(lvh_obj_get_val, /* name */ be_nested_proto( - 7, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 5]) { /* constants */ - /* K0 */ be_nested_str_weak(_lv_part2_selector), - /* K1 */ be_nested_str_weak(_lv_obj), - /* K2 */ be_nested_str_weak(set_style_pad_top), - /* K3 */ be_nested_str_weak(lv), - /* K4 */ be_nested_str_weak(STATE_DEFAULT), - }), - be_str_weak(set_pad_top2), - &be_const_str_solidified, - ( &(const binstruction[15]) { /* code */ - 0x88080100, // 0000 GETMBR R2 R0 K0 - 0x4C0C0000, // 0001 LDNIL R3 - 0x20080403, // 0002 NE R2 R2 R3 - 0x780A0009, // 0003 JMPF R2 #000E - 0x88080101, // 0004 GETMBR R2 R0 K1 - 0x8C080502, // 0005 GETMET R2 R2 K2 - 0x60100009, // 0006 GETGBL R4 G9 - 0x5C140200, // 0007 MOVE R5 R1 - 0x7C100200, // 0008 CALL R4 1 - 0x88140100, // 0009 GETMBR R5 R0 K0 - 0xB81A0600, // 000A GETNGBL R6 K3 - 0x88180D04, // 000B GETMBR R6 R6 K4 - 0x30140A06, // 000C OR R5 R5 R6 - 0x7C080600, // 000D CALL R2 3 - 0x80000000, // 000E RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: get_text_rule -********************************************************************/ -be_local_closure(lvh_obj_get_text_rule, /* name */ - be_nested_proto( - 2, /* nstack */ + 3, /* nstack */ 1, /* argc */ 2, /* varg */ 0, /* has upvals */ @@ -685,41 +2665,17 @@ be_local_closure(lvh_obj_get_text_rule, /* name */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str_weak(_text_rule), - }), - be_str_weak(get_text_rule), - &be_const_str_solidified, - ( &(const binstruction[ 2]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x80040200, // 0001 RET 1 R1 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: get_obj -********************************************************************/ -be_local_closure(lvh_obj_get_obj, /* name */ - be_nested_proto( - 2, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ + ( &(const bvalue[ 2]) { /* constants */ /* K0 */ be_nested_str_weak(_lv_obj), + /* K1 */ be_nested_str_weak(get_value), }), - be_str_weak(get_obj), + be_str_weak(get_val), &be_const_str_solidified, - ( &(const binstruction[ 2]) { /* code */ + ( &(const binstruction[ 4]) { /* code */ 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x80040200, // 0001 RET 1 R1 + 0x8C040301, // 0001 GETMET R1 R1 K1 + 0x7C040200, // 0002 CALL R1 1 + 0x80040200, // 0003 RET 1 R1 }) ) ); @@ -727,53 +2683,9 @@ be_local_closure(lvh_obj_get_obj, /* name */ /******************************************************************** -** Solidified function: set_pad_left2 +** Solidified function: get_pad_right ********************************************************************/ -be_local_closure(lvh_obj_set_pad_left2, /* name */ - be_nested_proto( - 7, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 5]) { /* constants */ - /* K0 */ be_nested_str_weak(_lv_part2_selector), - /* K1 */ be_nested_str_weak(_lv_obj), - /* K2 */ be_nested_str_weak(set_style_pad_left), - /* K3 */ be_nested_str_weak(lv), - /* K4 */ be_nested_str_weak(STATE_DEFAULT), - }), - be_str_weak(set_pad_left2), - &be_const_str_solidified, - ( &(const binstruction[15]) { /* code */ - 0x88080100, // 0000 GETMBR R2 R0 K0 - 0x4C0C0000, // 0001 LDNIL R3 - 0x20080403, // 0002 NE R2 R2 R3 - 0x780A0009, // 0003 JMPF R2 #000E - 0x88080101, // 0004 GETMBR R2 R0 K1 - 0x8C080502, // 0005 GETMET R2 R2 K2 - 0x60100009, // 0006 GETGBL R4 G9 - 0x5C140200, // 0007 MOVE R5 R1 - 0x7C100200, // 0008 CALL R4 1 - 0x88140100, // 0009 GETMBR R5 R0 K0 - 0xB81A0600, // 000A GETNGBL R6 K3 - 0x88180D04, // 000B GETMBR R6 R6 K4 - 0x30140A06, // 000C OR R5 R5 R6 - 0x7C080600, // 000D CALL R2 3 - 0x80000000, // 000E RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: get_align -********************************************************************/ -be_local_closure(lvh_obj_get_align, /* name */ +be_local_closure(lvh_obj_get_pad_right, /* name */ be_nested_proto( 5, /* nstack */ 1, /* argc */ @@ -783,94 +2695,28 @@ be_local_closure(lvh_obj_get_align, /* name */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[10]) { /* constants */ - /* K0 */ be_nested_str_weak(_lv_label), - /* K1 */ be_nested_str_weak(get_style_text_align), - /* K2 */ be_const_int(0), - /* K3 */ be_nested_str_weak(lv), - /* K4 */ be_nested_str_weak(TEXT_ALIGN_LEFT), - /* K5 */ be_nested_str_weak(left), - /* K6 */ be_nested_str_weak(TEXT_ALIGN_CENTER), - /* K7 */ be_nested_str_weak(center), - /* K8 */ be_nested_str_weak(TEXT_ALIGN_RIGHT), - /* K9 */ be_nested_str_weak(right), - }), - be_str_weak(get_align), - &be_const_str_solidified, - ( &(const binstruction[32]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x4C080000, // 0001 LDNIL R2 - 0x1C040202, // 0002 EQ R1 R1 R2 - 0x78060001, // 0003 JMPF R1 #0006 - 0x4C040000, // 0004 LDNIL R1 - 0x80040200, // 0005 RET 1 R1 - 0x4C040000, // 0006 LDNIL R1 - 0x88080100, // 0007 GETMBR R2 R0 K0 - 0x8C080501, // 0008 GETMET R2 R2 K1 - 0x58100002, // 0009 LDCONST R4 K2 - 0x7C080400, // 000A CALL R2 2 - 0xB80A0600, // 000B GETNGBL R2 K3 - 0x88080504, // 000C GETMBR R2 R2 K4 - 0x1C080202, // 000D EQ R2 R1 R2 - 0x780A0001, // 000E JMPF R2 #0011 - 0x80060A00, // 000F RET 1 K5 - 0x7002000D, // 0010 JMP #001F - 0xB80A0600, // 0011 GETNGBL R2 K3 - 0x88080506, // 0012 GETMBR R2 R2 K6 - 0x1C080202, // 0013 EQ R2 R1 R2 - 0x780A0001, // 0014 JMPF R2 #0017 - 0x80060E00, // 0015 RET 1 K7 - 0x70020007, // 0016 JMP #001F - 0xB80A0600, // 0017 GETNGBL R2 K3 - 0x88080508, // 0018 GETMBR R2 R2 K8 - 0x1C080202, // 0019 EQ R2 R1 R2 - 0x780A0001, // 001A JMPF R2 #001D - 0x80061200, // 001B RET 1 K9 - 0x70020001, // 001C JMP #001F - 0x4C080000, // 001D LDNIL R2 - 0x80040400, // 001E RET 1 R2 - 0x80000000, // 001F RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: set_hidden -********************************************************************/ -be_local_closure(lvh_obj_set_hidden, /* name */ - be_nested_proto( - 5, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ ( &(const bvalue[ 5]) { /* constants */ - /* K0 */ be_nested_str_weak(_lv_obj), - /* K1 */ be_nested_str_weak(add_flag), - /* K2 */ be_nested_str_weak(lv), - /* K3 */ be_nested_str_weak(OBJ_FLAG_HIDDEN), - /* K4 */ be_nested_str_weak(clear_flag), + /* K0 */ be_nested_str_weak(_lv_part2_selector), + /* K1 */ be_nested_str_weak(_lv_obj), + /* K2 */ be_nested_str_weak(get_style_pad_right), + /* K3 */ be_nested_str_weak(lv), + /* K4 */ be_nested_str_weak(STATE_DEFAULT), }), - be_str_weak(set_hidden), + be_str_weak(get_pad_right), &be_const_str_solidified, ( &(const binstruction[13]) { /* code */ - 0x78060005, // 0000 JMPF R1 #0007 - 0x88080100, // 0001 GETMBR R2 R0 K0 - 0x8C080501, // 0002 GETMET R2 R2 K1 - 0xB8120400, // 0003 GETNGBL R4 K2 - 0x88100903, // 0004 GETMBR R4 R4 K3 - 0x7C080400, // 0005 CALL R2 2 - 0x70020004, // 0006 JMP #000C - 0x88080100, // 0007 GETMBR R2 R0 K0 - 0x8C080504, // 0008 GETMET R2 R2 K4 - 0xB8120400, // 0009 GETNGBL R4 K2 - 0x88100903, // 000A GETMBR R4 R4 K3 - 0x7C080400, // 000B CALL R2 2 + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x4C080000, // 0001 LDNIL R2 + 0x20040202, // 0002 NE R1 R1 R2 + 0x78060007, // 0003 JMPF R1 #000C + 0x88040101, // 0004 GETMBR R1 R0 K1 + 0x8C040302, // 0005 GETMET R1 R1 K2 + 0x880C0100, // 0006 GETMBR R3 R0 K0 + 0xB8120600, // 0007 GETNGBL R4 K3 + 0x88100904, // 0008 GETMBR R4 R4 K4 + 0x300C0604, // 0009 OR R3 R3 R4 + 0x7C040400, // 000A CALL R1 2 + 0x80040200, // 000B RET 1 R1 0x80000000, // 000C RET 0 }) ) @@ -878,42 +2724,6 @@ be_local_closure(lvh_obj_set_hidden, /* name */ /*******************************************************************/ -/******************************************************************** -** Solidified function: set_text_color -********************************************************************/ -be_local_closure(lvh_obj_set_text_color, /* name */ - be_nested_proto( - 7, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 4]) { /* constants */ - /* K0 */ be_nested_str_weak(_lv_obj), - /* K1 */ be_nested_str_weak(set_style_text_color), - /* K2 */ be_nested_str_weak(parse_color), - /* K3 */ be_const_int(0), - }), - be_str_weak(set_text_color), - &be_const_str_solidified, - ( &(const binstruction[ 8]) { /* code */ - 0x88080100, // 0000 GETMBR R2 R0 K0 - 0x8C080501, // 0001 GETMET R2 R2 K1 - 0x8C100102, // 0002 GETMET R4 R0 K2 - 0x5C180200, // 0003 MOVE R6 R1 - 0x7C100400, // 0004 CALL R4 2 - 0x58140003, // 0005 LDCONST R5 K3 - 0x7C080600, // 0006 CALL R2 3 - 0x80000000, // 0007 RET 0 - }) - ) -); -/*******************************************************************/ - - /******************************************************************** ** Solidified function: get_value_font ********************************************************************/ @@ -943,117 +2753,9 @@ be_local_closure(lvh_obj_get_value_font, /* name */ /******************************************************************** -** Solidified function: get_pad_bottom +** Solidified function: get_toggle ********************************************************************/ -be_local_closure(lvh_obj_get_pad_bottom, /* name */ - be_nested_proto( - 5, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 5]) { /* constants */ - /* K0 */ be_nested_str_weak(_lv_part2_selector), - /* K1 */ be_nested_str_weak(_lv_obj), - /* K2 */ be_nested_str_weak(get_style_pad_bottom), - /* K3 */ be_nested_str_weak(lv), - /* K4 */ be_nested_str_weak(STATE_DEFAULT), - }), - be_str_weak(get_pad_bottom), - &be_const_str_solidified, - ( &(const binstruction[13]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x4C080000, // 0001 LDNIL R2 - 0x20040202, // 0002 NE R1 R1 R2 - 0x78060007, // 0003 JMPF R1 #000C - 0x88040101, // 0004 GETMBR R1 R0 K1 - 0x8C040302, // 0005 GETMET R1 R1 K2 - 0x880C0100, // 0006 GETMBR R3 R0 K0 - 0xB8120600, // 0007 GETNGBL R4 K3 - 0x88100904, // 0008 GETMBR R4 R4 K4 - 0x300C0604, // 0009 OR R3 R3 R4 - 0x7C040400, // 000A CALL R1 2 - 0x80040200, // 000B RET 1 R1 - 0x80000000, // 000C RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: val_rule_matched -********************************************************************/ -be_local_closure(lvh_obj_val_rule_matched, /* name */ - be_nested_proto( - 13, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 5]) { /* constants */ - /* K0 */ be_nested_str_weak(_val_rule_function), - /* K1 */ be_nested_str_weak(string), - /* K2 */ be_nested_str_weak(format), - /* K3 */ be_nested_str_weak(HSP_X3A_X20failed_X20to_X20run_X20self_X2E_val_rule_function_X20_X2D_X20_X25s_X20_X28_X25s_X29), - /* K4 */ be_nested_str_weak(val), - }), - be_str_weak(val_rule_matched), - &be_const_str_solidified, - ( &(const binstruction[37]) { /* code */ - 0x6008000A, // 0000 GETGBL R2 G10 - 0x5C0C0200, // 0001 MOVE R3 R1 - 0x7C080200, // 0002 CALL R2 1 - 0x4C0C0000, // 0003 LDNIL R3 - 0x1C0C0403, // 0004 EQ R3 R2 R3 - 0x780E0001, // 0005 JMPF R3 #0008 - 0x500C0000, // 0006 LDBOOL R3 0 0 - 0x80040600, // 0007 RET 1 R3 - 0x880C0100, // 0008 GETMBR R3 R0 K0 - 0x4C100000, // 0009 LDNIL R4 - 0x20100604, // 000A NE R4 R3 R4 - 0x78120012, // 000B JMPF R4 #001F - 0xA8020005, // 000C EXBLK 0 #0013 - 0x5C100600, // 000D MOVE R4 R3 - 0x5C140400, // 000E MOVE R5 R2 - 0x7C100200, // 000F CALL R4 1 - 0x5C080800, // 0010 MOVE R2 R4 - 0xA8040001, // 0011 EXBLK 1 1 - 0x7002000B, // 0012 JMP #001F - 0xAC100002, // 0013 CATCH R4 0 2 - 0x70020008, // 0014 JMP #001E - 0xA41A0200, // 0015 IMPORT R6 K1 - 0x601C0001, // 0016 GETGBL R7 G1 - 0x8C200D02, // 0017 GETMET R8 R6 K2 - 0x58280003, // 0018 LDCONST R10 K3 - 0x5C2C0800, // 0019 MOVE R11 R4 - 0x5C300A00, // 001A MOVE R12 R5 - 0x7C200800, // 001B CALL R8 4 - 0x7C1C0200, // 001C CALL R7 1 - 0x70020000, // 001D JMP #001F - 0xB0080000, // 001E RAISE 2 R0 R0 - 0x60100009, // 001F GETGBL R4 G9 - 0x5C140400, // 0020 MOVE R5 R2 - 0x7C100200, // 0021 CALL R4 1 - 0x90020804, // 0022 SETMBR R0 K4 R4 - 0x50100000, // 0023 LDBOOL R4 0 0 - 0x80040800, // 0024 RET 1 R4 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: get_enabled -********************************************************************/ -be_local_closure(lvh_obj_get_enabled, /* name */ +be_local_closure(lvh_obj_get_toggle, /* name */ be_nested_proto( 4, /* nstack */ 1, /* argc */ @@ -1065,11 +2767,11 @@ be_local_closure(lvh_obj_get_enabled, /* name */ 1, /* has constants */ ( &(const bvalue[ 4]) { /* constants */ /* K0 */ be_nested_str_weak(_lv_obj), - /* K1 */ be_nested_str_weak(has_flag), + /* K1 */ be_nested_str_weak(has_state), /* K2 */ be_nested_str_weak(lv), - /* K3 */ be_nested_str_weak(OBJ_FLAG_CLICKABLE), + /* K3 */ be_nested_str_weak(STATE_CHECKED), }), - be_str_weak(get_enabled), + be_str_weak(get_toggle), &be_const_str_solidified, ( &(const binstruction[ 6]) { /* code */ 0x88040100, // 0000 GETMBR R1 R0 K0 @@ -1111,33 +2813,6 @@ be_local_closure(lvh_obj_set_meta, /* name */ /*******************************************************************/ -/******************************************************************** -** Solidified function: get_val_rule -********************************************************************/ -be_local_closure(lvh_obj_get_val_rule, /* name */ - be_nested_proto( - 2, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str_weak(_val_rule), - }), - be_str_weak(get_val_rule), - &be_const_str_solidified, - ( &(const binstruction[ 2]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x80040200, // 0001 RET 1 R1 - }) - ) -); -/*******************************************************************/ - - /******************************************************************** ** Solidified function: set_text_rule_format ********************************************************************/ @@ -1168,386 +2843,6 @@ be_local_closure(lvh_obj_set_text_rule_format, /* name */ /*******************************************************************/ -/******************************************************************** -** Solidified function: init -********************************************************************/ -be_local_closure(lvh_obj_init, /* name */ - be_nested_proto( - 8, /* nstack */ - 5, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 4]) { /* constants */ - /* K0 */ be_nested_str_weak(_page), - /* K1 */ be_nested_str_weak(_lv_class), - /* K2 */ be_nested_str_weak(_lv_obj), - /* K3 */ be_nested_str_weak(post_init), - }), - be_str_weak(init), - &be_const_str_solidified, - ( &(const binstruction[16]) { /* code */ - 0x90020002, // 0000 SETMBR R0 K0 R2 - 0x4C140000, // 0001 LDNIL R5 - 0x1C140805, // 0002 EQ R5 R4 R5 - 0x78160007, // 0003 JMPF R5 #000C - 0x88140101, // 0004 GETMBR R5 R0 K1 - 0x78160005, // 0005 JMPF R5 #000C - 0x88140101, // 0006 GETMBR R5 R0 K1 - 0x5C180A00, // 0007 MOVE R6 R5 - 0x5C1C0200, // 0008 MOVE R7 R1 - 0x7C180200, // 0009 CALL R6 1 - 0x90020406, // 000A SETMBR R0 K2 R6 - 0x70020000, // 000B JMP #000D - 0x90020404, // 000C SETMBR R0 K2 R4 - 0x8C140103, // 000D GETMET R5 R0 K3 - 0x7C140200, // 000E CALL R5 1 - 0x80000000, // 000F RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: set_value_font -********************************************************************/ -be_local_closure(lvh_obj_set_value_font, /* name */ - be_nested_proto( - 5, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str_weak(set_text_font), - }), - be_str_weak(set_value_font), - &be_const_str_solidified, - ( &(const binstruction[ 4]) { /* code */ - 0x8C080100, // 0000 GETMET R2 R0 K0 - 0x5C100200, // 0001 MOVE R4 R1 - 0x7C080400, // 0002 CALL R2 2 - 0x80000000, // 0003 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: check_label -********************************************************************/ -be_local_closure(lvh_obj_check_label, /* name */ - be_nested_proto( - 5, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 6]) { /* constants */ - /* K0 */ be_nested_str_weak(_lv_label), - /* K1 */ be_nested_str_weak(lv), - /* K2 */ be_nested_str_weak(label), - /* K3 */ be_nested_str_weak(get_obj), - /* K4 */ be_nested_str_weak(set_align), - /* K5 */ be_nested_str_weak(ALIGN_CENTER), - }), - be_str_weak(check_label), - &be_const_str_solidified, - ( &(const binstruction[16]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x4C080000, // 0001 LDNIL R2 - 0x1C040202, // 0002 EQ R1 R1 R2 - 0x7806000A, // 0003 JMPF R1 #000F - 0xB8060200, // 0004 GETNGBL R1 K1 - 0x8C040302, // 0005 GETMET R1 R1 K2 - 0x8C0C0103, // 0006 GETMET R3 R0 K3 - 0x7C0C0200, // 0007 CALL R3 1 - 0x7C040400, // 0008 CALL R1 2 - 0x90020001, // 0009 SETMBR R0 K0 R1 - 0x88040100, // 000A GETMBR R1 R0 K0 - 0x8C040304, // 000B GETMET R1 R1 K4 - 0xB80E0200, // 000C GETNGBL R3 K1 - 0x880C0705, // 000D GETMBR R3 R3 K5 - 0x7C040400, // 000E CALL R1 2 - 0x80000000, // 000F RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: get_meta -********************************************************************/ -be_local_closure(lvh_obj_get_meta, /* name */ - be_nested_proto( - 2, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str_weak(_meta), - }), - be_str_weak(get_meta), - &be_const_str_solidified, - ( &(const binstruction[ 2]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x80040200, // 0001 RET 1 R1 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: set_val_rule -********************************************************************/ -be_local_closure(lvh_obj_set_val_rule, /* name */ - be_nested_proto( - 7, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 1, /* has sup protos */ - ( &(const struct bproto*[ 1]) { - be_nested_proto( - 4, /* nstack */ - 1, /* argc */ - 0, /* varg */ - 1, /* has upvals */ - ( &(const bupvaldesc[ 1]) { /* upvals */ - be_local_const_upval(1, 0), - }), - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str_weak(val_rule_matched), - }), - be_str_weak(_X3Clambda_X3E), - &be_const_str_solidified, - ( &(const binstruction[ 5]) { /* code */ - 0x68040000, // 0000 GETUPV R1 U0 - 0x8C040300, // 0001 GETMET R1 R1 K0 - 0x5C0C0000, // 0002 MOVE R3 R0 - 0x7C040400, // 0003 CALL R1 2 - 0x80040200, // 0004 RET 1 R1 - }) - ), - }), - 1, /* has constants */ - ( &(const bvalue[ 4]) { /* constants */ - /* K0 */ be_nested_str_weak(_val_rule), - /* K1 */ be_nested_str_weak(tasmota), - /* K2 */ be_nested_str_weak(remove_rule), - /* K3 */ be_nested_str_weak(add_rule), - }), - be_str_weak(set_val_rule), - &be_const_str_solidified, - ( &(const binstruction[21]) { /* code */ - 0x88080100, // 0000 GETMBR R2 R0 K0 - 0x4C0C0000, // 0001 LDNIL R3 - 0x20080403, // 0002 NE R2 R2 R3 - 0x780A0004, // 0003 JMPF R2 #0009 - 0xB80A0200, // 0004 GETNGBL R2 K1 - 0x8C080502, // 0005 GETMET R2 R2 K2 - 0x88100100, // 0006 GETMBR R4 R0 K0 - 0x5C140000, // 0007 MOVE R5 R0 - 0x7C080600, // 0008 CALL R2 3 - 0x60080008, // 0009 GETGBL R2 G8 - 0x5C0C0200, // 000A MOVE R3 R1 - 0x7C080200, // 000B CALL R2 1 - 0x90020002, // 000C SETMBR R0 K0 R2 - 0xB80A0200, // 000D GETNGBL R2 K1 - 0x8C080503, // 000E GETMET R2 R2 K3 - 0x88100100, // 000F GETMBR R4 R0 K0 - 0x84140000, // 0010 CLOSURE R5 P0 - 0x5C180000, // 0011 MOVE R6 R0 - 0x7C080800, // 0012 CALL R2 4 - 0xA0000000, // 0013 CLOSE R0 - 0x80000000, // 0014 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: set_enabled -********************************************************************/ -be_local_closure(lvh_obj_set_enabled, /* name */ - be_nested_proto( - 5, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 5]) { /* constants */ - /* K0 */ be_nested_str_weak(_lv_obj), - /* K1 */ be_nested_str_weak(add_flag), - /* K2 */ be_nested_str_weak(lv), - /* K3 */ be_nested_str_weak(OBJ_FLAG_CLICKABLE), - /* K4 */ be_nested_str_weak(clear_flag), - }), - be_str_weak(set_enabled), - &be_const_str_solidified, - ( &(const binstruction[13]) { /* code */ - 0x78060005, // 0000 JMPF R1 #0007 - 0x88080100, // 0001 GETMBR R2 R0 K0 - 0x8C080501, // 0002 GETMET R2 R2 K1 - 0xB8120400, // 0003 GETNGBL R4 K2 - 0x88100903, // 0004 GETMBR R4 R4 K3 - 0x7C080400, // 0005 CALL R2 2 - 0x70020004, // 0006 JMP #000C - 0x88080100, // 0007 GETMBR R2 R0 K0 - 0x8C080504, // 0008 GETMET R2 R2 K4 - 0xB8120400, // 0009 GETNGBL R4 K2 - 0x88100903, // 000A GETMBR R4 R4 K3 - 0x7C080400, // 000B CALL R2 2 - 0x80000000, // 000C RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: get_action -********************************************************************/ -be_local_closure(lvh_obj_get_action, /* name */ - be_nested_proto( - 3, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 2]) { /* constants */ - /* K0 */ be_nested_str_weak(_action), - /* K1 */ be_nested_str_weak(), - }), - be_str_weak(get_action), - &be_const_str_solidified, - ( &(const binstruction[ 6]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x78060001, // 0001 JMPF R1 #0004 - 0x5C080200, // 0002 MOVE R2 R1 - 0x70020000, // 0003 JMP #0005 - 0x58080001, // 0004 LDCONST R2 K1 - 0x80040400, // 0005 RET 1 R2 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: get_radius2 -********************************************************************/ -be_local_closure(lvh_obj_get_radius2, /* name */ - be_nested_proto( - 5, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 5]) { /* constants */ - /* K0 */ be_nested_str_weak(_lv_part2_selector), - /* K1 */ be_nested_str_weak(_lv_obj), - /* K2 */ be_nested_str_weak(get_style_radius), - /* K3 */ be_nested_str_weak(lv), - /* K4 */ be_nested_str_weak(STATE_DEFAULT), - }), - be_str_weak(get_radius2), - &be_const_str_solidified, - ( &(const binstruction[13]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x4C080000, // 0001 LDNIL R2 - 0x20040202, // 0002 NE R1 R1 R2 - 0x78060007, // 0003 JMPF R1 #000C - 0x88040101, // 0004 GETMBR R1 R0 K1 - 0x8C040302, // 0005 GETMET R1 R1 K2 - 0x880C0100, // 0006 GETMBR R3 R0 K0 - 0xB8120600, // 0007 GETNGBL R4 K3 - 0x88100904, // 0008 GETMBR R4 R4 K4 - 0x300C0604, // 0009 OR R3 R3 R4 - 0x7C040400, // 000A CALL R1 2 - 0x80040200, // 000B RET 1 R1 - 0x80000000, // 000C RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: set_pad_right2 -********************************************************************/ -be_local_closure(lvh_obj_set_pad_right2, /* name */ - be_nested_proto( - 7, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 5]) { /* constants */ - /* K0 */ be_nested_str_weak(_lv_part2_selector), - /* K1 */ be_nested_str_weak(_lv_obj), - /* K2 */ be_nested_str_weak(set_style_pad_right), - /* K3 */ be_nested_str_weak(lv), - /* K4 */ be_nested_str_weak(STATE_DEFAULT), - }), - be_str_weak(set_pad_right2), - &be_const_str_solidified, - ( &(const binstruction[15]) { /* code */ - 0x88080100, // 0000 GETMBR R2 R0 K0 - 0x4C0C0000, // 0001 LDNIL R3 - 0x20080403, // 0002 NE R2 R2 R3 - 0x780A0009, // 0003 JMPF R2 #000E - 0x88080101, // 0004 GETMBR R2 R0 K1 - 0x8C080502, // 0005 GETMET R2 R2 K2 - 0x60100009, // 0006 GETGBL R4 G9 - 0x5C140200, // 0007 MOVE R5 R1 - 0x7C100200, // 0008 CALL R4 1 - 0x88140100, // 0009 GETMBR R5 R0 K0 - 0xB81A0600, // 000A GETNGBL R6 K3 - 0x88180D04, // 000B GETMBR R6 R6 K4 - 0x30140A06, // 000C OR R5 R5 R6 - 0x7C080600, // 000D CALL R2 3 - 0x80000000, // 000E RET 0 - }) - ) -); -/*******************************************************************/ - - /******************************************************************** ** Solidified function: get_value_ofs_x ********************************************************************/ @@ -1579,339 +2874,38 @@ be_local_closure(lvh_obj_get_value_ofs_x, /* name */ /******************************************************************** -** Solidified function: get_value_color +** Solidified function: is_color_attribute ********************************************************************/ -be_local_closure(lvh_obj_get_value_color, /* name */ +be_local_closure(lvh_obj_is_color_attribute, /* name */ be_nested_proto( - 3, /* nstack */ + 9, /* nstack */ 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str_weak(get_value_color), - }), - be_str_weak(get_value_color), - &be_const_str_solidified, - ( &(const binstruction[ 3]) { /* code */ - 0x8C040100, // 0000 GETMET R1 R0 K0 - 0x7C040200, // 0001 CALL R1 1 - 0x80040200, // 0002 RET 1 R1 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: set_pad_bottom2 -********************************************************************/ -be_local_closure(lvh_obj_set_pad_bottom2, /* name */ - be_nested_proto( - 7, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 5]) { /* constants */ - /* K0 */ be_nested_str_weak(_lv_part2_selector), - /* K1 */ be_nested_str_weak(_lv_obj), - /* K2 */ be_nested_str_weak(set_style_pad_bottom), - /* K3 */ be_nested_str_weak(lv), - /* K4 */ be_nested_str_weak(STATE_DEFAULT), - }), - be_str_weak(set_pad_bottom2), - &be_const_str_solidified, - ( &(const binstruction[15]) { /* code */ - 0x88080100, // 0000 GETMBR R2 R0 K0 - 0x4C0C0000, // 0001 LDNIL R3 - 0x20080403, // 0002 NE R2 R2 R3 - 0x780A0009, // 0003 JMPF R2 #000E - 0x88080101, // 0004 GETMBR R2 R0 K1 - 0x8C080502, // 0005 GETMET R2 R2 K2 - 0x60100009, // 0006 GETGBL R4 G9 - 0x5C140200, // 0007 MOVE R5 R1 - 0x7C100200, // 0008 CALL R4 1 - 0x88140100, // 0009 GETMBR R5 R0 K0 - 0xB81A0600, // 000A GETNGBL R6 K3 - 0x88180D04, // 000B GETMBR R6 R6 K4 - 0x30140A06, // 000C OR R5 R5 R6 - 0x7C080600, // 000D CALL R2 3 - 0x80000000, // 000E RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: get_text_color -********************************************************************/ -be_local_closure(lvh_obj_get_text_color, /* name */ - be_nested_proto( - 4, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 3]) { /* constants */ - /* K0 */ be_nested_str_weak(_lv_obj), - /* K1 */ be_nested_str_weak(get_style_text_color), - /* K2 */ be_const_int(0), - }), - be_str_weak(get_text_color), - &be_const_str_solidified, - ( &(const binstruction[ 5]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x8C040301, // 0001 GETMET R1 R1 K1 - 0x580C0002, // 0002 LDCONST R3 K2 - 0x7C040400, // 0003 CALL R1 2 - 0x80040200, // 0004 RET 1 R1 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: get_click -********************************************************************/ -be_local_closure(lvh_obj_get_click, /* name */ - be_nested_proto( - 3, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str_weak(get_enabled), - }), - be_str_weak(get_click), - &be_const_str_solidified, - ( &(const binstruction[ 3]) { /* code */ - 0x8C040100, // 0000 GETMET R1 R0 K0 - 0x7C040200, // 0001 CALL R1 1 - 0x80040200, // 0002 RET 1 R1 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: event_cb -********************************************************************/ -be_local_closure(lvh_obj_event_cb, /* name */ - be_nested_proto( - 15, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 1, /* has sup protos */ - ( &(const struct bproto*[ 2]) { - be_nested_proto( - 4, /* nstack */ - 0, /* argc */ - 0, /* varg */ - 1, /* has upvals */ - ( &(const bupvaldesc[ 3]) { /* upvals */ - be_local_const_upval(1, 2), - be_local_const_upval(1, 0), - be_local_const_upval(1, 3), - }), - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str_weak(do_action), - }), - be_str_weak(_X3Clambda_X3E), - &be_const_str_solidified, - ( &(const binstruction[ 6]) { /* code */ - 0x68000000, // 0000 GETUPV R0 U0 - 0x8C000100, // 0001 GETMET R0 R0 K0 - 0x68080001, // 0002 GETUPV R2 U1 - 0x680C0002, // 0003 GETUPV R3 U2 - 0x7C000600, // 0004 CALL R0 3 - 0x80040000, // 0005 RET 1 R0 - }) - ), - be_nested_proto( - 3, /* nstack */ - 0, /* argc */ - 0, /* varg */ - 1, /* has upvals */ - ( &(const bupvaldesc[ 1]) { /* upvals */ - be_local_const_upval(1, 8), - }), - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 2]) { /* constants */ - /* K0 */ be_nested_str_weak(tasmota), - /* K1 */ be_nested_str_weak(publish_rule), - }), - be_str_weak(_X3Clambda_X3E), - &be_const_str_solidified, - ( &(const binstruction[ 5]) { /* code */ - 0xB8020000, // 0000 GETNGBL R0 K0 - 0x8C000101, // 0001 GETMET R0 R0 K1 - 0x68080000, // 0002 GETUPV R2 U0 - 0x7C000400, // 0003 CALL R0 2 - 0x80040000, // 0004 RET 1 R0 - }) - ), - }), - 1, /* has constants */ - ( &(const bvalue[24]) { /* constants */ - /* K0 */ be_nested_str_weak(_page), - /* K1 */ be_nested_str_weak(_oh), - /* K2 */ be_nested_str_weak(code), - /* K3 */ be_nested_str_weak(action), - /* K4 */ be_nested_str_weak(), - /* K5 */ be_nested_str_weak(lv), - /* K6 */ be_nested_str_weak(EVENT_CLICKED), - /* K7 */ be_nested_str_weak(tasmota), - /* K8 */ be_nested_str_weak(set_timer), - /* K9 */ be_const_int(0), - /* K10 */ be_nested_str_weak(_event_map), - /* K11 */ be_nested_str_weak(find), - /* K12 */ be_nested_str_weak(string), - /* K13 */ be_nested_str_weak(json), - /* K14 */ be_nested_str_weak(EVENT_VALUE_CHANGED), - /* K15 */ be_nested_str_weak(val), - /* K16 */ be_nested_str_weak(format), - /* K17 */ be_nested_str_weak(_X2C_X22val_X22_X3A_X25s), - /* K18 */ be_nested_str_weak(dump), - /* K19 */ be_nested_str_weak(text), - /* K20 */ be_nested_str_weak(_X2C_X22text_X22_X3A), - /* K21 */ be_nested_str_weak(_X7B_X22hasp_X22_X3A_X7B_X22p_X25ib_X25i_X22_X3A_X7B_X22event_X22_X3A_X22_X25s_X22_X25s_X7D_X7D_X7D), - /* K22 */ be_nested_str_weak(_page_id), - /* K23 */ be_nested_str_weak(id), - }), - be_str_weak(event_cb), - &be_const_str_solidified, - ( &(const binstruction[73]) { /* code */ - 0x88080100, // 0000 GETMBR R2 R0 K0 - 0x88080501, // 0001 GETMBR R2 R2 K1 - 0x880C0302, // 0002 GETMBR R3 R1 K2 - 0x88100103, // 0003 GETMBR R4 R0 K3 - 0x20100904, // 0004 NE R4 R4 K4 - 0x78120008, // 0005 JMPF R4 #000F - 0xB8120A00, // 0006 GETNGBL R4 K5 - 0x88100906, // 0007 GETMBR R4 R4 K6 - 0x1C100604, // 0008 EQ R4 R3 R4 - 0x78120004, // 0009 JMPF R4 #000F - 0xB8120E00, // 000A GETNGBL R4 K7 - 0x8C100908, // 000B GETMET R4 R4 K8 - 0x58180009, // 000C LDCONST R6 K9 - 0x841C0000, // 000D CLOSURE R7 P0 - 0x7C100600, // 000E CALL R4 3 - 0x8810010A, // 000F GETMBR R4 R0 K10 - 0x8C10090B, // 0010 GETMET R4 R4 K11 - 0x5C180600, // 0011 MOVE R6 R3 - 0x7C100400, // 0012 CALL R4 2 - 0x4C140000, // 0013 LDNIL R5 - 0x20140805, // 0014 NE R5 R4 R5 - 0x78160030, // 0015 JMPF R5 #0047 - 0xA4161800, // 0016 IMPORT R5 K12 - 0xA41A1A00, // 0017 IMPORT R6 K13 - 0x581C0004, // 0018 LDCONST R7 K4 - 0x88200302, // 0019 GETMBR R8 R1 K2 - 0xB8260A00, // 001A GETNGBL R9 K5 - 0x8824130E, // 001B GETMBR R9 R9 K14 - 0x1C201009, // 001C EQ R8 R8 R9 - 0x7822001A, // 001D JMPF R8 #0039 - 0xA8020015, // 001E EXBLK 0 #0035 - 0x8820010F, // 001F GETMBR R8 R0 K15 - 0x4C240000, // 0020 LDNIL R9 - 0x20241009, // 0021 NE R9 R8 R9 - 0x78260006, // 0022 JMPF R9 #002A - 0x8C240B10, // 0023 GETMET R9 R5 K16 - 0x582C0011, // 0024 LDCONST R11 K17 - 0x8C300D12, // 0025 GETMET R12 R6 K18 - 0x5C381000, // 0026 MOVE R14 R8 - 0x7C300400, // 0027 CALL R12 2 - 0x7C240600, // 0028 CALL R9 3 - 0x5C1C1200, // 0029 MOVE R7 R9 - 0x88240113, // 002A GETMBR R9 R0 K19 - 0x4C280000, // 002B LDNIL R10 - 0x2028120A, // 002C NE R10 R9 R10 - 0x782A0004, // 002D JMPF R10 #0033 - 0x001C0F14, // 002E ADD R7 R7 K20 - 0x8C280D12, // 002F GETMET R10 R6 K18 - 0x5C301200, // 0030 MOVE R12 R9 - 0x7C280400, // 0031 CALL R10 2 - 0x001C0E0A, // 0032 ADD R7 R7 R10 - 0xA8040001, // 0033 EXBLK 1 1 - 0x70020003, // 0034 JMP #0039 - 0xAC200000, // 0035 CATCH R8 0 0 - 0x70020000, // 0036 JMP #0038 - 0x70020000, // 0037 JMP #0039 - 0xB0080000, // 0038 RAISE 2 R0 R0 - 0x8C200B10, // 0039 GETMET R8 R5 K16 - 0x58280015, // 003A LDCONST R10 K21 - 0x882C0100, // 003B GETMBR R11 R0 K0 - 0x882C1716, // 003C GETMBR R11 R11 K22 - 0x88300117, // 003D GETMBR R12 R0 K23 - 0x5C340800, // 003E MOVE R13 R4 - 0x5C380E00, // 003F MOVE R14 R7 - 0x7C200C00, // 0040 CALL R8 6 - 0xB8260E00, // 0041 GETNGBL R9 K7 - 0x8C241308, // 0042 GETMET R9 R9 K8 - 0x582C0009, // 0043 LDCONST R11 K9 - 0x84300001, // 0044 CLOSURE R12 P1 - 0x7C240600, // 0045 CALL R9 3 - 0xA0140000, // 0046 CLOSE R5 - 0xA0000000, // 0047 CLOSE R0 - 0x80000000, // 0048 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: get_toggle -********************************************************************/ -be_local_closure(lvh_obj_get_toggle, /* name */ - be_nested_proto( - 4, /* nstack */ - 1, /* argc */ - 2, /* varg */ + 4, /* varg */ 0, /* has upvals */ NULL, /* no upvals */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ ( &(const bvalue[ 4]) { /* constants */ - /* K0 */ be_nested_str_weak(_lv_obj), - /* K1 */ be_nested_str_weak(has_state), - /* K2 */ be_nested_str_weak(lv), - /* K3 */ be_nested_str_weak(STATE_CHECKED), + /* K0 */ be_const_class(be_class_lvh_obj), + /* K1 */ be_nested_str_weak(re), + /* K2 */ be_nested_str_weak(search), + /* K3 */ be_nested_str_weak(color_X24), }), - be_str_weak(get_toggle), + be_str_weak(is_color_attribute), &be_const_str_solidified, - ( &(const binstruction[ 6]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x8C040301, // 0001 GETMET R1 R1 K1 - 0xB80E0400, // 0002 GETNGBL R3 K2 - 0x880C0703, // 0003 GETMBR R3 R3 K3 - 0x7C040400, // 0004 CALL R1 2 - 0x80040200, // 0005 RET 1 R1 + ( &(const binstruction[11]) { /* code */ + 0x58040000, // 0000 LDCONST R1 K0 + 0xA40A0200, // 0001 IMPORT R2 K1 + 0x600C0017, // 0002 GETGBL R3 G23 + 0x8C100502, // 0003 GETMET R4 R2 K2 + 0x58180003, // 0004 LDCONST R6 K3 + 0x601C0008, // 0005 GETGBL R7 G8 + 0x5C200000, // 0006 MOVE R8 R0 + 0x7C1C0200, // 0007 CALL R7 1 + 0x7C100600, // 0008 CALL R4 3 + 0x7C0C0200, // 0009 CALL R3 1 + 0x80040600, // 000A RET 1 R3 }) ) ); @@ -1919,11 +2913,38 @@ be_local_closure(lvh_obj_get_toggle, /* name */ /******************************************************************** -** Solidified function: set_text_rule_formula +** Solidified function: get_text_rule_formula ********************************************************************/ -be_local_closure(lvh_obj_set_text_rule_formula, /* name */ +be_local_closure(lvh_obj_get_text_rule_formula, /* name */ be_nested_proto( - 13, /* nstack */ + 2, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str_weak(_text_rule_formula), + }), + be_str_weak(get_text_rule_formula), + &be_const_str_solidified, + ( &(const binstruction[ 2]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x80040200, // 0001 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_value_color +********************************************************************/ +be_local_closure(lvh_obj_set_value_color, /* name */ + be_nested_proto( + 5, /* nstack */ 2, /* argc */ 2, /* varg */ 0, /* has upvals */ @@ -1931,48 +2952,16 @@ be_local_closure(lvh_obj_set_text_rule_formula, /* name */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[ 7]) { /* constants */ - /* K0 */ be_nested_str_weak(_text_rule_formula), - /* K1 */ be_nested_str_weak(return_X20_X2F_X20val_X20_X2D_X3E_X20_X28), - /* K2 */ be_nested_str_weak(_X29), - /* K3 */ be_nested_str_weak(_text_rule_function), - /* K4 */ be_nested_str_weak(string), - /* K5 */ be_nested_str_weak(format), - /* K6 */ be_nested_str_weak(HSP_X3A_X20failed_X20to_X20compile_X20_X27_X25s_X27_X20_X2D_X20_X25s_X20_X28_X25s_X29), + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str_weak(set_text_color), }), - be_str_weak(set_text_rule_formula), + be_str_weak(set_value_color), &be_const_str_solidified, - ( &(const binstruction[30]) { /* code */ - 0x60080008, // 0000 GETGBL R2 G8 - 0x5C0C0200, // 0001 MOVE R3 R1 - 0x7C080200, // 0002 CALL R2 1 - 0x90020002, // 0003 SETMBR R0 K0 R2 - 0x88080100, // 0004 GETMBR R2 R0 K0 - 0x000A0202, // 0005 ADD R2 K1 R2 - 0x00080502, // 0006 ADD R2 R2 K2 - 0xA8020007, // 0007 EXBLK 0 #0010 - 0x600C000D, // 0008 GETGBL R3 G13 - 0x5C100400, // 0009 MOVE R4 R2 - 0x7C0C0200, // 000A CALL R3 1 - 0x5C100600, // 000B MOVE R4 R3 - 0x7C100000, // 000C CALL R4 0 - 0x90020604, // 000D SETMBR R0 K3 R4 - 0xA8040001, // 000E EXBLK 1 1 - 0x7002000C, // 000F JMP #001D - 0xAC0C0002, // 0010 CATCH R3 0 2 - 0x70020009, // 0011 JMP #001C - 0xA4160800, // 0012 IMPORT R5 K4 - 0x60180001, // 0013 GETGBL R6 G1 - 0x8C1C0B05, // 0014 GETMET R7 R5 K5 - 0x58240006, // 0015 LDCONST R9 K6 - 0x5C280400, // 0016 MOVE R10 R2 - 0x5C2C0600, // 0017 MOVE R11 R3 - 0x5C300800, // 0018 MOVE R12 R4 - 0x7C1C0A00, // 0019 CALL R7 5 - 0x7C180200, // 001A CALL R6 1 - 0x70020000, // 001B JMP #001D - 0xB0080000, // 001C RAISE 2 R0 R0 - 0x80000000, // 001D RET 0 + ( &(const binstruction[ 4]) { /* code */ + 0x8C080100, // 0000 GETMET R2 R0 K0 + 0x5C100200, // 0001 MOVE R4 R1 + 0x7C080400, // 0002 CALL R2 2 + 0x80000000, // 0003 RET 0 }) ) ); @@ -2021,6 +3010,253 @@ be_local_closure(lvh_obj_get_pad_top, /* name */ /*******************************************************************/ +/******************************************************************** +** Solidified function: get_hidden +********************************************************************/ +be_local_closure(lvh_obj_get_hidden, /* name */ + be_nested_proto( + 4, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 4]) { /* constants */ + /* K0 */ be_nested_str_weak(_lv_obj), + /* K1 */ be_nested_str_weak(has_flag), + /* K2 */ be_nested_str_weak(lv), + /* K3 */ be_nested_str_weak(OBJ_FLAG_HIDDEN), + }), + be_str_weak(get_hidden), + &be_const_str_solidified, + ( &(const binstruction[ 6]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x8C040301, // 0001 GETMET R1 R1 K1 + 0xB80E0400, // 0002 GETNGBL R3 K2 + 0x880C0703, // 0003 GETMBR R3 R3 K3 + 0x7C040400, // 0004 CALL R1 2 + 0x80040200, // 0005 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: get_pad_left +********************************************************************/ +be_local_closure(lvh_obj_get_pad_left, /* name */ + be_nested_proto( + 5, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 5]) { /* constants */ + /* K0 */ be_nested_str_weak(_lv_part2_selector), + /* K1 */ be_nested_str_weak(_lv_obj), + /* K2 */ be_nested_str_weak(get_style_pad_left), + /* K3 */ be_nested_str_weak(lv), + /* K4 */ be_nested_str_weak(STATE_DEFAULT), + }), + be_str_weak(get_pad_left), + &be_const_str_solidified, + ( &(const binstruction[13]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x4C080000, // 0001 LDNIL R2 + 0x20040202, // 0002 NE R1 R1 R2 + 0x78060007, // 0003 JMPF R1 #000C + 0x88040101, // 0004 GETMBR R1 R0 K1 + 0x8C040302, // 0005 GETMET R1 R1 K2 + 0x880C0100, // 0006 GETMBR R3 R0 K0 + 0xB8120600, // 0007 GETNGBL R4 K3 + 0x88100904, // 0008 GETMBR R4 R4 K4 + 0x300C0604, // 0009 OR R3 R3 R4 + 0x7C040400, // 000A CALL R1 2 + 0x80040200, // 000B RET 1 R1 + 0x80000000, // 000C RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: get_radius2 +********************************************************************/ +be_local_closure(lvh_obj_get_radius2, /* name */ + be_nested_proto( + 5, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 5]) { /* constants */ + /* K0 */ be_nested_str_weak(_lv_part2_selector), + /* K1 */ be_nested_str_weak(_lv_obj), + /* K2 */ be_nested_str_weak(get_style_radius), + /* K3 */ be_nested_str_weak(lv), + /* K4 */ be_nested_str_weak(STATE_DEFAULT), + }), + be_str_weak(get_radius2), + &be_const_str_solidified, + ( &(const binstruction[13]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x4C080000, // 0001 LDNIL R2 + 0x20040202, // 0002 NE R1 R1 R2 + 0x78060007, // 0003 JMPF R1 #000C + 0x88040101, // 0004 GETMBR R1 R0 K1 + 0x8C040302, // 0005 GETMET R1 R1 K2 + 0x880C0100, // 0006 GETMBR R3 R0 K0 + 0xB8120600, // 0007 GETNGBL R4 K3 + 0x88100904, // 0008 GETMBR R4 R4 K4 + 0x300C0604, // 0009 OR R3 R3 R4 + 0x7C040400, // 000A CALL R1 2 + 0x80040200, // 000B RET 1 R1 + 0x80000000, // 000C RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: get_pad_all +********************************************************************/ +be_local_closure(lvh_obj_get_pad_all, /* name */ + be_nested_proto( + 1, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 0, /* has constants */ + NULL, /* no const */ + be_str_weak(get_pad_all), + &be_const_str_solidified, + ( &(const binstruction[ 1]) { /* code */ + 0x80000000, // 0000 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_click +********************************************************************/ +be_local_closure(lvh_obj_set_click, /* name */ + be_nested_proto( + 5, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str_weak(set_enabled), + }), + be_str_weak(set_click), + &be_const_str_solidified, + ( &(const binstruction[ 4]) { /* code */ + 0x8C080100, // 0000 GETMET R2 R0 K0 + 0x5C100200, // 0001 MOVE R4 R1 + 0x7C080400, // 0002 CALL R2 2 + 0x80000000, // 0003 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_pad_top2 +********************************************************************/ +be_local_closure(lvh_obj_set_pad_top2, /* name */ + be_nested_proto( + 7, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 5]) { /* constants */ + /* K0 */ be_nested_str_weak(_lv_part2_selector), + /* K1 */ be_nested_str_weak(_lv_obj), + /* K2 */ be_nested_str_weak(set_style_pad_top), + /* K3 */ be_nested_str_weak(lv), + /* K4 */ be_nested_str_weak(STATE_DEFAULT), + }), + be_str_weak(set_pad_top2), + &be_const_str_solidified, + ( &(const binstruction[15]) { /* code */ + 0x88080100, // 0000 GETMBR R2 R0 K0 + 0x4C0C0000, // 0001 LDNIL R3 + 0x20080403, // 0002 NE R2 R2 R3 + 0x780A0009, // 0003 JMPF R2 #000E + 0x88080101, // 0004 GETMBR R2 R0 K1 + 0x8C080502, // 0005 GETMET R2 R2 K2 + 0x60100009, // 0006 GETGBL R4 G9 + 0x5C140200, // 0007 MOVE R5 R1 + 0x7C100200, // 0008 CALL R4 1 + 0x88140100, // 0009 GETMBR R5 R0 K0 + 0xB81A0600, // 000A GETNGBL R6 K3 + 0x88180D04, // 000B GETMBR R6 R6 K4 + 0x30140A06, // 000C OR R5 R5 R6 + 0x7C080600, // 000D CALL R2 3 + 0x80000000, // 000E RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: get_action +********************************************************************/ +be_local_closure(lvh_obj_get_action, /* name */ + be_nested_proto( + 3, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str_weak(_action), + /* K1 */ be_nested_str_weak(), + }), + be_str_weak(get_action), + &be_const_str_solidified, + ( &(const binstruction[ 6]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x78060001, // 0001 JMPF R1 #0004 + 0x5C080200, // 0002 MOVE R2 R1 + 0x70020000, // 0003 JMP #0005 + 0x58080001, // 0004 LDCONST R2 K1 + 0x80040400, // 0005 RET 1 R2 + }) + ) +); +/*******************************************************************/ + + /******************************************************************** ** Solidified function: set_adjustable ********************************************************************/ @@ -2064,9 +3300,45 @@ be_local_closure(lvh_obj_set_adjustable, /* name */ /******************************************************************** -** Solidified function: set_value_color +** Solidified function: set_value_ofs_y ********************************************************************/ -be_local_closure(lvh_obj_set_value_color, /* name */ +be_local_closure(lvh_obj_set_value_ofs_y, /* name */ + be_nested_proto( + 6, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 3]) { /* constants */ + /* K0 */ be_nested_str_weak(check_label), + /* K1 */ be_nested_str_weak(_lv_label), + /* K2 */ be_nested_str_weak(set_y), + }), + be_str_weak(set_value_ofs_y), + &be_const_str_solidified, + ( &(const binstruction[ 9]) { /* code */ + 0x8C080100, // 0000 GETMET R2 R0 K0 + 0x7C080200, // 0001 CALL R2 1 + 0x88080101, // 0002 GETMBR R2 R0 K1 + 0x8C080502, // 0003 GETMET R2 R2 K2 + 0x60100009, // 0004 GETGBL R4 G9 + 0x5C140200, // 0005 MOVE R5 R1 + 0x7C100200, // 0006 CALL R4 1 + 0x7C080400, // 0007 CALL R2 2 + 0x80000000, // 0008 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_hidden +********************************************************************/ +be_local_closure(lvh_obj_set_hidden, /* name */ be_nested_proto( 5, /* nstack */ 2, /* argc */ @@ -2076,194 +3348,29 @@ be_local_closure(lvh_obj_set_value_color, /* name */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str_weak(set_text_color), - }), - be_str_weak(set_value_color), - &be_const_str_solidified, - ( &(const binstruction[ 4]) { /* code */ - 0x8C080100, // 0000 GETMET R2 R0 K0 - 0x5C100200, // 0001 MOVE R4 R1 - 0x7C080400, // 0002 CALL R2 2 - 0x80000000, // 0003 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: register_event_cb -********************************************************************/ -be_local_closure(lvh_obj_register_event_cb, /* name */ - be_nested_proto( - 8, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 6]) { /* constants */ - /* K0 */ be_nested_str_weak(_page), - /* K1 */ be_nested_str_weak(_oh), - /* K2 */ be_nested_str_weak(_event_map), - /* K3 */ be_nested_str_weak(keys), - /* K4 */ be_nested_str_weak(register_event), - /* K5 */ be_nested_str_weak(stop_iteration), - }), - be_str_weak(register_event_cb), - &be_const_str_solidified, - ( &(const binstruction[19]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x88040301, // 0001 GETMBR R1 R1 K1 - 0x60080010, // 0002 GETGBL R2 G16 - 0x880C0102, // 0003 GETMBR R3 R0 K2 - 0x8C0C0703, // 0004 GETMET R3 R3 K3 - 0x7C0C0200, // 0005 CALL R3 1 - 0x7C080200, // 0006 CALL R2 1 - 0xA8020006, // 0007 EXBLK 0 #000F - 0x5C0C0400, // 0008 MOVE R3 R2 - 0x7C0C0000, // 0009 CALL R3 0 - 0x8C100304, // 000A GETMET R4 R1 K4 - 0x5C180000, // 000B MOVE R6 R0 - 0x5C1C0600, // 000C MOVE R7 R3 - 0x7C100600, // 000D CALL R4 3 - 0x7001FFF8, // 000E JMP #0008 - 0x58080005, // 000F LDCONST R2 K5 - 0xAC080200, // 0010 CATCH R2 1 0 - 0xB0080000, // 0011 RAISE 2 R0 R0 - 0x80000000, // 0012 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: set_pad_all2 -********************************************************************/ -be_local_closure(lvh_obj_set_pad_all2, /* name */ - be_nested_proto( - 7, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ ( &(const bvalue[ 5]) { /* constants */ - /* K0 */ be_nested_str_weak(_lv_part2_selector), - /* K1 */ be_nested_str_weak(_lv_obj), - /* K2 */ be_nested_str_weak(set_style_pad_all), - /* K3 */ be_nested_str_weak(lv), - /* K4 */ be_nested_str_weak(STATE_DEFAULT), - }), - be_str_weak(set_pad_all2), - &be_const_str_solidified, - ( &(const binstruction[15]) { /* code */ - 0x88080100, // 0000 GETMBR R2 R0 K0 - 0x4C0C0000, // 0001 LDNIL R3 - 0x20080403, // 0002 NE R2 R2 R3 - 0x780A0009, // 0003 JMPF R2 #000E - 0x88080101, // 0004 GETMBR R2 R0 K1 - 0x8C080502, // 0005 GETMET R2 R2 K2 - 0x60100009, // 0006 GETGBL R4 G9 - 0x5C140200, // 0007 MOVE R5 R1 - 0x7C100200, // 0008 CALL R4 1 - 0x88140100, // 0009 GETMBR R5 R0 K0 - 0xB81A0600, // 000A GETNGBL R6 K3 - 0x88180D04, // 000B GETMBR R6 R6 K4 - 0x30140A06, // 000C OR R5 R5 R6 - 0x7C080600, // 000D CALL R2 3 - 0x80000000, // 000E RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: get_text_rule_formula -********************************************************************/ -be_local_closure(lvh_obj_get_text_rule_formula, /* name */ - be_nested_proto( - 2, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str_weak(_text_rule_formula), - }), - be_str_weak(get_text_rule_formula), - &be_const_str_solidified, - ( &(const binstruction[ 2]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x80040200, // 0001 RET 1 R1 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: get_text_font -********************************************************************/ -be_local_closure(lvh_obj_get_text_font, /* name */ - be_nested_proto( - 1, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 0, /* has constants */ - NULL, /* no const */ - be_str_weak(get_text_font), - &be_const_str_solidified, - ( &(const binstruction[ 1]) { /* code */ - 0x80000000, // 0000 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: get_hidden -********************************************************************/ -be_local_closure(lvh_obj_get_hidden, /* name */ - be_nested_proto( - 4, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 4]) { /* constants */ /* K0 */ be_nested_str_weak(_lv_obj), - /* K1 */ be_nested_str_weak(has_flag), + /* K1 */ be_nested_str_weak(add_flag), /* K2 */ be_nested_str_weak(lv), /* K3 */ be_nested_str_weak(OBJ_FLAG_HIDDEN), + /* K4 */ be_nested_str_weak(clear_flag), }), - be_str_weak(get_hidden), + be_str_weak(set_hidden), &be_const_str_solidified, - ( &(const binstruction[ 6]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x8C040301, // 0001 GETMET R1 R1 K1 - 0xB80E0400, // 0002 GETNGBL R3 K2 - 0x880C0703, // 0003 GETMBR R3 R3 K3 - 0x7C040400, // 0004 CALL R1 2 - 0x80040200, // 0005 RET 1 R1 + ( &(const binstruction[13]) { /* code */ + 0x78060005, // 0000 JMPF R1 #0007 + 0x88080100, // 0001 GETMBR R2 R0 K0 + 0x8C080501, // 0002 GETMET R2 R2 K1 + 0xB8120400, // 0003 GETNGBL R4 K2 + 0x88100903, // 0004 GETMBR R4 R4 K3 + 0x7C080400, // 0005 CALL R2 2 + 0x70020004, // 0006 JMP #000C + 0x88080100, // 0007 GETMBR R2 R0 K0 + 0x8C080504, // 0008 GETMET R2 R2 K4 + 0xB8120400, // 0009 GETNGBL R4 K2 + 0x88100903, // 000A GETMBR R4 R4 K3 + 0x7C080400, // 000B CALL R2 2 + 0x80000000, // 000C RET 0 }) ) ); @@ -2299,282 +3406,23 @@ be_local_closure(lvh_obj_get_value_str, /* name */ /******************************************************************** -** Solidified function: remove_trailing_zeroes +** Solidified function: get_text_font ********************************************************************/ -be_local_closure(lvh_obj_remove_trailing_zeroes, /* name */ +be_local_closure(lvh_obj_get_text_font, /* name */ be_nested_proto( - 8, /* nstack */ - 1, /* argc */ - 4, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 4]) { /* constants */ - /* K0 */ be_const_class(be_class_lvh_obj), - /* K1 */ be_const_int(0), - /* K2 */ be_const_int(1), - /* K3 */ be_nested_str_weak(resize), - }), - be_str_weak(remove_trailing_zeroes), - &be_const_str_solidified, - ( &(const binstruction[24]) { /* code */ - 0x58040000, // 0000 LDCONST R1 K0 - 0x6008000C, // 0001 GETGBL R2 G12 - 0x5C0C0000, // 0002 MOVE R3 R0 - 0x7C080200, // 0003 CALL R2 1 - 0x580C0001, // 0004 LDCONST R3 K1 - 0x14100602, // 0005 LT R4 R3 R2 - 0x78120007, // 0006 JMPF R4 #000F - 0x5411FFFE, // 0007 LDINT R4 -1 - 0x04100803, // 0008 SUB R4 R4 R3 - 0x94100004, // 0009 GETIDX R4 R0 R4 - 0x20100901, // 000A NE R4 R4 K1 - 0x78120000, // 000B JMPF R4 #000D - 0x70020001, // 000C JMP #000F - 0x000C0702, // 000D ADD R3 R3 K2 - 0x7001FFF5, // 000E JMP #0005 - 0x24100701, // 000F GT R4 R3 K1 - 0x78120005, // 0010 JMPF R4 #0017 - 0x8C100103, // 0011 GETMET R4 R0 K3 - 0x6018000C, // 0012 GETGBL R6 G12 - 0x5C1C0000, // 0013 MOVE R7 R0 - 0x7C180200, // 0014 CALL R6 1 - 0x04180C03, // 0015 SUB R6 R6 R3 - 0x7C100400, // 0016 CALL R4 2 - 0x80040000, // 0017 RET 1 R0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: set_click -********************************************************************/ -be_local_closure(lvh_obj_set_click, /* name */ - be_nested_proto( - 5, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str_weak(set_enabled), - }), - be_str_weak(set_click), - &be_const_str_solidified, - ( &(const binstruction[ 4]) { /* code */ - 0x8C080100, // 0000 GETMET R2 R0 K0 - 0x5C100200, // 0001 MOVE R4 R1 - 0x7C080400, // 0002 CALL R2 2 - 0x80000000, // 0003 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: get_text -********************************************************************/ -be_local_closure(lvh_obj_get_text, /* name */ - be_nested_proto( - 3, /* nstack */ + 1, /* nstack */ 1, /* argc */ 2, /* varg */ 0, /* has upvals */ NULL, /* no upvals */ 0, /* has sup protos */ NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 2]) { /* constants */ - /* K0 */ be_nested_str_weak(_lv_label), - /* K1 */ be_nested_str_weak(get_text), - }), - be_str_weak(get_text), + 0, /* has constants */ + NULL, /* no const */ + be_str_weak(get_text_font), &be_const_str_solidified, - ( &(const binstruction[10]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x4C080000, // 0001 LDNIL R2 - 0x1C040202, // 0002 EQ R1 R1 R2 - 0x78060001, // 0003 JMPF R1 #0006 - 0x4C040000, // 0004 LDNIL R1 - 0x80040200, // 0005 RET 1 R1 - 0x88040100, // 0006 GETMBR R1 R0 K0 - 0x8C040301, // 0007 GETMET R1 R1 K1 - 0x7C040200, // 0008 CALL R1 1 - 0x80040200, // 0009 RET 1 R1 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: set_action -********************************************************************/ -be_local_closure(lvh_obj_set_action, /* name */ - be_nested_proto( - 4, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str_weak(_action), - }), - be_str_weak(set_action), - &be_const_str_solidified, - ( &(const binstruction[ 5]) { /* code */ - 0x60080008, // 0000 GETGBL R2 G8 - 0x5C0C0200, // 0001 MOVE R3 R1 - 0x7C080200, // 0002 CALL R2 1 - 0x90020002, // 0003 SETMBR R0 K0 R2 - 0x80000000, // 0004 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: setmember -********************************************************************/ -be_local_closure(lvh_obj_setmember, /* name */ - be_nested_proto( - 12, /* nstack */ - 3, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[19]) { /* constants */ - /* K0 */ be_nested_str_weak(string), - /* K1 */ be_nested_str_weak(introspect), - /* K2 */ be_const_int(0), - /* K3 */ be_const_int(3), - /* K4 */ be_nested_str_weak(set_), - /* K5 */ be_nested_str_weak(get_), - /* K6 */ be_nested_str_weak(_attr_ignore), - /* K7 */ be_nested_str_weak(find), - /* K8 */ be_nested_str_weak(get), - /* K9 */ be_nested_str_weak(function), - /* K10 */ be_nested_str_weak(_attr_map), - /* K11 */ be_nested_str_weak(contains), - /* K12 */ be_nested_str_weak(_lv_obj), - /* K13 */ be_nested_str_weak(is_color_attribute), - /* K14 */ be_nested_str_weak(parse_color), - /* K15 */ be_nested_str_weak(style_), - /* K16 */ be_nested_str_weak(_X20for_X20), - /* K17 */ be_nested_str_weak(HSP_X3A_X20Could_X20not_X20find_X20function_X20set_), - /* K18 */ be_nested_str_weak(HSP_X3A_X20unknown_X20attribute_X3A), - }), - be_str_weak(setmember), - &be_const_str_solidified, - ( &(const binstruction[93]) { /* code */ - 0xA40E0000, // 0000 IMPORT R3 K0 - 0xA4120200, // 0001 IMPORT R4 K1 - 0x40160503, // 0002 CONNECT R5 K2 K3 - 0x94140205, // 0003 GETIDX R5 R1 R5 - 0x1C180B04, // 0004 EQ R6 R5 K4 - 0x741A0001, // 0005 JMPT R6 #0008 - 0x1C180B05, // 0006 EQ R6 R5 K5 - 0x781A0000, // 0007 JMPF R6 #0009 - 0x80000C00, // 0008 RET 0 - 0x88180106, // 0009 GETMBR R6 R0 K6 - 0x8C180D07, // 000A GETMET R6 R6 K7 - 0x5C200200, // 000B MOVE R8 R1 - 0x7C180400, // 000C CALL R6 2 - 0x4C1C0000, // 000D LDNIL R7 - 0x20180C07, // 000E NE R6 R6 R7 - 0x781A0000, // 000F JMPF R6 #0011 - 0x80000C00, // 0010 RET 0 - 0x8C180908, // 0011 GETMET R6 R4 K8 - 0x5C200000, // 0012 MOVE R8 R0 - 0x00260801, // 0013 ADD R9 K4 R1 - 0x7C180600, // 0014 CALL R6 3 - 0x601C0004, // 0015 GETGBL R7 G4 - 0x5C200C00, // 0016 MOVE R8 R6 - 0x7C1C0200, // 0017 CALL R7 1 - 0x1C1C0F09, // 0018 EQ R7 R7 K9 - 0x781E0004, // 0019 JMPF R7 #001F - 0x5C1C0C00, // 001A MOVE R7 R6 - 0x5C200000, // 001B MOVE R8 R0 - 0x5C240400, // 001C MOVE R9 R2 - 0x7C1C0400, // 001D CALL R7 2 - 0x80000E00, // 001E RET 0 - 0x881C010A, // 001F GETMBR R7 R0 K10 - 0x8C1C0F0B, // 0020 GETMET R7 R7 K11 - 0x5C240200, // 0021 MOVE R9 R1 - 0x7C1C0400, // 0022 CALL R7 2 - 0x781E0033, // 0023 JMPF R7 #0058 - 0x881C010A, // 0024 GETMBR R7 R0 K10 - 0x941C0E01, // 0025 GETIDX R7 R7 R1 - 0x8C200908, // 0026 GETMET R8 R4 K8 - 0x8828010C, // 0027 GETMBR R10 R0 K12 - 0x002E0807, // 0028 ADD R11 K4 R7 - 0x7C200600, // 0029 CALL R8 3 - 0x5C181000, // 002A MOVE R6 R8 - 0x8C20010D, // 002B GETMET R8 R0 K13 - 0x5C280E00, // 002C MOVE R10 R7 - 0x7C200400, // 002D CALL R8 2 - 0x78220003, // 002E JMPF R8 #0033 - 0x8C20010E, // 002F GETMET R8 R0 K14 - 0x5C280400, // 0030 MOVE R10 R2 - 0x7C200400, // 0031 CALL R8 2 - 0x5C081000, // 0032 MOVE R2 R8 - 0x60200004, // 0033 GETGBL R8 G4 - 0x5C240C00, // 0034 MOVE R9 R6 - 0x7C200200, // 0035 CALL R8 1 - 0x1C201109, // 0036 EQ R8 R8 K9 - 0x7822001B, // 0037 JMPF R8 #0054 - 0xA8020011, // 0038 EXBLK 0 #004B - 0x8C200707, // 0039 GETMET R8 R3 K7 - 0x5C280E00, // 003A MOVE R10 R7 - 0x582C000F, // 003B LDCONST R11 K15 - 0x7C200600, // 003C CALL R8 3 - 0x1C201102, // 003D EQ R8 R8 K2 - 0x78220005, // 003E JMPF R8 #0045 - 0x5C200C00, // 003F MOVE R8 R6 - 0x8824010C, // 0040 GETMBR R9 R0 K12 - 0x5C280400, // 0041 MOVE R10 R2 - 0x582C0002, // 0042 LDCONST R11 K2 - 0x7C200600, // 0043 CALL R8 3 - 0x70020003, // 0044 JMP #0049 - 0x5C200C00, // 0045 MOVE R8 R6 - 0x8824010C, // 0046 GETMBR R9 R0 K12 - 0x5C280400, // 0047 MOVE R10 R2 - 0x7C200400, // 0048 CALL R8 2 - 0xA8040001, // 0049 EXBLK 1 1 - 0x70020006, // 004A JMP #0052 - 0xAC200002, // 004B CATCH R8 0 2 - 0x70020003, // 004C JMP #0051 - 0x00281310, // 004D ADD R10 R9 K16 - 0x00281401, // 004E ADD R10 R10 R1 - 0xB004100A, // 004F RAISE 1 R8 R10 - 0x70020000, // 0050 JMP #0052 - 0xB0080000, // 0051 RAISE 2 R0 R0 - 0x80001000, // 0052 RET 0 - 0x70020002, // 0053 JMP #0057 - 0x60200001, // 0054 GETGBL R8 G1 - 0x00262207, // 0055 ADD R9 K17 R7 - 0x7C200200, // 0056 CALL R8 1 - 0x70020003, // 0057 JMP #005C - 0x601C0001, // 0058 GETGBL R7 G1 - 0x58200012, // 0059 LDCONST R8 K18 - 0x5C240200, // 005A MOVE R9 R1 - 0x7C1C0400, // 005B CALL R7 2 - 0x80000000, // 005C RET 0 + ( &(const binstruction[ 1]) { /* code */ + 0x80000000, // 0000 RET 0 }) ) ); @@ -2656,11 +3504,11 @@ be_local_closure(lvh_obj_set_text_rule, /* name */ /******************************************************************** -** Solidified function: get_adjustable +** Solidified function: get_meta ********************************************************************/ -be_local_closure(lvh_obj_get_adjustable, /* name */ +be_local_closure(lvh_obj_get_meta, /* name */ be_nested_proto( - 4, /* nstack */ + 2, /* nstack */ 1, /* argc */ 2, /* varg */ 0, /* has upvals */ @@ -2668,154 +3516,41 @@ be_local_closure(lvh_obj_get_adjustable, /* name */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[ 4]) { /* constants */ - /* K0 */ be_nested_str_weak(_lv_obj), - /* K1 */ be_nested_str_weak(has_flag), - /* K2 */ be_nested_str_weak(lv), - /* K3 */ be_nested_str_weak(OBJ_FLAG_CLICKABLE), - }), - be_str_weak(get_adjustable), - &be_const_str_solidified, - ( &(const binstruction[ 6]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x8C040301, // 0001 GETMET R1 R1 K1 - 0xB80E0400, // 0002 GETNGBL R3 K2 - 0x880C0703, // 0003 GETMBR R3 R3 K3 - 0x7C040400, // 0004 CALL R1 2 - 0x80040200, // 0005 RET 1 R1 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: get_pad_all -********************************************************************/ -be_local_closure(lvh_obj_get_pad_all, /* name */ - be_nested_proto( - 1, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 0, /* has constants */ - NULL, /* no const */ - be_str_weak(get_pad_all), - &be_const_str_solidified, - ( &(const binstruction[ 1]) { /* code */ - 0x80000000, // 0000 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: set_radius2 -********************************************************************/ -be_local_closure(lvh_obj_set_radius2, /* name */ - be_nested_proto( - 7, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 5]) { /* constants */ - /* K0 */ be_nested_str_weak(_lv_part2_selector), - /* K1 */ be_nested_str_weak(_lv_obj), - /* K2 */ be_nested_str_weak(set_style_radius), - /* K3 */ be_nested_str_weak(lv), - /* K4 */ be_nested_str_weak(STATE_DEFAULT), - }), - be_str_weak(set_radius2), - &be_const_str_solidified, - ( &(const binstruction[15]) { /* code */ - 0x88080100, // 0000 GETMBR R2 R0 K0 - 0x4C0C0000, // 0001 LDNIL R3 - 0x20080403, // 0002 NE R2 R2 R3 - 0x780A0009, // 0003 JMPF R2 #000E - 0x88080101, // 0004 GETMBR R2 R0 K1 - 0x8C080502, // 0005 GETMET R2 R2 K2 - 0x60100009, // 0006 GETGBL R4 G9 - 0x5C140200, // 0007 MOVE R5 R1 - 0x7C100200, // 0008 CALL R4 1 - 0x88140100, // 0009 GETMBR R5 R0 K0 - 0xB81A0600, // 000A GETNGBL R6 K3 - 0x88180D04, // 000B GETMBR R6 R6 K4 - 0x30140A06, // 000C OR R5 R5 R6 - 0x7C080600, // 000D CALL R2 3 - 0x80000000, // 000E RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: set_value_ofs_y -********************************************************************/ -be_local_closure(lvh_obj_set_value_ofs_y, /* name */ - be_nested_proto( - 6, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 3]) { /* constants */ - /* K0 */ be_nested_str_weak(check_label), - /* K1 */ be_nested_str_weak(_lv_label), - /* K2 */ be_nested_str_weak(set_y), - }), - be_str_weak(set_value_ofs_y), - &be_const_str_solidified, - ( &(const binstruction[ 9]) { /* code */ - 0x8C080100, // 0000 GETMET R2 R0 K0 - 0x7C080200, // 0001 CALL R2 1 - 0x88080101, // 0002 GETMBR R2 R0 K1 - 0x8C080502, // 0003 GETMET R2 R2 K2 - 0x60100009, // 0004 GETGBL R4 G9 - 0x5C140200, // 0005 MOVE R5 R1 - 0x7C100200, // 0006 CALL R4 1 - 0x7C080400, // 0007 CALL R2 2 - 0x80000000, // 0008 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: set_value_str -********************************************************************/ -be_local_closure(lvh_obj_set_value_str, /* name */ - be_nested_proto( - 5, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str_weak(set_text), + /* K0 */ be_nested_str_weak(_meta), }), - be_str_weak(set_value_str), + be_str_weak(get_meta), &be_const_str_solidified, - ( &(const binstruction[ 4]) { /* code */ - 0x8C080100, // 0000 GETMET R2 R0 K0 - 0x5C100200, // 0001 MOVE R4 R1 - 0x7C080400, // 0002 CALL R2 2 - 0x80000000, // 0003 RET 0 + ( &(const binstruction[ 2]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x80040200, // 0001 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: get_val_rule +********************************************************************/ +be_local_closure(lvh_obj_get_val_rule, /* name */ + be_nested_proto( + 2, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str_weak(_val_rule), + }), + be_str_weak(get_val_rule), + &be_const_str_solidified, + ( &(const binstruction[ 2]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x80040200, // 0001 RET 1 R1 }) ) ); @@ -3011,9 +3746,9 @@ be_local_closure(lvh_obj_set_text_font, /* name */ /******************************************************************** -** Solidified function: set_align +** Solidified function: set_radius2 ********************************************************************/ -be_local_closure(lvh_obj_set_align, /* name */ +be_local_closure(lvh_obj_set_radius2, /* name */ be_nested_proto( 7, /* nstack */ 2, /* argc */ @@ -3023,695 +3758,31 @@ be_local_closure(lvh_obj_set_align, /* name */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[13]) { /* constants */ - /* K0 */ be_nested_str_weak(check_label), - /* K1 */ be_const_int(0), - /* K2 */ be_nested_str_weak(left), - /* K3 */ be_nested_str_weak(lv), - /* K4 */ be_nested_str_weak(TEXT_ALIGN_LEFT), - /* K5 */ be_const_int(1), - /* K6 */ be_nested_str_weak(center), - /* K7 */ be_nested_str_weak(TEXT_ALIGN_CENTER), - /* K8 */ be_const_int(2), - /* K9 */ be_nested_str_weak(right), - /* K10 */ be_nested_str_weak(TEXT_ALIGN_RIGHT), - /* K11 */ be_nested_str_weak(_lv_label), - /* K12 */ be_nested_str_weak(set_style_text_align), - }), - be_str_weak(set_align), - &be_const_str_solidified, - ( &(const binstruction[29]) { /* code */ - 0x4C080000, // 0000 LDNIL R2 - 0x8C0C0100, // 0001 GETMET R3 R0 K0 - 0x7C0C0200, // 0002 CALL R3 1 - 0x1C0C0301, // 0003 EQ R3 R1 K1 - 0x740E0001, // 0004 JMPT R3 #0007 - 0x1C0C0302, // 0005 EQ R3 R1 K2 - 0x780E0002, // 0006 JMPF R3 #000A - 0xB80E0600, // 0007 GETNGBL R3 K3 - 0x88080704, // 0008 GETMBR R2 R3 K4 - 0x7002000C, // 0009 JMP #0017 - 0x1C0C0305, // 000A EQ R3 R1 K5 - 0x740E0001, // 000B JMPT R3 #000E - 0x1C0C0306, // 000C EQ R3 R1 K6 - 0x780E0002, // 000D JMPF R3 #0011 - 0xB80E0600, // 000E GETNGBL R3 K3 - 0x88080707, // 000F GETMBR R2 R3 K7 - 0x70020005, // 0010 JMP #0017 - 0x1C0C0308, // 0011 EQ R3 R1 K8 - 0x740E0001, // 0012 JMPT R3 #0015 - 0x1C0C0309, // 0013 EQ R3 R1 K9 - 0x780E0001, // 0014 JMPF R3 #0017 - 0xB80E0600, // 0015 GETNGBL R3 K3 - 0x8808070A, // 0016 GETMBR R2 R3 K10 - 0x880C010B, // 0017 GETMBR R3 R0 K11 - 0x8C0C070C, // 0018 GETMET R3 R3 K12 - 0x5C140400, // 0019 MOVE R5 R2 - 0x58180001, // 001A LDCONST R6 K1 - 0x7C0C0600, // 001B CALL R3 3 - 0x80000000, // 001C RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: text_rule_matched -********************************************************************/ -be_local_closure(lvh_obj_text_rule_matched, /* name */ - be_nested_proto( - 12, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 8]) { /* constants */ - /* K0 */ be_nested_str_weak(int), - /* K1 */ be_nested_str_weak(_text_rule_function), - /* K2 */ be_nested_str_weak(string), - /* K3 */ be_nested_str_weak(format), - /* K4 */ be_nested_str_weak(HSP_X3A_X20failed_X20to_X20run_X20self_X2E_text_rule_function_X20_X2D_X20_X25s_X20_X28_X25s_X29), - /* K5 */ be_nested_str_weak(_text_rule_format), - /* K6 */ be_nested_str_weak(), - /* K7 */ be_nested_str_weak(text), - }), - be_str_weak(text_rule_matched), - &be_const_str_solidified, - ( &(const binstruction[49]) { /* code */ - 0x60080004, // 0000 GETGBL R2 G4 - 0x5C0C0200, // 0001 MOVE R3 R1 - 0x7C080200, // 0002 CALL R2 1 - 0x1C080500, // 0003 EQ R2 R2 K0 - 0x780A0003, // 0004 JMPF R2 #0009 - 0x6008000A, // 0005 GETGBL R2 G10 - 0x5C0C0200, // 0006 MOVE R3 R1 - 0x7C080200, // 0007 CALL R2 1 - 0x5C040400, // 0008 MOVE R1 R2 - 0x88080101, // 0009 GETMBR R2 R0 K1 - 0x4C0C0000, // 000A LDNIL R3 - 0x200C0403, // 000B NE R3 R2 R3 - 0x780E0012, // 000C JMPF R3 #0020 - 0xA8020005, // 000D EXBLK 0 #0014 - 0x5C0C0400, // 000E MOVE R3 R2 - 0x5C100200, // 000F MOVE R4 R1 - 0x7C0C0200, // 0010 CALL R3 1 - 0x5C040600, // 0011 MOVE R1 R3 - 0xA8040001, // 0012 EXBLK 1 1 - 0x7002000B, // 0013 JMP #0020 - 0xAC0C0002, // 0014 CATCH R3 0 2 - 0x70020008, // 0015 JMP #001F - 0xA4160400, // 0016 IMPORT R5 K2 - 0x60180001, // 0017 GETGBL R6 G1 - 0x8C1C0B03, // 0018 GETMET R7 R5 K3 - 0x58240004, // 0019 LDCONST R9 K4 - 0x5C280600, // 001A MOVE R10 R3 - 0x5C2C0800, // 001B MOVE R11 R4 - 0x7C1C0800, // 001C CALL R7 4 - 0x7C180200, // 001D CALL R6 1 - 0x70020000, // 001E JMP #0020 - 0xB0080000, // 001F RAISE 2 R0 R0 - 0x880C0105, // 0020 GETMBR R3 R0 K5 - 0x60100004, // 0021 GETGBL R4 G4 - 0x5C140600, // 0022 MOVE R5 R3 - 0x7C100200, // 0023 CALL R4 1 - 0x1C100902, // 0024 EQ R4 R4 K2 - 0x78120006, // 0025 JMPF R4 #002D - 0xA4120400, // 0026 IMPORT R4 K2 - 0x8C140903, // 0027 GETMET R5 R4 K3 - 0x5C1C0600, // 0028 MOVE R7 R3 - 0x5C200200, // 0029 MOVE R8 R1 - 0x7C140600, // 002A CALL R5 3 - 0x5C0C0A00, // 002B MOVE R3 R5 - 0x70020000, // 002C JMP #002E - 0x580C0006, // 002D LDCONST R3 K6 - 0x90020E03, // 002E SETMBR R0 K7 R3 - 0x50100000, // 002F LDBOOL R4 0 0 - 0x80040800, // 0030 RET 1 R4 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: set_line_width -********************************************************************/ -be_local_closure(lvh_obj_set_line_width, /* name */ - be_nested_proto( - 6, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 3]) { /* constants */ - /* K0 */ be_nested_str_weak(_lv_obj), - /* K1 */ be_nested_str_weak(set_style_line_width), - /* K2 */ be_const_int(0), - }), - be_str_weak(set_line_width), - &be_const_str_solidified, - ( &(const binstruction[ 8]) { /* code */ - 0x88080100, // 0000 GETMBR R2 R0 K0 - 0x8C080501, // 0001 GETMET R2 R2 K1 - 0x60100009, // 0002 GETGBL R4 G9 - 0x5C140200, // 0003 MOVE R5 R1 - 0x7C100200, // 0004 CALL R4 1 - 0x58140002, // 0005 LDCONST R5 K2 - 0x7C080600, // 0006 CALL R2 3 - 0x80000000, // 0007 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: get_val_rule_formula -********************************************************************/ -be_local_closure(lvh_obj_get_val_rule_formula, /* name */ - be_nested_proto( - 2, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str_weak(_val_rule_formula), - }), - be_str_weak(get_val_rule_formula), - &be_const_str_solidified, - ( &(const binstruction[ 2]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x80040200, // 0001 RET 1 R1 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: set_val_rule_formula -********************************************************************/ -be_local_closure(lvh_obj_set_val_rule_formula, /* name */ - be_nested_proto( - 13, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 7]) { /* constants */ - /* K0 */ be_nested_str_weak(_val_rule_formula), - /* K1 */ be_nested_str_weak(return_X20_X2F_X20val_X20_X2D_X3E_X20_X28), - /* K2 */ be_nested_str_weak(_X29), - /* K3 */ be_nested_str_weak(_val_rule_function), - /* K4 */ be_nested_str_weak(string), - /* K5 */ be_nested_str_weak(format), - /* K6 */ be_nested_str_weak(HSP_X3A_X20failed_X20to_X20compile_X20_X27_X25s_X27_X20_X2D_X20_X25s_X20_X28_X25s_X29), - }), - be_str_weak(set_val_rule_formula), - &be_const_str_solidified, - ( &(const binstruction[30]) { /* code */ - 0x60080008, // 0000 GETGBL R2 G8 - 0x5C0C0200, // 0001 MOVE R3 R1 - 0x7C080200, // 0002 CALL R2 1 - 0x90020002, // 0003 SETMBR R0 K0 R2 - 0x88080100, // 0004 GETMBR R2 R0 K0 - 0x000A0202, // 0005 ADD R2 K1 R2 - 0x00080502, // 0006 ADD R2 R2 K2 - 0xA8020007, // 0007 EXBLK 0 #0010 - 0x600C000D, // 0008 GETGBL R3 G13 - 0x5C100400, // 0009 MOVE R4 R2 - 0x7C0C0200, // 000A CALL R3 1 - 0x5C100600, // 000B MOVE R4 R3 - 0x7C100000, // 000C CALL R4 0 - 0x90020604, // 000D SETMBR R0 K3 R4 - 0xA8040001, // 000E EXBLK 1 1 - 0x7002000C, // 000F JMP #001D - 0xAC0C0002, // 0010 CATCH R3 0 2 - 0x70020009, // 0011 JMP #001C - 0xA4160800, // 0012 IMPORT R5 K4 - 0x60180001, // 0013 GETGBL R6 G1 - 0x8C1C0B05, // 0014 GETMET R7 R5 K5 - 0x58240006, // 0015 LDCONST R9 K6 - 0x5C280400, // 0016 MOVE R10 R2 - 0x5C2C0600, // 0017 MOVE R11 R3 - 0x5C300800, // 0018 MOVE R12 R4 - 0x7C1C0A00, // 0019 CALL R7 5 - 0x7C180200, // 001A CALL R6 1 - 0x70020000, // 001B JMP #001D - 0xB0080000, // 001C RAISE 2 R0 R0 - 0x80000000, // 001D RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: set_value_ofs_x -********************************************************************/ -be_local_closure(lvh_obj_set_value_ofs_x, /* name */ - be_nested_proto( - 6, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 3]) { /* constants */ - /* K0 */ be_nested_str_weak(check_label), - /* K1 */ be_nested_str_weak(_lv_label), - /* K2 */ be_nested_str_weak(set_x), - }), - be_str_weak(set_value_ofs_x), - &be_const_str_solidified, - ( &(const binstruction[ 9]) { /* code */ - 0x8C080100, // 0000 GETMET R2 R0 K0 - 0x7C080200, // 0001 CALL R2 1 - 0x88080101, // 0002 GETMBR R2 R0 K1 - 0x8C080502, // 0003 GETMET R2 R2 K2 - 0x60100009, // 0004 GETGBL R4 G9 - 0x5C140200, // 0005 MOVE R5 R1 - 0x7C100200, // 0006 CALL R4 1 - 0x7C080400, // 0007 CALL R2 2 - 0x80000000, // 0008 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: get_pad_left -********************************************************************/ -be_local_closure(lvh_obj_get_pad_left, /* name */ - be_nested_proto( - 5, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ ( &(const bvalue[ 5]) { /* constants */ /* K0 */ be_nested_str_weak(_lv_part2_selector), /* K1 */ be_nested_str_weak(_lv_obj), - /* K2 */ be_nested_str_weak(get_style_pad_left), + /* K2 */ be_nested_str_weak(set_style_radius), /* K3 */ be_nested_str_weak(lv), /* K4 */ be_nested_str_weak(STATE_DEFAULT), }), - be_str_weak(get_pad_left), + be_str_weak(set_radius2), &be_const_str_solidified, - ( &(const binstruction[13]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x4C080000, // 0001 LDNIL R2 - 0x20040202, // 0002 NE R1 R1 R2 - 0x78060007, // 0003 JMPF R1 #000C - 0x88040101, // 0004 GETMBR R1 R0 K1 - 0x8C040302, // 0005 GETMET R1 R1 K2 - 0x880C0100, // 0006 GETMBR R3 R0 K0 - 0xB8120600, // 0007 GETNGBL R4 K3 - 0x88100904, // 0008 GETMBR R4 R4 K4 - 0x300C0604, // 0009 OR R3 R3 R4 - 0x7C040400, // 000A CALL R1 2 - 0x80040200, // 000B RET 1 R1 - 0x80000000, // 000C RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: post_init -********************************************************************/ -be_local_closure(lvh_obj_post_init, /* name */ - be_nested_proto( - 3, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str_weak(register_event_cb), - }), - be_str_weak(post_init), - &be_const_str_solidified, - ( &(const binstruction[ 3]) { /* code */ - 0x8C040100, // 0000 GETMET R1 R0 K0 - 0x7C040200, // 0001 CALL R1 1 - 0x80000000, // 0002 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: get_text_rule_format -********************************************************************/ -be_local_closure(lvh_obj_get_text_rule_format, /* name */ - be_nested_proto( - 2, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str_weak(_text_rule_format), - }), - be_str_weak(get_text_rule_format), - &be_const_str_solidified, - ( &(const binstruction[ 2]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x80040200, // 0001 RET 1 R1 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: member -********************************************************************/ -be_local_closure(lvh_obj_member, /* name */ - be_nested_proto( - 11, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[16]) { /* constants */ - /* K0 */ be_nested_str_weak(string), - /* K1 */ be_nested_str_weak(introspect), - /* K2 */ be_const_int(0), - /* K3 */ be_const_int(3), - /* K4 */ be_nested_str_weak(set_), - /* K5 */ be_nested_str_weak(get_), - /* K6 */ be_nested_str_weak(_attr_ignore), - /* K7 */ be_nested_str_weak(find), - /* K8 */ be_nested_str_weak(get), - /* K9 */ be_nested_str_weak(function), - /* K10 */ be_nested_str_weak(_attr_map), - /* K11 */ be_nested_str_weak(contains), - /* K12 */ be_nested_str_weak(_lv_obj), - /* K13 */ be_nested_str_weak(style_), - /* K14 */ be_nested_str_weak(unknown_X20attribute_X20), - /* K15 */ be_nested_str_weak(value_error), - }), - be_str_weak(member), - &be_const_str_solidified, - ( &(const binstruction[69]) { /* code */ - 0xA40A0000, // 0000 IMPORT R2 K0 - 0xA40E0200, // 0001 IMPORT R3 K1 - 0x40120503, // 0002 CONNECT R4 K2 K3 - 0x94100204, // 0003 GETIDX R4 R1 R4 - 0x1C140904, // 0004 EQ R5 R4 K4 - 0x74160001, // 0005 JMPT R5 #0008 - 0x1C140905, // 0006 EQ R5 R4 K5 - 0x78160000, // 0007 JMPF R5 #0009 - 0x80000A00, // 0008 RET 0 - 0x88140106, // 0009 GETMBR R5 R0 K6 - 0x8C140B07, // 000A GETMET R5 R5 K7 - 0x5C1C0200, // 000B MOVE R7 R1 - 0x7C140400, // 000C CALL R5 2 - 0x4C180000, // 000D LDNIL R6 - 0x20140A06, // 000E NE R5 R5 R6 - 0x78160000, // 000F JMPF R5 #0011 - 0x80000A00, // 0010 RET 0 - 0x8C140708, // 0011 GETMET R5 R3 K8 - 0x5C1C0000, // 0012 MOVE R7 R0 - 0x00220A01, // 0013 ADD R8 K5 R1 - 0x7C140600, // 0014 CALL R5 3 - 0x60180004, // 0015 GETGBL R6 G4 - 0x5C1C0A00, // 0016 MOVE R7 R5 - 0x7C180200, // 0017 CALL R6 1 - 0x1C180D09, // 0018 EQ R6 R6 K9 - 0x781A0003, // 0019 JMPF R6 #001E - 0x5C180A00, // 001A MOVE R6 R5 - 0x5C1C0000, // 001B MOVE R7 R0 - 0x7C180200, // 001C CALL R6 1 - 0x80040C00, // 001D RET 1 R6 - 0x8818010A, // 001E GETMBR R6 R0 K10 - 0x8C180D0B, // 001F GETMET R6 R6 K11 - 0x5C200200, // 0020 MOVE R8 R1 - 0x7C180400, // 0021 CALL R6 2 - 0x781A001B, // 0022 JMPF R6 #003F - 0x8818010A, // 0023 GETMBR R6 R0 K10 - 0x94180C01, // 0024 GETIDX R6 R6 R1 - 0x8C1C0708, // 0025 GETMET R7 R3 K8 - 0x8824010C, // 0026 GETMBR R9 R0 K12 - 0x002A0A06, // 0027 ADD R10 K5 R6 - 0x7C1C0600, // 0028 CALL R7 3 - 0x5C140E00, // 0029 MOVE R5 R7 - 0x601C0004, // 002A GETGBL R7 G4 - 0x5C200A00, // 002B MOVE R8 R5 - 0x7C1C0200, // 002C CALL R7 1 - 0x1C1C0F09, // 002D EQ R7 R7 K9 - 0x781E000F, // 002E JMPF R7 #003F - 0x8C1C0507, // 002F GETMET R7 R2 K7 - 0x5C240C00, // 0030 MOVE R9 R6 - 0x5828000D, // 0031 LDCONST R10 K13 - 0x7C1C0600, // 0032 CALL R7 3 - 0x1C1C0F02, // 0033 EQ R7 R7 K2 - 0x781E0005, // 0034 JMPF R7 #003B - 0x5C1C0A00, // 0035 MOVE R7 R5 - 0x8820010C, // 0036 GETMBR R8 R0 K12 - 0x58240002, // 0037 LDCONST R9 K2 - 0x7C1C0400, // 0038 CALL R7 2 - 0x80040E00, // 0039 RET 1 R7 - 0x70020003, // 003A JMP #003F - 0x5C1C0A00, // 003B MOVE R7 R5 - 0x8820010C, // 003C GETMBR R8 R0 K12 - 0x7C1C0200, // 003D CALL R7 1 - 0x80040E00, // 003E RET 1 R7 - 0x60180008, // 003F GETGBL R6 G8 - 0x5C1C0200, // 0040 MOVE R7 R1 - 0x7C180200, // 0041 CALL R6 1 - 0x001A1C06, // 0042 ADD R6 K14 R6 - 0xB0061E06, // 0043 RAISE 1 K15 R6 - 0x80000000, // 0044 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: is_color_attribute -********************************************************************/ -be_local_closure(lvh_obj_is_color_attribute, /* name */ - be_nested_proto( - 9, /* nstack */ - 1, /* argc */ - 4, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 4]) { /* constants */ - /* K0 */ be_const_class(be_class_lvh_obj), - /* K1 */ be_nested_str_weak(re), - /* K2 */ be_nested_str_weak(search), - /* K3 */ be_nested_str_weak(color_X24), - }), - be_str_weak(is_color_attribute), - &be_const_str_solidified, - ( &(const binstruction[11]) { /* code */ - 0x58040000, // 0000 LDCONST R1 K0 - 0xA40A0200, // 0001 IMPORT R2 K1 - 0x600C0017, // 0002 GETGBL R3 G23 - 0x8C100502, // 0003 GETMET R4 R2 K2 - 0x58180003, // 0004 LDCONST R6 K3 - 0x601C0008, // 0005 GETGBL R7 G8 - 0x5C200000, // 0006 MOVE R8 R0 - 0x7C1C0200, // 0007 CALL R7 1 - 0x7C100600, // 0008 CALL R4 3 - 0x7C0C0200, // 0009 CALL R3 1 - 0x80040600, // 000A RET 1 R3 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: get_val -********************************************************************/ -be_local_closure(lvh_obj_get_val, /* name */ - be_nested_proto( - 3, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 2]) { /* constants */ - /* K0 */ be_nested_str_weak(_lv_obj), - /* K1 */ be_nested_str_weak(get_value), - }), - be_str_weak(get_val), - &be_const_str_solidified, - ( &(const binstruction[ 4]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x8C040301, // 0001 GETMET R1 R1 K1 - 0x7C040200, // 0002 CALL R1 1 - 0x80040200, // 0003 RET 1 R1 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: get_mode -********************************************************************/ -be_local_closure(lvh_obj_get_mode, /* name */ - be_nested_proto( - 1, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 0, /* has constants */ - NULL, /* no const */ - be_str_weak(get_mode), - &be_const_str_solidified, - ( &(const binstruction[ 1]) { /* code */ - 0x80000000, // 0000 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: get_pad_right -********************************************************************/ -be_local_closure(lvh_obj_get_pad_right, /* name */ - be_nested_proto( - 5, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 5]) { /* constants */ - /* K0 */ be_nested_str_weak(_lv_part2_selector), - /* K1 */ be_nested_str_weak(_lv_obj), - /* K2 */ be_nested_str_weak(get_style_pad_right), - /* K3 */ be_nested_str_weak(lv), - /* K4 */ be_nested_str_weak(STATE_DEFAULT), - }), - be_str_weak(get_pad_right), - &be_const_str_solidified, - ( &(const binstruction[13]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x4C080000, // 0001 LDNIL R2 - 0x20040202, // 0002 NE R1 R1 R2 - 0x78060007, // 0003 JMPF R1 #000C - 0x88040101, // 0004 GETMBR R1 R0 K1 - 0x8C040302, // 0005 GETMET R1 R1 K2 - 0x880C0100, // 0006 GETMBR R3 R0 K0 - 0xB8120600, // 0007 GETNGBL R4 K3 - 0x88100904, // 0008 GETMBR R4 R4 K4 - 0x300C0604, // 0009 OR R3 R3 R4 - 0x7C040400, // 000A CALL R1 2 - 0x80040200, // 000B RET 1 R1 - 0x80000000, // 000C RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: get_value_ofs_y -********************************************************************/ -be_local_closure(lvh_obj_get_value_ofs_y, /* name */ - be_nested_proto( - 3, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 2]) { /* constants */ - /* K0 */ be_nested_str_weak(_lv_label), - /* K1 */ be_nested_str_weak(get_y), - }), - be_str_weak(get_value_ofs_y), - &be_const_str_solidified, - ( &(const binstruction[ 4]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x8C040301, // 0001 GETMET R1 R1 K1 - 0x7C040200, // 0002 CALL R1 1 - 0x80040200, // 0003 RET 1 R1 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: set_val -********************************************************************/ -be_local_closure(lvh_obj_set_val, /* name */ - be_nested_proto( - 5, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 2]) { /* constants */ - /* K0 */ be_nested_str_weak(_lv_obj), - /* K1 */ be_nested_str_weak(set_value), - }), - be_str_weak(set_val), - &be_const_str_solidified, - ( &(const binstruction[ 5]) { /* code */ + ( &(const binstruction[15]) { /* code */ 0x88080100, // 0000 GETMBR R2 R0 K0 - 0x8C080501, // 0001 GETMET R2 R2 K1 - 0x5C100200, // 0002 MOVE R4 R1 - 0x7C080400, // 0003 CALL R2 2 - 0x80000000, // 0004 RET 0 + 0x4C0C0000, // 0001 LDNIL R3 + 0x20080403, // 0002 NE R2 R2 R3 + 0x780A0009, // 0003 JMPF R2 #000E + 0x88080101, // 0004 GETMBR R2 R0 K1 + 0x8C080502, // 0005 GETMET R2 R2 K2 + 0x60100009, // 0006 GETGBL R4 G9 + 0x5C140200, // 0007 MOVE R5 R1 + 0x7C100200, // 0008 CALL R4 1 + 0x88140100, // 0009 GETMBR R5 R0 K0 + 0xB81A0600, // 000A GETNGBL R6 K3 + 0x88180D04, // 000B GETMBR R6 R6 K4 + 0x30140A06, // 000C OR R5 R5 R6 + 0x7C080600, // 000D CALL R2 3 + 0x80000000, // 000E RET 0 }) ) ); @@ -3719,74 +3790,9 @@ be_local_closure(lvh_obj_set_val, /* name */ /******************************************************************** -** Solidified function: set_toggle +** Solidified function: get_adjustable ********************************************************************/ -be_local_closure(lvh_obj_set_toggle, /* name */ - be_nested_proto( - 7, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 9]) { /* constants */ - /* K0 */ be_nested_str_weak(string), - /* K1 */ be_nested_str_weak(toupper), - /* K2 */ be_nested_str_weak(TRUE), - /* K3 */ be_nested_str_weak(FALSE), - /* K4 */ be_nested_str_weak(_lv_obj), - /* K5 */ be_nested_str_weak(add_state), - /* K6 */ be_nested_str_weak(lv), - /* K7 */ be_nested_str_weak(STATE_CHECKED), - /* K8 */ be_nested_str_weak(clear_state), - }), - be_str_weak(set_toggle), - &be_const_str_solidified, - ( &(const binstruction[32]) { /* code */ - 0x60080004, // 0000 GETGBL R2 G4 - 0x5C0C0200, // 0001 MOVE R3 R1 - 0x7C080200, // 0002 CALL R2 1 - 0x1C080500, // 0003 EQ R2 R2 K0 - 0x780A000D, // 0004 JMPF R2 #0013 - 0xA40A0000, // 0005 IMPORT R2 K0 - 0x8C0C0501, // 0006 GETMET R3 R2 K1 - 0x60140008, // 0007 GETGBL R5 G8 - 0x5C180200, // 0008 MOVE R6 R1 - 0x7C140200, // 0009 CALL R5 1 - 0x7C0C0400, // 000A CALL R3 2 - 0x5C040600, // 000B MOVE R1 R3 - 0x1C0C0302, // 000C EQ R3 R1 K2 - 0x780E0001, // 000D JMPF R3 #0010 - 0x50040200, // 000E LDBOOL R1 1 0 - 0x70020002, // 000F JMP #0013 - 0x1C0C0303, // 0010 EQ R3 R1 K3 - 0x780E0000, // 0011 JMPF R3 #0013 - 0x50040000, // 0012 LDBOOL R1 0 0 - 0x78060005, // 0013 JMPF R1 #001A - 0x88080104, // 0014 GETMBR R2 R0 K4 - 0x8C080505, // 0015 GETMET R2 R2 K5 - 0xB8120C00, // 0016 GETNGBL R4 K6 - 0x88100907, // 0017 GETMBR R4 R4 K7 - 0x7C080400, // 0018 CALL R2 2 - 0x70020004, // 0019 JMP #001F - 0x88080104, // 001A GETMBR R2 R0 K4 - 0x8C080508, // 001B GETMET R2 R2 K8 - 0xB8120C00, // 001C GETNGBL R4 K6 - 0x88100907, // 001D GETMBR R4 R4 K7 - 0x7C080400, // 001E CALL R2 2 - 0x80000000, // 001F RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: get_line_width -********************************************************************/ -be_local_closure(lvh_obj_get_line_width, /* name */ +be_local_closure(lvh_obj_get_adjustable, /* name */ be_nested_proto( 4, /* nstack */ 1, /* argc */ @@ -3796,55 +3802,21 @@ be_local_closure(lvh_obj_get_line_width, /* name */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[ 3]) { /* constants */ + ( &(const bvalue[ 4]) { /* constants */ /* K0 */ be_nested_str_weak(_lv_obj), - /* K1 */ be_nested_str_weak(get_style_line_width), - /* K2 */ be_const_int(0), + /* K1 */ be_nested_str_weak(has_flag), + /* K2 */ be_nested_str_weak(lv), + /* K3 */ be_nested_str_weak(OBJ_FLAG_CLICKABLE), }), - be_str_weak(get_line_width), + be_str_weak(get_adjustable), &be_const_str_solidified, - ( &(const binstruction[ 5]) { /* code */ + ( &(const binstruction[ 6]) { /* code */ 0x88040100, // 0000 GETMBR R1 R0 K0 0x8C040301, // 0001 GETMET R1 R1 K1 - 0x580C0002, // 0002 LDCONST R3 K2 - 0x7C040400, // 0003 CALL R1 2 - 0x80040200, // 0004 RET 1 R1 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: set_text -********************************************************************/ -be_local_closure(lvh_obj_set_text, /* name */ - be_nested_proto( - 6, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 3]) { /* constants */ - /* K0 */ be_nested_str_weak(check_label), - /* K1 */ be_nested_str_weak(_lv_label), - /* K2 */ be_nested_str_weak(set_text), - }), - be_str_weak(set_text), - &be_const_str_solidified, - ( &(const binstruction[ 9]) { /* code */ - 0x8C080100, // 0000 GETMET R2 R0 K0 - 0x7C080200, // 0001 CALL R2 1 - 0x88080101, // 0002 GETMBR R2 R0 K1 - 0x8C080502, // 0003 GETMET R2 R2 K2 - 0x60100008, // 0004 GETGBL R4 G8 - 0x5C140200, // 0005 MOVE R5 R1 - 0x7C100200, // 0006 CALL R4 1 - 0x7C080400, // 0007 CALL R2 2 - 0x80000000, // 0008 RET 0 + 0xB80E0400, // 0002 GETNGBL R3 K2 + 0x880C0703, // 0003 GETMBR R3 R3 K3 + 0x7C040400, // 0004 CALL R1 2 + 0x80040200, // 0005 RET 1 R1 }) ) ); @@ -3936,23 +3908,205 @@ be_local_closure(lvh_obj_set_mode, /* name */ /*******************************************************************/ +/******************************************************************** +** Solidified function: get_val_rule_formula +********************************************************************/ +be_local_closure(lvh_obj_get_val_rule_formula, /* name */ + be_nested_proto( + 2, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str_weak(_val_rule_formula), + }), + be_str_weak(get_val_rule_formula), + &be_const_str_solidified, + ( &(const binstruction[ 2]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x80040200, // 0001 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: remove_trailing_zeroes +********************************************************************/ +be_local_closure(lvh_obj_remove_trailing_zeroes, /* name */ + be_nested_proto( + 8, /* nstack */ + 1, /* argc */ + 4, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 4]) { /* constants */ + /* K0 */ be_const_class(be_class_lvh_obj), + /* K1 */ be_const_int(0), + /* K2 */ be_const_int(1), + /* K3 */ be_nested_str_weak(resize), + }), + be_str_weak(remove_trailing_zeroes), + &be_const_str_solidified, + ( &(const binstruction[24]) { /* code */ + 0x58040000, // 0000 LDCONST R1 K0 + 0x6008000C, // 0001 GETGBL R2 G12 + 0x5C0C0000, // 0002 MOVE R3 R0 + 0x7C080200, // 0003 CALL R2 1 + 0x580C0001, // 0004 LDCONST R3 K1 + 0x14100602, // 0005 LT R4 R3 R2 + 0x78120007, // 0006 JMPF R4 #000F + 0x5411FFFE, // 0007 LDINT R4 -1 + 0x04100803, // 0008 SUB R4 R4 R3 + 0x94100004, // 0009 GETIDX R4 R0 R4 + 0x20100901, // 000A NE R4 R4 K1 + 0x78120000, // 000B JMPF R4 #000D + 0x70020001, // 000C JMP #000F + 0x000C0702, // 000D ADD R3 R3 K2 + 0x7001FFF5, // 000E JMP #0005 + 0x24100701, // 000F GT R4 R3 K1 + 0x78120005, // 0010 JMPF R4 #0017 + 0x8C100103, // 0011 GETMET R4 R0 K3 + 0x6018000C, // 0012 GETGBL R6 G12 + 0x5C1C0000, // 0013 MOVE R7 R0 + 0x7C180200, // 0014 CALL R6 1 + 0x04180C03, // 0015 SUB R6 R6 R3 + 0x7C100400, // 0016 CALL R4 2 + 0x80040000, // 0017 RET 1 R0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: post_init +********************************************************************/ +be_local_closure(lvh_obj_post_init, /* name */ + be_nested_proto( + 3, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str_weak(register_event_cb), + }), + be_str_weak(post_init), + &be_const_str_solidified, + ( &(const binstruction[ 3]) { /* code */ + 0x8C040100, // 0000 GETMET R1 R0 K0 + 0x7C040200, // 0001 CALL R1 1 + 0x80000000, // 0002 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: val_rule_matched +********************************************************************/ +be_local_closure(lvh_obj_val_rule_matched, /* name */ + be_nested_proto( + 11, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 3]) { /* constants */ + /* K0 */ be_nested_str_weak(_val_rule_function), + /* K1 */ be_nested_str_weak(HSP_X3A_X20failed_X20to_X20run_X20self_X2E_val_rule_function_X20_X2D_X20_X25s_X20_X28_X25s_X29), + /* K2 */ be_nested_str_weak(val), + }), + be_str_weak(val_rule_matched), + &be_const_str_solidified, + ( &(const binstruction[36]) { /* code */ + 0x6008000A, // 0000 GETGBL R2 G10 + 0x5C0C0200, // 0001 MOVE R3 R1 + 0x7C080200, // 0002 CALL R2 1 + 0x4C0C0000, // 0003 LDNIL R3 + 0x1C0C0403, // 0004 EQ R3 R2 R3 + 0x780E0001, // 0005 JMPF R3 #0008 + 0x500C0000, // 0006 LDBOOL R3 0 0 + 0x80040600, // 0007 RET 1 R3 + 0x880C0100, // 0008 GETMBR R3 R0 K0 + 0x4C100000, // 0009 LDNIL R4 + 0x20100604, // 000A NE R4 R3 R4 + 0x78120011, // 000B JMPF R4 #001E + 0xA8020005, // 000C EXBLK 0 #0013 + 0x5C100600, // 000D MOVE R4 R3 + 0x5C140400, // 000E MOVE R5 R2 + 0x7C100200, // 000F CALL R4 1 + 0x5C080800, // 0010 MOVE R2 R4 + 0xA8040001, // 0011 EXBLK 1 1 + 0x7002000A, // 0012 JMP #001E + 0xAC100002, // 0013 CATCH R4 0 2 + 0x70020007, // 0014 JMP #001D + 0x60180001, // 0015 GETGBL R6 G1 + 0x601C0018, // 0016 GETGBL R7 G24 + 0x58200001, // 0017 LDCONST R8 K1 + 0x5C240800, // 0018 MOVE R9 R4 + 0x5C280A00, // 0019 MOVE R10 R5 + 0x7C1C0600, // 001A CALL R7 3 + 0x7C180200, // 001B CALL R6 1 + 0x70020000, // 001C JMP #001E + 0xB0080000, // 001D RAISE 2 R0 R0 + 0x60100009, // 001E GETGBL R4 G9 + 0x5C140400, // 001F MOVE R5 R2 + 0x7C100200, // 0020 CALL R4 1 + 0x90020404, // 0021 SETMBR R0 K2 R4 + 0x50100000, // 0022 LDBOOL R4 0 0 + 0x80040800, // 0023 RET 1 R4 + }) + ) +); +/*******************************************************************/ + + /******************************************************************** ** Solidified class: lvh_obj ********************************************************************/ be_local_class(lvh_obj, 13, NULL, - be_nested_map(91, + be_nested_map(94, ( (struct bmapnode*) &(const bmapnode[]) { - { be_const_key_weak(parse_color, 3), be_const_static_closure(lvh_obj_parse_color_closure) }, - { be_const_key_weak(set_mode, 8), be_const_closure(lvh_obj_set_mode_closure) }, - { be_const_key_weak(set_pad_top2, -1), be_const_closure(lvh_obj_set_pad_top2_closure) }, - { be_const_key_weak(set_pad_left2, -1), be_const_closure(lvh_obj_set_pad_left2_closure) }, - { be_const_key_weak(get_obj, -1), be_const_closure(lvh_obj_get_obj_closure) }, - { be_const_key_weak(get_line_width, 84), be_const_closure(lvh_obj_get_line_width_closure) }, - { be_const_key_weak(get_align, -1), be_const_closure(lvh_obj_get_align_closure) }, - { be_const_key_weak(_text_rule, -1), be_const_var(9) }, - { be_const_key_weak(_attr_ignore, 42), be_const_simple_instance(be_nested_simple_instance(&be_class_list, { + { be_const_key_weak(val_rule_matched, 9), be_const_closure(lvh_obj_val_rule_matched_closure) }, + { be_const_key_weak(post_init, 18), be_const_closure(lvh_obj_post_init_closure) }, + { be_const_key_weak(set_val_rule, -1), be_const_closure(lvh_obj_set_val_rule_closure) }, + { be_const_key_weak(remove_trailing_zeroes, -1), be_const_static_closure(lvh_obj_remove_trailing_zeroes_closure) }, + { be_const_key_weak(_action, -1), be_const_var(4) }, + { be_const_key_weak(id, -1), be_const_var(0) }, + { be_const_key_weak(get_val_rule_formula, -1), be_const_closure(lvh_obj_get_val_rule_formula_closure) }, + { be_const_key_weak(set_mode, 80), be_const_closure(lvh_obj_set_mode_closure) }, + { be_const_key_weak(get_adjustable, -1), be_const_closure(lvh_obj_get_adjustable_closure) }, + { be_const_key_weak(set_radius2, -1), be_const_closure(lvh_obj_set_radius2_closure) }, + { be_const_key_weak(set_text_font, -1), be_const_closure(lvh_obj_set_text_font_closure) }, + { be_const_key_weak(set_pad_all2, -1), be_const_closure(lvh_obj_set_pad_all2_closure) }, + { be_const_key_weak(text_rule_matched, -1), be_const_closure(lvh_obj_text_rule_matched_closure) }, + { be_const_key_weak(set_value_ofs_x, -1), be_const_closure(lvh_obj_set_value_ofs_x_closure) }, + { be_const_key_weak(_text_rule, 45), be_const_var(9) }, + { be_const_key_weak(_page, -1), be_const_var(3) }, + { be_const_key_weak(get_val_rule, 73), be_const_closure(lvh_obj_get_val_rule_closure) }, + { be_const_key_weak(get_text_color, -1), be_const_closure(lvh_obj_get_text_color_closure) }, + { be_const_key_weak(set_text_rule, -1), be_const_closure(lvh_obj_set_text_rule_closure) }, + { be_const_key_weak(get_enabled, -1), be_const_closure(lvh_obj_get_enabled_closure) }, + { be_const_key_weak(_attr_ignore, -1), be_const_simple_instance(be_nested_simple_instance(&be_class_list, { be_const_list( * be_nested_list(10, ( (struct bvalue*) &(const bvalue[]) { be_nested_str_weak(tostring), @@ -3966,45 +4120,26 @@ be_local_class(lvh_obj, be_nested_str_weak(back), be_nested_str_weak(berry_run), })) ) } )) }, - { be_const_key_weak(get_value_font, -1), be_const_closure(lvh_obj_get_value_font_closure) }, - { be_const_key_weak(id, 64), be_const_var(0) }, - { be_const_key_weak(_val_rule, 65), be_const_var(6) }, - { be_const_key_weak(_val_rule_function, -1), be_const_var(8) }, - { be_const_key_weak(get_pad_bottom, -1), be_const_closure(lvh_obj_get_pad_bottom_closure) }, - { be_const_key_weak(val_rule_matched, -1), be_const_closure(lvh_obj_val_rule_matched_closure) }, - { be_const_key_weak(get_enabled, 86), be_const_closure(lvh_obj_get_enabled_closure) }, - { be_const_key_weak(set_meta, 35), be_const_closure(lvh_obj_set_meta_closure) }, - { be_const_key_weak(get_val_rule, 52), be_const_closure(lvh_obj_get_val_rule_closure) }, - { be_const_key_weak(_page, 47), be_const_var(3) }, { be_const_key_weak(init, -1), be_const_closure(lvh_obj_init_closure) }, - { be_const_key_weak(set_toggle, 36), be_const_closure(lvh_obj_set_toggle_closure) }, - { be_const_key_weak(_text_rule_function, -1), be_const_var(11) }, - { be_const_key_weak(check_label, 49), be_const_closure(lvh_obj_check_label_closure) }, - { be_const_key_weak(get_meta, -1), be_const_closure(lvh_obj_get_meta_closure) }, - { be_const_key_weak(set_val_rule, 59), be_const_closure(lvh_obj_set_val_rule_closure) }, - { be_const_key_weak(set_enabled, -1), be_const_closure(lvh_obj_set_enabled_closure) }, - { be_const_key_weak(get_action, -1), be_const_closure(lvh_obj_get_action_closure) }, - { be_const_key_weak(get_radius2, 18), be_const_closure(lvh_obj_get_radius2_closure) }, - { be_const_key_weak(_lv_obj, -1), be_const_var(1) }, - { be_const_key_weak(get_text_rule_formula, -1), be_const_closure(lvh_obj_get_text_rule_formula_closure) }, - { be_const_key_weak(get_value_ofs_x, -1), be_const_closure(lvh_obj_get_value_ofs_x_closure) }, - { be_const_key_weak(get_value_color, -1), be_const_closure(lvh_obj_get_value_color_closure) }, - { be_const_key_weak(set_pad_bottom2, -1), be_const_closure(lvh_obj_set_pad_bottom2_closure) }, - { be_const_key_weak(get_text_color, -1), be_const_closure(lvh_obj_get_text_color_closure) }, - { be_const_key_weak(get_value_ofs_y, 71), be_const_closure(lvh_obj_get_value_ofs_y_closure) }, + { be_const_key_weak(_text_rule_format, -1), be_const_var(12) }, + { be_const_key_weak(get_text, -1), be_const_closure(lvh_obj_get_text_closure) }, { be_const_key_weak(get_text_font, -1), be_const_closure(lvh_obj_get_text_font_closure) }, - { be_const_key_weak(get_mode, -1), be_const_closure(lvh_obj_get_mode_closure) }, - { be_const_key_weak(_text_rule_formula, 5), be_const_var(10) }, - { be_const_key_weak(set_text_rule_formula, -1), be_const_closure(lvh_obj_set_text_rule_formula_closure) }, - { be_const_key_weak(get_pad_top, -1), be_const_closure(lvh_obj_get_pad_top_closure) }, - { be_const_key_weak(set_adjustable, -1), be_const_closure(lvh_obj_set_adjustable_closure) }, - { be_const_key_weak(set_value_color, -1), be_const_closure(lvh_obj_set_value_color_closure) }, - { be_const_key_weak(get_val, 67), be_const_closure(lvh_obj_get_val_closure) }, - { be_const_key_weak(set_pad_all2, -1), be_const_closure(lvh_obj_set_pad_all2_closure) }, - { be_const_key_weak(_lv_label, 29), be_const_var(2) }, - { be_const_key_weak(_lv_class, -1), be_const_class(be_class_lv_obj) }, - { be_const_key_weak(setmember, 88), be_const_closure(lvh_obj_setmember_closure) }, - { be_const_key_weak(_attr_map, -1), be_const_simple_instance(be_nested_simple_instance(&be_class_map, { + { be_const_key_weak(_lv_class, 87), be_const_class(be_class_lv_obj) }, + { be_const_key_weak(get_value_str, -1), be_const_closure(lvh_obj_get_value_str_closure) }, + { be_const_key_weak(set_align, 42), be_const_closure(lvh_obj_set_align_closure) }, + { be_const_key_weak(set_val_rule_formula, -1), be_const_closure(lvh_obj_set_val_rule_formula_closure) }, + { be_const_key_weak(_text_rule_function, 30), be_const_var(11) }, + { be_const_key_weak(set_enabled, 79), be_const_closure(lvh_obj_set_enabled_closure) }, + { be_const_key_weak(set_value_font, -1), be_const_closure(lvh_obj_set_value_font_closure) }, + { be_const_key_weak(set_toggle, -1), be_const_closure(lvh_obj_set_toggle_closure) }, + { be_const_key_weak(_val_rule_function, -1), be_const_var(8) }, + { be_const_key_weak(get_value_ofs_y, -1), be_const_closure(lvh_obj_get_value_ofs_y_closure) }, + { be_const_key_weak(_text_rule_formula, 88), be_const_var(10) }, + { be_const_key_weak(set_pad_left2, 93), be_const_closure(lvh_obj_set_pad_left2_closure) }, + { be_const_key_weak(digits_to_style, -1), be_const_closure(lvh_obj_digits_to_style_closure) }, + { be_const_key_weak(get_action, -1), be_const_closure(lvh_obj_get_action_closure) }, + { be_const_key_weak(get_obj, 84), be_const_closure(lvh_obj_get_obj_closure) }, + { be_const_key_weak(_attr_map, 50), be_const_simple_instance(be_nested_simple_instance(&be_class_map, { be_const_map( * be_nested_map(26, ( (struct bmapnode*) &(const bmapnode[]) { { be_const_key_weak(rotation, -1), be_nested_str_weak(rotation) }, @@ -4034,16 +4169,79 @@ be_local_class(lvh_obj, { be_const_key_weak(pad_top, 16), be_nested_str_weak(style_pad_top) }, { be_const_key_weak(bg_grad_dir, 14), be_nested_str_weak(style_bg_grad_dir) }, })) ) } )) }, - { be_const_key_weak(remove_trailing_zeroes, -1), be_const_static_closure(lvh_obj_remove_trailing_zeroes_closure) }, - { be_const_key_weak(_action, -1), be_const_var(4) }, - { be_const_key_weak(get_text, -1), be_const_closure(lvh_obj_get_text_closure) }, - { be_const_key_weak(_val_rule_formula, -1), be_const_var(7) }, + { be_const_key_weak(register_event_cb, 17), be_const_closure(lvh_obj_register_event_cb_closure) }, + { be_const_key_weak(set_pad_top2, 61), be_const_closure(lvh_obj_set_pad_top2_closure) }, + { be_const_key_weak(event_cb, 7), be_const_closure(lvh_obj_event_cb_closure) }, + { be_const_key_weak(check_label, -1), be_const_closure(lvh_obj_check_label_closure) }, + { be_const_key_weak(_lv_part2_selector, -1), be_const_nil() }, + { be_const_key_weak(_digit2part, -1), be_const_simple_instance(be_nested_simple_instance(&be_class_list, { + be_const_list( * be_nested_list(10, + ( (struct bvalue*) &(const bvalue[]) { + be_const_int(0), + be_const_int(131072), + be_const_int(196608), + be_const_int(327680), + be_const_int(327680), + be_const_int(262144), + be_const_int(393216), + be_const_int(458752), + be_const_int(65536), + be_const_int(524288), + })) ) } )) }, + { be_const_key_weak(get_val, 75), be_const_closure(lvh_obj_get_val_closure) }, { be_const_key_weak(get_pad_all, -1), be_const_closure(lvh_obj_get_pad_all_closure) }, - { be_const_key_weak(set_action, -1), be_const_closure(lvh_obj_set_action_closure) }, - { be_const_key_weak(set_hidden, 46), be_const_closure(lvh_obj_set_hidden_closure) }, - { be_const_key_weak(get_text_rule, 75), be_const_closure(lvh_obj_get_text_rule_closure) }, - { be_const_key_weak(get_adjustable, -1), be_const_closure(lvh_obj_get_adjustable_closure) }, - { be_const_key_weak(_event_map, -1), be_const_simple_instance(be_nested_simple_instance(&be_class_map, { + { be_const_key_weak(get_pad_bottom, 66), be_const_closure(lvh_obj_get_pad_bottom_closure) }, + { be_const_key_weak(get_toggle, -1), be_const_closure(lvh_obj_get_toggle_closure) }, + { be_const_key_weak(set_line_width, -1), be_const_closure(lvh_obj_set_line_width_closure) }, + { be_const_key_weak(get_text_rule_format, -1), be_const_closure(lvh_obj_get_text_rule_format_closure) }, + { be_const_key_weak(set_pad_bottom2, 74), be_const_closure(lvh_obj_set_pad_bottom2_closure) }, + { be_const_key_weak(set_action, 16), be_const_closure(lvh_obj_set_action_closure) }, + { be_const_key_weak(set_text_color, 47), be_const_closure(lvh_obj_set_text_color_closure) }, + { be_const_key_weak(get_pad_right, -1), be_const_closure(lvh_obj_get_pad_right_closure) }, + { be_const_key_weak(get_value_font, -1), be_const_closure(lvh_obj_get_value_font_closure) }, + { be_const_key_weak(get_text_rule, 40), be_const_closure(lvh_obj_get_text_rule_closure) }, + { be_const_key_weak(set_meta, 8), be_const_closure(lvh_obj_set_meta_closure) }, + { be_const_key_weak(set_text_rule_format, -1), be_const_closure(lvh_obj_set_text_rule_format_closure) }, + { be_const_key_weak(get_line_width, -1), be_const_closure(lvh_obj_get_line_width_closure) }, + { be_const_key_weak(_digit2state, -1), be_const_simple_instance(be_nested_simple_instance(&be_class_list, { + be_const_list( * be_nested_list(6, + ( (struct bvalue*) &(const bvalue[]) { + be_const_int(0), + be_const_int(1), + be_const_int(32), + be_const_int(33), + be_const_int(128), + be_const_int(160), + })) ) } )) }, + { be_const_key_weak(get_value_ofs_x, -1), be_const_closure(lvh_obj_get_value_ofs_x_closure) }, + { be_const_key_weak(is_color_attribute, -1), be_const_static_closure(lvh_obj_is_color_attribute_closure) }, + { be_const_key_weak(get_text_rule_formula, 26), be_const_closure(lvh_obj_get_text_rule_formula_closure) }, + { be_const_key_weak(set_value_color, -1), be_const_closure(lvh_obj_set_value_color_closure) }, + { be_const_key_weak(get_pad_top, -1), be_const_closure(lvh_obj_get_pad_top_closure) }, + { be_const_key_weak(get_hidden, -1), be_const_closure(lvh_obj_get_hidden_closure) }, + { be_const_key_weak(get_pad_left, -1), be_const_closure(lvh_obj_get_pad_left_closure) }, + { be_const_key_weak(get_radius2, -1), be_const_closure(lvh_obj_get_radius2_closure) }, + { be_const_key_weak(set_value_str, 48), be_const_closure(lvh_obj_set_value_str_closure) }, + { be_const_key_weak(set_click, -1), be_const_closure(lvh_obj_set_click_closure) }, + { be_const_key_weak(parse_color, 82), be_const_static_closure(lvh_obj_parse_color_closure) }, + { be_const_key_weak(set_text, 36), be_const_closure(lvh_obj_set_text_closure) }, + { be_const_key_weak(member, -1), be_const_closure(lvh_obj_member_closure) }, + { be_const_key_weak(set_pad_right2, 38), be_const_closure(lvh_obj_set_pad_right2_closure) }, + { be_const_key_weak(set_adjustable, -1), be_const_closure(lvh_obj_set_adjustable_closure) }, + { be_const_key_weak(set_value_ofs_y, -1), be_const_closure(lvh_obj_set_value_ofs_y_closure) }, + { be_const_key_weak(get_mode, 28), be_const_closure(lvh_obj_get_mode_closure) }, + { be_const_key_weak(setmember, -1), be_const_closure(lvh_obj_setmember_closure) }, + { be_const_key_weak(_val_rule_formula, 24), be_const_var(7) }, + { be_const_key_weak(get_click, -1), be_const_closure(lvh_obj_get_click_closure) }, + { be_const_key_weak(get_meta, -1), be_const_closure(lvh_obj_get_meta_closure) }, + { be_const_key_weak(get_value_color, -1), be_const_closure(lvh_obj_get_value_color_closure) }, + { be_const_key_weak(_meta, 10), be_const_var(5) }, + { be_const_key_weak(_val_rule, 0), be_const_var(6) }, + { be_const_key_weak(_lv_label, -1), be_const_var(2) }, + { be_const_key_weak(set_text_rule_formula, -1), be_const_closure(lvh_obj_set_text_rule_formula_closure) }, + { be_const_key_weak(set_val, 6), be_const_closure(lvh_obj_set_val_closure) }, + { be_const_key_weak(set_hidden, 5), be_const_closure(lvh_obj_set_hidden_closure) }, + { be_const_key_weak(_event_map, 3), be_const_simple_instance(be_nested_simple_instance(&be_class_map, { be_const_map( * be_nested_map(7, ( (struct bmapnode*) &(const bmapnode[]) { { be_const_key_int(28, 2), be_nested_str_weak(changed) }, @@ -4054,39 +4252,8 @@ be_local_class(lvh_obj, { be_const_key_int(5, -1), be_nested_str_weak(long) }, { be_const_key_int(6, -1), be_nested_str_weak(hold) }, })) ) } )) }, - { be_const_key_weak(set_radius2, 78), be_const_closure(lvh_obj_set_radius2_closure) }, - { be_const_key_weak(get_pad_left, -1), be_const_closure(lvh_obj_get_pad_left_closure) }, - { be_const_key_weak(get_value_str, 58), be_const_closure(lvh_obj_get_value_str_closure) }, - { be_const_key_weak(set_value_ofs_y, -1), be_const_closure(lvh_obj_set_value_ofs_y_closure) }, - { be_const_key_weak(_lv_part2_selector, -1), be_const_nil() }, - { be_const_key_weak(set_text_font, -1), be_const_closure(lvh_obj_set_text_font_closure) }, - { be_const_key_weak(set_value_ofs_x, 45), be_const_closure(lvh_obj_set_value_ofs_x_closure) }, - { be_const_key_weak(text_rule_matched, 79), be_const_closure(lvh_obj_text_rule_matched_closure) }, - { be_const_key_weak(set_line_width, -1), be_const_closure(lvh_obj_set_line_width_closure) }, - { be_const_key_weak(get_val_rule_formula, 69), be_const_closure(lvh_obj_get_val_rule_formula_closure) }, - { be_const_key_weak(set_val_rule_formula, -1), be_const_closure(lvh_obj_set_val_rule_formula_closure) }, - { be_const_key_weak(set_align, -1), be_const_closure(lvh_obj_set_align_closure) }, - { be_const_key_weak(set_text_rule_format, 62), be_const_closure(lvh_obj_set_text_rule_format_closure) }, - { be_const_key_weak(set_value_str, -1), be_const_closure(lvh_obj_set_value_str_closure) }, - { be_const_key_weak(_text_rule_format, -1), be_const_var(12) }, - { be_const_key_weak(post_init, -1), be_const_closure(lvh_obj_post_init_closure) }, - { be_const_key_weak(get_text_rule_format, -1), be_const_closure(lvh_obj_get_text_rule_format_closure) }, - { be_const_key_weak(set_text_rule, -1), be_const_closure(lvh_obj_set_text_rule_closure) }, - { be_const_key_weak(member, -1), be_const_closure(lvh_obj_member_closure) }, - { be_const_key_weak(is_color_attribute, -1), be_const_static_closure(lvh_obj_is_color_attribute_closure) }, - { be_const_key_weak(set_click, -1), be_const_closure(lvh_obj_set_click_closure) }, - { be_const_key_weak(get_hidden, -1), be_const_closure(lvh_obj_get_hidden_closure) }, - { be_const_key_weak(get_pad_right, -1), be_const_closure(lvh_obj_get_pad_right_closure) }, - { be_const_key_weak(event_cb, 34), be_const_closure(lvh_obj_event_cb_closure) }, - { be_const_key_weak(set_val, -1), be_const_closure(lvh_obj_set_val_closure) }, - { be_const_key_weak(set_text_color, 20), be_const_closure(lvh_obj_set_text_color_closure) }, - { be_const_key_weak(get_toggle, -1), be_const_closure(lvh_obj_get_toggle_closure) }, - { be_const_key_weak(register_event_cb, 11), be_const_closure(lvh_obj_register_event_cb_closure) }, - { be_const_key_weak(get_click, -1), be_const_closure(lvh_obj_get_click_closure) }, - { be_const_key_weak(set_value_font, 7), be_const_closure(lvh_obj_set_value_font_closure) }, - { be_const_key_weak(set_pad_right2, -1), be_const_closure(lvh_obj_set_pad_right2_closure) }, - { be_const_key_weak(set_text, -1), be_const_closure(lvh_obj_set_text_closure) }, - { be_const_key_weak(_meta, 1), be_const_var(5) }, + { be_const_key_weak(_lv_obj, 1), be_const_var(1) }, + { be_const_key_weak(get_align, -1), be_const_closure(lvh_obj_get_align_closure) }, })), be_str_weak(lvh_obj) ); @@ -4147,11 +4314,11 @@ void be_load_lvh_btn_class(bvm *vm) { extern const bclass be_class_lvh_switch; /******************************************************************** -** Solidified function: set_radius20 +** Solidified function: set_val ********************************************************************/ -be_local_closure(lvh_switch_set_radius20, /* name */ +be_local_closure(lvh_switch_set_val, /* name */ be_nested_proto( - 7, /* nstack */ + 5, /* nstack */ 2, /* argc */ 2, /* varg */ 0, /* has upvals */ @@ -4159,28 +4326,16 @@ be_local_closure(lvh_switch_set_radius20, /* name */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[ 5]) { /* constants */ - /* K0 */ be_nested_str_weak(_lv_obj), - /* K1 */ be_nested_str_weak(set_style_radius), - /* K2 */ be_nested_str_weak(lv), - /* K3 */ be_nested_str_weak(PART_KNOB), - /* K4 */ be_nested_str_weak(STATE_DEFAULT), + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str_weak(set_toggle), }), - be_str_weak(set_radius20), + be_str_weak(set_val), &be_const_str_solidified, - ( &(const binstruction[12]) { /* code */ - 0x88080100, // 0000 GETMBR R2 R0 K0 - 0x8C080501, // 0001 GETMET R2 R2 K1 - 0x60100009, // 0002 GETGBL R4 G9 - 0x5C140200, // 0003 MOVE R5 R1 - 0x7C100200, // 0004 CALL R4 1 - 0xB8160400, // 0005 GETNGBL R5 K2 - 0x88140B03, // 0006 GETMBR R5 R5 K3 - 0xB81A0400, // 0007 GETNGBL R6 K2 - 0x88180D04, // 0008 GETMBR R6 R6 K4 - 0x30140A06, // 0009 OR R5 R5 R6 - 0x7C080600, // 000A CALL R2 3 - 0x80000000, // 000B RET 0 + ( &(const binstruction[ 4]) { /* code */ + 0x8C080100, // 0000 GETMET R2 R0 K0 + 0x5C100200, // 0001 MOVE R4 R1 + 0x7C080400, // 0002 CALL R2 2 + 0x80040400, // 0003 RET 1 R2 }) ) ); @@ -4215,221 +4370,6 @@ be_local_closure(lvh_switch_get_val, /* name */ /*******************************************************************/ -/******************************************************************** -** Solidified function: get_bg_color10 -********************************************************************/ -be_local_closure(lvh_switch_get_bg_color10, /* name */ - be_nested_proto( - 4, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 4]) { /* constants */ - /* K0 */ be_nested_str_weak(_lv_obj), - /* K1 */ be_nested_str_weak(get_style_bg_color), - /* K2 */ be_nested_str_weak(lv), - /* K3 */ be_nested_str_weak(PART_INDICATOR), - }), - be_str_weak(get_bg_color10), - &be_const_str_solidified, - ( &(const binstruction[ 6]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x8C040301, // 0001 GETMET R1 R1 K1 - 0xB80E0400, // 0002 GETNGBL R3 K2 - 0x880C0703, // 0003 GETMBR R3 R3 K3 - 0x7C040400, // 0004 CALL R1 2 - 0x80040200, // 0005 RET 1 R1 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: set_bg_color20 -********************************************************************/ -be_local_closure(lvh_switch_set_bg_color20, /* name */ - be_nested_proto( - 7, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 6]) { /* constants */ - /* K0 */ be_nested_str_weak(_lv_obj), - /* K1 */ be_nested_str_weak(set_style_bg_color), - /* K2 */ be_nested_str_weak(parse_color), - /* K3 */ be_nested_str_weak(lv), - /* K4 */ be_nested_str_weak(PART_KNOB), - /* K5 */ be_nested_str_weak(STATE_DEFAULT), - }), - be_str_weak(set_bg_color20), - &be_const_str_solidified, - ( &(const binstruction[12]) { /* code */ - 0x88080100, // 0000 GETMBR R2 R0 K0 - 0x8C080501, // 0001 GETMET R2 R2 K1 - 0x8C100102, // 0002 GETMET R4 R0 K2 - 0x5C180200, // 0003 MOVE R6 R1 - 0x7C100400, // 0004 CALL R4 2 - 0xB8160600, // 0005 GETNGBL R5 K3 - 0x88140B04, // 0006 GETMBR R5 R5 K4 - 0xB81A0600, // 0007 GETNGBL R6 K3 - 0x88180D05, // 0008 GETMBR R6 R6 K5 - 0x30140A06, // 0009 OR R5 R5 R6 - 0x7C080600, // 000A CALL R2 3 - 0x80000000, // 000B RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: set_bg_color10 -********************************************************************/ -be_local_closure(lvh_switch_set_bg_color10, /* name */ - be_nested_proto( - 7, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 6]) { /* constants */ - /* K0 */ be_nested_str_weak(_lv_obj), - /* K1 */ be_nested_str_weak(set_style_bg_color), - /* K2 */ be_nested_str_weak(parse_color), - /* K3 */ be_nested_str_weak(lv), - /* K4 */ be_nested_str_weak(PART_INDICATOR), - /* K5 */ be_nested_str_weak(STATE_CHECKED), - }), - be_str_weak(set_bg_color10), - &be_const_str_solidified, - ( &(const binstruction[12]) { /* code */ - 0x88080100, // 0000 GETMBR R2 R0 K0 - 0x8C080501, // 0001 GETMET R2 R2 K1 - 0x8C100102, // 0002 GETMET R4 R0 K2 - 0x5C180200, // 0003 MOVE R6 R1 - 0x7C100400, // 0004 CALL R4 2 - 0xB8160600, // 0005 GETNGBL R5 K3 - 0x88140B04, // 0006 GETMBR R5 R5 K4 - 0xB81A0600, // 0007 GETNGBL R6 K3 - 0x88180D05, // 0008 GETMBR R6 R6 K5 - 0x30140A06, // 0009 OR R5 R5 R6 - 0x7C080600, // 000A CALL R2 3 - 0x80000000, // 000B RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: set_val -********************************************************************/ -be_local_closure(lvh_switch_set_val, /* name */ - be_nested_proto( - 5, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str_weak(set_toggle), - }), - be_str_weak(set_val), - &be_const_str_solidified, - ( &(const binstruction[ 4]) { /* code */ - 0x8C080100, // 0000 GETMET R2 R0 K0 - 0x5C100200, // 0001 MOVE R4 R1 - 0x7C080400, // 0002 CALL R2 2 - 0x80040400, // 0003 RET 1 R2 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: get_radius20 -********************************************************************/ -be_local_closure(lvh_switch_get_radius20, /* name */ - be_nested_proto( - 4, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 4]) { /* constants */ - /* K0 */ be_nested_str_weak(_lv_obj), - /* K1 */ be_nested_str_weak(get_style_radius), - /* K2 */ be_nested_str_weak(lv), - /* K3 */ be_nested_str_weak(PART_KNOB), - }), - be_str_weak(get_radius20), - &be_const_str_solidified, - ( &(const binstruction[ 6]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x8C040301, // 0001 GETMET R1 R1 K1 - 0xB80E0400, // 0002 GETNGBL R3 K2 - 0x880C0703, // 0003 GETMBR R3 R3 K3 - 0x7C040400, // 0004 CALL R1 2 - 0x80040200, // 0005 RET 1 R1 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: get_bg_color20 -********************************************************************/ -be_local_closure(lvh_switch_get_bg_color20, /* name */ - be_nested_proto( - 4, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 4]) { /* constants */ - /* K0 */ be_nested_str_weak(_lv_obj), - /* K1 */ be_nested_str_weak(get_style_bg_color), - /* K2 */ be_nested_str_weak(lv), - /* K3 */ be_nested_str_weak(PART_KNOB), - }), - be_str_weak(get_bg_color20), - &be_const_str_solidified, - ( &(const binstruction[ 6]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x8C040301, // 0001 GETMET R1 R1 K1 - 0xB80E0400, // 0002 GETNGBL R3 K2 - 0x880C0703, // 0003 GETMBR R3 R3 K3 - 0x7C040400, // 0004 CALL R1 2 - 0x80040200, // 0005 RET 1 R1 - }) - ) -); -/*******************************************************************/ - - /******************************************************************** ** Solidified class: lvh_switch ********************************************************************/ @@ -4437,18 +4377,12 @@ extern const bclass be_class_lvh_obj; be_local_class(lvh_switch, 0, &be_class_lvh_obj, - be_nested_map(10, + be_nested_map(4, ( (struct bmapnode*) &(const bmapnode[]) { - { be_const_key_weak(set_radius20, -1), be_const_closure(lvh_switch_set_radius20_closure) }, - { be_const_key_weak(get_val, -1), be_const_closure(lvh_switch_get_val_closure) }, - { be_const_key_weak(get_bg_color10, 9), be_const_closure(lvh_switch_get_bg_color10_closure) }, - { be_const_key_weak(set_bg_color20, 8), be_const_closure(lvh_switch_set_bg_color20_closure) }, - { be_const_key_weak(set_bg_color10, -1), be_const_closure(lvh_switch_set_bg_color10_closure) }, + { be_const_key_weak(get_val, 1), be_const_closure(lvh_switch_get_val_closure) }, { be_const_key_weak(set_val, -1), be_const_closure(lvh_switch_set_val_closure) }, - { be_const_key_weak(get_radius20, -1), be_const_closure(lvh_switch_get_radius20_closure) }, - { be_const_key_weak(_lv_class, -1), be_const_class(be_class_lv_switch) }, - { be_const_key_weak(get_bg_color20, -1), be_const_closure(lvh_switch_get_bg_color20_closure) }, { be_const_key_weak(_lv_part2_selector, -1), be_const_int(196608) }, + { be_const_key_weak(_lv_class, 0), be_const_class(be_class_lv_switch) }, })), be_str_weak(lvh_switch) ); @@ -5159,6 +5093,41 @@ void be_load_lvh_btnmatrix_class(bvm *vm) { extern const bclass be_class_lvh_bar; +/******************************************************************** +** Solidified function: set_val +********************************************************************/ +be_local_closure(lvh_bar_set_val, /* name */ + be_nested_proto( + 6, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 4]) { /* constants */ + /* K0 */ be_nested_str_weak(_lv_obj), + /* K1 */ be_nested_str_weak(set_value), + /* K2 */ be_nested_str_weak(lv), + /* K3 */ be_nested_str_weak(ANIM_OFF), + }), + be_str_weak(set_val), + &be_const_str_solidified, + ( &(const binstruction[ 7]) { /* code */ + 0x88080100, // 0000 GETMBR R2 R0 K0 + 0x8C080501, // 0001 GETMET R2 R2 K1 + 0x5C100200, // 0002 MOVE R4 R1 + 0xB8160400, // 0003 GETNGBL R5 K2 + 0x88140B03, // 0004 GETMBR R5 R5 K3 + 0x7C080600, // 0005 CALL R2 3 + 0x80000000, // 0006 RET 0 + }) + ) +); +/*******************************************************************/ + + /******************************************************************** ** Solidified class: lvh_bar ********************************************************************/ @@ -5166,9 +5135,10 @@ extern const bclass be_class_lvh_obj; be_local_class(lvh_bar, 0, &be_class_lvh_obj, - be_nested_map(1, + be_nested_map(2, ( (struct bmapnode*) &(const bmapnode[]) { - { be_const_key_weak(_lv_class, -1), be_const_class(be_class_lv_bar) }, + { be_const_key_weak(set_val, -1), be_const_closure(lvh_bar_set_val_closure) }, + { be_const_key_weak(_lv_class, 0), be_const_class(be_class_lv_bar) }, })), be_str_weak(lvh_bar) ); @@ -5345,27 +5315,26 @@ be_local_closure(lvh_arc_get_max, /* name */ ********************************************************************/ be_local_closure(lvh_arc_get_line_width, /* name */ be_nested_proto( - 4, /* nstack */ - 1, /* argc */ + 5, /* nstack */ + 2, /* argc */ 2, /* varg */ 0, /* has upvals */ NULL, /* no upvals */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[ 3]) { /* constants */ + ( &(const bvalue[ 2]) { /* constants */ /* K0 */ be_nested_str_weak(_lv_obj), /* K1 */ be_nested_str_weak(get_arc_line_width), - /* K2 */ be_const_int(0), }), be_str_weak(get_line_width), &be_const_str_solidified, ( &(const binstruction[ 5]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x8C040301, // 0001 GETMET R1 R1 K1 - 0x580C0002, // 0002 LDCONST R3 K2 - 0x7C040400, // 0003 CALL R1 2 - 0x80040200, // 0004 RET 1 R1 + 0x88080100, // 0000 GETMBR R2 R0 K0 + 0x8C080501, // 0001 GETMET R2 R2 K1 + 0x5C100200, // 0002 MOVE R4 R1 + 0x7C080400, // 0003 CALL R2 2 + 0x80040400, // 0004 RET 1 R2 }) ) ); @@ -5481,29 +5450,28 @@ be_local_closure(lvh_arc_get_line_width1, /* name */ ********************************************************************/ be_local_closure(lvh_arc_set_line_width, /* name */ be_nested_proto( - 6, /* nstack */ - 2, /* argc */ + 7, /* nstack */ + 3, /* argc */ 2, /* varg */ 0, /* has upvals */ NULL, /* no upvals */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[ 3]) { /* constants */ + ( &(const bvalue[ 2]) { /* constants */ /* K0 */ be_nested_str_weak(_lv_obj), /* K1 */ be_nested_str_weak(set_style_arc_width), - /* K2 */ be_const_int(0), }), be_str_weak(set_line_width), &be_const_str_solidified, ( &(const binstruction[ 8]) { /* code */ - 0x88080100, // 0000 GETMBR R2 R0 K0 - 0x8C080501, // 0001 GETMET R2 R2 K1 - 0x60100009, // 0002 GETGBL R4 G9 - 0x5C140200, // 0003 MOVE R5 R1 - 0x7C100200, // 0004 CALL R4 1 - 0x58140002, // 0005 LDCONST R5 K2 - 0x7C080600, // 0006 CALL R2 3 + 0x880C0100, // 0000 GETMBR R3 R0 K0 + 0x8C0C0701, // 0001 GETMET R3 R3 K1 + 0x60140009, // 0002 GETGBL R5 G9 + 0x5C180200, // 0003 MOVE R6 R1 + 0x7C140200, // 0004 CALL R5 1 + 0x5C180400, // 0005 MOVE R6 R2 + 0x7C0C0600, // 0006 CALL R3 3 0x80000000, // 0007 RET 0 }) ) @@ -6405,9 +6373,9 @@ be_local_closure(HASPmota_do_action, /* name */ 0x780E0000, // 0003 JMPF R3 #0005 0x80000600, // 0004 RET 0 0x880C0302, // 0005 GETMBR R3 R1 K2 - 0x88100104, // 0006 GETMBR R4 R0 K4 - 0x88140103, // 0007 GETMBR R5 R0 K3 - 0x94100A04, // 0008 GETIDX R4 R5 R4 + 0x88100103, // 0006 GETMBR R4 R0 K3 + 0x88140104, // 0007 GETMBR R5 R0 K4 + 0x94100805, // 0008 GETIDX R4 R4 R5 0x4C140000, // 0009 LDNIL R5 0x8C180105, // 000A GETMET R6 R0 K5 0x88200104, // 000B GETMBR R8 R0 K4 @@ -6579,9 +6547,9 @@ be_local_closure(HASPmota_get_page_cur, /* name */ be_str_weak(get_page_cur), &be_const_str_solidified, ( &(const binstruction[ 4]) { /* code */ - 0x88040101, // 0000 GETMBR R1 R0 K1 - 0x88080100, // 0001 GETMBR R2 R0 K0 - 0x94040401, // 0002 GETIDX R1 R2 R1 + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x88080101, // 0001 GETMBR R2 R0 K1 + 0x94040202, // 0002 GETIDX R1 R1 R2 0x80040200, // 0003 RET 1 R1 }) ) @@ -7138,9 +7106,9 @@ be_local_closure(HASPmota__load, /* name */ 0x7C240400, // 0027 CALL R9 2 0x8C24010F, // 0028 GETMET R9 R0 K15 0x5C2C1000, // 0029 MOVE R11 R8 - 0x88300102, // 002A GETMBR R12 R0 K2 - 0x88340105, // 002B GETMBR R13 R0 K5 - 0x94301A0C, // 002C GETIDX R12 R13 R12 + 0x88300105, // 002A GETMBR R12 R0 K5 + 0x88340102, // 002B GETMBR R13 R0 K2 + 0x9430180D, // 002C GETIDX R12 R12 R13 0x7C240600, // 002D CALL R9 3 0x4C200000, // 002E LDNIL R8 0x8C240F10, // 002F GETMET R9 R7 K16 @@ -7197,9 +7165,9 @@ be_local_closure(HASPmota_parse, /* name */ 0x7C100400, // 000B CALL R4 2 0x8C100104, // 000C GETMET R4 R0 K4 0x5C180600, // 000D MOVE R6 R3 - 0x881C0106, // 000E GETMBR R7 R0 K6 - 0x88200105, // 000F GETMBR R8 R0 K5 - 0x941C1007, // 0010 GETIDX R7 R8 R7 + 0x881C0105, // 000E GETMBR R7 R0 K5 + 0x88200106, // 000F GETMBR R8 R0 K6 + 0x941C0E08, // 0010 GETIDX R7 R7 R8 0x7C100600, // 0011 CALL R4 3 0x70020000, // 0012 JMP #0014 0xB0060F08, // 0013 RAISE 1 K7 K8 @@ -7273,7 +7241,7 @@ be_local_closure(HASPmota_sort, /* name */ ********************************************************************/ be_local_closure(HASPmota_parse_obj, /* name */ be_nested_proto( - 21, /* nstack */ + 20, /* nstack */ 3, /* argc */ 2, /* varg */ 0, /* has upvals */ @@ -7281,261 +7249,258 @@ be_local_closure(HASPmota_parse_obj, /* name */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[32]) { /* constants */ + ( &(const bvalue[30]) { /* constants */ /* K0 */ be_nested_str_weak(global), - /* K1 */ be_nested_str_weak(string), - /* K2 */ be_nested_str_weak(introspect), - /* K3 */ be_nested_str_weak(find), - /* K4 */ be_nested_str_weak(id), - /* K5 */ be_nested_str_weak(obj), - /* K6 */ be_nested_str_weak(get_page_cur), - /* K7 */ be_nested_str_weak(berry_run), - /* K8 */ be_nested_str_weak(nil), - /* K9 */ be_nested_str_weak(format), - /* K10 */ be_nested_str_weak(HSP_X3A_X20unable_X20to_X20compile_X20berry_X20code_X20_X22_X25s_X22_X20_X2D_X20_X27_X25s_X27_X20_X2D_X20_X25s), - /* K11 */ be_const_int(1), - /* K12 */ be_nested_str_weak(HSP_X3A_X20invalid_X20_X27id_X27_X3A_X20), - /* K13 */ be_nested_str_weak(_X20for_X20_X27obj_X27_X3A), - /* K14 */ be_nested_str_weak(parentid), - /* K15 */ be_nested_str_weak(get_obj), - /* K16 */ be_nested_str_weak(_lv_obj), - /* K17 */ be_nested_str_weak(get_scr), - /* K18 */ be_nested_str_weak(get), - /* K19 */ be_nested_str_weak(lvh_), - /* K20 */ be_nested_str_weak(class), - /* K21 */ be_nested_str_weak(lvh_obj), - /* K22 */ be_nested_str_weak(module), - /* K23 */ be_nested_str_weak(HSP_X3A_X20cannot_X20find_X20object_X20of_X20type_X20), - /* K24 */ be_nested_str_weak(set_obj), - /* K25 */ be_nested_str_weak(p_X25ib_X25i), - /* K26 */ be_nested_str_weak(function), - /* K27 */ be_nested_str_weak(HSP_X3A_X20unable_X20to_X20run_X20berry_X20code_X20_X22_X25s_X22_X20_X2D_X20_X27_X25s_X27_X20_X2D_X20_X25s), - /* K28 */ be_const_int(0), - /* K29 */ be_nested_str_weak(HSP_X3A_X20cannot_X20specify_X20_X27obj_X27_X20for_X20_X27id_X27_X3A0), - /* K30 */ be_nested_str_weak(keys), - /* K31 */ be_nested_str_weak(stop_iteration), + /* K1 */ be_nested_str_weak(introspect), + /* K2 */ be_nested_str_weak(find), + /* K3 */ be_nested_str_weak(id), + /* K4 */ be_nested_str_weak(obj), + /* K5 */ be_nested_str_weak(get_page_cur), + /* K6 */ be_nested_str_weak(berry_run), + /* K7 */ be_nested_str_weak(nil), + /* K8 */ be_nested_str_weak(HSP_X3A_X20unable_X20to_X20compile_X20berry_X20code_X20_X22_X25s_X22_X20_X2D_X20_X27_X25s_X27_X20_X2D_X20_X25s), + /* K9 */ be_const_int(1), + /* K10 */ be_nested_str_weak(HSP_X3A_X20invalid_X20_X27id_X27_X3A_X20), + /* K11 */ be_nested_str_weak(_X20for_X20_X27obj_X27_X3A), + /* K12 */ be_nested_str_weak(parentid), + /* K13 */ be_nested_str_weak(get_obj), + /* K14 */ be_nested_str_weak(_lv_obj), + /* K15 */ be_nested_str_weak(get_scr), + /* K16 */ be_nested_str_weak(get), + /* K17 */ be_nested_str_weak(lvh_), + /* K18 */ be_nested_str_weak(class), + /* K19 */ be_nested_str_weak(lvh_obj), + /* K20 */ be_nested_str_weak(module), + /* K21 */ be_nested_str_weak(HSP_X3A_X20cannot_X20find_X20object_X20of_X20type_X20), + /* K22 */ be_nested_str_weak(set_obj), + /* K23 */ be_nested_str_weak(p_X25ib_X25i), + /* K24 */ be_nested_str_weak(function), + /* K25 */ be_nested_str_weak(HSP_X3A_X20unable_X20to_X20run_X20berry_X20code_X20_X22_X25s_X22_X20_X2D_X20_X27_X25s_X27_X20_X2D_X20_X25s), + /* K26 */ be_const_int(0), + /* K27 */ be_nested_str_weak(HSP_X3A_X20cannot_X20specify_X20_X27obj_X27_X20for_X20_X27id_X27_X3A0), + /* K28 */ be_nested_str_weak(keys), + /* K29 */ be_nested_str_weak(stop_iteration), }), be_str_weak(parse_obj), &be_const_str_solidified, - ( &(const binstruction[218]) { /* code */ + ( &(const binstruction[217]) { /* code */ 0xA40E0000, // 0000 IMPORT R3 K0 0xA4120200, // 0001 IMPORT R4 K1 - 0xA4160400, // 0002 IMPORT R5 K2 - 0x60180009, // 0003 GETGBL R6 G9 - 0x8C1C0303, // 0004 GETMET R7 R1 K3 - 0x58240004, // 0005 LDCONST R9 K4 - 0x7C1C0400, // 0006 CALL R7 2 - 0x7C180200, // 0007 CALL R6 1 - 0x601C0008, // 0008 GETGBL R7 G8 - 0x8C200303, // 0009 GETMET R8 R1 K3 - 0x58280005, // 000A LDCONST R10 K5 - 0x7C200400, // 000B CALL R8 2 - 0x7C1C0200, // 000C CALL R7 1 - 0x4C200000, // 000D LDNIL R8 - 0x8C240106, // 000E GETMET R9 R0 K6 - 0x7C240200, // 000F CALL R9 1 - 0x60280008, // 0010 GETGBL R10 G8 - 0x8C2C0303, // 0011 GETMET R11 R1 K3 - 0x58340007, // 0012 LDCONST R13 K7 - 0x7C2C0400, // 0013 CALL R11 2 - 0x7C280200, // 0014 CALL R10 1 - 0x4C2C0000, // 0015 LDNIL R11 - 0x20301508, // 0016 NE R12 R10 K8 - 0x78320012, // 0017 JMPF R12 #002B - 0xA8020005, // 0018 EXBLK 0 #001F - 0x6030000D, // 0019 GETGBL R12 G13 - 0x5C341400, // 001A MOVE R13 R10 - 0x7C300200, // 001B CALL R12 1 - 0x5C2C1800, // 001C MOVE R11 R12 - 0xA8040001, // 001D EXBLK 1 1 - 0x7002000B, // 001E JMP #002B - 0xAC300002, // 001F CATCH R12 0 2 - 0x70020008, // 0020 JMP #002A - 0x60380001, // 0021 GETGBL R14 G1 - 0x8C3C0909, // 0022 GETMET R15 R4 K9 - 0x5844000A, // 0023 LDCONST R17 K10 - 0x5C481400, // 0024 MOVE R18 R10 - 0x5C4C1800, // 0025 MOVE R19 R12 - 0x5C501A00, // 0026 MOVE R20 R13 - 0x7C3C0A00, // 0027 CALL R15 5 - 0x7C380200, // 0028 CALL R14 1 - 0x70020000, // 0029 JMP #002B - 0xB0080000, // 002A RAISE 2 R0 R0 - 0x4C300000, // 002B LDNIL R12 - 0x1C300C0C, // 002C EQ R12 R6 R12 - 0x78320000, // 002D JMPF R12 #002F - 0x80001800, // 002E RET 0 - 0x20300F08, // 002F NE R12 R7 K8 - 0x7832006E, // 0030 JMPF R12 #00A0 - 0x4C300000, // 0031 LDNIL R12 - 0x20300C0C, // 0032 NE R12 R6 R12 - 0x7832006B, // 0033 JMPF R12 #00A0 - 0x14300D0B, // 0034 LT R12 R6 K11 - 0x74320002, // 0035 JMPT R12 #0039 - 0x543200FD, // 0036 LDINT R12 254 - 0x24300C0C, // 0037 GT R12 R6 R12 - 0x78320008, // 0038 JMPF R12 #0042 - 0x60300001, // 0039 GETGBL R12 G1 - 0x60340008, // 003A GETGBL R13 G8 - 0x5C380C00, // 003B MOVE R14 R6 - 0x7C340200, // 003C CALL R13 1 - 0x0036180D, // 003D ADD R13 K12 R13 - 0x00341B0D, // 003E ADD R13 R13 K13 - 0x00341A07, // 003F ADD R13 R13 R7 - 0x7C300200, // 0040 CALL R12 1 - 0x80001800, // 0041 RET 0 - 0x4C300000, // 0042 LDNIL R12 - 0x60340009, // 0043 GETGBL R13 G9 - 0x8C380303, // 0044 GETMET R14 R1 K3 - 0x5840000E, // 0045 LDCONST R16 K14 - 0x7C380400, // 0046 CALL R14 2 - 0x7C340200, // 0047 CALL R13 1 - 0x4C380000, // 0048 LDNIL R14 - 0x20381A0E, // 0049 NE R14 R13 R14 - 0x783A0006, // 004A JMPF R14 #0052 - 0x8C38130F, // 004B GETMET R14 R9 K15 - 0x5C401A00, // 004C MOVE R16 R13 - 0x7C380400, // 004D CALL R14 2 - 0x4C3C0000, // 004E LDNIL R15 - 0x203C1C0F, // 004F NE R15 R14 R15 - 0x783E0000, // 0050 JMPF R15 #0052 - 0x88301D10, // 0051 GETMBR R12 R14 K16 - 0x4C380000, // 0052 LDNIL R14 - 0x1C38180E, // 0053 EQ R14 R12 R14 - 0x783A0002, // 0054 JMPF R14 #0058 - 0x8C381311, // 0055 GETMET R14 R9 K17 - 0x7C380200, // 0056 CALL R14 1 - 0x5C301C00, // 0057 MOVE R12 R14 - 0x8C380B12, // 0058 GETMET R14 R5 K18 - 0x5C400000, // 0059 MOVE R16 R0 - 0x00462607, // 005A ADD R17 K19 R7 - 0x7C380600, // 005B CALL R14 3 + 0x60140009, // 0002 GETGBL R5 G9 + 0x8C180302, // 0003 GETMET R6 R1 K2 + 0x58200003, // 0004 LDCONST R8 K3 + 0x7C180400, // 0005 CALL R6 2 + 0x7C140200, // 0006 CALL R5 1 + 0x60180008, // 0007 GETGBL R6 G8 + 0x8C1C0302, // 0008 GETMET R7 R1 K2 + 0x58240004, // 0009 LDCONST R9 K4 + 0x7C1C0400, // 000A CALL R7 2 + 0x7C180200, // 000B CALL R6 1 + 0x4C1C0000, // 000C LDNIL R7 + 0x8C200105, // 000D GETMET R8 R0 K5 + 0x7C200200, // 000E CALL R8 1 + 0x60240008, // 000F GETGBL R9 G8 + 0x8C280302, // 0010 GETMET R10 R1 K2 + 0x58300006, // 0011 LDCONST R12 K6 + 0x7C280400, // 0012 CALL R10 2 + 0x7C240200, // 0013 CALL R9 1 + 0x4C280000, // 0014 LDNIL R10 + 0x202C1307, // 0015 NE R11 R9 K7 + 0x782E0012, // 0016 JMPF R11 #002A + 0xA8020005, // 0017 EXBLK 0 #001E + 0x602C000D, // 0018 GETGBL R11 G13 + 0x5C301200, // 0019 MOVE R12 R9 + 0x7C2C0200, // 001A CALL R11 1 + 0x5C281600, // 001B MOVE R10 R11 + 0xA8040001, // 001C EXBLK 1 1 + 0x7002000B, // 001D JMP #002A + 0xAC2C0002, // 001E CATCH R11 0 2 + 0x70020008, // 001F JMP #0029 + 0x60340001, // 0020 GETGBL R13 G1 + 0x60380018, // 0021 GETGBL R14 G24 + 0x583C0008, // 0022 LDCONST R15 K8 + 0x5C401200, // 0023 MOVE R16 R9 + 0x5C441600, // 0024 MOVE R17 R11 + 0x5C481800, // 0025 MOVE R18 R12 + 0x7C380800, // 0026 CALL R14 4 + 0x7C340200, // 0027 CALL R13 1 + 0x70020000, // 0028 JMP #002A + 0xB0080000, // 0029 RAISE 2 R0 R0 + 0x4C2C0000, // 002A LDNIL R11 + 0x1C2C0A0B, // 002B EQ R11 R5 R11 + 0x782E0000, // 002C JMPF R11 #002E + 0x80001600, // 002D RET 0 + 0x202C0D07, // 002E NE R11 R6 K7 + 0x782E006E, // 002F JMPF R11 #009F + 0x4C2C0000, // 0030 LDNIL R11 + 0x202C0A0B, // 0031 NE R11 R5 R11 + 0x782E006B, // 0032 JMPF R11 #009F + 0x142C0B09, // 0033 LT R11 R5 K9 + 0x742E0002, // 0034 JMPT R11 #0038 + 0x542E00FD, // 0035 LDINT R11 254 + 0x242C0A0B, // 0036 GT R11 R5 R11 + 0x782E0008, // 0037 JMPF R11 #0041 + 0x602C0001, // 0038 GETGBL R11 G1 + 0x60300008, // 0039 GETGBL R12 G8 + 0x5C340A00, // 003A MOVE R13 R5 + 0x7C300200, // 003B CALL R12 1 + 0x0032140C, // 003C ADD R12 K10 R12 + 0x0030190B, // 003D ADD R12 R12 K11 + 0x00301806, // 003E ADD R12 R12 R6 + 0x7C2C0200, // 003F CALL R11 1 + 0x80001600, // 0040 RET 0 + 0x4C2C0000, // 0041 LDNIL R11 + 0x60300009, // 0042 GETGBL R12 G9 + 0x8C340302, // 0043 GETMET R13 R1 K2 + 0x583C000C, // 0044 LDCONST R15 K12 + 0x7C340400, // 0045 CALL R13 2 + 0x7C300200, // 0046 CALL R12 1 + 0x4C340000, // 0047 LDNIL R13 + 0x2034180D, // 0048 NE R13 R12 R13 + 0x78360006, // 0049 JMPF R13 #0051 + 0x8C34110D, // 004A GETMET R13 R8 K13 + 0x5C3C1800, // 004B MOVE R15 R12 + 0x7C340400, // 004C CALL R13 2 + 0x4C380000, // 004D LDNIL R14 + 0x20381A0E, // 004E NE R14 R13 R14 + 0x783A0000, // 004F JMPF R14 #0051 + 0x882C1B0E, // 0050 GETMBR R11 R13 K14 + 0x4C340000, // 0051 LDNIL R13 + 0x1C34160D, // 0052 EQ R13 R11 R13 + 0x78360002, // 0053 JMPF R13 #0057 + 0x8C34110F, // 0054 GETMET R13 R8 K15 + 0x7C340200, // 0055 CALL R13 1 + 0x5C2C1A00, // 0056 MOVE R11 R13 + 0x8C340910, // 0057 GETMET R13 R4 K16 + 0x5C3C0000, // 0058 MOVE R15 R0 + 0x00422206, // 0059 ADD R16 K17 R6 + 0x7C340600, // 005A CALL R13 3 + 0x4C380000, // 005B LDNIL R14 0x4C3C0000, // 005C LDNIL R15 - 0x4C400000, // 005D LDNIL R16 - 0x1C401C10, // 005E EQ R16 R14 R16 - 0x78420010, // 005F JMPF R16 #0071 - 0x8C400B12, // 0060 GETMET R16 R5 K18 - 0x5C480600, // 0061 MOVE R18 R3 - 0x5C4C0E00, // 0062 MOVE R19 R7 - 0x7C400600, // 0063 CALL R16 3 - 0x4C440000, // 0064 LDNIL R17 - 0x20442011, // 0065 NE R17 R16 R17 - 0x78460009, // 0066 JMPF R17 #0071 - 0x60440004, // 0067 GETGBL R17 G4 - 0x5C482000, // 0068 MOVE R18 R16 - 0x7C440200, // 0069 CALL R17 1 - 0x1C442314, // 006A EQ R17 R17 K20 - 0x78460004, // 006B JMPF R17 #0071 - 0x5C442000, // 006C MOVE R17 R16 - 0x5C481800, // 006D MOVE R18 R12 - 0x7C440200, // 006E CALL R17 1 - 0x5C3C2200, // 006F MOVE R15 R17 - 0x88380115, // 0070 GETMBR R14 R0 K21 - 0x4C400000, // 0071 LDNIL R16 - 0x1C401C10, // 0072 EQ R16 R14 R16 - 0x7842000F, // 0073 JMPF R16 #0084 - 0x8C400B16, // 0074 GETMET R16 R5 K22 - 0x5C480E00, // 0075 MOVE R18 R7 - 0x7C400400, // 0076 CALL R16 2 - 0x4C440000, // 0077 LDNIL R17 - 0x20442011, // 0078 NE R17 R16 R17 - 0x78460009, // 0079 JMPF R17 #0084 - 0x60440004, // 007A GETGBL R17 G4 - 0x5C482000, // 007B MOVE R18 R16 - 0x7C440200, // 007C CALL R17 1 - 0x1C442314, // 007D EQ R17 R17 K20 - 0x78460004, // 007E JMPF R17 #0084 - 0x5C442000, // 007F MOVE R17 R16 - 0x5C481800, // 0080 MOVE R18 R12 - 0x7C440200, // 0081 CALL R17 1 - 0x5C3C2200, // 0082 MOVE R15 R17 - 0x88380115, // 0083 GETMBR R14 R0 K21 - 0x4C400000, // 0084 LDNIL R16 - 0x1C401C10, // 0085 EQ R16 R14 R16 - 0x78420006, // 0086 JMPF R16 #008E - 0x60400001, // 0087 GETGBL R16 G1 - 0x60440008, // 0088 GETGBL R17 G8 - 0x5C480E00, // 0089 MOVE R18 R7 - 0x7C440200, // 008A CALL R17 1 - 0x00462E11, // 008B ADD R17 K23 R17 - 0x7C400200, // 008C CALL R16 1 - 0x80002000, // 008D RET 0 - 0x5C401C00, // 008E MOVE R16 R14 - 0x5C441800, // 008F MOVE R17 R12 - 0x5C480400, // 0090 MOVE R18 R2 - 0x5C4C0200, // 0091 MOVE R19 R1 - 0x5C501E00, // 0092 MOVE R20 R15 - 0x7C400800, // 0093 CALL R16 4 - 0x5C202000, // 0094 MOVE R8 R16 - 0x8C401318, // 0095 GETMET R16 R9 K24 - 0x5C480C00, // 0096 MOVE R18 R6 - 0x5C4C1000, // 0097 MOVE R19 R8 - 0x7C400600, // 0098 CALL R16 3 - 0x8C400909, // 0099 GETMET R16 R4 K9 - 0x58480019, // 009A LDCONST R18 K25 - 0x8C4C1304, // 009B GETMET R19 R9 K4 - 0x7C4C0200, // 009C CALL R19 1 - 0x5C500C00, // 009D MOVE R20 R6 - 0x7C400800, // 009E CALL R16 4 - 0x900C2008, // 009F SETMBR R3 R16 R8 - 0x4C300000, // 00A0 LDNIL R12 - 0x2030160C, // 00A1 NE R12 R11 R12 - 0x78320018, // 00A2 JMPF R12 #00BC - 0xA802000B, // 00A3 EXBLK 0 #00B0 - 0x5C301600, // 00A4 MOVE R12 R11 - 0x7C300000, // 00A5 CALL R12 0 - 0x60340004, // 00A6 GETGBL R13 G4 - 0x5C381800, // 00A7 MOVE R14 R12 - 0x7C340200, // 00A8 CALL R13 1 - 0x1C341B1A, // 00A9 EQ R13 R13 K26 - 0x78360002, // 00AA JMPF R13 #00AE - 0x5C341800, // 00AB MOVE R13 R12 - 0x5C381000, // 00AC MOVE R14 R8 - 0x7C340200, // 00AD CALL R13 1 - 0xA8040001, // 00AE EXBLK 1 1 - 0x7002000B, // 00AF JMP #00BC - 0xAC300002, // 00B0 CATCH R12 0 2 - 0x70020008, // 00B1 JMP #00BB - 0x60380001, // 00B2 GETGBL R14 G1 - 0x8C3C0909, // 00B3 GETMET R15 R4 K9 - 0x5844001B, // 00B4 LDCONST R17 K27 - 0x5C481400, // 00B5 MOVE R18 R10 - 0x5C4C1800, // 00B6 MOVE R19 R12 - 0x5C501A00, // 00B7 MOVE R20 R13 - 0x7C3C0A00, // 00B8 CALL R15 5 - 0x7C380200, // 00B9 CALL R14 1 - 0x70020000, // 00BA JMP #00BC - 0xB0080000, // 00BB RAISE 2 R0 R0 - 0x1C300D1C, // 00BC EQ R12 R6 K28 - 0x78320005, // 00BD JMPF R12 #00C4 - 0x20300F08, // 00BE NE R12 R7 K8 - 0x78320003, // 00BF JMPF R12 #00C4 - 0x60300001, // 00C0 GETGBL R12 G1 - 0x5834001D, // 00C1 LDCONST R13 K29 - 0x7C300200, // 00C2 CALL R12 1 - 0x80001800, // 00C3 RET 0 - 0x1C300D1C, // 00C4 EQ R12 R6 K28 - 0x78320005, // 00C5 JMPF R12 #00CC - 0x8C300106, // 00C6 GETMET R12 R0 K6 - 0x7C300200, // 00C7 CALL R12 1 - 0x8C30190F, // 00C8 GETMET R12 R12 K15 - 0x5838001C, // 00C9 LDCONST R14 K28 - 0x7C300400, // 00CA CALL R12 2 - 0x5C201800, // 00CB MOVE R8 R12 - 0x60300010, // 00CC GETGBL R12 G16 - 0x8C34031E, // 00CD GETMET R13 R1 K30 - 0x7C340200, // 00CE CALL R13 1 - 0x7C300200, // 00CF CALL R12 1 - 0xA8020004, // 00D0 EXBLK 0 #00D6 - 0x5C341800, // 00D1 MOVE R13 R12 - 0x7C340000, // 00D2 CALL R13 0 - 0x9438020D, // 00D3 GETIDX R14 R1 R13 - 0x90201A0E, // 00D4 SETMBR R8 R13 R14 - 0x7001FFFA, // 00D5 JMP #00D1 - 0x5830001F, // 00D6 LDCONST R12 K31 - 0xAC300200, // 00D7 CATCH R12 1 0 - 0xB0080000, // 00D8 RAISE 2 R0 R0 - 0x80000000, // 00D9 RET 0 + 0x1C3C1A0F, // 005D EQ R15 R13 R15 + 0x783E0010, // 005E JMPF R15 #0070 + 0x8C3C0910, // 005F GETMET R15 R4 K16 + 0x5C440600, // 0060 MOVE R17 R3 + 0x5C480C00, // 0061 MOVE R18 R6 + 0x7C3C0600, // 0062 CALL R15 3 + 0x4C400000, // 0063 LDNIL R16 + 0x20401E10, // 0064 NE R16 R15 R16 + 0x78420009, // 0065 JMPF R16 #0070 + 0x60400004, // 0066 GETGBL R16 G4 + 0x5C441E00, // 0067 MOVE R17 R15 + 0x7C400200, // 0068 CALL R16 1 + 0x1C402112, // 0069 EQ R16 R16 K18 + 0x78420004, // 006A JMPF R16 #0070 + 0x5C401E00, // 006B MOVE R16 R15 + 0x5C441600, // 006C MOVE R17 R11 + 0x7C400200, // 006D CALL R16 1 + 0x5C382000, // 006E MOVE R14 R16 + 0x88340113, // 006F GETMBR R13 R0 K19 + 0x4C3C0000, // 0070 LDNIL R15 + 0x1C3C1A0F, // 0071 EQ R15 R13 R15 + 0x783E000F, // 0072 JMPF R15 #0083 + 0x8C3C0914, // 0073 GETMET R15 R4 K20 + 0x5C440C00, // 0074 MOVE R17 R6 + 0x7C3C0400, // 0075 CALL R15 2 + 0x4C400000, // 0076 LDNIL R16 + 0x20401E10, // 0077 NE R16 R15 R16 + 0x78420009, // 0078 JMPF R16 #0083 + 0x60400004, // 0079 GETGBL R16 G4 + 0x5C441E00, // 007A MOVE R17 R15 + 0x7C400200, // 007B CALL R16 1 + 0x1C402112, // 007C EQ R16 R16 K18 + 0x78420004, // 007D JMPF R16 #0083 + 0x5C401E00, // 007E MOVE R16 R15 + 0x5C441600, // 007F MOVE R17 R11 + 0x7C400200, // 0080 CALL R16 1 + 0x5C382000, // 0081 MOVE R14 R16 + 0x88340113, // 0082 GETMBR R13 R0 K19 + 0x4C3C0000, // 0083 LDNIL R15 + 0x1C3C1A0F, // 0084 EQ R15 R13 R15 + 0x783E0006, // 0085 JMPF R15 #008D + 0x603C0001, // 0086 GETGBL R15 G1 + 0x60400008, // 0087 GETGBL R16 G8 + 0x5C440C00, // 0088 MOVE R17 R6 + 0x7C400200, // 0089 CALL R16 1 + 0x00422A10, // 008A ADD R16 K21 R16 + 0x7C3C0200, // 008B CALL R15 1 + 0x80001E00, // 008C RET 0 + 0x5C3C1A00, // 008D MOVE R15 R13 + 0x5C401600, // 008E MOVE R16 R11 + 0x5C440400, // 008F MOVE R17 R2 + 0x5C480200, // 0090 MOVE R18 R1 + 0x5C4C1C00, // 0091 MOVE R19 R14 + 0x7C3C0800, // 0092 CALL R15 4 + 0x5C1C1E00, // 0093 MOVE R7 R15 + 0x8C3C1116, // 0094 GETMET R15 R8 K22 + 0x5C440A00, // 0095 MOVE R17 R5 + 0x5C480E00, // 0096 MOVE R18 R7 + 0x7C3C0600, // 0097 CALL R15 3 + 0x603C0018, // 0098 GETGBL R15 G24 + 0x58400017, // 0099 LDCONST R16 K23 + 0x8C441103, // 009A GETMET R17 R8 K3 + 0x7C440200, // 009B CALL R17 1 + 0x5C480A00, // 009C MOVE R18 R5 + 0x7C3C0600, // 009D CALL R15 3 + 0x900C1E07, // 009E SETMBR R3 R15 R7 + 0x4C2C0000, // 009F LDNIL R11 + 0x202C140B, // 00A0 NE R11 R10 R11 + 0x782E0018, // 00A1 JMPF R11 #00BB + 0xA802000B, // 00A2 EXBLK 0 #00AF + 0x5C2C1400, // 00A3 MOVE R11 R10 + 0x7C2C0000, // 00A4 CALL R11 0 + 0x60300004, // 00A5 GETGBL R12 G4 + 0x5C341600, // 00A6 MOVE R13 R11 + 0x7C300200, // 00A7 CALL R12 1 + 0x1C301918, // 00A8 EQ R12 R12 K24 + 0x78320002, // 00A9 JMPF R12 #00AD + 0x5C301600, // 00AA MOVE R12 R11 + 0x5C340E00, // 00AB MOVE R13 R7 + 0x7C300200, // 00AC CALL R12 1 + 0xA8040001, // 00AD EXBLK 1 1 + 0x7002000B, // 00AE JMP #00BB + 0xAC2C0002, // 00AF CATCH R11 0 2 + 0x70020008, // 00B0 JMP #00BA + 0x60340001, // 00B1 GETGBL R13 G1 + 0x60380018, // 00B2 GETGBL R14 G24 + 0x583C0019, // 00B3 LDCONST R15 K25 + 0x5C401200, // 00B4 MOVE R16 R9 + 0x5C441600, // 00B5 MOVE R17 R11 + 0x5C481800, // 00B6 MOVE R18 R12 + 0x7C380800, // 00B7 CALL R14 4 + 0x7C340200, // 00B8 CALL R13 1 + 0x70020000, // 00B9 JMP #00BB + 0xB0080000, // 00BA RAISE 2 R0 R0 + 0x1C2C0B1A, // 00BB EQ R11 R5 K26 + 0x782E0005, // 00BC JMPF R11 #00C3 + 0x202C0D07, // 00BD NE R11 R6 K7 + 0x782E0003, // 00BE JMPF R11 #00C3 + 0x602C0001, // 00BF GETGBL R11 G1 + 0x5830001B, // 00C0 LDCONST R12 K27 + 0x7C2C0200, // 00C1 CALL R11 1 + 0x80001600, // 00C2 RET 0 + 0x1C2C0B1A, // 00C3 EQ R11 R5 K26 + 0x782E0005, // 00C4 JMPF R11 #00CB + 0x8C2C0105, // 00C5 GETMET R11 R0 K5 + 0x7C2C0200, // 00C6 CALL R11 1 + 0x8C2C170D, // 00C7 GETMET R11 R11 K13 + 0x5834001A, // 00C8 LDCONST R13 K26 + 0x7C2C0400, // 00C9 CALL R11 2 + 0x5C1C1600, // 00CA MOVE R7 R11 + 0x602C0010, // 00CB GETGBL R11 G16 + 0x8C30031C, // 00CC GETMET R12 R1 K28 + 0x7C300200, // 00CD CALL R12 1 + 0x7C2C0200, // 00CE CALL R11 1 + 0xA8020004, // 00CF EXBLK 0 #00D5 + 0x5C301600, // 00D0 MOVE R12 R11 + 0x7C300000, // 00D1 CALL R12 0 + 0x9434020C, // 00D2 GETIDX R13 R1 R12 + 0x901C180D, // 00D3 SETMBR R7 R12 R13 + 0x7001FFFA, // 00D4 JMP #00D0 + 0x582C001D, // 00D5 LDCONST R11 K29 + 0xAC2C0200, // 00D6 CATCH R11 1 0 + 0xB0080000, // 00D7 RAISE 2 R0 R0 + 0x80000000, // 00D8 RET 0 }) ) ); diff --git a/lib/libesp32/berry_tasmota/src/be_tasmota_lib.c b/lib/libesp32/berry_tasmota/src/be_tasmota_lib.c index e4962d731..9bd9120b7 100644 --- a/lib/libesp32/berry_tasmota/src/be_tasmota_lib.c +++ b/lib/libesp32/berry_tasmota/src/be_tasmota_lib.c @@ -34,6 +34,7 @@ extern int l_yield(bvm *vm); extern int l_delay(bvm *vm); extern int l_delay_microseconds(bvm *vm); extern int l_scaleuint(bvm *vm); +extern int l_scaleint(bvm *vm); extern int l_logInfo(bvm *vm); extern int l_loglevel(bvm *vm); extern int l_save(bvm *vm); @@ -118,6 +119,7 @@ class be_class_tasmota (scope: global, name: Tasmota) { delay, func(l_delay) delay_microseconds, func(l_delay_microseconds) scale_uint, static_func(l_scaleuint) + scale_int, static_func(l_scaleint) log, func(l_logInfo) loglevel, func(l_loglevel) save, func(l_save) diff --git a/lib/libesp32/berry_tasmota/src/embedded/animate_module.be b/lib/libesp32/berry_tasmota/src/embedded/animate_module.be index 7e913c919..f1857c90c 100644 --- a/lib/libesp32/berry_tasmota/src/embedded/animate_module.be +++ b/lib/libesp32/berry_tasmota/src/embedded/animate_module.be @@ -4,6 +4,7 @@ # Animation framework # +#@ solidify:animate,weak animate = module("animate") # state-machine: from val a to b @@ -20,6 +21,381 @@ class Animate_ins_ramp end animate.ins_ramp = Animate_ins_ramp + +################################################################################# +# class Animate_palette +# +# Animated color palette +################################################################################# + +################################################################################# +# Palette format compatible +# +# Takes a binary array with a set of 4 bytes elements: VRGB +# V: Value in a range 0..255. The first value must be 0, +# the last needs to be 255. +# Numbers must be in strictly increasin numbers. +# The algorithm maps a 0..255 rotating value to its color +# in the palette. +# R: Red component +# G: Green component +# B: Blue component +# Note: RGB is in big Endian to make it more readable, although +# it's little-endian when in memory. Be aware! +# RGB values are stored at max brightness and without gamma correction +################################################################################# + +# Gradient palette "ib_jul01_gp", originally from +# http://soliton.vm.bytemark.co.uk/pub/cpt-city/ing/xmas/tn/ib_jul01.png.index.html +var PALETTE_ib_jul01_gp = bytes( + "00" "E60611" + "5E" "25605A" + "85" "90BD6A" + "FF" "BB030D" +) +# animate.PALETTE_ib_jul01_gp = PALETTE_ib_jul01_gp +# rgb(230, 6, 17) 0.000%, +# rgb( 37, 96, 90) 37.010%, +# rgb(144,189,106) 52.000%, +# rgb(187, 3, 13) 100.000% + +var PALETTE_STANDARD_VAL = bytes( + "00" "FF0000" # red + "24" "FFA500" # orange + "49" "FFFF00" # yellow + "6E" "008800" # green + "92" "0000FF" # blue + "B7" "4B0082" # indigo + "DB" "EE82EE" # violet + "FF" "FF0000" # red +) +# animate.PALETTE_STANDARD = PALETTE_STANDARD + +var PALETTE_SATURATED_TAG = bytes( + "40" "FF0000" # red + "40" "FFA500" # orange + "40" "FFFF00" # yellow + "40" "00FF00" # green + "40" "0000FF" # blue + "40" "FF00FF" # indigo + "40" "EE44A5" # violet + "00" "FF0000" # red +) + +var PALETTE_STANDARD_TAG = bytes( + "40" "FF0000" # red + "40" "FFA500" # orange + "40" "FFFF00" # yellow + "40" "008800" # green + "40" "0000FF" # blue + "40" "4B0082" # indigo + "40" "EE82EE" # violet + "00" "FF0000" # red +) +# animate.PALETTE_STANDARD = PALETTE_STANDARD + + +class Animate_palette + # parsing of palette + var palette # raw bytes object + var slots_arr # constructed array of timestamp slots + var slots # number of slots + # timing information + var running + var duration_ms # duration_ms of the entire cycle in ms, cannot be `0` + var origin # origin in ms of the current cycle, as per tasmota.millis() reference + # range information (when used as range color) + var range_min # minimum value expected as input + var range_max # maximum value expected as input, needs (range_min < range_max, can be negative) + # callback information + var animate_obj # object to call + var animate_mth # object method to call + # brightness + var bri # brightness to be applied to palette 0..100 + # color object to do RGB color calculation + var color # instance of light_state, used for color calculation (reuse of object) + + def init(palette, duration_s) + self.running = false + self.palette = palette + self.bri = 100 + self.slots = size(palette) / 4 + if duration_s != nil + self.set_duration(int(duration_s * 1000)) + end + self.color = light_state(light_state.RGB) + end + + def set_cb(obj, mth) + self.animate_obj = obj + self.animate_mth = mth + end + + # setter to be used as cb + def set_bri(bri) + self.bri = int(bri) + end + + def start(millis) + if (self.duration_ms == nil) return end + if millis == nil millis = tasmota.millis() end + self.origin = millis + self.running = true + end + + def stop() + self.origin = nil + self.running = false + end + + def is_running() + return bool(self.running) + end + + def parse_palette(min, max) + var arr = [] + var slots = self.slots + arr.resize(slots) + + # check if we have slots or values + # if first value index is non-zero, it's ticks count + if self.palette.get(0, 1) != 0 + # palette in tick counts + # compute the total number of ticks + var total_ticks = 0 + var idx = 0 + while idx < slots - 1 + total_ticks += self.palette.get(idx * 4, 1) + idx += 1 + end + var cur_ticks = 0 + idx = 0 + while idx < slots + arr[idx] = tasmota.scale_int(cur_ticks, 0, total_ticks, min, max) + cur_ticks += self.palette.get(idx * 4, 1) + idx += 1 + end + else + # palette is in value range from 0..255 + var idx = 0 + while idx < slots + var val = self.palette.get(idx * 4, 1) + arr[idx] = tasmota.scale_int(val, 0, 255, min, max) + idx += 1 + end + end + # print(f"ANM: {arr=}") + return arr + end + + def set_duration(duration_ms) + if (duration_ms == nil) return end + if duration_ms <= 0 raise "value_error", "duration_ms must be positive" end + self.duration_ms = duration_ms + + self.slots_arr = self.parse_palette(0, duration_ms - 1) + end + + def set_range(min, max) + if (min >= max) raise "value_error", "min must be lower than mex" end + self.range_min = min + self.range_max = max + + self.slots_arr = self.parse_palette(min, max) + end + + # compute the css linear-gradient description + # + # Example: background: linear-gradient(to right, #000000, #e66465 11.0%, #9198e5); + def to_css_gradient() + var arr = self.parse_palette(0, 1000) + var ret = "background:linear-gradient(to right" + var idx = 0 + while idx < size(arr) + var prm = arr[idx] # per mile + + var bgrt = self.palette.get(idx * 4, 4) + var r = (bgrt >> 8) & 0xFF + var g = (bgrt >> 16) & 0xFF + var b = (bgrt >> 24) & 0xFF + ret += f",#{r:02X}{g:02X}{b:02X} {prm/10.0:.1f}%" + idx += 1 + end + ret += ");" + return ret + end + + def set_value(value) + if (self.range_min == nil || self.range_max == nil) return nil end + var scale_int = tasmota.scale_int + + # find slot + var slots = self.slots + var idx = slots - 2 + while idx > 0 + if value >= self.slots_arr[idx] break end + idx -= 1 + end + var bgrt0 = self.palette.get(idx * 4, 4) + var bgrt1 = self.palette.get((idx + 1) * 4, 4) + var t0 = self.slots_arr[idx] + var t1 = self.slots_arr[idx + 1] + var r = scale_int(value, t0, t1, (bgrt0 >> 8) & 0xFF, (bgrt1 >> 8) & 0xFF) + var g = scale_int(value, t0, t1, (bgrt0 >> 16) & 0xFF, (bgrt1 >> 16) & 0xFF) + var b = scale_int(value, t0, t1, (bgrt0 >> 24) & 0xFF, (bgrt1 >> 24) & 0xFF) + var rgb = (r << 16) | (g << 8) | b + # + var obj = self.animate_obj + var mth = self.animate_mth + if (obj && mth) + mth(obj, rgb) + end + # if self.cb != nil + # self.cb(rgb) + # end + # + # print(f"ANM: {rgb=:%06X}") + return rgb + end + + def animate(millis) + if (self.duration_ms == nil) return end + if millis == nil millis = tasmota.millis() end + var past = millis - self.origin + if past < 0 + past = 0 + millis = self.origin + end + var duration_ms = self.duration_ms + var scale_uint = tasmota.scale_uint + if past >= duration_ms + self.origin += (past / duration_ms) * duration_ms + past = past % duration_ms + end + # find slot + var slots = self.slots + var idx = slots - 2 + while idx > 0 + if past >= self.slots_arr[idx] break end + idx -= 1 + end + var bgrt0 = self.palette.get(idx * 4, 4) + var bgrt1 = self.palette.get((idx + 1) * 4, 4) + var t0 = self.slots_arr[idx] + var t1 = self.slots_arr[idx + 1] + var r = scale_uint(past, t0, t1, (bgrt0 >> 8) & 0xFF, (bgrt1 >> 8) & 0xFF) + var g = scale_uint(past, t0, t1, (bgrt0 >> 16) & 0xFF, (bgrt1 >> 16) & 0xFF) + var b = scale_uint(past, t0, t1, (bgrt0 >> 24) & 0xFF, (bgrt1 >> 24) & 0xFF) + + var color = self.color + color.set_rgb((bgrt0 >> 8) & 0xFF, (bgrt0 >> 16) & 0xFF, (bgrt0 >> 24) & 0xFF) + var bri0 = color.bri + color.set_rgb((bgrt1 >> 8) & 0xFF, (bgrt1 >> 16) & 0xFF, (bgrt1 >> 24) & 0xFF) + var bri1 = color.bri + var bri2 = scale_uint(past, t0, t1, bri0, bri1) + color.set_rgb(r, g, b) + color.set_bri(bri2) + + r = color.r + g = color.g + b = color.b + + # apply self.bri if not `100` + var bri = self.bri + if bri != 100 + r = tasmota.scale_uint(r, 0, 100, 0, bri) + g = tasmota.scale_uint(g, 0, 100, 0, bri) + b = tasmota.scale_uint(b, 0, 100, 0, bri) + end + + # var rgb = (r << 16) | (g << 8) | b + var rgb = (r << 16) | (g << 8) | b + + var obj = self.animate_obj + var mth = self.animate_mth + if (obj && mth) + mth(obj, rgb) + end + + return rgb + end +end +animate.palette = Animate_palette + +#- + +pal = Animate_palette(PALETTE_STANDARD_TAG, 7000) +pal = Animate_palette(PALETTE_STANDARD_VAL, 7000) + + +import animate +var pal = animate.palette(PALETTE_STANDARD_TAG, 7000) +pal.start(0) +for t: range(0,8000,200) + pal.tick(t) +end + +-# + +################################################################################# +# class Animate_segment +# +# Animate a small segment ______/+++\______ +# length in 1/256 pixels +# slew in 1/256 pixels +# fore foregroung color +# back background color (or transparent) +# origin in 1/256 pixels +# +# strip +################################################################################# +# class Animate_segment +# var strip +# var length +# var slew +# var fore +# var back +# var origin + +# def init(strip) +# self.strip = strip +# self.length = 256 # 1 pixel +# self.slew = 0 # 0 pixel (immediate) +# self.fore = 0x00FF0000 # red opaque +# self.back = 0xFF000000 # transparent +# self.origin = 0 # start of strip +# end + +# def paint(bri) +# # move all important values in registers +# var strip = self.strip +# var pix_offset = strip.pixel_offset() +# var pix_count = strip.pixel_count() +# var pix_buffer = strip.pixels_buffer() +# var pix_size = strip.pixel_size() + +# var length = self.length +# var slew = self.slew +# var fore = self.fore +# var back = self.back +# var origin = self.origin + +# var pix = 0 # iterate on each pixel +# var limit_low = (origin - slew) / 256 +# var limit_high = (origin + length + slew) / 256 +# while pix < pix_count +# # are we off limits +# if (pix >= limit_low) && (pix <= limit_high) # outside of those boundaries, we just apply backgroung +# strip.set_pixel_color(pix, fore, bri) +# else +# strip.set_pixel_color(pix, back, bri) +# end +# pix += 1 +# end +# end +# end +# animate.segment = Animate_segment + # state-machine: pause and goto class Animate_ins_goto var pc_rel # relative PC, -1 previous instruction, 1 next instruction, 0 means see pc_abs @@ -37,6 +413,8 @@ animate.ins_goto = Animate_ins_goto class Animate_engine var code # array of state-machine instructions var closure # closure to call with the new value + var animate_obj # object to call (alternative to closure) + var animate_mth # method to call on object var pc # program-counter var ins_time # absolute time when the current instruction started var running # is the animation running? allows fast return @@ -50,37 +428,35 @@ class Animate_engine # end - # run but needs external calls to `animate()` + def set_cb(obj, mth) + self.animate_obj = obj + self.animate_mth = mth + end + + # start but needs external calls to `animate()` # cur_time:int (opt) current timestamp in ms, defaults to `tasmota.millis()` # val:int (opt) starting value, default to `nil` - def run(cur_time, val) + def start(cur_time, val) if cur_time == nil cur_time = tasmota.millis() end if (val != nil) self.value = val end self.ins_time = cur_time self.running = true - tasmota.add_driver(self) end - # runs autonomously in the Tasmota event loop - def autorun(cur_time, val) - self.run(cur_time, val) - tasmota.add_driver(self) - end + # # runs autonomously in the Tasmota event loop + # def autorun(cur_time, val) + # self.run(cur_time, val) + # end def stop() self.running = false - tasmota.remove_driver(self) end def is_running() return self.running end - def every_50ms() - self.animate() - end - def animate(cur_time) # time in milliseconds, optional, defaults to `tasmota.millis()` if !self.running return end if cur_time == nil cur_time = tasmota.millis() end @@ -99,16 +475,23 @@ class Animate_engine # Instruction Ramp if isinstance(ins, animate.ins_ramp) - var f = self.closure # assign to a local variable to not call a method + var closure = self.closure # assign to a local variable to not call a method + var obj = self.animate_obj + var mth = self.animate_mth if sub_index < ins.duration # we're still in the ramp self.value = tasmota.scale_uint(sub_index, 0, ins.duration, ins.a, ins.b) + # call method + if (obj && mth) mth(obj, self.value) end # call closure - if f f(self.value) end # call closure, need try? TODO + if (closure) closure(self.value) end # call closure, need try? TODO break else self.value = ins.b - if f f(self.value) end # set to last value + # call method + if (obj && mth) mth(obj, self.value) end + # call closure + if (closure) closure(self.value) end # set to last value self.pc += 1 # next instruction self.ins_time = cur_time - (sub_index - ins.duration) end @@ -139,25 +522,26 @@ animate.engine = Animate_engine class Animate_from_to : Animate_engine - def init(closure, from, to, duration) + def init(obj, mth, from, to, duration) super(self).init() - self.closure = closure + self.set_cb(obj, mth) self.code.push(animate.ins_ramp(from, to, duration)) end end animate.from_to = Animate_from_to -#- -a=Animate_from_to(nil, 0, 100, 5000) -a.autorun() --# +### +# +# a=Animate_from_to(nil, 0, 100, 5000) +# +### class Animate_rotate : Animate_engine - def init(closure, from, to, duration) + def init(obj, mth, from, to, duration) super(self).init() - self.closure = closure + self.set_cb(obj, mth) self.code.push(animate.ins_ramp(from, to, duration)) self.code.push(animate.ins_goto(0, 0, 0)) # goto abs pc = 0 without any pause end @@ -172,17 +556,16 @@ a.autorun() class Animate_back_forth : Animate_engine - def init(closure, from, to, duration) + def init(obj, mth, from, to, duration) super(self).init() - self.closure = closure - self.code.push(animate.ins_ramp(from, to, duration / 2)) - self.code.push(animate.ins_ramp(to, from, duration / 2)) + self.set_cb(obj, mth) + self.code.push(animate.ins_ramp(from, to, duration)) + self.code.push(animate.ins_ramp(to, from, duration)) self.code.push(animate.ins_goto(0, 0, 0)) # goto abs pc = 0 without any pause end end animate.back_forth = Animate_back_forth -#@ solidify:animate #- a=Animate_back_forth(nil, 0, 100, 5000) diff --git a/lib/libesp32/berry_tasmota/src/embedded/leds.be b/lib/libesp32/berry_tasmota/src/embedded/leds.be index ecde9b706..3e20b1c4a 100644 --- a/lib/libesp32/berry_tasmota/src/embedded/leds.be +++ b/lib/libesp32/berry_tasmota/src/embedded/leds.be @@ -132,6 +132,9 @@ class Leds : Leds_ntv def pixel_count() return self.call_native(8) end + def pixel_offset() + return 0 + end def clear_to(col, bri) self.call_native(9, self.to_gamma(col, bri)) end @@ -155,20 +158,8 @@ class Leds : Leds_ntv # end # apply gamma and bri - def to_gamma(rgbw, bri) - bri = (bri != nil) ? bri : 100 - var r = tasmota.scale_uint(bri, 0, 100, 0, (rgbw & 0xFF0000) >> 16) - var g = tasmota.scale_uint(bri, 0, 100, 0, (rgbw & 0x00FF00) >> 8) - var b = tasmota.scale_uint(bri, 0, 100, 0, (rgbw & 0x0000FF)) - if self.gamma - return light.gamma8(r) << 16 | - light.gamma8(g) << 8 | - light.gamma8(b) - else - return r << 16 | - g << 8 | - b - end + def to_gamma(rgb, bri) + return self.apply_bri_gamma(rgb, bri, self.gamma) end # `segment` @@ -218,15 +209,19 @@ class Leds : Leds_ntv def pixel_size() return self.strip.pixel_size() end + def pixel_offset() + return self.offset + end def pixel_count() return self.leds end def clear_to(col, bri) - var i = 0 - while i < self.leds - self.strip.set_pixel_color(i + self.offset, col, bri) - i += 1 - end + self.strip.call_native(9, self.strip.to_gamma(col, bri), self.offset, self.leds) + # var i = 0 + # while i < self.leds + # self.strip.set_pixel_color(i + self.offset, col, bri) + # i += 1 + # end end def set_pixel_color(idx, col, bri) self.strip.set_pixel_color(idx + self.offset, col, bri) @@ -302,12 +297,11 @@ class Leds : Leds_ntv def pixel_count() return self.w * self.h end + def pixel_offset() + return self.offset + end def clear_to(col, bri) - var i = 0 - while i < self.w * self.h - self.strip.set_pixel_color(i + self.offset, col, bri) - i += 1 - end + self.strip.call_native(9, self.strip.to_gamma(col, bri), self.offset, self.w * self.h) end def set_pixel_color(idx, col, bri) self.strip.set_pixel_color(idx + self.offset, col, bri) diff --git a/lib/libesp32/berry_tasmota/src/embedded/leds_0_animator.be b/lib/libesp32/berry_tasmota/src/embedded/leds_0_animator.be new file mode 100644 index 000000000..e6de57d09 --- /dev/null +++ b/lib/libesp32/berry_tasmota/src/embedded/leds_0_animator.be @@ -0,0 +1,163 @@ +# class Leds_animator + +#@ solidify:Leds_animator,weak + +# for solidification +class Leds_frame end + +########################################################################################## +# +# class Leds_animator +# +# Simple framework to orchestrate all the animations for a led strip or led matrix +# +# You should pass a Leds or Leds_segment to push pixels at each tick +# This version uses `fast_loop` for up to 5ms animation time (200 Hz) +# +########################################################################################## +class Leds_animator + var strip # neopixelbus object + var pixel_count # number of pixels in the strip + var bri # brightness of the animation, 0..100, default 50 + var running # is the animation running + var animators # animators list + var painters # list of objects that paint layers on top of background (with transparency) + var fast_loop_cb # closure used for fast_loop + static var FAST_LOOP_MIN = 20 + var fast_loop_next # next time-stamp for fast_loop + # cb for animation + var animate_object # object called at each tick + var animate_method # method of object called at each tick + # frame ojects + var frame # Leds_frame frame object + var layer # Leds_frame for layer on top of frame + # background color management (only for uniform background) + var back_color # background color RRGGBB + + def init(strip, bri) + self.strip = strip + if (bri == nil) bri = 50 end + self.bri = bri # percentage of brightness 0..100 + self.running = false + self.pixel_count = strip.pixel_count() + self.animators = [] + self.painters = [] + # + self.clear() # clear all leds first + self.frame = Leds_frame(self.pixel_count) + self.layer = Leds_frame(self.pixel_count) + # + self.fast_loop_cb = def() self.fast_loop() end + self.back_color = 0x000000 + end + + # cb + def set_back_color(col) + self.back_color = col + end + + def add_background_animator(anim) + anim.set_cb(self, self.set_back_color) + self.add_animator(anim) + end + + def add_animator(anim) + self.animators.push(anim) + end + + def add_painter(painter) + self.painters.push(painter) + end + + def clear() + self.stop() + self.strip.clear() + end + def start() + self.running = true + var animators = self.animators + var idx = 0 + while idx < size(animators) + animators[idx].start() + idx += 1 + end + self.fast_loop_next = 0 # run immediately + tasmota.add_fast_loop(self.fast_loop_cb) + end + + def stop() + self.running = false + var animators = self.animators + var idx = 0 + while idx < size(animators) + animators[idx].stop() + idx += 1 + end + tasmota.remove_fast_loop(self.fast_loop_cb) + end + + def set_bri(bri) + self.bri = bri + end + def get_bri(bri) + return self.bri + end + + def set_cb(obj, method) + self.animate_object = obj + self.animate_method = method + end + + def fast_loop() + if self.running && tasmota.time_reached(self.fast_loop_next) && self.strip.can_show() + # prepare environnement + self.frame.fill_pixels(self.back_color) + # run animators first + var i = 0 + var now = tasmota.millis() + self.fast_loop_next = now + self.FAST_LOOP_MIN + while i < size(self.animators) + self.animators[i].animate(now) + i += 1 + # var anim = self.animators[i] + # if anim.is_running() + # anim.animate(now) + # i += 1 + # else + # self.animators.remove(i) # remove any finished animator + # end + end + # apply painters + i = 0 + var frame = self.frame + var layer = self.layer + while i < size(self.painters) + layer.fill_pixels(0xFF000000) # fill with transparent color + if (self.painters[i].paint(layer)) + frame.blend_pixels(layer) + end + i += 1 + end + # tirgger animate and display + var obj = self.animate_object + var mth = self.animate_method + if (obj && mth) + mth(obj) + end + self.animate() + # now display the frame + self.frame.paste_pixels(self.strip.pixels_buffer(), self.bri, self.strip.gamma) + self.strip.dirty() + self.strip.show() + end + end + + def animate() + # placeholder - do nothing by default + end + + def remove() + self.clear() + tasmota.remove_fast_loop(self.fast_loop_cb) + end +end diff --git a/lib/libesp32/berry_tasmota/src/embedded/leds_1_animate_effects.be b/lib/libesp32/berry_tasmota/src/embedded/leds_1_animate_effects.be new file mode 100644 index 000000000..fd8d112ed --- /dev/null +++ b/lib/libesp32/berry_tasmota/src/embedded/leds_1_animate_effects.be @@ -0,0 +1,162 @@ +# class Leds_pulse + +#@ solidify:Leds_pulse,weak + +########################################################################################## +# +# class Leds_pulse +# +# Display a color pulse +# +# index (1) +# | +# v +# _______ +# / \ +# _______/ \____________ +# | | | | +# |2| 3 |2| +# +# 1: `index`, start of the pulse (in pixel) +# 2: `slew_size`, number of pixels to fade from back to fore color, can be `0` +# 3: `pulse_size`, number of pixels of the pulse +# +########################################################################################## + +class Leds_pulse + var color + var back_color + var index + var slew_size + var pulse_size + + def init(color, pulse_size, slew_size) + if (color == nil) color = 0xFFFFFF end # white by default + if (pulse_size == nil) pulse_size = 1 end + if (slew_size == nil) slew_size = 0 end + + self.color = color + self.back_color = 0xFF000000 # default to transparent + if pulse_size < 0 pulse_size = 0 end + self.pulse_size = pulse_size + if slew_size < 0 slew_size = 0 end + self.slew_size = slew_size + end + + ## + ## Setters - to be used as cb for animators + ## + def set_color(color) + self.color = color + end + + def set_back_color(c) + self.back_color = c + end + + def set_index(index) + self.index = index + end + + def set_slew_size(slew_size) + self.slew_size = slew_size + end + + def set_pulse_size(pulse_size) + self.pulse_size = pulse_size + end + + # return true if buffer was filled successfully + def paint(frame) + var back_color = self.back_color + if (back_color != 0xFF000000) + frame.fill_pixels(back_color) # fill with transparent color + end + var index = self.index + var slew_size = self.slew_size + var pulse_size = self.pulse_size + var color = self.color + var pixel_size = frame.pixel_size + + # var min_index = index - slew_size + # var max_index = index + pulse_size + slew_size - 1 + + var pulse_min, pulse_max + pulse_min = index + pulse_max = index + pulse_size + if (pulse_min < 0) pulse_min = 0 end + if (pulse_max >= pixel_size) pulse_max = pixel_size end + + var i = pulse_min + while (i < pulse_max) + frame[i] = color + i += 1 + end + + if (slew_size > 0) + # check first slew, from `min_index` to `index - 1` + # Slew 1 + pulse_min = index - slew_size + pulse_max = index + if (pulse_min < 0) pulse_min = 0 end + if (pulse_max >= pixel_size) pulse_max = pixel_size end + i = pulse_min + while (i < pulse_max) + # blend from 255 (back) to 0 (fore) + frame[i] = frame.blend(back_color, color, tasmota.scale_int(i, index - slew_size - 1, index, 255, 0)) + # blend + i += 1 + end + # Slew 2 + pulse_min = index + pulse_size + pulse_max = index + pulse_size + slew_size + if (pulse_min < 0) pulse_min = 0 end + if (pulse_max >= pixel_size) pulse_max = pixel_size end + i = pulse_min + while (i < pulse_max) + # blend + frame[i] = frame.blend(back_color, color, tasmota.scale_int(i, index + pulse_size - 1, index + pulse_size + slew_size, 0, 255)) + i += 1 + end + end + + return true + end + +end + +# +# Unit tests +# +if false + +var frame = Leds_frame(10) +assert(frame.tohex() == '00000000000000000000000000000000000000000000000000000000000000000000000000000000') + +var pulse = Leds_pulse(0x00FF00, 3, 2) +pulse.set_index(5) +pulse.paint(frame) +assert(frame.tohex() == '0000000000000000000000000055000000AA000000FF000000FF000000FF000000AA000000550000') + +pulse.set_back_color(0x111111) +pulse.set_slew_size(1) +pulse.paint(frame) +assert(frame.tohex() == '111111001111110011111100111111000988090000FF000000FF000000FF00000988090011111100') + +pulse.set_back_color(0x00000000) +pulse.paint(frame) +assert(frame.tohex() == '00000000000000000000000000000000007F000000FF000000FF000000FF0000007F000000000000') + +pulse.set_pulse_size(0) +pulse.paint(frame) +assert(frame.tohex() == '00000000000000000000000000000000007F0000007F000000000000000000000000000000000000') + +pulse.set_slew_size(3) +pulse.paint(frame) +assert(frame.tohex() == '000000000000000000400000007F000000BF000000BF0000007F0000004000000000000000000000') + +pulse.set_slew_size(0) +pulse.paint(frame) +assert(frame.tohex() == '00000000000000000000000000000000000000000000000000000000000000000000000000000000') + +end diff --git a/lib/libesp32/berry_tasmota/src/embedded/leds_animator.be b/lib/libesp32/berry_tasmota/src/embedded/leds_animator.be deleted file mode 100644 index a6f4fb337..000000000 --- a/lib/libesp32/berry_tasmota/src/embedded/leds_animator.be +++ /dev/null @@ -1,72 +0,0 @@ -# class Leds_animator - -#@ solidify:Leds_animator,weak -class Leds_animator - var strip # neopixelbus object - var pixel_count # number of pixels in the strip - var bri # brightness of the animation, 0..100, default 50 - var running # is the animation running - var animators # animators list - - def init(strip) - self.strip = strip - self.bri = 50 # percentage of brightness 0..100 - self.running = false - self.pixel_count = strip.pixel_count() - self.animators = [] - # - self.clear() # clear all leds first - # - tasmota.add_fast_loop(/-> self.fast_loop()) - # it may be useful to reduce Sleep time here - end - - def add_anim(anim) - self.animators.push(anim) - anim.run() # start the animator - end - - def clear() - self.stop() - self.strip.clear() - end - def start() - self.running = true - end - def stop() - self.running = false - end - - def set_bri(bri) - self.bri = bri - end - def get_bri(bri) - return self.bri - end - - def fast_loop() - if self.running - # run animators first - var i = 0 - while i < size(self.animators) - var anim = self.animators[i] - if anim.is_running() - anim.animate() - i += 1 - else - self.animators.remove(i) # remove any finished animator - end - end - # tirgger animate and display - self.animate() - end - end - - def animate() - # placeholder - do nothing by default - end - - def remove() - tasmota.remove_driver(self) - end -end diff --git a/lib/libesp32/berry_tasmota/src/embedded/leds_frame_be_methods.be b/lib/libesp32/berry_tasmota/src/embedded/leds_frame_be_methods.be new file mode 100644 index 000000000..667ead151 --- /dev/null +++ b/lib/libesp32/berry_tasmota/src/embedded/leds_frame_be_methods.be @@ -0,0 +1,28 @@ +#- Native code used for code solidification -# +#- Do not use it -# + +tasmota = nil +#@ solidify:Leds_frame_be +class Leds_frame_be + + def init(pixels) + if (pixels < 0) pixels = -pixels end + self.pixel_size = pixels + super(self).init(pixels * (-4)) + end + + def item(i) + return self.get(i * 4, 4) + end + + def setitem(i, v) + self.set(i * 4, v, 4) + end + + def set_pixel(i, r, g, b, alpha) + if (alpha == nil) alpha = 0 end + var color = ((alpha & 0xFF) << 24) | ((r & 0xFF) << 16) | ((g & 0xFF) << 8) | (b & 0xFF) + self.setitem(i, color) + end + +end diff --git a/lib/libesp32/berry_tasmota/src/embedded/partition_core.be b/lib/libesp32/berry_tasmota/src/embedded/partition_core.be index 5fee46839..c907f493e 100644 --- a/lib/libesp32/berry_tasmota/src/embedded/partition_core.be +++ b/lib/libesp32/berry_tasmota/src/embedded/partition_core.be @@ -600,6 +600,19 @@ class Partition end end + #- invalidate SPIFFS partition to force format at next boot -# + #- we simply erase the first byte of the first 2 blocks in the SPIFFS partition -# + def invalidate_spiffs() + import flash + #- we expect the SPIFFS partition to be the last one -# + var spiffs = self.slots[-1] + if !spiffs.is_spiffs() raise 'value_error', 'No FS partition found' end + + var b = bytes("00") #- flash memory: we can turn bits from '1' to '0' -# + flash.write(spiffs.start , b) #- block #0 -# + flash.write(spiffs.start + 0x1000, b) #- block #1 -# + end + # switch to safeboot `factory` partition def switch_factory(force_ota) import flash diff --git a/lib/libesp32/berry_tasmota/src/embedded/partition_core_shelly.be b/lib/libesp32/berry_tasmota/src/embedded/partition_core_shelly.be index 620cc352d..289107cc4 100644 --- a/lib/libesp32/berry_tasmota/src/embedded/partition_core_shelly.be +++ b/lib/libesp32/berry_tasmota/src/embedded/partition_core_shelly.be @@ -602,6 +602,19 @@ class Partition end end + #- invalidate SPIFFS partition to force format at next boot -# + #- we simply erase the first byte of the first 2 blocks in the SPIFFS partition -# + def invalidate_spiffs() + import flash + #- we expect the SPIFFS partition to be the last one -# + var spiffs = self.slots[-1] + if !spiffs.is_spiffs() raise 'value_error', 'No FS partition found' end + + var b = bytes("00") #- flash memory: we can turn bits from '1' to '0' -# + flash.write(spiffs.start , b) #- block #0 -# + flash.write(spiffs.start + 0x1000, b) #- block #1 -# + end + # switch to safeboot `factory` partition def switch_factory(force_ota) import flash diff --git a/lib/libesp32/berry_tasmota/src/embedded/tasmota_class.be b/lib/libesp32/berry_tasmota/src/embedded/tasmota_class.be index 2259e0a68..b25620118 100644 --- a/lib/libesp32/berry_tasmota/src/embedded/tasmota_class.be +++ b/lib/libesp32/berry_tasmota/src/embedded/tasmota_class.be @@ -428,6 +428,10 @@ class Tasmota return true except .. as e, m print(format("BRY: failed to run compiled code '%s' - %s", e, m)) + if self._debug_present + import debug + debug.traceback() + end end end return false diff --git a/lib/libesp32/berry_tasmota/src/solidify/solidified_animate_module.h b/lib/libesp32/berry_tasmota/src/solidify/solidified_animate_module.h index a153a3817..5d0f45c10 100644 --- a/lib/libesp32/berry_tasmota/src/solidify/solidified_animate_module.h +++ b/lib/libesp32/berry_tasmota/src/solidify/solidified_animate_module.h @@ -4,6 +4,901 @@ \********************************************************************/ #include "be_constobj.h" +extern const bclass be_class_Animate_palette; + +/******************************************************************** +** Solidified function: to_css_gradient +********************************************************************/ +be_local_closure(Animate_palette_to_css_gradient, /* name */ + be_nested_proto( + 15, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 9]) { /* constants */ + /* K0 */ be_nested_str_weak(parse_palette), + /* K1 */ be_const_int(0), + /* K2 */ be_nested_str_weak(background_X3Alinear_X2Dgradient_X28to_X20right), + /* K3 */ be_nested_str_weak(palette), + /* K4 */ be_nested_str_weak(get), + /* K5 */ be_nested_str_weak(_X2C_X23_X2502X_X2502X_X2502X_X20_X25_X2E1f_X25_X25), + /* K6 */ be_const_real_hex(0x41200000), + /* K7 */ be_const_int(1), + /* K8 */ be_nested_str_weak(_X29_X3B), + }), + be_str_weak(to_css_gradient), + &be_const_str_solidified, + ( &(const binstruction[42]) { /* code */ + 0x8C040100, // 0000 GETMET R1 R0 K0 + 0x580C0001, // 0001 LDCONST R3 K1 + 0x541203E7, // 0002 LDINT R4 1000 + 0x7C040600, // 0003 CALL R1 3 + 0x58080002, // 0004 LDCONST R2 K2 + 0x580C0001, // 0005 LDCONST R3 K1 + 0x6010000C, // 0006 GETGBL R4 G12 + 0x5C140200, // 0007 MOVE R5 R1 + 0x7C100200, // 0008 CALL R4 1 + 0x14100604, // 0009 LT R4 R3 R4 + 0x7812001C, // 000A JMPF R4 #0028 + 0x94100203, // 000B GETIDX R4 R1 R3 + 0x88140103, // 000C GETMBR R5 R0 K3 + 0x8C140B04, // 000D GETMET R5 R5 K4 + 0x541E0003, // 000E LDINT R7 4 + 0x081C0607, // 000F MUL R7 R3 R7 + 0x54220003, // 0010 LDINT R8 4 + 0x7C140600, // 0011 CALL R5 3 + 0x541A0007, // 0012 LDINT R6 8 + 0x3C180A06, // 0013 SHR R6 R5 R6 + 0x541E00FE, // 0014 LDINT R7 255 + 0x2C180C07, // 0015 AND R6 R6 R7 + 0x541E000F, // 0016 LDINT R7 16 + 0x3C1C0A07, // 0017 SHR R7 R5 R7 + 0x542200FE, // 0018 LDINT R8 255 + 0x2C1C0E08, // 0019 AND R7 R7 R8 + 0x54220017, // 001A LDINT R8 24 + 0x3C200A08, // 001B SHR R8 R5 R8 + 0x542600FE, // 001C LDINT R9 255 + 0x2C201009, // 001D AND R8 R8 R9 + 0x60240018, // 001E GETGBL R9 G24 + 0x58280005, // 001F LDCONST R10 K5 + 0x5C2C0C00, // 0020 MOVE R11 R6 + 0x5C300E00, // 0021 MOVE R12 R7 + 0x5C341000, // 0022 MOVE R13 R8 + 0x0C380906, // 0023 DIV R14 R4 K6 + 0x7C240A00, // 0024 CALL R9 5 + 0x00080409, // 0025 ADD R2 R2 R9 + 0x000C0707, // 0026 ADD R3 R3 K7 + 0x7001FFDD, // 0027 JMP #0006 + 0x00080508, // 0028 ADD R2 R2 K8 + 0x80040400, // 0029 RET 1 R2 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: parse_palette +********************************************************************/ +be_local_closure(Animate_palette_parse_palette, /* name */ + be_nested_proto( + 15, /* nstack */ + 3, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 8]) { /* constants */ + /* K0 */ be_nested_str_weak(slots), + /* K1 */ be_nested_str_weak(resize), + /* K2 */ be_nested_str_weak(palette), + /* K3 */ be_nested_str_weak(get), + /* K4 */ be_const_int(0), + /* K5 */ be_const_int(1), + /* K6 */ be_nested_str_weak(tasmota), + /* K7 */ be_nested_str_weak(scale_int), + }), + be_str_weak(parse_palette), + &be_const_str_solidified, + ( &(const binstruction[71]) { /* code */ + 0x600C0012, // 0000 GETGBL R3 G18 + 0x7C0C0000, // 0001 CALL R3 0 + 0x88100100, // 0002 GETMBR R4 R0 K0 + 0x8C140701, // 0003 GETMET R5 R3 K1 + 0x5C1C0800, // 0004 MOVE R7 R4 + 0x7C140400, // 0005 CALL R5 2 + 0x88140102, // 0006 GETMBR R5 R0 K2 + 0x8C140B03, // 0007 GETMET R5 R5 K3 + 0x581C0004, // 0008 LDCONST R7 K4 + 0x58200005, // 0009 LDCONST R8 K5 + 0x7C140600, // 000A CALL R5 3 + 0x20140B04, // 000B NE R5 R5 K4 + 0x78160024, // 000C JMPF R5 #0032 + 0x58140004, // 000D LDCONST R5 K4 + 0x58180004, // 000E LDCONST R6 K4 + 0x041C0905, // 000F SUB R7 R4 K5 + 0x141C0C07, // 0010 LT R7 R6 R7 + 0x781E0008, // 0011 JMPF R7 #001B + 0x881C0102, // 0012 GETMBR R7 R0 K2 + 0x8C1C0F03, // 0013 GETMET R7 R7 K3 + 0x54260003, // 0014 LDINT R9 4 + 0x08240C09, // 0015 MUL R9 R6 R9 + 0x58280005, // 0016 LDCONST R10 K5 + 0x7C1C0600, // 0017 CALL R7 3 + 0x00140A07, // 0018 ADD R5 R5 R7 + 0x00180D05, // 0019 ADD R6 R6 K5 + 0x7001FFF3, // 001A JMP #000F + 0x581C0004, // 001B LDCONST R7 K4 + 0x58180004, // 001C LDCONST R6 K4 + 0x14200C04, // 001D LT R8 R6 R4 + 0x78220011, // 001E JMPF R8 #0031 + 0xB8220C00, // 001F GETNGBL R8 K6 + 0x8C201107, // 0020 GETMET R8 R8 K7 + 0x5C280E00, // 0021 MOVE R10 R7 + 0x582C0004, // 0022 LDCONST R11 K4 + 0x5C300A00, // 0023 MOVE R12 R5 + 0x5C340200, // 0024 MOVE R13 R1 + 0x5C380400, // 0025 MOVE R14 R2 + 0x7C200C00, // 0026 CALL R8 6 + 0x980C0C08, // 0027 SETIDX R3 R6 R8 + 0x88200102, // 0028 GETMBR R8 R0 K2 + 0x8C201103, // 0029 GETMET R8 R8 K3 + 0x542A0003, // 002A LDINT R10 4 + 0x08280C0A, // 002B MUL R10 R6 R10 + 0x582C0005, // 002C LDCONST R11 K5 + 0x7C200600, // 002D CALL R8 3 + 0x001C0E08, // 002E ADD R7 R7 R8 + 0x00180D05, // 002F ADD R6 R6 K5 + 0x7001FFEB, // 0030 JMP #001D + 0x70020013, // 0031 JMP #0046 + 0x58140004, // 0032 LDCONST R5 K4 + 0x14180A04, // 0033 LT R6 R5 R4 + 0x781A0010, // 0034 JMPF R6 #0046 + 0x88180102, // 0035 GETMBR R6 R0 K2 + 0x8C180D03, // 0036 GETMET R6 R6 K3 + 0x54220003, // 0037 LDINT R8 4 + 0x08200A08, // 0038 MUL R8 R5 R8 + 0x58240005, // 0039 LDCONST R9 K5 + 0x7C180600, // 003A CALL R6 3 + 0xB81E0C00, // 003B GETNGBL R7 K6 + 0x8C1C0F07, // 003C GETMET R7 R7 K7 + 0x5C240C00, // 003D MOVE R9 R6 + 0x58280004, // 003E LDCONST R10 K4 + 0x542E00FE, // 003F LDINT R11 255 + 0x5C300200, // 0040 MOVE R12 R1 + 0x5C340400, // 0041 MOVE R13 R2 + 0x7C1C0C00, // 0042 CALL R7 6 + 0x980C0A07, // 0043 SETIDX R3 R5 R7 + 0x00140B05, // 0044 ADD R5 R5 K5 + 0x7001FFEC, // 0045 JMP #0033 + 0x80040600, // 0046 RET 1 R3 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: init +********************************************************************/ +be_local_closure(Animate_palette_init, /* name */ + be_nested_proto( + 7, /* nstack */ + 3, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 8]) { /* constants */ + /* K0 */ be_nested_str_weak(running), + /* K1 */ be_nested_str_weak(palette), + /* K2 */ be_nested_str_weak(bri), + /* K3 */ be_nested_str_weak(slots), + /* K4 */ be_nested_str_weak(set_duration), + /* K5 */ be_nested_str_weak(color), + /* K6 */ be_nested_str_weak(light_state), + /* K7 */ be_nested_str_weak(RGB), + }), + be_str_weak(init), + &be_const_str_solidified, + ( &(const binstruction[26]) { /* code */ + 0x500C0000, // 0000 LDBOOL R3 0 0 + 0x90020003, // 0001 SETMBR R0 K0 R3 + 0x90020201, // 0002 SETMBR R0 K1 R1 + 0x540E0063, // 0003 LDINT R3 100 + 0x90020403, // 0004 SETMBR R0 K2 R3 + 0x600C000C, // 0005 GETGBL R3 G12 + 0x5C100200, // 0006 MOVE R4 R1 + 0x7C0C0200, // 0007 CALL R3 1 + 0x54120003, // 0008 LDINT R4 4 + 0x0C0C0604, // 0009 DIV R3 R3 R4 + 0x90020603, // 000A SETMBR R0 K3 R3 + 0x4C0C0000, // 000B LDNIL R3 + 0x200C0403, // 000C NE R3 R2 R3 + 0x780E0005, // 000D JMPF R3 #0014 + 0x8C0C0104, // 000E GETMET R3 R0 K4 + 0x60140009, // 000F GETGBL R5 G9 + 0x541A03E7, // 0010 LDINT R6 1000 + 0x08180406, // 0011 MUL R6 R2 R6 + 0x7C140200, // 0012 CALL R5 1 + 0x7C0C0400, // 0013 CALL R3 2 + 0xB80E0C00, // 0014 GETNGBL R3 K6 + 0xB8120C00, // 0015 GETNGBL R4 K6 + 0x88100907, // 0016 GETMBR R4 R4 K7 + 0x7C0C0200, // 0017 CALL R3 1 + 0x90020A03, // 0018 SETMBR R0 K5 R3 + 0x80000000, // 0019 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_cb +********************************************************************/ +be_local_closure(Animate_palette_set_cb, /* name */ + be_nested_proto( + 3, /* nstack */ + 3, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str_weak(animate_obj), + /* K1 */ be_nested_str_weak(animate_mth), + }), + be_str_weak(set_cb), + &be_const_str_solidified, + ( &(const binstruction[ 3]) { /* code */ + 0x90020001, // 0000 SETMBR R0 K0 R1 + 0x90020202, // 0001 SETMBR R0 K1 R2 + 0x80000000, // 0002 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: stop +********************************************************************/ +be_local_closure(Animate_palette_stop, /* name */ + be_nested_proto( + 2, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str_weak(origin), + /* K1 */ be_nested_str_weak(running), + }), + be_str_weak(stop), + &be_const_str_solidified, + ( &(const binstruction[ 5]) { /* code */ + 0x4C040000, // 0000 LDNIL R1 + 0x90020001, // 0001 SETMBR R0 K0 R1 + 0x50040000, // 0002 LDBOOL R1 0 0 + 0x90020201, // 0003 SETMBR R0 K1 R1 + 0x80000000, // 0004 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: animate +********************************************************************/ +be_local_closure(Animate_palette_animate, /* name */ + be_nested_proto( + 26, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[21]) { /* constants */ + /* K0 */ be_nested_str_weak(duration_ms), + /* K1 */ be_nested_str_weak(tasmota), + /* K2 */ be_nested_str_weak(millis), + /* K3 */ be_nested_str_weak(origin), + /* K4 */ be_const_int(0), + /* K5 */ be_nested_str_weak(scale_uint), + /* K6 */ be_nested_str_weak(slots), + /* K7 */ be_const_int(2), + /* K8 */ be_nested_str_weak(slots_arr), + /* K9 */ be_const_int(1), + /* K10 */ be_nested_str_weak(palette), + /* K11 */ be_nested_str_weak(get), + /* K12 */ be_nested_str_weak(color), + /* K13 */ be_nested_str_weak(set_rgb), + /* K14 */ be_nested_str_weak(bri), + /* K15 */ be_nested_str_weak(set_bri), + /* K16 */ be_nested_str_weak(r), + /* K17 */ be_nested_str_weak(g), + /* K18 */ be_nested_str_weak(b), + /* K19 */ be_nested_str_weak(animate_obj), + /* K20 */ be_nested_str_weak(animate_mth), + }), + be_str_weak(animate), + &be_const_str_solidified, + ( &(const binstruction[193]) { /* code */ + 0x88080100, // 0000 GETMBR R2 R0 K0 + 0x4C0C0000, // 0001 LDNIL R3 + 0x1C080403, // 0002 EQ R2 R2 R3 + 0x780A0000, // 0003 JMPF R2 #0005 + 0x80000400, // 0004 RET 0 + 0x4C080000, // 0005 LDNIL R2 + 0x1C080202, // 0006 EQ R2 R1 R2 + 0x780A0003, // 0007 JMPF R2 #000C + 0xB80A0200, // 0008 GETNGBL R2 K1 + 0x8C080502, // 0009 GETMET R2 R2 K2 + 0x7C080200, // 000A CALL R2 1 + 0x5C040400, // 000B MOVE R1 R2 + 0x88080103, // 000C GETMBR R2 R0 K3 + 0x04080202, // 000D SUB R2 R1 R2 + 0x140C0504, // 000E LT R3 R2 K4 + 0x780E0001, // 000F JMPF R3 #0012 + 0x58080004, // 0010 LDCONST R2 K4 + 0x88040103, // 0011 GETMBR R1 R0 K3 + 0x880C0100, // 0012 GETMBR R3 R0 K0 + 0xB8120200, // 0013 GETNGBL R4 K1 + 0x88100905, // 0014 GETMBR R4 R4 K5 + 0x28140403, // 0015 GE R5 R2 R3 + 0x78160005, // 0016 JMPF R5 #001D + 0x0C180403, // 0017 DIV R6 R2 R3 + 0x08180C03, // 0018 MUL R6 R6 R3 + 0x88140103, // 0019 GETMBR R5 R0 K3 + 0x00140A06, // 001A ADD R5 R5 R6 + 0x90020605, // 001B SETMBR R0 K3 R5 + 0x10080403, // 001C MOD R2 R2 R3 + 0x88140106, // 001D GETMBR R5 R0 K6 + 0x04180B07, // 001E SUB R6 R5 K7 + 0x241C0D04, // 001F GT R7 R6 K4 + 0x781E0006, // 0020 JMPF R7 #0028 + 0x881C0108, // 0021 GETMBR R7 R0 K8 + 0x941C0E06, // 0022 GETIDX R7 R7 R6 + 0x281C0407, // 0023 GE R7 R2 R7 + 0x781E0000, // 0024 JMPF R7 #0026 + 0x70020001, // 0025 JMP #0028 + 0x04180D09, // 0026 SUB R6 R6 K9 + 0x7001FFF6, // 0027 JMP #001F + 0x881C010A, // 0028 GETMBR R7 R0 K10 + 0x8C1C0F0B, // 0029 GETMET R7 R7 K11 + 0x54260003, // 002A LDINT R9 4 + 0x08240C09, // 002B MUL R9 R6 R9 + 0x542A0003, // 002C LDINT R10 4 + 0x7C1C0600, // 002D CALL R7 3 + 0x8820010A, // 002E GETMBR R8 R0 K10 + 0x8C20110B, // 002F GETMET R8 R8 K11 + 0x00280D09, // 0030 ADD R10 R6 K9 + 0x542E0003, // 0031 LDINT R11 4 + 0x0828140B, // 0032 MUL R10 R10 R11 + 0x542E0003, // 0033 LDINT R11 4 + 0x7C200600, // 0034 CALL R8 3 + 0x88240108, // 0035 GETMBR R9 R0 K8 + 0x94241206, // 0036 GETIDX R9 R9 R6 + 0x00280D09, // 0037 ADD R10 R6 K9 + 0x882C0108, // 0038 GETMBR R11 R0 K8 + 0x9428160A, // 0039 GETIDX R10 R11 R10 + 0x5C300800, // 003A MOVE R12 R4 + 0x5C340400, // 003B MOVE R13 R2 + 0x5C381200, // 003C MOVE R14 R9 + 0x5C3C1400, // 003D MOVE R15 R10 + 0x54420007, // 003E LDINT R16 8 + 0x3C400E10, // 003F SHR R16 R7 R16 + 0x544600FE, // 0040 LDINT R17 255 + 0x2C402011, // 0041 AND R16 R16 R17 + 0x54460007, // 0042 LDINT R17 8 + 0x3C441011, // 0043 SHR R17 R8 R17 + 0x544A00FE, // 0044 LDINT R18 255 + 0x2C442212, // 0045 AND R17 R17 R18 + 0x7C300A00, // 0046 CALL R12 5 + 0x5C2C1800, // 0047 MOVE R11 R12 + 0x5C300800, // 0048 MOVE R12 R4 + 0x5C340400, // 0049 MOVE R13 R2 + 0x5C381200, // 004A MOVE R14 R9 + 0x5C3C1400, // 004B MOVE R15 R10 + 0x5442000F, // 004C LDINT R16 16 + 0x3C400E10, // 004D SHR R16 R7 R16 + 0x544600FE, // 004E LDINT R17 255 + 0x2C402011, // 004F AND R16 R16 R17 + 0x5446000F, // 0050 LDINT R17 16 + 0x3C441011, // 0051 SHR R17 R8 R17 + 0x544A00FE, // 0052 LDINT R18 255 + 0x2C442212, // 0053 AND R17 R17 R18 + 0x7C300A00, // 0054 CALL R12 5 + 0x5C340800, // 0055 MOVE R13 R4 + 0x5C380400, // 0056 MOVE R14 R2 + 0x5C3C1200, // 0057 MOVE R15 R9 + 0x5C401400, // 0058 MOVE R16 R10 + 0x54460017, // 0059 LDINT R17 24 + 0x3C440E11, // 005A SHR R17 R7 R17 + 0x544A00FE, // 005B LDINT R18 255 + 0x2C442212, // 005C AND R17 R17 R18 + 0x544A0017, // 005D LDINT R18 24 + 0x3C481012, // 005E SHR R18 R8 R18 + 0x544E00FE, // 005F LDINT R19 255 + 0x2C482413, // 0060 AND R18 R18 R19 + 0x7C340A00, // 0061 CALL R13 5 + 0x8838010C, // 0062 GETMBR R14 R0 K12 + 0x8C3C1D0D, // 0063 GETMET R15 R14 K13 + 0x54460007, // 0064 LDINT R17 8 + 0x3C440E11, // 0065 SHR R17 R7 R17 + 0x544A00FE, // 0066 LDINT R18 255 + 0x2C442212, // 0067 AND R17 R17 R18 + 0x544A000F, // 0068 LDINT R18 16 + 0x3C480E12, // 0069 SHR R18 R7 R18 + 0x544E00FE, // 006A LDINT R19 255 + 0x2C482413, // 006B AND R18 R18 R19 + 0x544E0017, // 006C LDINT R19 24 + 0x3C4C0E13, // 006D SHR R19 R7 R19 + 0x545200FE, // 006E LDINT R20 255 + 0x2C4C2614, // 006F AND R19 R19 R20 + 0x7C3C0800, // 0070 CALL R15 4 + 0x883C1D0E, // 0071 GETMBR R15 R14 K14 + 0x8C401D0D, // 0072 GETMET R16 R14 K13 + 0x544A0007, // 0073 LDINT R18 8 + 0x3C481012, // 0074 SHR R18 R8 R18 + 0x544E00FE, // 0075 LDINT R19 255 + 0x2C482413, // 0076 AND R18 R18 R19 + 0x544E000F, // 0077 LDINT R19 16 + 0x3C4C1013, // 0078 SHR R19 R8 R19 + 0x545200FE, // 0079 LDINT R20 255 + 0x2C4C2614, // 007A AND R19 R19 R20 + 0x54520017, // 007B LDINT R20 24 + 0x3C501014, // 007C SHR R20 R8 R20 + 0x545600FE, // 007D LDINT R21 255 + 0x2C502815, // 007E AND R20 R20 R21 + 0x7C400800, // 007F CALL R16 4 + 0x88401D0E, // 0080 GETMBR R16 R14 K14 + 0x5C440800, // 0081 MOVE R17 R4 + 0x5C480400, // 0082 MOVE R18 R2 + 0x5C4C1200, // 0083 MOVE R19 R9 + 0x5C501400, // 0084 MOVE R20 R10 + 0x5C541E00, // 0085 MOVE R21 R15 + 0x5C582000, // 0086 MOVE R22 R16 + 0x7C440A00, // 0087 CALL R17 5 + 0x8C481D0D, // 0088 GETMET R18 R14 K13 + 0x5C501600, // 0089 MOVE R20 R11 + 0x5C541800, // 008A MOVE R21 R12 + 0x5C581A00, // 008B MOVE R22 R13 + 0x7C480800, // 008C CALL R18 4 + 0x8C481D0F, // 008D GETMET R18 R14 K15 + 0x5C502200, // 008E MOVE R20 R17 + 0x7C480400, // 008F CALL R18 2 + 0x882C1D10, // 0090 GETMBR R11 R14 K16 + 0x88301D11, // 0091 GETMBR R12 R14 K17 + 0x88341D12, // 0092 GETMBR R13 R14 K18 + 0x8848010E, // 0093 GETMBR R18 R0 K14 + 0x544E0063, // 0094 LDINT R19 100 + 0x204C2413, // 0095 NE R19 R18 R19 + 0x784E001A, // 0096 JMPF R19 #00B2 + 0xB84E0200, // 0097 GETNGBL R19 K1 + 0x8C4C2705, // 0098 GETMET R19 R19 K5 + 0x5C541600, // 0099 MOVE R21 R11 + 0x58580004, // 009A LDCONST R22 K4 + 0x545E0063, // 009B LDINT R23 100 + 0x58600004, // 009C LDCONST R24 K4 + 0x5C642400, // 009D MOVE R25 R18 + 0x7C4C0C00, // 009E CALL R19 6 + 0x5C2C2600, // 009F MOVE R11 R19 + 0xB84E0200, // 00A0 GETNGBL R19 K1 + 0x8C4C2705, // 00A1 GETMET R19 R19 K5 + 0x5C541800, // 00A2 MOVE R21 R12 + 0x58580004, // 00A3 LDCONST R22 K4 + 0x545E0063, // 00A4 LDINT R23 100 + 0x58600004, // 00A5 LDCONST R24 K4 + 0x5C642400, // 00A6 MOVE R25 R18 + 0x7C4C0C00, // 00A7 CALL R19 6 + 0x5C302600, // 00A8 MOVE R12 R19 + 0xB84E0200, // 00A9 GETNGBL R19 K1 + 0x8C4C2705, // 00AA GETMET R19 R19 K5 + 0x5C541A00, // 00AB MOVE R21 R13 + 0x58580004, // 00AC LDCONST R22 K4 + 0x545E0063, // 00AD LDINT R23 100 + 0x58600004, // 00AE LDCONST R24 K4 + 0x5C642400, // 00AF MOVE R25 R18 + 0x7C4C0C00, // 00B0 CALL R19 6 + 0x5C342600, // 00B1 MOVE R13 R19 + 0x544E000F, // 00B2 LDINT R19 16 + 0x384C1613, // 00B3 SHL R19 R11 R19 + 0x54520007, // 00B4 LDINT R20 8 + 0x38501814, // 00B5 SHL R20 R12 R20 + 0x304C2614, // 00B6 OR R19 R19 R20 + 0x304C260D, // 00B7 OR R19 R19 R13 + 0x88500113, // 00B8 GETMBR R20 R0 K19 + 0x88540114, // 00B9 GETMBR R21 R0 K20 + 0x78520004, // 00BA JMPF R20 #00C0 + 0x78560003, // 00BB JMPF R21 #00C0 + 0x5C582A00, // 00BC MOVE R22 R21 + 0x5C5C2800, // 00BD MOVE R23 R20 + 0x5C602600, // 00BE MOVE R24 R19 + 0x7C580400, // 00BF CALL R22 2 + 0x80042600, // 00C0 RET 1 R19 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_range +********************************************************************/ +be_local_closure(Animate_palette_set_range, /* name */ + be_nested_proto( + 7, /* nstack */ + 3, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 6]) { /* constants */ + /* K0 */ be_nested_str_weak(value_error), + /* K1 */ be_nested_str_weak(min_X20must_X20be_X20lower_X20than_X20mex), + /* K2 */ be_nested_str_weak(range_min), + /* K3 */ be_nested_str_weak(range_max), + /* K4 */ be_nested_str_weak(slots_arr), + /* K5 */ be_nested_str_weak(parse_palette), + }), + be_str_weak(set_range), + &be_const_str_solidified, + ( &(const binstruction[11]) { /* code */ + 0x280C0202, // 0000 GE R3 R1 R2 + 0x780E0000, // 0001 JMPF R3 #0003 + 0xB0060101, // 0002 RAISE 1 K0 K1 + 0x90020401, // 0003 SETMBR R0 K2 R1 + 0x90020602, // 0004 SETMBR R0 K3 R2 + 0x8C0C0105, // 0005 GETMET R3 R0 K5 + 0x5C140200, // 0006 MOVE R5 R1 + 0x5C180400, // 0007 MOVE R6 R2 + 0x7C0C0600, // 0008 CALL R3 3 + 0x90020803, // 0009 SETMBR R0 K4 R3 + 0x80000000, // 000A RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_bri +********************************************************************/ +be_local_closure(Animate_palette_set_bri, /* name */ + be_nested_proto( + 4, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str_weak(bri), + }), + be_str_weak(set_bri), + &be_const_str_solidified, + ( &(const binstruction[ 5]) { /* code */ + 0x60080009, // 0000 GETGBL R2 G9 + 0x5C0C0200, // 0001 MOVE R3 R1 + 0x7C080200, // 0002 CALL R2 1 + 0x90020002, // 0003 SETMBR R0 K0 R2 + 0x80000000, // 0004 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: is_running +********************************************************************/ +be_local_closure(Animate_palette_is_running, /* name */ + be_nested_proto( + 3, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str_weak(running), + }), + be_str_weak(is_running), + &be_const_str_solidified, + ( &(const binstruction[ 4]) { /* code */ + 0x60040017, // 0000 GETGBL R1 G23 + 0x88080100, // 0001 GETMBR R2 R0 K0 + 0x7C040200, // 0002 CALL R1 1 + 0x80040200, // 0003 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_duration +********************************************************************/ +be_local_closure(Animate_palette_set_duration, /* name */ + be_nested_proto( + 6, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 7]) { /* constants */ + /* K0 */ be_const_int(0), + /* K1 */ be_nested_str_weak(value_error), + /* K2 */ be_nested_str_weak(duration_ms_X20must_X20be_X20positive), + /* K3 */ be_nested_str_weak(duration_ms), + /* K4 */ be_nested_str_weak(slots_arr), + /* K5 */ be_nested_str_weak(parse_palette), + /* K6 */ be_const_int(1), + }), + be_str_weak(set_duration), + &be_const_str_solidified, + ( &(const binstruction[14]) { /* code */ + 0x4C080000, // 0000 LDNIL R2 + 0x1C080202, // 0001 EQ R2 R1 R2 + 0x780A0000, // 0002 JMPF R2 #0004 + 0x80000400, // 0003 RET 0 + 0x18080300, // 0004 LE R2 R1 K0 + 0x780A0000, // 0005 JMPF R2 #0007 + 0xB0060302, // 0006 RAISE 1 K1 K2 + 0x90020601, // 0007 SETMBR R0 K3 R1 + 0x8C080105, // 0008 GETMET R2 R0 K5 + 0x58100000, // 0009 LDCONST R4 K0 + 0x04140306, // 000A SUB R5 R1 K6 + 0x7C080600, // 000B CALL R2 3 + 0x90020802, // 000C SETMBR R0 K4 R2 + 0x80000000, // 000D RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_value +********************************************************************/ +be_local_closure(Animate_palette_set_value, /* name */ + be_nested_proto( + 18, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[13]) { /* constants */ + /* K0 */ be_nested_str_weak(range_min), + /* K1 */ be_nested_str_weak(range_max), + /* K2 */ be_nested_str_weak(tasmota), + /* K3 */ be_nested_str_weak(scale_int), + /* K4 */ be_nested_str_weak(slots), + /* K5 */ be_const_int(2), + /* K6 */ be_const_int(0), + /* K7 */ be_nested_str_weak(slots_arr), + /* K8 */ be_const_int(1), + /* K9 */ be_nested_str_weak(palette), + /* K10 */ be_nested_str_weak(get), + /* K11 */ be_nested_str_weak(animate_obj), + /* K12 */ be_nested_str_weak(animate_mth), + }), + be_str_weak(set_value), + &be_const_str_solidified, + ( &(const binstruction[96]) { /* code */ + 0x88080100, // 0000 GETMBR R2 R0 K0 + 0x4C0C0000, // 0001 LDNIL R3 + 0x1C080403, // 0002 EQ R2 R2 R3 + 0x740A0003, // 0003 JMPT R2 #0008 + 0x88080101, // 0004 GETMBR R2 R0 K1 + 0x4C0C0000, // 0005 LDNIL R3 + 0x1C080403, // 0006 EQ R2 R2 R3 + 0x780A0001, // 0007 JMPF R2 #000A + 0x4C080000, // 0008 LDNIL R2 + 0x80040400, // 0009 RET 1 R2 + 0xB80A0400, // 000A GETNGBL R2 K2 + 0x88080503, // 000B GETMBR R2 R2 K3 + 0x880C0104, // 000C GETMBR R3 R0 K4 + 0x04100705, // 000D SUB R4 R3 K5 + 0x24140906, // 000E GT R5 R4 K6 + 0x78160006, // 000F JMPF R5 #0017 + 0x88140107, // 0010 GETMBR R5 R0 K7 + 0x94140A04, // 0011 GETIDX R5 R5 R4 + 0x28140205, // 0012 GE R5 R1 R5 + 0x78160000, // 0013 JMPF R5 #0015 + 0x70020001, // 0014 JMP #0017 + 0x04100908, // 0015 SUB R4 R4 K8 + 0x7001FFF6, // 0016 JMP #000E + 0x88140109, // 0017 GETMBR R5 R0 K9 + 0x8C140B0A, // 0018 GETMET R5 R5 K10 + 0x541E0003, // 0019 LDINT R7 4 + 0x081C0807, // 001A MUL R7 R4 R7 + 0x54220003, // 001B LDINT R8 4 + 0x7C140600, // 001C CALL R5 3 + 0x88180109, // 001D GETMBR R6 R0 K9 + 0x8C180D0A, // 001E GETMET R6 R6 K10 + 0x00200908, // 001F ADD R8 R4 K8 + 0x54260003, // 0020 LDINT R9 4 + 0x08201009, // 0021 MUL R8 R8 R9 + 0x54260003, // 0022 LDINT R9 4 + 0x7C180600, // 0023 CALL R6 3 + 0x881C0107, // 0024 GETMBR R7 R0 K7 + 0x941C0E04, // 0025 GETIDX R7 R7 R4 + 0x00200908, // 0026 ADD R8 R4 K8 + 0x88240107, // 0027 GETMBR R9 R0 K7 + 0x94201208, // 0028 GETIDX R8 R9 R8 + 0x5C280400, // 0029 MOVE R10 R2 + 0x5C2C0200, // 002A MOVE R11 R1 + 0x5C300E00, // 002B MOVE R12 R7 + 0x5C341000, // 002C MOVE R13 R8 + 0x543A0007, // 002D LDINT R14 8 + 0x3C380A0E, // 002E SHR R14 R5 R14 + 0x543E00FE, // 002F LDINT R15 255 + 0x2C381C0F, // 0030 AND R14 R14 R15 + 0x543E0007, // 0031 LDINT R15 8 + 0x3C3C0C0F, // 0032 SHR R15 R6 R15 + 0x544200FE, // 0033 LDINT R16 255 + 0x2C3C1E10, // 0034 AND R15 R15 R16 + 0x7C280A00, // 0035 CALL R10 5 + 0x5C241400, // 0036 MOVE R9 R10 + 0x5C280400, // 0037 MOVE R10 R2 + 0x5C2C0200, // 0038 MOVE R11 R1 + 0x5C300E00, // 0039 MOVE R12 R7 + 0x5C341000, // 003A MOVE R13 R8 + 0x543A000F, // 003B LDINT R14 16 + 0x3C380A0E, // 003C SHR R14 R5 R14 + 0x543E00FE, // 003D LDINT R15 255 + 0x2C381C0F, // 003E AND R14 R14 R15 + 0x543E000F, // 003F LDINT R15 16 + 0x3C3C0C0F, // 0040 SHR R15 R6 R15 + 0x544200FE, // 0041 LDINT R16 255 + 0x2C3C1E10, // 0042 AND R15 R15 R16 + 0x7C280A00, // 0043 CALL R10 5 + 0x5C2C0400, // 0044 MOVE R11 R2 + 0x5C300200, // 0045 MOVE R12 R1 + 0x5C340E00, // 0046 MOVE R13 R7 + 0x5C381000, // 0047 MOVE R14 R8 + 0x543E0017, // 0048 LDINT R15 24 + 0x3C3C0A0F, // 0049 SHR R15 R5 R15 + 0x544200FE, // 004A LDINT R16 255 + 0x2C3C1E10, // 004B AND R15 R15 R16 + 0x54420017, // 004C LDINT R16 24 + 0x3C400C10, // 004D SHR R16 R6 R16 + 0x544600FE, // 004E LDINT R17 255 + 0x2C402011, // 004F AND R16 R16 R17 + 0x7C2C0A00, // 0050 CALL R11 5 + 0x5432000F, // 0051 LDINT R12 16 + 0x3830120C, // 0052 SHL R12 R9 R12 + 0x54360007, // 0053 LDINT R13 8 + 0x3834140D, // 0054 SHL R13 R10 R13 + 0x3030180D, // 0055 OR R12 R12 R13 + 0x3030180B, // 0056 OR R12 R12 R11 + 0x8834010B, // 0057 GETMBR R13 R0 K11 + 0x8838010C, // 0058 GETMBR R14 R0 K12 + 0x78360004, // 0059 JMPF R13 #005F + 0x783A0003, // 005A JMPF R14 #005F + 0x5C3C1C00, // 005B MOVE R15 R14 + 0x5C401A00, // 005C MOVE R16 R13 + 0x5C441800, // 005D MOVE R17 R12 + 0x7C3C0400, // 005E CALL R15 2 + 0x80041800, // 005F RET 1 R12 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: start +********************************************************************/ +be_local_closure(Animate_palette_start, /* name */ + be_nested_proto( + 4, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 5]) { /* constants */ + /* K0 */ be_nested_str_weak(duration_ms), + /* K1 */ be_nested_str_weak(tasmota), + /* K2 */ be_nested_str_weak(millis), + /* K3 */ be_nested_str_weak(origin), + /* K4 */ be_nested_str_weak(running), + }), + be_str_weak(start), + &be_const_str_solidified, + ( &(const binstruction[16]) { /* code */ + 0x88080100, // 0000 GETMBR R2 R0 K0 + 0x4C0C0000, // 0001 LDNIL R3 + 0x1C080403, // 0002 EQ R2 R2 R3 + 0x780A0000, // 0003 JMPF R2 #0005 + 0x80000400, // 0004 RET 0 + 0x4C080000, // 0005 LDNIL R2 + 0x1C080202, // 0006 EQ R2 R1 R2 + 0x780A0003, // 0007 JMPF R2 #000C + 0xB80A0200, // 0008 GETNGBL R2 K1 + 0x8C080502, // 0009 GETMET R2 R2 K2 + 0x7C080200, // 000A CALL R2 1 + 0x5C040400, // 000B MOVE R1 R2 + 0x90020601, // 000C SETMBR R0 K3 R1 + 0x50080200, // 000D LDBOOL R2 1 0 + 0x90020802, // 000E SETMBR R0 K4 R2 + 0x80000000, // 000F RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified class: Animate_palette +********************************************************************/ +be_local_class(Animate_palette, + 12, + NULL, + be_nested_map(24, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_const_key_weak(start, -1), be_const_closure(Animate_palette_start_closure) }, + { be_const_key_weak(to_css_gradient, -1), be_const_closure(Animate_palette_to_css_gradient_closure) }, + { be_const_key_weak(range_min, -1), be_const_var(6) }, + { be_const_key_weak(init, -1), be_const_closure(Animate_palette_init_closure) }, + { be_const_key_weak(set_value, -1), be_const_closure(Animate_palette_set_value_closure) }, + { be_const_key_weak(stop, -1), be_const_closure(Animate_palette_stop_closure) }, + { be_const_key_weak(slots, 15), be_const_var(2) }, + { be_const_key_weak(origin, -1), be_const_var(5) }, + { be_const_key_weak(animate, 19), be_const_closure(Animate_palette_animate_closure) }, + { be_const_key_weak(set_range, 2), be_const_closure(Animate_palette_set_range_closure) }, + { be_const_key_weak(slots_arr, -1), be_const_var(1) }, + { be_const_key_weak(set_bri, -1), be_const_closure(Animate_palette_set_bri_closure) }, + { be_const_key_weak(bri, 17), be_const_var(10) }, + { be_const_key_weak(is_running, -1), be_const_closure(Animate_palette_is_running_closure) }, + { be_const_key_weak(animate_mth, -1), be_const_var(9) }, + { be_const_key_weak(duration_ms, -1), be_const_var(4) }, + { be_const_key_weak(color, -1), be_const_var(11) }, + { be_const_key_weak(set_duration, 22), be_const_closure(Animate_palette_set_duration_closure) }, + { be_const_key_weak(animate_obj, -1), be_const_var(8) }, + { be_const_key_weak(palette, -1), be_const_var(0) }, + { be_const_key_weak(parse_palette, 14), be_const_closure(Animate_palette_parse_palette_closure) }, + { be_const_key_weak(set_cb, 4), be_const_closure(Animate_palette_set_cb_closure) }, + { be_const_key_weak(running, -1), be_const_var(3) }, + { be_const_key_weak(range_max, 0), be_const_var(7) }, + })), + be_str_weak(Animate_palette) +); + extern const bclass be_class_Animate_rotate; /******************************************************************** @@ -11,8 +906,8 @@ extern const bclass be_class_Animate_rotate; ********************************************************************/ be_local_closure(Animate_rotate_init, /* name */ be_nested_proto( - 12, /* nstack */ - 5, /* argc */ + 13, /* nstack */ + 6, /* argc */ 2, /* varg */ 0, /* has upvals */ NULL, /* no upvals */ @@ -20,43 +915,46 @@ be_local_closure(Animate_rotate_init, /* name */ NULL, /* no sub protos */ 1, /* has constants */ ( &(const bvalue[ 8]) { /* constants */ - /* K0 */ be_nested_str(init), - /* K1 */ be_nested_str(closure), - /* K2 */ be_nested_str(code), - /* K3 */ be_nested_str(push), - /* K4 */ be_nested_str(animate), - /* K5 */ be_nested_str(ins_ramp), - /* K6 */ be_nested_str(ins_goto), + /* K0 */ be_nested_str_weak(init), + /* K1 */ be_nested_str_weak(set_cb), + /* K2 */ be_nested_str_weak(code), + /* K3 */ be_nested_str_weak(push), + /* K4 */ be_nested_str_weak(animate), + /* K5 */ be_nested_str_weak(ins_ramp), + /* K6 */ be_nested_str_weak(ins_goto), /* K7 */ be_const_int(0), }), - &be_const_str_init, + be_str_weak(init), &be_const_str_solidified, - ( &(const binstruction[25]) { /* code */ - 0x60140003, // 0000 GETGBL R5 G3 - 0x5C180000, // 0001 MOVE R6 R0 - 0x7C140200, // 0002 CALL R5 1 - 0x8C140B00, // 0003 GETMET R5 R5 K0 - 0x7C140200, // 0004 CALL R5 1 - 0x90020201, // 0005 SETMBR R0 K1 R1 - 0x88140102, // 0006 GETMBR R5 R0 K2 - 0x8C140B03, // 0007 GETMET R5 R5 K3 - 0xB81E0800, // 0008 GETNGBL R7 K4 - 0x8C1C0F05, // 0009 GETMET R7 R7 K5 - 0x5C240400, // 000A MOVE R9 R2 - 0x5C280600, // 000B MOVE R10 R3 - 0x5C2C0800, // 000C MOVE R11 R4 - 0x7C1C0800, // 000D CALL R7 4 - 0x7C140400, // 000E CALL R5 2 - 0x88140102, // 000F GETMBR R5 R0 K2 - 0x8C140B03, // 0010 GETMET R5 R5 K3 - 0xB81E0800, // 0011 GETNGBL R7 K4 - 0x8C1C0F06, // 0012 GETMET R7 R7 K6 - 0x58240007, // 0013 LDCONST R9 K7 - 0x58280007, // 0014 LDCONST R10 K7 - 0x582C0007, // 0015 LDCONST R11 K7 - 0x7C1C0800, // 0016 CALL R7 4 - 0x7C140400, // 0017 CALL R5 2 - 0x80000000, // 0018 RET 0 + ( &(const binstruction[28]) { /* code */ + 0x60180003, // 0000 GETGBL R6 G3 + 0x5C1C0000, // 0001 MOVE R7 R0 + 0x7C180200, // 0002 CALL R6 1 + 0x8C180D00, // 0003 GETMET R6 R6 K0 + 0x7C180200, // 0004 CALL R6 1 + 0x8C180101, // 0005 GETMET R6 R0 K1 + 0x5C200200, // 0006 MOVE R8 R1 + 0x5C240400, // 0007 MOVE R9 R2 + 0x7C180600, // 0008 CALL R6 3 + 0x88180102, // 0009 GETMBR R6 R0 K2 + 0x8C180D03, // 000A GETMET R6 R6 K3 + 0xB8220800, // 000B GETNGBL R8 K4 + 0x8C201105, // 000C GETMET R8 R8 K5 + 0x5C280600, // 000D MOVE R10 R3 + 0x5C2C0800, // 000E MOVE R11 R4 + 0x5C300A00, // 000F MOVE R12 R5 + 0x7C200800, // 0010 CALL R8 4 + 0x7C180400, // 0011 CALL R6 2 + 0x88180102, // 0012 GETMBR R6 R0 K2 + 0x8C180D03, // 0013 GETMET R6 R6 K3 + 0xB8220800, // 0014 GETNGBL R8 K4 + 0x8C201106, // 0015 GETMET R8 R8 K6 + 0x58280007, // 0016 LDCONST R10 K7 + 0x582C0007, // 0017 LDCONST R11 K7 + 0x58300007, // 0018 LDCONST R12 K7 + 0x7C200800, // 0019 CALL R8 4 + 0x7C180400, // 001A CALL R6 2 + 0x80000000, // 001B RET 0 }) ) ); @@ -72,154 +970,9 @@ be_local_class(Animate_rotate, &be_class_Animate_engine, be_nested_map(1, ( (struct bmapnode*) &(const bmapnode[]) { - { be_const_key(init, -1), be_const_closure(Animate_rotate_init_closure) }, + { be_const_key_weak(init, -1), be_const_closure(Animate_rotate_init_closure) }, })), - (bstring*) &be_const_str_Animate_rotate -); - -extern const bclass be_class_Animate_from_to; - -/******************************************************************** -** Solidified function: init -********************************************************************/ -be_local_closure(Animate_from_to_init, /* name */ - be_nested_proto( - 12, /* nstack */ - 5, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 6]) { /* constants */ - /* K0 */ be_nested_str(init), - /* K1 */ be_nested_str(closure), - /* K2 */ be_nested_str(code), - /* K3 */ be_nested_str(push), - /* K4 */ be_nested_str(animate), - /* K5 */ be_nested_str(ins_ramp), - }), - &be_const_str_init, - &be_const_str_solidified, - ( &(const binstruction[16]) { /* code */ - 0x60140003, // 0000 GETGBL R5 G3 - 0x5C180000, // 0001 MOVE R6 R0 - 0x7C140200, // 0002 CALL R5 1 - 0x8C140B00, // 0003 GETMET R5 R5 K0 - 0x7C140200, // 0004 CALL R5 1 - 0x90020201, // 0005 SETMBR R0 K1 R1 - 0x88140102, // 0006 GETMBR R5 R0 K2 - 0x8C140B03, // 0007 GETMET R5 R5 K3 - 0xB81E0800, // 0008 GETNGBL R7 K4 - 0x8C1C0F05, // 0009 GETMET R7 R7 K5 - 0x5C240400, // 000A MOVE R9 R2 - 0x5C280600, // 000B MOVE R10 R3 - 0x5C2C0800, // 000C MOVE R11 R4 - 0x7C1C0800, // 000D CALL R7 4 - 0x7C140400, // 000E CALL R5 2 - 0x80000000, // 000F RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified class: Animate_from_to -********************************************************************/ -extern const bclass be_class_Animate_engine; -be_local_class(Animate_from_to, - 0, - &be_class_Animate_engine, - be_nested_map(1, - ( (struct bmapnode*) &(const bmapnode[]) { - { be_const_key(init, -1), be_const_closure(Animate_from_to_init_closure) }, - })), - (bstring*) &be_const_str_Animate_from_to -); - -extern const bclass be_class_Animate_back_forth; - -/******************************************************************** -** Solidified function: init -********************************************************************/ -be_local_closure(Animate_back_forth_init, /* name */ - be_nested_proto( - 12, /* nstack */ - 5, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 9]) { /* constants */ - /* K0 */ be_nested_str(init), - /* K1 */ be_nested_str(closure), - /* K2 */ be_nested_str(code), - /* K3 */ be_nested_str(push), - /* K4 */ be_nested_str(animate), - /* K5 */ be_nested_str(ins_ramp), - /* K6 */ be_const_int(2), - /* K7 */ be_nested_str(ins_goto), - /* K8 */ be_const_int(0), - }), - &be_const_str_init, - &be_const_str_solidified, - ( &(const binstruction[34]) { /* code */ - 0x60140003, // 0000 GETGBL R5 G3 - 0x5C180000, // 0001 MOVE R6 R0 - 0x7C140200, // 0002 CALL R5 1 - 0x8C140B00, // 0003 GETMET R5 R5 K0 - 0x7C140200, // 0004 CALL R5 1 - 0x90020201, // 0005 SETMBR R0 K1 R1 - 0x88140102, // 0006 GETMBR R5 R0 K2 - 0x8C140B03, // 0007 GETMET R5 R5 K3 - 0xB81E0800, // 0008 GETNGBL R7 K4 - 0x8C1C0F05, // 0009 GETMET R7 R7 K5 - 0x5C240400, // 000A MOVE R9 R2 - 0x5C280600, // 000B MOVE R10 R3 - 0x0C2C0906, // 000C DIV R11 R4 K6 - 0x7C1C0800, // 000D CALL R7 4 - 0x7C140400, // 000E CALL R5 2 - 0x88140102, // 000F GETMBR R5 R0 K2 - 0x8C140B03, // 0010 GETMET R5 R5 K3 - 0xB81E0800, // 0011 GETNGBL R7 K4 - 0x8C1C0F05, // 0012 GETMET R7 R7 K5 - 0x5C240600, // 0013 MOVE R9 R3 - 0x5C280400, // 0014 MOVE R10 R2 - 0x0C2C0906, // 0015 DIV R11 R4 K6 - 0x7C1C0800, // 0016 CALL R7 4 - 0x7C140400, // 0017 CALL R5 2 - 0x88140102, // 0018 GETMBR R5 R0 K2 - 0x8C140B03, // 0019 GETMET R5 R5 K3 - 0xB81E0800, // 001A GETNGBL R7 K4 - 0x8C1C0F07, // 001B GETMET R7 R7 K7 - 0x58240008, // 001C LDCONST R9 K8 - 0x58280008, // 001D LDCONST R10 K8 - 0x582C0008, // 001E LDCONST R11 K8 - 0x7C1C0800, // 001F CALL R7 4 - 0x7C140400, // 0020 CALL R5 2 - 0x80000000, // 0021 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified class: Animate_back_forth -********************************************************************/ -extern const bclass be_class_Animate_engine; -be_local_class(Animate_back_forth, - 0, - &be_class_Animate_engine, - be_nested_map(1, - ( (struct bmapnode*) &(const bmapnode[]) { - { be_const_key(init, -1), be_const_closure(Animate_back_forth_init_closure) }, - })), - (bstring*) &be_const_str_Animate_back_forth + be_str_weak(Animate_rotate) ); extern const bclass be_class_Animate_ins_goto; @@ -238,11 +991,11 @@ be_local_closure(Animate_ins_goto_init, /* name */ NULL, /* no sub protos */ 1, /* has constants */ ( &(const bvalue[ 3]) { /* constants */ - /* K0 */ be_nested_str(pc_rel), - /* K1 */ be_nested_str(pc_abs), - /* K2 */ be_nested_str(duration), + /* K0 */ be_nested_str_weak(pc_rel), + /* K1 */ be_nested_str_weak(pc_abs), + /* K2 */ be_nested_str_weak(duration), }), - &be_const_str_init, + be_str_weak(init), &be_const_str_solidified, ( &(const binstruction[ 4]) { /* code */ 0x90020001, // 0000 SETMBR R0 K0 R1 @@ -263,12 +1016,12 @@ be_local_class(Animate_ins_goto, NULL, be_nested_map(4, ( (struct bmapnode*) &(const bmapnode[]) { - { be_const_key(pc_rel, -1), be_const_var(0) }, - { be_const_key(duration, -1), be_const_var(2) }, - { be_const_key(init, -1), be_const_closure(Animate_ins_goto_init_closure) }, - { be_const_key(pc_abs, 2), be_const_var(1) }, + { be_const_key_weak(pc_rel, -1), be_const_var(0) }, + { be_const_key_weak(duration, -1), be_const_var(2) }, + { be_const_key_weak(init, -1), be_const_closure(Animate_ins_goto_init_closure) }, + { be_const_key_weak(pc_abs, 2), be_const_var(1) }, })), - (bstring*) &be_const_str_Animate_ins_goto + be_str_weak(Animate_ins_goto) ); extern const bclass be_class_Animate_ins_ramp; @@ -287,11 +1040,11 @@ be_local_closure(Animate_ins_ramp_init, /* name */ NULL, /* no sub protos */ 1, /* has constants */ ( &(const bvalue[ 3]) { /* constants */ - /* K0 */ be_nested_str(a), - /* K1 */ be_nested_str(b), - /* K2 */ be_nested_str(duration), + /* K0 */ be_nested_str_weak(a), + /* K1 */ be_nested_str_weak(b), + /* K2 */ be_nested_str_weak(duration), }), - &be_const_str_init, + be_str_weak(init), &be_const_str_solidified, ( &(const binstruction[ 4]) { /* code */ 0x90020001, // 0000 SETMBR R0 K0 R1 @@ -312,59 +1065,171 @@ be_local_class(Animate_ins_ramp, NULL, be_nested_map(4, ( (struct bmapnode*) &(const bmapnode[]) { - { be_const_key(a, -1), be_const_var(0) }, - { be_const_key(b, 2), be_const_var(1) }, - { be_const_key(duration, -1), be_const_var(2) }, - { be_const_key(init, -1), be_const_closure(Animate_ins_ramp_init_closure) }, + { be_const_key_weak(a, -1), be_const_var(0) }, + { be_const_key_weak(b, 2), be_const_var(1) }, + { be_const_key_weak(duration, -1), be_const_var(2) }, + { be_const_key_weak(init, -1), be_const_closure(Animate_ins_ramp_init_closure) }, })), - (bstring*) &be_const_str_Animate_ins_ramp + be_str_weak(Animate_ins_ramp) ); extern const bclass be_class_Animate_engine; /******************************************************************** -** Solidified function: run +** Solidified function: animate ********************************************************************/ -be_local_closure(Animate_engine_run, /* name */ +be_local_closure(Animate_engine_animate, /* name */ be_nested_proto( - 6, /* nstack */ - 3, /* argc */ + 14, /* nstack */ + 2, /* argc */ 2, /* varg */ 0, /* has upvals */ NULL, /* no upvals */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[ 6]) { /* constants */ - /* K0 */ be_nested_str(tasmota), - /* K1 */ be_nested_str(millis), - /* K2 */ be_nested_str(value), - /* K3 */ be_nested_str(ins_time), - /* K4 */ be_nested_str(running), - /* K5 */ be_nested_str(add_driver), + ( &(const bvalue[24]) { /* constants */ + /* K0 */ be_nested_str_weak(running), + /* K1 */ be_nested_str_weak(tasmota), + /* K2 */ be_nested_str_weak(millis), + /* K3 */ be_nested_str_weak(ins_time), + /* K4 */ be_nested_str_weak(pc), + /* K5 */ be_nested_str_weak(code), + /* K6 */ be_const_int(0), + /* K7 */ be_nested_str_weak(internal_error), + /* K8 */ be_nested_str_weak(Animate_X20pc_X20is_X20out_X20of_X20range), + /* K9 */ be_nested_str_weak(animate), + /* K10 */ be_nested_str_weak(ins_ramp), + /* K11 */ be_nested_str_weak(closure), + /* K12 */ be_nested_str_weak(animate_obj), + /* K13 */ be_nested_str_weak(animate_mth), + /* K14 */ be_nested_str_weak(duration), + /* K15 */ be_nested_str_weak(value), + /* K16 */ be_nested_str_weak(scale_uint), + /* K17 */ be_nested_str_weak(a), + /* K18 */ be_nested_str_weak(b), + /* K19 */ be_const_int(1), + /* K20 */ be_nested_str_weak(ins_goto), + /* K21 */ be_nested_str_weak(pc_rel), + /* K22 */ be_nested_str_weak(pc_abs), + /* K23 */ be_nested_str_weak(unknown_X20instruction), }), - &be_const_str_run, + be_str_weak(animate), &be_const_str_solidified, - ( &(const binstruction[19]) { /* code */ - 0x4C0C0000, // 0000 LDNIL R3 - 0x1C0C0203, // 0001 EQ R3 R1 R3 - 0x780E0003, // 0002 JMPF R3 #0007 - 0xB80E0000, // 0003 GETNGBL R3 K0 - 0x8C0C0701, // 0004 GETMET R3 R3 K1 - 0x7C0C0200, // 0005 CALL R3 1 - 0x5C040600, // 0006 MOVE R1 R3 - 0x4C0C0000, // 0007 LDNIL R3 - 0x200C0403, // 0008 NE R3 R2 R3 - 0x780E0000, // 0009 JMPF R3 #000B - 0x90020402, // 000A SETMBR R0 K2 R2 - 0x90020601, // 000B SETMBR R0 K3 R1 - 0x500C0200, // 000C LDBOOL R3 1 0 - 0x90020803, // 000D SETMBR R0 K4 R3 - 0xB80E0000, // 000E GETNGBL R3 K0 - 0x8C0C0705, // 000F GETMET R3 R3 K5 - 0x5C140000, // 0010 MOVE R5 R0 - 0x7C0C0400, // 0011 CALL R3 2 - 0x80000000, // 0012 RET 0 + ( &(const binstruction[113]) { /* code */ + 0x88080100, // 0000 GETMBR R2 R0 K0 + 0x740A0000, // 0001 JMPT R2 #0003 + 0x80000400, // 0002 RET 0 + 0x4C080000, // 0003 LDNIL R2 + 0x1C080202, // 0004 EQ R2 R1 R2 + 0x780A0003, // 0005 JMPF R2 #000A + 0xB80A0200, // 0006 GETNGBL R2 K1 + 0x8C080502, // 0007 GETMET R2 R2 K2 + 0x7C080200, // 0008 CALL R2 1 + 0x5C040400, // 0009 MOVE R1 R2 + 0x50080200, // 000A LDBOOL R2 1 0 + 0x780A0062, // 000B JMPF R2 #006F + 0x88080103, // 000C GETMBR R2 R0 K3 + 0x04080202, // 000D SUB R2 R1 R2 + 0x880C0104, // 000E GETMBR R3 R0 K4 + 0x6010000C, // 000F GETGBL R4 G12 + 0x88140105, // 0010 GETMBR R5 R0 K5 + 0x7C100200, // 0011 CALL R4 1 + 0x280C0604, // 0012 GE R3 R3 R4 + 0x780E0002, // 0013 JMPF R3 #0017 + 0x500C0000, // 0014 LDBOOL R3 0 0 + 0x90020003, // 0015 SETMBR R0 K0 R3 + 0x70020057, // 0016 JMP #006F + 0x880C0104, // 0017 GETMBR R3 R0 K4 + 0x140C0706, // 0018 LT R3 R3 K6 + 0x780E0000, // 0019 JMPF R3 #001B + 0xB0060F08, // 001A RAISE 1 K7 K8 + 0x880C0105, // 001B GETMBR R3 R0 K5 + 0x88100104, // 001C GETMBR R4 R0 K4 + 0x940C0604, // 001D GETIDX R3 R3 R4 + 0x6010000F, // 001E GETGBL R4 G15 + 0x5C140600, // 001F MOVE R5 R3 + 0xB81A1200, // 0020 GETNGBL R6 K9 + 0x88180D0A, // 0021 GETMBR R6 R6 K10 + 0x7C100400, // 0022 CALL R4 2 + 0x7812002E, // 0023 JMPF R4 #0053 + 0x8810010B, // 0024 GETMBR R4 R0 K11 + 0x8814010C, // 0025 GETMBR R5 R0 K12 + 0x8818010D, // 0026 GETMBR R6 R0 K13 + 0x881C070E, // 0027 GETMBR R7 R3 K14 + 0x141C0407, // 0028 LT R7 R2 R7 + 0x781E0014, // 0029 JMPF R7 #003F + 0xB81E0200, // 002A GETNGBL R7 K1 + 0x8C1C0F10, // 002B GETMET R7 R7 K16 + 0x5C240400, // 002C MOVE R9 R2 + 0x58280006, // 002D LDCONST R10 K6 + 0x882C070E, // 002E GETMBR R11 R3 K14 + 0x88300711, // 002F GETMBR R12 R3 K17 + 0x88340712, // 0030 GETMBR R13 R3 K18 + 0x7C1C0C00, // 0031 CALL R7 6 + 0x90021E07, // 0032 SETMBR R0 K15 R7 + 0x78160004, // 0033 JMPF R5 #0039 + 0x781A0003, // 0034 JMPF R6 #0039 + 0x5C1C0C00, // 0035 MOVE R7 R6 + 0x5C200A00, // 0036 MOVE R8 R5 + 0x8824010F, // 0037 GETMBR R9 R0 K15 + 0x7C1C0400, // 0038 CALL R7 2 + 0x78120002, // 0039 JMPF R4 #003D + 0x5C1C0800, // 003A MOVE R7 R4 + 0x8820010F, // 003B GETMBR R8 R0 K15 + 0x7C1C0200, // 003C CALL R7 1 + 0x70020030, // 003D JMP #006F + 0x70020012, // 003E JMP #0052 + 0x881C0712, // 003F GETMBR R7 R3 K18 + 0x90021E07, // 0040 SETMBR R0 K15 R7 + 0x78160004, // 0041 JMPF R5 #0047 + 0x781A0003, // 0042 JMPF R6 #0047 + 0x5C1C0C00, // 0043 MOVE R7 R6 + 0x5C200A00, // 0044 MOVE R8 R5 + 0x8824010F, // 0045 GETMBR R9 R0 K15 + 0x7C1C0400, // 0046 CALL R7 2 + 0x78120002, // 0047 JMPF R4 #004B + 0x5C1C0800, // 0048 MOVE R7 R4 + 0x8820010F, // 0049 GETMBR R8 R0 K15 + 0x7C1C0200, // 004A CALL R7 1 + 0x881C0104, // 004B GETMBR R7 R0 K4 + 0x001C0F13, // 004C ADD R7 R7 K19 + 0x90020807, // 004D SETMBR R0 K4 R7 + 0x881C070E, // 004E GETMBR R7 R3 K14 + 0x041C0407, // 004F SUB R7 R2 R7 + 0x041C0207, // 0050 SUB R7 R1 R7 + 0x90020607, // 0051 SETMBR R0 K3 R7 + 0x7002001A, // 0052 JMP #006E + 0x6010000F, // 0053 GETGBL R4 G15 + 0x5C140600, // 0054 MOVE R5 R3 + 0xB81A1200, // 0055 GETNGBL R6 K9 + 0x88180D14, // 0056 GETMBR R6 R6 K20 + 0x7C100400, // 0057 CALL R4 2 + 0x78120013, // 0058 JMPF R4 #006D + 0x8810070E, // 0059 GETMBR R4 R3 K14 + 0x14100404, // 005A LT R4 R2 R4 + 0x78120001, // 005B JMPF R4 #005E + 0x70020011, // 005C JMP #006F + 0x7002000D, // 005D JMP #006C + 0x88100715, // 005E GETMBR R4 R3 K21 + 0x20100906, // 005F NE R4 R4 K6 + 0x78120004, // 0060 JMPF R4 #0066 + 0x88100104, // 0061 GETMBR R4 R0 K4 + 0x88140715, // 0062 GETMBR R5 R3 K21 + 0x00100805, // 0063 ADD R4 R4 R5 + 0x90020804, // 0064 SETMBR R0 K4 R4 + 0x70020001, // 0065 JMP #0068 + 0x88100716, // 0066 GETMBR R4 R3 K22 + 0x90020804, // 0067 SETMBR R0 K4 R4 + 0x8810070E, // 0068 GETMBR R4 R3 K14 + 0x04100404, // 0069 SUB R4 R2 R4 + 0x04100204, // 006A SUB R4 R1 R4 + 0x90020604, // 006B SETMBR R0 K3 R4 + 0x70020000, // 006C JMP #006E + 0xB0060F17, // 006D RAISE 1 K7 K23 + 0x7001FF9A, // 006E JMP #000A + 0x8808010F, // 006F GETMBR R2 R0 K15 + 0x80040400, // 0070 RET 1 R2 }) ) ); @@ -385,13 +1250,13 @@ be_local_closure(Animate_engine_init, /* name */ NULL, /* no sub protos */ 1, /* has constants */ ( &(const bvalue[ 5]) { /* constants */ - /* K0 */ be_nested_str(code), - /* K1 */ be_nested_str(pc), + /* K0 */ be_nested_str_weak(code), + /* K1 */ be_nested_str_weak(pc), /* K2 */ be_const_int(0), - /* K3 */ be_nested_str(ins_time), - /* K4 */ be_nested_str(running), + /* K3 */ be_nested_str_weak(ins_time), + /* K4 */ be_nested_str_weak(running), }), - &be_const_str_init, + be_str_weak(init), &be_const_str_solidified, ( &(const binstruction[ 8]) { /* code */ 0x60040012, // 0000 GETGBL R1 G18 @@ -408,48 +1273,12 @@ be_local_closure(Animate_engine_init, /* name */ /*******************************************************************/ -/******************************************************************** -** Solidified function: autorun -********************************************************************/ -be_local_closure(Animate_engine_autorun, /* name */ - be_nested_proto( - 7, /* nstack */ - 3, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 3]) { /* constants */ - /* K0 */ be_nested_str(run), - /* K1 */ be_nested_str(tasmota), - /* K2 */ be_nested_str(add_driver), - }), - &be_const_str_autorun, - &be_const_str_solidified, - ( &(const binstruction[ 9]) { /* code */ - 0x8C0C0100, // 0000 GETMET R3 R0 K0 - 0x5C140200, // 0001 MOVE R5 R1 - 0x5C180400, // 0002 MOVE R6 R2 - 0x7C0C0600, // 0003 CALL R3 3 - 0xB80E0200, // 0004 GETNGBL R3 K1 - 0x8C0C0702, // 0005 GETMET R3 R3 K2 - 0x5C140000, // 0006 MOVE R5 R0 - 0x7C0C0400, // 0007 CALL R3 2 - 0x80000000, // 0008 RET 0 - }) - ) -); -/*******************************************************************/ - - /******************************************************************** ** Solidified function: stop ********************************************************************/ be_local_closure(Animate_engine_stop, /* name */ be_nested_proto( - 4, /* nstack */ + 2, /* nstack */ 1, /* argc */ 2, /* varg */ 0, /* has upvals */ @@ -457,21 +1286,15 @@ be_local_closure(Animate_engine_stop, /* name */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[ 3]) { /* constants */ - /* K0 */ be_nested_str(running), - /* K1 */ be_nested_str(tasmota), - /* K2 */ be_nested_str(remove_driver), + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str_weak(running), }), - &be_const_str_stop, + be_str_weak(stop), &be_const_str_solidified, - ( &(const binstruction[ 7]) { /* code */ + ( &(const binstruction[ 3]) { /* code */ 0x50040000, // 0000 LDBOOL R1 0 0 0x90020001, // 0001 SETMBR R0 K0 R1 - 0xB8060200, // 0002 GETNGBL R1 K1 - 0x8C040302, // 0003 GETMET R1 R1 K2 - 0x5C0C0000, // 0004 MOVE R3 R0 - 0x7C040400, // 0005 CALL R1 2 - 0x80000000, // 0006 RET 0 + 0x80000000, // 0002 RET 0 }) ) ); @@ -492,9 +1315,9 @@ be_local_closure(Animate_engine_is_running, /* name */ NULL, /* no sub protos */ 1, /* has constants */ ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str(running), + /* K0 */ be_nested_str_weak(running), }), - &be_const_str_is_running, + be_str_weak(is_running), &be_const_str_solidified, ( &(const binstruction[ 2]) { /* code */ 0x88040100, // 0000 GETMBR R1 R0 K0 @@ -506,26 +1329,27 @@ be_local_closure(Animate_engine_is_running, /* name */ /******************************************************************** -** Solidified function: every_50ms +** Solidified function: set_cb ********************************************************************/ -be_local_closure(Animate_engine_every_50ms, /* name */ +be_local_closure(Animate_engine_set_cb, /* name */ be_nested_proto( 3, /* nstack */ - 1, /* argc */ + 3, /* argc */ 2, /* varg */ 0, /* has upvals */ NULL, /* no upvals */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str(animate), + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str_weak(animate_obj), + /* K1 */ be_nested_str_weak(animate_mth), }), - &be_const_str_every_50ms, + be_str_weak(set_cb), &be_const_str_solidified, ( &(const binstruction[ 3]) { /* code */ - 0x8C040100, // 0000 GETMET R1 R0 K0 - 0x7C040200, // 0001 CALL R1 1 + 0x90020001, // 0000 SETMBR R0 K0 R1 + 0x90020202, // 0001 SETMBR R0 K1 R2 0x80000000, // 0002 RET 0 }) ) @@ -534,144 +1358,43 @@ be_local_closure(Animate_engine_every_50ms, /* name */ /******************************************************************** -** Solidified function: animate +** Solidified function: start ********************************************************************/ -be_local_closure(Animate_engine_animate, /* name */ +be_local_closure(Animate_engine_start, /* name */ be_nested_proto( - 12, /* nstack */ - 2, /* argc */ + 5, /* nstack */ + 3, /* argc */ 2, /* varg */ 0, /* has upvals */ NULL, /* no upvals */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[22]) { /* constants */ - /* K0 */ be_nested_str(running), - /* K1 */ be_nested_str(tasmota), - /* K2 */ be_nested_str(millis), - /* K3 */ be_nested_str(ins_time), - /* K4 */ be_nested_str(pc), - /* K5 */ be_nested_str(code), - /* K6 */ be_const_int(0), - /* K7 */ be_nested_str(internal_error), - /* K8 */ be_nested_str(Animate_X20pc_X20is_X20out_X20of_X20range), - /* K9 */ be_nested_str(animate), - /* K10 */ be_nested_str(ins_ramp), - /* K11 */ be_nested_str(closure), - /* K12 */ be_nested_str(duration), - /* K13 */ be_nested_str(value), - /* K14 */ be_nested_str(scale_uint), - /* K15 */ be_nested_str(a), - /* K16 */ be_nested_str(b), - /* K17 */ be_const_int(1), - /* K18 */ be_nested_str(ins_goto), - /* K19 */ be_nested_str(pc_rel), - /* K20 */ be_nested_str(pc_abs), - /* K21 */ be_nested_str(unknown_X20instruction), + ( &(const bvalue[ 5]) { /* constants */ + /* K0 */ be_nested_str_weak(tasmota), + /* K1 */ be_nested_str_weak(millis), + /* K2 */ be_nested_str_weak(value), + /* K3 */ be_nested_str_weak(ins_time), + /* K4 */ be_nested_str_weak(running), }), - &be_const_str_animate, + be_str_weak(start), &be_const_str_solidified, - ( &(const binstruction[99]) { /* code */ - 0x88080100, // 0000 GETMBR R2 R0 K0 - 0x740A0000, // 0001 JMPT R2 #0003 - 0x80000400, // 0002 RET 0 - 0x4C080000, // 0003 LDNIL R2 - 0x1C080202, // 0004 EQ R2 R1 R2 - 0x780A0003, // 0005 JMPF R2 #000A - 0xB80A0200, // 0006 GETNGBL R2 K1 - 0x8C080502, // 0007 GETMET R2 R2 K2 - 0x7C080200, // 0008 CALL R2 1 - 0x5C040400, // 0009 MOVE R1 R2 - 0x50080200, // 000A LDBOOL R2 1 0 - 0x780A0054, // 000B JMPF R2 #0061 - 0x88080103, // 000C GETMBR R2 R0 K3 - 0x04080202, // 000D SUB R2 R1 R2 - 0x880C0104, // 000E GETMBR R3 R0 K4 - 0x6010000C, // 000F GETGBL R4 G12 - 0x88140105, // 0010 GETMBR R5 R0 K5 - 0x7C100200, // 0011 CALL R4 1 - 0x280C0604, // 0012 GE R3 R3 R4 - 0x780E0002, // 0013 JMPF R3 #0017 - 0x500C0000, // 0014 LDBOOL R3 0 0 - 0x90020003, // 0015 SETMBR R0 K0 R3 - 0x70020049, // 0016 JMP #0061 - 0x880C0104, // 0017 GETMBR R3 R0 K4 - 0x140C0706, // 0018 LT R3 R3 K6 - 0x780E0000, // 0019 JMPF R3 #001B - 0xB0060F08, // 001A RAISE 1 K7 K8 - 0x880C0105, // 001B GETMBR R3 R0 K5 - 0x88100104, // 001C GETMBR R4 R0 K4 - 0x940C0604, // 001D GETIDX R3 R3 R4 - 0x6014000F, // 001E GETGBL R5 G15 - 0x5C180600, // 001F MOVE R6 R3 - 0xB81E1200, // 0020 GETNGBL R7 K9 - 0x881C0F0A, // 0021 GETMBR R7 R7 K10 - 0x7C140400, // 0022 CALL R5 2 - 0x78160020, // 0023 JMPF R5 #0045 - 0x8810010B, // 0024 GETMBR R4 R0 K11 - 0x8814070C, // 0025 GETMBR R5 R3 K12 - 0x14140405, // 0026 LT R5 R2 R5 - 0x7816000E, // 0027 JMPF R5 #0037 - 0xB8160200, // 0028 GETNGBL R5 K1 - 0x8C140B0E, // 0029 GETMET R5 R5 K14 - 0x5C1C0400, // 002A MOVE R7 R2 - 0x58200006, // 002B LDCONST R8 K6 - 0x8824070C, // 002C GETMBR R9 R3 K12 - 0x8828070F, // 002D GETMBR R10 R3 K15 - 0x882C0710, // 002E GETMBR R11 R3 K16 - 0x7C140C00, // 002F CALL R5 6 - 0x90021A05, // 0030 SETMBR R0 K13 R5 - 0x78120002, // 0031 JMPF R4 #0035 - 0x5C140800, // 0032 MOVE R5 R4 - 0x8818010D, // 0033 GETMBR R6 R0 K13 - 0x7C140200, // 0034 CALL R5 1 - 0x7002002A, // 0035 JMP #0061 - 0x7002000C, // 0036 JMP #0044 - 0x88140710, // 0037 GETMBR R5 R3 K16 - 0x90021A05, // 0038 SETMBR R0 K13 R5 - 0x78120002, // 0039 JMPF R4 #003D - 0x5C140800, // 003A MOVE R5 R4 - 0x8818010D, // 003B GETMBR R6 R0 K13 - 0x7C140200, // 003C CALL R5 1 - 0x88140104, // 003D GETMBR R5 R0 K4 - 0x00140B11, // 003E ADD R5 R5 K17 - 0x90020805, // 003F SETMBR R0 K4 R5 - 0x8814070C, // 0040 GETMBR R5 R3 K12 - 0x04140405, // 0041 SUB R5 R2 R5 - 0x04140205, // 0042 SUB R5 R1 R5 - 0x90020605, // 0043 SETMBR R0 K3 R5 - 0x7002001A, // 0044 JMP #0060 - 0x6010000F, // 0045 GETGBL R4 G15 - 0x5C140600, // 0046 MOVE R5 R3 - 0xB81A1200, // 0047 GETNGBL R6 K9 - 0x88180D12, // 0048 GETMBR R6 R6 K18 - 0x7C100400, // 0049 CALL R4 2 - 0x78120013, // 004A JMPF R4 #005F - 0x8810070C, // 004B GETMBR R4 R3 K12 - 0x14100404, // 004C LT R4 R2 R4 - 0x78120001, // 004D JMPF R4 #0050 - 0x70020011, // 004E JMP #0061 - 0x7002000D, // 004F JMP #005E - 0x88100713, // 0050 GETMBR R4 R3 K19 - 0x20100906, // 0051 NE R4 R4 K6 - 0x78120004, // 0052 JMPF R4 #0058 - 0x88100104, // 0053 GETMBR R4 R0 K4 - 0x88140713, // 0054 GETMBR R5 R3 K19 - 0x00100805, // 0055 ADD R4 R4 R5 - 0x90020804, // 0056 SETMBR R0 K4 R4 - 0x70020001, // 0057 JMP #005A - 0x88100714, // 0058 GETMBR R4 R3 K20 - 0x90020804, // 0059 SETMBR R0 K4 R4 - 0x8810070C, // 005A GETMBR R4 R3 K12 - 0x04100404, // 005B SUB R4 R2 R4 - 0x04100204, // 005C SUB R4 R1 R4 - 0x90020604, // 005D SETMBR R0 K3 R4 - 0x70020000, // 005E JMP #0060 - 0xB0060F15, // 005F RAISE 1 K7 K21 - 0x7001FFA8, // 0060 JMP #000A - 0x8808010D, // 0061 GETMBR R2 R0 K13 - 0x80040400, // 0062 RET 1 R2 + ( &(const binstruction[15]) { /* code */ + 0x4C0C0000, // 0000 LDNIL R3 + 0x1C0C0203, // 0001 EQ R3 R1 R3 + 0x780E0003, // 0002 JMPF R3 #0007 + 0xB80E0000, // 0003 GETNGBL R3 K0 + 0x8C0C0701, // 0004 GETMET R3 R3 K1 + 0x7C0C0200, // 0005 CALL R3 1 + 0x5C040600, // 0006 MOVE R1 R3 + 0x4C0C0000, // 0007 LDNIL R3 + 0x200C0403, // 0008 NE R3 R2 R3 + 0x780E0000, // 0009 JMPF R3 #000B + 0x90020402, // 000A SETMBR R0 K2 R2 + 0x90020601, // 000B SETMBR R0 K3 R1 + 0x500C0200, // 000C LDBOOL R3 1 0 + 0x90020803, // 000D SETMBR R0 K4 R3 + 0x80000000, // 000E RET 0 }) ) ); @@ -682,25 +1405,176 @@ be_local_closure(Animate_engine_animate, /* name */ ** Solidified class: Animate_engine ********************************************************************/ be_local_class(Animate_engine, - 6, + 8, NULL, - be_nested_map(13, + be_nested_map(14, ( (struct bmapnode*) &(const bmapnode[]) { - { be_const_key(code, -1), be_const_var(0) }, - { be_const_key(run, 9), be_const_closure(Animate_engine_run_closure) }, - { be_const_key(running, 4), be_const_var(4) }, - { be_const_key(ins_time, 8), be_const_var(3) }, - { be_const_key(closure, 10), be_const_var(1) }, - { be_const_key(value, -1), be_const_var(5) }, - { be_const_key(init, 11), be_const_closure(Animate_engine_init_closure) }, - { be_const_key(pc, -1), be_const_var(2) }, - { be_const_key(animate, -1), be_const_closure(Animate_engine_animate_closure) }, - { be_const_key(autorun, -1), be_const_closure(Animate_engine_autorun_closure) }, - { be_const_key(is_running, -1), be_const_closure(Animate_engine_is_running_closure) }, - { be_const_key(stop, -1), be_const_closure(Animate_engine_stop_closure) }, - { be_const_key(every_50ms, 3), be_const_closure(Animate_engine_every_50ms_closure) }, + { be_const_key_weak(animate, -1), be_const_closure(Animate_engine_animate_closure) }, + { be_const_key_weak(ins_time, -1), be_const_var(5) }, + { be_const_key_weak(running, 10), be_const_var(6) }, + { be_const_key_weak(stop, 7), be_const_closure(Animate_engine_stop_closure) }, + { be_const_key_weak(closure, -1), be_const_var(1) }, + { be_const_key_weak(init, 1), be_const_closure(Animate_engine_init_closure) }, + { be_const_key_weak(animate_mth, -1), be_const_var(3) }, + { be_const_key_weak(set_cb, -1), be_const_closure(Animate_engine_set_cb_closure) }, + { be_const_key_weak(code, -1), be_const_var(0) }, + { be_const_key_weak(is_running, -1), be_const_closure(Animate_engine_is_running_closure) }, + { be_const_key_weak(animate_obj, 11), be_const_var(2) }, + { be_const_key_weak(pc, -1), be_const_var(4) }, + { be_const_key_weak(value, 6), be_const_var(7) }, + { be_const_key_weak(start, -1), be_const_closure(Animate_engine_start_closure) }, })), - (bstring*) &be_const_str_Animate_engine + be_str_weak(Animate_engine) +); + +extern const bclass be_class_Animate_back_forth; + +/******************************************************************** +** Solidified function: init +********************************************************************/ +be_local_closure(Animate_back_forth_init, /* name */ + be_nested_proto( + 13, /* nstack */ + 6, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 8]) { /* constants */ + /* K0 */ be_nested_str_weak(init), + /* K1 */ be_nested_str_weak(set_cb), + /* K2 */ be_nested_str_weak(code), + /* K3 */ be_nested_str_weak(push), + /* K4 */ be_nested_str_weak(animate), + /* K5 */ be_nested_str_weak(ins_ramp), + /* K6 */ be_nested_str_weak(ins_goto), + /* K7 */ be_const_int(0), + }), + be_str_weak(init), + &be_const_str_solidified, + ( &(const binstruction[37]) { /* code */ + 0x60180003, // 0000 GETGBL R6 G3 + 0x5C1C0000, // 0001 MOVE R7 R0 + 0x7C180200, // 0002 CALL R6 1 + 0x8C180D00, // 0003 GETMET R6 R6 K0 + 0x7C180200, // 0004 CALL R6 1 + 0x8C180101, // 0005 GETMET R6 R0 K1 + 0x5C200200, // 0006 MOVE R8 R1 + 0x5C240400, // 0007 MOVE R9 R2 + 0x7C180600, // 0008 CALL R6 3 + 0x88180102, // 0009 GETMBR R6 R0 K2 + 0x8C180D03, // 000A GETMET R6 R6 K3 + 0xB8220800, // 000B GETNGBL R8 K4 + 0x8C201105, // 000C GETMET R8 R8 K5 + 0x5C280600, // 000D MOVE R10 R3 + 0x5C2C0800, // 000E MOVE R11 R4 + 0x5C300A00, // 000F MOVE R12 R5 + 0x7C200800, // 0010 CALL R8 4 + 0x7C180400, // 0011 CALL R6 2 + 0x88180102, // 0012 GETMBR R6 R0 K2 + 0x8C180D03, // 0013 GETMET R6 R6 K3 + 0xB8220800, // 0014 GETNGBL R8 K4 + 0x8C201105, // 0015 GETMET R8 R8 K5 + 0x5C280800, // 0016 MOVE R10 R4 + 0x5C2C0600, // 0017 MOVE R11 R3 + 0x5C300A00, // 0018 MOVE R12 R5 + 0x7C200800, // 0019 CALL R8 4 + 0x7C180400, // 001A CALL R6 2 + 0x88180102, // 001B GETMBR R6 R0 K2 + 0x8C180D03, // 001C GETMET R6 R6 K3 + 0xB8220800, // 001D GETNGBL R8 K4 + 0x8C201106, // 001E GETMET R8 R8 K6 + 0x58280007, // 001F LDCONST R10 K7 + 0x582C0007, // 0020 LDCONST R11 K7 + 0x58300007, // 0021 LDCONST R12 K7 + 0x7C200800, // 0022 CALL R8 4 + 0x7C180400, // 0023 CALL R6 2 + 0x80000000, // 0024 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified class: Animate_back_forth +********************************************************************/ +extern const bclass be_class_Animate_engine; +be_local_class(Animate_back_forth, + 0, + &be_class_Animate_engine, + be_nested_map(1, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_const_key_weak(init, -1), be_const_closure(Animate_back_forth_init_closure) }, + })), + be_str_weak(Animate_back_forth) +); + +extern const bclass be_class_Animate_from_to; + +/******************************************************************** +** Solidified function: init +********************************************************************/ +be_local_closure(Animate_from_to_init, /* name */ + be_nested_proto( + 13, /* nstack */ + 6, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 6]) { /* constants */ + /* K0 */ be_nested_str_weak(init), + /* K1 */ be_nested_str_weak(set_cb), + /* K2 */ be_nested_str_weak(code), + /* K3 */ be_nested_str_weak(push), + /* K4 */ be_nested_str_weak(animate), + /* K5 */ be_nested_str_weak(ins_ramp), + }), + be_str_weak(init), + &be_const_str_solidified, + ( &(const binstruction[19]) { /* code */ + 0x60180003, // 0000 GETGBL R6 G3 + 0x5C1C0000, // 0001 MOVE R7 R0 + 0x7C180200, // 0002 CALL R6 1 + 0x8C180D00, // 0003 GETMET R6 R6 K0 + 0x7C180200, // 0004 CALL R6 1 + 0x8C180101, // 0005 GETMET R6 R0 K1 + 0x5C200200, // 0006 MOVE R8 R1 + 0x5C240400, // 0007 MOVE R9 R2 + 0x7C180600, // 0008 CALL R6 3 + 0x88180102, // 0009 GETMBR R6 R0 K2 + 0x8C180D03, // 000A GETMET R6 R6 K3 + 0xB8220800, // 000B GETNGBL R8 K4 + 0x8C201105, // 000C GETMET R8 R8 K5 + 0x5C280600, // 000D MOVE R10 R3 + 0x5C2C0800, // 000E MOVE R11 R4 + 0x5C300A00, // 000F MOVE R12 R5 + 0x7C200800, // 0010 CALL R8 4 + 0x7C180400, // 0011 CALL R6 2 + 0x80000000, // 0012 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified class: Animate_from_to +********************************************************************/ +extern const bclass be_class_Animate_engine; +be_local_class(Animate_from_to, + 0, + &be_class_Animate_engine, + be_nested_map(1, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_const_key_weak(init, -1), be_const_closure(Animate_from_to_init_closure) }, + })), + be_str_weak(Animate_from_to) ); /******************************************************************** @@ -708,14 +1582,15 @@ be_local_class(Animate_engine, ********************************************************************/ be_local_module(animate, "animate", - be_nested_map(6, + be_nested_map(7, ( (struct bmapnode*) &(const bmapnode[]) { - { be_const_key(rotate, 2), be_const_class(be_class_Animate_rotate) }, - { be_const_key(from_to, 3), be_const_class(be_class_Animate_from_to) }, - { be_const_key(back_forth, -1), be_const_class(be_class_Animate_back_forth) }, - { be_const_key(ins_goto, -1), be_const_class(be_class_Animate_ins_goto) }, - { be_const_key(ins_ramp, -1), be_const_class(be_class_Animate_ins_ramp) }, - { be_const_key(engine, -1), be_const_class(be_class_Animate_engine) }, + { be_const_key_weak(ins_ramp, -1), be_const_class(be_class_Animate_ins_ramp) }, + { be_const_key_weak(from_to, -1), be_const_class(be_class_Animate_from_to) }, + { be_const_key_weak(palette, 3), be_const_class(be_class_Animate_palette) }, + { be_const_key_weak(engine, 5), be_const_class(be_class_Animate_engine) }, + { be_const_key_weak(back_forth, -1), be_const_class(be_class_Animate_back_forth) }, + { be_const_key_weak(rotate, -1), be_const_class(be_class_Animate_rotate) }, + { be_const_key_weak(ins_goto, -1), be_const_class(be_class_Animate_ins_goto) }, })) ); BE_EXPORT_VARIABLE be_define_const_native_module(animate); diff --git a/lib/libesp32/berry_tasmota/src/solidify/solidified_leds.h b/lib/libesp32/berry_tasmota/src/solidify/solidified_leds.h index 13b452935..ef3af9aba 100644 --- a/lib/libesp32/berry_tasmota/src/solidify/solidified_leds.h +++ b/lib/libesp32/berry_tasmota/src/solidify/solidified_leds.h @@ -6,35 +6,6 @@ extern const bclass be_class_Leds; -/******************************************************************** -** Solidified function: pixel_count -********************************************************************/ -be_local_closure(Leds_pixel_count, /* name */ - be_nested_proto( - 4, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str(call_native), - }), - &be_const_str_pixel_count, - &be_const_str_solidified, - ( &(const binstruction[ 4]) { /* code */ - 0x8C040100, // 0000 GETMET R1 R0 K0 - 0x540E0007, // 0001 LDINT R3 8 - 0x7C040400, // 0002 CALL R1 2 - 0x80040200, // 0003 RET 1 R1 - }) - ) -); -/*******************************************************************/ - - /******************************************************************** ** Solidified function: show ********************************************************************/ @@ -65,81 +36,14 @@ be_local_closure(Leds_show, /* name */ /*******************************************************************/ -/******************************************************************** -** Solidified function: clear_to -********************************************************************/ -be_local_closure(Leds_clear_to, /* name */ - be_nested_proto( - 10, /* nstack */ - 3, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 2]) { /* constants */ - /* K0 */ be_nested_str(call_native), - /* K1 */ be_nested_str(to_gamma), - }), - &be_const_str_clear_to, - &be_const_str_solidified, - ( &(const binstruction[ 8]) { /* code */ - 0x8C0C0100, // 0000 GETMET R3 R0 K0 - 0x54160008, // 0001 LDINT R5 9 - 0x8C180101, // 0002 GETMET R6 R0 K1 - 0x5C200200, // 0003 MOVE R8 R1 - 0x5C240400, // 0004 MOVE R9 R2 - 0x7C180600, // 0005 CALL R6 3 - 0x7C0C0600, // 0006 CALL R3 3 - 0x80000000, // 0007 RET 0 - }) - ) -); -/*******************************************************************/ - +extern const bclass be_class_Leds_segment; /******************************************************************** -** Solidified function: set_pixel_color +** Solidified function: pixel_offset ********************************************************************/ -be_local_closure(Leds_set_pixel_color, /* name */ +be_local_closure(Leds_segment_pixel_offset, /* name */ be_nested_proto( - 12, /* nstack */ - 4, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 2]) { /* constants */ - /* K0 */ be_nested_str(call_native), - /* K1 */ be_nested_str(to_gamma), - }), - &be_const_str_set_pixel_color, - &be_const_str_solidified, - ( &(const binstruction[ 9]) { /* code */ - 0x8C100100, // 0000 GETMET R4 R0 K0 - 0x541A0009, // 0001 LDINT R6 10 - 0x5C1C0200, // 0002 MOVE R7 R1 - 0x8C200101, // 0003 GETMET R8 R0 K1 - 0x5C280400, // 0004 MOVE R10 R2 - 0x5C2C0600, // 0005 MOVE R11 R3 - 0x7C200600, // 0006 CALL R8 3 - 0x7C100800, // 0007 CALL R4 4 - 0x80000000, // 0008 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: clear -********************************************************************/ -be_local_closure(Leds_clear, /* name */ - be_nested_proto( - 4, /* nstack */ + 2, /* nstack */ 1, /* argc */ 2, /* varg */ 0, /* has upvals */ @@ -147,95 +51,14 @@ be_local_closure(Leds_clear, /* name */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[ 3]) { /* constants */ - /* K0 */ be_nested_str(clear_to), - /* K1 */ be_const_int(0), - /* K2 */ be_nested_str(show), + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str(offset), }), - &be_const_str_clear, + &be_const_str_pixel_offset, &be_const_str_solidified, - ( &(const binstruction[ 6]) { /* code */ - 0x8C040100, // 0000 GETMET R1 R0 K0 - 0x580C0001, // 0001 LDCONST R3 K1 - 0x7C040400, // 0002 CALL R1 2 - 0x8C040102, // 0003 GETMET R1 R0 K2 - 0x7C040200, // 0004 CALL R1 1 - 0x80000000, // 0005 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: matrix -********************************************************************/ -be_local_closure(Leds_matrix, /* name */ - be_nested_proto( - 11, /* nstack */ - 4, /* argc */ - 4, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 4]) { /* constants */ - /* K0 */ be_const_class(be_class_Leds), - /* K1 */ be_nested_str(Leds), - /* K2 */ be_nested_str(create_matrix), - /* K3 */ be_const_int(0), - }), - &be_const_str_matrix, - &be_const_str_solidified, - ( &(const binstruction[12]) { /* code */ - 0x58100000, // 0000 LDCONST R4 K0 - 0xB8160200, // 0001 GETNGBL R5 K1 - 0x08180001, // 0002 MUL R6 R0 R1 - 0x5C1C0400, // 0003 MOVE R7 R2 - 0x5C200600, // 0004 MOVE R8 R3 - 0x7C140600, // 0005 CALL R5 3 - 0x8C180B02, // 0006 GETMET R6 R5 K2 - 0x5C200000, // 0007 MOVE R8 R0 - 0x5C240200, // 0008 MOVE R9 R1 - 0x58280003, // 0009 LDCONST R10 K3 - 0x7C180800, // 000A CALL R6 4 - 0x80040C00, // 000B RET 1 R6 - }) - ) -); -/*******************************************************************/ - - -extern const bclass be_class_Leds_segment; - -/******************************************************************** -** Solidified function: get_pixel_color -********************************************************************/ -be_local_closure(Leds_segment_get_pixel_color, /* name */ - be_nested_proto( - 5, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 3]) { /* constants */ - /* K0 */ be_nested_str(strip), - /* K1 */ be_nested_str(get_pixel_color), - /* K2 */ be_nested_str(offseta), - }), - &be_const_str_get_pixel_color, - &be_const_str_solidified, - ( &(const binstruction[ 6]) { /* code */ - 0x88080100, // 0000 GETMBR R2 R0 K0 - 0x8C080501, // 0001 GETMET R2 R2 K1 - 0x88100102, // 0002 GETMBR R4 R0 K2 - 0x00100204, // 0003 ADD R4 R1 R4 - 0x7C080400, // 0004 CALL R2 2 - 0x80040400, // 0005 RET 1 R2 + ( &(const binstruction[ 2]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x80040200, // 0001 RET 1 R1 }) ) ); @@ -247,7 +70,7 @@ be_local_closure(Leds_segment_get_pixel_color, /* name */ ********************************************************************/ be_local_closure(Leds_segment_clear_to, /* name */ be_nested_proto( - 9, /* nstack */ + 10, /* nstack */ 3, /* argc */ 2, /* varg */ 0, /* has upvals */ @@ -255,31 +78,110 @@ be_local_closure(Leds_segment_clear_to, /* name */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[ 6]) { /* constants */ - /* K0 */ be_const_int(0), - /* K1 */ be_nested_str(leds), - /* K2 */ be_nested_str(strip), - /* K3 */ be_nested_str(set_pixel_color), - /* K4 */ be_nested_str(offset), - /* K5 */ be_const_int(1), + ( &(const bvalue[ 5]) { /* constants */ + /* K0 */ be_nested_str(strip), + /* K1 */ be_nested_str(call_native), + /* K2 */ be_nested_str(to_gamma), + /* K3 */ be_nested_str(offset), + /* K4 */ be_nested_str(leds), }), &be_const_str_clear_to, &be_const_str_solidified, - ( &(const binstruction[14]) { /* code */ - 0x580C0000, // 0000 LDCONST R3 K0 - 0x88100101, // 0001 GETMBR R4 R0 K1 - 0x14100604, // 0002 LT R4 R3 R4 - 0x78120008, // 0003 JMPF R4 #000D - 0x88100102, // 0004 GETMBR R4 R0 K2 - 0x8C100903, // 0005 GETMET R4 R4 K3 - 0x88180104, // 0006 GETMBR R6 R0 K4 - 0x00180606, // 0007 ADD R6 R3 R6 - 0x5C1C0200, // 0008 MOVE R7 R1 - 0x5C200400, // 0009 MOVE R8 R2 - 0x7C100800, // 000A CALL R4 4 - 0x000C0705, // 000B ADD R3 R3 K5 - 0x7001FFF3, // 000C JMP #0001 - 0x80000000, // 000D RET 0 + ( &(const binstruction[12]) { /* code */ + 0x880C0100, // 0000 GETMBR R3 R0 K0 + 0x8C0C0701, // 0001 GETMET R3 R3 K1 + 0x54160008, // 0002 LDINT R5 9 + 0x88180100, // 0003 GETMBR R6 R0 K0 + 0x8C180D02, // 0004 GETMET R6 R6 K2 + 0x5C200200, // 0005 MOVE R8 R1 + 0x5C240400, // 0006 MOVE R9 R2 + 0x7C180600, // 0007 CALL R6 3 + 0x881C0103, // 0008 GETMBR R7 R0 K3 + 0x88200104, // 0009 GETMBR R8 R0 K4 + 0x7C0C0A00, // 000A CALL R3 5 + 0x80000000, // 000B RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: pixel_count +********************************************************************/ +be_local_closure(Leds_segment_pixel_count, /* name */ + be_nested_proto( + 2, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str(leds), + }), + &be_const_str_pixel_count, + &be_const_str_solidified, + ( &(const binstruction[ 2]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x80040200, // 0001 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: pixels_buffer +********************************************************************/ +be_local_closure(Leds_segment_pixels_buffer, /* name */ + be_nested_proto( + 2, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 0, /* has constants */ + NULL, /* no const */ + &be_const_str_pixels_buffer, + &be_const_str_solidified, + ( &(const binstruction[ 2]) { /* code */ + 0x4C040000, // 0000 LDNIL R1 + 0x80040200, // 0001 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: dirty +********************************************************************/ +be_local_closure(Leds_segment_dirty, /* name */ + be_nested_proto( + 3, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(strip), + /* K1 */ be_nested_str(dirty), + }), + &be_const_str_dirty, + &be_const_str_solidified, + ( &(const binstruction[ 4]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x8C040301, // 0001 GETMET R1 R1 K1 + 0x7C040200, // 0002 CALL R1 1 + 0x80000000, // 0003 RET 0 }) ) ); @@ -351,6 +253,36 @@ be_local_closure(Leds_segment_set_pixel_color, /* name */ /*******************************************************************/ +/******************************************************************** +** Solidified function: is_dirty +********************************************************************/ +be_local_closure(Leds_segment_is_dirty, /* name */ + be_nested_proto( + 3, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(strip), + /* K1 */ be_nested_str(is_dirty), + }), + &be_const_str_is_dirty, + &be_const_str_solidified, + ( &(const binstruction[ 4]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x8C040301, // 0001 GETMET R1 R1 K1 + 0x7C040200, // 0002 CALL R1 1 + 0x80040200, // 0003 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + /******************************************************************** ** Solidified function: clear ********************************************************************/ @@ -409,39 +341,12 @@ be_local_closure(Leds_segment_begin, /* name */ /******************************************************************** -** Solidified function: pixel_count +** Solidified function: get_pixel_color ********************************************************************/ -be_local_closure(Leds_segment_pixel_count, /* name */ +be_local_closure(Leds_segment_get_pixel_color, /* name */ be_nested_proto( - 2, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str(leds), - }), - &be_const_str_pixel_count, - &be_const_str_solidified, - ( &(const binstruction[ 2]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x80040200, // 0001 RET 1 R1 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: init -********************************************************************/ -be_local_closure(Leds_segment_init, /* name */ - be_nested_proto( - 6, /* nstack */ - 4, /* argc */ + 5, /* nstack */ + 2, /* argc */ 2, /* varg */ 0, /* has upvals */ NULL, /* no upvals */ @@ -450,22 +355,18 @@ be_local_closure(Leds_segment_init, /* name */ 1, /* has constants */ ( &(const bvalue[ 3]) { /* constants */ /* K0 */ be_nested_str(strip), - /* K1 */ be_nested_str(offset), - /* K2 */ be_nested_str(leds), + /* K1 */ be_nested_str(get_pixel_color), + /* K2 */ be_nested_str(offseta), }), - &be_const_str_init, + &be_const_str_get_pixel_color, &be_const_str_solidified, - ( &(const binstruction[10]) { /* code */ - 0x90020001, // 0000 SETMBR R0 K0 R1 - 0x60100009, // 0001 GETGBL R4 G9 - 0x5C140400, // 0002 MOVE R5 R2 - 0x7C100200, // 0003 CALL R4 1 - 0x90020204, // 0004 SETMBR R0 K1 R4 - 0x60100009, // 0005 GETGBL R4 G9 - 0x5C140600, // 0006 MOVE R5 R3 - 0x7C100200, // 0007 CALL R4 1 - 0x90020404, // 0008 SETMBR R0 K2 R4 - 0x80000000, // 0009 RET 0 + ( &(const binstruction[ 6]) { /* code */ + 0x88080100, // 0000 GETMBR R2 R0 K0 + 0x8C080501, // 0001 GETMET R2 R2 K1 + 0x88100102, // 0002 GETMBR R4 R0 K2 + 0x00100204, // 0003 ADD R4 R1 R4 + 0x7C080400, // 0004 CALL R2 2 + 0x80040400, // 0005 RET 1 R2 }) ) ); @@ -503,29 +404,36 @@ be_local_closure(Leds_segment_pixel_size, /* name */ /******************************************************************** -** Solidified function: dirty +** Solidified function: init ********************************************************************/ -be_local_closure(Leds_segment_dirty, /* name */ +be_local_closure(Leds_segment_init, /* name */ be_nested_proto( - 3, /* nstack */ - 1, /* argc */ + 6, /* nstack */ + 4, /* argc */ 2, /* varg */ 0, /* has upvals */ NULL, /* no upvals */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[ 2]) { /* constants */ + ( &(const bvalue[ 3]) { /* constants */ /* K0 */ be_nested_str(strip), - /* K1 */ be_nested_str(dirty), + /* K1 */ be_nested_str(offset), + /* K2 */ be_nested_str(leds), }), - &be_const_str_dirty, + &be_const_str_init, &be_const_str_solidified, - ( &(const binstruction[ 4]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x8C040301, // 0001 GETMET R1 R1 K1 - 0x7C040200, // 0002 CALL R1 1 - 0x80000000, // 0003 RET 0 + ( &(const binstruction[10]) { /* code */ + 0x90020001, // 0000 SETMBR R0 K0 R1 + 0x60100009, // 0001 GETGBL R4 G9 + 0x5C140400, // 0002 MOVE R5 R2 + 0x7C100200, // 0003 CALL R4 1 + 0x90020204, // 0004 SETMBR R0 K1 R4 + 0x60100009, // 0005 GETGBL R4 G9 + 0x5C140600, // 0006 MOVE R5 R3 + 0x7C100200, // 0007 CALL R4 1 + 0x90020404, // 0008 SETMBR R0 K2 R4 + 0x80000000, // 0009 RET 0 }) ) ); @@ -577,85 +485,31 @@ be_local_closure(Leds_segment_show, /* name */ /*******************************************************************/ -/******************************************************************** -** Solidified function: is_dirty -********************************************************************/ -be_local_closure(Leds_segment_is_dirty, /* name */ - be_nested_proto( - 3, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 2]) { /* constants */ - /* K0 */ be_nested_str(strip), - /* K1 */ be_nested_str(is_dirty), - }), - &be_const_str_is_dirty, - &be_const_str_solidified, - ( &(const binstruction[ 4]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x8C040301, // 0001 GETMET R1 R1 K1 - 0x7C040200, // 0002 CALL R1 1 - 0x80040200, // 0003 RET 1 R1 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: pixels_buffer -********************************************************************/ -be_local_closure(Leds_segment_pixels_buffer, /* name */ - be_nested_proto( - 2, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 0, /* has constants */ - NULL, /* no const */ - &be_const_str_pixels_buffer, - &be_const_str_solidified, - ( &(const binstruction[ 2]) { /* code */ - 0x4C040000, // 0000 LDNIL R1 - 0x80040200, // 0001 RET 1 R1 - }) - ) -); -/*******************************************************************/ - - /******************************************************************** ** Solidified class: Leds_segment ********************************************************************/ be_local_class(Leds_segment, 3, NULL, - be_nested_map(16, + be_nested_map(17, ( (struct bmapnode*) &(const bmapnode[]) { - { be_const_key(get_pixel_color, -1), be_const_closure(Leds_segment_get_pixel_color_closure) }, - { be_const_key(strip, -1), be_const_var(0) }, - { be_const_key(clear_to, 5), be_const_closure(Leds_segment_clear_to_closure) }, - { be_const_key(can_show, 13), be_const_closure(Leds_segment_can_show_closure) }, - { be_const_key(set_pixel_color, -1), be_const_closure(Leds_segment_set_pixel_color_closure) }, - { be_const_key(clear, -1), be_const_closure(Leds_segment_clear_closure) }, - { be_const_key(is_dirty, -1), be_const_closure(Leds_segment_is_dirty_closure) }, - { be_const_key(pixel_count, -1), be_const_closure(Leds_segment_pixel_count_closure) }, - { be_const_key(leds, -1), be_const_var(2) }, - { be_const_key(pixel_size, -1), be_const_closure(Leds_segment_pixel_size_closure) }, - { be_const_key(offset, -1), be_const_var(1) }, - { be_const_key(dirty, 8), be_const_closure(Leds_segment_dirty_closure) }, + { be_const_key(pixel_offset, 9), be_const_closure(Leds_segment_pixel_offset_closure) }, + { be_const_key(clear_to, -1), be_const_closure(Leds_segment_clear_to_closure) }, { be_const_key(show, -1), be_const_closure(Leds_segment_show_closure) }, + { be_const_key(pixels_buffer, 10), be_const_closure(Leds_segment_pixels_buffer_closure) }, + { be_const_key(offset, -1), be_const_var(1) }, + { be_const_key(dirty, -1), be_const_closure(Leds_segment_dirty_closure) }, + { be_const_key(can_show, -1), be_const_closure(Leds_segment_can_show_closure) }, + { be_const_key(set_pixel_color, 6), be_const_closure(Leds_segment_set_pixel_color_closure) }, + { be_const_key(get_pixel_color, -1), be_const_closure(Leds_segment_get_pixel_color_closure) }, + { be_const_key(pixel_count, -1), be_const_closure(Leds_segment_pixel_count_closure) }, + { be_const_key(strip, 7), be_const_var(0) }, + { be_const_key(leds, -1), be_const_var(2) }, + { be_const_key(begin, -1), be_const_closure(Leds_segment_begin_closure) }, + { be_const_key(is_dirty, 8), be_const_closure(Leds_segment_is_dirty_closure) }, + { be_const_key(pixel_size, -1), be_const_closure(Leds_segment_pixel_size_closure) }, { be_const_key(init, -1), be_const_closure(Leds_segment_init_closure) }, - { be_const_key(begin, 6), be_const_closure(Leds_segment_begin_closure) }, - { be_const_key(pixels_buffer, -1), be_const_closure(Leds_segment_pixels_buffer_closure) }, + { be_const_key(clear, 2), be_const_closure(Leds_segment_clear_closure) }, })), (bstring*) &be_const_str_Leds_segment ); @@ -712,918 +566,6 @@ be_local_closure(Leds_create_segment, /* name */ /*******************************************************************/ -/******************************************************************** -** Solidified function: is_dirty -********************************************************************/ -be_local_closure(Leds_is_dirty, /* name */ - be_nested_proto( - 4, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str(call_native), - }), - &be_const_str_is_dirty, - &be_const_str_solidified, - ( &(const binstruction[ 4]) { /* code */ - 0x8C040100, // 0000 GETMET R1 R0 K0 - 0x540E0003, // 0001 LDINT R3 4 - 0x7C040400, // 0002 CALL R1 2 - 0x80040200, // 0003 RET 1 R1 - }) - ) -); -/*******************************************************************/ - - -extern const bclass be_class_Leds_matrix; - -/******************************************************************** -** Solidified function: pixels_buffer -********************************************************************/ -be_local_closure(Leds_matrix_pixels_buffer, /* name */ - be_nested_proto( - 3, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 2]) { /* constants */ - /* K0 */ be_nested_str(strip), - /* K1 */ be_nested_str(pixels_buffer), - }), - &be_const_str_pixels_buffer, - &be_const_str_solidified, - ( &(const binstruction[ 4]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x8C040301, // 0001 GETMET R1 R1 K1 - 0x7C040200, // 0002 CALL R1 1 - 0x80040200, // 0003 RET 1 R1 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: init -********************************************************************/ -be_local_closure(Leds_matrix_init, /* name */ - be_nested_proto( - 7, /* nstack */ - 5, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 9]) { /* constants */ - /* K0 */ be_nested_str(strip), - /* K1 */ be_nested_str(offset), - /* K2 */ be_nested_str(h), - /* K3 */ be_nested_str(w), - /* K4 */ be_nested_str(alternate), - /* K5 */ be_nested_str(pix_buffer), - /* K6 */ be_nested_str(pixels_buffer), - /* K7 */ be_nested_str(pix_size), - /* K8 */ be_nested_str(pixel_size), - }), - &be_const_str_init, - &be_const_str_solidified, - ( &(const binstruction[15]) { /* code */ - 0x90020001, // 0000 SETMBR R0 K0 R1 - 0x90020204, // 0001 SETMBR R0 K1 R4 - 0x90020403, // 0002 SETMBR R0 K2 R3 - 0x90020602, // 0003 SETMBR R0 K3 R2 - 0x50140000, // 0004 LDBOOL R5 0 0 - 0x90020805, // 0005 SETMBR R0 K4 R5 - 0x88140100, // 0006 GETMBR R5 R0 K0 - 0x8C140B06, // 0007 GETMET R5 R5 K6 - 0x7C140200, // 0008 CALL R5 1 - 0x90020A05, // 0009 SETMBR R0 K5 R5 - 0x88140100, // 000A GETMBR R5 R0 K0 - 0x8C140B08, // 000B GETMET R5 R5 K8 - 0x7C140200, // 000C CALL R5 1 - 0x90020E05, // 000D SETMBR R0 K7 R5 - 0x80000000, // 000E RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: set_pixel_color -********************************************************************/ -be_local_closure(Leds_matrix_set_pixel_color, /* name */ - be_nested_proto( - 9, /* nstack */ - 4, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 3]) { /* constants */ - /* K0 */ be_nested_str(strip), - /* K1 */ be_nested_str(set_pixel_color), - /* K2 */ be_nested_str(offset), - }), - &be_const_str_set_pixel_color, - &be_const_str_solidified, - ( &(const binstruction[ 8]) { /* code */ - 0x88100100, // 0000 GETMBR R4 R0 K0 - 0x8C100901, // 0001 GETMET R4 R4 K1 - 0x88180102, // 0002 GETMBR R6 R0 K2 - 0x00180206, // 0003 ADD R6 R1 R6 - 0x5C1C0400, // 0004 MOVE R7 R2 - 0x5C200600, // 0005 MOVE R8 R3 - 0x7C100800, // 0006 CALL R4 4 - 0x80000000, // 0007 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: begin -********************************************************************/ -be_local_closure(Leds_matrix_begin, /* name */ - be_nested_proto( - 1, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 0, /* has constants */ - NULL, /* no const */ - &be_const_str_begin, - &be_const_str_solidified, - ( &(const binstruction[ 1]) { /* code */ - 0x80000000, // 0000 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: get_pixel_color -********************************************************************/ -be_local_closure(Leds_matrix_get_pixel_color, /* name */ - be_nested_proto( - 5, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 3]) { /* constants */ - /* K0 */ be_nested_str(strip), - /* K1 */ be_nested_str(get_pixel_color), - /* K2 */ be_nested_str(offseta), - }), - &be_const_str_get_pixel_color, - &be_const_str_solidified, - ( &(const binstruction[ 6]) { /* code */ - 0x88080100, // 0000 GETMBR R2 R0 K0 - 0x8C080501, // 0001 GETMET R2 R2 K1 - 0x88100102, // 0002 GETMBR R4 R0 K2 - 0x00100204, // 0003 ADD R4 R1 R4 - 0x7C080400, // 0004 CALL R2 2 - 0x80040400, // 0005 RET 1 R2 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: pixel_size -********************************************************************/ -be_local_closure(Leds_matrix_pixel_size, /* name */ - be_nested_proto( - 2, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str(pix_size), - }), - &be_const_str_pixel_size, - &be_const_str_solidified, - ( &(const binstruction[ 2]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x80040200, // 0001 RET 1 R1 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: set_alternate -********************************************************************/ -be_local_closure(Leds_matrix_set_alternate, /* name */ - be_nested_proto( - 2, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str(alternate), - }), - &be_const_str_set_alternate, - &be_const_str_solidified, - ( &(const binstruction[ 2]) { /* code */ - 0x90020001, // 0000 SETMBR R0 K0 R1 - 0x80000000, // 0001 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: can_show -********************************************************************/ -be_local_closure(Leds_matrix_can_show, /* name */ - be_nested_proto( - 3, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 2]) { /* constants */ - /* K0 */ be_nested_str(strip), - /* K1 */ be_nested_str(can_show), - }), - &be_const_str_can_show, - &be_const_str_solidified, - ( &(const binstruction[ 4]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x8C040301, // 0001 GETMET R1 R1 K1 - 0x7C040200, // 0002 CALL R1 1 - 0x80040200, // 0003 RET 1 R1 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: clear -********************************************************************/ -be_local_closure(Leds_matrix_clear, /* name */ - be_nested_proto( - 4, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 3]) { /* constants */ - /* K0 */ be_nested_str(clear_to), - /* K1 */ be_const_int(0), - /* K2 */ be_nested_str(show), - }), - &be_const_str_clear, - &be_const_str_solidified, - ( &(const binstruction[ 6]) { /* code */ - 0x8C040100, // 0000 GETMET R1 R0 K0 - 0x580C0001, // 0001 LDCONST R3 K1 - 0x7C040400, // 0002 CALL R1 2 - 0x8C040102, // 0003 GETMET R1 R0 K2 - 0x7C040200, // 0004 CALL R1 1 - 0x80000000, // 0005 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: set_matrix_pixel_color -********************************************************************/ -be_local_closure(Leds_matrix_set_matrix_pixel_color, /* name */ - be_nested_proto( - 10, /* nstack */ - 5, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 8]) { /* constants */ - /* K0 */ be_nested_str(alternate), - /* K1 */ be_const_int(2), - /* K2 */ be_nested_str(strip), - /* K3 */ be_nested_str(set_pixel_color), - /* K4 */ be_nested_str(w), - /* K5 */ be_nested_str(h), - /* K6 */ be_const_int(1), - /* K7 */ be_nested_str(offset), - }), - &be_const_str_set_matrix_pixel_color, - &be_const_str_solidified, - ( &(const binstruction[29]) { /* code */ - 0x88140100, // 0000 GETMBR R5 R0 K0 - 0x7816000F, // 0001 JMPF R5 #0012 - 0x10140301, // 0002 MOD R5 R1 K1 - 0x7816000D, // 0003 JMPF R5 #0012 - 0x88140102, // 0004 GETMBR R5 R0 K2 - 0x8C140B03, // 0005 GETMET R5 R5 K3 - 0x881C0104, // 0006 GETMBR R7 R0 K4 - 0x081C0207, // 0007 MUL R7 R1 R7 - 0x88200105, // 0008 GETMBR R8 R0 K5 - 0x001C0E08, // 0009 ADD R7 R7 R8 - 0x041C0E02, // 000A SUB R7 R7 R2 - 0x041C0F06, // 000B SUB R7 R7 K6 - 0x88200107, // 000C GETMBR R8 R0 K7 - 0x001C0E08, // 000D ADD R7 R7 R8 - 0x5C200600, // 000E MOVE R8 R3 - 0x5C240800, // 000F MOVE R9 R4 - 0x7C140800, // 0010 CALL R5 4 - 0x70020009, // 0011 JMP #001C - 0x88140102, // 0012 GETMBR R5 R0 K2 - 0x8C140B03, // 0013 GETMET R5 R5 K3 - 0x881C0104, // 0014 GETMBR R7 R0 K4 - 0x081C0207, // 0015 MUL R7 R1 R7 - 0x001C0E02, // 0016 ADD R7 R7 R2 - 0x88200107, // 0017 GETMBR R8 R0 K7 - 0x001C0E08, // 0018 ADD R7 R7 R8 - 0x5C200600, // 0019 MOVE R8 R3 - 0x5C240800, // 001A MOVE R9 R4 - 0x7C140800, // 001B CALL R5 4 - 0x80000000, // 001C RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: pixel_count -********************************************************************/ -be_local_closure(Leds_matrix_pixel_count, /* name */ - be_nested_proto( - 3, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 2]) { /* constants */ - /* K0 */ be_nested_str(w), - /* K1 */ be_nested_str(h), - }), - &be_const_str_pixel_count, - &be_const_str_solidified, - ( &(const binstruction[ 4]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x88080101, // 0001 GETMBR R2 R0 K1 - 0x08040202, // 0002 MUL R1 R1 R2 - 0x80040200, // 0003 RET 1 R1 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: show -********************************************************************/ -be_local_closure(Leds_matrix_show, /* name */ - be_nested_proto( - 5, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 9]) { /* constants */ - /* K0 */ be_nested_str(offset), - /* K1 */ be_const_int(0), - /* K2 */ be_nested_str(w), - /* K3 */ be_nested_str(h), - /* K4 */ be_nested_str(strip), - /* K5 */ be_nested_str(leds), - /* K6 */ be_nested_str(show), - /* K7 */ be_nested_str(pix_buffer), - /* K8 */ be_nested_str(pixels_buffer), - }), - &be_const_str_show, - &be_const_str_solidified, - ( &(const binstruction[23]) { /* code */ - 0x60080017, // 0000 GETGBL R2 G23 - 0x5C0C0200, // 0001 MOVE R3 R1 - 0x7C080200, // 0002 CALL R2 1 - 0x740A0009, // 0003 JMPT R2 #000E - 0x88080100, // 0004 GETMBR R2 R0 K0 - 0x1C080501, // 0005 EQ R2 R2 K1 - 0x780A000E, // 0006 JMPF R2 #0016 - 0x88080102, // 0007 GETMBR R2 R0 K2 - 0x880C0103, // 0008 GETMBR R3 R0 K3 - 0x08080403, // 0009 MUL R2 R2 R3 - 0x880C0104, // 000A GETMBR R3 R0 K4 - 0x880C0705, // 000B GETMBR R3 R3 K5 - 0x1C080403, // 000C EQ R2 R2 R3 - 0x780A0007, // 000D JMPF R2 #0016 - 0x88080104, // 000E GETMBR R2 R0 K4 - 0x8C080506, // 000F GETMET R2 R2 K6 - 0x7C080200, // 0010 CALL R2 1 - 0x88080104, // 0011 GETMBR R2 R0 K4 - 0x8C080508, // 0012 GETMET R2 R2 K8 - 0x88100107, // 0013 GETMBR R4 R0 K7 - 0x7C080400, // 0014 CALL R2 2 - 0x90020E02, // 0015 SETMBR R0 K7 R2 - 0x80000000, // 0016 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: clear_to -********************************************************************/ -be_local_closure(Leds_matrix_clear_to, /* name */ - be_nested_proto( - 9, /* nstack */ - 3, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 7]) { /* constants */ - /* K0 */ be_const_int(0), - /* K1 */ be_nested_str(w), - /* K2 */ be_nested_str(h), - /* K3 */ be_nested_str(strip), - /* K4 */ be_nested_str(set_pixel_color), - /* K5 */ be_nested_str(offset), - /* K6 */ be_const_int(1), - }), - &be_const_str_clear_to, - &be_const_str_solidified, - ( &(const binstruction[16]) { /* code */ - 0x580C0000, // 0000 LDCONST R3 K0 - 0x88100101, // 0001 GETMBR R4 R0 K1 - 0x88140102, // 0002 GETMBR R5 R0 K2 - 0x08100805, // 0003 MUL R4 R4 R5 - 0x14100604, // 0004 LT R4 R3 R4 - 0x78120008, // 0005 JMPF R4 #000F - 0x88100103, // 0006 GETMBR R4 R0 K3 - 0x8C100904, // 0007 GETMET R4 R4 K4 - 0x88180105, // 0008 GETMBR R6 R0 K5 - 0x00180606, // 0009 ADD R6 R3 R6 - 0x5C1C0200, // 000A MOVE R7 R1 - 0x5C200400, // 000B MOVE R8 R2 - 0x7C100800, // 000C CALL R4 4 - 0x000C0706, // 000D ADD R3 R3 K6 - 0x7001FFF1, // 000E JMP #0001 - 0x80000000, // 000F RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: dirty -********************************************************************/ -be_local_closure(Leds_matrix_dirty, /* name */ - be_nested_proto( - 3, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 2]) { /* constants */ - /* K0 */ be_nested_str(strip), - /* K1 */ be_nested_str(dirty), - }), - &be_const_str_dirty, - &be_const_str_solidified, - ( &(const binstruction[ 4]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x8C040301, // 0001 GETMET R1 R1 K1 - 0x7C040200, // 0002 CALL R1 1 - 0x80000000, // 0003 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: get_alternate -********************************************************************/ -be_local_closure(Leds_matrix_get_alternate, /* name */ - be_nested_proto( - 2, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str(alternate), - }), - &be_const_str_get_alternate, - &be_const_str_solidified, - ( &(const binstruction[ 2]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x80040200, // 0001 RET 1 R1 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: is_dirty -********************************************************************/ -be_local_closure(Leds_matrix_is_dirty, /* name */ - be_nested_proto( - 3, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 2]) { /* constants */ - /* K0 */ be_nested_str(strip), - /* K1 */ be_nested_str(is_dirty), - }), - &be_const_str_is_dirty, - &be_const_str_solidified, - ( &(const binstruction[ 4]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x8C040301, // 0001 GETMET R1 R1 K1 - 0x7C040200, // 0002 CALL R1 1 - 0x80040200, // 0003 RET 1 R1 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: set_bytes -********************************************************************/ -be_local_closure(Leds_matrix_set_bytes, /* name */ - be_nested_proto( - 13, /* nstack */ - 5, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 5]) { /* constants */ - /* K0 */ be_nested_str(h), - /* K1 */ be_nested_str(pix_size), - /* K2 */ be_nested_str(offset), - /* K3 */ be_nested_str(pix_buffer), - /* K4 */ be_nested_str(setbytes), - }), - &be_const_str_set_bytes, - &be_const_str_solidified, - ( &(const binstruction[17]) { /* code */ - 0x88140100, // 0000 GETMBR R5 R0 K0 - 0x88180101, // 0001 GETMBR R6 R0 K1 - 0x08140A06, // 0002 MUL R5 R5 R6 - 0x24180805, // 0003 GT R6 R4 R5 - 0x781A0000, // 0004 JMPF R6 #0006 - 0x5C100A00, // 0005 MOVE R4 R5 - 0x88180102, // 0006 GETMBR R6 R0 K2 - 0x00180C01, // 0007 ADD R6 R6 R1 - 0x08180C05, // 0008 MUL R6 R6 R5 - 0x881C0103, // 0009 GETMBR R7 R0 K3 - 0x8C1C0F04, // 000A GETMET R7 R7 K4 - 0x5C240C00, // 000B MOVE R9 R6 - 0x5C280400, // 000C MOVE R10 R2 - 0x5C2C0600, // 000D MOVE R11 R3 - 0x5C300800, // 000E MOVE R12 R4 - 0x7C1C0A00, // 000F CALL R7 5 - 0x80000000, // 0010 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified class: Leds_matrix -********************************************************************/ -be_local_class(Leds_matrix, - 7, - NULL, - be_nested_map(24, - ( (struct bmapnode*) &(const bmapnode[]) { - { be_const_key(set_bytes, -1), be_const_closure(Leds_matrix_set_bytes_closure) }, - { be_const_key(pix_buffer, -1), be_const_var(5) }, - { be_const_key(pix_size, 20), be_const_var(6) }, - { be_const_key(init, -1), be_const_closure(Leds_matrix_init_closure) }, - { be_const_key(set_pixel_color, 16), be_const_closure(Leds_matrix_set_pixel_color_closure) }, - { be_const_key(alternate, -1), be_const_var(4) }, - { be_const_key(begin, -1), be_const_closure(Leds_matrix_begin_closure) }, - { be_const_key(h, -1), be_const_var(2) }, - { be_const_key(get_pixel_color, -1), be_const_closure(Leds_matrix_get_pixel_color_closure) }, - { be_const_key(pixel_size, 21), be_const_closure(Leds_matrix_pixel_size_closure) }, - { be_const_key(set_alternate, -1), be_const_closure(Leds_matrix_set_alternate_closure) }, - { be_const_key(can_show, -1), be_const_closure(Leds_matrix_can_show_closure) }, - { be_const_key(get_alternate, 13), be_const_closure(Leds_matrix_get_alternate_closure) }, - { be_const_key(w, -1), be_const_var(3) }, - { be_const_key(set_matrix_pixel_color, 12), be_const_closure(Leds_matrix_set_matrix_pixel_color_closure) }, - { be_const_key(pixel_count, -1), be_const_closure(Leds_matrix_pixel_count_closure) }, - { be_const_key(show, -1), be_const_closure(Leds_matrix_show_closure) }, - { be_const_key(offset, -1), be_const_var(1) }, - { be_const_key(clear_to, 17), be_const_closure(Leds_matrix_clear_to_closure) }, - { be_const_key(dirty, -1), be_const_closure(Leds_matrix_dirty_closure) }, - { be_const_key(clear, 10), be_const_closure(Leds_matrix_clear_closure) }, - { be_const_key(strip, -1), be_const_var(0) }, - { be_const_key(is_dirty, -1), be_const_closure(Leds_matrix_is_dirty_closure) }, - { be_const_key(pixels_buffer, 0), be_const_closure(Leds_matrix_pixels_buffer_closure) }, - })), - (bstring*) &be_const_str_Leds_matrix -); - -/******************************************************************** -** Solidified function: create_matrix -********************************************************************/ -be_local_closure(Leds_create_matrix, /* name */ - be_nested_proto( - 10, /* nstack */ - 4, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 5]) { /* constants */ - /* K0 */ be_const_int(0), - /* K1 */ be_nested_str(leds), - /* K2 */ be_nested_str(value_error), - /* K3 */ be_nested_str(out_X20of_X20range), - /* K4 */ be_const_class(be_class_Leds_matrix), - }), - &be_const_str_create_matrix, - &be_const_str_solidified, - ( &(const binstruction[37]) { /* code */ - 0x60100009, // 0000 GETGBL R4 G9 - 0x5C140600, // 0001 MOVE R5 R3 - 0x7C100200, // 0002 CALL R4 1 - 0x5C0C0800, // 0003 MOVE R3 R4 - 0x60100009, // 0004 GETGBL R4 G9 - 0x5C140200, // 0005 MOVE R5 R1 - 0x7C100200, // 0006 CALL R4 1 - 0x5C040800, // 0007 MOVE R1 R4 - 0x60100009, // 0008 GETGBL R4 G9 - 0x5C140400, // 0009 MOVE R5 R2 - 0x7C100200, // 000A CALL R4 1 - 0x5C080800, // 000B MOVE R2 R4 - 0x4C100000, // 000C LDNIL R4 - 0x1C100604, // 000D EQ R4 R3 R4 - 0x78120000, // 000E JMPF R4 #0010 - 0x580C0000, // 000F LDCONST R3 K0 - 0x08100202, // 0010 MUL R4 R1 R2 - 0x00100803, // 0011 ADD R4 R4 R3 - 0x88140101, // 0012 GETMBR R5 R0 K1 - 0x24100805, // 0013 GT R4 R4 R5 - 0x74120005, // 0014 JMPT R4 #001B - 0x14100500, // 0015 LT R4 R2 K0 - 0x74120003, // 0016 JMPT R4 #001B - 0x14100300, // 0017 LT R4 R1 K0 - 0x74120001, // 0018 JMPT R4 #001B - 0x14100700, // 0019 LT R4 R3 K0 - 0x78120000, // 001A JMPF R4 #001C - 0xB0060503, // 001B RAISE 1 K2 K3 - 0x58100004, // 001C LDCONST R4 K4 - 0xB4000004, // 001D CLASS K4 - 0x5C140800, // 001E MOVE R5 R4 - 0x5C180000, // 001F MOVE R6 R0 - 0x5C1C0200, // 0020 MOVE R7 R1 - 0x5C200400, // 0021 MOVE R8 R2 - 0x5C240600, // 0022 MOVE R9 R3 - 0x7C140800, // 0023 CALL R5 4 - 0x80040A00, // 0024 RET 1 R5 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: pixels_buffer -********************************************************************/ -be_local_closure(Leds_pixels_buffer, /* name */ - be_nested_proto( - 8, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 4]) { /* constants */ - /* K0 */ be_nested_str(call_native), - /* K1 */ be_nested_str(pixel_size), - /* K2 */ be_nested_str(pixel_count), - /* K3 */ be_nested_str(_change_buffer), - }), - &be_const_str_pixels_buffer, - &be_const_str_solidified, - ( &(const binstruction[21]) { /* code */ - 0x8C080100, // 0000 GETMET R2 R0 K0 - 0x54120005, // 0001 LDINT R4 6 - 0x7C080400, // 0002 CALL R2 2 - 0x4C0C0000, // 0003 LDNIL R3 - 0x1C0C0203, // 0004 EQ R3 R1 R3 - 0x780E0009, // 0005 JMPF R3 #0010 - 0x600C0015, // 0006 GETGBL R3 G21 - 0x5C100400, // 0007 MOVE R4 R2 - 0x8C140101, // 0008 GETMET R5 R0 K1 - 0x7C140200, // 0009 CALL R5 1 - 0x8C180102, // 000A GETMET R6 R0 K2 - 0x7C180200, // 000B CALL R6 1 - 0x08140A06, // 000C MUL R5 R5 R6 - 0x7C0C0400, // 000D CALL R3 2 - 0x80040600, // 000E RET 1 R3 - 0x70020003, // 000F JMP #0014 - 0x8C0C0303, // 0010 GETMET R3 R1 K3 - 0x5C140400, // 0011 MOVE R5 R2 - 0x7C0C0400, // 0012 CALL R3 2 - 0x80040200, // 0013 RET 1 R1 - 0x80000000, // 0014 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: init -********************************************************************/ -be_local_closure(Leds_init, /* name */ - be_nested_proto( - 11, /* nstack */ - 5, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 9]) { /* constants */ - /* K0 */ be_nested_str(gamma), - /* K1 */ be_nested_str(leds), - /* K2 */ be_nested_str(valuer_error), - /* K3 */ be_nested_str(no_X20GPIO_X20specified_X20for_X20neopixelbus), - /* K4 */ be_nested_str(ctor), - /* K5 */ be_nested_str(_p), - /* K6 */ be_nested_str(internal_error), - /* K7 */ be_nested_str(couldn_X27t_X20not_X20initialize_X20noepixelbus), - /* K8 */ be_nested_str(begin), - }), - &be_const_str_init, - &be_const_str_solidified, - ( &(const binstruction[24]) { /* code */ - 0x50140200, // 0000 LDBOOL R5 1 0 - 0x90020005, // 0001 SETMBR R0 K0 R5 - 0x60140009, // 0002 GETGBL R5 G9 - 0x5C180200, // 0003 MOVE R6 R1 - 0x7C140200, // 0004 CALL R5 1 - 0x90020205, // 0005 SETMBR R0 K1 R5 - 0x4C140000, // 0006 LDNIL R5 - 0x1C140405, // 0007 EQ R5 R2 R5 - 0x78160000, // 0008 JMPF R5 #000A - 0xB0060503, // 0009 RAISE 1 K2 K3 - 0x8C140104, // 000A GETMET R5 R0 K4 - 0x881C0101, // 000B GETMBR R7 R0 K1 - 0x5C200400, // 000C MOVE R8 R2 - 0x5C240600, // 000D MOVE R9 R3 - 0x5C280800, // 000E MOVE R10 R4 - 0x7C140A00, // 000F CALL R5 5 - 0x88140105, // 0010 GETMBR R5 R0 K5 - 0x4C180000, // 0011 LDNIL R6 - 0x1C140A06, // 0012 EQ R5 R5 R6 - 0x78160000, // 0013 JMPF R5 #0015 - 0xB0060D07, // 0014 RAISE 1 K6 K7 - 0x8C140108, // 0015 GETMET R5 R0 K8 - 0x7C140200, // 0016 CALL R5 1 - 0x80000000, // 0017 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: dirty -********************************************************************/ -be_local_closure(Leds_dirty, /* name */ - be_nested_proto( - 4, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str(call_native), - }), - &be_const_str_dirty, - &be_const_str_solidified, - ( &(const binstruction[ 4]) { /* code */ - 0x8C040100, // 0000 GETMET R1 R0 K0 - 0x540E0004, // 0001 LDINT R3 5 - 0x7C040400, // 0002 CALL R1 2 - 0x80000000, // 0003 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: get_pixel_color -********************************************************************/ -be_local_closure(Leds_get_pixel_color, /* name */ - be_nested_proto( - 6, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str(call_native), - }), - &be_const_str_get_pixel_color, - &be_const_str_solidified, - ( &(const binstruction[ 5]) { /* code */ - 0x8C080100, // 0000 GETMET R2 R0 K0 - 0x5412000A, // 0001 LDINT R4 11 - 0x5C140200, // 0002 MOVE R5 R1 - 0x7C080600, // 0003 CALL R2 3 - 0x80040400, // 0004 RET 1 R2 - }) - ) -); -/*******************************************************************/ - - /******************************************************************** ** Solidified function: assign_rmt ********************************************************************/ @@ -1738,9 +680,79 @@ be_local_closure(Leds_assign_rmt, /* name */ /******************************************************************** -** Solidified function: pixel_size +** Solidified function: can_show ********************************************************************/ -be_local_closure(Leds_pixel_size, /* name */ +be_local_closure(Leds_can_show, /* name */ + be_nested_proto( + 4, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(call_native), + /* K1 */ be_const_int(3), + }), + &be_const_str_can_show, + &be_const_str_solidified, + ( &(const binstruction[ 4]) { /* code */ + 0x8C040100, // 0000 GETMET R1 R0 K0 + 0x580C0001, // 0001 LDCONST R3 K1 + 0x7C040400, // 0002 CALL R1 2 + 0x80040200, // 0003 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: matrix +********************************************************************/ +be_local_closure(Leds_matrix, /* name */ + be_nested_proto( + 11, /* nstack */ + 4, /* argc */ + 4, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 4]) { /* constants */ + /* K0 */ be_const_class(be_class_Leds), + /* K1 */ be_nested_str(Leds), + /* K2 */ be_nested_str(create_matrix), + /* K3 */ be_const_int(0), + }), + &be_const_str_matrix, + &be_const_str_solidified, + ( &(const binstruction[12]) { /* code */ + 0x58100000, // 0000 LDCONST R4 K0 + 0xB8160200, // 0001 GETNGBL R5 K1 + 0x08180001, // 0002 MUL R6 R0 R1 + 0x5C1C0400, // 0003 MOVE R7 R2 + 0x5C200600, // 0004 MOVE R8 R3 + 0x7C140600, // 0005 CALL R5 3 + 0x8C180B02, // 0006 GETMET R6 R5 K2 + 0x5C200000, // 0007 MOVE R8 R0 + 0x5C240200, // 0008 MOVE R9 R1 + 0x58280003, // 0009 LDCONST R10 K3 + 0x7C180800, // 000A CALL R6 4 + 0x80040C00, // 000B RET 1 R6 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: pixel_count +********************************************************************/ +be_local_closure(Leds_pixel_count, /* name */ be_nested_proto( 4, /* nstack */ 1, /* argc */ @@ -1753,11 +765,11 @@ be_local_closure(Leds_pixel_size, /* name */ ( &(const bvalue[ 1]) { /* constants */ /* K0 */ be_nested_str(call_native), }), - &be_const_str_pixel_size, + &be_const_str_pixel_count, &be_const_str_solidified, ( &(const binstruction[ 4]) { /* code */ 0x8C040100, // 0000 GETMET R1 R0 K0 - 0x540E0006, // 0001 LDINT R3 7 + 0x540E0007, // 0001 LDINT R3 8 0x7C040400, // 0002 CALL R1 2 0x80040200, // 0003 RET 1 R1 }) @@ -1766,12 +778,868 @@ be_local_closure(Leds_pixel_size, /* name */ /*******************************************************************/ +/******************************************************************** +** Solidified function: is_dirty +********************************************************************/ +be_local_closure(Leds_is_dirty, /* name */ + be_nested_proto( + 4, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str(call_native), + }), + &be_const_str_is_dirty, + &be_const_str_solidified, + ( &(const binstruction[ 4]) { /* code */ + 0x8C040100, // 0000 GETMET R1 R0 K0 + 0x540E0003, // 0001 LDINT R3 4 + 0x7C040400, // 0002 CALL R1 2 + 0x80040200, // 0003 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: pixels_buffer +********************************************************************/ +be_local_closure(Leds_pixels_buffer, /* name */ + be_nested_proto( + 8, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 4]) { /* constants */ + /* K0 */ be_nested_str(call_native), + /* K1 */ be_nested_str(pixel_size), + /* K2 */ be_nested_str(pixel_count), + /* K3 */ be_nested_str(_change_buffer), + }), + &be_const_str_pixels_buffer, + &be_const_str_solidified, + ( &(const binstruction[21]) { /* code */ + 0x8C080100, // 0000 GETMET R2 R0 K0 + 0x54120005, // 0001 LDINT R4 6 + 0x7C080400, // 0002 CALL R2 2 + 0x4C0C0000, // 0003 LDNIL R3 + 0x1C0C0203, // 0004 EQ R3 R1 R3 + 0x780E0009, // 0005 JMPF R3 #0010 + 0x600C0015, // 0006 GETGBL R3 G21 + 0x5C100400, // 0007 MOVE R4 R2 + 0x8C140101, // 0008 GETMET R5 R0 K1 + 0x7C140200, // 0009 CALL R5 1 + 0x8C180102, // 000A GETMET R6 R0 K2 + 0x7C180200, // 000B CALL R6 1 + 0x08140A06, // 000C MUL R5 R5 R6 + 0x7C0C0400, // 000D CALL R3 2 + 0x80040600, // 000E RET 1 R3 + 0x70020003, // 000F JMP #0014 + 0x8C0C0303, // 0010 GETMET R3 R1 K3 + 0x5C140400, // 0011 MOVE R5 R2 + 0x7C0C0400, // 0012 CALL R3 2 + 0x80040200, // 0013 RET 1 R1 + 0x80000000, // 0014 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_pixel_color +********************************************************************/ +be_local_closure(Leds_set_pixel_color, /* name */ + be_nested_proto( + 12, /* nstack */ + 4, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(call_native), + /* K1 */ be_nested_str(to_gamma), + }), + &be_const_str_set_pixel_color, + &be_const_str_solidified, + ( &(const binstruction[ 9]) { /* code */ + 0x8C100100, // 0000 GETMET R4 R0 K0 + 0x541A0009, // 0001 LDINT R6 10 + 0x5C1C0200, // 0002 MOVE R7 R1 + 0x8C200101, // 0003 GETMET R8 R0 K1 + 0x5C280400, // 0004 MOVE R10 R2 + 0x5C2C0600, // 0005 MOVE R11 R3 + 0x7C200600, // 0006 CALL R8 3 + 0x7C100800, // 0007 CALL R4 4 + 0x80000000, // 0008 RET 0 + }) + ) +); +/*******************************************************************/ + + +extern const bclass be_class_Leds_matrix; + +/******************************************************************** +** Solidified function: clear_to +********************************************************************/ +be_local_closure(Leds_matrix_clear_to, /* name */ + be_nested_proto( + 10, /* nstack */ + 3, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 6]) { /* constants */ + /* K0 */ be_nested_str(strip), + /* K1 */ be_nested_str(call_native), + /* K2 */ be_nested_str(to_gamma), + /* K3 */ be_nested_str(offset), + /* K4 */ be_nested_str(w), + /* K5 */ be_nested_str(h), + }), + &be_const_str_clear_to, + &be_const_str_solidified, + ( &(const binstruction[14]) { /* code */ + 0x880C0100, // 0000 GETMBR R3 R0 K0 + 0x8C0C0701, // 0001 GETMET R3 R3 K1 + 0x54160008, // 0002 LDINT R5 9 + 0x88180100, // 0003 GETMBR R6 R0 K0 + 0x8C180D02, // 0004 GETMET R6 R6 K2 + 0x5C200200, // 0005 MOVE R8 R1 + 0x5C240400, // 0006 MOVE R9 R2 + 0x7C180600, // 0007 CALL R6 3 + 0x881C0103, // 0008 GETMBR R7 R0 K3 + 0x88200104, // 0009 GETMBR R8 R0 K4 + 0x88240105, // 000A GETMBR R9 R0 K5 + 0x08201009, // 000B MUL R8 R8 R9 + 0x7C0C0A00, // 000C CALL R3 5 + 0x80000000, // 000D RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: show +********************************************************************/ +be_local_closure(Leds_matrix_show, /* name */ + be_nested_proto( + 5, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 9]) { /* constants */ + /* K0 */ be_nested_str(offset), + /* K1 */ be_const_int(0), + /* K2 */ be_nested_str(w), + /* K3 */ be_nested_str(h), + /* K4 */ be_nested_str(strip), + /* K5 */ be_nested_str(leds), + /* K6 */ be_nested_str(show), + /* K7 */ be_nested_str(pix_buffer), + /* K8 */ be_nested_str(pixels_buffer), + }), + &be_const_str_show, + &be_const_str_solidified, + ( &(const binstruction[23]) { /* code */ + 0x60080017, // 0000 GETGBL R2 G23 + 0x5C0C0200, // 0001 MOVE R3 R1 + 0x7C080200, // 0002 CALL R2 1 + 0x740A0009, // 0003 JMPT R2 #000E + 0x88080100, // 0004 GETMBR R2 R0 K0 + 0x1C080501, // 0005 EQ R2 R2 K1 + 0x780A000E, // 0006 JMPF R2 #0016 + 0x88080102, // 0007 GETMBR R2 R0 K2 + 0x880C0103, // 0008 GETMBR R3 R0 K3 + 0x08080403, // 0009 MUL R2 R2 R3 + 0x880C0104, // 000A GETMBR R3 R0 K4 + 0x880C0705, // 000B GETMBR R3 R3 K5 + 0x1C080403, // 000C EQ R2 R2 R3 + 0x780A0007, // 000D JMPF R2 #0016 + 0x88080104, // 000E GETMBR R2 R0 K4 + 0x8C080506, // 000F GETMET R2 R2 K6 + 0x7C080200, // 0010 CALL R2 1 + 0x88080104, // 0011 GETMBR R2 R0 K4 + 0x8C080508, // 0012 GETMET R2 R2 K8 + 0x88100107, // 0013 GETMBR R4 R0 K7 + 0x7C080400, // 0014 CALL R2 2 + 0x90020E02, // 0015 SETMBR R0 K7 R2 + 0x80000000, // 0016 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: pixel_size +********************************************************************/ +be_local_closure(Leds_matrix_pixel_size, /* name */ + be_nested_proto( + 2, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str(pix_size), + }), + &be_const_str_pixel_size, + &be_const_str_solidified, + ( &(const binstruction[ 2]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x80040200, // 0001 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: init +********************************************************************/ +be_local_closure(Leds_matrix_init, /* name */ + be_nested_proto( + 7, /* nstack */ + 5, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 9]) { /* constants */ + /* K0 */ be_nested_str(strip), + /* K1 */ be_nested_str(offset), + /* K2 */ be_nested_str(h), + /* K3 */ be_nested_str(w), + /* K4 */ be_nested_str(alternate), + /* K5 */ be_nested_str(pix_buffer), + /* K6 */ be_nested_str(pixels_buffer), + /* K7 */ be_nested_str(pix_size), + /* K8 */ be_nested_str(pixel_size), + }), + &be_const_str_init, + &be_const_str_solidified, + ( &(const binstruction[15]) { /* code */ + 0x90020001, // 0000 SETMBR R0 K0 R1 + 0x90020204, // 0001 SETMBR R0 K1 R4 + 0x90020403, // 0002 SETMBR R0 K2 R3 + 0x90020602, // 0003 SETMBR R0 K3 R2 + 0x50140000, // 0004 LDBOOL R5 0 0 + 0x90020805, // 0005 SETMBR R0 K4 R5 + 0x88140100, // 0006 GETMBR R5 R0 K0 + 0x8C140B06, // 0007 GETMET R5 R5 K6 + 0x7C140200, // 0008 CALL R5 1 + 0x90020A05, // 0009 SETMBR R0 K5 R5 + 0x88140100, // 000A GETMBR R5 R0 K0 + 0x8C140B08, // 000B GETMET R5 R5 K8 + 0x7C140200, // 000C CALL R5 1 + 0x90020E05, // 000D SETMBR R0 K7 R5 + 0x80000000, // 000E RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_pixel_color +********************************************************************/ +be_local_closure(Leds_matrix_set_pixel_color, /* name */ + be_nested_proto( + 9, /* nstack */ + 4, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 3]) { /* constants */ + /* K0 */ be_nested_str(strip), + /* K1 */ be_nested_str(set_pixel_color), + /* K2 */ be_nested_str(offset), + }), + &be_const_str_set_pixel_color, + &be_const_str_solidified, + ( &(const binstruction[ 8]) { /* code */ + 0x88100100, // 0000 GETMBR R4 R0 K0 + 0x8C100901, // 0001 GETMET R4 R4 K1 + 0x88180102, // 0002 GETMBR R6 R0 K2 + 0x00180206, // 0003 ADD R6 R1 R6 + 0x5C1C0400, // 0004 MOVE R7 R2 + 0x5C200600, // 0005 MOVE R8 R3 + 0x7C100800, // 0006 CALL R4 4 + 0x80000000, // 0007 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: pixels_buffer +********************************************************************/ +be_local_closure(Leds_matrix_pixels_buffer, /* name */ + be_nested_proto( + 3, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(strip), + /* K1 */ be_nested_str(pixels_buffer), + }), + &be_const_str_pixels_buffer, + &be_const_str_solidified, + ( &(const binstruction[ 4]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x8C040301, // 0001 GETMET R1 R1 K1 + 0x7C040200, // 0002 CALL R1 1 + 0x80040200, // 0003 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: dirty +********************************************************************/ +be_local_closure(Leds_matrix_dirty, /* name */ + be_nested_proto( + 3, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(strip), + /* K1 */ be_nested_str(dirty), + }), + &be_const_str_dirty, + &be_const_str_solidified, + ( &(const binstruction[ 4]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x8C040301, // 0001 GETMET R1 R1 K1 + 0x7C040200, // 0002 CALL R1 1 + 0x80000000, // 0003 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_matrix_pixel_color +********************************************************************/ +be_local_closure(Leds_matrix_set_matrix_pixel_color, /* name */ + be_nested_proto( + 10, /* nstack */ + 5, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 8]) { /* constants */ + /* K0 */ be_nested_str(alternate), + /* K1 */ be_const_int(2), + /* K2 */ be_nested_str(strip), + /* K3 */ be_nested_str(set_pixel_color), + /* K4 */ be_nested_str(w), + /* K5 */ be_nested_str(h), + /* K6 */ be_const_int(1), + /* K7 */ be_nested_str(offset), + }), + &be_const_str_set_matrix_pixel_color, + &be_const_str_solidified, + ( &(const binstruction[29]) { /* code */ + 0x88140100, // 0000 GETMBR R5 R0 K0 + 0x7816000F, // 0001 JMPF R5 #0012 + 0x10140301, // 0002 MOD R5 R1 K1 + 0x7816000D, // 0003 JMPF R5 #0012 + 0x88140102, // 0004 GETMBR R5 R0 K2 + 0x8C140B03, // 0005 GETMET R5 R5 K3 + 0x881C0104, // 0006 GETMBR R7 R0 K4 + 0x081C0207, // 0007 MUL R7 R1 R7 + 0x88200105, // 0008 GETMBR R8 R0 K5 + 0x001C0E08, // 0009 ADD R7 R7 R8 + 0x041C0E02, // 000A SUB R7 R7 R2 + 0x041C0F06, // 000B SUB R7 R7 K6 + 0x88200107, // 000C GETMBR R8 R0 K7 + 0x001C0E08, // 000D ADD R7 R7 R8 + 0x5C200600, // 000E MOVE R8 R3 + 0x5C240800, // 000F MOVE R9 R4 + 0x7C140800, // 0010 CALL R5 4 + 0x70020009, // 0011 JMP #001C + 0x88140102, // 0012 GETMBR R5 R0 K2 + 0x8C140B03, // 0013 GETMET R5 R5 K3 + 0x881C0104, // 0014 GETMBR R7 R0 K4 + 0x081C0207, // 0015 MUL R7 R1 R7 + 0x001C0E02, // 0016 ADD R7 R7 R2 + 0x88200107, // 0017 GETMBR R8 R0 K7 + 0x001C0E08, // 0018 ADD R7 R7 R8 + 0x5C200600, // 0019 MOVE R8 R3 + 0x5C240800, // 001A MOVE R9 R4 + 0x7C140800, // 001B CALL R5 4 + 0x80000000, // 001C RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: is_dirty +********************************************************************/ +be_local_closure(Leds_matrix_is_dirty, /* name */ + be_nested_proto( + 3, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(strip), + /* K1 */ be_nested_str(is_dirty), + }), + &be_const_str_is_dirty, + &be_const_str_solidified, + ( &(const binstruction[ 4]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x8C040301, // 0001 GETMET R1 R1 K1 + 0x7C040200, // 0002 CALL R1 1 + 0x80040200, // 0003 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_alternate +********************************************************************/ +be_local_closure(Leds_matrix_set_alternate, /* name */ + be_nested_proto( + 2, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str(alternate), + }), + &be_const_str_set_alternate, + &be_const_str_solidified, + ( &(const binstruction[ 2]) { /* code */ + 0x90020001, // 0000 SETMBR R0 K0 R1 + 0x80000000, // 0001 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: begin +********************************************************************/ +be_local_closure(Leds_matrix_begin, /* name */ + be_nested_proto( + 1, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 0, /* has constants */ + NULL, /* no const */ + &be_const_str_begin, + &be_const_str_solidified, + ( &(const binstruction[ 1]) { /* code */ + 0x80000000, // 0000 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: pixel_count +********************************************************************/ +be_local_closure(Leds_matrix_pixel_count, /* name */ + be_nested_proto( + 3, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(w), + /* K1 */ be_nested_str(h), + }), + &be_const_str_pixel_count, + &be_const_str_solidified, + ( &(const binstruction[ 4]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x88080101, // 0001 GETMBR R2 R0 K1 + 0x08040202, // 0002 MUL R1 R1 R2 + 0x80040200, // 0003 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: get_alternate +********************************************************************/ +be_local_closure(Leds_matrix_get_alternate, /* name */ + be_nested_proto( + 2, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str(alternate), + }), + &be_const_str_get_alternate, + &be_const_str_solidified, + ( &(const binstruction[ 2]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x80040200, // 0001 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: pixel_offset +********************************************************************/ +be_local_closure(Leds_matrix_pixel_offset, /* name */ + be_nested_proto( + 2, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str(offset), + }), + &be_const_str_pixel_offset, + &be_const_str_solidified, + ( &(const binstruction[ 2]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x80040200, // 0001 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: can_show +********************************************************************/ +be_local_closure(Leds_matrix_can_show, /* name */ + be_nested_proto( + 3, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(strip), + /* K1 */ be_nested_str(can_show), + }), + &be_const_str_can_show, + &be_const_str_solidified, + ( &(const binstruction[ 4]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x8C040301, // 0001 GETMET R1 R1 K1 + 0x7C040200, // 0002 CALL R1 1 + 0x80040200, // 0003 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_bytes +********************************************************************/ +be_local_closure(Leds_matrix_set_bytes, /* name */ + be_nested_proto( + 13, /* nstack */ + 5, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 5]) { /* constants */ + /* K0 */ be_nested_str(h), + /* K1 */ be_nested_str(pix_size), + /* K2 */ be_nested_str(offset), + /* K3 */ be_nested_str(pix_buffer), + /* K4 */ be_nested_str(setbytes), + }), + &be_const_str_set_bytes, + &be_const_str_solidified, + ( &(const binstruction[17]) { /* code */ + 0x88140100, // 0000 GETMBR R5 R0 K0 + 0x88180101, // 0001 GETMBR R6 R0 K1 + 0x08140A06, // 0002 MUL R5 R5 R6 + 0x24180805, // 0003 GT R6 R4 R5 + 0x781A0000, // 0004 JMPF R6 #0006 + 0x5C100A00, // 0005 MOVE R4 R5 + 0x88180102, // 0006 GETMBR R6 R0 K2 + 0x00180C01, // 0007 ADD R6 R6 R1 + 0x08180C05, // 0008 MUL R6 R6 R5 + 0x881C0103, // 0009 GETMBR R7 R0 K3 + 0x8C1C0F04, // 000A GETMET R7 R7 K4 + 0x5C240C00, // 000B MOVE R9 R6 + 0x5C280400, // 000C MOVE R10 R2 + 0x5C2C0600, // 000D MOVE R11 R3 + 0x5C300800, // 000E MOVE R12 R4 + 0x7C1C0A00, // 000F CALL R7 5 + 0x80000000, // 0010 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: get_pixel_color +********************************************************************/ +be_local_closure(Leds_matrix_get_pixel_color, /* name */ + be_nested_proto( + 5, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 3]) { /* constants */ + /* K0 */ be_nested_str(strip), + /* K1 */ be_nested_str(get_pixel_color), + /* K2 */ be_nested_str(offseta), + }), + &be_const_str_get_pixel_color, + &be_const_str_solidified, + ( &(const binstruction[ 6]) { /* code */ + 0x88080100, // 0000 GETMBR R2 R0 K0 + 0x8C080501, // 0001 GETMET R2 R2 K1 + 0x88100102, // 0002 GETMBR R4 R0 K2 + 0x00100204, // 0003 ADD R4 R1 R4 + 0x7C080400, // 0004 CALL R2 2 + 0x80040400, // 0005 RET 1 R2 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: clear +********************************************************************/ +be_local_closure(Leds_matrix_clear, /* name */ + be_nested_proto( + 4, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 3]) { /* constants */ + /* K0 */ be_nested_str(clear_to), + /* K1 */ be_const_int(0), + /* K2 */ be_nested_str(show), + }), + &be_const_str_clear, + &be_const_str_solidified, + ( &(const binstruction[ 6]) { /* code */ + 0x8C040100, // 0000 GETMET R1 R0 K0 + 0x580C0001, // 0001 LDCONST R3 K1 + 0x7C040400, // 0002 CALL R1 2 + 0x8C040102, // 0003 GETMET R1 R0 K2 + 0x7C040200, // 0004 CALL R1 1 + 0x80000000, // 0005 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified class: Leds_matrix +********************************************************************/ +be_local_class(Leds_matrix, + 7, + NULL, + be_nested_map(25, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_const_key(init, -1), be_const_closure(Leds_matrix_init_closure) }, + { be_const_key(show, -1), be_const_closure(Leds_matrix_show_closure) }, + { be_const_key(alternate, -1), be_const_var(4) }, + { be_const_key(get_pixel_color, 14), be_const_closure(Leds_matrix_get_pixel_color_closure) }, + { be_const_key(is_dirty, -1), be_const_closure(Leds_matrix_is_dirty_closure) }, + { be_const_key(clear_to, 0), be_const_closure(Leds_matrix_clear_to_closure) }, + { be_const_key(set_pixel_color, -1), be_const_closure(Leds_matrix_set_pixel_color_closure) }, + { be_const_key(pixels_buffer, -1), be_const_closure(Leds_matrix_pixels_buffer_closure) }, + { be_const_key(dirty, -1), be_const_closure(Leds_matrix_dirty_closure) }, + { be_const_key(can_show, 21), be_const_closure(Leds_matrix_can_show_closure) }, + { be_const_key(pixel_size, 4), be_const_closure(Leds_matrix_pixel_size_closure) }, + { be_const_key(w, -1), be_const_var(3) }, + { be_const_key(set_matrix_pixel_color, 9), be_const_closure(Leds_matrix_set_matrix_pixel_color_closure) }, + { be_const_key(offset, -1), be_const_var(1) }, + { be_const_key(strip, -1), be_const_var(0) }, + { be_const_key(begin, -1), be_const_closure(Leds_matrix_begin_closure) }, + { be_const_key(h, -1), be_const_var(2) }, + { be_const_key(pix_size, -1), be_const_var(6) }, + { be_const_key(pixel_count, -1), be_const_closure(Leds_matrix_pixel_count_closure) }, + { be_const_key(get_alternate, -1), be_const_closure(Leds_matrix_get_alternate_closure) }, + { be_const_key(pixel_offset, -1), be_const_closure(Leds_matrix_pixel_offset_closure) }, + { be_const_key(set_alternate, -1), be_const_closure(Leds_matrix_set_alternate_closure) }, + { be_const_key(set_bytes, -1), be_const_closure(Leds_matrix_set_bytes_closure) }, + { be_const_key(pix_buffer, 3), be_const_var(5) }, + { be_const_key(clear, -1), be_const_closure(Leds_matrix_clear_closure) }, + })), + (bstring*) &be_const_str_Leds_matrix +); + +/******************************************************************** +** Solidified function: create_matrix +********************************************************************/ +be_local_closure(Leds_create_matrix, /* name */ + be_nested_proto( + 10, /* nstack */ + 4, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 5]) { /* constants */ + /* K0 */ be_const_int(0), + /* K1 */ be_nested_str(leds), + /* K2 */ be_nested_str(value_error), + /* K3 */ be_nested_str(out_X20of_X20range), + /* K4 */ be_const_class(be_class_Leds_matrix), + }), + &be_const_str_create_matrix, + &be_const_str_solidified, + ( &(const binstruction[37]) { /* code */ + 0x60100009, // 0000 GETGBL R4 G9 + 0x5C140600, // 0001 MOVE R5 R3 + 0x7C100200, // 0002 CALL R4 1 + 0x5C0C0800, // 0003 MOVE R3 R4 + 0x60100009, // 0004 GETGBL R4 G9 + 0x5C140200, // 0005 MOVE R5 R1 + 0x7C100200, // 0006 CALL R4 1 + 0x5C040800, // 0007 MOVE R1 R4 + 0x60100009, // 0008 GETGBL R4 G9 + 0x5C140400, // 0009 MOVE R5 R2 + 0x7C100200, // 000A CALL R4 1 + 0x5C080800, // 000B MOVE R2 R4 + 0x4C100000, // 000C LDNIL R4 + 0x1C100604, // 000D EQ R4 R3 R4 + 0x78120000, // 000E JMPF R4 #0010 + 0x580C0000, // 000F LDCONST R3 K0 + 0x08100202, // 0010 MUL R4 R1 R2 + 0x00100803, // 0011 ADD R4 R4 R3 + 0x88140101, // 0012 GETMBR R5 R0 K1 + 0x24100805, // 0013 GT R4 R4 R5 + 0x74120005, // 0014 JMPT R4 #001B + 0x14100500, // 0015 LT R4 R2 K0 + 0x74120003, // 0016 JMPT R4 #001B + 0x14100300, // 0017 LT R4 R1 K0 + 0x74120001, // 0018 JMPT R4 #001B + 0x14100700, // 0019 LT R4 R3 K0 + 0x78120000, // 001A JMPF R4 #001C + 0xB0060503, // 001B RAISE 1 K2 K3 + 0x58100004, // 001C LDCONST R4 K4 + 0xB4000004, // 001D CLASS K4 + 0x5C140800, // 001E MOVE R5 R4 + 0x5C180000, // 001F MOVE R6 R0 + 0x5C1C0200, // 0020 MOVE R7 R1 + 0x5C200400, // 0021 MOVE R8 R2 + 0x5C240600, // 0022 MOVE R9 R3 + 0x7C140800, // 0023 CALL R5 4 + 0x80040A00, // 0024 RET 1 R5 + }) + ) +); +/*******************************************************************/ + + /******************************************************************** ** Solidified function: to_gamma ********************************************************************/ be_local_closure(Leds_to_gamma, /* name */ be_nested_proto( - 12, /* nstack */ + 8, /* nstack */ 3, /* argc */ 2, /* varg */ 0, /* has upvals */ @@ -1779,115 +1647,19 @@ be_local_closure(Leds_to_gamma, /* name */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[ 7]) { /* constants */ - /* K0 */ be_nested_str(tasmota), - /* K1 */ be_nested_str(scale_uint), - /* K2 */ be_const_int(0), - /* K3 */ be_const_int(16711680), - /* K4 */ be_nested_str(gamma), - /* K5 */ be_nested_str(light), - /* K6 */ be_nested_str(gamma8), + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(apply_bri_gamma), + /* K1 */ be_nested_str(gamma), }), &be_const_str_to_gamma, &be_const_str_solidified, - ( &(const binstruction[67]) { /* code */ - 0x4C0C0000, // 0000 LDNIL R3 - 0x200C0403, // 0001 NE R3 R2 R3 - 0x780E0001, // 0002 JMPF R3 #0005 - 0x5C0C0400, // 0003 MOVE R3 R2 - 0x70020000, // 0004 JMP #0006 - 0x540E0063, // 0005 LDINT R3 100 - 0x5C080600, // 0006 MOVE R2 R3 - 0xB80E0000, // 0007 GETNGBL R3 K0 - 0x8C0C0701, // 0008 GETMET R3 R3 K1 - 0x5C140400, // 0009 MOVE R5 R2 - 0x58180002, // 000A LDCONST R6 K2 - 0x541E0063, // 000B LDINT R7 100 - 0x58200002, // 000C LDCONST R8 K2 - 0x2C240303, // 000D AND R9 R1 K3 - 0x542A000F, // 000E LDINT R10 16 - 0x3C24120A, // 000F SHR R9 R9 R10 - 0x7C0C0C00, // 0010 CALL R3 6 - 0xB8120000, // 0011 GETNGBL R4 K0 - 0x8C100901, // 0012 GETMET R4 R4 K1 - 0x5C180400, // 0013 MOVE R6 R2 - 0x581C0002, // 0014 LDCONST R7 K2 - 0x54220063, // 0015 LDINT R8 100 - 0x58240002, // 0016 LDCONST R9 K2 - 0x542AFEFF, // 0017 LDINT R10 65280 - 0x2C28020A, // 0018 AND R10 R1 R10 - 0x542E0007, // 0019 LDINT R11 8 - 0x3C28140B, // 001A SHR R10 R10 R11 - 0x7C100C00, // 001B CALL R4 6 - 0xB8160000, // 001C GETNGBL R5 K0 - 0x8C140B01, // 001D GETMET R5 R5 K1 - 0x5C1C0400, // 001E MOVE R7 R2 - 0x58200002, // 001F LDCONST R8 K2 - 0x54260063, // 0020 LDINT R9 100 - 0x58280002, // 0021 LDCONST R10 K2 - 0x542E00FE, // 0022 LDINT R11 255 - 0x2C2C020B, // 0023 AND R11 R1 R11 - 0x7C140C00, // 0024 CALL R5 6 - 0x88180104, // 0025 GETMBR R6 R0 K4 - 0x781A0013, // 0026 JMPF R6 #003B - 0xB81A0A00, // 0027 GETNGBL R6 K5 - 0x8C180D06, // 0028 GETMET R6 R6 K6 - 0x5C200600, // 0029 MOVE R8 R3 - 0x7C180400, // 002A CALL R6 2 - 0x541E000F, // 002B LDINT R7 16 - 0x38180C07, // 002C SHL R6 R6 R7 - 0xB81E0A00, // 002D GETNGBL R7 K5 - 0x8C1C0F06, // 002E GETMET R7 R7 K6 - 0x5C240800, // 002F MOVE R9 R4 - 0x7C1C0400, // 0030 CALL R7 2 - 0x54220007, // 0031 LDINT R8 8 - 0x381C0E08, // 0032 SHL R7 R7 R8 - 0x30180C07, // 0033 OR R6 R6 R7 - 0xB81E0A00, // 0034 GETNGBL R7 K5 - 0x8C1C0F06, // 0035 GETMET R7 R7 K6 - 0x5C240A00, // 0036 MOVE R9 R5 - 0x7C1C0400, // 0037 CALL R7 2 - 0x30180C07, // 0038 OR R6 R6 R7 - 0x80040C00, // 0039 RET 1 R6 - 0x70020006, // 003A JMP #0042 - 0x541A000F, // 003B LDINT R6 16 - 0x38180606, // 003C SHL R6 R3 R6 - 0x541E0007, // 003D LDINT R7 8 - 0x381C0807, // 003E SHL R7 R4 R7 - 0x30180C07, // 003F OR R6 R6 R7 - 0x30180C05, // 0040 OR R6 R6 R5 - 0x80040C00, // 0041 RET 1 R6 - 0x80000000, // 0042 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: begin -********************************************************************/ -be_local_closure(Leds_begin, /* name */ - be_nested_proto( - 4, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 2]) { /* constants */ - /* K0 */ be_nested_str(call_native), - /* K1 */ be_const_int(1), - }), - &be_const_str_begin, - &be_const_str_solidified, - ( &(const binstruction[ 4]) { /* code */ - 0x8C040100, // 0000 GETMET R1 R0 K0 - 0x580C0001, // 0001 LDCONST R3 K1 - 0x7C040400, // 0002 CALL R1 2 - 0x80000000, // 0003 RET 0 + ( &(const binstruction[ 6]) { /* code */ + 0x8C0C0100, // 0000 GETMET R3 R0 K0 + 0x5C140200, // 0001 MOVE R5 R1 + 0x5C180400, // 0002 MOVE R6 R2 + 0x881C0101, // 0003 GETMBR R7 R0 K1 + 0x7C0C0800, // 0004 CALL R3 4 + 0x80040600, // 0005 RET 1 R3 }) ) ); @@ -1942,9 +1714,159 @@ be_local_closure(Leds_ctor, /* name */ /******************************************************************** -** Solidified function: can_show +** Solidified function: dirty ********************************************************************/ -be_local_closure(Leds_can_show, /* name */ +be_local_closure(Leds_dirty, /* name */ + be_nested_proto( + 4, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str(call_native), + }), + &be_const_str_dirty, + &be_const_str_solidified, + ( &(const binstruction[ 4]) { /* code */ + 0x8C040100, // 0000 GETMET R1 R0 K0 + 0x540E0004, // 0001 LDINT R3 5 + 0x7C040400, // 0002 CALL R1 2 + 0x80000000, // 0003 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: clear_to +********************************************************************/ +be_local_closure(Leds_clear_to, /* name */ + be_nested_proto( + 10, /* nstack */ + 3, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(call_native), + /* K1 */ be_nested_str(to_gamma), + }), + &be_const_str_clear_to, + &be_const_str_solidified, + ( &(const binstruction[ 8]) { /* code */ + 0x8C0C0100, // 0000 GETMET R3 R0 K0 + 0x54160008, // 0001 LDINT R5 9 + 0x8C180101, // 0002 GETMET R6 R0 K1 + 0x5C200200, // 0003 MOVE R8 R1 + 0x5C240400, // 0004 MOVE R9 R2 + 0x7C180600, // 0005 CALL R6 3 + 0x7C0C0600, // 0006 CALL R3 3 + 0x80000000, // 0007 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: get_pixel_color +********************************************************************/ +be_local_closure(Leds_get_pixel_color, /* name */ + be_nested_proto( + 6, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str(call_native), + }), + &be_const_str_get_pixel_color, + &be_const_str_solidified, + ( &(const binstruction[ 5]) { /* code */ + 0x8C080100, // 0000 GETMET R2 R0 K0 + 0x5412000A, // 0001 LDINT R4 11 + 0x5C140200, // 0002 MOVE R5 R1 + 0x7C080600, // 0003 CALL R2 3 + 0x80040400, // 0004 RET 1 R2 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: init +********************************************************************/ +be_local_closure(Leds_init, /* name */ + be_nested_proto( + 11, /* nstack */ + 5, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 9]) { /* constants */ + /* K0 */ be_nested_str(gamma), + /* K1 */ be_nested_str(leds), + /* K2 */ be_nested_str(valuer_error), + /* K3 */ be_nested_str(no_X20GPIO_X20specified_X20for_X20neopixelbus), + /* K4 */ be_nested_str(ctor), + /* K5 */ be_nested_str(_p), + /* K6 */ be_nested_str(internal_error), + /* K7 */ be_nested_str(couldn_X27t_X20not_X20initialize_X20noepixelbus), + /* K8 */ be_nested_str(begin), + }), + &be_const_str_init, + &be_const_str_solidified, + ( &(const binstruction[24]) { /* code */ + 0x50140200, // 0000 LDBOOL R5 1 0 + 0x90020005, // 0001 SETMBR R0 K0 R5 + 0x60140009, // 0002 GETGBL R5 G9 + 0x5C180200, // 0003 MOVE R6 R1 + 0x7C140200, // 0004 CALL R5 1 + 0x90020205, // 0005 SETMBR R0 K1 R5 + 0x4C140000, // 0006 LDNIL R5 + 0x1C140405, // 0007 EQ R5 R2 R5 + 0x78160000, // 0008 JMPF R5 #000A + 0xB0060503, // 0009 RAISE 1 K2 K3 + 0x8C140104, // 000A GETMET R5 R0 K4 + 0x881C0101, // 000B GETMBR R7 R0 K1 + 0x5C200400, // 000C MOVE R8 R2 + 0x5C240600, // 000D MOVE R9 R3 + 0x5C280800, // 000E MOVE R10 R4 + 0x7C140A00, // 000F CALL R5 5 + 0x88140105, // 0010 GETMBR R5 R0 K5 + 0x4C180000, // 0011 LDNIL R6 + 0x1C140A06, // 0012 EQ R5 R5 R6 + 0x78160000, // 0013 JMPF R5 #0015 + 0xB0060D07, // 0014 RAISE 1 K6 K7 + 0x8C140108, // 0015 GETMET R5 R0 K8 + 0x7C140200, // 0016 CALL R5 1 + 0x80000000, // 0017 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: begin +********************************************************************/ +be_local_closure(Leds_begin, /* name */ be_nested_proto( 4, /* nstack */ 1, /* argc */ @@ -1956,14 +1878,102 @@ be_local_closure(Leds_can_show, /* name */ 1, /* has constants */ ( &(const bvalue[ 2]) { /* constants */ /* K0 */ be_nested_str(call_native), - /* K1 */ be_const_int(3), + /* K1 */ be_const_int(1), }), - &be_const_str_can_show, + &be_const_str_begin, &be_const_str_solidified, ( &(const binstruction[ 4]) { /* code */ 0x8C040100, // 0000 GETMET R1 R0 K0 0x580C0001, // 0001 LDCONST R3 K1 0x7C040400, // 0002 CALL R1 2 + 0x80000000, // 0003 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: pixel_offset +********************************************************************/ +be_local_closure(Leds_pixel_offset, /* name */ + be_nested_proto( + 1, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_const_int(0), + }), + &be_const_str_pixel_offset, + &be_const_str_solidified, + ( &(const binstruction[ 1]) { /* code */ + 0x80060000, // 0000 RET 1 K0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: clear +********************************************************************/ +be_local_closure(Leds_clear, /* name */ + be_nested_proto( + 4, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 3]) { /* constants */ + /* K0 */ be_nested_str(clear_to), + /* K1 */ be_const_int(0), + /* K2 */ be_nested_str(show), + }), + &be_const_str_clear, + &be_const_str_solidified, + ( &(const binstruction[ 6]) { /* code */ + 0x8C040100, // 0000 GETMET R1 R0 K0 + 0x580C0001, // 0001 LDCONST R3 K1 + 0x7C040400, // 0002 CALL R1 2 + 0x8C040102, // 0003 GETMET R1 R0 K2 + 0x7C040200, // 0004 CALL R1 1 + 0x80000000, // 0005 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: pixel_size +********************************************************************/ +be_local_closure(Leds_pixel_size, /* name */ + be_nested_proto( + 4, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str(call_native), + }), + &be_const_str_pixel_size, + &be_const_str_solidified, + ( &(const binstruction[ 4]) { /* code */ + 0x8C040100, // 0000 GETMET R1 R0 K0 + 0x540E0006, // 0001 LDINT R3 7 + 0x7C040400, // 0002 CALL R1 2 0x80040200, // 0003 RET 1 R1 }) ) @@ -1978,29 +1988,30 @@ extern const bclass be_class_Leds_ntv; be_local_class(Leds, 2, &be_class_Leds_ntv, - be_nested_map(21, + be_nested_map(22, ( (struct bmapnode*) &(const bmapnode[]) { - { be_const_key(pixel_count, -1), be_const_closure(Leds_pixel_count_closure) }, { be_const_key(show, -1), be_const_closure(Leds_show_closure) }, - { be_const_key(is_dirty, -1), be_const_closure(Leds_is_dirty_closure) }, - { be_const_key(leds, 17), be_const_var(1) }, - { be_const_key(set_pixel_color, 8), be_const_closure(Leds_set_pixel_color_closure) }, - { be_const_key(clear, -1), be_const_closure(Leds_clear_closure) }, - { be_const_key(matrix, -1), be_const_static_closure(Leds_matrix_closure) }, { be_const_key(create_segment, -1), be_const_closure(Leds_create_segment_closure) }, - { be_const_key(ctor, 2), be_const_closure(Leds_ctor_closure) }, - { be_const_key(clear_to, 19), be_const_closure(Leds_clear_to_closure) }, - { be_const_key(create_matrix, -1), be_const_closure(Leds_create_matrix_closure) }, - { be_const_key(pixels_buffer, -1), be_const_closure(Leds_pixels_buffer_closure) }, - { be_const_key(init, -1), be_const_closure(Leds_init_closure) }, - { be_const_key(dirty, -1), be_const_closure(Leds_dirty_closure) }, - { be_const_key(get_pixel_color, -1), be_const_closure(Leds_get_pixel_color_closure) }, { be_const_key(assign_rmt, -1), be_const_static_closure(Leds_assign_rmt_closure) }, { be_const_key(pixel_size, -1), be_const_closure(Leds_pixel_size_closure) }, - { be_const_key(to_gamma, 16), be_const_closure(Leds_to_gamma_closure) }, - { be_const_key(begin, -1), be_const_closure(Leds_begin_closure) }, - { be_const_key(gamma, -1), be_const_var(0) }, - { be_const_key(can_show, -1), be_const_closure(Leds_can_show_closure) }, + { be_const_key(matrix, 18), be_const_static_closure(Leds_matrix_closure) }, + { be_const_key(pixel_count, -1), be_const_closure(Leds_pixel_count_closure) }, + { be_const_key(ctor, -1), be_const_closure(Leds_ctor_closure) }, + { be_const_key(pixels_buffer, -1), be_const_closure(Leds_pixels_buffer_closure) }, + { be_const_key(set_pixel_color, -1), be_const_closure(Leds_set_pixel_color_closure) }, + { be_const_key(create_matrix, 15), be_const_closure(Leds_create_matrix_closure) }, + { be_const_key(is_dirty, 14), be_const_closure(Leds_is_dirty_closure) }, + { be_const_key(can_show, 6), be_const_closure(Leds_can_show_closure) }, + { be_const_key(to_gamma, -1), be_const_closure(Leds_to_gamma_closure) }, + { be_const_key(dirty, 19), be_const_closure(Leds_dirty_closure) }, + { be_const_key(begin, 12), be_const_closure(Leds_begin_closure) }, + { be_const_key(init, -1), be_const_closure(Leds_init_closure) }, + { be_const_key(gamma, 17), be_const_var(0) }, + { be_const_key(get_pixel_color, -1), be_const_closure(Leds_get_pixel_color_closure) }, + { be_const_key(clear_to, -1), be_const_closure(Leds_clear_to_closure) }, + { be_const_key(leds, -1), be_const_var(1) }, + { be_const_key(clear, -1), be_const_closure(Leds_clear_closure) }, + { be_const_key(pixel_offset, 3), be_const_closure(Leds_pixel_offset_closure) }, })), (bstring*) &be_const_str_Leds ); diff --git a/lib/libesp32/berry_tasmota/src/solidify/solidified_leds_0_animator.h b/lib/libesp32/berry_tasmota/src/solidify/solidified_leds_0_animator.h new file mode 100644 index 000000000..ea031d397 --- /dev/null +++ b/lib/libesp32/berry_tasmota/src/solidify/solidified_leds_0_animator.h @@ -0,0 +1,685 @@ +/* Solidification of leds_0_animator.h */ +/********************************************************************\ +* Generated code, don't edit * +\********************************************************************/ +#include "be_constobj.h" + +extern const bclass be_class_Leds_animator; + +/******************************************************************** +** Solidified function: remove +********************************************************************/ +be_local_closure(Leds_animator_remove, /* name */ + be_nested_proto( + 4, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 4]) { /* constants */ + /* K0 */ be_nested_str_weak(clear), + /* K1 */ be_nested_str_weak(tasmota), + /* K2 */ be_nested_str_weak(remove_fast_loop), + /* K3 */ be_nested_str_weak(fast_loop_cb), + }), + be_str_weak(remove), + &be_const_str_solidified, + ( &(const binstruction[ 7]) { /* code */ + 0x8C040100, // 0000 GETMET R1 R0 K0 + 0x7C040200, // 0001 CALL R1 1 + 0xB8060200, // 0002 GETNGBL R1 K1 + 0x8C040302, // 0003 GETMET R1 R1 K2 + 0x880C0103, // 0004 GETMBR R3 R0 K3 + 0x7C040400, // 0005 CALL R1 2 + 0x80000000, // 0006 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: add_background_animator +********************************************************************/ +be_local_closure(Leds_animator_add_background_animator, /* name */ + be_nested_proto( + 6, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 3]) { /* constants */ + /* K0 */ be_nested_str_weak(set_cb), + /* K1 */ be_nested_str_weak(set_back_color), + /* K2 */ be_nested_str_weak(add_animator), + }), + be_str_weak(add_background_animator), + &be_const_str_solidified, + ( &(const binstruction[ 8]) { /* code */ + 0x8C080300, // 0000 GETMET R2 R1 K0 + 0x5C100000, // 0001 MOVE R4 R0 + 0x88140101, // 0002 GETMBR R5 R0 K1 + 0x7C080600, // 0003 CALL R2 3 + 0x8C080102, // 0004 GETMET R2 R0 K2 + 0x5C100200, // 0005 MOVE R4 R1 + 0x7C080400, // 0006 CALL R2 2 + 0x80000000, // 0007 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: clear +********************************************************************/ +be_local_closure(Leds_animator_clear, /* name */ + be_nested_proto( + 3, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 3]) { /* constants */ + /* K0 */ be_nested_str_weak(stop), + /* K1 */ be_nested_str_weak(strip), + /* K2 */ be_nested_str_weak(clear), + }), + be_str_weak(clear), + &be_const_str_solidified, + ( &(const binstruction[ 6]) { /* code */ + 0x8C040100, // 0000 GETMET R1 R0 K0 + 0x7C040200, // 0001 CALL R1 1 + 0x88040101, // 0002 GETMBR R1 R0 K1 + 0x8C040302, // 0003 GETMET R1 R1 K2 + 0x7C040200, // 0004 CALL R1 1 + 0x80000000, // 0005 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: add_animator +********************************************************************/ +be_local_closure(Leds_animator_add_animator, /* name */ + be_nested_proto( + 5, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str_weak(animators), + /* K1 */ be_nested_str_weak(push), + }), + be_str_weak(add_animator), + &be_const_str_solidified, + ( &(const binstruction[ 5]) { /* code */ + 0x88080100, // 0000 GETMBR R2 R0 K0 + 0x8C080501, // 0001 GETMET R2 R2 K1 + 0x5C100200, // 0002 MOVE R4 R1 + 0x7C080400, // 0003 CALL R2 2 + 0x80000000, // 0004 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: animate +********************************************************************/ +be_local_closure(Leds_animator_animate, /* name */ + be_nested_proto( + 1, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 0, /* has constants */ + NULL, /* no const */ + be_str_weak(animate), + &be_const_str_solidified, + ( &(const binstruction[ 1]) { /* code */ + 0x80000000, // 0000 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: get_bri +********************************************************************/ +be_local_closure(Leds_animator_get_bri, /* name */ + be_nested_proto( + 3, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str_weak(bri), + }), + be_str_weak(get_bri), + &be_const_str_solidified, + ( &(const binstruction[ 2]) { /* code */ + 0x88080100, // 0000 GETMBR R2 R0 K0 + 0x80040400, // 0001 RET 1 R2 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_bri +********************************************************************/ +be_local_closure(Leds_animator_set_bri, /* name */ + be_nested_proto( + 2, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str_weak(bri), + }), + be_str_weak(set_bri), + &be_const_str_solidified, + ( &(const binstruction[ 2]) { /* code */ + 0x90020001, // 0000 SETMBR R0 K0 R1 + 0x80000000, // 0001 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_back_color +********************************************************************/ +be_local_closure(Leds_animator_set_back_color, /* name */ + be_nested_proto( + 2, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str_weak(back_color), + }), + be_str_weak(set_back_color), + &be_const_str_solidified, + ( &(const binstruction[ 2]) { /* code */ + 0x90020001, // 0000 SETMBR R0 K0 R1 + 0x80000000, // 0001 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: stop +********************************************************************/ +be_local_closure(Leds_animator_stop, /* name */ + be_nested_proto( + 6, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 8]) { /* constants */ + /* K0 */ be_nested_str_weak(running), + /* K1 */ be_nested_str_weak(animators), + /* K2 */ be_const_int(0), + /* K3 */ be_nested_str_weak(stop), + /* K4 */ be_const_int(1), + /* K5 */ be_nested_str_weak(tasmota), + /* K6 */ be_nested_str_weak(remove_fast_loop), + /* K7 */ be_nested_str_weak(fast_loop_cb), + }), + be_str_weak(stop), + &be_const_str_solidified, + ( &(const binstruction[19]) { /* code */ + 0x50040000, // 0000 LDBOOL R1 0 0 + 0x90020001, // 0001 SETMBR R0 K0 R1 + 0x88040101, // 0002 GETMBR R1 R0 K1 + 0x58080002, // 0003 LDCONST R2 K2 + 0x600C000C, // 0004 GETGBL R3 G12 + 0x5C100200, // 0005 MOVE R4 R1 + 0x7C0C0200, // 0006 CALL R3 1 + 0x140C0403, // 0007 LT R3 R2 R3 + 0x780E0004, // 0008 JMPF R3 #000E + 0x940C0202, // 0009 GETIDX R3 R1 R2 + 0x8C0C0703, // 000A GETMET R3 R3 K3 + 0x7C0C0200, // 000B CALL R3 1 + 0x00080504, // 000C ADD R2 R2 K4 + 0x7001FFF5, // 000D JMP #0004 + 0xB80E0A00, // 000E GETNGBL R3 K5 + 0x8C0C0706, // 000F GETMET R3 R3 K6 + 0x88140107, // 0010 GETMBR R5 R0 K7 + 0x7C0C0400, // 0011 CALL R3 2 + 0x80000000, // 0012 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_cb +********************************************************************/ +be_local_closure(Leds_animator_set_cb, /* name */ + be_nested_proto( + 3, /* nstack */ + 3, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str_weak(animate_object), + /* K1 */ be_nested_str_weak(animate_method), + }), + be_str_weak(set_cb), + &be_const_str_solidified, + ( &(const binstruction[ 3]) { /* code */ + 0x90020001, // 0000 SETMBR R0 K0 R1 + 0x90020202, // 0001 SETMBR R0 K1 R2 + 0x80000000, // 0002 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: init +********************************************************************/ +be_local_closure(Leds_animator_init, /* name */ + be_nested_proto( + 5, /* nstack */ + 3, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 1, /* has sup protos */ + ( &(const struct bproto*[ 1]) { + be_nested_proto( + 2, /* nstack */ + 0, /* argc */ + 0, /* varg */ + 1, /* has upvals */ + ( &(const bupvaldesc[ 1]) { /* upvals */ + be_local_const_upval(1, 0), + }), + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str_weak(fast_loop), + }), + be_str_weak(_anonymous_), + &be_const_str_solidified, + ( &(const binstruction[ 4]) { /* code */ + 0x68000000, // 0000 GETUPV R0 U0 + 0x8C000100, // 0001 GETMET R0 R0 K0 + 0x7C000200, // 0002 CALL R0 1 + 0x80000000, // 0003 RET 0 + }) + ), + }), + 1, /* has constants */ + ( &(const bvalue[13]) { /* constants */ + /* K0 */ be_nested_str_weak(strip), + /* K1 */ be_nested_str_weak(bri), + /* K2 */ be_nested_str_weak(running), + /* K3 */ be_nested_str_weak(pixel_count), + /* K4 */ be_nested_str_weak(animators), + /* K5 */ be_nested_str_weak(painters), + /* K6 */ be_nested_str_weak(clear), + /* K7 */ be_nested_str_weak(frame), + /* K8 */ be_nested_str_weak(Leds_frame), + /* K9 */ be_nested_str_weak(layer), + /* K10 */ be_nested_str_weak(fast_loop_cb), + /* K11 */ be_nested_str_weak(back_color), + /* K12 */ be_const_int(0), + }), + be_str_weak(init), + &be_const_str_solidified, + ( &(const binstruction[32]) { /* code */ + 0x90020001, // 0000 SETMBR R0 K0 R1 + 0x4C0C0000, // 0001 LDNIL R3 + 0x1C0C0403, // 0002 EQ R3 R2 R3 + 0x780E0000, // 0003 JMPF R3 #0005 + 0x540A0031, // 0004 LDINT R2 50 + 0x90020202, // 0005 SETMBR R0 K1 R2 + 0x500C0000, // 0006 LDBOOL R3 0 0 + 0x90020403, // 0007 SETMBR R0 K2 R3 + 0x8C0C0303, // 0008 GETMET R3 R1 K3 + 0x7C0C0200, // 0009 CALL R3 1 + 0x90020603, // 000A SETMBR R0 K3 R3 + 0x600C0012, // 000B GETGBL R3 G18 + 0x7C0C0000, // 000C CALL R3 0 + 0x90020803, // 000D SETMBR R0 K4 R3 + 0x600C0012, // 000E GETGBL R3 G18 + 0x7C0C0000, // 000F CALL R3 0 + 0x90020A03, // 0010 SETMBR R0 K5 R3 + 0x8C0C0106, // 0011 GETMET R3 R0 K6 + 0x7C0C0200, // 0012 CALL R3 1 + 0xB80E1000, // 0013 GETNGBL R3 K8 + 0x88100103, // 0014 GETMBR R4 R0 K3 + 0x7C0C0200, // 0015 CALL R3 1 + 0x90020E03, // 0016 SETMBR R0 K7 R3 + 0xB80E1000, // 0017 GETNGBL R3 K8 + 0x88100103, // 0018 GETMBR R4 R0 K3 + 0x7C0C0200, // 0019 CALL R3 1 + 0x90021203, // 001A SETMBR R0 K9 R3 + 0x840C0000, // 001B CLOSURE R3 P0 + 0x90021403, // 001C SETMBR R0 K10 R3 + 0x9002170C, // 001D SETMBR R0 K11 K12 + 0xA0000000, // 001E CLOSE R0 + 0x80000000, // 001F RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: add_painter +********************************************************************/ +be_local_closure(Leds_animator_add_painter, /* name */ + be_nested_proto( + 5, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str_weak(painters), + /* K1 */ be_nested_str_weak(push), + }), + be_str_weak(add_painter), + &be_const_str_solidified, + ( &(const binstruction[ 5]) { /* code */ + 0x88080100, // 0000 GETMBR R2 R0 K0 + 0x8C080501, // 0001 GETMET R2 R2 K1 + 0x5C100200, // 0002 MOVE R4 R1 + 0x7C080400, // 0003 CALL R2 2 + 0x80000000, // 0004 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: fast_loop +********************************************************************/ +be_local_closure(Leds_animator_fast_loop, /* name */ + be_nested_proto( + 12, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[28]) { /* constants */ + /* K0 */ be_nested_str_weak(running), + /* K1 */ be_nested_str_weak(tasmota), + /* K2 */ be_nested_str_weak(time_reached), + /* K3 */ be_nested_str_weak(fast_loop_next), + /* K4 */ be_nested_str_weak(strip), + /* K5 */ be_nested_str_weak(can_show), + /* K6 */ be_nested_str_weak(frame), + /* K7 */ be_nested_str_weak(fill_pixels), + /* K8 */ be_nested_str_weak(back_color), + /* K9 */ be_const_int(0), + /* K10 */ be_nested_str_weak(millis), + /* K11 */ be_nested_str_weak(FAST_LOOP_MIN), + /* K12 */ be_nested_str_weak(animators), + /* K13 */ be_nested_str_weak(animate), + /* K14 */ be_const_int(1), + /* K15 */ be_nested_str_weak(layer), + /* K16 */ be_nested_str_weak(painters), + /* K17 */ be_const_int(-16777216), + /* K18 */ be_nested_str_weak(paint), + /* K19 */ be_nested_str_weak(blend_pixels), + /* K20 */ be_nested_str_weak(animate_object), + /* K21 */ be_nested_str_weak(animate_method), + /* K22 */ be_nested_str_weak(paste_pixels), + /* K23 */ be_nested_str_weak(pixels_buffer), + /* K24 */ be_nested_str_weak(bri), + /* K25 */ be_nested_str_weak(gamma), + /* K26 */ be_nested_str_weak(dirty), + /* K27 */ be_nested_str_weak(show), + }), + be_str_weak(fast_loop), + &be_const_str_solidified, + ( &(const binstruction[81]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x7806004D, // 0001 JMPF R1 #0050 + 0xB8060200, // 0002 GETNGBL R1 K1 + 0x8C040302, // 0003 GETMET R1 R1 K2 + 0x880C0103, // 0004 GETMBR R3 R0 K3 + 0x7C040400, // 0005 CALL R1 2 + 0x78060048, // 0006 JMPF R1 #0050 + 0x88040104, // 0007 GETMBR R1 R0 K4 + 0x8C040305, // 0008 GETMET R1 R1 K5 + 0x7C040200, // 0009 CALL R1 1 + 0x78060044, // 000A JMPF R1 #0050 + 0x88040106, // 000B GETMBR R1 R0 K6 + 0x8C040307, // 000C GETMET R1 R1 K7 + 0x880C0108, // 000D GETMBR R3 R0 K8 + 0x7C040400, // 000E CALL R1 2 + 0x58040009, // 000F LDCONST R1 K9 + 0xB80A0200, // 0010 GETNGBL R2 K1 + 0x8C08050A, // 0011 GETMET R2 R2 K10 + 0x7C080200, // 0012 CALL R2 1 + 0x880C010B, // 0013 GETMBR R3 R0 K11 + 0x000C0403, // 0014 ADD R3 R2 R3 + 0x90020603, // 0015 SETMBR R0 K3 R3 + 0x600C000C, // 0016 GETGBL R3 G12 + 0x8810010C, // 0017 GETMBR R4 R0 K12 + 0x7C0C0200, // 0018 CALL R3 1 + 0x140C0203, // 0019 LT R3 R1 R3 + 0x780E0006, // 001A JMPF R3 #0022 + 0x880C010C, // 001B GETMBR R3 R0 K12 + 0x940C0601, // 001C GETIDX R3 R3 R1 + 0x8C0C070D, // 001D GETMET R3 R3 K13 + 0x5C140400, // 001E MOVE R5 R2 + 0x7C0C0400, // 001F CALL R3 2 + 0x0004030E, // 0020 ADD R1 R1 K14 + 0x7001FFF3, // 0021 JMP #0016 + 0x58040009, // 0022 LDCONST R1 K9 + 0x880C0106, // 0023 GETMBR R3 R0 K6 + 0x8810010F, // 0024 GETMBR R4 R0 K15 + 0x6014000C, // 0025 GETGBL R5 G12 + 0x88180110, // 0026 GETMBR R6 R0 K16 + 0x7C140200, // 0027 CALL R5 1 + 0x14140205, // 0028 LT R5 R1 R5 + 0x7816000D, // 0029 JMPF R5 #0038 + 0x8C140907, // 002A GETMET R5 R4 K7 + 0x581C0011, // 002B LDCONST R7 K17 + 0x7C140400, // 002C CALL R5 2 + 0x88140110, // 002D GETMBR R5 R0 K16 + 0x94140A01, // 002E GETIDX R5 R5 R1 + 0x8C140B12, // 002F GETMET R5 R5 K18 + 0x5C1C0800, // 0030 MOVE R7 R4 + 0x7C140400, // 0031 CALL R5 2 + 0x78160002, // 0032 JMPF R5 #0036 + 0x8C140713, // 0033 GETMET R5 R3 K19 + 0x5C1C0800, // 0034 MOVE R7 R4 + 0x7C140400, // 0035 CALL R5 2 + 0x0004030E, // 0036 ADD R1 R1 K14 + 0x7001FFEC, // 0037 JMP #0025 + 0x88140114, // 0038 GETMBR R5 R0 K20 + 0x88180115, // 0039 GETMBR R6 R0 K21 + 0x78160003, // 003A JMPF R5 #003F + 0x781A0002, // 003B JMPF R6 #003F + 0x5C1C0C00, // 003C MOVE R7 R6 + 0x5C200A00, // 003D MOVE R8 R5 + 0x7C1C0200, // 003E CALL R7 1 + 0x8C1C010D, // 003F GETMET R7 R0 K13 + 0x7C1C0200, // 0040 CALL R7 1 + 0x881C0106, // 0041 GETMBR R7 R0 K6 + 0x8C1C0F16, // 0042 GETMET R7 R7 K22 + 0x88240104, // 0043 GETMBR R9 R0 K4 + 0x8C241317, // 0044 GETMET R9 R9 K23 + 0x7C240200, // 0045 CALL R9 1 + 0x88280118, // 0046 GETMBR R10 R0 K24 + 0x882C0104, // 0047 GETMBR R11 R0 K4 + 0x882C1719, // 0048 GETMBR R11 R11 K25 + 0x7C1C0800, // 0049 CALL R7 4 + 0x881C0104, // 004A GETMBR R7 R0 K4 + 0x8C1C0F1A, // 004B GETMET R7 R7 K26 + 0x7C1C0200, // 004C CALL R7 1 + 0x881C0104, // 004D GETMBR R7 R0 K4 + 0x8C1C0F1B, // 004E GETMET R7 R7 K27 + 0x7C1C0200, // 004F CALL R7 1 + 0x80000000, // 0050 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: start +********************************************************************/ +be_local_closure(Leds_animator_start, /* name */ + be_nested_proto( + 6, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 9]) { /* constants */ + /* K0 */ be_nested_str_weak(running), + /* K1 */ be_nested_str_weak(animators), + /* K2 */ be_const_int(0), + /* K3 */ be_nested_str_weak(start), + /* K4 */ be_const_int(1), + /* K5 */ be_nested_str_weak(fast_loop_next), + /* K6 */ be_nested_str_weak(tasmota), + /* K7 */ be_nested_str_weak(add_fast_loop), + /* K8 */ be_nested_str_weak(fast_loop_cb), + }), + be_str_weak(start), + &be_const_str_solidified, + ( &(const binstruction[20]) { /* code */ + 0x50040200, // 0000 LDBOOL R1 1 0 + 0x90020001, // 0001 SETMBR R0 K0 R1 + 0x88040101, // 0002 GETMBR R1 R0 K1 + 0x58080002, // 0003 LDCONST R2 K2 + 0x600C000C, // 0004 GETGBL R3 G12 + 0x5C100200, // 0005 MOVE R4 R1 + 0x7C0C0200, // 0006 CALL R3 1 + 0x140C0403, // 0007 LT R3 R2 R3 + 0x780E0004, // 0008 JMPF R3 #000E + 0x940C0202, // 0009 GETIDX R3 R1 R2 + 0x8C0C0703, // 000A GETMET R3 R3 K3 + 0x7C0C0200, // 000B CALL R3 1 + 0x00080504, // 000C ADD R2 R2 K4 + 0x7001FFF5, // 000D JMP #0004 + 0x90020B02, // 000E SETMBR R0 K5 K2 + 0xB80E0C00, // 000F GETNGBL R3 K6 + 0x8C0C0707, // 0010 GETMET R3 R3 K7 + 0x88140108, // 0011 GETMBR R5 R0 K8 + 0x7C0C0400, // 0012 CALL R3 2 + 0x80000000, // 0013 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified class: Leds_animator +********************************************************************/ +be_local_class(Leds_animator, + 13, + NULL, + be_nested_map(28, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_const_key_weak(bri, 23), be_const_var(2) }, + { be_const_key_weak(remove, -1), be_const_closure(Leds_animator_remove_closure) }, + { be_const_key_weak(start, 21), be_const_closure(Leds_animator_start_closure) }, + { be_const_key_weak(fast_loop, -1), be_const_closure(Leds_animator_fast_loop_closure) }, + { be_const_key_weak(add_animator, -1), be_const_closure(Leds_animator_add_animator_closure) }, + { be_const_key_weak(FAST_LOOP_MIN, 8), be_const_int(20) }, + { be_const_key_weak(animate, -1), be_const_closure(Leds_animator_animate_closure) }, + { be_const_key_weak(pixel_count, -1), be_const_var(1) }, + { be_const_key_weak(animators, -1), be_const_var(4) }, + { be_const_key_weak(back_color, 11), be_const_var(12) }, + { be_const_key_weak(fast_loop_cb, 12), be_const_var(6) }, + { be_const_key_weak(frame, -1), be_const_var(10) }, + { be_const_key_weak(animate_object, -1), be_const_var(8) }, + { be_const_key_weak(stop, -1), be_const_closure(Leds_animator_stop_closure) }, + { be_const_key_weak(init, -1), be_const_closure(Leds_animator_init_closure) }, + { be_const_key_weak(set_cb, 13), be_const_closure(Leds_animator_set_cb_closure) }, + { be_const_key_weak(running, -1), be_const_var(3) }, + { be_const_key_weak(strip, 15), be_const_var(0) }, + { be_const_key_weak(fast_loop_next, -1), be_const_var(7) }, + { be_const_key_weak(set_back_color, 14), be_const_closure(Leds_animator_set_back_color_closure) }, + { be_const_key_weak(add_painter, -1), be_const_closure(Leds_animator_add_painter_closure) }, + { be_const_key_weak(set_bri, 24), be_const_closure(Leds_animator_set_bri_closure) }, + { be_const_key_weak(layer, 9), be_const_var(11) }, + { be_const_key_weak(animate_method, 6), be_const_var(9) }, + { be_const_key_weak(get_bri, -1), be_const_closure(Leds_animator_get_bri_closure) }, + { be_const_key_weak(painters, -1), be_const_var(5) }, + { be_const_key_weak(clear, 3), be_const_closure(Leds_animator_clear_closure) }, + { be_const_key_weak(add_background_animator, 2), be_const_closure(Leds_animator_add_background_animator_closure) }, + })), + be_str_weak(Leds_animator) +); +/*******************************************************************/ + +void be_load_Leds_animator_class(bvm *vm) { + be_pushntvclass(vm, &be_class_Leds_animator); + be_setglobal(vm, "Leds_animator"); + be_pop(vm, 1); +} +/********************************************************************/ +/* End of solidification */ diff --git a/lib/libesp32/berry_tasmota/src/solidify/solidified_leds_1_animate_effects.h b/lib/libesp32/berry_tasmota/src/solidify/solidified_leds_1_animate_effects.h new file mode 100644 index 000000000..1c2891e5b --- /dev/null +++ b/lib/libesp32/berry_tasmota/src/solidify/solidified_leds_1_animate_effects.h @@ -0,0 +1,358 @@ +/* Solidification of leds_1_animate_effects.h */ +/********************************************************************\ +* Generated code, don't edit * +\********************************************************************/ +#include "be_constobj.h" + +extern const bclass be_class_Leds_pulse; + +/******************************************************************** +** Solidified function: set_slew_size +********************************************************************/ +be_local_closure(Leds_pulse_set_slew_size, /* name */ + be_nested_proto( + 2, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str_weak(slew_size), + }), + be_str_weak(set_slew_size), + &be_const_str_solidified, + ( &(const binstruction[ 2]) { /* code */ + 0x90020001, // 0000 SETMBR R0 K0 R1 + 0x80000000, // 0001 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_back_color +********************************************************************/ +be_local_closure(Leds_pulse_set_back_color, /* name */ + be_nested_proto( + 2, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str_weak(back_color), + }), + be_str_weak(set_back_color), + &be_const_str_solidified, + ( &(const binstruction[ 2]) { /* code */ + 0x90020001, // 0000 SETMBR R0 K0 R1 + 0x80000000, // 0001 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_index +********************************************************************/ +be_local_closure(Leds_pulse_set_index, /* name */ + be_nested_proto( + 2, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str_weak(index), + }), + be_str_weak(set_index), + &be_const_str_solidified, + ( &(const binstruction[ 2]) { /* code */ + 0x90020001, // 0000 SETMBR R0 K0 R1 + 0x80000000, // 0001 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_pulse_size +********************************************************************/ +be_local_closure(Leds_pulse_set_pulse_size, /* name */ + be_nested_proto( + 2, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str_weak(pulse_size), + }), + be_str_weak(set_pulse_size), + &be_const_str_solidified, + ( &(const binstruction[ 2]) { /* code */ + 0x90020001, // 0000 SETMBR R0 K0 R1 + 0x80000000, // 0001 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: init +********************************************************************/ +be_local_closure(Leds_pulse_init, /* name */ + be_nested_proto( + 5, /* nstack */ + 4, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 8]) { /* constants */ + /* K0 */ be_const_int(16777215), + /* K1 */ be_const_int(1), + /* K2 */ be_const_int(0), + /* K3 */ be_nested_str_weak(color), + /* K4 */ be_nested_str_weak(back_color), + /* K5 */ be_const_int(-16777216), + /* K6 */ be_nested_str_weak(pulse_size), + /* K7 */ be_nested_str_weak(slew_size), + }), + be_str_weak(init), + &be_const_str_solidified, + ( &(const binstruction[23]) { /* code */ + 0x4C100000, // 0000 LDNIL R4 + 0x1C100204, // 0001 EQ R4 R1 R4 + 0x78120000, // 0002 JMPF R4 #0004 + 0x58040000, // 0003 LDCONST R1 K0 + 0x4C100000, // 0004 LDNIL R4 + 0x1C100404, // 0005 EQ R4 R2 R4 + 0x78120000, // 0006 JMPF R4 #0008 + 0x58080001, // 0007 LDCONST R2 K1 + 0x4C100000, // 0008 LDNIL R4 + 0x1C100604, // 0009 EQ R4 R3 R4 + 0x78120000, // 000A JMPF R4 #000C + 0x580C0002, // 000B LDCONST R3 K2 + 0x90020601, // 000C SETMBR R0 K3 R1 + 0x90020905, // 000D SETMBR R0 K4 K5 + 0x14100502, // 000E LT R4 R2 K2 + 0x78120000, // 000F JMPF R4 #0011 + 0x58080002, // 0010 LDCONST R2 K2 + 0x90020C02, // 0011 SETMBR R0 K6 R2 + 0x14100702, // 0012 LT R4 R3 K2 + 0x78120000, // 0013 JMPF R4 #0015 + 0x580C0002, // 0014 LDCONST R3 K2 + 0x90020E03, // 0015 SETMBR R0 K7 R3 + 0x80000000, // 0016 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_color +********************************************************************/ +be_local_closure(Leds_pulse_set_color, /* name */ + be_nested_proto( + 2, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str_weak(color), + }), + be_str_weak(set_color), + &be_const_str_solidified, + ( &(const binstruction[ 2]) { /* code */ + 0x90020001, // 0000 SETMBR R0 K0 R1 + 0x80000000, // 0001 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: paint +********************************************************************/ +be_local_closure(Leds_pulse_paint, /* name */ + be_nested_proto( + 22, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[13]) { /* constants */ + /* K0 */ be_nested_str_weak(back_color), + /* K1 */ be_const_int(-16777216), + /* K2 */ be_nested_str_weak(fill_pixels), + /* K3 */ be_nested_str_weak(index), + /* K4 */ be_nested_str_weak(slew_size), + /* K5 */ be_nested_str_weak(pulse_size), + /* K6 */ be_nested_str_weak(color), + /* K7 */ be_nested_str_weak(pixel_size), + /* K8 */ be_const_int(0), + /* K9 */ be_const_int(1), + /* K10 */ be_nested_str_weak(blend), + /* K11 */ be_nested_str_weak(tasmota), + /* K12 */ be_nested_str_weak(scale_int), + }), + be_str_weak(paint), + &be_const_str_solidified, + ( &(const binstruction[91]) { /* code */ + 0x88080100, // 0000 GETMBR R2 R0 K0 + 0x200C0501, // 0001 NE R3 R2 K1 + 0x780E0002, // 0002 JMPF R3 #0006 + 0x8C0C0302, // 0003 GETMET R3 R1 K2 + 0x5C140400, // 0004 MOVE R5 R2 + 0x7C0C0400, // 0005 CALL R3 2 + 0x880C0103, // 0006 GETMBR R3 R0 K3 + 0x88100104, // 0007 GETMBR R4 R0 K4 + 0x88140105, // 0008 GETMBR R5 R0 K5 + 0x88180106, // 0009 GETMBR R6 R0 K6 + 0x881C0307, // 000A GETMBR R7 R1 K7 + 0x4C200000, // 000B LDNIL R8 + 0x4C240000, // 000C LDNIL R9 + 0x5C200600, // 000D MOVE R8 R3 + 0x00280605, // 000E ADD R10 R3 R5 + 0x5C241400, // 000F MOVE R9 R10 + 0x14281108, // 0010 LT R10 R8 K8 + 0x782A0000, // 0011 JMPF R10 #0013 + 0x58200008, // 0012 LDCONST R8 K8 + 0x28281207, // 0013 GE R10 R9 R7 + 0x782A0000, // 0014 JMPF R10 #0016 + 0x5C240E00, // 0015 MOVE R9 R7 + 0x5C281000, // 0016 MOVE R10 R8 + 0x142C1409, // 0017 LT R11 R10 R9 + 0x782E0002, // 0018 JMPF R11 #001C + 0x98041406, // 0019 SETIDX R1 R10 R6 + 0x00281509, // 001A ADD R10 R10 K9 + 0x7001FFFA, // 001B JMP #0017 + 0x242C0908, // 001C GT R11 R4 K8 + 0x782E003A, // 001D JMPF R11 #0059 + 0x042C0604, // 001E SUB R11 R3 R4 + 0x5C201600, // 001F MOVE R8 R11 + 0x5C240600, // 0020 MOVE R9 R3 + 0x142C1108, // 0021 LT R11 R8 K8 + 0x782E0000, // 0022 JMPF R11 #0024 + 0x58200008, // 0023 LDCONST R8 K8 + 0x282C1207, // 0024 GE R11 R9 R7 + 0x782E0000, // 0025 JMPF R11 #0027 + 0x5C240E00, // 0026 MOVE R9 R7 + 0x5C281000, // 0027 MOVE R10 R8 + 0x142C1409, // 0028 LT R11 R10 R9 + 0x782E000F, // 0029 JMPF R11 #003A + 0x8C2C030A, // 002A GETMET R11 R1 K10 + 0x5C340400, // 002B MOVE R13 R2 + 0x5C380C00, // 002C MOVE R14 R6 + 0xB83E1600, // 002D GETNGBL R15 K11 + 0x8C3C1F0C, // 002E GETMET R15 R15 K12 + 0x5C441400, // 002F MOVE R17 R10 + 0x04480604, // 0030 SUB R18 R3 R4 + 0x04482509, // 0031 SUB R18 R18 K9 + 0x5C4C0600, // 0032 MOVE R19 R3 + 0x545200FE, // 0033 LDINT R20 255 + 0x58540008, // 0034 LDCONST R21 K8 + 0x7C3C0C00, // 0035 CALL R15 6 + 0x7C2C0800, // 0036 CALL R11 4 + 0x9804140B, // 0037 SETIDX R1 R10 R11 + 0x00281509, // 0038 ADD R10 R10 K9 + 0x7001FFED, // 0039 JMP #0028 + 0x002C0605, // 003A ADD R11 R3 R5 + 0x5C201600, // 003B MOVE R8 R11 + 0x002C0605, // 003C ADD R11 R3 R5 + 0x002C1604, // 003D ADD R11 R11 R4 + 0x5C241600, // 003E MOVE R9 R11 + 0x142C1108, // 003F LT R11 R8 K8 + 0x782E0000, // 0040 JMPF R11 #0042 + 0x58200008, // 0041 LDCONST R8 K8 + 0x282C1207, // 0042 GE R11 R9 R7 + 0x782E0000, // 0043 JMPF R11 #0045 + 0x5C240E00, // 0044 MOVE R9 R7 + 0x5C281000, // 0045 MOVE R10 R8 + 0x142C1409, // 0046 LT R11 R10 R9 + 0x782E0010, // 0047 JMPF R11 #0059 + 0x8C2C030A, // 0048 GETMET R11 R1 K10 + 0x5C340400, // 0049 MOVE R13 R2 + 0x5C380C00, // 004A MOVE R14 R6 + 0xB83E1600, // 004B GETNGBL R15 K11 + 0x8C3C1F0C, // 004C GETMET R15 R15 K12 + 0x5C441400, // 004D MOVE R17 R10 + 0x00480605, // 004E ADD R18 R3 R5 + 0x04482509, // 004F SUB R18 R18 K9 + 0x004C0605, // 0050 ADD R19 R3 R5 + 0x004C2604, // 0051 ADD R19 R19 R4 + 0x58500008, // 0052 LDCONST R20 K8 + 0x545600FE, // 0053 LDINT R21 255 + 0x7C3C0C00, // 0054 CALL R15 6 + 0x7C2C0800, // 0055 CALL R11 4 + 0x9804140B, // 0056 SETIDX R1 R10 R11 + 0x00281509, // 0057 ADD R10 R10 K9 + 0x7001FFEC, // 0058 JMP #0046 + 0x502C0200, // 0059 LDBOOL R11 1 0 + 0x80041600, // 005A RET 1 R11 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified class: Leds_pulse +********************************************************************/ +be_local_class(Leds_pulse, + 5, + NULL, + be_nested_map(12, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_const_key_weak(paint, 9), be_const_closure(Leds_pulse_paint_closure) }, + { be_const_key_weak(set_slew_size, -1), be_const_closure(Leds_pulse_set_slew_size_closure) }, + { be_const_key_weak(pulse_size, -1), be_const_var(4) }, + { be_const_key_weak(set_back_color, 6), be_const_closure(Leds_pulse_set_back_color_closure) }, + { be_const_key_weak(set_index, 7), be_const_closure(Leds_pulse_set_index_closure) }, + { be_const_key_weak(back_color, -1), be_const_var(1) }, + { be_const_key_weak(set_color, 8), be_const_closure(Leds_pulse_set_color_closure) }, + { be_const_key_weak(color, -1), be_const_var(0) }, + { be_const_key_weak(init, -1), be_const_closure(Leds_pulse_init_closure) }, + { be_const_key_weak(set_pulse_size, -1), be_const_closure(Leds_pulse_set_pulse_size_closure) }, + { be_const_key_weak(slew_size, 5), be_const_var(3) }, + { be_const_key_weak(index, 0), be_const_var(2) }, + })), + be_str_weak(Leds_pulse) +); +/*******************************************************************/ + +void be_load_Leds_pulse_class(bvm *vm) { + be_pushntvclass(vm, &be_class_Leds_pulse); + be_setglobal(vm, "Leds_pulse"); + be_pop(vm, 1); +} +/********************************************************************/ +/* End of solidification */ diff --git a/lib/libesp32/berry_tasmota/src/solidify/solidified_leds_animator.h b/lib/libesp32/berry_tasmota/src/solidify/solidified_leds_animator.h deleted file mode 100644 index 992fae52b..000000000 --- a/lib/libesp32/berry_tasmota/src/solidify/solidified_leds_animator.h +++ /dev/null @@ -1,406 +0,0 @@ -/* Solidification of leds_animator.h */ -/********************************************************************\ -* Generated code, don't edit * -\********************************************************************/ -#include "be_constobj.h" - -extern const bclass be_class_Leds_animator; - -/******************************************************************** -** Solidified function: init -********************************************************************/ -be_local_closure(Leds_animator_init, /* name */ - be_nested_proto( - 5, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 1, /* has sup protos */ - ( &(const struct bproto*[ 1]) { - be_nested_proto( - 2, /* nstack */ - 0, /* argc */ - 0, /* varg */ - 1, /* has upvals */ - ( &(const bupvaldesc[ 1]) { /* upvals */ - be_local_const_upval(1, 0), - }), - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str_weak(fast_loop), - }), - be_str_weak(_X3Clambda_X3E), - &be_const_str_solidified, - ( &(const binstruction[ 4]) { /* code */ - 0x68000000, // 0000 GETUPV R0 U0 - 0x8C000100, // 0001 GETMET R0 R0 K0 - 0x7C000200, // 0002 CALL R0 1 - 0x80040000, // 0003 RET 1 R0 - }) - ), - }), - 1, /* has constants */ - ( &(const bvalue[ 8]) { /* constants */ - /* K0 */ be_nested_str_weak(strip), - /* K1 */ be_nested_str_weak(bri), - /* K2 */ be_nested_str_weak(running), - /* K3 */ be_nested_str_weak(pixel_count), - /* K4 */ be_nested_str_weak(animators), - /* K5 */ be_nested_str_weak(clear), - /* K6 */ be_nested_str_weak(tasmota), - /* K7 */ be_nested_str_weak(add_fast_loop), - }), - be_str_weak(init), - &be_const_str_solidified, - ( &(const binstruction[19]) { /* code */ - 0x90020001, // 0000 SETMBR R0 K0 R1 - 0x540A0031, // 0001 LDINT R2 50 - 0x90020202, // 0002 SETMBR R0 K1 R2 - 0x50080000, // 0003 LDBOOL R2 0 0 - 0x90020402, // 0004 SETMBR R0 K2 R2 - 0x8C080303, // 0005 GETMET R2 R1 K3 - 0x7C080200, // 0006 CALL R2 1 - 0x90020602, // 0007 SETMBR R0 K3 R2 - 0x60080012, // 0008 GETGBL R2 G18 - 0x7C080000, // 0009 CALL R2 0 - 0x90020802, // 000A SETMBR R0 K4 R2 - 0x8C080105, // 000B GETMET R2 R0 K5 - 0x7C080200, // 000C CALL R2 1 - 0xB80A0C00, // 000D GETNGBL R2 K6 - 0x8C080507, // 000E GETMET R2 R2 K7 - 0x84100000, // 000F CLOSURE R4 P0 - 0x7C080400, // 0010 CALL R2 2 - 0xA0000000, // 0011 CLOSE R0 - 0x80000000, // 0012 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: add_anim -********************************************************************/ -be_local_closure(Leds_animator_add_anim, /* name */ - be_nested_proto( - 5, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 3]) { /* constants */ - /* K0 */ be_nested_str_weak(animators), - /* K1 */ be_nested_str_weak(push), - /* K2 */ be_nested_str_weak(run), - }), - be_str_weak(add_anim), - &be_const_str_solidified, - ( &(const binstruction[ 7]) { /* code */ - 0x88080100, // 0000 GETMBR R2 R0 K0 - 0x8C080501, // 0001 GETMET R2 R2 K1 - 0x5C100200, // 0002 MOVE R4 R1 - 0x7C080400, // 0003 CALL R2 2 - 0x8C080302, // 0004 GETMET R2 R1 K2 - 0x7C080200, // 0005 CALL R2 1 - 0x80000000, // 0006 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: stop -********************************************************************/ -be_local_closure(Leds_animator_stop, /* name */ - be_nested_proto( - 2, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str_weak(running), - }), - be_str_weak(stop), - &be_const_str_solidified, - ( &(const binstruction[ 3]) { /* code */ - 0x50040000, // 0000 LDBOOL R1 0 0 - 0x90020001, // 0001 SETMBR R0 K0 R1 - 0x80000000, // 0002 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: fast_loop -********************************************************************/ -be_local_closure(Leds_animator_fast_loop, /* name */ - be_nested_proto( - 6, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 7]) { /* constants */ - /* K0 */ be_nested_str_weak(running), - /* K1 */ be_const_int(0), - /* K2 */ be_nested_str_weak(animators), - /* K3 */ be_nested_str_weak(is_running), - /* K4 */ be_nested_str_weak(animate), - /* K5 */ be_const_int(1), - /* K6 */ be_nested_str_weak(remove), - }), - be_str_weak(fast_loop), - &be_const_str_solidified, - ( &(const binstruction[25]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x78060015, // 0001 JMPF R1 #0018 - 0x58040001, // 0002 LDCONST R1 K1 - 0x6008000C, // 0003 GETGBL R2 G12 - 0x880C0102, // 0004 GETMBR R3 R0 K2 - 0x7C080200, // 0005 CALL R2 1 - 0x14080202, // 0006 LT R2 R1 R2 - 0x780A000D, // 0007 JMPF R2 #0016 - 0x88080102, // 0008 GETMBR R2 R0 K2 - 0x94080401, // 0009 GETIDX R2 R2 R1 - 0x8C0C0503, // 000A GETMET R3 R2 K3 - 0x7C0C0200, // 000B CALL R3 1 - 0x780E0003, // 000C JMPF R3 #0011 - 0x8C0C0504, // 000D GETMET R3 R2 K4 - 0x7C0C0200, // 000E CALL R3 1 - 0x00040305, // 000F ADD R1 R1 K5 - 0x70020003, // 0010 JMP #0015 - 0x880C0102, // 0011 GETMBR R3 R0 K2 - 0x8C0C0706, // 0012 GETMET R3 R3 K6 - 0x5C140200, // 0013 MOVE R5 R1 - 0x7C0C0400, // 0014 CALL R3 2 - 0x7001FFEC, // 0015 JMP #0003 - 0x8C080104, // 0016 GETMET R2 R0 K4 - 0x7C080200, // 0017 CALL R2 1 - 0x80000000, // 0018 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: animate -********************************************************************/ -be_local_closure(Leds_animator_animate, /* name */ - be_nested_proto( - 1, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 0, /* has constants */ - NULL, /* no const */ - be_str_weak(animate), - &be_const_str_solidified, - ( &(const binstruction[ 1]) { /* code */ - 0x80000000, // 0000 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: remove -********************************************************************/ -be_local_closure(Leds_animator_remove, /* name */ - be_nested_proto( - 4, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 2]) { /* constants */ - /* K0 */ be_nested_str_weak(tasmota), - /* K1 */ be_nested_str_weak(remove_driver), - }), - be_str_weak(remove), - &be_const_str_solidified, - ( &(const binstruction[ 5]) { /* code */ - 0xB8060000, // 0000 GETNGBL R1 K0 - 0x8C040301, // 0001 GETMET R1 R1 K1 - 0x5C0C0000, // 0002 MOVE R3 R0 - 0x7C040400, // 0003 CALL R1 2 - 0x80000000, // 0004 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: set_bri -********************************************************************/ -be_local_closure(Leds_animator_set_bri, /* name */ - be_nested_proto( - 2, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str_weak(bri), - }), - be_str_weak(set_bri), - &be_const_str_solidified, - ( &(const binstruction[ 2]) { /* code */ - 0x90020001, // 0000 SETMBR R0 K0 R1 - 0x80000000, // 0001 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: get_bri -********************************************************************/ -be_local_closure(Leds_animator_get_bri, /* name */ - be_nested_proto( - 3, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str_weak(bri), - }), - be_str_weak(get_bri), - &be_const_str_solidified, - ( &(const binstruction[ 2]) { /* code */ - 0x88080100, // 0000 GETMBR R2 R0 K0 - 0x80040400, // 0001 RET 1 R2 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: start -********************************************************************/ -be_local_closure(Leds_animator_start, /* name */ - be_nested_proto( - 2, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str_weak(running), - }), - be_str_weak(start), - &be_const_str_solidified, - ( &(const binstruction[ 3]) { /* code */ - 0x50040200, // 0000 LDBOOL R1 1 0 - 0x90020001, // 0001 SETMBR R0 K0 R1 - 0x80000000, // 0002 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: clear -********************************************************************/ -be_local_closure(Leds_animator_clear, /* name */ - be_nested_proto( - 3, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 3]) { /* constants */ - /* K0 */ be_nested_str_weak(stop), - /* K1 */ be_nested_str_weak(strip), - /* K2 */ be_nested_str_weak(clear), - }), - be_str_weak(clear), - &be_const_str_solidified, - ( &(const binstruction[ 6]) { /* code */ - 0x8C040100, // 0000 GETMET R1 R0 K0 - 0x7C040200, // 0001 CALL R1 1 - 0x88040101, // 0002 GETMBR R1 R0 K1 - 0x8C040302, // 0003 GETMET R1 R1 K2 - 0x7C040200, // 0004 CALL R1 1 - 0x80000000, // 0005 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified class: Leds_animator -********************************************************************/ -be_local_class(Leds_animator, - 5, - NULL, - be_nested_map(15, - ( (struct bmapnode*) &(const bmapnode[]) { - { be_const_key_weak(init, 12), be_const_closure(Leds_animator_init_closure) }, - { be_const_key_weak(clear, -1), be_const_closure(Leds_animator_clear_closure) }, - { be_const_key_weak(stop, 13), be_const_closure(Leds_animator_stop_closure) }, - { be_const_key_weak(add_anim, 4), be_const_closure(Leds_animator_add_anim_closure) }, - { be_const_key_weak(pixel_count, 6), be_const_var(1) }, - { be_const_key_weak(animate, -1), be_const_closure(Leds_animator_animate_closure) }, - { be_const_key_weak(animators, 7), be_const_var(4) }, - { be_const_key_weak(strip, -1), be_const_var(0) }, - { be_const_key_weak(bri, -1), be_const_var(2) }, - { be_const_key_weak(remove, 8), be_const_closure(Leds_animator_remove_closure) }, - { be_const_key_weak(get_bri, -1), be_const_closure(Leds_animator_get_bri_closure) }, - { be_const_key_weak(start, -1), be_const_closure(Leds_animator_start_closure) }, - { be_const_key_weak(running, -1), be_const_var(3) }, - { be_const_key_weak(fast_loop, -1), be_const_closure(Leds_animator_fast_loop_closure) }, - { be_const_key_weak(set_bri, 1), be_const_closure(Leds_animator_set_bri_closure) }, - })), - be_str_weak(Leds_animator) -); -/*******************************************************************/ - -void be_load_Leds_animator_class(bvm *vm) { - be_pushntvclass(vm, &be_class_Leds_animator); - be_setglobal(vm, "Leds_animator"); - be_pop(vm, 1); -} -/********************************************************************/ -/* End of solidification */ diff --git a/lib/libesp32/berry_tasmota/src/solidify/solidified_leds_frame_be_methods.h b/lib/libesp32/berry_tasmota/src/solidify/solidified_leds_frame_be_methods.h new file mode 100644 index 000000000..7a565f9f2 --- /dev/null +++ b/lib/libesp32/berry_tasmota/src/solidify/solidified_leds_frame_be_methods.h @@ -0,0 +1,186 @@ +/* Solidification of leds_frame_be_methods.h */ +/********************************************************************\ +* Generated code, don't edit * +\********************************************************************/ +#include "be_constobj.h" + +extern const bclass be_class_Leds_frame_be; + +/******************************************************************** +** Solidified function: setitem +********************************************************************/ +be_local_closure(Leds_frame_be_setitem, /* name */ + be_nested_proto( + 8, /* nstack */ + 3, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str(set), + }), + &be_const_str_setitem, + &be_const_str_solidified, + ( &(const binstruction[ 7]) { /* code */ + 0x8C0C0100, // 0000 GETMET R3 R0 K0 + 0x54160003, // 0001 LDINT R5 4 + 0x08140205, // 0002 MUL R5 R1 R5 + 0x5C180400, // 0003 MOVE R6 R2 + 0x541E0003, // 0004 LDINT R7 4 + 0x7C0C0800, // 0005 CALL R3 4 + 0x80000000, // 0006 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: set_pixel +********************************************************************/ +be_local_closure(Leds_frame_be_set_pixel, /* name */ + be_nested_proto( + 11, /* nstack */ + 6, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_const_int(0), + /* K1 */ be_nested_str(setitem), + }), + &be_const_str_set_pixel, + &be_const_str_solidified, + ( &(const binstruction[26]) { /* code */ + 0x4C180000, // 0000 LDNIL R6 + 0x1C180A06, // 0001 EQ R6 R5 R6 + 0x781A0000, // 0002 JMPF R6 #0004 + 0x58140000, // 0003 LDCONST R5 K0 + 0x541A00FE, // 0004 LDINT R6 255 + 0x2C180A06, // 0005 AND R6 R5 R6 + 0x541E0017, // 0006 LDINT R7 24 + 0x38180C07, // 0007 SHL R6 R6 R7 + 0x541E00FE, // 0008 LDINT R7 255 + 0x2C1C0407, // 0009 AND R7 R2 R7 + 0x5422000F, // 000A LDINT R8 16 + 0x381C0E08, // 000B SHL R7 R7 R8 + 0x30180C07, // 000C OR R6 R6 R7 + 0x541E00FE, // 000D LDINT R7 255 + 0x2C1C0607, // 000E AND R7 R3 R7 + 0x54220007, // 000F LDINT R8 8 + 0x381C0E08, // 0010 SHL R7 R7 R8 + 0x30180C07, // 0011 OR R6 R6 R7 + 0x541E00FE, // 0012 LDINT R7 255 + 0x2C1C0807, // 0013 AND R7 R4 R7 + 0x30180C07, // 0014 OR R6 R6 R7 + 0x8C1C0101, // 0015 GETMET R7 R0 K1 + 0x5C240200, // 0016 MOVE R9 R1 + 0x5C280C00, // 0017 MOVE R10 R6 + 0x7C1C0600, // 0018 CALL R7 3 + 0x80000000, // 0019 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: item +********************************************************************/ +be_local_closure(Leds_frame_be_item, /* name */ + be_nested_proto( + 6, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str(get), + }), + &be_const_str_item, + &be_const_str_solidified, + ( &(const binstruction[ 6]) { /* code */ + 0x8C080100, // 0000 GETMET R2 R0 K0 + 0x54120003, // 0001 LDINT R4 4 + 0x08100204, // 0002 MUL R4 R1 R4 + 0x54160003, // 0003 LDINT R5 4 + 0x7C080600, // 0004 CALL R2 3 + 0x80040400, // 0005 RET 1 R2 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: init +********************************************************************/ +be_local_closure(Leds_frame_be_init, /* name */ + be_nested_proto( + 5, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 3]) { /* constants */ + /* K0 */ be_const_int(0), + /* K1 */ be_nested_str(pixel_size), + /* K2 */ be_nested_str(init), + }), + &be_const_str_init, + &be_const_str_solidified, + ( &(const binstruction[12]) { /* code */ + 0x14080300, // 0000 LT R2 R1 K0 + 0x780A0000, // 0001 JMPF R2 #0003 + 0x44040200, // 0002 NEG R1 R1 + 0x90020201, // 0003 SETMBR R0 K1 R1 + 0x60080003, // 0004 GETGBL R2 G3 + 0x5C0C0000, // 0005 MOVE R3 R0 + 0x7C080200, // 0006 CALL R2 1 + 0x8C080502, // 0007 GETMET R2 R2 K2 + 0x5411FFFB, // 0008 LDINT R4 -4 + 0x08100204, // 0009 MUL R4 R1 R4 + 0x7C080400, // 000A CALL R2 2 + 0x80000000, // 000B RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified class: Leds_frame_be +********************************************************************/ +be_local_class(Leds_frame_be, + 0, + NULL, + be_nested_map(4, + ( (struct bmapnode*) &(const bmapnode[]) { + { be_const_key(setitem, 1), be_const_closure(Leds_frame_be_setitem_closure) }, + { be_const_key(set_pixel, -1), be_const_closure(Leds_frame_be_set_pixel_closure) }, + { be_const_key(item, -1), be_const_closure(Leds_frame_be_item_closure) }, + { be_const_key(init, -1), be_const_closure(Leds_frame_be_init_closure) }, + })), + (bstring*) &be_const_str_Leds_frame_be +); +/*******************************************************************/ + +void be_load_Leds_frame_be_class(bvm *vm) { + be_pushntvclass(vm, &be_class_Leds_frame_be); + be_setglobal(vm, "Leds_frame_be"); + be_pop(vm, 1); +} +/********************************************************************/ +/* End of solidification */ diff --git a/lib/libesp32/berry_tasmota/src/solidify/solidified_partition_core.h b/lib/libesp32/berry_tasmota/src/solidify/solidified_partition_core.h index 919b870ca..eb318fd5c 100644 --- a/lib/libesp32/berry_tasmota/src/solidify/solidified_partition_core.h +++ b/lib/libesp32/berry_tasmota/src/solidify/solidified_partition_core.h @@ -504,6 +504,294 @@ be_local_class(Partition_otadata, extern const bclass be_class_Partition; +/******************************************************************** +** Solidified function: save +********************************************************************/ +be_local_closure(Partition_save, /* name */ + be_nested_proto( + 7, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 6]) { /* constants */ + /* K0 */ be_nested_str(flash), + /* K1 */ be_nested_str(tobytes), + /* K2 */ be_nested_str(erase), + /* K3 */ be_nested_str(write), + /* K4 */ be_nested_str(otadata), + /* K5 */ be_nested_str(save), + }), + &be_const_str_save, + &be_const_str_solidified, + ( &(const binstruction[15]) { /* code */ + 0xA4060000, // 0000 IMPORT R1 K0 + 0x8C080101, // 0001 GETMET R2 R0 K1 + 0x7C080200, // 0002 CALL R2 1 + 0x8C0C0302, // 0003 GETMET R3 R1 K2 + 0x54167FFF, // 0004 LDINT R5 32768 + 0x541A0FFF, // 0005 LDINT R6 4096 + 0x7C0C0600, // 0006 CALL R3 3 + 0x8C0C0303, // 0007 GETMET R3 R1 K3 + 0x54167FFF, // 0008 LDINT R5 32768 + 0x5C180400, // 0009 MOVE R6 R2 + 0x7C0C0600, // 000A CALL R3 3 + 0x880C0104, // 000B GETMBR R3 R0 K4 + 0x8C0C0705, // 000C GETMET R3 R3 K5 + 0x7C0C0200, // 000D CALL R3 1 + 0x80000000, // 000E RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: load +********************************************************************/ +be_local_closure(Partition_load, /* name */ + be_nested_proto( + 6, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 3]) { /* constants */ + /* K0 */ be_nested_str(flash), + /* K1 */ be_nested_str(raw), + /* K2 */ be_nested_str(read), + }), + &be_const_str_load, + &be_const_str_solidified, + ( &(const binstruction[ 7]) { /* code */ + 0xA4060000, // 0000 IMPORT R1 K0 + 0x8C080302, // 0001 GETMET R2 R1 K2 + 0x54127FFF, // 0002 LDINT R4 32768 + 0x54160FFF, // 0003 LDINT R5 4096 + 0x7C080600, // 0004 CALL R2 3 + 0x90020202, // 0005 SETMBR R0 K1 R2 + 0x80000000, // 0006 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: get_active +********************************************************************/ +be_local_closure(Partition_get_active, /* name */ + be_nested_proto( + 2, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(otadata), + /* K1 */ be_nested_str(active_otadata), + }), + &be_const_str_get_active, + &be_const_str_solidified, + ( &(const binstruction[ 3]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x88040301, // 0001 GETMBR R1 R1 K1 + 0x80040200, // 0002 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: init +********************************************************************/ +be_local_closure(Partition_init, /* name */ + be_nested_proto( + 3, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 4]) { /* constants */ + /* K0 */ be_nested_str(slots), + /* K1 */ be_nested_str(load), + /* K2 */ be_nested_str(parse), + /* K3 */ be_nested_str(load_otadata), + }), + &be_const_str_init, + &be_const_str_solidified, + ( &(const binstruction[10]) { /* code */ + 0x60040012, // 0000 GETGBL R1 G18 + 0x7C040000, // 0001 CALL R1 0 + 0x90020001, // 0002 SETMBR R0 K0 R1 + 0x8C040101, // 0003 GETMET R1 R0 K1 + 0x7C040200, // 0004 CALL R1 1 + 0x8C040102, // 0005 GETMET R1 R0 K2 + 0x7C040200, // 0006 CALL R1 1 + 0x8C040103, // 0007 GETMET R1 R0 K3 + 0x7C040200, // 0008 CALL R1 1 + 0x80000000, // 0009 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: parse +********************************************************************/ +be_local_closure(Partition_parse, /* name */ + be_nested_proto( + 9, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[11]) { /* constants */ + /* K0 */ be_const_int(0), + /* K1 */ be_nested_str(raw), + /* K2 */ be_const_int(1), + /* K3 */ be_nested_str(get), + /* K4 */ be_const_int(2), + /* K5 */ be_nested_str(partition_core), + /* K6 */ be_nested_str(Partition_info), + /* K7 */ be_nested_str(slots), + /* K8 */ be_nested_str(push), + /* K9 */ be_nested_str(md5), + /* K10 */ be_nested_str(stop_iteration), + }), + &be_const_str_parse, + &be_const_str_solidified, + ( &(const binstruction[57]) { /* code */ + 0x60040010, // 0000 GETGBL R1 G16 + 0x540A005D, // 0001 LDINT R2 94 + 0x400A0002, // 0002 CONNECT R2 K0 R2 + 0x7C040200, // 0003 CALL R1 1 + 0xA802002F, // 0004 EXBLK 0 #0035 + 0x5C080200, // 0005 MOVE R2 R1 + 0x7C080000, // 0006 CALL R2 0 + 0x540E001F, // 0007 LDINT R3 32 + 0x080C0403, // 0008 MUL R3 R2 R3 + 0x00100502, // 0009 ADD R4 R2 K2 + 0x5416001F, // 000A LDINT R5 32 + 0x08100805, // 000B MUL R4 R4 R5 + 0x04100902, // 000C SUB R4 R4 K2 + 0x400C0604, // 000D CONNECT R3 R3 R4 + 0x88100101, // 000E GETMBR R4 R0 K1 + 0x940C0803, // 000F GETIDX R3 R4 R3 + 0x8C140703, // 0010 GETMET R5 R3 K3 + 0x581C0000, // 0011 LDCONST R7 K0 + 0x58200004, // 0012 LDCONST R8 K4 + 0x7C140600, // 0013 CALL R5 3 + 0x5C100A00, // 0014 MOVE R4 R5 + 0x541650A9, // 0015 LDINT R5 20650 + 0x1C140805, // 0016 EQ R5 R4 R5 + 0x78160008, // 0017 JMPF R5 #0021 + 0xB8160A00, // 0018 GETNGBL R5 K5 + 0x8C140B06, // 0019 GETMET R5 R5 K6 + 0x5C1C0600, // 001A MOVE R7 R3 + 0x7C140400, // 001B CALL R5 2 + 0x88180107, // 001C GETMBR R6 R0 K7 + 0x8C180D08, // 001D GETMET R6 R6 K8 + 0x5C200A00, // 001E MOVE R8 R5 + 0x7C180400, // 001F CALL R6 2 + 0x70020010, // 0020 JMP #0032 + 0x5416EBEA, // 0021 LDINT R5 60395 + 0x1C140805, // 0022 EQ R5 R4 R5 + 0x7816000C, // 0023 JMPF R5 #0031 + 0x5416001F, // 0024 LDINT R5 32 + 0x08140405, // 0025 MUL R5 R2 R5 + 0x541A000F, // 0026 LDINT R6 16 + 0x00140A06, // 0027 ADD R5 R5 R6 + 0x541A0020, // 0028 LDINT R6 33 + 0x08180406, // 0029 MUL R6 R2 R6 + 0x04180D02, // 002A SUB R6 R6 K2 + 0x40140A06, // 002B CONNECT R5 R5 R6 + 0x88180101, // 002C GETMBR R6 R0 K1 + 0x94140C05, // 002D GETIDX R5 R6 R5 + 0x90021205, // 002E SETMBR R0 K9 R5 + 0x70020002, // 002F JMP #0033 + 0x70020000, // 0030 JMP #0032 + 0x70020000, // 0031 JMP #0033 + 0x7001FFD1, // 0032 JMP #0005 + 0xA8040001, // 0033 EXBLK 1 1 + 0x70020002, // 0034 JMP #0038 + 0x5804000A, // 0035 LDCONST R1 K10 + 0xAC040200, // 0036 CATCH R1 1 0 + 0xB0080000, // 0037 RAISE 2 R0 R0 + 0x80000000, // 0038 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: get_max_flash_size_k +********************************************************************/ +be_local_closure(Partition_get_max_flash_size_k, /* name */ + be_nested_proto( + 6, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 6]) { /* constants */ + /* K0 */ be_nested_str(tasmota), + /* K1 */ be_nested_str(memory), + /* K2 */ be_nested_str(flash), + /* K3 */ be_nested_str(find), + /* K4 */ be_nested_str(flash_real), + /* K5 */ be_nested_str(get_flash_definition_sector), + }), + &be_const_str_get_max_flash_size_k, + &be_const_str_solidified, + ( &(const binstruction[20]) { /* code */ + 0xB8060000, // 0000 GETNGBL R1 K0 + 0x8C040301, // 0001 GETMET R1 R1 K1 + 0x7C040200, // 0002 CALL R1 1 + 0x94040302, // 0003 GETIDX R1 R1 K2 + 0xB80A0000, // 0004 GETNGBL R2 K0 + 0x8C080501, // 0005 GETMET R2 R2 K1 + 0x7C080200, // 0006 CALL R2 1 + 0x8C080503, // 0007 GETMET R2 R2 K3 + 0x58100004, // 0008 LDCONST R4 K4 + 0x5C140200, // 0009 MOVE R5 R1 + 0x7C080600, // 000A CALL R2 3 + 0x200C0202, // 000B NE R3 R1 R2 + 0x780E0005, // 000C JMPF R3 #0013 + 0x8C0C0105, // 000D GETMET R3 R0 K5 + 0x7C0C0200, // 000E CALL R3 1 + 0x4C100000, // 000F LDNIL R4 + 0x200C0604, // 0010 NE R3 R3 R4 + 0x780E0000, // 0011 JMPF R3 #0013 + 0x5C040400, // 0012 MOVE R1 R2 + 0x80040200, // 0013 RET 1 R1 + }) + ) +); +/*******************************************************************/ + + /******************************************************************** ** Solidified function: resize_max_flash_size_k ********************************************************************/ @@ -639,9 +927,252 @@ be_local_closure(Partition_resize_max_flash_size_k, /* name */ /******************************************************************** -** Solidified function: get_max_flash_size_k +** Solidified function: get_flash_definition_sector ********************************************************************/ -be_local_closure(Partition_get_max_flash_size_k, /* name */ +be_local_closure(Partition_get_flash_definition_sector, /* name */ + be_nested_proto( + 9, /* nstack */ + 0, /* argc */ + 4, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 7]) { /* constants */ + /* K0 */ be_const_class(be_class_Partition), + /* K1 */ be_nested_str(flash), + /* K2 */ be_const_int(0), + /* K3 */ be_const_int(1), + /* K4 */ be_nested_str(read), + /* K5 */ be_nested_str(E9), + /* K6 */ be_nested_str(stop_iteration), + }), + &be_const_str_get_flash_definition_sector, + &be_const_str_solidified, + ( &(const binstruction[26]) { /* code */ + 0x58000000, // 0000 LDCONST R0 K0 + 0xA4060200, // 0001 IMPORT R1 K1 + 0x60080010, // 0002 GETGBL R2 G16 + 0x400E0503, // 0003 CONNECT R3 K2 K3 + 0x7C080200, // 0004 CALL R2 1 + 0xA802000F, // 0005 EXBLK 0 #0016 + 0x5C0C0400, // 0006 MOVE R3 R2 + 0x7C0C0000, // 0007 CALL R3 0 + 0x54120FFF, // 0008 LDINT R4 4096 + 0x08100604, // 0009 MUL R4 R3 R4 + 0x8C140304, // 000A GETMET R5 R1 K4 + 0x5C1C0800, // 000B MOVE R7 R4 + 0x58200003, // 000C LDCONST R8 K3 + 0x7C140600, // 000D CALL R5 3 + 0x60180015, // 000E GETGBL R6 G21 + 0x581C0005, // 000F LDCONST R7 K5 + 0x7C180200, // 0010 CALL R6 1 + 0x1C140A06, // 0011 EQ R5 R5 R6 + 0x78160001, // 0012 JMPF R5 #0015 + 0xA8040001, // 0013 EXBLK 1 1 + 0x80040800, // 0014 RET 1 R4 + 0x7001FFEF, // 0015 JMP #0006 + 0x58080006, // 0016 LDCONST R2 K6 + 0xAC080200, // 0017 CATCH R2 1 0 + 0xB0080000, // 0018 RAISE 2 R0 R0 + 0x80000000, // 0019 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: resize_fs_to_max +********************************************************************/ +be_local_closure(Partition_resize_fs_to_max, /* name */ + be_nested_proto( + 9, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[14]) { /* constants */ + /* K0 */ be_nested_str(get_unallocated_k), + /* K1 */ be_const_int(0), + /* K2 */ be_nested_str(tasmota), + /* K3 */ be_nested_str(log), + /* K4 */ be_nested_str(BRY_X3A_X20Trying_X20to_X20expand_X20FS_X20by_X20_X25i_X20kB), + /* K5 */ be_const_int(2), + /* K6 */ be_nested_str(resize_max_flash_size_k), + /* K7 */ be_nested_str(slots), + /* K8 */ be_nested_str(sz), + /* K9 */ be_nested_str(save), + /* K10 */ be_nested_str(global), + /* K11 */ be_nested_str(restart_flag), + /* K12 */ be_nested_str(BRY_X3A_X20Successfully_X20resized_X20FS_X2C_X20restarting), + /* K13 */ be_nested_str(BRY_X3A_X20Exception_X3E_X20_X27_X25s_X27_X20_X2D_X20_X25s), + }), + &be_const_str_resize_fs_to_max, + &be_const_str_solidified, + ( &(const binstruction[52]) { /* code */ + 0xA8020024, // 0000 EXBLK 0 #0026 + 0x8C040100, // 0001 GETMET R1 R0 K0 + 0x7C040200, // 0002 CALL R1 1 + 0x18080301, // 0003 LE R2 R1 K1 + 0x780A0002, // 0004 JMPF R2 #0008 + 0x4C080000, // 0005 LDNIL R2 + 0xA8040001, // 0006 EXBLK 1 1 + 0x80040400, // 0007 RET 1 R2 + 0xB80A0400, // 0008 GETNGBL R2 K2 + 0x8C080503, // 0009 GETMET R2 R2 K3 + 0x60100018, // 000A GETGBL R4 G24 + 0x58140004, // 000B LDCONST R5 K4 + 0x5C180200, // 000C MOVE R6 R1 + 0x7C100400, // 000D CALL R4 2 + 0x58140005, // 000E LDCONST R5 K5 + 0x7C080600, // 000F CALL R2 3 + 0x8C080106, // 0010 GETMET R2 R0 K6 + 0x7C080200, // 0011 CALL R2 1 + 0x88080107, // 0012 GETMBR R2 R0 K7 + 0x540DFFFE, // 0013 LDINT R3 -1 + 0x94080403, // 0014 GETIDX R2 R2 R3 + 0x541203FF, // 0015 LDINT R4 1024 + 0x08100204, // 0016 MUL R4 R1 R4 + 0x880C0508, // 0017 GETMBR R3 R2 K8 + 0x000C0604, // 0018 ADD R3 R3 R4 + 0x900A1003, // 0019 SETMBR R2 K8 R3 + 0x8C0C0109, // 001A GETMET R3 R0 K9 + 0x7C0C0200, // 001B CALL R3 1 + 0xB80E0400, // 001C GETNGBL R3 K2 + 0x880C070A, // 001D GETMBR R3 R3 K10 + 0x900E1705, // 001E SETMBR R3 K11 K5 + 0xB80E0400, // 001F GETNGBL R3 K2 + 0x8C0C0703, // 0020 GETMET R3 R3 K3 + 0x5814000C, // 0021 LDCONST R5 K12 + 0x58180005, // 0022 LDCONST R6 K5 + 0x7C0C0600, // 0023 CALL R3 3 + 0xA8040001, // 0024 EXBLK 1 1 + 0x7002000C, // 0025 JMP #0033 + 0xAC040002, // 0026 CATCH R1 0 2 + 0x70020009, // 0027 JMP #0032 + 0xB80E0400, // 0028 GETNGBL R3 K2 + 0x8C0C0703, // 0029 GETMET R3 R3 K3 + 0x60140018, // 002A GETGBL R5 G24 + 0x5818000D, // 002B LDCONST R6 K13 + 0x5C1C0200, // 002C MOVE R7 R1 + 0x5C200400, // 002D MOVE R8 R2 + 0x7C140600, // 002E CALL R5 3 + 0x58180005, // 002F LDCONST R6 K5 + 0x7C0C0600, // 0030 CALL R3 3 + 0x70020000, // 0031 JMP #0033 + 0xB0080000, // 0032 RAISE 2 R0 R0 + 0x80000000, // 0033 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: switch_factory +********************************************************************/ +be_local_closure(Partition_switch_factory, /* name */ + be_nested_proto( + 6, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 2]) { /* constants */ + /* K0 */ be_nested_str(flash), + /* K1 */ be_nested_str(factory), + }), + &be_const_str_switch_factory, + &be_const_str_solidified, + ( &(const binstruction[ 5]) { /* code */ + 0xA40A0000, // 0000 IMPORT R2 K0 + 0x8C0C0501, // 0001 GETMET R3 R2 K1 + 0x5C140200, // 0002 MOVE R5 R1 + 0x7C0C0400, // 0003 CALL R3 2 + 0x80000000, // 0004 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: load_otadata +********************************************************************/ +be_local_closure(Partition_load_otadata, /* name */ + be_nested_proto( + 8, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[12]) { /* constants */ + /* K0 */ be_nested_str(ota_max), + /* K1 */ be_nested_str(slots), + /* K2 */ be_nested_str(type), + /* K3 */ be_const_int(1), + /* K4 */ be_nested_str(subtype), + /* K5 */ be_const_int(0), + /* K6 */ be_nested_str(start), + /* K7 */ be_nested_str(stop_iteration), + /* K8 */ be_nested_str(otadata), + /* K9 */ be_nested_str(partition_core), + /* K10 */ be_nested_str(Partition_otadata), + /* K11 */ be_nested_str(has_factory), + }), + &be_const_str_load_otadata, + &be_const_str_solidified, + ( &(const binstruction[29]) { /* code */ + 0x5406DFFF, // 0000 LDINT R1 57344 + 0x8C080100, // 0001 GETMET R2 R0 K0 + 0x7C080200, // 0002 CALL R2 1 + 0x600C0010, // 0003 GETGBL R3 G16 + 0x88100101, // 0004 GETMBR R4 R0 K1 + 0x7C0C0200, // 0005 CALL R3 1 + 0xA8020009, // 0006 EXBLK 0 #0011 + 0x5C100600, // 0007 MOVE R4 R3 + 0x7C100000, // 0008 CALL R4 0 + 0x88140902, // 0009 GETMBR R5 R4 K2 + 0x1C140B03, // 000A EQ R5 R5 K3 + 0x78160003, // 000B JMPF R5 #0010 + 0x88140904, // 000C GETMBR R5 R4 K4 + 0x1C140B05, // 000D EQ R5 R5 K5 + 0x78160000, // 000E JMPF R5 #0010 + 0x88040906, // 000F GETMBR R1 R4 K6 + 0x7001FFF5, // 0010 JMP #0007 + 0x580C0007, // 0011 LDCONST R3 K7 + 0xAC0C0200, // 0012 CATCH R3 1 0 + 0xB0080000, // 0013 RAISE 2 R0 R0 + 0xB80E1200, // 0014 GETNGBL R3 K9 + 0x8C0C070A, // 0015 GETMET R3 R3 K10 + 0x5C140400, // 0016 MOVE R5 R2 + 0x8C18010B, // 0017 GETMET R6 R0 K11 + 0x7C180200, // 0018 CALL R6 1 + 0x5C1C0200, // 0019 MOVE R7 R1 + 0x7C0C0800, // 001A CALL R3 4 + 0x90021003, // 001B SETMBR R0 K8 R3 + 0x80000000, // 001C RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: tostring +********************************************************************/ +be_local_closure(Partition_tostring, /* name */ be_nested_proto( 6, /* nstack */ 1, /* argc */ @@ -651,37 +1182,43 @@ be_local_closure(Partition_get_max_flash_size_k, /* name */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[ 6]) { /* constants */ - /* K0 */ be_nested_str(tasmota), - /* K1 */ be_nested_str(memory), - /* K2 */ be_nested_str(flash), - /* K3 */ be_nested_str(find), - /* K4 */ be_nested_str(flash_real), - /* K5 */ be_nested_str(get_flash_definition_sector), + ( &(const bvalue[ 9]) { /* constants */ + /* K0 */ be_nested_str(_X3Cinstance_X3A_X20Partition_X28_X5B_X0A), + /* K1 */ be_nested_str(slots), + /* K2 */ be_nested_str(_X20_X20), + /* K3 */ be_nested_str(tostring), + /* K4 */ be_nested_str(_X0A), + /* K5 */ be_nested_str(stop_iteration), + /* K6 */ be_nested_str(_X5D_X2C_X0A_X20_X20), + /* K7 */ be_nested_str(otadata), + /* K8 */ be_nested_str(_X0A_X29_X3E), }), - &be_const_str_get_max_flash_size_k, + &be_const_str_tostring, &be_const_str_solidified, - ( &(const binstruction[20]) { /* code */ - 0xB8060000, // 0000 GETNGBL R1 K0 - 0x8C040301, // 0001 GETMET R1 R1 K1 - 0x7C040200, // 0002 CALL R1 1 - 0x94040302, // 0003 GETIDX R1 R1 K2 - 0xB80A0000, // 0004 GETNGBL R2 K0 - 0x8C080501, // 0005 GETMET R2 R2 K1 - 0x7C080200, // 0006 CALL R2 1 - 0x8C080503, // 0007 GETMET R2 R2 K3 - 0x58100004, // 0008 LDCONST R4 K4 - 0x5C140200, // 0009 MOVE R5 R1 - 0x7C080600, // 000A CALL R2 3 - 0x200C0202, // 000B NE R3 R1 R2 - 0x780E0005, // 000C JMPF R3 #0013 - 0x8C0C0105, // 000D GETMET R3 R0 K5 - 0x7C0C0200, // 000E CALL R3 1 - 0x4C100000, // 000F LDNIL R4 - 0x200C0604, // 0010 NE R3 R3 R4 - 0x780E0000, // 0011 JMPF R3 #0013 - 0x5C040400, // 0012 MOVE R1 R2 - 0x80040200, // 0013 RET 1 R1 + ( &(const binstruction[23]) { /* code */ + 0x58040000, // 0000 LDCONST R1 K0 + 0x60080010, // 0001 GETGBL R2 G16 + 0x880C0101, // 0002 GETMBR R3 R0 K1 + 0x7C080200, // 0003 CALL R2 1 + 0xA8020007, // 0004 EXBLK 0 #000D + 0x5C0C0400, // 0005 MOVE R3 R2 + 0x7C0C0000, // 0006 CALL R3 0 + 0x00040302, // 0007 ADD R1 R1 K2 + 0x8C100703, // 0008 GETMET R4 R3 K3 + 0x7C100200, // 0009 CALL R4 1 + 0x00040204, // 000A ADD R1 R1 R4 + 0x00040304, // 000B ADD R1 R1 K4 + 0x7001FFF7, // 000C JMP #0005 + 0x58080005, // 000D LDCONST R2 K5 + 0xAC080200, // 000E CATCH R2 1 0 + 0xB0080000, // 000F RAISE 2 R0 R0 + 0x00040306, // 0010 ADD R1 R1 K6 + 0x88080107, // 0011 GETMBR R2 R0 K7 + 0x8C080503, // 0012 GETMET R2 R2 K3 + 0x7C080200, // 0013 CALL R2 1 + 0x00040202, // 0014 ADD R1 R1 R2 + 0x00040308, // 0015 ADD R1 R1 K8 + 0x80040200, // 0016 RET 1 R1 }) ) ); @@ -689,11 +1226,11 @@ be_local_closure(Partition_get_max_flash_size_k, /* name */ /******************************************************************** -** Solidified function: get_unallocated_k +** Solidified function: has_factory ********************************************************************/ -be_local_closure(Partition_get_unallocated_k, /* name */ +be_local_closure(Partition_has_factory, /* name */ be_nested_proto( - 5, /* nstack */ + 3, /* nstack */ 1, /* argc */ 2, /* varg */ 0, /* has upvals */ @@ -701,36 +1238,17 @@ be_local_closure(Partition_get_unallocated_k, /* name */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[ 6]) { /* constants */ - /* K0 */ be_nested_str(slots), - /* K1 */ be_nested_str(is_spiffs), - /* K2 */ be_nested_str(get_max_flash_size_k), - /* K3 */ be_nested_str(start), - /* K4 */ be_nested_str(sz), - /* K5 */ be_const_int(0), + ( &(const bvalue[ 1]) { /* constants */ + /* K0 */ be_nested_str(get_factory_slot), }), - &be_const_str_get_unallocated_k, + &be_const_str_has_factory, &be_const_str_solidified, - ( &(const binstruction[19]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x5409FFFE, // 0001 LDINT R2 -1 - 0x94040202, // 0002 GETIDX R1 R1 R2 - 0x8C0C0301, // 0003 GETMET R3 R1 K1 - 0x7C0C0200, // 0004 CALL R3 1 - 0x780E000B, // 0005 JMPF R3 #0012 - 0x8C0C0102, // 0006 GETMET R3 R0 K2 - 0x7C0C0200, // 0007 CALL R3 1 - 0x5C080600, // 0008 MOVE R2 R3 - 0x880C0303, // 0009 GETMBR R3 R1 K3 - 0x88100304, // 000A GETMBR R4 R1 K4 - 0x000C0604, // 000B ADD R3 R3 R4 - 0x541203FF, // 000C LDINT R4 1024 - 0x0C0C0604, // 000D DIV R3 R3 R4 - 0x14100602, // 000E LT R4 R3 R2 - 0x78120001, // 000F JMPF R4 #0012 - 0x04100403, // 0010 SUB R4 R2 R3 - 0x80040800, // 0011 RET 1 R4 - 0x80060A00, // 0012 RET 1 K5 + ( &(const binstruction[ 5]) { /* code */ + 0x8C040100, // 0000 GETMET R1 R0 K0 + 0x7C040200, // 0001 CALL R1 1 + 0x4C080000, // 0002 LDNIL R2 + 0x20040202, // 0003 NE R1 R1 R2 + 0x80040200, // 0004 RET 1 R1 }) ) ); @@ -805,511 +1323,6 @@ be_local_closure(Partition_tobytes, /* name */ /*******************************************************************/ -/******************************************************************** -** Solidified function: has_factory -********************************************************************/ -be_local_closure(Partition_has_factory, /* name */ - be_nested_proto( - 3, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ - /* K0 */ be_nested_str(get_factory_slot), - }), - &be_const_str_has_factory, - &be_const_str_solidified, - ( &(const binstruction[ 5]) { /* code */ - 0x8C040100, // 0000 GETMET R1 R0 K0 - 0x7C040200, // 0001 CALL R1 1 - 0x4C080000, // 0002 LDNIL R2 - 0x20040202, // 0003 NE R1 R1 R2 - 0x80040200, // 0004 RET 1 R1 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: resize_fs_to_max -********************************************************************/ -be_local_closure(Partition_resize_fs_to_max, /* name */ - be_nested_proto( - 9, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[14]) { /* constants */ - /* K0 */ be_nested_str(get_unallocated_k), - /* K1 */ be_const_int(0), - /* K2 */ be_nested_str(tasmota), - /* K3 */ be_nested_str(log), - /* K4 */ be_nested_str(BRY_X3A_X20Trying_X20to_X20expand_X20FS_X20by_X20_X25i_X20kB), - /* K5 */ be_const_int(2), - /* K6 */ be_nested_str(resize_max_flash_size_k), - /* K7 */ be_nested_str(slots), - /* K8 */ be_nested_str(sz), - /* K9 */ be_nested_str(save), - /* K10 */ be_nested_str(global), - /* K11 */ be_nested_str(restart_flag), - /* K12 */ be_nested_str(BRY_X3A_X20Successfully_X20resized_X20FS_X2C_X20restarting), - /* K13 */ be_nested_str(BRY_X3A_X20Exception_X3E_X20_X27_X25s_X27_X20_X2D_X20_X25s), - }), - &be_const_str_resize_fs_to_max, - &be_const_str_solidified, - ( &(const binstruction[52]) { /* code */ - 0xA8020024, // 0000 EXBLK 0 #0026 - 0x8C040100, // 0001 GETMET R1 R0 K0 - 0x7C040200, // 0002 CALL R1 1 - 0x18080301, // 0003 LE R2 R1 K1 - 0x780A0002, // 0004 JMPF R2 #0008 - 0x4C080000, // 0005 LDNIL R2 - 0xA8040001, // 0006 EXBLK 1 1 - 0x80040400, // 0007 RET 1 R2 - 0xB80A0400, // 0008 GETNGBL R2 K2 - 0x8C080503, // 0009 GETMET R2 R2 K3 - 0x60100018, // 000A GETGBL R4 G24 - 0x58140004, // 000B LDCONST R5 K4 - 0x5C180200, // 000C MOVE R6 R1 - 0x7C100400, // 000D CALL R4 2 - 0x58140005, // 000E LDCONST R5 K5 - 0x7C080600, // 000F CALL R2 3 - 0x8C080106, // 0010 GETMET R2 R0 K6 - 0x7C080200, // 0011 CALL R2 1 - 0x88080107, // 0012 GETMBR R2 R0 K7 - 0x540DFFFE, // 0013 LDINT R3 -1 - 0x94080403, // 0014 GETIDX R2 R2 R3 - 0x541603FF, // 0015 LDINT R5 1024 - 0x08140205, // 0016 MUL R5 R1 R5 - 0x88100508, // 0017 GETMBR R4 R2 K8 - 0x00100805, // 0018 ADD R4 R4 R5 - 0x900A1004, // 0019 SETMBR R2 K8 R4 - 0x8C100109, // 001A GETMET R4 R0 K9 - 0x7C100200, // 001B CALL R4 1 - 0xB80E0400, // 001C GETNGBL R3 K2 - 0x880C070A, // 001D GETMBR R3 R3 K10 - 0x900E1705, // 001E SETMBR R3 K11 K5 - 0xB80E0400, // 001F GETNGBL R3 K2 - 0x8C0C0703, // 0020 GETMET R3 R3 K3 - 0x5814000C, // 0021 LDCONST R5 K12 - 0x58180005, // 0022 LDCONST R6 K5 - 0x7C0C0600, // 0023 CALL R3 3 - 0xA8040001, // 0024 EXBLK 1 1 - 0x7002000C, // 0025 JMP #0033 - 0xAC040002, // 0026 CATCH R1 0 2 - 0x70020009, // 0027 JMP #0032 - 0xB80E0400, // 0028 GETNGBL R3 K2 - 0x8C0C0703, // 0029 GETMET R3 R3 K3 - 0x60140018, // 002A GETGBL R5 G24 - 0x5818000D, // 002B LDCONST R6 K13 - 0x5C1C0200, // 002C MOVE R7 R1 - 0x5C200400, // 002D MOVE R8 R2 - 0x7C140600, // 002E CALL R5 3 - 0x58180005, // 002F LDCONST R6 K5 - 0x7C0C0600, // 0030 CALL R3 3 - 0x70020000, // 0031 JMP #0033 - 0xB0080000, // 0032 RAISE 2 R0 R0 - 0x80000000, // 0033 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: get_ota_slot -********************************************************************/ -be_local_closure(Partition_get_ota_slot, /* name */ - be_nested_proto( - 6, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 3]) { /* constants */ - /* K0 */ be_nested_str(slots), - /* K1 */ be_nested_str(is_ota), - /* K2 */ be_nested_str(stop_iteration), - }), - &be_const_str_get_ota_slot, - &be_const_str_solidified, - ( &(const binstruction[18]) { /* code */ - 0x60080010, // 0000 GETGBL R2 G16 - 0x880C0100, // 0001 GETMBR R3 R0 K0 - 0x7C080200, // 0002 CALL R2 1 - 0xA8020008, // 0003 EXBLK 0 #000D - 0x5C0C0400, // 0004 MOVE R3 R2 - 0x7C0C0000, // 0005 CALL R3 0 - 0x8C100701, // 0006 GETMET R4 R3 K1 - 0x7C100200, // 0007 CALL R4 1 - 0x1C100801, // 0008 EQ R4 R4 R1 - 0x78120001, // 0009 JMPF R4 #000C - 0xA8040001, // 000A EXBLK 1 1 - 0x80040600, // 000B RET 1 R3 - 0x7001FFF6, // 000C JMP #0004 - 0x58080002, // 000D LDCONST R2 K2 - 0xAC080200, // 000E CATCH R2 1 0 - 0xB0080000, // 000F RAISE 2 R0 R0 - 0x4C080000, // 0010 LDNIL R2 - 0x80040400, // 0011 RET 1 R2 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: tostring -********************************************************************/ -be_local_closure(Partition_tostring, /* name */ - be_nested_proto( - 6, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 9]) { /* constants */ - /* K0 */ be_nested_str(_X3Cinstance_X3A_X20Partition_X28_X5B_X0A), - /* K1 */ be_nested_str(slots), - /* K2 */ be_nested_str(_X20_X20), - /* K3 */ be_nested_str(tostring), - /* K4 */ be_nested_str(_X0A), - /* K5 */ be_nested_str(stop_iteration), - /* K6 */ be_nested_str(_X5D_X2C_X0A_X20_X20), - /* K7 */ be_nested_str(otadata), - /* K8 */ be_nested_str(_X0A_X29_X3E), - }), - &be_const_str_tostring, - &be_const_str_solidified, - ( &(const binstruction[23]) { /* code */ - 0x58040000, // 0000 LDCONST R1 K0 - 0x60080010, // 0001 GETGBL R2 G16 - 0x880C0101, // 0002 GETMBR R3 R0 K1 - 0x7C080200, // 0003 CALL R2 1 - 0xA8020007, // 0004 EXBLK 0 #000D - 0x5C0C0400, // 0005 MOVE R3 R2 - 0x7C0C0000, // 0006 CALL R3 0 - 0x00040302, // 0007 ADD R1 R1 K2 - 0x8C100703, // 0008 GETMET R4 R3 K3 - 0x7C100200, // 0009 CALL R4 1 - 0x00040204, // 000A ADD R1 R1 R4 - 0x00040304, // 000B ADD R1 R1 K4 - 0x7001FFF7, // 000C JMP #0005 - 0x58080005, // 000D LDCONST R2 K5 - 0xAC080200, // 000E CATCH R2 1 0 - 0xB0080000, // 000F RAISE 2 R0 R0 - 0x00040306, // 0010 ADD R1 R1 K6 - 0x88080107, // 0011 GETMBR R2 R0 K7 - 0x8C080503, // 0012 GETMET R2 R2 K3 - 0x7C080200, // 0013 CALL R2 1 - 0x00040202, // 0014 ADD R1 R1 R2 - 0x00040308, // 0015 ADD R1 R1 K8 - 0x80040200, // 0016 RET 1 R1 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: parse -********************************************************************/ -be_local_closure(Partition_parse, /* name */ - be_nested_proto( - 9, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[11]) { /* constants */ - /* K0 */ be_const_int(0), - /* K1 */ be_nested_str(raw), - /* K2 */ be_const_int(1), - /* K3 */ be_nested_str(get), - /* K4 */ be_const_int(2), - /* K5 */ be_nested_str(partition_core), - /* K6 */ be_nested_str(Partition_info), - /* K7 */ be_nested_str(slots), - /* K8 */ be_nested_str(push), - /* K9 */ be_nested_str(md5), - /* K10 */ be_nested_str(stop_iteration), - }), - &be_const_str_parse, - &be_const_str_solidified, - ( &(const binstruction[57]) { /* code */ - 0x60040010, // 0000 GETGBL R1 G16 - 0x540A005D, // 0001 LDINT R2 94 - 0x400A0002, // 0002 CONNECT R2 K0 R2 - 0x7C040200, // 0003 CALL R1 1 - 0xA802002F, // 0004 EXBLK 0 #0035 - 0x5C080200, // 0005 MOVE R2 R1 - 0x7C080000, // 0006 CALL R2 0 - 0x540E001F, // 0007 LDINT R3 32 - 0x080C0403, // 0008 MUL R3 R2 R3 - 0x00100502, // 0009 ADD R4 R2 K2 - 0x5416001F, // 000A LDINT R5 32 - 0x08100805, // 000B MUL R4 R4 R5 - 0x04100902, // 000C SUB R4 R4 K2 - 0x400C0604, // 000D CONNECT R3 R3 R4 - 0x88100101, // 000E GETMBR R4 R0 K1 - 0x940C0803, // 000F GETIDX R3 R4 R3 - 0x8C140703, // 0010 GETMET R5 R3 K3 - 0x581C0000, // 0011 LDCONST R7 K0 - 0x58200004, // 0012 LDCONST R8 K4 - 0x7C140600, // 0013 CALL R5 3 - 0x5C100A00, // 0014 MOVE R4 R5 - 0x541650A9, // 0015 LDINT R5 20650 - 0x1C140805, // 0016 EQ R5 R4 R5 - 0x78160008, // 0017 JMPF R5 #0021 - 0xB8160A00, // 0018 GETNGBL R5 K5 - 0x8C140B06, // 0019 GETMET R5 R5 K6 - 0x5C1C0600, // 001A MOVE R7 R3 - 0x7C140400, // 001B CALL R5 2 - 0x88180107, // 001C GETMBR R6 R0 K7 - 0x8C180D08, // 001D GETMET R6 R6 K8 - 0x5C200A00, // 001E MOVE R8 R5 - 0x7C180400, // 001F CALL R6 2 - 0x70020010, // 0020 JMP #0032 - 0x5416EBEA, // 0021 LDINT R5 60395 - 0x1C140805, // 0022 EQ R5 R4 R5 - 0x7816000C, // 0023 JMPF R5 #0031 - 0x5416001F, // 0024 LDINT R5 32 - 0x08140405, // 0025 MUL R5 R2 R5 - 0x541A000F, // 0026 LDINT R6 16 - 0x00140A06, // 0027 ADD R5 R5 R6 - 0x541A0020, // 0028 LDINT R6 33 - 0x08180406, // 0029 MUL R6 R2 R6 - 0x04180D02, // 002A SUB R6 R6 K2 - 0x40140A06, // 002B CONNECT R5 R5 R6 - 0x88180101, // 002C GETMBR R6 R0 K1 - 0x94140C05, // 002D GETIDX R5 R6 R5 - 0x90021205, // 002E SETMBR R0 K9 R5 - 0x70020002, // 002F JMP #0033 - 0x70020000, // 0030 JMP #0032 - 0x70020000, // 0031 JMP #0033 - 0x7001FFD1, // 0032 JMP #0005 - 0xA8040001, // 0033 EXBLK 1 1 - 0x70020002, // 0034 JMP #0038 - 0x5804000A, // 0035 LDCONST R1 K10 - 0xAC040200, // 0036 CATCH R1 1 0 - 0xB0080000, // 0037 RAISE 2 R0 R0 - 0x80000000, // 0038 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: load -********************************************************************/ -be_local_closure(Partition_load, /* name */ - be_nested_proto( - 6, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 3]) { /* constants */ - /* K0 */ be_nested_str(flash), - /* K1 */ be_nested_str(raw), - /* K2 */ be_nested_str(read), - }), - &be_const_str_load, - &be_const_str_solidified, - ( &(const binstruction[ 7]) { /* code */ - 0xA4060000, // 0000 IMPORT R1 K0 - 0x8C080302, // 0001 GETMET R2 R1 K2 - 0x54127FFF, // 0002 LDINT R4 32768 - 0x54160FFF, // 0003 LDINT R5 4096 - 0x7C080600, // 0004 CALL R2 3 - 0x90020202, // 0005 SETMBR R0 K1 R2 - 0x80000000, // 0006 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: get_factory_slot -********************************************************************/ -be_local_closure(Partition_get_factory_slot, /* name */ - be_nested_proto( - 5, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 3]) { /* constants */ - /* K0 */ be_nested_str(slots), - /* K1 */ be_nested_str(is_factory), - /* K2 */ be_nested_str(stop_iteration), - }), - &be_const_str_get_factory_slot, - &be_const_str_solidified, - ( &(const binstruction[16]) { /* code */ - 0x60040010, // 0000 GETGBL R1 G16 - 0x88080100, // 0001 GETMBR R2 R0 K0 - 0x7C040200, // 0002 CALL R1 1 - 0xA8020007, // 0003 EXBLK 0 #000C - 0x5C080200, // 0004 MOVE R2 R1 - 0x7C080000, // 0005 CALL R2 0 - 0x8C0C0501, // 0006 GETMET R3 R2 K1 - 0x7C0C0200, // 0007 CALL R3 1 - 0x780E0001, // 0008 JMPF R3 #000B - 0xA8040001, // 0009 EXBLK 1 1 - 0x80040400, // 000A RET 1 R2 - 0x7001FFF7, // 000B JMP #0004 - 0x58040002, // 000C LDCONST R1 K2 - 0xAC040200, // 000D CATCH R1 1 0 - 0xB0080000, // 000E RAISE 2 R0 R0 - 0x80000000, // 000F RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: init -********************************************************************/ -be_local_closure(Partition_init, /* name */ - be_nested_proto( - 3, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 4]) { /* constants */ - /* K0 */ be_nested_str(slots), - /* K1 */ be_nested_str(load), - /* K2 */ be_nested_str(parse), - /* K3 */ be_nested_str(load_otadata), - }), - &be_const_str_init, - &be_const_str_solidified, - ( &(const binstruction[10]) { /* code */ - 0x60040012, // 0000 GETGBL R1 G18 - 0x7C040000, // 0001 CALL R1 0 - 0x90020001, // 0002 SETMBR R0 K0 R1 - 0x8C040101, // 0003 GETMET R1 R0 K1 - 0x7C040200, // 0004 CALL R1 1 - 0x8C040102, // 0005 GETMET R1 R0 K2 - 0x7C040200, // 0006 CALL R1 1 - 0x8C040103, // 0007 GETMET R1 R0 K3 - 0x7C040200, // 0008 CALL R1 1 - 0x80000000, // 0009 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: set_active -********************************************************************/ -be_local_closure(Partition_set_active, /* name */ - be_nested_proto( - 6, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 7]) { /* constants */ - /* K0 */ be_const_int(0), - /* K1 */ be_nested_str(ota_max), - /* K2 */ be_nested_str(value_error), - /* K3 */ be_nested_str(Invalid_X20ota_X20partition_X20number), - /* K4 */ be_nested_str(otadata), - /* K5 */ be_nested_str(set_ota_max), - /* K6 */ be_nested_str(set_active), - }), - &be_const_str_set_active, - &be_const_str_solidified, - ( &(const binstruction[17]) { /* code */ - 0x14080300, // 0000 LT R2 R1 K0 - 0x740A0003, // 0001 JMPT R2 #0006 - 0x8C080101, // 0002 GETMET R2 R0 K1 - 0x7C080200, // 0003 CALL R2 1 - 0x24080202, // 0004 GT R2 R1 R2 - 0x780A0000, // 0005 JMPF R2 #0007 - 0xB0060503, // 0006 RAISE 1 K2 K3 - 0x88080104, // 0007 GETMBR R2 R0 K4 - 0x8C080505, // 0008 GETMET R2 R2 K5 - 0x8C100101, // 0009 GETMET R4 R0 K1 - 0x7C100200, // 000A CALL R4 1 - 0x7C080400, // 000B CALL R2 2 - 0x88080104, // 000C GETMBR R2 R0 K4 - 0x8C080506, // 000D GETMET R2 R2 K6 - 0x5C100200, // 000E MOVE R4 R1 - 0x7C080400, // 000F CALL R2 2 - 0x80000000, // 0010 RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: get_active -********************************************************************/ -be_local_closure(Partition_get_active, /* name */ - be_nested_proto( - 2, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 2]) { /* constants */ - /* K0 */ be_nested_str(otadata), - /* K1 */ be_nested_str(active_otadata), - }), - &be_const_str_get_active, - &be_const_str_solidified, - ( &(const binstruction[ 3]) { /* code */ - 0x88040100, // 0000 GETMBR R1 R0 K0 - 0x88040301, // 0001 GETMBR R1 R1 K1 - 0x80040200, // 0002 RET 1 R1 - }) - ) -); -/*******************************************************************/ - - /******************************************************************** ** Solidified function: ota_max ********************************************************************/ @@ -1372,54 +1385,9 @@ be_local_closure(Partition_ota_max, /* name */ /******************************************************************** -** Solidified function: save +** Solidified function: invalidate_spiffs ********************************************************************/ -be_local_closure(Partition_save, /* name */ - be_nested_proto( - 7, /* nstack */ - 1, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 6]) { /* constants */ - /* K0 */ be_nested_str(flash), - /* K1 */ be_nested_str(tobytes), - /* K2 */ be_nested_str(erase), - /* K3 */ be_nested_str(write), - /* K4 */ be_nested_str(otadata), - /* K5 */ be_nested_str(save), - }), - &be_const_str_save, - &be_const_str_solidified, - ( &(const binstruction[15]) { /* code */ - 0xA4060000, // 0000 IMPORT R1 K0 - 0x8C080101, // 0001 GETMET R2 R0 K1 - 0x7C080200, // 0002 CALL R2 1 - 0x8C0C0302, // 0003 GETMET R3 R1 K2 - 0x54167FFF, // 0004 LDINT R5 32768 - 0x541A0FFF, // 0005 LDINT R6 4096 - 0x7C0C0600, // 0006 CALL R3 3 - 0x8C0C0303, // 0007 GETMET R3 R1 K3 - 0x54167FFF, // 0008 LDINT R5 32768 - 0x5C180400, // 0009 MOVE R6 R2 - 0x7C0C0600, // 000A CALL R3 3 - 0x880C0104, // 000B GETMBR R3 R0 K4 - 0x8C0C0705, // 000C GETMET R3 R3 K5 - 0x7C0C0200, // 000D CALL R3 1 - 0x80000000, // 000E RET 0 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: load_otadata -********************************************************************/ -be_local_closure(Partition_load_otadata, /* name */ +be_local_closure(Partition_invalidate_spiffs, /* name */ be_nested_proto( 8, /* nstack */ 1, /* argc */ @@ -1429,52 +1397,41 @@ be_local_closure(Partition_load_otadata, /* name */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[12]) { /* constants */ - /* K0 */ be_nested_str(ota_max), + ( &(const bvalue[ 8]) { /* constants */ + /* K0 */ be_nested_str(flash), /* K1 */ be_nested_str(slots), - /* K2 */ be_nested_str(type), - /* K3 */ be_const_int(1), - /* K4 */ be_nested_str(subtype), - /* K5 */ be_const_int(0), - /* K6 */ be_nested_str(start), - /* K7 */ be_nested_str(stop_iteration), - /* K8 */ be_nested_str(otadata), - /* K9 */ be_nested_str(partition_core), - /* K10 */ be_nested_str(Partition_otadata), - /* K11 */ be_nested_str(has_factory), + /* K2 */ be_nested_str(is_spiffs), + /* K3 */ be_nested_str(value_error), + /* K4 */ be_nested_str(No_X20FS_X20partition_X20found), + /* K5 */ be_nested_str(00), + /* K6 */ be_nested_str(write), + /* K7 */ be_nested_str(start), }), - &be_const_str_load_otadata, + &be_const_str_invalidate_spiffs, &be_const_str_solidified, - ( &(const binstruction[29]) { /* code */ - 0x5406DFFF, // 0000 LDINT R1 57344 - 0x8C080100, // 0001 GETMET R2 R0 K0 - 0x7C080200, // 0002 CALL R2 1 - 0x600C0010, // 0003 GETGBL R3 G16 - 0x88100101, // 0004 GETMBR R4 R0 K1 + ( &(const binstruction[22]) { /* code */ + 0xA4060000, // 0000 IMPORT R1 K0 + 0x88080101, // 0001 GETMBR R2 R0 K1 + 0x540DFFFE, // 0002 LDINT R3 -1 + 0x94080403, // 0003 GETIDX R2 R2 R3 + 0x8C0C0502, // 0004 GETMET R3 R2 K2 0x7C0C0200, // 0005 CALL R3 1 - 0xA8020009, // 0006 EXBLK 0 #0011 - 0x5C100600, // 0007 MOVE R4 R3 - 0x7C100000, // 0008 CALL R4 0 - 0x88140902, // 0009 GETMBR R5 R4 K2 - 0x1C140B03, // 000A EQ R5 R5 K3 - 0x78160003, // 000B JMPF R5 #0010 - 0x88140904, // 000C GETMBR R5 R4 K4 - 0x1C140B05, // 000D EQ R5 R5 K5 - 0x78160000, // 000E JMPF R5 #0010 - 0x88040906, // 000F GETMBR R1 R4 K6 - 0x7001FFF5, // 0010 JMP #0007 - 0x580C0007, // 0011 LDCONST R3 K7 - 0xAC0C0200, // 0012 CATCH R3 1 0 - 0xB0080000, // 0013 RAISE 2 R0 R0 - 0xB80E1200, // 0014 GETNGBL R3 K9 - 0x8C0C070A, // 0015 GETMET R3 R3 K10 - 0x5C140400, // 0016 MOVE R5 R2 - 0x8C18010B, // 0017 GETMET R6 R0 K11 - 0x7C180200, // 0018 CALL R6 1 - 0x5C1C0200, // 0019 MOVE R7 R1 - 0x7C0C0800, // 001A CALL R3 4 - 0x90021003, // 001B SETMBR R0 K8 R3 - 0x80000000, // 001C RET 0 + 0x740E0000, // 0006 JMPT R3 #0008 + 0xB0060704, // 0007 RAISE 1 K3 K4 + 0x600C0015, // 0008 GETGBL R3 G21 + 0x58100005, // 0009 LDCONST R4 K5 + 0x7C0C0200, // 000A CALL R3 1 + 0x8C100306, // 000B GETMET R4 R1 K6 + 0x88180507, // 000C GETMBR R6 R2 K7 + 0x5C1C0600, // 000D MOVE R7 R3 + 0x7C100600, // 000E CALL R4 3 + 0x8C100306, // 000F GETMET R4 R1 K6 + 0x88180507, // 0010 GETMBR R6 R2 K7 + 0x541E0FFF, // 0011 LDINT R7 4096 + 0x00180C07, // 0012 ADD R6 R6 R7 + 0x5C1C0600, // 0013 MOVE R7 R3 + 0x7C100600, // 0014 CALL R4 3 + 0x80000000, // 0015 RET 0 }) ) ); @@ -1482,56 +1439,42 @@ be_local_closure(Partition_load_otadata, /* name */ /******************************************************************** -** Solidified function: get_flash_definition_sector +** Solidified function: get_factory_slot ********************************************************************/ -be_local_closure(Partition_get_flash_definition_sector, /* name */ +be_local_closure(Partition_get_factory_slot, /* name */ be_nested_proto( - 9, /* nstack */ - 0, /* argc */ - 4, /* varg */ + 5, /* nstack */ + 1, /* argc */ + 2, /* varg */ 0, /* has upvals */ NULL, /* no upvals */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[ 7]) { /* constants */ - /* K0 */ be_const_class(be_class_Partition), - /* K1 */ be_nested_str(flash), - /* K2 */ be_const_int(0), - /* K3 */ be_const_int(1), - /* K4 */ be_nested_str(read), - /* K5 */ be_nested_str(E9), - /* K6 */ be_nested_str(stop_iteration), + ( &(const bvalue[ 3]) { /* constants */ + /* K0 */ be_nested_str(slots), + /* K1 */ be_nested_str(is_factory), + /* K2 */ be_nested_str(stop_iteration), }), - &be_const_str_get_flash_definition_sector, + &be_const_str_get_factory_slot, &be_const_str_solidified, - ( &(const binstruction[26]) { /* code */ - 0x58000000, // 0000 LDCONST R0 K0 - 0xA4060200, // 0001 IMPORT R1 K1 - 0x60080010, // 0002 GETGBL R2 G16 - 0x400E0503, // 0003 CONNECT R3 K2 K3 - 0x7C080200, // 0004 CALL R2 1 - 0xA802000F, // 0005 EXBLK 0 #0016 - 0x5C0C0400, // 0006 MOVE R3 R2 - 0x7C0C0000, // 0007 CALL R3 0 - 0x54120FFF, // 0008 LDINT R4 4096 - 0x08100604, // 0009 MUL R4 R3 R4 - 0x8C140304, // 000A GETMET R5 R1 K4 - 0x5C1C0800, // 000B MOVE R7 R4 - 0x58200003, // 000C LDCONST R8 K3 - 0x7C140600, // 000D CALL R5 3 - 0x60180015, // 000E GETGBL R6 G21 - 0x581C0005, // 000F LDCONST R7 K5 - 0x7C180200, // 0010 CALL R6 1 - 0x1C140A06, // 0011 EQ R5 R5 R6 - 0x78160001, // 0012 JMPF R5 #0015 - 0xA8040001, // 0013 EXBLK 1 1 - 0x80040800, // 0014 RET 1 R4 - 0x7001FFEF, // 0015 JMP #0006 - 0x58080006, // 0016 LDCONST R2 K6 - 0xAC080200, // 0017 CATCH R2 1 0 - 0xB0080000, // 0018 RAISE 2 R0 R0 - 0x80000000, // 0019 RET 0 + ( &(const binstruction[16]) { /* code */ + 0x60040010, // 0000 GETGBL R1 G16 + 0x88080100, // 0001 GETMBR R2 R0 K0 + 0x7C040200, // 0002 CALL R1 1 + 0xA8020007, // 0003 EXBLK 0 #000C + 0x5C080200, // 0004 MOVE R2 R1 + 0x7C080000, // 0005 CALL R2 0 + 0x8C0C0501, // 0006 GETMET R3 R2 K1 + 0x7C0C0200, // 0007 CALL R3 1 + 0x780E0001, // 0008 JMPF R3 #000B + 0xA8040001, // 0009 EXBLK 1 1 + 0x80040400, // 000A RET 1 R2 + 0x7001FFF7, // 000B JMP #0004 + 0x58040002, // 000C LDCONST R1 K2 + 0xAC040200, // 000D CATCH R1 1 0 + 0xB0080000, // 000E RAISE 2 R0 R0 + 0x80000000, // 000F RET 0 }) ) ); @@ -1539,9 +1482,9 @@ be_local_closure(Partition_get_flash_definition_sector, /* name */ /******************************************************************** -** Solidified function: switch_factory +** Solidified function: set_active ********************************************************************/ -be_local_closure(Partition_switch_factory, /* name */ +be_local_closure(Partition_set_active, /* name */ be_nested_proto( 6, /* nstack */ 2, /* argc */ @@ -1551,18 +1494,128 @@ be_local_closure(Partition_switch_factory, /* name */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[ 2]) { /* constants */ - /* K0 */ be_nested_str(flash), - /* K1 */ be_nested_str(factory), + ( &(const bvalue[ 7]) { /* constants */ + /* K0 */ be_const_int(0), + /* K1 */ be_nested_str(ota_max), + /* K2 */ be_nested_str(value_error), + /* K3 */ be_nested_str(Invalid_X20ota_X20partition_X20number), + /* K4 */ be_nested_str(otadata), + /* K5 */ be_nested_str(set_ota_max), + /* K6 */ be_nested_str(set_active), }), - &be_const_str_switch_factory, + &be_const_str_set_active, &be_const_str_solidified, - ( &(const binstruction[ 5]) { /* code */ - 0xA40A0000, // 0000 IMPORT R2 K0 - 0x8C0C0501, // 0001 GETMET R3 R2 K1 - 0x5C140200, // 0002 MOVE R5 R1 - 0x7C0C0400, // 0003 CALL R3 2 - 0x80000000, // 0004 RET 0 + ( &(const binstruction[17]) { /* code */ + 0x14080300, // 0000 LT R2 R1 K0 + 0x740A0003, // 0001 JMPT R2 #0006 + 0x8C080101, // 0002 GETMET R2 R0 K1 + 0x7C080200, // 0003 CALL R2 1 + 0x24080202, // 0004 GT R2 R1 R2 + 0x780A0000, // 0005 JMPF R2 #0007 + 0xB0060503, // 0006 RAISE 1 K2 K3 + 0x88080104, // 0007 GETMBR R2 R0 K4 + 0x8C080505, // 0008 GETMET R2 R2 K5 + 0x8C100101, // 0009 GETMET R4 R0 K1 + 0x7C100200, // 000A CALL R4 1 + 0x7C080400, // 000B CALL R2 2 + 0x88080104, // 000C GETMBR R2 R0 K4 + 0x8C080506, // 000D GETMET R2 R2 K6 + 0x5C100200, // 000E MOVE R4 R1 + 0x7C080400, // 000F CALL R2 2 + 0x80000000, // 0010 RET 0 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: get_unallocated_k +********************************************************************/ +be_local_closure(Partition_get_unallocated_k, /* name */ + be_nested_proto( + 5, /* nstack */ + 1, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 6]) { /* constants */ + /* K0 */ be_nested_str(slots), + /* K1 */ be_nested_str(is_spiffs), + /* K2 */ be_nested_str(get_max_flash_size_k), + /* K3 */ be_nested_str(start), + /* K4 */ be_nested_str(sz), + /* K5 */ be_const_int(0), + }), + &be_const_str_get_unallocated_k, + &be_const_str_solidified, + ( &(const binstruction[18]) { /* code */ + 0x88040100, // 0000 GETMBR R1 R0 K0 + 0x5409FFFE, // 0001 LDINT R2 -1 + 0x94040202, // 0002 GETIDX R1 R1 R2 + 0x8C080301, // 0003 GETMET R2 R1 K1 + 0x7C080200, // 0004 CALL R2 1 + 0x780A000A, // 0005 JMPF R2 #0011 + 0x8C080102, // 0006 GETMET R2 R0 K2 + 0x7C080200, // 0007 CALL R2 1 + 0x880C0303, // 0008 GETMBR R3 R1 K3 + 0x88100304, // 0009 GETMBR R4 R1 K4 + 0x000C0604, // 000A ADD R3 R3 R4 + 0x541203FF, // 000B LDINT R4 1024 + 0x0C0C0604, // 000C DIV R3 R3 R4 + 0x14100602, // 000D LT R4 R3 R2 + 0x78120001, // 000E JMPF R4 #0011 + 0x04100403, // 000F SUB R4 R2 R3 + 0x80040800, // 0010 RET 1 R4 + 0x80060A00, // 0011 RET 1 K5 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: get_ota_slot +********************************************************************/ +be_local_closure(Partition_get_ota_slot, /* name */ + be_nested_proto( + 6, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 3]) { /* constants */ + /* K0 */ be_nested_str(slots), + /* K1 */ be_nested_str(is_ota), + /* K2 */ be_nested_str(stop_iteration), + }), + &be_const_str_get_ota_slot, + &be_const_str_solidified, + ( &(const binstruction[18]) { /* code */ + 0x60080010, // 0000 GETGBL R2 G16 + 0x880C0100, // 0001 GETMBR R3 R0 K0 + 0x7C080200, // 0002 CALL R2 1 + 0xA8020008, // 0003 EXBLK 0 #000D + 0x5C0C0400, // 0004 MOVE R3 R2 + 0x7C0C0000, // 0005 CALL R3 0 + 0x8C100701, // 0006 GETMET R4 R3 K1 + 0x7C100200, // 0007 CALL R4 1 + 0x1C100801, // 0008 EQ R4 R4 R1 + 0x78120001, // 0009 JMPF R4 #000C + 0xA8040001, // 000A EXBLK 1 1 + 0x80040600, // 000B RET 1 R3 + 0x7001FFF6, // 000C JMP #0004 + 0x58080002, // 000D LDCONST R2 K2 + 0xAC080200, // 000E CATCH R2 1 0 + 0xB0080000, // 000F RAISE 2 R0 R0 + 0x4C080000, // 0010 LDNIL R2 + 0x80040400, // 0011 RET 1 R2 }) ) ); @@ -1575,31 +1628,32 @@ be_local_closure(Partition_switch_factory, /* name */ be_local_class(Partition, 4, NULL, - be_nested_map(23, + be_nested_map(24, ( (struct bmapnode*) &(const bmapnode[]) { - { be_const_key(resize_max_flash_size_k, -1), be_const_closure(Partition_resize_max_flash_size_k_closure) }, - { be_const_key(switch_factory, 21), be_const_closure(Partition_switch_factory_closure) }, - { be_const_key(get_flash_definition_sector, 5), be_const_static_closure(Partition_get_flash_definition_sector_closure) }, - { be_const_key(load, 22), be_const_closure(Partition_load_closure) }, - { be_const_key(has_factory, -1), be_const_closure(Partition_has_factory_closure) }, - { be_const_key(slots, -1), be_const_var(2) }, - { be_const_key(raw, -1), be_const_var(0) }, - { be_const_key(set_active, -1), be_const_closure(Partition_set_active_closure) }, - { be_const_key(get_ota_slot, -1), be_const_closure(Partition_get_ota_slot_closure) }, - { be_const_key(tostring, -1), be_const_closure(Partition_tostring_closure) }, - { be_const_key(tobytes, 1), be_const_closure(Partition_tobytes_closure) }, - { be_const_key(get_unallocated_k, 3), be_const_closure(Partition_get_unallocated_k_closure) }, - { be_const_key(otadata, -1), be_const_var(3) }, - { be_const_key(md5, 2), be_const_var(1) }, - { be_const_key(init, 7), be_const_closure(Partition_init_closure) }, - { be_const_key(get_active, -1), be_const_closure(Partition_get_active_closure) }, - { be_const_key(get_factory_slot, 15), be_const_closure(Partition_get_factory_slot_closure) }, - { be_const_key(get_max_flash_size_k, 12), be_const_closure(Partition_get_max_flash_size_k_closure) }, - { be_const_key(ota_max, -1), be_const_closure(Partition_ota_max_closure) }, { be_const_key(save, -1), be_const_closure(Partition_save_closure) }, - { be_const_key(load_otadata, -1), be_const_closure(Partition_load_otadata_closure) }, - { be_const_key(parse, -1), be_const_closure(Partition_parse_closure) }, + { be_const_key(load, 8), be_const_closure(Partition_load_closure) }, + { be_const_key(get_active, -1), be_const_closure(Partition_get_active_closure) }, + { be_const_key(init, -1), be_const_closure(Partition_init_closure) }, + { be_const_key(parse, 21), be_const_closure(Partition_parse_closure) }, + { be_const_key(otadata, -1), be_const_var(3) }, + { be_const_key(slots, 11), be_const_var(2) }, + { be_const_key(get_ota_slot, -1), be_const_closure(Partition_get_ota_slot_closure) }, + { be_const_key(resize_max_flash_size_k, -1), be_const_closure(Partition_resize_max_flash_size_k_closure) }, + { be_const_key(get_flash_definition_sector, -1), be_const_static_closure(Partition_get_flash_definition_sector_closure) }, { be_const_key(resize_fs_to_max, -1), be_const_closure(Partition_resize_fs_to_max_closure) }, + { be_const_key(set_active, -1), be_const_closure(Partition_set_active_closure) }, + { be_const_key(get_factory_slot, -1), be_const_closure(Partition_get_factory_slot_closure) }, + { be_const_key(tostring, -1), be_const_closure(Partition_tostring_closure) }, + { be_const_key(invalidate_spiffs, -1), be_const_closure(Partition_invalidate_spiffs_closure) }, + { be_const_key(tobytes, 12), be_const_closure(Partition_tobytes_closure) }, + { be_const_key(load_otadata, 20), be_const_closure(Partition_load_otadata_closure) }, + { be_const_key(raw, -1), be_const_var(0) }, + { be_const_key(has_factory, 14), be_const_closure(Partition_has_factory_closure) }, + { be_const_key(md5, -1), be_const_var(1) }, + { be_const_key(ota_max, -1), be_const_closure(Partition_ota_max_closure) }, + { be_const_key(switch_factory, -1), be_const_closure(Partition_switch_factory_closure) }, + { be_const_key(get_unallocated_k, -1), be_const_closure(Partition_get_unallocated_k_closure) }, + { be_const_key(get_max_flash_size_k, 7), be_const_closure(Partition_get_max_flash_size_k_closure) }, })), (bstring*) &be_const_str_Partition ); diff --git a/lib/libesp32/berry_tasmota/src/solidify/solidified_rule_matcher.h b/lib/libesp32/berry_tasmota/src/solidify/solidified_rule_matcher.h index ced3ca45e..81f51d586 100644 --- a/lib/libesp32/berry_tasmota/src/solidify/solidified_rule_matcher.h +++ b/lib/libesp32/berry_tasmota/src/solidify/solidified_rule_matcher.h @@ -1372,8 +1372,8 @@ be_local_closure(Rule_Matcher_parse, /* name */ 0x0434170A, // 0049 SUB R13 R11 K10 0x4034120D, // 004A CONNECT R13 R9 R13 0x94300A0D, // 004B GETIDX R12 R5 R13 - 0x0038170A, // 004C ADD R14 R11 K10 - 0x5C241C00, // 004D MOVE R9 R14 + 0x0034170A, // 004C ADD R13 R11 K10 + 0x5C241A00, // 004D MOVE R9 R13 0x70020002, // 004E JMP #0052 0x40341310, // 004F CONNECT R13 R9 K16 0x94300A0D, // 0050 GETIDX R12 R5 R13 @@ -1400,10 +1400,10 @@ be_local_closure(Rule_Matcher_parse, /* name */ 0x04441B0A, // 0065 SUB R17 R13 K10 0x40461211, // 0066 CONNECT R17 K9 R17 0x94301811, // 0067 GETIDX R12 R12 R17 - 0x60480009, // 0068 GETGBL R18 G9 - 0x5C4C2000, // 0069 MOVE R19 R16 - 0x7C480200, // 006A CALL R18 1 - 0x5C382400, // 006B MOVE R14 R18 + 0x60440009, // 0068 GETGBL R17 G9 + 0x5C482000, // 0069 MOVE R18 R16 + 0x7C440200, // 006A CALL R17 1 + 0x5C382200, // 006B MOVE R14 R17 0x1C3C1915, // 006C EQ R15 R12 K21 0x783E0004, // 006D JMPF R15 #0073 0x8C3C0703, // 006E GETMET R15 R3 K3 diff --git a/lib/libesp32/berry_tasmota/src/solidify/solidified_tasmota_class.h b/lib/libesp32/berry_tasmota/src/solidify/solidified_tasmota_class.h index 1488c004f..6e545efad 100644 --- a/lib/libesp32/berry_tasmota/src/solidify/solidified_tasmota_class.h +++ b/lib/libesp32/berry_tasmota/src/solidify/solidified_tasmota_class.h @@ -1803,20 +1803,25 @@ be_local_closure(Tasmota_load, /* name */ 8, /* nstack */ 1, /* argc */ 0, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ + 1, /* has upvals */ + ( &(const bupvaldesc[ 1]) { /* upvals */ + be_local_const_upval(1, 0), + }), 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[ 1]) { /* constants */ + ( &(const bvalue[ 4]) { /* constants */ /* K0 */ be_nested_str(BRY_X3A_X20failed_X20to_X20run_X20compiled_X20code_X20_X27_X25s_X27_X20_X2D_X20_X25s), + /* K1 */ be_nested_str(_debug_present), + /* K2 */ be_nested_str(debug), + /* K3 */ be_nested_str(traceback), }), &be_const_str_try_run_compiled, &be_const_str_solidified, - ( &(const binstruction[24]) { /* code */ + ( &(const binstruction[30]) { /* code */ 0x4C040000, // 0000 LDNIL R1 0x20040001, // 0001 NE R1 R0 R1 - 0x78060012, // 0002 JMPF R1 #0016 + 0x78060018, // 0002 JMPF R1 #001C 0xA8020006, // 0003 EXBLK 0 #000B 0x5C040000, // 0004 MOVE R1 R0 0x7C040000, // 0005 CALL R1 0 @@ -1824,9 +1829,9 @@ be_local_closure(Tasmota_load, /* name */ 0xA8040001, // 0007 EXBLK 1 1 0x80040200, // 0008 RET 1 R1 0xA8040001, // 0009 EXBLK 1 1 - 0x7002000A, // 000A JMP #0016 + 0x70020010, // 000A JMP #001C 0xAC040002, // 000B CATCH R1 0 2 - 0x70020007, // 000C JMP #0015 + 0x7002000D, // 000C JMP #001B 0x600C0001, // 000D GETGBL R3 G1 0x60100018, // 000E GETGBL R4 G24 0x58140000, // 000F LDCONST R5 K0 @@ -1834,10 +1839,16 @@ be_local_closure(Tasmota_load, /* name */ 0x5C1C0400, // 0011 MOVE R7 R2 0x7C100600, // 0012 CALL R4 3 0x7C0C0200, // 0013 CALL R3 1 - 0x70020000, // 0014 JMP #0016 - 0xB0080000, // 0015 RAISE 2 R0 R0 - 0x50040000, // 0016 LDBOOL R1 0 0 - 0x80040200, // 0017 RET 1 R1 + 0x680C0000, // 0014 GETUPV R3 U0 + 0x880C0701, // 0015 GETMBR R3 R3 K1 + 0x780E0002, // 0016 JMPF R3 #001A + 0xA40E0400, // 0017 IMPORT R3 K2 + 0x8C100703, // 0018 GETMET R4 R3 K3 + 0x7C100200, // 0019 CALL R4 1 + 0x70020000, // 001A JMP #001C + 0xB0080000, // 001B RAISE 2 R0 R0 + 0x50040000, // 001C LDBOOL R1 0 0 + 0x80040200, // 001D RET 1 R1 }) ), }), @@ -1867,7 +1878,7 @@ be_local_closure(Tasmota_load, /* name */ }), &be_const_str_load, &be_const_str_solidified, - ( &(const binstruction[176]) { /* code */ + ( &(const binstruction[180]) { /* code */ 0x84080000, // 0000 CLOSURE R2 P0 0x840C0001, // 0001 CLOSURE R3 P1 0x84100002, // 0002 CLOSURE R4 P2 @@ -1880,170 +1891,174 @@ be_local_closure(Tasmota_load, /* name */ 0x5C2C0200, // 0009 MOVE R11 R1 0x7C280200, // 000A CALL R10 1 0x1C281502, // 000B EQ R10 R10 K2 - 0x782A0001, // 000C JMPF R10 #000F + 0x782A0002, // 000C JMPF R10 #0010 0x50280000, // 000D LDBOOL R10 0 0 - 0x80041400, // 000E RET 1 R10 - 0x94280302, // 000F GETIDX R10 R1 K2 - 0x20281503, // 0010 NE R10 R10 K3 - 0x782A0000, // 0011 JMPF R10 #0013 - 0x00060601, // 0012 ADD R1 K3 R1 - 0x8C281104, // 0013 GETMET R10 R8 K4 - 0x5C300200, // 0014 MOVE R12 R1 - 0x58340005, // 0015 LDCONST R13 K5 - 0x7C280600, // 0016 CALL R10 3 - 0x942C1502, // 0017 GETIDX R11 R10 K2 - 0x5431FFFE, // 0018 LDINT R12 -1 - 0x9430140C, // 0019 GETIDX R12 R10 R12 - 0x6034000C, // 001A GETGBL R13 G12 - 0x5C381400, // 001B MOVE R14 R10 - 0x7C340200, // 001C CALL R13 1 - 0x24341B06, // 001D GT R13 R13 K6 - 0x8C381107, // 001E GETMET R14 R8 K7 - 0x5C401800, // 001F MOVE R16 R12 - 0x58440008, // 0020 LDCONST R17 K8 - 0x7C380600, // 0021 CALL R14 3 - 0x14381D02, // 0022 LT R14 R14 K2 - 0x783A0001, // 0023 JMPF R14 #0026 - 0x00040309, // 0024 ADD R1 R1 K9 - 0x00301909, // 0025 ADD R12 R12 K9 - 0x5439FFFC, // 0026 LDINT R14 -3 - 0x543DFFFE, // 0027 LDINT R15 -1 - 0x40381C0F, // 0028 CONNECT R14 R14 R15 - 0x9438180E, // 0029 GETIDX R14 R12 R14 - 0x1C381D09, // 002A EQ R14 R14 K9 - 0x543DFFFB, // 002B LDINT R15 -4 - 0x5441FFFE, // 002C LDINT R16 -1 - 0x403C1E10, // 002D CONNECT R15 R15 R16 - 0x943C180F, // 002E GETIDX R15 R12 R15 - 0x1C3C1F0A, // 002F EQ R15 R15 K10 - 0x5C401C00, // 0030 MOVE R16 R14 - 0x74420002, // 0031 JMPT R16 #0035 - 0x5C401E00, // 0032 MOVE R16 R15 - 0x74420000, // 0033 JMPT R16 #0035 - 0xB006170C, // 0034 RAISE 1 K11 K12 - 0x8C40130D, // 0035 GETMET R16 R9 K13 - 0x5C480200, // 0036 MOVE R18 R1 - 0x7C400400, // 0037 CALL R16 2 - 0x783E0001, // 0038 JMPF R15 #003B - 0x5C440200, // 0039 MOVE R17 R1 - 0x70020000, // 003A JMP #003C - 0x0044030E, // 003B ADD R17 R1 K14 - 0x783E0005, // 003C JMPF R15 #0043 - 0x4C480000, // 003D LDNIL R18 - 0x1C482012, // 003E EQ R18 R16 R18 - 0x784A0001, // 003F JMPF R18 #0042 - 0x50480000, // 0040 LDBOOL R18 0 0 - 0x80042400, // 0041 RET 1 R18 - 0x70020013, // 0042 JMP #0057 - 0x8C48130D, // 0043 GETMET R18 R9 K13 - 0x5C502200, // 0044 MOVE R20 R17 - 0x7C480400, // 0045 CALL R18 2 - 0x4C4C0000, // 0046 LDNIL R19 - 0x1C4C2013, // 0047 EQ R19 R16 R19 - 0x784E0004, // 0048 JMPF R19 #004E - 0x4C4C0000, // 0049 LDNIL R19 - 0x1C4C2413, // 004A EQ R19 R18 R19 - 0x784E0001, // 004B JMPF R19 #004E - 0x504C0000, // 004C LDBOOL R19 0 0 - 0x80042600, // 004D RET 1 R19 - 0x4C4C0000, // 004E LDNIL R19 - 0x204C2413, // 004F NE R19 R18 R19 - 0x784E0005, // 0050 JMPF R19 #0057 + 0xA0000000, // 000E CLOSE R0 + 0x80041400, // 000F RET 1 R10 + 0x94280302, // 0010 GETIDX R10 R1 K2 + 0x20281503, // 0011 NE R10 R10 K3 + 0x782A0000, // 0012 JMPF R10 #0014 + 0x00060601, // 0013 ADD R1 K3 R1 + 0x8C281104, // 0014 GETMET R10 R8 K4 + 0x5C300200, // 0015 MOVE R12 R1 + 0x58340005, // 0016 LDCONST R13 K5 + 0x7C280600, // 0017 CALL R10 3 + 0x942C1502, // 0018 GETIDX R11 R10 K2 + 0x5431FFFE, // 0019 LDINT R12 -1 + 0x9430140C, // 001A GETIDX R12 R10 R12 + 0x6034000C, // 001B GETGBL R13 G12 + 0x5C381400, // 001C MOVE R14 R10 + 0x7C340200, // 001D CALL R13 1 + 0x24341B06, // 001E GT R13 R13 K6 + 0x8C381107, // 001F GETMET R14 R8 K7 + 0x5C401800, // 0020 MOVE R16 R12 + 0x58440008, // 0021 LDCONST R17 K8 + 0x7C380600, // 0022 CALL R14 3 + 0x14381D02, // 0023 LT R14 R14 K2 + 0x783A0001, // 0024 JMPF R14 #0027 + 0x00040309, // 0025 ADD R1 R1 K9 + 0x00301909, // 0026 ADD R12 R12 K9 + 0x5439FFFC, // 0027 LDINT R14 -3 + 0x543DFFFE, // 0028 LDINT R15 -1 + 0x40381C0F, // 0029 CONNECT R14 R14 R15 + 0x9438180E, // 002A GETIDX R14 R12 R14 + 0x1C381D09, // 002B EQ R14 R14 K9 + 0x543DFFFB, // 002C LDINT R15 -4 + 0x5441FFFE, // 002D LDINT R16 -1 + 0x403C1E10, // 002E CONNECT R15 R15 R16 + 0x943C180F, // 002F GETIDX R15 R12 R15 + 0x1C3C1F0A, // 0030 EQ R15 R15 K10 + 0x5C401C00, // 0031 MOVE R16 R14 + 0x74420002, // 0032 JMPT R16 #0036 + 0x5C401E00, // 0033 MOVE R16 R15 + 0x74420000, // 0034 JMPT R16 #0036 + 0xB006170C, // 0035 RAISE 1 K11 K12 + 0x8C40130D, // 0036 GETMET R16 R9 K13 + 0x5C480200, // 0037 MOVE R18 R1 + 0x7C400400, // 0038 CALL R16 2 + 0x783E0001, // 0039 JMPF R15 #003C + 0x5C440200, // 003A MOVE R17 R1 + 0x70020000, // 003B JMP #003D + 0x0044030E, // 003C ADD R17 R1 K14 + 0x783E0006, // 003D JMPF R15 #0045 + 0x4C480000, // 003E LDNIL R18 + 0x1C482012, // 003F EQ R18 R16 R18 + 0x784A0002, // 0040 JMPF R18 #0044 + 0x50480000, // 0041 LDBOOL R18 0 0 + 0xA0000000, // 0042 CLOSE R0 + 0x80042400, // 0043 RET 1 R18 + 0x70020014, // 0044 JMP #005A + 0x8C48130D, // 0045 GETMET R18 R9 K13 + 0x5C502200, // 0046 MOVE R20 R17 + 0x7C480400, // 0047 CALL R18 2 + 0x4C4C0000, // 0048 LDNIL R19 + 0x1C4C2013, // 0049 EQ R19 R16 R19 + 0x784E0005, // 004A JMPF R19 #0051 + 0x4C4C0000, // 004B LDNIL R19 + 0x1C4C2413, // 004C EQ R19 R18 R19 + 0x784E0002, // 004D JMPF R19 #0051 + 0x504C0000, // 004E LDBOOL R19 0 0 + 0xA0000000, // 004F CLOSE R0 + 0x80042600, // 0050 RET 1 R19 0x4C4C0000, // 0051 LDNIL R19 - 0x1C4C2013, // 0052 EQ R19 R16 R19 - 0x744E0001, // 0053 JMPT R19 #0056 - 0x284C2410, // 0054 GE R19 R18 R16 - 0x784E0000, // 0055 JMPF R19 #0057 - 0x503C0200, // 0056 LDBOOL R15 1 0 - 0x78360005, // 0057 JMPF R13 #005E - 0x00481705, // 0058 ADD R18 R11 K5 - 0x90021E12, // 0059 SETMBR R0 K15 R18 - 0x5C480400, // 005A MOVE R18 R2 - 0x884C010F, // 005B GETMBR R19 R0 K15 - 0x7C480200, // 005C CALL R18 1 - 0x70020000, // 005D JMP #005F - 0x90021F10, // 005E SETMBR R0 K15 K16 - 0x4C480000, // 005F LDNIL R18 - 0x783E0025, // 0060 JMPF R15 #0087 - 0x5C4C0800, // 0061 MOVE R19 R4 - 0x5C502200, // 0062 MOVE R20 R17 - 0x7C4C0200, // 0063 CALL R19 1 - 0x50500200, // 0064 LDBOOL R20 1 0 - 0x4C540000, // 0065 LDNIL R21 - 0x1C542615, // 0066 EQ R21 R19 R21 - 0x78560007, // 0067 JMPF R21 #0070 - 0x60540001, // 0068 GETGBL R21 G1 - 0x60580018, // 0069 GETGBL R22 G24 - 0x585C0011, // 006A LDCONST R23 K17 - 0x5C602200, // 006B MOVE R24 R17 - 0x7C580400, // 006C CALL R22 2 - 0x7C540200, // 006D CALL R21 1 - 0x50500000, // 006E LDBOOL R20 0 0 - 0x7002000A, // 006F JMP #007B - 0x54560003, // 0070 LDINT R21 4 - 0x20542615, // 0071 NE R21 R19 R21 - 0x78560007, // 0072 JMPF R21 #007B - 0x60540001, // 0073 GETGBL R21 G1 - 0x60580018, // 0074 GETGBL R22 G24 - 0x585C0012, // 0075 LDCONST R23 K18 - 0x5C602200, // 0076 MOVE R24 R17 - 0x5C642600, // 0077 MOVE R25 R19 - 0x7C580600, // 0078 CALL R22 3 - 0x7C540200, // 0079 CALL R21 1 - 0x50500000, // 007A LDBOOL R20 0 0 - 0x78520003, // 007B JMPF R20 #0080 - 0x5C540C00, // 007C MOVE R21 R6 - 0x5C582200, // 007D MOVE R22 R17 - 0x7C540200, // 007E CALL R21 1 - 0x5C482A00, // 007F MOVE R18 R21 - 0x4C540000, // 0080 LDNIL R21 - 0x1C542415, // 0081 EQ R21 R18 R21 - 0x78560003, // 0082 JMPF R21 #0087 - 0x5C540A00, // 0083 MOVE R21 R5 - 0x5C582200, // 0084 MOVE R22 R17 - 0x7C540200, // 0085 CALL R21 1 - 0x503C0000, // 0086 LDBOOL R15 0 0 - 0x783A0006, // 0087 JMPF R14 #008F - 0x4C4C0000, // 0088 LDNIL R19 - 0x1C4C2413, // 0089 EQ R19 R18 R19 - 0x784E0003, // 008A JMPF R19 #008F - 0x5C4C0C00, // 008B MOVE R19 R6 - 0x5C500200, // 008C MOVE R20 R1 - 0x7C4C0200, // 008D CALL R19 1 - 0x5C482600, // 008E MOVE R18 R19 - 0x4C4C0000, // 008F LDNIL R19 - 0x204C2413, // 0090 NE R19 R18 R19 - 0x784E0015, // 0091 JMPF R19 #00A8 - 0x5C4C1E00, // 0092 MOVE R19 R15 - 0x744E0013, // 0093 JMPT R19 #00A8 - 0x5C4C1A00, // 0094 MOVE R19 R13 - 0x744E0011, // 0095 JMPT R19 #00A8 - 0xA8020005, // 0096 EXBLK 0 #009D - 0x8C4C0113, // 0097 GETMET R19 R0 K19 - 0x5C542200, // 0098 MOVE R21 R17 - 0x5C582400, // 0099 MOVE R22 R18 - 0x7C4C0600, // 009A CALL R19 3 - 0xA8040001, // 009B EXBLK 1 1 - 0x7002000A, // 009C JMP #00A8 - 0xAC4C0001, // 009D CATCH R19 0 1 - 0x70020007, // 009E JMP #00A7 - 0x60500001, // 009F GETGBL R20 G1 - 0x60540018, // 00A0 GETGBL R21 G24 - 0x58580014, // 00A1 LDCONST R22 K20 - 0x5C5C2200, // 00A2 MOVE R23 R17 - 0x5C602600, // 00A3 MOVE R24 R19 - 0x7C540600, // 00A4 CALL R21 3 - 0x7C500200, // 00A5 CALL R20 1 - 0x70020000, // 00A6 JMP #00A8 - 0xB0080000, // 00A7 RAISE 2 R0 R0 - 0x5C4C0E00, // 00A8 MOVE R19 R7 - 0x5C502400, // 00A9 MOVE R20 R18 - 0x7C4C0200, // 00AA CALL R19 1 - 0x78360002, // 00AB JMPF R13 #00AF - 0x5C500600, // 00AC MOVE R20 R3 - 0x00541705, // 00AD ADD R21 R11 K5 - 0x7C500200, // 00AE CALL R20 1 - 0x80042600, // 00AF RET 1 R19 + 0x204C2413, // 0052 NE R19 R18 R19 + 0x784E0005, // 0053 JMPF R19 #005A + 0x4C4C0000, // 0054 LDNIL R19 + 0x1C4C2013, // 0055 EQ R19 R16 R19 + 0x744E0001, // 0056 JMPT R19 #0059 + 0x284C2410, // 0057 GE R19 R18 R16 + 0x784E0000, // 0058 JMPF R19 #005A + 0x503C0200, // 0059 LDBOOL R15 1 0 + 0x78360005, // 005A JMPF R13 #0061 + 0x00481705, // 005B ADD R18 R11 K5 + 0x90021E12, // 005C SETMBR R0 K15 R18 + 0x5C480400, // 005D MOVE R18 R2 + 0x884C010F, // 005E GETMBR R19 R0 K15 + 0x7C480200, // 005F CALL R18 1 + 0x70020000, // 0060 JMP #0062 + 0x90021F10, // 0061 SETMBR R0 K15 K16 + 0x4C480000, // 0062 LDNIL R18 + 0x783E0025, // 0063 JMPF R15 #008A + 0x5C4C0800, // 0064 MOVE R19 R4 + 0x5C502200, // 0065 MOVE R20 R17 + 0x7C4C0200, // 0066 CALL R19 1 + 0x50500200, // 0067 LDBOOL R20 1 0 + 0x4C540000, // 0068 LDNIL R21 + 0x1C542615, // 0069 EQ R21 R19 R21 + 0x78560007, // 006A JMPF R21 #0073 + 0x60540001, // 006B GETGBL R21 G1 + 0x60580018, // 006C GETGBL R22 G24 + 0x585C0011, // 006D LDCONST R23 K17 + 0x5C602200, // 006E MOVE R24 R17 + 0x7C580400, // 006F CALL R22 2 + 0x7C540200, // 0070 CALL R21 1 + 0x50500000, // 0071 LDBOOL R20 0 0 + 0x7002000A, // 0072 JMP #007E + 0x54560003, // 0073 LDINT R21 4 + 0x20542615, // 0074 NE R21 R19 R21 + 0x78560007, // 0075 JMPF R21 #007E + 0x60540001, // 0076 GETGBL R21 G1 + 0x60580018, // 0077 GETGBL R22 G24 + 0x585C0012, // 0078 LDCONST R23 K18 + 0x5C602200, // 0079 MOVE R24 R17 + 0x5C642600, // 007A MOVE R25 R19 + 0x7C580600, // 007B CALL R22 3 + 0x7C540200, // 007C CALL R21 1 + 0x50500000, // 007D LDBOOL R20 0 0 + 0x78520003, // 007E JMPF R20 #0083 + 0x5C540C00, // 007F MOVE R21 R6 + 0x5C582200, // 0080 MOVE R22 R17 + 0x7C540200, // 0081 CALL R21 1 + 0x5C482A00, // 0082 MOVE R18 R21 + 0x4C540000, // 0083 LDNIL R21 + 0x1C542415, // 0084 EQ R21 R18 R21 + 0x78560003, // 0085 JMPF R21 #008A + 0x5C540A00, // 0086 MOVE R21 R5 + 0x5C582200, // 0087 MOVE R22 R17 + 0x7C540200, // 0088 CALL R21 1 + 0x503C0000, // 0089 LDBOOL R15 0 0 + 0x783A0006, // 008A JMPF R14 #0092 + 0x4C4C0000, // 008B LDNIL R19 + 0x1C4C2413, // 008C EQ R19 R18 R19 + 0x784E0003, // 008D JMPF R19 #0092 + 0x5C4C0C00, // 008E MOVE R19 R6 + 0x5C500200, // 008F MOVE R20 R1 + 0x7C4C0200, // 0090 CALL R19 1 + 0x5C482600, // 0091 MOVE R18 R19 + 0x4C4C0000, // 0092 LDNIL R19 + 0x204C2413, // 0093 NE R19 R18 R19 + 0x784E0015, // 0094 JMPF R19 #00AB + 0x5C4C1E00, // 0095 MOVE R19 R15 + 0x744E0013, // 0096 JMPT R19 #00AB + 0x5C4C1A00, // 0097 MOVE R19 R13 + 0x744E0011, // 0098 JMPT R19 #00AB + 0xA8020005, // 0099 EXBLK 0 #00A0 + 0x8C4C0113, // 009A GETMET R19 R0 K19 + 0x5C542200, // 009B MOVE R21 R17 + 0x5C582400, // 009C MOVE R22 R18 + 0x7C4C0600, // 009D CALL R19 3 + 0xA8040001, // 009E EXBLK 1 1 + 0x7002000A, // 009F JMP #00AB + 0xAC4C0001, // 00A0 CATCH R19 0 1 + 0x70020007, // 00A1 JMP #00AA + 0x60500001, // 00A2 GETGBL R20 G1 + 0x60540018, // 00A3 GETGBL R21 G24 + 0x58580014, // 00A4 LDCONST R22 K20 + 0x5C5C2200, // 00A5 MOVE R23 R17 + 0x5C602600, // 00A6 MOVE R24 R19 + 0x7C540600, // 00A7 CALL R21 3 + 0x7C500200, // 00A8 CALL R20 1 + 0x70020000, // 00A9 JMP #00AB + 0xB0080000, // 00AA RAISE 2 R0 R0 + 0x5C4C0E00, // 00AB MOVE R19 R7 + 0x5C502400, // 00AC MOVE R20 R18 + 0x7C4C0200, // 00AD CALL R19 1 + 0x78360002, // 00AE JMPF R13 #00B2 + 0x5C500600, // 00AF MOVE R20 R3 + 0x00541705, // 00B0 ADD R21 R11 K5 + 0x7C500200, // 00B1 CALL R20 1 + 0xA0000000, // 00B2 CLOSE R0 + 0x80042600, // 00B3 RET 1 R19 }) ) ); diff --git a/lib/libesp32_div/esp-nimble-cpp/src/NimBLERemoteCharacteristic.cpp b/lib/libesp32_div/esp-nimble-cpp/src/NimBLERemoteCharacteristic.cpp index 35c191df3..c2050ed8f 100644 --- a/lib/libesp32_div/esp-nimble-cpp/src/NimBLERemoteCharacteristic.cpp +++ b/lib/libesp32_div/esp-nimble-cpp/src/NimBLERemoteCharacteristic.cpp @@ -134,6 +134,15 @@ bool NimBLERemoteCharacteristic::canWriteNoResponse() { return (m_charProp & BLE_GATT_CHR_PROP_WRITE_NO_RSP) != 0; } // canWriteNoResponse +/** + * @brief Return properties as bitfield + * + * @return uint8_t + */ +uint8_t NimBLERemoteCharacteristic::getProperties() { + return m_charProp; +} + /** * @brief Callback used by the API when a descriptor is discovered or search complete. diff --git a/lib/libesp32_div/esp-nimble-cpp/src/NimBLERemoteCharacteristic.h b/lib/libesp32_div/esp-nimble-cpp/src/NimBLERemoteCharacteristic.h index a0f8f55f2..ea4616e51 100644 --- a/lib/libesp32_div/esp-nimble-cpp/src/NimBLERemoteCharacteristic.h +++ b/lib/libesp32_div/esp-nimble-cpp/src/NimBLERemoteCharacteristic.h @@ -52,6 +52,7 @@ public: bool canRead(); bool canWrite(); bool canWriteNoResponse(); + uint8_t getProperties(); std::vector::iterator begin(); std::vector::iterator end(); NimBLERemoteDescriptor* getDescriptor(const NimBLEUUID &uuid); diff --git a/lib/libesp32_lvgl/Adafruit_LvGL_Glue-shadinger/Adafruit_LvGL_Glue.cpp b/lib/libesp32_lvgl/Adafruit_LvGL_Glue-shadinger/Adafruit_LvGL_Glue.cpp index 75f6baa0a..2e433ee9e 100755 --- a/lib/libesp32_lvgl/Adafruit_LvGL_Glue-shadinger/Adafruit_LvGL_Glue.cpp +++ b/lib/libesp32_lvgl/Adafruit_LvGL_Glue-shadinger/Adafruit_LvGL_Glue.cpp @@ -205,7 +205,9 @@ LvGLStatus Adafruit_LvGL_Glue::begin(Renderer *tft, void *touch, bool debug) { lvgl_buffer_size = tft->width() * (flushlines ? flushlines:LV_BUFFER_ROWS); if (tft->lvgl_pars()->use_dma) { lvgl_buffer_size /= 2; - lv_pixel_buf2 = new lv_color_t[lvgl_buffer_size]; + if (lvgl_buffer_size < 1000000) { + lv_pixel_buf2 = new lv_color_t[lvgl_buffer_size]; + } if (!lv_pixel_buf2) { return status; } diff --git a/lib/libesp32_lvgl/lv_binding_berry/generate/be_lv_c_mapping.h b/lib/libesp32_lvgl/lv_binding_berry/generate/be_lv_c_mapping.h index ea0556f2c..18ca143e1 100644 --- a/lib/libesp32_lvgl/lv_binding_berry/generate/be_lv_c_mapping.h +++ b/lib/libesp32_lvgl/lv_binding_berry/generate/be_lv_c_mapping.h @@ -968,12 +968,14 @@ const be_ntv_func_def_t lv_switch_func[] = { const be_ntv_func_def_t lv_table_func[] = { { "add_cell_ctrl", { (const void*) &lv_table_add_cell_ctrl, "", "(lv.lv_obj)ii(lv.lv_table_cell_ctrl)" } }, { "clear_cell_ctrl", { (const void*) &lv_table_clear_cell_ctrl, "", "(lv.lv_obj)ii(lv.lv_table_cell_ctrl)" } }, + { "get_cell_user_data", { (const void*) &lv_table_get_cell_user_data, ".", "(lv.lv_obj)ii" } }, { "get_cell_value", { (const void*) &lv_table_get_cell_value, "s", "(lv.lv_obj)ii" } }, { "get_col_cnt", { (const void*) &lv_table_get_col_cnt, "i", "(lv.lv_obj)" } }, { "get_col_width", { (const void*) &lv_table_get_col_width, "i", "(lv.lv_obj)i" } }, { "get_row_cnt", { (const void*) &lv_table_get_row_cnt, "i", "(lv.lv_obj)" } }, { "get_selected_cell", { (const void*) &lv_table_get_selected_cell, "", "(lv.lv_obj)(lv.uint16)(lv.uint16)" } }, { "has_cell_ctrl", { (const void*) &lv_table_has_cell_ctrl, "b", "(lv.lv_obj)ii(lv.lv_table_cell_ctrl)" } }, + { "set_cell_user_data", { (const void*) &lv_table_set_cell_user_data, "", "(lv.lv_obj)ii." } }, { "set_cell_value", { (const void*) &lv_table_set_cell_value, "", "(lv.lv_obj)iis" } }, { "set_cell_value_fmt", { (const void*) &lv_table_set_cell_value_fmt, "", "(lv.lv_obj)iis[......]" } }, { "set_col_cnt", { (const void*) &lv_table_set_col_cnt, "", "(lv.lv_obj)i" } }, diff --git a/lib/libesp32_lvgl/lv_binding_berry/generate/be_lvgl_widgets_lib.c b/lib/libesp32_lvgl/lv_binding_berry/generate/be_lvgl_widgets_lib.c index 3df0ce70b..614e7f985 100644 --- a/lib/libesp32_lvgl/lv_binding_berry/generate/be_lvgl_widgets_lib.c +++ b/lib/libesp32_lvgl/lv_binding_berry/generate/be_lvgl_widgets_lib.c @@ -907,12 +907,14 @@ extern int lvbe_table_set_col_cnt(bvm *vm); extern int lvbe_table_set_col_width(bvm *vm); extern int lvbe_table_add_cell_ctrl(bvm *vm); extern int lvbe_table_clear_cell_ctrl(bvm *vm); +extern int lvbe_table_set_cell_user_data(bvm *vm); extern int lvbe_table_get_cell_value(bvm *vm); extern int lvbe_table_get_row_cnt(bvm *vm); extern int lvbe_table_get_col_cnt(bvm *vm); extern int lvbe_table_get_col_width(bvm *vm); extern int lvbe_table_has_cell_ctrl(bvm *vm); extern int lvbe_table_get_selected_cell(bvm *vm); +extern int lvbe_table_get_cell_user_data(bvm *vm); /* `lv_textarea` external functions definitions */ extern int lvbe_textarea_create(bvm *vm); diff --git a/lib/libesp32_lvgl/lv_binding_berry/mapping/lv_funcs.h b/lib/libesp32_lvgl/lv_binding_berry/mapping/lv_funcs.h index 39fbddc61..1a031f381 100644 --- a/lib/libesp32_lvgl/lv_binding_berry/mapping/lv_funcs.h +++ b/lib/libesp32_lvgl/lv_binding_berry/mapping/lv_funcs.h @@ -1130,12 +1130,14 @@ void lv_table_set_col_cnt(lv_obj_t * obj, uint16_t col_cnt) void lv_table_set_col_width(lv_obj_t * obj, uint16_t col_id, lv_coord_t w) void lv_table_add_cell_ctrl(lv_obj_t * obj, uint16_t row, uint16_t col, lv_table_cell_ctrl_t ctrl) void lv_table_clear_cell_ctrl(lv_obj_t * obj, uint16_t row, uint16_t col, lv_table_cell_ctrl_t ctrl) +void lv_table_set_cell_user_data(lv_obj_t * obj, uint16_t row, uint16_t col, void * user_data) const char * lv_table_get_cell_value(lv_obj_t * obj, uint16_t row, uint16_t col) uint16_t lv_table_get_row_cnt(lv_obj_t * obj) uint16_t lv_table_get_col_cnt(lv_obj_t * obj) lv_coord_t lv_table_get_col_width(lv_obj_t * obj, uint16_t col) bool lv_table_has_cell_ctrl(lv_obj_t * obj, uint16_t row, uint16_t col, lv_table_cell_ctrl_t ctrl) void lv_table_get_selected_cell(lv_obj_t * obj, uint16_t * row, uint16_t * col) +void * lv_table_get_cell_user_data(lv_obj_t * obj, uint16_t row, uint16_t col) // ../../lvgl/src/widgets/lv_textarea.h lv_obj_t * lv_textarea_create(lv_obj_t * parent) diff --git a/lib/libesp32_lvgl/lv_binding_berry/src/be_lvgl_ctypes_definitions.c b/lib/libesp32_lvgl/lv_binding_berry/src/be_lvgl_ctypes_definitions.c index 35b3e2ce5..7df88b6cd 100644 --- a/lib/libesp32_lvgl/lv_binding_berry/src/be_lvgl_ctypes_definitions.c +++ b/lib/libesp32_lvgl/lv_binding_berry/src/be_lvgl_ctypes_definitions.c @@ -432,11 +432,10 @@ const be_ctypes_structure_t be_lv_draw_mask_saved = { const be_ctypes_structure_t be_lv_meter_scale = { 36, /* size in bytes */ - 15, /* number of elements */ + 14, /* number of elements */ be_ctypes_instance_mappings, - (const be_ctypes_structure_item_t[15]) { + (const be_ctypes_structure_item_t[14]) { { "angle_range", 30, 0, 0, ctypes_u16, 0 }, - { "label_color", 18, 0, 0, ctypes_i16, 0 }, { "label_gap", 16, 0, 0, ctypes_i16, 0 }, { "max", 24, 0, 0, ctypes_i32, 0 }, { "min", 20, 0, 0, ctypes_i32, 0 }, diff --git a/lib/libesp32_lvgl/lv_binding_berry/src/embedded/lvgl_ctypes.py b/lib/libesp32_lvgl/lv_binding_berry/src/embedded/lvgl_ctypes.py index 1eddbcf10..a6649f7fe 100644 --- a/lib/libesp32_lvgl/lv_binding_berry/src/embedded/lvgl_ctypes.py +++ b/lib/libesp32_lvgl/lv_binding_berry/src/embedded/lvgl_ctypes.py @@ -353,7 +353,6 @@ lv_meter_scale = [ # valid LVGL8.3 [uint16_t, "tick_major_width"], [int16_t, "label_gap"], - [int16_t, "label_color"], [int32_t, "min"], [int32_t, "max"], diff --git a/lib/libesp32_lvgl/lvgl/library.json b/lib/libesp32_lvgl/lvgl/library.json index 5a1f9d7be..068fc5c47 100644 --- a/lib/libesp32_lvgl/lvgl/library.json +++ b/lib/libesp32_lvgl/lvgl/library.json @@ -1,6 +1,6 @@ { "name": "lvgl", - "version": "8.3.10", + "version": "8.3.11", "keywords": "graphics, gui, embedded, tft, lvgl", "description": "Graphics library to create embedded GUI with easy-to-use graphical elements, beautiful visual effects and low memory footprint. It offers anti-aliasing, opacity, and animations using only one frame buffer.", "repository": { diff --git a/lib/libesp32_lvgl/lvgl/library.properties b/lib/libesp32_lvgl/lvgl/library.properties index 87e1cbc89..bc7411552 100644 --- a/lib/libesp32_lvgl/lvgl/library.properties +++ b/lib/libesp32_lvgl/lvgl/library.properties @@ -1,5 +1,5 @@ name=lvgl -version=8.3.10 +version=8.3.11 author=kisvegabor maintainer=kisvegabor,embeddedt,pete-pjb sentence=Full-featured Graphics Library for Embedded Systems diff --git a/lib/libesp32_lvgl/lvgl/lv_conf_template.h b/lib/libesp32_lvgl/lvgl/lv_conf_template.h index 66535138d..bed77fb8f 100644 --- a/lib/libesp32_lvgl/lvgl/lv_conf_template.h +++ b/lib/libesp32_lvgl/lvgl/lv_conf_template.h @@ -1,6 +1,6 @@ /** * @file lv_conf.h - * Configuration file for v8.3.9 + * Configuration file for v8.3.11 */ /* @@ -639,6 +639,13 @@ #define LV_FS_FATFS_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/ #endif +/*API for LittleFS (library needs to be added separately). Uses lfs_file_open, lfs_file_read, etc*/ +#define LV_USE_FS_LITTLEFS 0 +#if LV_USE_FS_LITTLEFS + #define LV_FS_LITTLEFS_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/ + #define LV_FS_LITTLEFS_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/ +#endif + /*PNG decoder library*/ #define LV_USE_PNG 0 @@ -672,6 +679,13 @@ #endif #endif +/*Tiny TTF library*/ +#define LV_USE_TINY_TTF 0 +#if LV_USE_TINY_TTF + /*Load TTF data from files*/ + #define LV_TINY_TTF_FILE_SUPPORT 0 +#endif + /*Rlottie library*/ #define LV_USE_RLOTTIE 0 diff --git a/lib/libesp32_lvgl/lvgl/lvgl.h b/lib/libesp32_lvgl/lvgl/lvgl.h index c37b2ee8d..47700d4e6 100644 --- a/lib/libesp32_lvgl/lvgl/lvgl.h +++ b/lib/libesp32_lvgl/lvgl/lvgl.h @@ -15,7 +15,7 @@ extern "C" { ***************************/ #define LVGL_VERSION_MAJOR 8 #define LVGL_VERSION_MINOR 3 -#define LVGL_VERSION_PATCH 10 +#define LVGL_VERSION_PATCH 11 #define LVGL_VERSION_INFO "" /********************* diff --git a/lib/libesp32_lvgl/lvgl/src/core/lv_disp.c b/lib/libesp32_lvgl/lvgl/src/core/lv_disp.c index dd0f7898e..cacade51d 100644 --- a/lib/libesp32_lvgl/lvgl/src/core/lv_disp.c +++ b/lib/libesp32_lvgl/lvgl/src/core/lv_disp.c @@ -224,9 +224,13 @@ void lv_scr_load_anim(lv_obj_t * new_scr, lv_scr_load_anim_t anim_type, uint32_t lv_disp_t * d = lv_obj_get_disp(new_scr); lv_obj_t * act_scr = lv_scr_act(); + if(act_scr == new_scr || d->scr_to_load == new_scr) { + return; + } + /*If an other screen load animation is in progress *make target screen loaded immediately. */ - if(d->scr_to_load && act_scr != d->scr_to_load) { + if(d->scr_to_load) { scr_load_internal(d->scr_to_load); lv_anim_del(d->scr_to_load, NULL); lv_obj_set_pos(d->scr_to_load, 0, 0); @@ -258,7 +262,6 @@ void lv_scr_load_anim(lv_obj_t * new_scr, lv_scr_load_anim_t anim_type, uint32_t lv_obj_remove_local_style_prop(new_scr, LV_STYLE_OPA, 0); lv_obj_remove_local_style_prop(lv_scr_act(), LV_STYLE_OPA, 0); - /*Shortcut for immediate load*/ if(time == 0 && delay == 0) { scr_load_internal(new_scr); @@ -478,6 +481,7 @@ static void scr_load_internal(lv_obj_t * scr) if(d->act_scr) lv_event_send(scr, LV_EVENT_SCREEN_LOAD_START, NULL); d->act_scr = scr; + d->scr_to_load = NULL; if(d->act_scr) lv_event_send(scr, LV_EVENT_SCREEN_LOADED, NULL); if(d->act_scr) lv_event_send(old_scr, LV_EVENT_SCREEN_UNLOADED, NULL); diff --git a/lib/libesp32_lvgl/lvgl/src/core/lv_obj.c b/lib/libesp32_lvgl/lvgl/src/core/lv_obj.c index 8d814d1ab..f0f4d5500 100644 --- a/lib/libesp32_lvgl/lvgl/src/core/lv_obj.c +++ b/lib/libesp32_lvgl/lvgl/src/core/lv_obj.c @@ -149,9 +149,9 @@ void lv_init(void) lv_img_cache_set_size(LV_IMG_CACHE_DEF_SIZE); #endif /*Test if the IDE has UTF-8 encoding*/ - char * txt = "Á"; + const char * txt = "Á"; - uint8_t * txt_u8 = (uint8_t *)txt; + const uint8_t * txt_u8 = (uint8_t *)txt; if(txt_u8[0] != 0xc3 || txt_u8[1] != 0x81 || txt_u8[2] != 0x00) { LV_LOG_WARN("The strings have no UTF-8 encoding. Non-ASCII characters won't be displayed."); } @@ -862,6 +862,10 @@ static void lv_obj_event(const lv_obj_class_t * class_p, lv_event_t * e) lv_obj_mark_layout_as_dirty(obj); } } + else if(code == LV_EVENT_CHILD_DELETED) { + obj->readjust_scroll_after_layout = 1; + lv_obj_mark_layout_as_dirty(obj); + } else if(code == LV_EVENT_REFR_EXT_DRAW_SIZE) { lv_coord_t d = lv_obj_calculate_ext_draw_size(obj, LV_PART_MAIN); lv_event_set_ext_draw_size(e, d); diff --git a/lib/libesp32_lvgl/lvgl/src/core/lv_obj.h b/lib/libesp32_lvgl/lvgl/src/core/lv_obj.h index a6a9ac38c..830d122e4 100644 --- a/lib/libesp32_lvgl/lvgl/src/core/lv_obj.h +++ b/lib/libesp32_lvgl/lvgl/src/core/lv_obj.h @@ -183,6 +183,7 @@ typedef struct _lv_obj_t { lv_obj_flag_t flags; lv_state_t state; uint16_t layout_inv : 1; + uint16_t readjust_scroll_after_layout : 1; uint16_t scr_layout_inv : 1; uint16_t skip_trans : 1; uint16_t style_cnt : 6; diff --git a/lib/libesp32_lvgl/lvgl/src/core/lv_obj_draw.c b/lib/libesp32_lvgl/lvgl/src/core/lv_obj_draw.c index e0b95c523..d906126c3 100644 --- a/lib/libesp32_lvgl/lvgl/src/core/lv_obj_draw.c +++ b/lib/libesp32_lvgl/lvgl/src/core/lv_obj_draw.c @@ -179,12 +179,11 @@ void lv_obj_init_draw_rect_dsc(lv_obj_t * obj, uint32_t part, lv_draw_rect_dsc_t } } #endif - if(opa < LV_OPA_MAX) { - draw_dsc->bg_opa = (opa * draw_dsc->shadow_opa) >> 8; - draw_dsc->bg_img_opa = (opa * draw_dsc->shadow_opa) >> 8; - draw_dsc->border_opa = (opa * draw_dsc->shadow_opa) >> 8; - draw_dsc->outline_opa = (opa * draw_dsc->shadow_opa) >> 8; + draw_dsc->bg_opa = (opa * draw_dsc->bg_opa) >> 8; + draw_dsc->bg_img_opa = (opa * draw_dsc->bg_img_opa) >> 8; + draw_dsc->border_opa = (opa * draw_dsc->border_opa) >> 8; + draw_dsc->outline_opa = (opa * draw_dsc->outline_opa) >> 8; draw_dsc->shadow_opa = (opa * draw_dsc->shadow_opa) >> 8; } } diff --git a/lib/libesp32_lvgl/lvgl/src/core/lv_obj_pos.c b/lib/libesp32_lvgl/lvgl/src/core/lv_obj_pos.c index 5fc7db9ee..c50ea3a3c 100644 --- a/lib/libesp32_lvgl/lvgl/src/core/lv_obj_pos.c +++ b/lib/libesp32_lvgl/lvgl/src/core/lv_obj_pos.c @@ -200,7 +200,7 @@ bool lv_obj_refr_size(lv_obj_t * obj) /*Invalidate the new area*/ lv_obj_invalidate(obj); - lv_obj_readjust_scroll(obj, LV_ANIM_OFF); + obj->readjust_scroll_after_layout = 1; /*If the object was out of the parent invalidate the new scrollbar area too. *If it wasn't out of the parent but out now, also invalidate the scrollbars*/ @@ -1137,20 +1137,24 @@ static void layout_update_core(lv_obj_t * obj) layout_update_core(child); } - if(obj->layout_inv == 0) return; + if(obj->layout_inv) { + obj->layout_inv = 0; + lv_obj_refr_size(obj); + lv_obj_refr_pos(obj); - obj->layout_inv = 0; - - lv_obj_refr_size(obj); - lv_obj_refr_pos(obj); - - if(child_cnt > 0) { - uint32_t layout_id = lv_obj_get_style_layout(obj, LV_PART_MAIN); - if(layout_id > 0 && layout_id <= layout_cnt) { - void * user_data = LV_GC_ROOT(_lv_layout_list)[layout_id - 1].user_data; - LV_GC_ROOT(_lv_layout_list)[layout_id - 1].cb(obj, user_data); + if(child_cnt > 0) { + uint32_t layout_id = lv_obj_get_style_layout(obj, LV_PART_MAIN); + if(layout_id > 0 && layout_id <= layout_cnt) { + void * user_data = LV_GC_ROOT(_lv_layout_list)[layout_id - 1].user_data; + LV_GC_ROOT(_lv_layout_list)[layout_id - 1].cb(obj, user_data); + } } } + + if(obj->readjust_scroll_after_layout) { + obj->readjust_scroll_after_layout = 0; + lv_obj_readjust_scroll(obj, LV_ANIM_OFF); + } } static void transform_point(const lv_obj_t * obj, lv_point_t * p, bool inv) diff --git a/lib/libesp32_lvgl/lvgl/src/core/lv_obj_scroll.h b/lib/libesp32_lvgl/lvgl/src/core/lv_obj_scroll.h index e1da245b7..459389e3f 100644 --- a/lib/libesp32_lvgl/lvgl/src/core/lv_obj_scroll.h +++ b/lib/libesp32_lvgl/lvgl/src/core/lv_obj_scroll.h @@ -290,7 +290,7 @@ void lv_obj_get_scrollbar_area(struct _lv_obj_t * obj, lv_area_t * hor, lv_area_ void lv_obj_scrollbar_invalidate(struct _lv_obj_t * obj); /** - * Checked if the content is scrolled "in" and adjusts it to a normal position. + * Checks if the content is scrolled "in" and adjusts it to a normal position. * @param obj pointer to an object * @param anim_en LV_ANIM_ON/OFF */ diff --git a/lib/libesp32_lvgl/lvgl/src/core/lv_obj_style_gen.c b/lib/libesp32_lvgl/lvgl/src/core/lv_obj_style_gen.c index a9635f473..81358ab9e 100644 --- a/lib/libesp32_lvgl/lvgl/src/core/lv_obj_style_gen.c +++ b/lib/libesp32_lvgl/lvgl/src/core/lv_obj_style_gen.c @@ -608,8 +608,7 @@ void lv_obj_set_style_opa_layered(struct _lv_obj_t * obj, lv_opa_t value, lv_sty lv_obj_set_local_style_prop(obj, LV_STYLE_OPA_LAYERED, v, selector); } -void lv_obj_set_style_color_filter_dsc(struct _lv_obj_t * obj, const lv_color_filter_dsc_t * value, - lv_style_selector_t selector) +void lv_obj_set_style_color_filter_dsc(struct _lv_obj_t * obj, const lv_color_filter_dsc_t * value, lv_style_selector_t selector) { lv_style_value_t v = { .ptr = value @@ -649,8 +648,7 @@ void lv_obj_set_style_anim_speed(struct _lv_obj_t * obj, uint32_t value, lv_styl lv_obj_set_local_style_prop(obj, LV_STYLE_ANIM_SPEED, v, selector); } -void lv_obj_set_style_transition(struct _lv_obj_t * obj, const lv_style_transition_dsc_t * value, - lv_style_selector_t selector) +void lv_obj_set_style_transition(struct _lv_obj_t * obj, const lv_style_transition_dsc_t * value, lv_style_selector_t selector) { lv_style_value_t v = { .ptr = value diff --git a/lib/libesp32_lvgl/lvgl/src/core/lv_obj_style_gen.h b/lib/libesp32_lvgl/lvgl/src/core/lv_obj_style_gen.h index 51d43aefc..4a135be09 100644 --- a/lib/libesp32_lvgl/lvgl/src/core/lv_obj_style_gen.h +++ b/lib/libesp32_lvgl/lvgl/src/core/lv_obj_style_gen.h @@ -162,8 +162,7 @@ static inline lv_color_t lv_obj_get_style_bg_grad_color(const struct _lv_obj_t * static inline lv_color_t lv_obj_get_style_bg_grad_color_filtered(const struct _lv_obj_t * obj, uint32_t part) { - lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, - LV_STYLE_BG_GRAD_COLOR)); + lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_BG_GRAD_COLOR)); return v.color; } @@ -217,8 +216,7 @@ static inline lv_color_t lv_obj_get_style_bg_img_recolor(const struct _lv_obj_t static inline lv_color_t lv_obj_get_style_bg_img_recolor_filtered(const struct _lv_obj_t * obj, uint32_t part) { - lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, - LV_STYLE_BG_IMG_RECOLOR)); + lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_BG_IMG_RECOLOR)); return v.color; } @@ -242,8 +240,7 @@ static inline lv_color_t lv_obj_get_style_border_color(const struct _lv_obj_t * static inline lv_color_t lv_obj_get_style_border_color_filtered(const struct _lv_obj_t * obj, uint32_t part) { - lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, - LV_STYLE_BORDER_COLOR)); + lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_BORDER_COLOR)); return v.color; } @@ -285,8 +282,7 @@ static inline lv_color_t lv_obj_get_style_outline_color(const struct _lv_obj_t * static inline lv_color_t lv_obj_get_style_outline_color_filtered(const struct _lv_obj_t * obj, uint32_t part) { - lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, - LV_STYLE_OUTLINE_COLOR)); + lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_OUTLINE_COLOR)); return v.color; } @@ -334,8 +330,7 @@ static inline lv_color_t lv_obj_get_style_shadow_color(const struct _lv_obj_t * static inline lv_color_t lv_obj_get_style_shadow_color_filtered(const struct _lv_obj_t * obj, uint32_t part) { - lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, - LV_STYLE_SHADOW_COLOR)); + lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_SHADOW_COLOR)); return v.color; } @@ -359,8 +354,7 @@ static inline lv_color_t lv_obj_get_style_img_recolor(const struct _lv_obj_t * o static inline lv_color_t lv_obj_get_style_img_recolor_filtered(const struct _lv_obj_t * obj, uint32_t part) { - lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, - LV_STYLE_IMG_RECOLOR)); + lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_IMG_RECOLOR)); return v.color; } @@ -520,8 +514,7 @@ static inline lv_opa_t lv_obj_get_style_opa_layered(const struct _lv_obj_t * obj return (lv_opa_t)v.num; } -static inline const lv_color_filter_dsc_t * lv_obj_get_style_color_filter_dsc(const struct _lv_obj_t * obj, - uint32_t part) +static inline const lv_color_filter_dsc_t * lv_obj_get_style_color_filter_dsc(const struct _lv_obj_t * obj, uint32_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_COLOR_FILTER_DSC); return (const lv_color_filter_dsc_t *)v.ptr; @@ -651,14 +644,12 @@ void lv_obj_set_style_radius(struct _lv_obj_t * obj, lv_coord_t value, lv_style_ void lv_obj_set_style_clip_corner(struct _lv_obj_t * obj, bool value, lv_style_selector_t selector); void lv_obj_set_style_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector); void lv_obj_set_style_opa_layered(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector); -void lv_obj_set_style_color_filter_dsc(struct _lv_obj_t * obj, const lv_color_filter_dsc_t * value, - lv_style_selector_t selector); +void lv_obj_set_style_color_filter_dsc(struct _lv_obj_t * obj, const lv_color_filter_dsc_t * value, lv_style_selector_t selector); void lv_obj_set_style_color_filter_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector); void lv_obj_set_style_anim(struct _lv_obj_t * obj, const lv_anim_t * value, lv_style_selector_t selector); void lv_obj_set_style_anim_time(struct _lv_obj_t * obj, uint32_t value, lv_style_selector_t selector); void lv_obj_set_style_anim_speed(struct _lv_obj_t * obj, uint32_t value, lv_style_selector_t selector); -void lv_obj_set_style_transition(struct _lv_obj_t * obj, const lv_style_transition_dsc_t * value, - lv_style_selector_t selector); +void lv_obj_set_style_transition(struct _lv_obj_t * obj, const lv_style_transition_dsc_t * value, lv_style_selector_t selector); void lv_obj_set_style_blend_mode(struct _lv_obj_t * obj, lv_blend_mode_t value, lv_style_selector_t selector); void lv_obj_set_style_layout(struct _lv_obj_t * obj, uint16_t value, lv_style_selector_t selector); void lv_obj_set_style_base_dir(struct _lv_obj_t * obj, lv_base_dir_t value, lv_style_selector_t selector); diff --git a/lib/libesp32_lvgl/lvgl/src/core/lv_obj_tree.c b/lib/libesp32_lvgl/lvgl/src/core/lv_obj_tree.c index dbd350a46..5ae629e75 100644 --- a/lib/libesp32_lvgl/lvgl/src/core/lv_obj_tree.c +++ b/lib/libesp32_lvgl/lvgl/src/core/lv_obj_tree.c @@ -49,9 +49,6 @@ void lv_obj_del(lv_obj_t * obj) lv_obj_invalidate(obj); lv_obj_t * par = lv_obj_get_parent(obj); - if(par) { - lv_obj_scrollbar_invalidate(par); - } lv_disp_t * disp = NULL; bool act_scr_del = false; @@ -65,8 +62,6 @@ void lv_obj_del(lv_obj_t * obj) /*Call the ancestor's event handler to the parent to notify it about the child delete*/ if(par) { - lv_obj_update_layout(par); - lv_obj_readjust_scroll(par, LV_ANIM_OFF); lv_obj_scrollbar_invalidate(par); lv_event_send(par, LV_EVENT_CHILD_CHANGED, NULL); lv_event_send(par, LV_EVENT_CHILD_DELETED, NULL); @@ -173,7 +168,6 @@ void lv_obj_set_parent(lv_obj_t * obj, lv_obj_t * parent) obj->parent = parent; /*Notify the original parent because one of its children is lost*/ - lv_obj_readjust_scroll(old_parent, LV_ANIM_OFF); lv_obj_scrollbar_invalidate(old_parent); lv_event_send(old_parent, LV_EVENT_CHILD_CHANGED, obj); lv_event_send(old_parent, LV_EVENT_CHILD_DELETED, NULL); diff --git a/lib/libesp32_lvgl/lvgl/src/draw/stm32_dma2d/lv_gpu_stm32_dma2d.c b/lib/libesp32_lvgl/lvgl/src/draw/stm32_dma2d/lv_gpu_stm32_dma2d.c index 715cdd2c0..84da4b69c 100644 --- a/lib/libesp32_lvgl/lvgl/src/draw/stm32_dma2d/lv_gpu_stm32_dma2d.c +++ b/lib/libesp32_lvgl/lvgl/src/draw/stm32_dma2d/lv_gpu_stm32_dma2d.c @@ -34,6 +34,19 @@ #error "Cannot use DMA2D with LV_COLOR_DEPTH other than 16 or 32" #endif +#if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U) + #define LV_STM32_DMA2D_USE_M7_CACHE +#endif + +#if defined (LV_STM32_DMA2D_USE_M7_CACHE) + // Cortex-M7 DCache present + #define __lv_gpu_stm32_dma2d_clean_cache(address, offset, width, height, pixel_size) _lv_gpu_stm32_dma2d_clean_cache(address, offset, width, height, pixel_size) + #define __lv_gpu_stm32_dma2d_invalidate_cache(address, offset, width, height, pixel_size) _lv_gpu_stm32_dma2d_invalidate_cache(address, offset, width, height, pixel_size) +#else + #define __lv_gpu_stm32_dma2d_clean_cache(address, offset, width, height, pixel_size) + #define __lv_gpu_stm32_dma2d_invalidate_cache(address, offset, width, height, pixel_size) +#endif + /********************** * STATIC PROTOTYPES **********************/ @@ -61,13 +74,19 @@ LV_STM32_DMA2D_STATIC void _lv_draw_stm32_dma2d_copy_buffer(const lv_color_t * d const lv_area_t * draw_area, const lv_color_t * src_buf, lv_coord_t src_stride, const lv_point_t * src_offset); LV_STM32_DMA2D_STATIC void _lv_gpu_stm32_dma2d_await_dma_transfer_finish(lv_disp_drv_t * disp_drv); LV_STM32_DMA2D_STATIC void _lv_gpu_stm32_dma2d_start_dma_transfer(void); + +#if defined (LV_STM32_DMA2D_USE_M7_CACHE) LV_STM32_DMA2D_STATIC void _lv_gpu_stm32_dma2d_invalidate_cache(uint32_t address, lv_coord_t offset, lv_coord_t width, lv_coord_t height, uint8_t pixel_size); LV_STM32_DMA2D_STATIC void _lv_gpu_stm32_dma2d_clean_cache(uint32_t address, lv_coord_t offset, lv_coord_t width, lv_coord_t height, uint8_t pixel_size); -LV_STM32_DMA2D_STATIC bool _lv_gpu_stm32_dwt_init(void); -LV_STM32_DMA2D_STATIC void _lv_gpu_stm32_dwt_reset(void); -LV_STM32_DMA2D_STATIC uint32_t _lv_gpu_stm32_dwt_get_us(void); +#endif + +#if defined(LV_STM32_DMA2D_TEST) + LV_STM32_DMA2D_STATIC bool _lv_gpu_stm32_dwt_init(void); + LV_STM32_DMA2D_STATIC void _lv_gpu_stm32_dwt_reset(void); + LV_STM32_DMA2D_STATIC uint32_t _lv_gpu_stm32_dwt_get_us(void); +#endif static bool isDma2dInProgess = false; // indicates whether DMA2D transfer *initiated here* is in progress @@ -77,21 +96,21 @@ static bool isDma2dInProgess = false; // indicates whether DMA2D transfer *initi void lv_draw_stm32_dma2d_init(void) { // Enable DMA2D clock -#if defined(STM32F4) || defined(STM32F7) +#if defined(STM32F4) || defined(STM32F7) || defined(STM32U5) RCC->AHB1ENR |= RCC_AHB1ENR_DMA2DEN; // enable DMA2D + // wait for hardware access to complete + __asm volatile("DSB\n"); + volatile uint32_t temp = RCC->AHB1ENR; + LV_UNUSED(temp); #elif defined(STM32H7) RCC->AHB3ENR |= RCC_AHB3ENR_DMA2DEN; + // wait for hardware access to complete + __asm volatile("DSB\n"); + volatile uint32_t temp = RCC->AHB3ENR; + LV_UNUSED(temp); #else # warning "LVGL can't enable the clock of DMA2D" #endif - - // Wait for hardware access to complete - __asm volatile("DSB\n"); - - // Delay after setting peripheral clock - volatile uint32_t temp = RCC->AHB1ENR; - LV_UNUSED(temp); - // AHB master timer configuration DMA2D->AMTCR = 0; // AHB bus guaranteed dead time disabled #if defined(LV_STM32_DMA2D_TEST) @@ -206,7 +225,7 @@ static void lv_draw_stm32_dma2d_blend(lv_draw_ctx_t * draw_ctx, const lv_draw_sw // lv_coord_t draw_width = lv_area_get_width(&draw_area); // lv_coord_t draw_height = lv_area_get_height(&draw_area); // uint32_t dest_address = (uint32_t)(draw_ctx->buf + (dest_stride * draw_area.y1) + draw_area.x1); - // _lv_gpu_stm32_dma2d_clean_cache(dest_address, dest_stride - draw_width, draw_width, draw_height, sizeof(lv_color_t)); + // __lv_gpu_stm32_dma2d_clean_cache(dest_address, dest_stride - draw_width, draw_width, draw_height, sizeof(lv_color_t)); #endif } } @@ -412,7 +431,7 @@ LV_STM32_DMA2D_STATIC void _lv_draw_stm32_dma2d_blend_fill(const lv_color_t * de DMA2D->BGMAR = (uint32_t)(dest_buf + (dest_stride * draw_area->y1) + draw_area->x1); DMA2D->BGOR = dest_stride - draw_width; DMA2D->BGCOLR = 0; // used in A4 and A8 modes only - _lv_gpu_stm32_dma2d_clean_cache(DMA2D->BGMAR, DMA2D->BGOR, draw_width, draw_height, sizeof(lv_color_t)); + __lv_gpu_stm32_dma2d_clean_cache(DMA2D->BGMAR, DMA2D->BGOR, draw_width, draw_height, sizeof(lv_color_t)); DMA2D->OPFCCR = LvglColorFormat; #if defined(DMA2D_OPFCCR_RBS_Pos) @@ -500,7 +519,7 @@ LV_STM32_DMA2D_STATIC void _lv_draw_stm32_dma2d_blend_map(const lv_color_t * des DMA2D->FGMAR = ((uint32_t)src_buf) + srcBpp * ((src_stride * src_offset->y) + src_offset->x); DMA2D->FGOR = src_stride - draw_width; DMA2D->FGCOLR = 0; // used in A4 and A8 modes only - _lv_gpu_stm32_dma2d_clean_cache(DMA2D->FGMAR, DMA2D->FGOR, draw_width, draw_height, srcBpp); + __lv_gpu_stm32_dma2d_clean_cache(DMA2D->FGMAR, DMA2D->FGOR, draw_width, draw_height, srcBpp); DMA2D->OPFCCR = LvglColorFormat; #if defined(DMA2D_OPFCCR_RBS_Pos) @@ -519,7 +538,7 @@ LV_STM32_DMA2D_STATIC void _lv_draw_stm32_dma2d_blend_map(const lv_color_t * des DMA2D->BGMAR = DMA2D->OMAR; DMA2D->BGOR = DMA2D->OOR; DMA2D->BGCOLR = 0; // used in A4 and A8 modes only - _lv_gpu_stm32_dma2d_clean_cache(DMA2D->BGMAR, DMA2D->BGOR, draw_width, draw_height, sizeof(lv_color_t)); + __lv_gpu_stm32_dma2d_clean_cache(DMA2D->BGMAR, DMA2D->BGOR, draw_width, draw_height, sizeof(lv_color_t)); } // PL - pixel per lines (14 bit), NL - number of lines (16 bit) @@ -556,7 +575,7 @@ LV_STM32_DMA2D_STATIC void _lv_draw_stm32_dma2d_blend_paint(const lv_color_t * d DMA2D->FGMAR = (uint32_t)(mask_buf + (mask_stride * mask_offset->y) + mask_offset->x); DMA2D->FGOR = mask_stride - draw_width; DMA2D->FGCOLR = lv_color_to32(color) & 0x00ffffff; // swap FGCOLR R/B bits if FGPFCCR.RBS (RBS_BIT) bit is set - _lv_gpu_stm32_dma2d_clean_cache(DMA2D->FGMAR, DMA2D->FGOR, draw_width, draw_height, sizeof(lv_opa_t)); + __lv_gpu_stm32_dma2d_clean_cache(DMA2D->FGMAR, DMA2D->FGOR, draw_width, draw_height, sizeof(lv_opa_t)); DMA2D->BGPFCCR = LvglColorFormat; #if defined(DMA2D_BGPFCCR_RBS_Pos) @@ -565,7 +584,7 @@ LV_STM32_DMA2D_STATIC void _lv_draw_stm32_dma2d_blend_paint(const lv_color_t * d DMA2D->BGMAR = (uint32_t)(dest_buf + (dest_stride * draw_area->y1) + draw_area->x1); DMA2D->BGOR = dest_stride - draw_width; DMA2D->BGCOLR = 0; // used in A4 and A8 modes only - _lv_gpu_stm32_dma2d_clean_cache(DMA2D->BGMAR, DMA2D->BGOR, draw_width, draw_height, sizeof(lv_color_t)); + __lv_gpu_stm32_dma2d_clean_cache(DMA2D->BGMAR, DMA2D->BGOR, draw_width, draw_height, sizeof(lv_color_t)); DMA2D->OPFCCR = LvglColorFormat; #if defined(DMA2D_OPFCCR_RBS_Pos) @@ -602,7 +621,7 @@ LV_STM32_DMA2D_STATIC void _lv_draw_stm32_dma2d_copy_buffer(const lv_color_t * d DMA2D->FGMAR = (uint32_t)(src_buf + (src_stride * src_offset->y) + src_offset->x); DMA2D->FGOR = src_stride - draw_width; DMA2D->FGCOLR = 0; // used in A4 and A8 modes only - _lv_gpu_stm32_dma2d_clean_cache(DMA2D->FGMAR, DMA2D->FGOR, draw_width, draw_height, sizeof(lv_color_t)); + __lv_gpu_stm32_dma2d_clean_cache(DMA2D->FGMAR, DMA2D->FGOR, draw_width, draw_height, sizeof(lv_color_t)); // Note BG* registers do not need to be set up since BG is not used @@ -627,8 +646,8 @@ LV_STM32_DMA2D_STATIC void _lv_gpu_stm32_dma2d_start_dma_transfer(void) DMA2D->IFCR = 0x3FU; // trigger ISR flags reset // Note: cleaning output buffer cache is needed only when buffer may be misaligned or adjacent area may have been drawn in sw-fashion, e.g. using lv_draw_sw_blend_basic() #if LV_COLOR_DEPTH == 16 - _lv_gpu_stm32_dma2d_clean_cache(DMA2D->OMAR, DMA2D->OOR, (DMA2D->NLR & DMA2D_NLR_PL_Msk) >> DMA2D_NLR_PL_Pos, - (DMA2D->NLR & DMA2D_NLR_NL_Msk) >> DMA2D_NLR_NL_Pos, sizeof(lv_color_t)); + __lv_gpu_stm32_dma2d_clean_cache(DMA2D->OMAR, DMA2D->OOR, (DMA2D->NLR & DMA2D_NLR_PL_Msk) >> DMA2D_NLR_PL_Pos, + (DMA2D->NLR & DMA2D_NLR_NL_Msk) >> DMA2D_NLR_NL_Pos, sizeof(lv_color_t)); #endif DMA2D->CR |= DMA2D_CR_START; // Note: for some reason mask buffer gets damaged during transfer if waiting is postponed @@ -660,15 +679,16 @@ LV_STM32_DMA2D_STATIC void _lv_gpu_stm32_dma2d_await_dma_transfer_finish(lv_disp if(isDma2dInProgess) { // invalidate output buffer cached memory ONLY after DMA2D transfer - //_lv_gpu_stm32_dma2d_invalidate_cache(DMA2D->OMAR, DMA2D->OOR, (DMA2D->NLR & DMA2D_NLR_PL_Msk) >> DMA2D_NLR_PL_Pos, (DMA2D->NLR & DMA2D_NLR_NL_Msk) >> DMA2D_NLR_NL_Pos, sizeof(lv_color_t)); + //__lv_gpu_stm32_dma2d_invalidate_cache(DMA2D->OMAR, DMA2D->OOR, (DMA2D->NLR & DMA2D_NLR_PL_Msk) >> DMA2D_NLR_PL_Pos, (DMA2D->NLR & DMA2D_NLR_NL_Msk) >> DMA2D_NLR_NL_Pos, sizeof(lv_color_t)); isDma2dInProgess = false; } } +#if defined (LV_STM32_DMA2D_USE_M7_CACHE) +// Cortex-M7 DCache present LV_STM32_DMA2D_STATIC void _lv_gpu_stm32_dma2d_invalidate_cache(uint32_t address, lv_coord_t offset, lv_coord_t width, lv_coord_t height, uint8_t pixel_size) { -#if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U) if(((SCB->CCR) & SCB_CCR_DC_Msk) == 0) return; // L1 data cache is disabled uint16_t stride = pixel_size * (width + offset); // in bytes uint16_t ll = pixel_size * width; // line length in bytes @@ -694,13 +714,11 @@ LV_STM32_DMA2D_STATIC void _lv_gpu_stm32_dma2d_invalidate_cache(uint32_t address __DSB(); __ISB(); -#endif } LV_STM32_DMA2D_STATIC void _lv_gpu_stm32_dma2d_clean_cache(uint32_t address, lv_coord_t offset, lv_coord_t width, lv_coord_t height, uint8_t pixel_size) { -#if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U) if(((SCB->CCR) & SCB_CCR_DC_Msk) == 0) return; // L1 data cache is disabled uint16_t stride = pixel_size * (width + offset); // in bytes uint16_t ll = pixel_size * width; // line length in bytes @@ -725,9 +743,10 @@ LV_STM32_DMA2D_STATIC void _lv_gpu_stm32_dma2d_clean_cache(uint32_t address, lv_ __DSB(); __ISB(); -#endif } +#endif // LV_STM32_DMA2D_USE_M7_CACHE +#if defined(LV_STM32_DMA2D_TEST) // initialize µs timer LV_STM32_DMA2D_STATIC bool _lv_gpu_stm32_dwt_init(void) { @@ -773,5 +792,5 @@ LV_STM32_DMA2D_STATIC void _lv_gpu_stm32_dwt_reset(void) { DWT->CYCCNT = 0; } - -#endif +#endif // LV_STM32_DMA2D_TEST +#endif // LV_USE_GPU_STM32_DMA2D \ No newline at end of file diff --git a/lib/libesp32_lvgl/lvgl/src/draw/sw/lv_draw_sw_letter.c b/lib/libesp32_lvgl/lvgl/src/draw/sw/lv_draw_sw_letter.c index d0da8bcfc..ee27bc61b 100644 --- a/lib/libesp32_lvgl/lvgl/src/draw/sw/lv_draw_sw_letter.c +++ b/lib/libesp32_lvgl/lvgl/src/draw/sw/lv_draw_sw_letter.c @@ -103,7 +103,7 @@ void lv_draw_sw_letter(lv_draw_ctx_t * draw_ctx, const lv_draw_label_dsc_t * dsc if(letter >= 0x20 && letter != 0xf8ff && /*LV_SYMBOL_DUMMY*/ letter != 0x200c) { /*ZERO WIDTH NON-JOINER*/ - LV_LOG_WARN("lv_draw_letter: glyph dsc. not found for U+%" PRIX32, letter); + LV_LOG_WARN("lv_draw_letter: glyph dsc. not found for U+%" LV_PRIX32, letter); #if LV_USE_FONT_PLACEHOLDER /* draw placeholder */ diff --git a/lib/libesp32_lvgl/lvgl/src/draw/sw/lv_draw_sw_transform.c b/lib/libesp32_lvgl/lvgl/src/draw/sw/lv_draw_sw_transform.c index 204503a4f..9ead7b95c 100644 --- a/lib/libesp32_lvgl/lvgl/src/draw/sw/lv_draw_sw_transform.c +++ b/lib/libesp32_lvgl/lvgl/src/draw/sw/lv_draw_sw_transform.c @@ -273,7 +273,7 @@ static void argb_and_rgb_aa(const uint8_t * src, lv_coord_t src_w, lv_coord_t sr int32_t ys_ups_start = ys_ups; bool has_alpha; int32_t px_size; - lv_color_t ck = {0}; + lv_color_t ck = _LV_COLOR_ZERO_INITIALIZER; switch(cf) { case LV_IMG_CF_TRUE_COLOR: has_alpha = false; diff --git a/lib/libesp32_lvgl/lvgl/src/extra/libs/fsdrv/lv_fs_littlefs.c b/lib/libesp32_lvgl/lvgl/src/extra/libs/fsdrv/lv_fs_littlefs.c new file mode 100644 index 000000000..44261c31d --- /dev/null +++ b/lib/libesp32_lvgl/lvgl/src/extra/libs/fsdrv/lv_fs_littlefs.c @@ -0,0 +1,332 @@ +/** + * @file lv_fs_littlefs.c + * + */ + +/********************* + * INCLUDES + *********************/ +#include "../../../lvgl.h" + +#if LV_USE_FS_LITTLEFS +#include "lfs.h" + +/********************* + * DEFINES + *********************/ + +#if LV_FS_LITTLEFS_LETTER == '\0' + #error "LV_FS_LITTLEFS_LETTER must be an upper case ASCII letter" +#endif + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * STATIC PROTOTYPES + **********************/ + +static void fs_init(void); + +static void * fs_open(lv_fs_drv_t * drv, const char * path, lv_fs_mode_t mode); +static lv_fs_res_t fs_close(lv_fs_drv_t * drv, void * file_p); + +static lv_fs_res_t fs_read(lv_fs_drv_t * drv, void * file_p, void * buf, uint32_t btr, uint32_t * br); +static lv_fs_res_t fs_write(lv_fs_drv_t * drv, void * file_p, const void * buf, uint32_t btw, uint32_t * bw); + +static lv_fs_res_t fs_seek(lv_fs_drv_t * drv, void * file_p, uint32_t pos, lv_fs_whence_t whence); +static lv_fs_res_t fs_tell(lv_fs_drv_t * drv, void * file_p, uint32_t * pos_p); + +static void * fs_dir_open(lv_fs_drv_t * drv, const char * path); +static lv_fs_res_t fs_dir_read(lv_fs_drv_t * drv, void * dir_p, char * fn); +static lv_fs_res_t fs_dir_close(lv_fs_drv_t * drv, void * dir_p); + +/********************** + * STATIC VARIABLES + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +/********************** + * GLOBAL FUNCTIONS + **********************/ + +void lv_fs_littlefs_init(void) +{ + /*---------------------------------------------------- + * Initialize your storage device and File System + * -------------------------------------------------*/ + fs_init(); + + /*--------------------------------------------------- + * Register the file system interface in LVGL + *--------------------------------------------------*/ + + /*Add a simple drive to open images*/ + static lv_fs_drv_t fs_drv; /*A driver descriptor*/ + lv_fs_drv_init(&fs_drv); + + /*Set up fields...*/ + fs_drv.letter = LV_FS_LITTLEFS_LETTER; + fs_drv.cache_size = LV_FS_LITTLEFS_CACHE_SIZE; + + fs_drv.open_cb = fs_open; + fs_drv.close_cb = fs_close; + fs_drv.read_cb = fs_read; + fs_drv.write_cb = fs_write; + fs_drv.seek_cb = fs_seek; + fs_drv.tell_cb = fs_tell; + + fs_drv.dir_open_cb = fs_dir_open; + fs_drv.dir_close_cb = fs_dir_close; + fs_drv.dir_read_cb = fs_dir_read; + + /*#if LV_USE_USER_DATA*/ + fs_drv.user_data = NULL; + /*#endif*/ + + lv_fs_drv_register(&fs_drv); +} + +/** + * Convenience function to attach registered driver to lfs_t structure by driver-label + * @param label the label assigned to the driver when it was registered + * @param lfs_p the pointer to the lfs_t structure initialized by external code/library + * @return pointer to a driver descriptor or NULL on error + */ +lv_fs_drv_t * lv_fs_littlefs_set_driver(char label, void * lfs_p) +{ + lv_fs_drv_t * drv_p = lv_fs_get_drv(label); + if(drv_p != NULL) drv_p->user_data = (lfs_t *) lfs_p; + return drv_p; +} + +/********************** + * STATIC FUNCTIONS + **********************/ + +/*Initialize your Storage device and File system.*/ +static void fs_init(void) +{ + /* Initialize the internal flash or SD-card and LittleFS itself. + * Better to do it in your code to keep this library untouched for easy updating */ +} + +/** + * Open a file + * @param drv pointer to a driver where this function belongs + * @param path path to the file beginning with the driver letter (e.g. S:/folder/file.txt) + * @param mode read: FS_MODE_RD, write: FS_MODE_WR, both: FS_MODE_RD | FS_MODE_WR + * @return pointer to a file descriptor or NULL on error + */ +static void * fs_open(lv_fs_drv_t * drv, const char * path, lv_fs_mode_t mode) +{ + lfs_t * lfs_p = drv->user_data; + uint32_t flags = 0; + + flags = mode == LV_FS_MODE_RD ? LFS_O_RDONLY + : mode == LV_FS_MODE_WR ? LFS_O_WRONLY + : mode == (LV_FS_MODE_WR | LV_FS_MODE_RD) ? LFS_O_RDWR : 0; + + lfs_file_t * file_p = lv_mem_alloc(sizeof(lfs_file_t)); + if(file_p == NULL) return NULL; + + int result = lfs_file_open(lfs_p, file_p, path, flags); + + if(result != LFS_ERR_OK) { + lv_mem_free(file_p); + return NULL; + } + + return file_p; +} + +/** + * Close an opened file + * @param drv pointer to a driver where this function belongs + * @param file_p pointer to a file_t variable. (opened with fs_open) + * @return LV_FS_RES_OK: no error or any error from @lv_fs_res_t enum + */ +static lv_fs_res_t fs_close(lv_fs_drv_t * drv, void * file_p) +{ + lfs_t * lfs_p = drv->user_data; + + int result = lfs_file_close(lfs_p, file_p); + lv_mem_free(file_p); + /*lv_mem_free( lfs_p );*/ /*allocated and freed by outside-code*/ + + if(result != LFS_ERR_OK) return LV_FS_RES_UNKNOWN; + return LV_FS_RES_OK; +} + +/** + * Read data from an opened file + * @param drv pointer to a driver where this function belongs + * @param file_p pointer to a file_t variable. + * @param buf pointer to a memory block where to store the read data + * @param btr number of Bytes To Read + * @param br the real number of read bytes (Byte Read) + * @return LV_FS_RES_OK: no error or any error from @lv_fs_res_t enum + */ +static lv_fs_res_t fs_read(lv_fs_drv_t * drv, void * file_p, void * buf, uint32_t btr, uint32_t * br) +{ + lfs_t * lfs_p = drv->user_data; + + lfs_ssize_t result = lfs_file_read(lfs_p, file_p, buf, btr); + if(result < 0) return LV_FS_RES_UNKNOWN; + + *br = (uint32_t) result; + return LV_FS_RES_OK; +} + +/** + * Write into a file + * @param drv pointer to a driver where this function belongs + * @param file_p pointer to a file_t variable + * @param buf pointer to a buffer with the bytes to write + * @param btw Bytes To Write + * @param bw the number of real written bytes (Bytes Written). NULL if unused. + * @return LV_FS_RES_OK: no error or any error from @lv_fs_res_t enum + */ +static lv_fs_res_t fs_write(lv_fs_drv_t * drv, void * file_p, const void * buf, uint32_t btw, uint32_t * bw) +{ +#ifndef LFS_READONLY + lfs_t * lfs_p = drv->user_data; + + lfs_ssize_t result = lfs_file_write(lfs_p, file_p, buf, btw); + if(result < 0 || lfs_file_sync(lfs_p, file_p) < 0) return LV_FS_RES_UNKNOWN; + + *bw = (uint32_t) result; + return LV_FS_RES_OK; +#else + return LV_FS_RES_NOT_IMP; +#endif +} + +/** + * Set the read write pointer. Also expand the file size if necessary. + * @param drv pointer to a driver where this function belongs + * @param file_p pointer to a file_t variable. (opened with fs_open ) + * @param pos the new position of read write pointer + * @param whence tells from where to interpret the `pos`. See @lv_fs_whence_t + * @return LV_FS_RES_OK: no error or any error from @lv_fs_res_t enum + */ +static lv_fs_res_t fs_seek(lv_fs_drv_t * drv, void * file_p, uint32_t pos, lv_fs_whence_t whence) +{ + lfs_t * lfs_p = drv->user_data; + + int lfs_whence = whence == LV_FS_SEEK_SET ? LFS_SEEK_SET + : whence == LV_FS_SEEK_CUR ? LFS_SEEK_CUR + : whence == LV_FS_SEEK_END ? LFS_SEEK_END : 0; + + lfs_soff_t result = lfs_file_seek(lfs_p, file_p, pos, lfs_whence); + if(result < 0) return LV_FS_RES_UNKNOWN; + + /*pos = result;*/ /*not supported by lv_fs*/ + return LV_FS_RES_OK; +} + +/** + * Give the position of the read write pointer + * @param drv pointer to a driver where this function belongs + * @param file_p pointer to a file_t variable. + * @param pos_p pointer to where to store the result + * @return LV_FS_RES_OK: no error or any error from @lv_fs_res_t enum + */ +static lv_fs_res_t fs_tell(lv_fs_drv_t * drv, void * file_p, uint32_t * pos_p) +{ + lfs_t * lfs_p = drv->user_data; + + lfs_soff_t result = lfs_file_tell(lfs_p, file_p); + if(result < 0) return LV_FS_RES_UNKNOWN; + + *pos_p = (uint32_t) result; + return LV_FS_RES_OK; +} + +/** + * Initialize a 'lv_fs_dir_t' variable for directory reading + * @param drv pointer to a driver where this function belongs + * @param path path to a directory + * @return pointer to the directory read descriptor or NULL on error + */ +static void * fs_dir_open(lv_fs_drv_t * drv, const char * path) +{ + lfs_t * lfs_p = drv->user_data; + + lfs_dir_t * dir_p = lv_mem_alloc(sizeof(lfs_dir_t)); + if(dir_p == NULL) return NULL; + + int result = lfs_dir_open(lfs_p, dir_p, path); + if(result != LFS_ERR_OK) { + lv_mem_free(dir_p); + return NULL; + } + + return dir_p; +} + +/** + * Read the next filename form a directory. + * The name of the directories will begin with '/' + * @param drv pointer to a driver where this function belongs + * @param rddir_p pointer to an initialized 'lv_fs_dir_t' variable + * @param fn pointer to a buffer to store the filename + * @return LV_FS_RES_OK: no error or any error from @lv_fs_res_t enum + */ +static lv_fs_res_t fs_dir_read(lv_fs_drv_t * drv, void * rddir_p, char * fn) +{ + lfs_t * lfs_p = drv->user_data; + struct lfs_info info; + int result; + + info.name[0] = '\0'; + + do { + result = lfs_dir_read(lfs_p, rddir_p, &info); + if(result > 0) { + if(info.type == LFS_TYPE_DIR) { + fn[0] = '/'; + strcpy(&fn[1], info.name); + } + else strcpy(fn, info.name); + } + else if(result == 0) fn[0] = '\0'; /*dir-scan ended*/ + else return LV_FS_RES_UNKNOWN; + + } while(!strcmp(fn, "/.") || !strcmp(fn, "/..")); + + return LV_FS_RES_OK; +} + +/** + * Close the directory reading + * @param drv pointer to a driver where this function belongs + * @param rddir_p pointer to an initialized 'lv_fs_dir_t' variable + * @return LV_FS_RES_OK: no error or any error from @lv_fs_res_t enum + */ +static lv_fs_res_t fs_dir_close(lv_fs_drv_t * drv, void * rddir_p) +{ + lfs_t * lfs_p = drv->user_data; + + int result = lfs_dir_close(lfs_p, rddir_p); + lv_mem_free(rddir_p); + + if(result != LFS_ERR_OK) return LV_FS_RES_UNKNOWN; + return LV_FS_RES_OK; +} + +#else /*LV_USE_FS_LITTLEFS == 0*/ + +#if defined(LV_FS_LITTLEFS_LETTER) && LV_FS_LITTLEFS_LETTER != '\0' + #warning "LV_USE_FS_LITTLEFS is not enabled but LV_FS_LITTLEFS_LETTER is set" +#endif + +#endif /*LV_USE_FS_POSIX*/ diff --git a/lib/libesp32_lvgl/lvgl/src/extra/libs/fsdrv/lv_fsdrv.h b/lib/libesp32_lvgl/lvgl/src/extra/libs/fsdrv/lv_fsdrv.h index 285d598fd..b864ad6f3 100644 --- a/lib/libesp32_lvgl/lvgl/src/extra/libs/fsdrv/lv_fsdrv.h +++ b/lib/libesp32_lvgl/lvgl/src/extra/libs/fsdrv/lv_fsdrv.h @@ -31,6 +31,11 @@ extern "C" { void lv_fs_fatfs_init(void); #endif +#if LV_USE_FS_LITTLEFS != '\0' +void lv_fs_littlefs_init(void); +lv_fs_drv_t * lv_fs_littlefs_set_driver(char label, void * lfs_p); +#endif + #if LV_USE_FS_STDIO != '\0' void lv_fs_stdio_init(void); #endif diff --git a/lib/libesp32_lvgl/lvgl/src/extra/libs/lv_libs.h b/lib/libesp32_lvgl/lvgl/src/extra/libs/lv_libs.h index 6782b1d08..1fefe6c11 100644 --- a/lib/libesp32_lvgl/lvgl/src/extra/libs/lv_libs.h +++ b/lib/libesp32_lvgl/lvgl/src/extra/libs/lv_libs.h @@ -22,6 +22,7 @@ extern "C" { #include "freetype/lv_freetype.h" #include "rlottie/lv_rlottie.h" #include "ffmpeg/lv_ffmpeg.h" +#include "tiny_ttf/lv_tiny_ttf.h" /********************* * DEFINES diff --git a/lib/libesp32_lvgl/lvgl/src/extra/libs/qrcode/qrcodegen.c b/lib/libesp32_lvgl/lvgl/src/extra/libs/qrcode/qrcodegen.c index 37ee74233..bd9f08b36 100644 --- a/lib/libesp32_lvgl/lvgl/src/extra/libs/qrcode/qrcodegen.c +++ b/lib/libesp32_lvgl/lvgl/src/extra/libs/qrcode/qrcodegen.c @@ -21,11 +21,11 @@ * Software. */ -#include #include #include #include #include "qrcodegen.h" +#include "../../../misc/lv_assert.h" #ifndef QRCODEGEN_TEST #define testable static // Keep functions private @@ -127,12 +127,12 @@ static const int PENALTY_N4 = 10; // Public function - see documentation comment in header file. bool qrcodegen_encodeText(const char *text, uint8_t tempBuffer[], uint8_t qrcode[], enum qrcodegen_Ecc ecl, int minVersion, int maxVersion, enum qrcodegen_Mask mask, bool boostEcl) { - + size_t textLen = strlen(text); if (textLen == 0) return qrcodegen_encodeSegmentsAdvanced(NULL, 0, ecl, minVersion, maxVersion, mask, boostEcl, tempBuffer, qrcode); size_t bufLen = qrcodegen_BUFFER_LEN_FOR_VERSION(maxVersion); - + struct qrcodegen_Segment seg; if (qrcodegen_isNumeric(text)) { if (qrcodegen_calcSegmentBufferSize(qrcodegen_Mode_NUMERIC, textLen) > bufLen) @@ -155,7 +155,7 @@ bool qrcodegen_encodeText(const char *text, uint8_t tempBuffer[], uint8_t qrcode seg.data = tempBuffer; } return qrcodegen_encodeSegmentsAdvanced(&seg, 1, ecl, minVersion, maxVersion, mask, boostEcl, tempBuffer, qrcode); - + fail: qrcode[0] = 0; // Set size to invalid value for safety return false; @@ -165,7 +165,7 @@ fail: // Public function - see documentation comment in header file. bool qrcodegen_encodeBinary(uint8_t dataAndTemp[], size_t dataLen, uint8_t qrcode[], enum qrcodegen_Ecc ecl, int minVersion, int maxVersion, enum qrcodegen_Mask mask, bool boostEcl) { - + struct qrcodegen_Segment seg; seg.mode = qrcodegen_Mode_BYTE; seg.bitLength = calcSegmentBitLength(seg.mode, dataLen); @@ -182,7 +182,7 @@ bool qrcodegen_encodeBinary(uint8_t dataAndTemp[], size_t dataLen, uint8_t qrcod // Appends the given number of low-order bits of the given value to the given byte-based // bit buffer, increasing the bit length. Requires 0 <= numBits <= 16 and val < 2^numBits. testable void appendBitsToBuffer(unsigned int val, int numBits, uint8_t buffer[], int *bitLen) { - assert(0 <= numBits && numBits <= 16 && (unsigned long)val >> numBits == 0); + LV_ASSERT(0 <= numBits && numBits <= 16 && (unsigned long)val >> numBits == 0); for (int i = numBits - 1; i >= 0; i--, (*bitLen)++) buffer[*bitLen >> 3] |= ((val >> i) & 1) << (7 - (*bitLen & 7)); } @@ -202,10 +202,10 @@ bool qrcodegen_encodeSegments(const struct qrcodegen_Segment segs[], size_t len, // Public function - see documentation comment in header file. bool qrcodegen_encodeSegmentsAdvanced(const struct qrcodegen_Segment segs[], size_t len, enum qrcodegen_Ecc ecl, int minVersion, int maxVersion, int mask, bool boostEcl, uint8_t tempBuffer[], uint8_t qrcode[]) { - assert(segs != NULL || len == 0); - assert(qrcodegen_VERSION_MIN <= minVersion && minVersion <= maxVersion && maxVersion <= qrcodegen_VERSION_MAX); - assert(0 <= (int)ecl && (int)ecl <= 3 && -1 <= (int)mask && (int)mask <= 7); - + LV_ASSERT(segs != NULL || len == 0); + LV_ASSERT(qrcodegen_VERSION_MIN <= minVersion && minVersion <= maxVersion && maxVersion <= qrcodegen_VERSION_MAX); + LV_ASSERT(0 <= (int)ecl && (int)ecl <= 3 && -1 <= (int)mask && (int)mask <= 7); + // Find the minimal version number to use int version, dataUsedBits; for (version = minVersion; ; version++) { @@ -218,14 +218,14 @@ bool qrcodegen_encodeSegmentsAdvanced(const struct qrcodegen_Segment segs[], siz return false; } } - assert(dataUsedBits != -1); - + LV_ASSERT(dataUsedBits != -1); + // Increase the error correction level while the data still fits in the current version number for (int i = (int)qrcodegen_Ecc_MEDIUM; i <= (int)qrcodegen_Ecc_HIGH; i++) { // From low to high if (boostEcl && dataUsedBits <= getNumDataCodewords(version, (enum qrcodegen_Ecc)i) * 8) ecl = (enum qrcodegen_Ecc)i; } - + // Concatenate all segments to create the data bit string memset(qrcode, 0, qrcodegen_BUFFER_LEN_FOR_VERSION(version) * sizeof(qrcode[0])); int bitLen = 0; @@ -236,29 +236,29 @@ bool qrcodegen_encodeSegmentsAdvanced(const struct qrcodegen_Segment segs[], siz for (int j = 0; j < seg->bitLength; j++) appendBitsToBuffer((seg->data[j >> 3] >> (7 - (j & 7))) & 1, 1, qrcode, &bitLen); } - assert(bitLen == dataUsedBits); - + LV_ASSERT(bitLen == dataUsedBits); + // Add terminator and pad up to a byte if applicable int dataCapacityBits = getNumDataCodewords(version, ecl) * 8; - assert(bitLen <= dataCapacityBits); + LV_ASSERT(bitLen <= dataCapacityBits); int terminatorBits = dataCapacityBits - bitLen; if (terminatorBits > 4) terminatorBits = 4; appendBitsToBuffer(0, terminatorBits, qrcode, &bitLen); appendBitsToBuffer(0, (8 - bitLen % 8) % 8, qrcode, &bitLen); - assert(bitLen % 8 == 0); - + LV_ASSERT(bitLen % 8 == 0); + // Pad with alternating bytes until data capacity is reached for (uint8_t padByte = 0xEC; bitLen < dataCapacityBits; padByte ^= 0xEC ^ 0x11) appendBitsToBuffer(padByte, 8, qrcode, &bitLen); - + // Draw function and data codeword modules addEccAndInterleave(qrcode, version, ecl, tempBuffer); initializeFunctionModules(version, qrcode); drawCodewords(tempBuffer, getNumRawDataModules(version) / 8, qrcode); drawWhiteFunctionModules(qrcode, version); initializeFunctionModules(version, tempBuffer); - + // Handle masking if (mask == qrcodegen_Mask_AUTO) { // Automatically choose best mask long minPenalty = LONG_MAX; @@ -274,7 +274,7 @@ bool qrcodegen_encodeSegmentsAdvanced(const struct qrcodegen_Segment segs[], siz applyMask(tempBuffer, qrcode, msk); // Undoes the mask due to XOR } } - assert(0 <= (int)mask && (int)mask <= 7); + LV_ASSERT(0 <= (int)mask && (int)mask <= 7); applyMask(tempBuffer, qrcode, mask); drawFormatBits(ecl, mask, qrcode); return true; @@ -290,14 +290,14 @@ bool qrcodegen_encodeSegmentsAdvanced(const struct qrcodegen_Segment segs[], siz // be clobbered by this function. The final answer is stored in result[0 : rawCodewords]. testable void addEccAndInterleave(uint8_t data[], int version, enum qrcodegen_Ecc ecl, uint8_t result[]) { // Calculate parameter numbers - assert(0 <= (int)ecl && (int)ecl < 4 && qrcodegen_VERSION_MIN <= version && version <= qrcodegen_VERSION_MAX); + LV_ASSERT(0 <= (int)ecl && (int)ecl < 4 && qrcodegen_VERSION_MIN <= version && version <= qrcodegen_VERSION_MAX); int numBlocks = NUM_ERROR_CORRECTION_BLOCKS[(int)ecl][version]; int blockEccLen = ECC_CODEWORDS_PER_BLOCK [(int)ecl][version]; int rawCodewords = getNumRawDataModules(version) / 8; int dataLen = getNumDataCodewords(version, ecl); int numShortBlocks = numBlocks - rawCodewords % numBlocks; int shortBlockDataLen = rawCodewords / numBlocks - blockEccLen; - + // Split data into blocks, calculate ECC, and interleave // (not concatenate) the bytes into a single sequence uint8_t generator[qrcodegen_REED_SOLOMON_DEGREE_MAX]; @@ -323,7 +323,7 @@ testable void addEccAndInterleave(uint8_t data[], int version, enum qrcodegen_Ec // for the given version number and error correction level. The result is in the range [9, 2956]. testable int getNumDataCodewords(int version, enum qrcodegen_Ecc ecl) { int v = version, e = (int)ecl; - assert(0 <= e && e < 4); + LV_ASSERT(0 <= e && e < 4); return getNumRawDataModules(v) / 8 - ECC_CODEWORDS_PER_BLOCK [e][v] * NUM_ERROR_CORRECTION_BLOCKS[e][v]; @@ -334,7 +334,7 @@ testable int getNumDataCodewords(int version, enum qrcodegen_Ecc ecl) { // all function modules are excluded. This includes remainder bits, so it might not be a multiple of 8. // The result is in the range [208, 29648]. This could be implemented as a 40-entry lookup table. testable int getNumRawDataModules(int ver) { - assert(qrcodegen_VERSION_MIN <= ver && ver <= qrcodegen_VERSION_MAX); + LV_ASSERT(qrcodegen_VERSION_MIN <= ver && ver <= qrcodegen_VERSION_MAX); int result = (16 * ver + 128) * ver + 64; if (ver >= 2) { int numAlign = ver / 7 + 2; @@ -352,10 +352,10 @@ testable int getNumRawDataModules(int ver) { // Calculates the Reed-Solomon generator polynomial of the given degree, storing in result[0 : degree]. testable void calcReedSolomonGenerator(int degree, uint8_t result[]) { // Start with the monomial x^0 - assert(1 <= degree && degree <= qrcodegen_REED_SOLOMON_DEGREE_MAX); + LV_ASSERT(1 <= degree && degree <= qrcodegen_REED_SOLOMON_DEGREE_MAX); memset(result, 0, degree * sizeof(result[0])); result[degree - 1] = 1; - + // Compute the product polynomial (x - r^0) * (x - r^1) * (x - r^2) * ... * (x - r^{degree-1}), // drop the highest term, and store the rest of the coefficients in order of descending powers. // Note that r = 0x02, which is a generator element of this field GF(2^8/0x11D). @@ -376,9 +376,9 @@ testable void calcReedSolomonGenerator(int degree, uint8_t result[]) { // polynomials are in big endian and the generator has an implicit leading 1 term, storing the result in result[0 : degree]. testable void calcReedSolomonRemainder(const uint8_t data[], int dataLen, const uint8_t generator[], int degree, uint8_t result[]) { - + // Perform polynomial division - assert(1 <= degree && degree <= qrcodegen_REED_SOLOMON_DEGREE_MAX); + LV_ASSERT(1 <= degree && degree <= qrcodegen_REED_SOLOMON_DEGREE_MAX); memset(result, 0, degree * sizeof(result[0])); for (int i = 0; i < dataLen; i++) { uint8_t factor = data[i] ^ result[0]; @@ -415,16 +415,16 @@ testable void initializeFunctionModules(int version, uint8_t qrcode[]) { int qrsize = version * 4 + 17; memset(qrcode, 0, ((qrsize * qrsize + 7) / 8 + 1) * sizeof(qrcode[0])); qrcode[0] = (uint8_t)qrsize; - + // Fill horizontal and vertical timing patterns fillRectangle(6, 0, 1, qrsize, qrcode); fillRectangle(0, 6, qrsize, 1, qrcode); - + // Fill 3 finder patterns (all corners except bottom right) and format bits fillRectangle(0, 0, 9, 9, qrcode); fillRectangle(qrsize - 8, 0, 8, 9, qrcode); fillRectangle(0, qrsize - 8, 9, 8, qrcode); - + // Fill numerous alignment patterns uint8_t alignPatPos[7]; int numAlign = getAlignmentPatternPositions(version, alignPatPos); @@ -435,7 +435,7 @@ testable void initializeFunctionModules(int version, uint8_t qrcode[]) { fillRectangle(alignPatPos[i] - 2, alignPatPos[j] - 2, 5, 5, qrcode); } } - + // Fill version blocks if (version >= 7) { fillRectangle(qrsize - 11, 0, 3, 6, qrcode); @@ -454,7 +454,7 @@ static void drawWhiteFunctionModules(uint8_t qrcode[], int version) { setModule(qrcode, 6, i, false); setModule(qrcode, i, 6, false); } - + // Draw 3 finder patterns (all corners except bottom right; overwrites some timing modules) for (int dy = -4; dy <= 4; dy++) { for (int dx = -4; dx <= 4; dx++) { @@ -468,7 +468,7 @@ static void drawWhiteFunctionModules(uint8_t qrcode[], int version) { } } } - + // Draw numerous alignment patterns uint8_t alignPatPos[7]; int numAlign = getAlignmentPatternPositions(version, alignPatPos); @@ -482,7 +482,7 @@ static void drawWhiteFunctionModules(uint8_t qrcode[], int version) { } } } - + // Draw version blocks if (version >= 7) { // Calculate error correction code and pack bits @@ -490,8 +490,8 @@ static void drawWhiteFunctionModules(uint8_t qrcode[], int version) { for (int i = 0; i < 12; i++) rem = (rem << 1) ^ ((rem >> 11) * 0x1F25); long bits = (long)version << 12 | rem; // uint18 - assert(bits >> 18 == 0); - + LV_ASSERT(bits >> 18 == 0); + // Draw two copies for (int i = 0; i < 6; i++) { for (int j = 0; j < 3; j++) { @@ -510,15 +510,15 @@ static void drawWhiteFunctionModules(uint8_t qrcode[], int version) { // the format bits, unlike drawWhiteFunctionModules() which might skip black modules. static void drawFormatBits(enum qrcodegen_Ecc ecl, enum qrcodegen_Mask mask, uint8_t qrcode[]) { // Calculate error correction code and pack bits - assert(0 <= (int)mask && (int)mask <= 7); + LV_ASSERT(0 <= (int)mask && (int)mask <= 7); static const int table[] = {1, 0, 3, 2}; int data = table[(int)ecl] << 3 | (int)mask; // errCorrLvl is uint2, mask is uint3 int rem = data; for (int i = 0; i < 10; i++) rem = (rem << 1) ^ ((rem >> 9) * 0x537); int bits = (data << 10 | rem) ^ 0x5412; // uint15 - assert(bits >> 15 == 0); - + LV_ASSERT(bits >> 15 == 0); + // Draw first copy for (int i = 0; i <= 5; i++) setModule(qrcode, 8, i, getBit(bits, i)); @@ -527,7 +527,7 @@ static void drawFormatBits(enum qrcodegen_Ecc ecl, enum qrcodegen_Mask mask, uin setModule(qrcode, 7, 8, getBit(bits, 8)); for (int i = 9; i < 15; i++) setModule(qrcode, 14 - i, 8, getBit(bits, i)); - + // Draw second copy int qrsize = qrcodegen_getSize(qrcode); for (int i = 0; i < 8; i++) @@ -591,7 +591,7 @@ static void drawCodewords(const uint8_t data[], int dataLen, uint8_t qrcode[]) { } } } - assert(i == dataLen * 8); + LV_ASSERT(i == dataLen * 8); } @@ -601,7 +601,7 @@ static void drawCodewords(const uint8_t data[], int dataLen, uint8_t qrcode[]) { // the same mask value a second time will undo the mask. A final well-formed // QR Code needs exactly one (not zero, two, etc.) mask applied. static void applyMask(const uint8_t functionModules[], uint8_t qrcode[], enum qrcodegen_Mask mask) { - assert(0 <= (int)mask && (int)mask <= 7); // Disallows qrcodegen_Mask_AUTO + LV_ASSERT(0 <= (int)mask && (int)mask <= 7); // Disallows qrcodegen_Mask_AUTO int qrsize = qrcodegen_getSize(qrcode); for (int y = 0; y < qrsize; y++) { for (int x = 0; x < qrsize; x++) { @@ -617,7 +617,7 @@ static void applyMask(const uint8_t functionModules[], uint8_t qrcode[], enum qr case 5: invert = x * y % 2 + x * y % 3 == 0; break; case 6: invert = (x * y % 2 + x * y % 3) % 2 == 0; break; case 7: invert = ((x + y) % 2 + x * y % 3) % 2 == 0; break; - default: assert(false); return; + default: LV_ASSERT(false); return; } bool val = getModule(qrcode, x, y); setModule(qrcode, x, y, val ^ invert); @@ -631,7 +631,7 @@ static void applyMask(const uint8_t functionModules[], uint8_t qrcode[], enum qr static long getPenaltyScore(const uint8_t qrcode[]) { int qrsize = qrcodegen_getSize(qrcode); long result = 0; - + // Adjacent modules in row having same color, and finder-like patterns for (int y = 0; y < qrsize; y++) { unsigned char runHistory[7] = {0}; @@ -684,7 +684,7 @@ static long getPenaltyScore(const uint8_t qrcode[]) { if (hasFinderLikePattern(runHistory)) result += PENALTY_N3; } - + // 2*2 blocks of modules having same color for (int y = 0; y < qrsize - 1; y++) { for (int x = 0; x < qrsize - 1; x++) { @@ -695,7 +695,7 @@ static long getPenaltyScore(const uint8_t qrcode[]) { result += PENALTY_N2; } } - + // Balance of black and white modules int black = 0; for (int y = 0; y < qrsize; y++) { @@ -737,9 +737,9 @@ static bool hasFinderLikePattern(const unsigned char runHistory[7]) { // Public function - see documentation comment in header file. int qrcodegen_getSize(const uint8_t qrcode[]) { - assert(qrcode != NULL); + LV_ASSERT(qrcode != NULL); int result = qrcode[0]; - assert((qrcodegen_VERSION_MIN * 4 + 17) <= result + LV_ASSERT((qrcodegen_VERSION_MIN * 4 + 17) <= result && result <= (qrcodegen_VERSION_MAX * 4 + 17)); return result; } @@ -747,7 +747,7 @@ int qrcodegen_getSize(const uint8_t qrcode[]) { // Public function - see documentation comment in header file. bool qrcodegen_getModule(const uint8_t qrcode[], int x, int y) { - assert(qrcode != NULL); + LV_ASSERT(qrcode != NULL); int qrsize = qrcode[0]; return (0 <= x && x < qrsize && 0 <= y && y < qrsize) && getModule(qrcode, x, y); } @@ -756,7 +756,7 @@ bool qrcodegen_getModule(const uint8_t qrcode[], int x, int y) { // Gets the module at the given coordinates, which must be in bounds. testable bool getModule(const uint8_t qrcode[], int x, int y) { int qrsize = qrcode[0]; - assert(21 <= qrsize && qrsize <= 177 && 0 <= x && x < qrsize && 0 <= y && y < qrsize); + LV_ASSERT(21 <= qrsize && qrsize <= 177 && 0 <= x && x < qrsize && 0 <= y && y < qrsize); int index = y * qrsize + x; return getBit(qrcode[(index >> 3) + 1], index & 7); } @@ -765,7 +765,7 @@ testable bool getModule(const uint8_t qrcode[], int x, int y) { // Sets the module at the given coordinates, which must be in bounds. testable void setModule(uint8_t qrcode[], int x, int y, bool isBlack) { int qrsize = qrcode[0]; - assert(21 <= qrsize && qrsize <= 177 && 0 <= x && x < qrsize && 0 <= y && y < qrsize); + LV_ASSERT(21 <= qrsize && qrsize <= 177 && 0 <= x && x < qrsize && 0 <= y && y < qrsize); int index = y * qrsize + x; int bitIndex = index & 7; int byteIndex = (index >> 3) + 1; @@ -795,7 +795,7 @@ static bool getBit(int x, int i) { // Public function - see documentation comment in header file. bool qrcodegen_isAlphanumeric(const char *text) { - assert(text != NULL); + LV_ASSERT(text != NULL); for (; *text != '\0'; text++) { if (strchr(ALPHANUMERIC_CHARSET, *text) == NULL) return false; @@ -806,7 +806,7 @@ bool qrcodegen_isAlphanumeric(const char *text) { // Public function - see documentation comment in header file. bool qrcodegen_isNumeric(const char *text) { - assert(text != NULL); + LV_ASSERT(text != NULL); for (; *text != '\0'; text++) { if (*text < '0' || *text > '9') return false; @@ -820,7 +820,7 @@ size_t qrcodegen_calcSegmentBufferSize(enum qrcodegen_Mode mode, size_t numChars int temp = calcSegmentBitLength(mode, numChars); if (temp == -1) return SIZE_MAX; - assert(0 <= temp && temp <= INT16_MAX); + LV_ASSERT(0 <= temp && temp <= INT16_MAX); return ((size_t)temp + 7) / 8; } @@ -849,10 +849,10 @@ testable int calcSegmentBitLength(enum qrcodegen_Mode mode, size_t numChars) { else if (mode == qrcodegen_Mode_ECI && numChars == 0) result = 3 * 8; else { // Invalid argument - assert(false); + LV_ASSERT(false); return -1; } - assert(result >= 0); + LV_ASSERT(result >= 0); if ((unsigned int)result > (unsigned int)INT16_MAX) return -1; return (int)result; @@ -861,11 +861,11 @@ testable int calcSegmentBitLength(enum qrcodegen_Mode mode, size_t numChars) { // Public function - see documentation comment in header file. struct qrcodegen_Segment qrcodegen_makeBytes(const uint8_t data[], size_t len, uint8_t buf[]) { - assert(data != NULL || len == 0); + LV_ASSERT(data != NULL || len == 0); struct qrcodegen_Segment result; result.mode = qrcodegen_Mode_BYTE; result.bitLength = calcSegmentBitLength(result.mode, len); - assert(result.bitLength != -1); + LV_ASSERT(result.bitLength != -1); result.numChars = (int)len; if (len > 0) memcpy(buf, data, len * sizeof(buf[0])); @@ -876,22 +876,22 @@ struct qrcodegen_Segment qrcodegen_makeBytes(const uint8_t data[], size_t len, u // Public function - see documentation comment in header file. struct qrcodegen_Segment qrcodegen_makeNumeric(const char *digits, uint8_t buf[]) { - assert(digits != NULL); + LV_ASSERT(digits != NULL); struct qrcodegen_Segment result; size_t len = strlen(digits); result.mode = qrcodegen_Mode_NUMERIC; int bitLen = calcSegmentBitLength(result.mode, len); - assert(bitLen != -1); + LV_ASSERT(bitLen != -1); result.numChars = (int)len; if (bitLen > 0) memset(buf, 0, ((size_t)bitLen + 7) / 8 * sizeof(buf[0])); result.bitLength = 0; - + unsigned int accumData = 0; int accumCount = 0; for (; *digits != '\0'; digits++) { char c = *digits; - assert('0' <= c && c <= '9'); + LV_ASSERT('0' <= c && c <= '9'); accumData = accumData * 10 + (unsigned int)(c - '0'); accumCount++; if (accumCount == 3) { @@ -902,7 +902,7 @@ struct qrcodegen_Segment qrcodegen_makeNumeric(const char *digits, uint8_t buf[] } if (accumCount > 0) // 1 or 2 digits remaining appendBitsToBuffer(accumData, accumCount * 3 + 1, buf, &result.bitLength); - assert(result.bitLength == bitLen); + LV_ASSERT(result.bitLength == bitLen); result.data = buf; return result; } @@ -910,22 +910,22 @@ struct qrcodegen_Segment qrcodegen_makeNumeric(const char *digits, uint8_t buf[] // Public function - see documentation comment in header file. struct qrcodegen_Segment qrcodegen_makeAlphanumeric(const char *text, uint8_t buf[]) { - assert(text != NULL); + LV_ASSERT(text != NULL); struct qrcodegen_Segment result; size_t len = strlen(text); result.mode = qrcodegen_Mode_ALPHANUMERIC; int bitLen = calcSegmentBitLength(result.mode, len); - assert(bitLen != -1); + LV_ASSERT(bitLen != -1); result.numChars = (int)len; if (bitLen > 0) memset(buf, 0, ((size_t)bitLen + 7) / 8 * sizeof(buf[0])); result.bitLength = 0; - + unsigned int accumData = 0; int accumCount = 0; for (; *text != '\0'; text++) { const char *temp = strchr(ALPHANUMERIC_CHARSET, *text); - assert(temp != NULL); + LV_ASSERT(temp != NULL); accumData = accumData * 45 + (unsigned int)(temp - ALPHANUMERIC_CHARSET); accumCount++; if (accumCount == 2) { @@ -936,7 +936,7 @@ struct qrcodegen_Segment qrcodegen_makeAlphanumeric(const char *text, uint8_t bu } if (accumCount > 0) // 1 character remaining appendBitsToBuffer(accumData, 6, buf, &result.bitLength); - assert(result.bitLength == bitLen); + LV_ASSERT(result.bitLength == bitLen); result.data = buf; return result; } @@ -949,7 +949,7 @@ struct qrcodegen_Segment qrcodegen_makeEci(long assignVal, uint8_t buf[]) { result.numChars = 0; result.bitLength = 0; if (assignVal < 0) { - assert(false); + LV_ASSERT(false); } else if (assignVal < (1 << 7)) { memset(buf, 0, 1 * sizeof(buf[0])); appendBitsToBuffer(assignVal, 8, buf, &result.bitLength); @@ -963,7 +963,7 @@ struct qrcodegen_Segment qrcodegen_makeEci(long assignVal, uint8_t buf[]) { appendBitsToBuffer(assignVal >> 10, 11, buf, &result.bitLength); appendBitsToBuffer(assignVal & 0x3FF, 10, buf, &result.bitLength); } else { - assert(false); + LV_ASSERT(false); } result.data = buf; return result; @@ -974,22 +974,22 @@ struct qrcodegen_Segment qrcodegen_makeEci(long assignVal, uint8_t buf[]) { // Returns a non-negative number if successful. Otherwise returns -1 if a segment has too // many characters to fit its length field, or the total bits exceeds INT16_MAX. testable int getTotalBits(const struct qrcodegen_Segment segs[], size_t len, int version) { - assert(segs != NULL || len == 0); + LV_ASSERT(segs != NULL || len == 0); long result = 0; for (size_t i = 0; i < len; i++) { int numChars = segs[i].numChars; int bitLength = segs[i].bitLength; - assert(0 <= numChars && numChars <= INT16_MAX); - assert(0 <= bitLength && bitLength <= INT16_MAX); + LV_ASSERT(0 <= numChars && numChars <= INT16_MAX); + LV_ASSERT(0 <= bitLength && bitLength <= INT16_MAX); int ccbits = numCharCountBits(segs[i].mode, version); - assert(0 <= ccbits && ccbits <= 16); + LV_ASSERT(0 <= ccbits && ccbits <= 16); if (numChars >= (1L << ccbits)) return -1; // The segment's length doesn't fit the field's bit width result += 4L + ccbits + bitLength; if (result > INT16_MAX) return -1; // The sum might overflow an int type } - assert(0 <= result && result <= INT16_MAX); + LV_ASSERT(0 <= result && result <= INT16_MAX); return (int)result; } @@ -997,7 +997,7 @@ testable int getTotalBits(const struct qrcodegen_Segment segs[], size_t len, int // Returns the bit width of the character count field for a segment in the given mode // in a QR Code at the given version number. The result is in the range [0, 16]. static int numCharCountBits(enum qrcodegen_Mode mode, int version) { - assert(qrcodegen_VERSION_MIN <= version && version <= qrcodegen_VERSION_MAX); + LV_ASSERT(qrcodegen_VERSION_MIN <= version && version <= qrcodegen_VERSION_MAX); int i = (version + 7) / 17; switch (mode) { case qrcodegen_Mode_NUMERIC : { static const int temp[] = {10, 12, 14}; return temp[i]; } @@ -1005,7 +1005,7 @@ static int numCharCountBits(enum qrcodegen_Mode mode, int version) { case qrcodegen_Mode_BYTE : { static const int temp[] = { 8, 16, 16}; return temp[i]; } case qrcodegen_Mode_KANJI : { static const int temp[] = { 8, 10, 12}; return temp[i]; } case qrcodegen_Mode_ECI : return 0; - default: assert(false); return -1; // Dummy value + default: LV_ASSERT(false); return -1; // Dummy value } } diff --git a/lib/libesp32_lvgl/lvgl/src/extra/libs/tiny_ttf/lv_tiny_ttf.c b/lib/libesp32_lvgl/lvgl/src/extra/libs/tiny_ttf/lv_tiny_ttf.c new file mode 100644 index 000000000..c275bfed2 --- /dev/null +++ b/lib/libesp32_lvgl/lvgl/src/extra/libs/tiny_ttf/lv_tiny_ttf.c @@ -0,0 +1,284 @@ +#include "lv_tiny_ttf.h" + +#if LV_USE_TINY_TTF +#include +#include "../../../misc/lv_lru.h" + +#define STB_RECT_PACK_IMPLEMENTATION +#define STBRP_STATIC +#define STBTT_STATIC +#define STB_TRUETYPE_IMPLEMENTATION +#define STBTT_HEAP_FACTOR_SIZE_32 50 +#define STBTT_HEAP_FACTOR_SIZE_128 20 +#define STBTT_HEAP_FACTOR_SIZE_DEFAULT 10 +#define STBTT_malloc(x, u) ((void)(u), lv_mem_alloc(x)) +#define STBTT_free(x, u) ((void)(u), lv_mem_free(x)) +#define TTF_MALLOC(x) (lv_mem_alloc(x)) +#define TTF_FREE(x) (lv_mem_free(x)) + +#if LV_TINY_TTF_FILE_SUPPORT +/* a hydra stream that can be in memory or from a file*/ +typedef struct ttf_cb_stream { + lv_fs_file_t * file; + const void * data; + size_t size; + size_t position; +} ttf_cb_stream_t; + +static void ttf_cb_stream_read(ttf_cb_stream_t * stream, void * data, size_t to_read) +{ + if(stream->file != NULL) { + uint32_t br; + lv_fs_read(stream->file, data, to_read, &br); + } + else { + if(to_read + stream->position >= stream->size) { + to_read = stream->size - stream->position; + } + lv_memcpy(data, ((const unsigned char *)stream->data + stream->position), to_read); + stream->position += to_read; + } +} +static void ttf_cb_stream_seek(ttf_cb_stream_t * stream, size_t position) +{ + if(stream->file != NULL) { + lv_fs_seek(stream->file, position, LV_FS_SEEK_SET); + } + else { + if(position > stream->size) { + stream->position = stream->size; + } + else { + stream->position = position; + } + } +} + +/* for stream support */ +#define STBTT_STREAM_TYPE ttf_cb_stream_t * +#define STBTT_STREAM_SEEK(s, x) ttf_cb_stream_seek(s, x); +#define STBTT_STREAM_READ(s, x, y) ttf_cb_stream_read(s, x, y); +#endif /*LV_TINY_TTF_FILE_SUPPORT*/ + +#include "stb_rect_pack.h" +#include "stb_truetype_htcw.h" + +typedef struct ttf_font_desc { + lv_fs_file_t file; +#if LV_TINY_TTF_FILE_SUPPORT + ttf_cb_stream_t stream; +#else + const uint8_t * stream; +#endif + stbtt_fontinfo info; + float scale; + int ascent; + int descent; + lv_lru_t * bitmap_cache; +} ttf_font_desc_t; + +typedef struct ttf_bitmap_cache_key { + uint32_t unicode_letter; + lv_coord_t line_height; +} ttf_bitmap_cache_key_t; + +static bool ttf_get_glyph_dsc_cb(const lv_font_t * font, lv_font_glyph_dsc_t * dsc_out, uint32_t unicode_letter, + uint32_t unicode_letter_next) +{ + if(unicode_letter < 0x20 || + unicode_letter == 0xf8ff || /*LV_SYMBOL_DUMMY*/ + unicode_letter == 0x200c) { /*ZERO WIDTH NON-JOINER*/ + dsc_out->box_w = 0; + dsc_out->adv_w = 0; + dsc_out->box_h = 0; /*height of the bitmap in [px]*/ + dsc_out->ofs_x = 0; /*X offset of the bitmap in [pf]*/ + dsc_out->ofs_y = 0; /*Y offset of the bitmap in [pf]*/ + dsc_out->bpp = 0; + dsc_out->is_placeholder = false; + return true; + } + ttf_font_desc_t * dsc = (ttf_font_desc_t *)font->dsc; + int g1 = stbtt_FindGlyphIndex(&dsc->info, (int)unicode_letter); + if(g1 == 0) { + /* Glyph not found */ + return false; + } + int x1, y1, x2, y2; + + stbtt_GetGlyphBitmapBox(&dsc->info, g1, dsc->scale, dsc->scale, &x1, &y1, &x2, &y2); + int g2 = 0; + if(unicode_letter_next != 0) { + g2 = stbtt_FindGlyphIndex(&dsc->info, (int)unicode_letter_next); + } + int advw, lsb; + stbtt_GetGlyphHMetrics(&dsc->info, g1, &advw, &lsb); + int k = stbtt_GetGlyphKernAdvance(&dsc->info, g1, g2); + dsc_out->adv_w = (uint16_t)floor((((float)advw + (float)k) * dsc->scale) + + 0.5f); /*Horizontal space required by the glyph in [px]*/ + + dsc_out->adv_w = (uint16_t)floor((((float)advw + (float)k) * dsc->scale) + + 0.5f); /*Horizontal space required by the glyph in [px]*/ + dsc_out->box_w = (x2 - x1 + 1); /*width of the bitmap in [px]*/ + dsc_out->box_h = (y2 - y1 + 1); /*height of the bitmap in [px]*/ + dsc_out->ofs_x = x1; /*X offset of the bitmap in [pf]*/ + dsc_out->ofs_y = -y2; /*Y offset of the bitmap measured from the as line*/ + dsc_out->bpp = 8; /*Bits per pixel: 1/2/4/8*/ + dsc_out->is_placeholder = false; + return true; /*true: glyph found; false: glyph was not found*/ +} + +static const uint8_t * ttf_get_glyph_bitmap_cb(const lv_font_t * font, uint32_t unicode_letter) +{ + ttf_font_desc_t * dsc = (ttf_font_desc_t *)font->dsc; + const stbtt_fontinfo * info = (const stbtt_fontinfo *)&dsc->info; + int g1 = stbtt_FindGlyphIndex(info, (int)unicode_letter); + if(g1 == 0) { + /* Glyph not found */ + return NULL; + } + int x1, y1, x2, y2; + stbtt_GetGlyphBitmapBox(info, g1, dsc->scale, dsc->scale, &x1, &y1, &x2, &y2); + int w, h; + w = x2 - x1 + 1; + h = y2 - y1 + 1; + uint32_t stride = w; + /*Try to load from cache*/ + ttf_bitmap_cache_key_t cache_key; + lv_memset(&cache_key, 0, sizeof(cache_key)); /*Zero padding*/ + cache_key.unicode_letter = unicode_letter; + cache_key.line_height = font->line_height; + uint8_t * buffer = NULL; + lv_lru_get(dsc->bitmap_cache, &cache_key, sizeof(cache_key), (void **)&buffer); + if(buffer) { + return buffer; + } + LV_LOG_TRACE("cache miss for letter: %u", unicode_letter); + /*Prepare space in cache*/ + size_t szb = h * stride; + buffer = lv_mem_alloc(szb); + if(!buffer) { + LV_LOG_ERROR("failed to allocate cache value"); + return NULL; + } + lv_memset(buffer, 0, szb); + if(LV_LRU_OK != lv_lru_set(dsc->bitmap_cache, &cache_key, sizeof(cache_key), buffer, szb)) { + LV_LOG_ERROR("failed to add cache value"); + lv_mem_free(buffer); + return NULL; + } + /*Render into cache*/ + stbtt_MakeGlyphBitmap(info, buffer, w, h, stride, dsc->scale, dsc->scale, g1); + return buffer; +} + +static lv_font_t * lv_tiny_ttf_create(const char * path, const void * data, size_t data_size, lv_coord_t font_size, + size_t cache_size) +{ + if((path == NULL && data == NULL) || 0 >= font_size) { + LV_LOG_ERROR("tiny_ttf: invalid argument\n"); + return NULL; + } + ttf_font_desc_t * dsc = (ttf_font_desc_t *)TTF_MALLOC(sizeof(ttf_font_desc_t)); + if(dsc == NULL) { + LV_LOG_ERROR("tiny_ttf: out of memory\n"); + return NULL; + } +#if LV_TINY_TTF_FILE_SUPPORT + if(path != NULL) { + if(LV_FS_RES_OK != lv_fs_open(&dsc->file, path, LV_FS_MODE_RD)) { + LV_LOG_ERROR("tiny_ttf: unable to open %s\n", path); + goto err_after_dsc; + } + dsc->stream.file = &dsc->file; + } + else { + dsc->stream.file = NULL; + dsc->stream.data = (const uint8_t *)data; + dsc->stream.size = data_size; + dsc->stream.position = 0; + } + if(0 == stbtt_InitFont(&dsc->info, &dsc->stream, stbtt_GetFontOffsetForIndex(&dsc->stream, 0))) { + LV_LOG_ERROR("tiny_ttf: init failed\n"); + goto err_after_dsc; + } + +#else + dsc->stream = (const uint8_t *)data; + LV_UNUSED(data_size); + if(0 == stbtt_InitFont(&dsc->info, dsc->stream, stbtt_GetFontOffsetForIndex(dsc->stream, 0))) { + LV_LOG_ERROR("tiny_ttf: init failed\n"); + goto err_after_dsc; + } +#endif + + dsc->bitmap_cache = lv_lru_create(cache_size, font_size * font_size, lv_mem_free, lv_mem_free); + if(dsc->bitmap_cache == NULL) { + LV_LOG_ERROR("failed to create lru cache"); + goto err_after_dsc; + } + + lv_font_t * out_font = (lv_font_t *)TTF_MALLOC(sizeof(lv_font_t)); + if(out_font == NULL) { + LV_LOG_ERROR("tiny_ttf: out of memory\n"); + goto err_after_bitmap_cache; + } + lv_memset(out_font, 0, sizeof(lv_font_t)); + out_font->get_glyph_dsc = ttf_get_glyph_dsc_cb; + out_font->get_glyph_bitmap = ttf_get_glyph_bitmap_cb; + out_font->dsc = dsc; + lv_tiny_ttf_set_size(out_font, font_size); + return out_font; +err_after_bitmap_cache: + lv_lru_del(dsc->bitmap_cache); +err_after_dsc: + TTF_FREE(dsc); + return NULL; +} +#if LV_TINY_TTF_FILE_SUPPORT +lv_font_t * lv_tiny_ttf_create_file_ex(const char * path, lv_coord_t font_size, size_t cache_size) +{ + return lv_tiny_ttf_create(path, NULL, 0, font_size, cache_size); +} +lv_font_t * lv_tiny_ttf_create_file(const char * path, lv_coord_t font_size) +{ + return lv_tiny_ttf_create_file_ex(path, font_size, 4096); +} +#endif /*LV_TINY_TTF_FILE_SUPPORT*/ +lv_font_t * lv_tiny_ttf_create_data_ex(const void * data, size_t data_size, lv_coord_t font_size, size_t cache_size) +{ + return lv_tiny_ttf_create(NULL, data, data_size, font_size, cache_size); +} +lv_font_t * lv_tiny_ttf_create_data(const void * data, size_t data_size, lv_coord_t font_size) +{ + return lv_tiny_ttf_create_data_ex(data, data_size, font_size, 4096); +} +void lv_tiny_ttf_set_size(lv_font_t * font, lv_coord_t font_size) +{ + if(font_size <= 0) { + LV_LOG_ERROR("invalid font size: %"PRIx32, font_size); + return; + } + ttf_font_desc_t * dsc = (ttf_font_desc_t *)font->dsc; + dsc->scale = stbtt_ScaleForMappingEmToPixels(&dsc->info, font_size); + int line_gap = 0; + stbtt_GetFontVMetrics(&dsc->info, &dsc->ascent, &dsc->descent, &line_gap); + font->line_height = (lv_coord_t)(dsc->scale * (dsc->ascent - dsc->descent + line_gap)); + font->base_line = (lv_coord_t)(dsc->scale * (line_gap - dsc->descent)); +} +void lv_tiny_ttf_destroy(lv_font_t * font) +{ + if(font != NULL) { + if(font->dsc != NULL) { + ttf_font_desc_t * ttf = (ttf_font_desc_t *)font->dsc; +#if LV_TINY_TTF_FILE_SUPPORT + if(ttf->stream.file != NULL) { + lv_fs_close(&ttf->file); + } +#endif + lv_lru_del(ttf->bitmap_cache); + TTF_FREE(ttf); + } + TTF_FREE(font); + } +} +#endif /*LV_USE_TINY_TTF*/ diff --git a/lib/libesp32_lvgl/lvgl/src/extra/libs/tiny_ttf/lv_tiny_ttf.h b/lib/libesp32_lvgl/lvgl/src/extra/libs/tiny_ttf/lv_tiny_ttf.h new file mode 100644 index 000000000..fe0936b3b --- /dev/null +++ b/lib/libesp32_lvgl/lvgl/src/extra/libs/tiny_ttf/lv_tiny_ttf.h @@ -0,0 +1,62 @@ +/** + * @file lv_tiny_ttf.h + * + */ + +#ifndef LV_TINY_TTF_H +#define LV_TINY_TTF_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../../../lvgl.h" + +#if LV_USE_TINY_TTF + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +#if LV_TINY_TTF_FILE_SUPPORT +/* create a font from the specified file or path with the specified line height.*/ +lv_font_t * lv_tiny_ttf_create_file(const char * path, lv_coord_t font_size); + +/* create a font from the specified file or path with the specified line height with the specified cache size.*/ +lv_font_t * lv_tiny_ttf_create_file_ex(const char * path, lv_coord_t font_size, size_t cache_size); +#endif /*LV_TINY_TTF_FILE_SUPPORT*/ + +/* create a font from the specified data pointer with the specified line height.*/ +lv_font_t * lv_tiny_ttf_create_data(const void * data, size_t data_size, lv_coord_t font_size); + +/* create a font from the specified data pointer with the specified line height and the specified cache size.*/ +lv_font_t * lv_tiny_ttf_create_data_ex(const void * data, size_t data_size, lv_coord_t font_size, size_t cache_size); + +/* set the size of the font to a new font_size*/ +void lv_tiny_ttf_set_size(lv_font_t * font, lv_coord_t font_size); + +/* destroy a font previously created with lv_tiny_ttf_create_xxxx()*/ +void lv_tiny_ttf_destroy(lv_font_t * font); + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_TINY_TTF*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_TINY_TTF_H*/ diff --git a/lib/libesp32_lvgl/lvgl/src/extra/libs/tiny_ttf/stb_rect_pack.h b/lib/libesp32_lvgl/lvgl/src/extra/libs/tiny_ttf/stb_rect_pack.h new file mode 100644 index 000000000..413e5047d --- /dev/null +++ b/lib/libesp32_lvgl/lvgl/src/extra/libs/tiny_ttf/stb_rect_pack.h @@ -0,0 +1,637 @@ +// stb_rect_pack.h - v1.01 - public domain - rectangle packing +// Sean Barrett 2014 +// +// Useful for e.g. packing rectangular textures into an atlas. +// Does not do rotation. +// +// Before #including, +// +// #define STB_RECT_PACK_IMPLEMENTATION +// +// in the file that you want to have the implementation. +// +// Not necessarily the awesomest packing method, but better than +// the totally naive one in stb_truetype (which is primarily what +// this is meant to replace). +// +// Has only had a few tests run, may have issues. +// +// More docs to come. +// +// No memory allocations; uses qsort() and assert() from stdlib. +// Can override those by defining STBRP_SORT and STBRP_ASSERT. +// +// This library currently uses the Skyline Bottom-Left algorithm. +// +// Please note: better rectangle packers are welcome! Please +// implement them to the same API, but with a different init +// function. +// +// Credits +// +// Library +// Sean Barrett +// Minor features +// Martins Mozeiko +// github:IntellectualKitty +// +// Bugfixes / warning fixes +// Jeremy Jaussaud +// Fabian Giesen +// +// Version history: +// +// 1.01 (2021-07-11) always use large rect mode, expose STBRP__MAXVAL in public section +// 1.00 (2019-02-25) avoid small space waste; gracefully fail too-wide rectangles +// 0.99 (2019-02-07) warning fixes +// 0.11 (2017-03-03) return packing success/fail result +// 0.10 (2016-10-25) remove cast-away-const to avoid warnings +// 0.09 (2016-08-27) fix compiler warnings +// 0.08 (2015-09-13) really fix bug with empty rects (w=0 or h=0) +// 0.07 (2015-09-13) fix bug with empty rects (w=0 or h=0) +// 0.06 (2015-04-15) added STBRP_SORT to allow replacing qsort +// 0.05: added STBRP_ASSERT to allow replacing assert +// 0.04: fixed minor bug in STBRP_LARGE_RECTS support +// 0.01: initial release +// +// LICENSE +// +// See end of file for license information. + +////////////////////////////////////////////////////////////////////////////// +// +// INCLUDE SECTION +// + +#ifndef STB_INCLUDE_STB_RECT_PACK_H +#define STB_INCLUDE_STB_RECT_PACK_H + +#define STB_RECT_PACK_VERSION 1 + +#ifdef STBRP_STATIC + #define STBRP_DEF static +#else + #define STBRP_DEF extern +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/// @cond +/** + * Tells Doxygen to ignore a duplicate declaration + */ +typedef struct stbrp_context stbrp_context; +typedef struct stbrp_node stbrp_node; +typedef struct stbrp_rect stbrp_rect; +/// @endcond + +typedef int stbrp_coord; + +#define STBRP__MAXVAL 0x7fffffff +// Mostly for internal use, but this is the maximum supported coordinate value. + +#if defined(__GNUC__) || defined(__clang__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-function" +#endif + + +STBRP_DEF int stbrp_pack_rects(stbrp_context * context, stbrp_rect * rects, int num_rects); +// Assign packed locations to rectangles. The rectangles are of type +// 'stbrp_rect' defined below, stored in the array 'rects', and there +// are 'num_rects' many of them. +// +// Rectangles which are successfully packed have the 'was_packed' flag +// set to a non-zero value and 'x' and 'y' store the minimum location +// on each axis (i.e. bottom-left in cartesian coordinates, top-left +// if you imagine y increasing downwards). Rectangles which do not fit +// have the 'was_packed' flag set to 0. +// +// You should not try to access the 'rects' array from another thread +// while this function is running, as the function temporarily reorders +// the array while it executes. +// +// To pack into another rectangle, you need to call stbrp_init_target +// again. To continue packing into the same rectangle, you can call +// this function again. Calling this multiple times with multiple rect +// arrays will probably produce worse packing results than calling it +// a single time with the full rectangle array, but the option is +// available. +// +// The function returns 1 if all of the rectangles were successfully +// packed and 0 otherwise. + +struct stbrp_rect { + // reserved for your use: + int id; + + // input: + stbrp_coord w, h; + + // output: + stbrp_coord x, y; + int was_packed; // non-zero if valid packing + +}; // 16 bytes, nominally + + +STBRP_DEF void stbrp_init_target(stbrp_context * context, int width, int height, stbrp_node * nodes, int num_nodes); +// Initialize a rectangle packer to: +// pack a rectangle that is 'width' by 'height' in dimensions +// using temporary storage provided by the array 'nodes', which is 'num_nodes' long +// +// You must call this function every time you start packing into a new target. +// +// There is no "shutdown" function. The 'nodes' memory must stay valid for +// the following stbrp_pack_rects() call (or calls), but can be freed after +// the call (or calls) finish. +// +// Note: to guarantee best results, either: +// 1. make sure 'num_nodes' >= 'width' +// or 2. call stbrp_allow_out_of_mem() defined below with 'allow_out_of_mem = 1' +// +// If you don't do either of the above things, widths will be quantized to multiples +// of small integers to guarantee the algorithm doesn't run out of temporary storage. +// +// If you do #2, then the non-quantized algorithm will be used, but the algorithm +// may run out of temporary storage and be unable to pack some rectangles. + +STBRP_DEF void stbrp_setup_allow_out_of_mem(stbrp_context * context, int allow_out_of_mem); +// Optionally call this function after init but before doing any packing to +// change the handling of the out-of-temp-memory scenario, described above. +// If you call init again, this will be reset to the default (false). + + +STBRP_DEF void stbrp_setup_heuristic(stbrp_context * context, int heuristic); +// Optionally select which packing heuristic the library should use. Different +// heuristics will produce better/worse results for different data sets. +// If you call init again, this will be reset to the default. + +enum { + STBRP_HEURISTIC_Skyline_default = 0, + STBRP_HEURISTIC_Skyline_BL_sortHeight = STBRP_HEURISTIC_Skyline_default, + STBRP_HEURISTIC_Skyline_BF_sortHeight +}; + + +////////////////////////////////////////////////////////////////////////////// +// +// the details of the following structures don't matter to you, but they must +// be visible so you can handle the memory allocations for them + +struct stbrp_node { + stbrp_coord x, y; + stbrp_node * next; +}; + +struct stbrp_context { + int width; + int height; + int align; + int init_mode; + int heuristic; + int num_nodes; + stbrp_node * active_head; + stbrp_node * free_head; + stbrp_node extra[2]; // we allocate two extra nodes so optimal user-node-count is 'width' not 'width+2' +}; + +#ifdef __cplusplus +} +#endif + +#endif + +////////////////////////////////////////////////////////////////////////////// +// +// IMPLEMENTATION SECTION +// + +#ifdef STB_RECT_PACK_IMPLEMENTATION +#ifndef STBRP_SORT + #include + #define STBRP_SORT qsort +#endif + +#ifndef STBRP_ASSERT + #include + #define STBRP_ASSERT assert +#endif + +#ifdef _MSC_VER + #define STBRP__NOTUSED(v) (void)(v) + #define STBRP__CDECL __cdecl +#else + #define STBRP__NOTUSED(v) (void)sizeof(v) + #define STBRP__CDECL +#endif + +enum { + STBRP__INIT_skyline = 1 +}; + +STBRP_DEF void stbrp_setup_heuristic(stbrp_context * context, int heuristic) +{ + switch(context->init_mode) { + case STBRP__INIT_skyline: + STBRP_ASSERT(heuristic == STBRP_HEURISTIC_Skyline_BL_sortHeight || heuristic == STBRP_HEURISTIC_Skyline_BF_sortHeight); + context->heuristic = heuristic; + break; + default: + STBRP_ASSERT(0); + } +} + +STBRP_DEF void stbrp_setup_allow_out_of_mem(stbrp_context * context, int allow_out_of_mem) +{ + if(allow_out_of_mem) + // if it's ok to run out of memory, then don't bother aligning them; + // this gives better packing, but may fail due to OOM (even though + // the rectangles easily fit). @TODO a smarter approach would be to only + // quantize once we've hit OOM, then we could get rid of this parameter. + context->align = 1; + else { + // if it's not ok to run out of memory, then quantize the widths + // so that num_nodes is always enough nodes. + // + // I.e. num_nodes * align >= width + // align >= width / num_nodes + // align = ceil(width/num_nodes) + + context->align = (context->width + context->num_nodes - 1) / context->num_nodes; + } +} + +STBRP_DEF void stbrp_init_target(stbrp_context * context, int width, int height, stbrp_node * nodes, int num_nodes) +{ + int i; + + for(i = 0; i < num_nodes - 1; ++i) + nodes[i].next = &nodes[i + 1]; + nodes[i].next = NULL; + context->init_mode = STBRP__INIT_skyline; + context->heuristic = STBRP_HEURISTIC_Skyline_default; + context->free_head = &nodes[0]; + context->active_head = &context->extra[0]; + context->width = width; + context->height = height; + context->num_nodes = num_nodes; + stbrp_setup_allow_out_of_mem(context, 0); + + // node 0 is the full width, node 1 is the sentinel (lets us not store width explicitly) + context->extra[0].x = 0; + context->extra[0].y = 0; + context->extra[0].next = &context->extra[1]; + context->extra[1].x = (stbrp_coord) width; + context->extra[1].y = (1 << 30); + context->extra[1].next = NULL; +} + +// find minimum y position if it starts at x1 +static int stbrp__skyline_find_min_y(stbrp_context * c, stbrp_node * first, int x0, int width, int * pwaste) +{ + stbrp_node * node = first; + int x1 = x0 + width; + int min_y, visited_width, waste_area; + + STBRP__NOTUSED(c); + + STBRP_ASSERT(first->x <= x0); + +#if 0 + // skip in case we're past the node + while(node->next->x <= x0) + ++node; +#else + STBRP_ASSERT(node->next->x > x0); // we ended up handling this in the caller for efficiency +#endif + + STBRP_ASSERT(node->x <= x0); + + min_y = 0; + waste_area = 0; + visited_width = 0; + while(node->x < x1) { + if(node->y > min_y) { + // raise min_y higher. + // we've accounted for all waste up to min_y, + // but we'll now add more waste for everything we've visited + waste_area += visited_width * (node->y - min_y); + min_y = node->y; + // the first time through, visited_width might be reduced + if(node->x < x0) + visited_width += node->next->x - x0; + else + visited_width += node->next->x - node->x; + } + else { + // add waste area + int under_width = node->next->x - node->x; + if(under_width + visited_width > width) + under_width = width - visited_width; + waste_area += under_width * (min_y - node->y); + visited_width += under_width; + } + node = node->next; + } + + *pwaste = waste_area; + return min_y; +} + +typedef struct { + int x, y; + stbrp_node ** prev_link; +} stbrp__findresult; + +static stbrp__findresult stbrp__skyline_find_best_pos(stbrp_context * c, int width, int height) +{ + int best_waste = (1 << 30), best_x, best_y = (1 << 30); + stbrp__findresult fr; + stbrp_node ** prev, * node, * tail, ** best = NULL; + + // align to multiple of c->align + width = (width + c->align - 1); + width -= width % c->align; + STBRP_ASSERT(width % c->align == 0); + + // if it can't possibly fit, bail immediately + if(width > c->width || height > c->height) { + fr.prev_link = NULL; + fr.x = fr.y = 0; + return fr; + } + + node = c->active_head; + prev = &c->active_head; + while(node->x + width <= c->width) { + int y, waste; + y = stbrp__skyline_find_min_y(c, node, node->x, width, &waste); + if(c->heuristic == STBRP_HEURISTIC_Skyline_BL_sortHeight) { // actually just want to test BL + // bottom left + if(y < best_y) { + best_y = y; + best = prev; + } + } + else { + // best-fit + if(y + height <= c->height) { + // can only use it if it first vertically + if(y < best_y || (y == best_y && waste < best_waste)) { + best_y = y; + best_waste = waste; + best = prev; + } + } + } + prev = &node->next; + node = node->next; + } + + best_x = (best == NULL) ? 0 : (*best)->x; + + // if doing best-fit (BF), we also have to try aligning right edge to each node position + // + // e.g, if fitting + // + // ____________________ + // |____________________| + // + // into + // + // | | + // | ____________| + // |____________| + // + // then right-aligned reduces waste, but bottom-left BL is always chooses left-aligned + // + // This makes BF take about 2x the time + + if(c->heuristic == STBRP_HEURISTIC_Skyline_BF_sortHeight) { + tail = c->active_head; + node = c->active_head; + prev = &c->active_head; + // find first node that's admissible + while(tail->x < width) + tail = tail->next; + while(tail) { + int xpos = tail->x - width; + int y, waste; + STBRP_ASSERT(xpos >= 0); + // find the left position that matches this + while(node->next->x <= xpos) { + prev = &node->next; + node = node->next; + } + STBRP_ASSERT(node->next->x > xpos && node->x <= xpos); + y = stbrp__skyline_find_min_y(c, node, xpos, width, &waste); + if(y + height <= c->height) { + if(y <= best_y) { + if(y < best_y || waste < best_waste || (waste == best_waste && xpos < best_x)) { + best_x = xpos; + STBRP_ASSERT(y <= best_y); + best_y = y; + best_waste = waste; + best = prev; + } + } + } + tail = tail->next; + } + } + + fr.prev_link = best; + fr.x = best_x; + fr.y = best_y; + return fr; +} + +static stbrp__findresult stbrp__skyline_pack_rectangle(stbrp_context * context, int width, int height) +{ + // find best position according to heuristic + stbrp__findresult res = stbrp__skyline_find_best_pos(context, width, height); + stbrp_node * node, * cur; + + // bail if: + // 1. it failed + // 2. the best node doesn't fit (we don't always check this) + // 3. we're out of memory + if(res.prev_link == NULL || res.y + height > context->height || context->free_head == NULL) { + res.prev_link = NULL; + return res; + } + + // on success, create new node + node = context->free_head; + node->x = (stbrp_coord) res.x; + node->y = (stbrp_coord)(res.y + height); + + context->free_head = node->next; + + // insert the new node into the right starting point, and + // let 'cur' point to the remaining nodes needing to be + // stiched back in + + cur = *res.prev_link; + if(cur->x < res.x) { + // preserve the existing one, so start testing with the next one + stbrp_node * next = cur->next; + cur->next = node; + cur = next; + } + else { + *res.prev_link = node; + } + + // from here, traverse cur and free the nodes, until we get to one + // that shouldn't be freed + while(cur->next && cur->next->x <= res.x + width) { + stbrp_node * next = cur->next; + // move the current node to the free list + cur->next = context->free_head; + context->free_head = cur; + cur = next; + } + + // stitch the list back in + node->next = cur; + + if(cur->x < res.x + width) + cur->x = (stbrp_coord)(res.x + width); + +#ifdef _DEBUG + cur = context->active_head; + while(cur->x < context->width) { + STBRP_ASSERT(cur->x < cur->next->x); + cur = cur->next; + } + STBRP_ASSERT(cur->next == NULL); + + { + int count = 0; + cur = context->active_head; + while(cur) { + cur = cur->next; + ++count; + } + cur = context->free_head; + while(cur) { + cur = cur->next; + ++count; + } + STBRP_ASSERT(count == context->num_nodes + 2); + } +#endif + + return res; +} + +static int STBRP__CDECL rect_height_compare(const void * a, const void * b) +{ + const stbrp_rect * p = (const stbrp_rect *) a; + const stbrp_rect * q = (const stbrp_rect *) b; + if(p->h > q->h) + return -1; + if(p->h < q->h) + return 1; + return (p->w > q->w) ? -1 : (p->w < q->w); +} + +static int STBRP__CDECL rect_original_order(const void * a, const void * b) +{ + const stbrp_rect * p = (const stbrp_rect *) a; + const stbrp_rect * q = (const stbrp_rect *) b; + return (p->was_packed < q->was_packed) ? -1 : (p->was_packed > q->was_packed); +} + +STBRP_DEF int stbrp_pack_rects(stbrp_context * context, stbrp_rect * rects, int num_rects) +{ + int i, all_rects_packed = 1; + + // we use the 'was_packed' field internally to allow sorting/unsorting + for(i = 0; i < num_rects; ++i) { + rects[i].was_packed = i; + } + + // sort according to heuristic + STBRP_SORT(rects, num_rects, sizeof(rects[0]), rect_height_compare); + + for(i = 0; i < num_rects; ++i) { + if(rects[i].w == 0 || rects[i].h == 0) { + rects[i].x = rects[i].y = 0; // empty rect needs no space + } + else { + stbrp__findresult fr = stbrp__skyline_pack_rectangle(context, rects[i].w, rects[i].h); + if(fr.prev_link) { + rects[i].x = (stbrp_coord) fr.x; + rects[i].y = (stbrp_coord) fr.y; + } + else { + rects[i].x = rects[i].y = STBRP__MAXVAL; + } + } + } + + // unsort + STBRP_SORT(rects, num_rects, sizeof(rects[0]), rect_original_order); + + // set was_packed flags and all_rects_packed status + for(i = 0; i < num_rects; ++i) { + rects[i].was_packed = !(rects[i].x == STBRP__MAXVAL && rects[i].y == STBRP__MAXVAL); + if(!rects[i].was_packed) + all_rects_packed = 0; + } + + // return the all_rects_packed status + return all_rects_packed; +} +#endif + +#if defined(__GNUC__) || defined(__clang__) + #pragma GCC diagnostic pop +#endif + +/* +------------------------------------------------------------------------------ +This software is available under 2 licenses -- choose whichever you prefer. +------------------------------------------------------------------------------ +ALTERNATIVE A - MIT License +Copyright (c) 2017 Sean Barrett +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +------------------------------------------------------------------------------ +ALTERNATIVE B - Public Domain (www.unlicense.org) +This is free and unencumbered software released into the public domain. +Anyone is free to copy, modify, publish, use, compile, sell, or distribute this +software, either in source code form or as a compiled binary, for any purpose, +commercial or non-commercial, and by any means. +In jurisdictions that recognize copyright laws, the author or authors of this +software dedicate any and all copyright interest in the software to the public +domain. We make this dedication for the benefit of the public at large and to +the detriment of our heirs and successors. We intend this dedication to be an +overt act of relinquishment in perpetuity of all present and future rights to +this software under copyright law. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +------------------------------------------------------------------------------ +*/ diff --git a/lib/libesp32_lvgl/lvgl/src/extra/libs/tiny_ttf/stb_truetype_htcw.h b/lib/libesp32_lvgl/lvgl/src/extra/libs/tiny_ttf/stb_truetype_htcw.h new file mode 100644 index 000000000..d0e839d9d --- /dev/null +++ b/lib/libesp32_lvgl/lvgl/src/extra/libs/tiny_ttf/stb_truetype_htcw.h @@ -0,0 +1,5572 @@ +// stb_truetype.h - v1.26htcw (fork to enable streaming and low memory environments) +// stb_truetype.h - v1.26 - public domain +// authored from 2009-2021 by Sean Barrett / RAD Game Tools +// +// ======================================================================= +// +// NO SECURITY GUARANTEE -- DO NOT USE THIS ON UNTRUSTED FONT FILES +// +// This library does no range checking of the offsets found in the file, +// meaning an attacker can use it to read arbitrary memory. +// +// ======================================================================= +// +// This library processes TrueType files: +// parse files +// extract glyph metrics +// extract glyph shapes +// render glyphs to one-channel bitmaps with antialiasing (box filter) +// render glyphs to one-channel SDF bitmaps (signed-distance field/function) +// +// Todo: +// non-MS cmaps +// crashproof on bad data +// hinting? (no longer patented) +// cleartype-style AA? +// optimize: use simple memory allocator for intermediates +// optimize: build edge-list directly from curves +// optimize: rasterize directly from curves? +// +// ADDITIONAL CONTRIBUTORS +// +// Mikko Mononen: compound shape support, more cmap formats +// Tor Andersson: kerning, subpixel rendering +// Dougall Johnson: OpenType / Type 2 font handling +// Daniel Ribeiro Maciel: basic GPOS-based kerning +// +// Misc other: +// Ryan Gordon +// Simon Glass +// github:IntellectualKitty +// Imanol Celaya +// Daniel Ribeiro Maciel +// +// Bug/warning reports/fixes: +// "Zer" on mollyrocket Fabian "ryg" Giesen github:NiLuJe +// Cass Everitt Martins Mozeiko github:aloucks +// stoiko (Haemimont Games) Cap Petschulat github:oyvindjam +// Brian Hook Omar Cornut github:vassvik +// Walter van Niftrik Ryan Griege +// David Gow Peter LaValle +// David Given Sergey Popov +// Ivan-Assen Ivanov Giumo X. Clanjor +// Anthony Pesch Higor Euripedes +// Johan Duparc Thomas Fields +// Hou Qiming Derek Vinyard +// Rob Loach Cort Stratton +// Kenney Phillis Jr. Brian Costabile +// Ken Voskuil (kaesve) +// +// VERSION HISTORY +// +// 1.26 (2021-08-28) fix broken rasterizer +// 1.25 (2021-07-11) many fixes +// 1.24 (2020-02-05) fix warning +// 1.23 (2020-02-02) query SVG data for glyphs; query whole kerning table (but only kern not GPOS) +// 1.22 (2019-08-11) minimize missing-glyph duplication; fix kerning if both 'GPOS' and 'kern' are defined +// 1.21 (2019-02-25) fix warning +// 1.20 (2019-02-07) PackFontRange skips missing codepoints; GetScaleFontVMetrics() +// 1.19 (2018-02-11) GPOS kerning, STBTT_fmod +// 1.18 (2018-01-29) add missing function +// 1.17 (2017-07-23) make more arguments const; doc fix +// 1.16 (2017-07-12) SDF support +// 1.15 (2017-03-03) make more arguments const +// 1.14 (2017-01-16) num-fonts-in-TTC function +// 1.13 (2017-01-02) support OpenType fonts, certain Apple fonts +// 1.12 (2016-10-25) suppress warnings about casting away const with -Wcast-qual +// 1.11 (2016-04-02) fix unused-variable warning +// 1.10 (2016-04-02) user-defined fabs(); rare memory leak; remove duplicate typedef +// 1.09 (2016-01-16) warning fix; avoid crash on outofmem; use allocation userdata properly +// 1.08 (2015-09-13) document stbtt_Rasterize(); fixes for vertical & horizontal edges +// 1.07 (2015-08-01) allow PackFontRanges to accept arrays of sparse codepoints; +// variant PackFontRanges to pack and render in separate phases; +// fix stbtt_GetFontOFfsetForIndex (never worked for non-0 input?); +// fixed an assert() bug in the new rasterizer +// replace assert() with STBTT_assert() in new rasterizer +// +// Full history can be found at the end of this file. +// +// LICENSE +// +// See end of file for license information. +// +// USAGE +// +// Include this file in whatever places need to refer to it. In ONE C/C++ +// file, write: +// #define STB_TRUETYPE_IMPLEMENTATION +// before the #include of this file. This expands out the actual +// implementation into that C/C++ file. +// +// To make the implementation private to the file that generates the implementation, +// #define STBTT_STATIC +// +// Simple 3D API (don't ship this, but it's fine for tools and quick start) +// stbtt_BakeFontBitmap() -- bake a font to a bitmap for use as texture +// stbtt_GetBakedQuad() -- compute quad to draw for a given char +// +// Improved 3D API (more shippable): +// #include "stb_rect_pack.h" -- optional, but you really want it +// stbtt_PackBegin() +// stbtt_PackSetOversampling() -- for improved quality on small fonts +// stbtt_PackFontRanges() -- pack and renders +// stbtt_PackEnd() +// stbtt_GetPackedQuad() +// +// "Load" a font file from a memory buffer (you have to keep the buffer loaded) +// stbtt_InitFont() +// stbtt_GetFontOffsetForIndex() -- indexing for TTC font collections +// stbtt_GetNumberOfFonts() -- number of fonts for TTC font collections +// +// Render a unicode codepoint to a bitmap +// stbtt_GetCodepointBitmap() -- allocates and returns a bitmap +// stbtt_MakeCodepointBitmap() -- renders into bitmap you provide +// stbtt_GetCodepointBitmapBox() -- how big the bitmap must be +// +// Character advance/positioning +// stbtt_GetCodepointHMetrics() +// stbtt_GetFontVMetrics() +// stbtt_GetFontVMetricsOS2() +// stbtt_GetCodepointKernAdvance() +// +// Starting with version 1.06, the rasterizer was replaced with a new, +// faster and generally-more-precise rasterizer. The new rasterizer more +// accurately measures pixel coverage for anti-aliasing, except in the case +// where multiple shapes overlap, in which case it overestimates the AA pixel +// coverage. Thus, anti-aliasing of intersecting shapes may look wrong. If +// this turns out to be a problem, you can re-enable the old rasterizer with +// #define STBTT_RASTERIZER_VERSION 1 +// which will incur about a 15% speed hit. +// +// ADDITIONAL DOCUMENTATION +// +// Immediately after this block comment are a series of sample programs. +// +// After the sample programs is the "header file" section. This section +// includes documentation for each API function. +// +// Some important concepts to understand to use this library: +// +// Codepoint +// Characters are defined by unicode codepoints, e.g. 65 is +// uppercase A, 231 is lowercase c with a cedilla, 0x7e30 is +// the hiragana for "ma". +// +// Glyph +// A visual character shape (every codepoint is rendered as +// some glyph) +// +// Glyph index +// A font-specific integer ID representing a glyph +// +// Baseline +// Glyph shapes are defined relative to a baseline, which is the +// bottom of uppercase characters. Characters extend both above +// and below the baseline. +// +// Current Point +// As you draw text to the screen, you keep track of a "current point" +// which is the origin of each character. The current point's vertical +// position is the baseline. Even "baked fonts" use this model. +// +// Vertical Font Metrics +// The vertical qualities of the font, used to vertically position +// and space the characters. See docs for stbtt_GetFontVMetrics. +// +// Font Size in Pixels or Points +// The preferred interface for specifying font sizes in stb_truetype +// is to specify how tall the font's vertical extent should be in pixels. +// If that sounds good enough, skip the next paragraph. +// +// Most font APIs instead use "points", which are a common typographic +// measurement for describing font size, defined as 72 points per inch. +// stb_truetype provides a point API for compatibility. However, true +// "per inch" conventions don't make much sense on computer displays +// since different monitors have different number of pixels per +// inch. For example, Windows traditionally uses a convention that +// there are 96 pixels per inch, thus making 'inch' measurements have +// nothing to do with inches, and thus effectively defining a point to +// be 1.333 pixels. Additionally, the TrueType font data provides +// an explicit scale factor to scale a given font's glyphs to points, +// but the author has observed that this scale factor is often wrong +// for non-commercial fonts, thus making fonts scaled in points +// according to the TrueType spec incoherently sized in practice. +// +// DETAILED USAGE: +// +// Scale: +// Select how high you want the font to be, in points or pixels. +// Call ScaleForPixelHeight or ScaleForMappingEmToPixels to compute +// a scale factor SF that will be used by all other functions. +// +// Baseline: +// You need to select a y-coordinate that is the baseline of where +// your text will appear. Call GetFontBoundingBox to get the baseline-relative +// bounding box for all characters. SF*-y0 will be the distance in pixels +// that the worst-case character could extend above the baseline, so if +// you want the top edge of characters to appear at the top of the +// screen where y=0, then you would set the baseline to SF*-y0. +// +// Current point: +// Set the current point where the first character will appear. The +// first character could extend left of the current point; this is font +// dependent. You can either choose a current point that is the leftmost +// point and hope, or add some padding, or check the bounding box or +// left-side-bearing of the first character to be displayed and set +// the current point based on that. +// +// Displaying a character: +// Compute the bounding box of the character. It will contain signed values +// relative to . I.e. if it returns x0,y0,x1,y1, +// then the character should be displayed in the rectangle from +// to = 32 && *text < 128) { + stbtt_aligned_quad q; + stbtt_GetBakedQuad(cdata, 512, 512, *text - 32, &x, &y, &q, 1);//1=opengl & d3d10+,0=d3d9 + glTexCoord2f(q.s0, q.t0); + glVertex2f(q.x0, q.y0); + glTexCoord2f(q.s1, q.t0); + glVertex2f(q.x1, q.y0); + glTexCoord2f(q.s1, q.t1); + glVertex2f(q.x1, q.y1); + glTexCoord2f(q.s0, q.t1); + glVertex2f(q.x0, q.y1); + } + ++text; + } + glEnd(); +} +#endif +// +// +////////////////////////////////////////////////////////////////////////////// +// +// Complete program (this compiles): get a single bitmap, print as ASCII art +// +#if 0 +#include +#define STB_TRUETYPE_IMPLEMENTATION // force following include to generate implementation +#include "stb_truetype.h" + +char ttf_buffer[1 << 25]; + +int main(int argc, char ** argv) +{ + stbtt_fontinfo font; + unsigned char * bitmap; + int w, h, i, j, c = (argc > 1 ? atoi(argv[1]) : 'a'), s = (argc > 2 ? atoi(argv[2]) : 20); + + fread(ttf_buffer, 1, 1 << 25, fopen(argc > 3 ? argv[3] : "c:/windows/fonts/arialbd.ttf", "rb")); + + stbtt_InitFont(&font, ttf_buffer, stbtt_GetFontOffsetForIndex(ttf_buffer, 0)); + bitmap = stbtt_GetCodepointBitmap(&font, 0, stbtt_ScaleForPixelHeight(&font, s), c, &w, &h, 0, 0); + + for(j = 0; j < h; ++j) { + for(i = 0; i < w; ++i) + putchar(" .:ioVM@"[bitmap[j * w + i] >> 5]); + putchar('\n'); + } + return 0; +} +#endif +// +// Output: +// +// .ii. +// @@@@@@. +// V@Mio@@o +// :i. V@V +// :oM@@M +// :@@@MM@M +// @@o o@M +// :@@. M@M +// @@@o@@@@ +// :M@@V:@@. +// +////////////////////////////////////////////////////////////////////////////// +// +// Complete program: print "Hello World!" banner, with bugs +// +#if 0 +char buffer[24 << 20]; +unsigned char screen[20][79]; + +int main(int arg, char ** argv) +{ + stbtt_fontinfo font; + int i, j, ascent, baseline, ch = 0; + float scale, xpos = 2; // leave a little padding in case the character extends left + char * text = "Heljo World!"; // intentionally misspelled to show 'lj' brokenness + + fread(buffer, 1, 1000000, fopen("c:/windows/fonts/arialbd.ttf", "rb")); + stbtt_InitFont(&font, buffer, 0); + + scale = stbtt_ScaleForPixelHeight(&font, 15); + stbtt_GetFontVMetrics(&font, &ascent, 0, 0); + baseline = (int)(ascent * scale); + + while(text[ch]) { + int advance, lsb, x0, y0, x1, y1; + float x_shift = xpos - (float)floor(xpos); + stbtt_GetCodepointHMetrics(&font, text[ch], &advance, &lsb); + stbtt_GetCodepointBitmapBoxSubpixel(&font, text[ch], scale, scale, x_shift, 0, &x0, &y0, &x1, &y1); + stbtt_MakeCodepointBitmapSubpixel(&font, &screen[baseline + y0][(int)xpos + x0], x1 - x0, y1 - y0, 79, scale, scale, + x_shift, 0, text[ch]); + // note that this stomps the old data, so where character boxes overlap (e.g. 'lj') it's wrong + // because this API is really for baking character bitmaps into textures. if you want to render + // a sequence of characters, you really need to render each bitmap to a temp buffer, then + // "alpha blend" that into the working buffer + xpos += (advance * scale); + if(text[ch + 1]) + xpos += scale * stbtt_GetCodepointKernAdvance(&font, text[ch], text[ch + 1]); + ++ch; + } + + for(j = 0; j < 20; ++j) { + for(i = 0; i < 78; ++i) + putchar(" .:ioVM@"[screen[j][i] >> 5]); + putchar('\n'); + } + + return 0; +} +#endif + + +////////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// +//// +//// INTEGRATION WITH YOUR CODEBASE +//// +//// The following sections allow you to supply alternate definitions +//// of C library functions used by stb_truetype, e.g. if you don't +//// link with the C runtime library. + +#ifdef STB_TRUETYPE_IMPLEMENTATION +// #define your own (u)stbtt_int8/16/32 before including to override this +#ifndef stbtt_uint8 + typedef unsigned char stbtt_uint8; + typedef signed char stbtt_int8; + typedef unsigned short stbtt_uint16; + typedef signed short stbtt_int16; + typedef unsigned int stbtt_uint32; + typedef signed int stbtt_int32; +#endif + +typedef char stbtt__check_size32[sizeof(stbtt_int32) == 4 ? 1 : -1]; +typedef char stbtt__check_size16[sizeof(stbtt_int16) == 2 ? 1 : -1]; + +// define STBTT_STDIO_STREAM to stream from a FILE object +// instead of from memory. Or define STBTT_STREAM_TYPE, +// STBTT_STREAM_READ and STBTT_STREAM_SEEK to implement +// another streaming source +#ifdef STBTT_STDIO_STREAM + #include + #define STBTT_STREAM_TYPE FILE* + #define STBTT_STREAM_READ(s,x,y) fread(x,1,y,s); + #define STBTT_STREAM_SEEK(s,x) fseek(s,x,SEEK_SET); +#endif + +// heap factor sizes for various counts of objects +// adjust for your platform. Below is suitable for +// modern PC class machines. +#ifndef STBTT_HEAP_FACTOR_SIZE_32 + #define STBTT_HEAP_FACTOR_SIZE_32 2000 +#endif + +#ifndef STBTT_HEAP_FACTOR_SIZE_128 + #define STBTT_HEAP_FACTOR_SIZE_128 800 +#endif + +#ifndef STBTT_HEAP_FACTOR_SIZE_DEFAULT + #define STBTT_HEAP_FACTOR_SIZE_DEFAULT 100 +#endif + +// e.g. #define your own STBTT_ifloor/STBTT_iceil() to avoid math.h +#ifndef STBTT_ifloor + #include + #define STBTT_ifloor(x) ((int) floor(x)) + #define STBTT_iceil(x) ((int) ceil(x)) +#endif + +#ifndef STBTT_sqrt + #include + #define STBTT_sqrt(x) (float)sqrt(x) + #define STBTT_pow(x,y) pow(x,y) +#endif + +#ifndef STBTT_fmod + #include + #define STBTT_fmod(x,y) fmod(x,y) +#endif + +#ifndef STBTT_cos + #include + #define STBTT_cos(x) cos(x) + #define STBTT_acos(x) acos(x) +#endif + +#ifndef STBTT_fabs + #include + #define STBTT_fabs(x) (float)fabs(x) +#endif + +// #define your own functions "STBTT_malloc" / "STBTT_free" to avoid malloc.h +#ifndef STBTT_malloc + #include + #define STBTT_malloc(x,u) ((void)(u),malloc(x)) + #define STBTT_free(x,u) ((void)(u),free(x)) +#endif + +#ifndef STBTT_assert + #include + #define STBTT_assert(x) assert(x) +#endif + +#ifndef STBTT_strlen + #include + #define STBTT_strlen(x) strlen(x) +#endif + +#ifndef STBTT_memcpy + #include + #define STBTT_memcpy memcpy + #define STBTT_memset memset +#endif +#endif + +/////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// +//// +//// INTERFACE +//// +//// + +#ifndef __STB_INCLUDE_STB_TRUETYPE_H__ +#define __STB_INCLUDE_STB_TRUETYPE_H__ + +#ifdef STBTT_STATIC + #define STBTT_DEF static +#else + #define STBTT_DEF extern +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +// private structure +typedef struct { +#ifdef STBTT_STREAM_TYPE + STBTT_STREAM_TYPE data; + stbtt_uint32 offset; +#else + unsigned char * data; +#endif + int cursor; + int size; +} stbtt__buf; + +#if defined(__GNUC__) || defined(__clang__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-function" +#endif + +////////////////////////////////////////////////////////////////////////////// +// +// TEXTURE BAKING API +// +// If you use this API, you only have to call two functions ever. +// + +typedef struct { + unsigned short x0, y0, x1, y1; // coordinates of bbox in bitmap + float xoff, yoff, xadvance; +} stbtt_bakedchar; + +typedef struct { + float x0, y0, s0, t0; // top-left + float x1, y1, s1, t1; // bottom-right +} stbtt_aligned_quad; + +STBTT_DEF void stbtt_GetBakedQuad(const stbtt_bakedchar * chardata, int pw, int ph, // same data as above + int char_index, // character to display + float * xpos, float * ypos, // pointers to current position in screen pixel space + stbtt_aligned_quad * q, // output: quad to draw + int opengl_fillrule); // true if opengl fill rule; false if DX9 or earlier +// Call GetBakedQuad with char_index = 'character - first_char', and it +// creates the quad you need to draw and advances the current position. +// +// The coordinate system used assumes y increases downwards. +// +// Characters will extend both above and below the current position; +// see discussion of "BASELINE" above. +// +// It's inefficient; you might want to c&p it and optimize it. + + +////////////////////////////////////////////////////////////////////////////// +// +// NEW TEXTURE BAKING API +// +// This provides options for packing multiple fonts into one atlas, not +// perfectly but better than nothing. + +typedef struct { + unsigned short x0, y0, x1, y1; // coordinates of bbox in bitmap + float xoff, yoff, xadvance; + float xoff2, yoff2; +} stbtt_packedchar; + +/// @cond +/** + * Tells Doxygen to ignore a duplicate declaration + */ +typedef struct stbtt_pack_context stbtt_pack_context; +typedef struct stbtt_fontinfo stbtt_fontinfo; +/// @endcond + +#ifndef STB_RECT_PACK_VERSION +/// @cond +/** + * Tells Doxygen to ignore a duplicate declaration + */ +typedef struct stbrp_rect stbrp_rect; +/// @endcond + +#endif +STBTT_DEF int stbtt_PackBegin(stbtt_pack_context * spc, unsigned char * pixels, int width, int height, + int stride_in_bytes, int padding, void * alloc_context); + +// Initializes a packing context stored in the passed-in stbtt_pack_context. +// Future calls using this context will pack characters into the bitmap passed +// in here: a 1-channel bitmap that is width * height. stride_in_bytes is +// the distance from one row to the next (or 0 to mean they are packed tightly +// together). "padding" is the amount of padding to leave between each +// character (normally you want '1' for bitmaps you'll use as textures with +// bilinear filtering). +// +// Returns 0 on failure, 1 on success. + +STBTT_DEF void stbtt_PackEnd(stbtt_pack_context * spc); +// Cleans up the packing context and frees all memory. + +#define STBTT_POINT_SIZE(x) (-(x)) + +typedef struct { + float font_size; + int first_unicode_codepoint_in_range; // if non-zero, then the chars are continuous, and this is the first codepoint + int * array_of_unicode_codepoints; // if non-zero, then this is an array of unicode codepoints + int num_chars; + stbtt_packedchar * chardata_for_range; // output + unsigned char h_oversample, v_oversample; // don't set these, they're used internally +} stbtt_pack_range; + +STBTT_DEF void stbtt_PackSetOversampling(stbtt_pack_context * spc, unsigned int h_oversample, + unsigned int v_oversample); +// Oversampling a font increases the quality by allowing higher-quality subpixel +// positioning, and is especially valuable at smaller text sizes. +// +// This function sets the amount of oversampling for all following calls to +// stbtt_PackFontRange(s) or stbtt_PackFontRangesGatherRects for a given +// pack context. The default (no oversampling) is achieved by h_oversample=1 +// and v_oversample=1. The total number of pixels required is +// h_oversample*v_oversample larger than the default; for example, 2x2 +// oversampling requires 4x the storage of 1x1. For best results, render +// oversampled textures with bilinear filtering. Look at the readme in +// stb/tests/oversample for information about oversampled fonts +// +// To use with PackFontRangesGather etc., you must set it before calls +// call to PackFontRangesGatherRects. + +STBTT_DEF void stbtt_PackSetSkipMissingCodepoints(stbtt_pack_context * spc, int skip); +// If skip != 0, this tells stb_truetype to skip any codepoints for which +// there is no corresponding glyph. If skip=0, which is the default, then +// codepoints without a glyph received the font's "missing character" glyph, +// typically an empty box by convention. + +STBTT_DEF void stbtt_GetPackedQuad(const stbtt_packedchar * chardata, int pw, int ph, // same data as above + int char_index, // character to display + float * xpos, float * ypos, // pointers to current position in screen pixel space + stbtt_aligned_quad * q, // output: quad to draw + int align_to_integer); + +STBTT_DEF int stbtt_PackFontRangesGatherRects(stbtt_pack_context * spc, const stbtt_fontinfo * info, + stbtt_pack_range * ranges, int num_ranges, stbrp_rect * rects); +STBTT_DEF void stbtt_PackFontRangesPackRects(stbtt_pack_context * spc, stbrp_rect * rects, int num_rects); +STBTT_DEF int stbtt_PackFontRangesRenderIntoRects(stbtt_pack_context * spc, const stbtt_fontinfo * info, + stbtt_pack_range * ranges, int num_ranges, stbrp_rect * rects); +// Calling these functions in sequence is roughly equivalent to calling +// stbtt_PackFontRanges(). If you more control over the packing of multiple +// fonts, or if you want to pack custom data into a font texture, take a look +// at the source to of stbtt_PackFontRanges() and create a custom version +// using these functions, e.g. call GatherRects multiple times, +// building up a single array of rects, then call PackRects once, +// then call RenderIntoRects repeatedly. This may result in a +// better packing than calling PackFontRanges multiple times +// (or it may not). + +// this is an opaque structure that you shouldn't mess with which holds +// all the context needed from PackBegin to PackEnd. +struct stbtt_pack_context { + void * user_allocator_context; + void * pack_info; + int width; + int height; + int stride_in_bytes; + int padding; + int skip_missing; + unsigned int h_oversample, v_oversample; + unsigned char * pixels; + void * nodes; +}; + +////////////////////////////////////////////////////////////////////////////// +// +// FONT LOADING +// +// +#ifdef STBTT_STREAM_TYPE +STBTT_DEF int stbtt_GetNumberOfFonts(STBTT_STREAM_TYPE data); +#else +STBTT_DEF int stbtt_GetNumberOfFonts(const unsigned char * data); +#endif +// This function will determine the number of fonts in a font file. TrueType +// collection (.ttc) files may contain multiple fonts, while TrueType font +// (.ttf) files only contain one font. The number of fonts can be used for +// indexing with the previous function where the index is between zero and one +// less than the total fonts. If an error occurs, -1 is returned. +#ifdef STBTT_STREAM_TYPE +STBTT_DEF int stbtt_GetFontOffsetForIndex(STBTT_STREAM_TYPE, int index); +#else +STBTT_DEF int stbtt_GetFontOffsetForIndex(const unsigned char * data, int index); +#endif + +// Each .ttf/.ttc file may have more than one font. Each font has a sequential +// index number starting from 0. Call this function to get the font offset for +// a given index; it returns -1 if the index is out of range. A regular .ttf +// file will only define one font and it always be at offset 0, so it will +// return '0' for index 0, and -1 for all other indices. + +// The following structure is defined publicly so you can declare one on +// the stack or as a global or etc, but you should treat it as opaque. +struct stbtt_fontinfo { + void * userdata; +#ifdef STBTT_STREAM_TYPE + STBTT_STREAM_TYPE data; +#else + unsigned char * data; // pointer to .ttf file +#endif + int fontstart; // offset of start of font + + int numGlyphs; // number of glyphs, needed for range checking + + int loca, head, glyf, hhea, hmtx, kern, gpos, svg; // table locations as offset from start of .ttf + int index_map; // a cmap mapping for our chosen character encoding + int indexToLocFormat; // format needed to map from glyph index to glyph + + stbtt__buf cff; // cff font data + stbtt__buf charstrings; // the charstring index + stbtt__buf gsubrs; // global charstring subroutines index + stbtt__buf subrs; // private charstring subroutines index + stbtt__buf fontdicts; // array of font dicts + stbtt__buf fdselect; // map from glyph to fontdict +}; +#ifdef STBTT_STREAM_TYPE +STBTT_DEF int stbtt_InitFont(stbtt_fontinfo * info, STBTT_STREAM_TYPE data, int offset); +#else +STBTT_DEF int stbtt_InitFont(stbtt_fontinfo * info, const unsigned char * data, int offset); +#endif +// Given an offset into the file that defines a font, this function builds +// the necessary cached info for the rest of the system. You must allocate +// the stbtt_fontinfo yourself, and stbtt_InitFont will fill it out. You don't +// need to do anything special to free it, because the contents are pure +// value data with no additional data structures. Returns 0 on failure. + + +////////////////////////////////////////////////////////////////////////////// +// +// CHARACTER TO GLYPH-INDEX CONVERSIOn + +STBTT_DEF int stbtt_FindGlyphIndex(const stbtt_fontinfo * info, int unicode_codepoint); +// If you're going to perform multiple operations on the same character +// and you want a speed-up, call this function with the character you're +// going to process, then use glyph-based functions instead of the +// codepoint-based functions. +// Returns 0 if the character codepoint is not defined in the font. + + +////////////////////////////////////////////////////////////////////////////// +// +// CHARACTER PROPERTIES +// + +STBTT_DEF float stbtt_ScaleForPixelHeight(const stbtt_fontinfo * info, float pixels); +// computes a scale factor to produce a font whose "height" is 'pixels' tall. +// Height is measured as the distance from the highest ascender to the lowest +// descender; in other words, it's equivalent to calling stbtt_GetFontVMetrics +// and computing: +// scale = pixels / (ascent - descent) +// so if you prefer to measure height by the ascent only, use a similar calculation. + +STBTT_DEF float stbtt_ScaleForMappingEmToPixels(const stbtt_fontinfo * info, float pixels); +// computes a scale factor to produce a font whose EM size is mapped to +// 'pixels' tall. This is probably what traditional APIs compute, but +// I'm not positive. + +STBTT_DEF void stbtt_GetFontVMetrics(const stbtt_fontinfo * info, int * ascent, int * descent, int * lineGap); +// ascent is the coordinate above the baseline the font extends; descent +// is the coordinate below the baseline the font extends (i.e. it is typically negative) +// lineGap is the spacing between one row's descent and the next row's ascent... +// so you should advance the vertical position by "*ascent - *descent + *lineGap" +// these are expressed in unscaled coordinates, so you must multiply by +// the scale factor for a given size + +STBTT_DEF int stbtt_GetFontVMetricsOS2(const stbtt_fontinfo * info, int * typoAscent, int * typoDescent, + int * typoLineGap); +// analogous to GetFontVMetrics, but returns the "typographic" values from the OS/2 +// table (specific to MS/Windows TTF files). +// +// Returns 1 on success (table present), 0 on failure. + +STBTT_DEF void stbtt_GetFontBoundingBox(const stbtt_fontinfo * info, int * x0, int * y0, int * x1, int * y1); +// the bounding box around all possible characters + +STBTT_DEF void stbtt_GetCodepointHMetrics(const stbtt_fontinfo * info, int codepoint, int * advanceWidth, + int * leftSideBearing); +// leftSideBearing is the offset from the current horizontal position to the left edge of the character +// advanceWidth is the offset from the current horizontal position to the next horizontal position +// these are expressed in unscaled coordinates + +STBTT_DEF int stbtt_GetCodepointKernAdvance(const stbtt_fontinfo * info, int ch1, int ch2); +// an additional amount to add to the 'advance' value between ch1 and ch2 + +STBTT_DEF int stbtt_GetCodepointBox(const stbtt_fontinfo * info, int codepoint, int * x0, int * y0, int * x1, int * y1); +// Gets the bounding box of the visible part of the glyph, in unscaled coordinates + +STBTT_DEF void stbtt_GetGlyphHMetrics(const stbtt_fontinfo * info, int glyph_index, int * advanceWidth, + int * leftSideBearing); +STBTT_DEF int stbtt_GetGlyphKernAdvance(const stbtt_fontinfo * info, int glyph1, int glyph2); +STBTT_DEF int stbtt_GetGlyphBox(const stbtt_fontinfo * info, int glyph_index, int * x0, int * y0, int * x1, int * y1); +// as above, but takes one or more glyph indices for greater efficiency + +typedef struct _stbtt_kerningentry { + int glyph1; // use stbtt_FindGlyphIndex + int glyph2; + int advance; +} stbtt_kerningentry; + +STBTT_DEF int stbtt_GetKerningTableLength(const stbtt_fontinfo * info); +STBTT_DEF int stbtt_GetKerningTable(const stbtt_fontinfo * info, stbtt_kerningentry * table, int table_length); +// Retrieves a complete list of all of the kerning pairs provided by the font +// stbtt_GetKerningTable never writes more than table_length entries and returns how many entries it did write. +// The table will be sorted by (a.glyph1 == b.glyph1)?(a.glyph2 < b.glyph2):(a.glyph1 < b.glyph1) + +////////////////////////////////////////////////////////////////////////////// +// +// GLYPH SHAPES (you probably don't need these, but they have to go before +// the bitmaps for C declaration-order reasons) +// + +#ifndef STBTT_vmove // you can predefine these to use different values (but why?) +enum { + STBTT_vmove = 1, + STBTT_vline, + STBTT_vcurve, + STBTT_vcubic +}; +#endif + +#ifndef stbtt_vertex // you can predefine this to use different values +// (we share this with other code at RAD) +#define stbtt_vertex_type short // can't use stbtt_int16 because that's not visible in the header file +typedef struct { + stbtt_vertex_type x, y, cx, cy, cx1, cy1; + unsigned char type, padding; +} stbtt_vertex; +#endif + +STBTT_DEF int stbtt_IsGlyphEmpty(const stbtt_fontinfo * info, int glyph_index); +// returns non-zero if nothing is drawn for this glyph + +STBTT_DEF int stbtt_GetCodepointShape(const stbtt_fontinfo * info, int unicode_codepoint, stbtt_vertex ** vertices); +STBTT_DEF int stbtt_GetGlyphShape(const stbtt_fontinfo * info, int glyph_index, stbtt_vertex ** vertices); +// returns # of vertices and fills *vertices with the pointer to them +// these are expressed in "unscaled" coordinates +// +// The shape is a series of contours. Each one starts with +// a STBTT_moveto, then consists of a series of mixed +// STBTT_lineto and STBTT_curveto segments. A lineto +// draws a line from previous endpoint to its x,y; a curveto +// draws a quadratic bezier from previous endpoint to +// its x,y, using cx,cy as the bezier control point. + +STBTT_DEF void stbtt_FreeShape(const stbtt_fontinfo * info, stbtt_vertex * vertices); +// frees the data allocated above + +STBTT_DEF stbtt_uint32 stbtt_FindSVGDoc(const stbtt_fontinfo * info, int gl); +STBTT_DEF int stbtt_GetCodepointSVG(const stbtt_fontinfo * info, int unicode_codepoint, stbtt_uint32 * svgOfs); +STBTT_DEF int stbtt_GetGlyphSVG(const stbtt_fontinfo * info, int gl, stbtt_uint32 * svgOfs); +// fills svg with the character's SVG data. +// returns data size or 0 if SVG not found. + +////////////////////////////////////////////////////////////////////////////// +// +// BITMAP RENDERING +// + +STBTT_DEF void stbtt_FreeBitmap(unsigned char * bitmap, void * userdata); +// frees the bitmap allocated below + +STBTT_DEF unsigned char * stbtt_GetCodepointBitmap(const stbtt_fontinfo * info, float scale_x, float scale_y, + int codepoint, int * width, int * height, int * xoff, int * yoff); +// allocates a large-enough single-channel 8bpp bitmap and renders the +// specified character/glyph at the specified scale into it, with +// antialiasing. 0 is no coverage (transparent), 255 is fully covered (opaque). +// *width & *height are filled out with the width & height of the bitmap, +// which is stored left-to-right, top-to-bottom. +// +// xoff/yoff are the offset it pixel space from the glyph origin to the top-left of the bitmap + +STBTT_DEF unsigned char * stbtt_GetCodepointBitmapSubpixel(const stbtt_fontinfo * info, float scale_x, float scale_y, + float shift_x, float shift_y, int codepoint, int * width, int * height, int * xoff, int * yoff); +// the same as stbtt_GetCodepoitnBitmap, but you can specify a subpixel +// shift for the character + +STBTT_DEF void stbtt_MakeCodepointBitmap(const stbtt_fontinfo * info, unsigned char * output, int out_w, int out_h, + int out_stride, float scale_x, float scale_y, int codepoint); +// the same as stbtt_GetCodepointBitmap, but you pass in storage for the bitmap +// in the form of 'output', with row spacing of 'out_stride' bytes. the bitmap +// is clipped to out_w/out_h bytes. Call stbtt_GetCodepointBitmapBox to get the +// width and height and positioning info for it first. + +STBTT_DEF void stbtt_MakeCodepointBitmapSubpixel(const stbtt_fontinfo * info, unsigned char * output, int out_w, + int out_h, int out_stride, float scale_x, float scale_y, float shift_x, float shift_y, int codepoint); +// same as stbtt_MakeCodepointBitmap, but you can specify a subpixel +// shift for the character + +STBTT_DEF void stbtt_MakeCodepointBitmapSubpixelPrefilter(const stbtt_fontinfo * info, unsigned char * output, + int out_w, int out_h, int out_stride, float scale_x, float scale_y, float shift_x, float shift_y, int oversample_x, + int oversample_y, float * sub_x, float * sub_y, int codepoint); +// same as stbtt_MakeCodepointBitmapSubpixel, but prefiltering +// is performed (see stbtt_PackSetOversampling) + +STBTT_DEF void stbtt_GetCodepointBitmapBox(const stbtt_fontinfo * font, int codepoint, float scale_x, float scale_y, + int * ix0, int * iy0, int * ix1, int * iy1); +// get the bbox of the bitmap centered around the glyph origin; so the +// bitmap width is ix1-ix0, height is iy1-iy0, and location to place +// the bitmap top left is (leftSideBearing*scale,iy0). +// (Note that the bitmap uses y-increases-down, but the shape uses +// y-increases-up, so CodepointBitmapBox and CodepointBox are inverted.) + +STBTT_DEF void stbtt_GetCodepointBitmapBoxSubpixel(const stbtt_fontinfo * font, int codepoint, float scale_x, + float scale_y, float shift_x, float shift_y, int * ix0, int * iy0, int * ix1, int * iy1); +// same as stbtt_GetCodepointBitmapBox, but you can specify a subpixel +// shift for the character + +// the following functions are equivalent to the above functions, but operate +// on glyph indices instead of Unicode codepoints (for efficiency) +STBTT_DEF unsigned char * stbtt_GetGlyphBitmap(const stbtt_fontinfo * info, float scale_x, float scale_y, int glyph, + int * width, int * height, int * xoff, int * yoff); +STBTT_DEF unsigned char * stbtt_GetGlyphBitmapSubpixel(const stbtt_fontinfo * info, float scale_x, float scale_y, + float shift_x, float shift_y, int glyph, int * width, int * height, int * xoff, int * yoff); +STBTT_DEF void stbtt_MakeGlyphBitmap(const stbtt_fontinfo * info, unsigned char * output, int out_w, int out_h, + int out_stride, float scale_x, float scale_y, int glyph); +STBTT_DEF void stbtt_MakeGlyphBitmapSubpixel(const stbtt_fontinfo * info, unsigned char * output, int out_w, int out_h, + int out_stride, float scale_x, float scale_y, float shift_x, float shift_y, int glyph); +STBTT_DEF void stbtt_MakeGlyphBitmapSubpixelPrefilter(const stbtt_fontinfo * info, unsigned char * output, int out_w, + int out_h, int out_stride, float scale_x, float scale_y, float shift_x, float shift_y, int oversample_x, + int oversample_y, float * sub_x, float * sub_y, int glyph); +STBTT_DEF void stbtt_GetGlyphBitmapBox(const stbtt_fontinfo * font, int glyph, float scale_x, float scale_y, int * ix0, + int * iy0, int * ix1, int * iy1); +STBTT_DEF void stbtt_GetGlyphBitmapBoxSubpixel(const stbtt_fontinfo * font, int glyph, float scale_x, float scale_y, + float shift_x, float shift_y, int * ix0, int * iy0, int * ix1, int * iy1); + + +// @TODO: don't expose this structure +typedef struct { + int w, h, stride; + unsigned char * pixels; +} stbtt__bitmap; + +// rasterize a shape with quadratic beziers into a bitmap +STBTT_DEF void stbtt_Rasterize(stbtt__bitmap * result, // 1-channel bitmap to draw into + float flatness_in_pixels, // allowable error of curve in pixels + stbtt_vertex * vertices, // array of vertices defining shape + int num_verts, // number of vertices in above array + float scale_x, float scale_y, // scale applied to input vertices + float shift_x, float shift_y, // translation applied to input vertices + int x_off, int y_off, // another translation applied to input + int invert, // if non-zero, vertically flip shape + void * userdata); // context for to STBTT_MALLOC + +////////////////////////////////////////////////////////////////////////////// +// +// Signed Distance Function (or Field) rendering + +STBTT_DEF void stbtt_FreeSDF(unsigned char * bitmap, void * userdata); +// frees the SDF bitmap allocated below + +STBTT_DEF unsigned char * stbtt_GetGlyphSDF(const stbtt_fontinfo * info, float scale, int glyph, int padding, + unsigned char onedge_value, float pixel_dist_scale, int * width, int * height, int * xoff, int * yoff); +STBTT_DEF unsigned char * stbtt_GetCodepointSDF(const stbtt_fontinfo * info, float scale, int codepoint, int padding, + unsigned char onedge_value, float pixel_dist_scale, int * width, int * height, int * xoff, int * yoff); +// These functions compute a discretized SDF field for a single character, suitable for storing +// in a single-channel texture, sampling with bilinear filtering, and testing against +// larger than some threshold to produce scalable fonts. +// info -- the font +// scale -- controls the size of the resulting SDF bitmap, same as it would be creating a regular bitmap +// glyph/codepoint -- the character to generate the SDF for +// padding -- extra "pixels" around the character which are filled with the distance to the character (not 0), +// which allows effects like bit outlines +// onedge_value -- value 0-255 to test the SDF against to reconstruct the character (i.e. the isocontour of the character) +// pixel_dist_scale -- what value the SDF should increase by when moving one SDF "pixel" away from the edge (on the 0..255 scale) +// if positive, > onedge_value is inside; if negative, < onedge_value is inside +// width,height -- output height & width of the SDF bitmap (including padding) +// xoff,yoff -- output origin of the character +// return value -- a 2D array of bytes 0..255, width*height in size +// +// pixel_dist_scale & onedge_value are a scale & bias that allows you to make +// optimal use of the limited 0..255 for your application, trading off precision +// and special effects. SDF values outside the range 0..255 are clamped to 0..255. +// +// Example: +// scale = stbtt_ScaleForPixelHeight(22) +// padding = 5 +// onedge_value = 180 +// pixel_dist_scale = 180/5.0 = 36.0 +// +// This will create an SDF bitmap in which the character is about 22 pixels +// high but the whole bitmap is about 22+5+5=32 pixels high. To produce a filled +// shape, sample the SDF at each pixel and fill the pixel if the SDF value +// is greater than or equal to 180/255. (You'll actually want to antialias, +// which is beyond the scope of this example.) Additionally, you can compute +// offset outlines (e.g. to stroke the character border inside & outside, +// or only outside). For example, to fill outside the character up to 3 SDF +// pixels, you would compare against (180-36.0*3)/255 = 72/255. The above +// choice of variables maps a range from 5 pixels outside the shape to +// 2 pixels inside the shape to 0..255; this is intended primarily for apply +// outside effects only (the interior range is needed to allow proper +// antialiasing of the font at *smaller* sizes) +// +// The function computes the SDF analytically at each SDF pixel, not by e.g. +// building a higher-res bitmap and approximating it. In theory the quality +// should be as high as possible for an SDF of this size & representation, but +// unclear if this is true in practice (perhaps building a higher-res bitmap +// and computing from that can allow drop-out prevention). +// +// The algorithm has not been optimized at all, so expect it to be slow +// if computing lots of characters or very large sizes. + + + +////////////////////////////////////////////////////////////////////////////// +// +// Finding the right font... +// +// You should really just solve this offline, keep your own tables +// of what font is what, and don't try to get it out of the .ttf file. +// That's because getting it out of the .ttf file is really hard, because +// the names in the file can appear in many possible encodings, in many +// possible languages, and e.g. if you need a case-insensitive comparison, +// the details of that depend on the encoding & language in a complex way +// (actually underspecified in truetype, but also gigantic). +// +// But you can use the provided functions in two possible ways: +// stbtt_FindMatchingFont() will use *case-sensitive* comparisons on +// unicode-encoded names to try to find the font you want; +// you can run this before calling stbtt_InitFont() +// +// stbtt_GetFontNameString() lets you get any of the various strings +// from the file yourself and do your own comparisons on them. +// You have to have called stbtt_InitFont() first. + +#ifdef STBTT_STREAM_TYPE +STBTT_DEF int stbtt_FindMatchingFont(STBTT_STREAM_TYPE fontdata, const char * name, int flags); +#else +STBTT_DEF int stbtt_FindMatchingFont(const unsigned char * fontdata, const char * name, int flags); +#endif +// returns the offset (not index) of the font that matches, or -1 if none +// if you use STBTT_MACSTYLE_DONTCARE, use a font name like "Arial Bold". +// if you use any other flag, use a font name like "Arial"; this checks +// the 'macStyle' header field; i don't know if fonts set this consistently +#define STBTT_MACSTYLE_DONTCARE 0 +#define STBTT_MACSTYLE_BOLD 1 +#define STBTT_MACSTYLE_ITALIC 2 +#define STBTT_MACSTYLE_UNDERSCORE 4 +#define STBTT_MACSTYLE_NONE 8 // <= not same as 0, this makes us check the bitfield is 0 + +#ifdef STBTT_STREAM_TYPE +STBTT_DEF int stbtt_CompareUTF8toUTF16_bigendian(const char * s1, int len1, STBTT_STREAM_TYPE s2, stbtt_uint32 s2offs, + int len2); +#else +STBTT_DEF int stbtt_CompareUTF8toUTF16_bigendian(const char * s1, int len1, const char * s2, stbtt_uint32 s2offs, + int len2); +#endif +// returns 1/0 whether the first string interpreted as utf8 is identical to +// the second string interpreted as big-endian utf16... useful for strings from next func + +STBTT_DEF stbtt_uint32 stbtt_GetFontNameString(const stbtt_fontinfo * font, int * length, int platformID, + int encodingID, int languageID, int nameID); + +// returns the string (which may be big-endian double byte, e.g. for unicode) +// and puts the length in bytes in *length. +// +// some of the values for the IDs are below; for more see the truetype spec: +// http://developer.apple.com/textfonts/TTRefMan/RM06/Chap6name.html +// http://www.microsoft.com/typography/otspec/name.htm + +enum { // platformID + STBTT_PLATFORM_ID_UNICODE = 0, + STBTT_PLATFORM_ID_MAC = 1, + STBTT_PLATFORM_ID_ISO = 2, + STBTT_PLATFORM_ID_MICROSOFT = 3 +}; + +enum { // encodingID for STBTT_PLATFORM_ID_UNICODE + STBTT_UNICODE_EID_UNICODE_1_0 = 0, + STBTT_UNICODE_EID_UNICODE_1_1 = 1, + STBTT_UNICODE_EID_ISO_10646 = 2, + STBTT_UNICODE_EID_UNICODE_2_0_BMP = 3, + STBTT_UNICODE_EID_UNICODE_2_0_FULL = 4 +}; + +enum { // encodingID for STBTT_PLATFORM_ID_MICROSOFT + STBTT_MS_EID_SYMBOL = 0, + STBTT_MS_EID_UNICODE_BMP = 1, + STBTT_MS_EID_SHIFTJIS = 2, + STBTT_MS_EID_UNICODE_FULL = 10 +}; + +enum { // encodingID for STBTT_PLATFORM_ID_MAC; same as Script Manager codes + STBTT_MAC_EID_ROMAN = 0, STBTT_MAC_EID_ARABIC = 4, + STBTT_MAC_EID_JAPANESE = 1, STBTT_MAC_EID_HEBREW = 5, + STBTT_MAC_EID_CHINESE_TRAD = 2, STBTT_MAC_EID_GREEK = 6, + STBTT_MAC_EID_KOREAN = 3, STBTT_MAC_EID_RUSSIAN = 7 +}; + +enum { // languageID for STBTT_PLATFORM_ID_MICROSOFT; same as LCID... + // problematic because there are e.g. 16 english LCIDs and 16 arabic LCIDs + STBTT_MS_LANG_ENGLISH = 0x0409, STBTT_MS_LANG_ITALIAN = 0x0410, + STBTT_MS_LANG_CHINESE = 0x0804, STBTT_MS_LANG_JAPANESE = 0x0411, + STBTT_MS_LANG_DUTCH = 0x0413, STBTT_MS_LANG_KOREAN = 0x0412, + STBTT_MS_LANG_FRENCH = 0x040c, STBTT_MS_LANG_RUSSIAN = 0x0419, + STBTT_MS_LANG_GERMAN = 0x0407, STBTT_MS_LANG_SPANISH = 0x0409, + STBTT_MS_LANG_HEBREW = 0x040d, STBTT_MS_LANG_SWEDISH = 0x041D +}; + +enum { // languageID for STBTT_PLATFORM_ID_MAC + STBTT_MAC_LANG_ENGLISH = 0, STBTT_MAC_LANG_JAPANESE = 11, + STBTT_MAC_LANG_ARABIC = 12, STBTT_MAC_LANG_KOREAN = 23, + STBTT_MAC_LANG_DUTCH = 4, STBTT_MAC_LANG_RUSSIAN = 32, + STBTT_MAC_LANG_FRENCH = 1, STBTT_MAC_LANG_SPANISH = 6, + STBTT_MAC_LANG_GERMAN = 2, STBTT_MAC_LANG_SWEDISH = 5, + STBTT_MAC_LANG_HEBREW = 10, STBTT_MAC_LANG_CHINESE_SIMPLIFIED = 33, + STBTT_MAC_LANG_ITALIAN = 3, STBTT_MAC_LANG_CHINESE_TRAD = 19 +}; + +#ifdef __cplusplus +} +#endif + +#endif // __STB_INCLUDE_STB_TRUETYPE_H__ + +/////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// +//// +//// IMPLEMENTATION +//// +//// + +#ifdef STB_TRUETYPE_IMPLEMENTATION + +#ifndef STBTT_MAX_OVERSAMPLE + #define STBTT_MAX_OVERSAMPLE 8 +#endif + +#if STBTT_MAX_OVERSAMPLE > 255 + #error "STBTT_MAX_OVERSAMPLE cannot be > 255" +#endif + +typedef int stbtt__test_oversample_pow2[(STBTT_MAX_OVERSAMPLE & (STBTT_MAX_OVERSAMPLE - 1)) == 0 ? 1 : -1]; + +#ifndef STBTT_RASTERIZER_VERSION + #define STBTT_RASTERIZER_VERSION 2 +#endif + +#ifdef _MSC_VER + #define STBTT__NOTUSED(v) (void)(v) +#else + #define STBTT__NOTUSED(v) (void)sizeof(v) +#endif + +////////////////////////////////////////////////////////////////////////// +// +// stbtt__buf helpers to parse data from file +// + +static stbtt_uint8 stbtt__buf_get8(stbtt__buf * b) +{ + if(b->cursor >= b->size) + return 0; +#ifdef STBTT_STREAM_TYPE + long pos = (long)(b->cursor + b->offset); + STBTT_STREAM_SEEK(b->data, pos); + stbtt_uint8 result; + STBTT_STREAM_READ(b->data, &result, 1); + ++b->cursor; + return result; +#else + return b->data[b->cursor++]; +#endif + +} + +static stbtt_uint8 stbtt__buf_peek8(stbtt__buf * b) +{ + if(b->cursor >= b->size) + return 0; +#ifdef STBTT_STREAM_TYPE + long pos = (long)(b->cursor + b->offset); + STBTT_STREAM_SEEK(b->data, pos); + stbtt_uint8 result; + STBTT_STREAM_READ(b->data, &result, 1); + return result; +#else + return b->data[b->cursor]; +#endif + +} + +static void stbtt__buf_seek(stbtt__buf * b, int o) +{ + STBTT_assert(!(o > b->size || o < 0)); + b->cursor = (o > b->size || o < 0) ? b->size : o; +} + +static void stbtt__buf_skip(stbtt__buf * b, int o) +{ + stbtt__buf_seek(b, b->cursor + o); +} + +static stbtt_uint32 stbtt__buf_get(stbtt__buf * b, int n) +{ + stbtt_uint32 v = 0; + int i; + STBTT_assert(n >= 1 && n <= 4); + for(i = 0; i < n; i++) + v = (v << 8) | stbtt__buf_get8(b); + return v; +} +#ifdef STBTT_STREAM_TYPE + static stbtt__buf stbtt__new_buf(STBTT_STREAM_TYPE s, size_t size) +#else + static stbtt__buf stbtt__new_buf(const void * p, size_t size) +#endif +{ + stbtt__buf r; + STBTT_assert(size < 0x40000000); +#ifdef STBTT_STREAM_TYPE + r.data = s; + r.offset = 0; +#else + r.data = (stbtt_uint8 *)p; +#endif + r.size = (int)size; + r.cursor = 0; + return r; +} + +#define stbtt__buf_get16(b) stbtt__buf_get((b), 2) +#define stbtt__buf_get32(b) stbtt__buf_get((b), 4) + +static stbtt__buf stbtt__buf_range(const stbtt__buf * b, int o, int s) +{ + stbtt__buf r = stbtt__new_buf(NULL, 0); + if(o < 0 || s < 0 || o > b->size || s > b->size - o) return r; +#ifdef STBTT_STREAM_TYPE + r.data = b->data; + r.offset = b->offset + o; +#else + r.data = b->data + o; +#endif + r.size = s; + return r; +} + +static stbtt__buf stbtt__cff_get_index(stbtt__buf * b) +{ + int count, start, offsize; + start = b->cursor; + count = stbtt__buf_get16(b); + if(count) { + offsize = stbtt__buf_get8(b); + STBTT_assert(offsize >= 1 && offsize <= 4); + stbtt__buf_skip(b, offsize * count); + stbtt__buf_skip(b, stbtt__buf_get(b, offsize) - 1); + } + return stbtt__buf_range(b, start, b->cursor - start); +} + +static stbtt_uint32 stbtt__cff_int(stbtt__buf * b) +{ + int b0 = stbtt__buf_get8(b); + if(b0 >= 32 && b0 <= 246) return b0 - 139; + else if(b0 >= 247 && b0 <= 250) return (b0 - 247) * 256 + stbtt__buf_get8(b) + 108; + else if(b0 >= 251 && b0 <= 254) return -(b0 - 251) * 256 - stbtt__buf_get8(b) - 108; + else if(b0 == 28) return stbtt__buf_get16(b); + else if(b0 == 29) return stbtt__buf_get32(b); + STBTT_assert(0); + return 0; +} + +static void stbtt__cff_skip_operand(stbtt__buf * b) +{ + int v, b0 = stbtt__buf_peek8(b); + STBTT_assert(b0 >= 28); + if(b0 == 30) { + stbtt__buf_skip(b, 1); + while(b->cursor < b->size) { + v = stbtt__buf_get8(b); + if((v & 0xF) == 0xF || (v >> 4) == 0xF) + break; + } + } + else { + stbtt__cff_int(b); + } +} + +static stbtt__buf stbtt__dict_get(stbtt__buf * b, int key) +{ + stbtt__buf_seek(b, 0); + while(b->cursor < b->size) { + int start = b->cursor, end, op; + while(stbtt__buf_peek8(b) >= 28) + stbtt__cff_skip_operand(b); + end = b->cursor; + op = stbtt__buf_get8(b); + if(op == 12) op = stbtt__buf_get8(b) | 0x100; + if(op == key) return stbtt__buf_range(b, start, end - start); + } + return stbtt__buf_range(b, 0, 0); +} + +static void stbtt__dict_get_ints(stbtt__buf * b, int key, int outcount, stbtt_uint32 * out) +{ + int i; + stbtt__buf operands = stbtt__dict_get(b, key); + for(i = 0; i < outcount && operands.cursor < operands.size; i++) + out[i] = stbtt__cff_int(&operands); +} + +static int stbtt__cff_index_count(stbtt__buf * b) +{ + stbtt__buf_seek(b, 0); + return stbtt__buf_get16(b); +} + +static stbtt__buf stbtt__cff_index_get(stbtt__buf b, int i) +{ + int count, offsize, start, end; + stbtt__buf_seek(&b, 0); + count = stbtt__buf_get16(&b); + offsize = stbtt__buf_get8(&b); + STBTT_assert(i >= 0 && i < count); + STBTT_assert(offsize >= 1 && offsize <= 4); + stbtt__buf_skip(&b, i * offsize); + start = stbtt__buf_get(&b, offsize); + end = stbtt__buf_get(&b, offsize); + return stbtt__buf_range(&b, 2 + (count + 1) * offsize + start, end - start); +} + +////////////////////////////////////////////////////////////////////////// +// +// accessors to parse data from file +// + +// on platforms that don't allow misaligned reads, if we want to allow +// truetype fonts that aren't padded to alignment, define ALLOW_UNALIGNED_TRUETYPE + + +#ifdef STBTT_STREAM_TYPE +static stbtt_uint8 ttBYTE(STBTT_STREAM_TYPE s, stbtt_uint32 offset) +{ + STBTT_STREAM_SEEK(s, offset); + stbtt_uint8 r; + STBTT_STREAM_READ(s, &r, 1); + return r; +} +#define ttCHAR(s, offset) ((stbtt_int8)ttBYTE(s,offset)) +static stbtt_uint16 ttUSHORT(STBTT_STREAM_TYPE s, stbtt_uint32 offset) +{ + STBTT_STREAM_SEEK(s, offset); + stbtt_uint8 r[2]; + STBTT_STREAM_READ(s, &r, 2); + return r[0] * 256 + r[1]; +} +static stbtt_int16 ttSHORT(STBTT_STREAM_TYPE s, stbtt_uint32 offset) +{ + STBTT_STREAM_SEEK(s, offset); + stbtt_uint8 r[2]; + STBTT_STREAM_READ(s, &r, 2); + return r[0] * 256 + r[1]; +} +static stbtt_uint32 ttULONG(STBTT_STREAM_TYPE s, stbtt_uint32 offset) +{ + STBTT_STREAM_SEEK(s, offset); + stbtt_uint8 r[4]; + STBTT_STREAM_READ(s, &r, 4); + return (r[0] << 24) + (r[1] << 16) + (r[2] << 8) + r[3]; +} +static stbtt_int32 ttLONG(STBTT_STREAM_TYPE s, stbtt_uint32 offset) +{ + STBTT_STREAM_SEEK(s, offset); + stbtt_uint8 r[4]; + STBTT_STREAM_READ(s, &r, 4); + return (r[0] << 24) + (r[1] << 16) + (r[2] << 8) + r[3]; +} +#else +#define ttBYTE(p, offset) (* (stbtt_uint8 *) (p+offset)) +#define ttCHAR(p, offset) (* (stbtt_int8 *) (p+offset)) +static stbtt_uint16 ttUSHORT(const stbtt_uint8 * p, stbtt_uint32 offset) +{ + return p[offset + 0] * 256 + p[offset + 1]; +} +static stbtt_int16 ttSHORT(const stbtt_uint8 * p, stbtt_uint32 offset) +{ + return p[offset + 0] * 256 + p[offset + 1]; +} +static stbtt_uint32 ttULONG(const stbtt_uint8 * p, stbtt_uint32 offset) +{ + return (p[offset + 0] << 24) + (p[offset + 1] << 16) + (p[offset + 2] << 8) + p[offset + 3]; +} +static stbtt_int32 ttLONG(const stbtt_uint8 * p, stbtt_uint32 offset) +{ + return (p[offset + 0] << 24) + (p[offset + 1] << 16) + (p[offset + 2] << 8) + p[offset + 3]; +} +#endif +#define ttFixed(p, offset) ttLONG(p, offset) + +#define stbtt_tag4(p,c0,c1,c2,c3) ((p)[0] == (c0) && (p)[1] == (c1) && (p)[2] == (c2) && (p)[3] == (c3)) +#define stbtt_tag(p,str) stbtt_tag4(p,str[0],str[1],str[2],str[3]) +#ifdef STBTT_STREAM_TYPE + static int stbtt__isfont(STBTT_STREAM_TYPE stream, stbtt_uint32 offs) +#else + static int stbtt__isfont(stbtt_uint8 * font, stbtt_uint32 offs) +#endif +{ +#ifdef STBTT_STREAM_TYPE + stbtt_uint8 font[4]; + STBTT_STREAM_SEEK(stream, offs); + STBTT_STREAM_READ(stream, font, 4); +#else + font += offs; +#endif + // check the version number + if(stbtt_tag4(font, '1', 0, 0, 0)) return 1; // TrueType 1 + if(stbtt_tag(font, "typ1")) return 1; // TrueType with type 1 font -- we don't support this! + if(stbtt_tag(font, "OTTO")) return 1; // OpenType with CFF + if(stbtt_tag4(font, 0, 1, 0, 0)) return 1; // OpenType 1.0 + if(stbtt_tag(font, "true")) return 1; // Apple specification for TrueType fonts + return 0; +} + +// @OPTIMIZE: binary search +#ifdef STBTT_STREAM_TYPE + static stbtt_uint32 stbtt__find_table(STBTT_STREAM_TYPE data, stbtt_uint32 fontstart, const char * tag) +#else + static stbtt_uint32 stbtt__find_table(stbtt_uint8 * data, stbtt_uint32 fontstart, const char * tag) +#endif +{ + stbtt_int32 num_tables = ttUSHORT(data, fontstart + 4); + stbtt_uint32 tabledir = fontstart + 12; + stbtt_int32 i; + for(i = 0; i < num_tables; ++i) { + stbtt_uint32 loc = tabledir + 16 * i; +#ifdef STBTT_STREAM_TYPE + stbtt_uint8 buf[4]; + STBTT_STREAM_SEEK(data, loc + 0); + STBTT_STREAM_READ(data, buf, 4); + if(stbtt_tag(buf, tag)) + return ttULONG(data, loc + 8); +#else + if(stbtt_tag(data + loc + 0, tag)) + return ttULONG(data, loc + 8); +#endif + } + return 0; +} +#ifdef STBTT_STREAM_TYPE + static int stbtt_GetFontOffsetForIndex_internal(STBTT_STREAM_TYPE font_collection, int index) +#else + static int stbtt_GetFontOffsetForIndex_internal(unsigned char * font_collection, int index) +#endif +{ + // if it's just a font, there's only one valid index + if(stbtt__isfont(font_collection, 0)) + return index == 0 ? 0 : -1; + + // check if it's a TTC +#ifdef STBTT_STREAM_TYPE + stbtt_uint8 buf[4]; + STBTT_STREAM_SEEK(font_collection, 0); + STBTT_STREAM_READ(font_collection, buf, 4); + if(stbtt_tag(buf, "ttcf")) { +#else + if(stbtt_tag(font_collection, "ttcf")) { +#endif + // version 1? + if(ttULONG(font_collection, 4) == 0x00010000 || ttULONG(font_collection, 4) == 0x00020000) { + stbtt_int32 n = ttLONG(font_collection, 8); + if(index >= n) + return -1; + return ttULONG(font_collection, 12 + index * 4); + } + } + return -1; +} +#ifdef STBTT_STREAM_TYPE + static int stbtt_GetNumberOfFonts_internal(STBTT_STREAM_TYPE font_collection) +#else + static int stbtt_GetNumberOfFonts_internal(unsigned char * font_collection) +#endif +{ + // if it's just a font, there's only one valid font + if(stbtt__isfont(font_collection, 0)) + return 1; + + // check if it's a TTC +#ifdef STBTT_STREAM_TYPE + stbtt_uint8 buf[4]; + STBTT_STREAM_SEEK(font_collection, 0); + STBTT_STREAM_READ(font_collection, buf, 4); + if(stbtt_tag(buf, "ttcf")) { +#else + if(stbtt_tag(font_collection, "ttcf")) { +#endif + // version 1? + if(ttULONG(font_collection, 4) == 0x00010000 || ttULONG(font_collection, 4) == 0x00020000) { + return ttLONG(font_collection, 8); + } + } + return 0; +} + +static stbtt__buf stbtt__get_subrs(stbtt__buf cff, stbtt__buf fontdict) +{ + stbtt_uint32 subrsoff = 0, private_loc[2] = { 0, 0 }; + stbtt__buf pdict; + stbtt__dict_get_ints(&fontdict, 18, 2, private_loc); + if(!private_loc[1] || !private_loc[0]) return stbtt__new_buf(NULL, 0); + pdict = stbtt__buf_range(&cff, private_loc[1], private_loc[0]); + stbtt__dict_get_ints(&pdict, 19, 1, &subrsoff); + if(!subrsoff) return stbtt__new_buf(NULL, 0); + stbtt__buf_seek(&cff, private_loc[1] + subrsoff); + return stbtt__cff_get_index(&cff); +} + +// since most people won't use this, find this table the first time it's needed +static int stbtt__get_svg(stbtt_fontinfo * info) +{ + stbtt_uint32 t; + if(info->svg < 0) { + t = stbtt__find_table(info->data, info->fontstart, "SVG "); + if(t) { + stbtt_uint32 offset = ttULONG(info->data, t + 2); + info->svg = t + offset; + } + else { + info->svg = 0; + } + } + return info->svg; +} +#ifdef STBTT_STREAM_TYPE + static int stbtt_InitFont_internal(stbtt_fontinfo * info, STBTT_STREAM_TYPE data, int fontstart) +#else + static int stbtt_InitFont_internal(stbtt_fontinfo * info, unsigned char * data, int fontstart) +#endif +{ + stbtt_uint32 cmap, t; + stbtt_int32 i, numTables; + + info->data = data; + info->fontstart = fontstart; + info->cff = stbtt__new_buf(NULL, 0); + + cmap = stbtt__find_table(data, fontstart, "cmap"); // required + info->loca = stbtt__find_table(data, fontstart, "loca"); // required + info->head = stbtt__find_table(data, fontstart, "head"); // required + info->glyf = stbtt__find_table(data, fontstart, "glyf"); // required + info->hhea = stbtt__find_table(data, fontstart, "hhea"); // required + info->hmtx = stbtt__find_table(data, fontstart, "hmtx"); // required + info->kern = stbtt__find_table(data, fontstart, "kern"); // not required + info->gpos = stbtt__find_table(data, fontstart, "GPOS"); // not required + + if(!cmap || !info->head || !info->hhea || !info->hmtx) + return 0; + if(info->glyf) { + // required for truetype + if(!info->loca) return 0; + } + else { + // initialization for CFF / Type2 fonts (OTF) + stbtt__buf b, topdict, topdictidx; + stbtt_uint32 cstype = 2, charstrings = 0, fdarrayoff = 0, fdselectoff = 0; + stbtt_uint32 cff; + + cff = stbtt__find_table(data, fontstart, "CFF "); + if(!cff) return 0; + + info->fontdicts = stbtt__new_buf(NULL, 0); + info->fdselect = stbtt__new_buf(NULL, 0); + + // @TODO this should use size from table (not 512MB) + +#ifdef STBTT_STREAM_TYPE + info->cff = stbtt__new_buf(info->data, 512 * 1024 * 1024); + info->cff.offset = cff; +#else + info->cff = stbtt__new_buf(info->data + cff, 512 * 1024 * 1024); +#endif + b = info->cff; + + // read the header + stbtt__buf_skip(&b, 2); + stbtt__buf_seek(&b, stbtt__buf_get8(&b)); // hdrsize + + // @TODO the name INDEX could list multiple fonts, + // but we just use the first one. + stbtt__cff_get_index(&b); // name INDEX + topdictidx = stbtt__cff_get_index(&b); + topdict = stbtt__cff_index_get(topdictidx, 0); + stbtt__cff_get_index(&b); // string INDEX + info->gsubrs = stbtt__cff_get_index(&b); + + stbtt__dict_get_ints(&topdict, 17, 1, &charstrings); + stbtt__dict_get_ints(&topdict, 0x100 | 6, 1, &cstype); + stbtt__dict_get_ints(&topdict, 0x100 | 36, 1, &fdarrayoff); + stbtt__dict_get_ints(&topdict, 0x100 | 37, 1, &fdselectoff); + info->subrs = stbtt__get_subrs(b, topdict); + + // we only support Type 2 charstrings + if(cstype != 2) return 0; + if(charstrings == 0) return 0; + + if(fdarrayoff) { + // looks like a CID font + if(!fdselectoff) return 0; + stbtt__buf_seek(&b, fdarrayoff); + info->fontdicts = stbtt__cff_get_index(&b); + info->fdselect = stbtt__buf_range(&b, fdselectoff, b.size - fdselectoff); + } + + stbtt__buf_seek(&b, charstrings); + info->charstrings = stbtt__cff_get_index(&b); + } + + t = stbtt__find_table(data, fontstart, "maxp"); + if(t) + info->numGlyphs = ttUSHORT(data, t + 4); + else + info->numGlyphs = 0xffff; + + info->svg = -1; + + // find a cmap encoding table we understand *now* to avoid searching + // later. (todo: could make this installable) + // the same regardless of glyph. + numTables = ttUSHORT(data, cmap + 2); + info->index_map = 0; + for(i = 0; i < numTables; ++i) { + stbtt_uint32 encoding_record = cmap + 4 + 8 * i; + // find an encoding we understand: + switch(ttUSHORT(data, encoding_record)) { + case STBTT_PLATFORM_ID_MICROSOFT: + switch(ttUSHORT(data, encoding_record + 2)) { + case STBTT_MS_EID_UNICODE_BMP: + case STBTT_MS_EID_UNICODE_FULL: + // MS/Unicode + info->index_map = cmap + ttULONG(data, encoding_record + 4); + break; + } + break; + case STBTT_PLATFORM_ID_UNICODE: + // Mac/iOS has these + // all the encodingIDs are unicode, so we don't bother to check it + info->index_map = cmap + ttULONG(data, encoding_record + 4); + break; + } + } + if(info->index_map == 0) + return 0; + + info->indexToLocFormat = ttUSHORT(data, info->head + 50); + return 1; +} + +STBTT_DEF int stbtt_FindGlyphIndex(const stbtt_fontinfo * info, int unicode_codepoint) +{ +#ifdef STBTT_STREAM_TYPE + STBTT_STREAM_TYPE data = info->data; +#else + stbtt_uint8 * data = info->data; +#endif + stbtt_uint32 index_map = info->index_map; + + stbtt_uint16 format = ttUSHORT(data, index_map + 0); + if(format == 0) { // apple byte encoding + stbtt_int32 bytes = ttUSHORT(data, index_map + 2); + if(unicode_codepoint < bytes - 6) + return ttBYTE(data, index_map + 6 + unicode_codepoint); + return 0; + } + else if(format == 6) { + stbtt_uint32 first = ttUSHORT(data, index_map + 6); + stbtt_uint32 count = ttUSHORT(data, index_map + 8); + if((stbtt_uint32)unicode_codepoint >= first && (stbtt_uint32)unicode_codepoint < first + count) + return ttUSHORT(data, index_map + 10 + (unicode_codepoint - first) * 2); + return 0; + } + else if(format == 2) { + STBTT_assert(0); // @TODO: high-byte mapping for japanese/chinese/korean + return 0; + } + else if(format == 4) { // standard mapping for windows fonts: binary search collection of ranges + stbtt_uint16 segcount = ttUSHORT(data, index_map + 6) >> 1; + stbtt_uint16 searchRange = ttUSHORT(data, index_map + 8) >> 1; + stbtt_uint16 entrySelector = ttUSHORT(data, index_map + 10); + stbtt_uint16 rangeShift = ttUSHORT(data, index_map + 12) >> 1; + + // do a binary search of the segments + stbtt_uint32 endCount = index_map + 14; + stbtt_uint32 search = endCount; + + if(unicode_codepoint > 0xffff) + return 0; + + // they lie from endCount .. endCount + segCount + // but searchRange is the nearest power of two, so... + if(unicode_codepoint >= ttUSHORT(data, search + rangeShift * 2)) + search += rangeShift * 2; + + // now decrement to bias correctly to find smallest + search -= 2; + while(entrySelector) { + stbtt_uint16 end; + searchRange >>= 1; + end = ttUSHORT(data, search + searchRange * 2); + if(unicode_codepoint > end) + search += searchRange * 2; + --entrySelector; + } + search += 2; + + { + stbtt_uint16 offset, start, last; + stbtt_uint16 item = (stbtt_uint16)((search - endCount) >> 1); + + start = ttUSHORT(data, index_map + 14 + segcount * 2 + 2 + 2 * item); + last = ttUSHORT(data, endCount + 2 * item); + if(unicode_codepoint < start || unicode_codepoint > last) + return 0; + + offset = ttUSHORT(data, index_map + 14 + segcount * 6 + 2 + 2 * item); + if(offset == 0) + return (stbtt_uint16)(unicode_codepoint + ttSHORT(data, index_map + 14 + segcount * 4 + 2 + 2 * item)); + + return ttUSHORT(data, offset + (unicode_codepoint - start) * 2 + index_map + 14 + segcount * 6 + 2 + 2 * item); + } + } + else if(format == 12 || format == 13) { + stbtt_uint32 ngroups = ttULONG(data, index_map + 12); + stbtt_int32 low, high; + low = 0; + high = (stbtt_int32)ngroups; + // Binary search the right group. + while(low < high) { + stbtt_int32 mid = low + ((high - low) >> 1); // rounds down, so low <= mid < high + stbtt_uint32 start_char = ttULONG(data, index_map + 16 + mid * 12); + stbtt_uint32 end_char = ttULONG(data, index_map + 16 + mid * 12 + 4); + if((stbtt_uint32)unicode_codepoint < start_char) + high = mid; + else if((stbtt_uint32)unicode_codepoint > end_char) + low = mid + 1; + else { + stbtt_uint32 start_glyph = ttULONG(data, index_map + 16 + mid * 12 + 8); + if(format == 12) + return start_glyph + unicode_codepoint - start_char; + else // format == 13 + return start_glyph; + } + } + return 0; // not found + } + // @TODO + STBTT_assert(0); + return 0; +} + +STBTT_DEF int stbtt_GetCodepointShape(const stbtt_fontinfo * info, int unicode_codepoint, stbtt_vertex * *vertices) +{ + return stbtt_GetGlyphShape(info, stbtt_FindGlyphIndex(info, unicode_codepoint), vertices); +} + +static void stbtt_setvertex(stbtt_vertex * v, stbtt_uint8 type, stbtt_int32 x, stbtt_int32 y, stbtt_int32 cx, + stbtt_int32 cy) +{ + v->type = type; + v->x = (stbtt_int16)x; + v->y = (stbtt_int16)y; + v->cx = (stbtt_int16)cx; + v->cy = (stbtt_int16)cy; +} + +static int stbtt__GetGlyfOffset(const stbtt_fontinfo * info, int glyph_index) +{ + int g1, g2; + + STBTT_assert(!info->cff.size); + + if(glyph_index >= info->numGlyphs) return -1; // glyph index out of range + if(info->indexToLocFormat >= 2) return -1; // unknown index->glyph map format + + if(info->indexToLocFormat == 0) { + g1 = info->glyf + ttUSHORT(info->data, info->loca + glyph_index * 2) * 2; + g2 = info->glyf + ttUSHORT(info->data, info->loca + glyph_index * 2 + 2) * 2; + } + else { + g1 = info->glyf + ttULONG(info->data, info->loca + glyph_index * 4); + g2 = info->glyf + ttULONG(info->data, info->loca + glyph_index * 4 + 4); + } + + return g1 == g2 ? -1 : g1; // if length is 0, return -1 +} + +static int stbtt__GetGlyphInfoT2(const stbtt_fontinfo * info, int glyph_index, int * x0, int * y0, int * x1, int * y1); + +STBTT_DEF int stbtt_GetGlyphBox(const stbtt_fontinfo * info, int glyph_index, int * x0, int * y0, int * x1, int * y1) +{ + if(info->cff.size) { + stbtt__GetGlyphInfoT2(info, glyph_index, x0, y0, x1, y1); + } + else { + int g = stbtt__GetGlyfOffset(info, glyph_index); + if(g < 0) return 0; + + if(x0) *x0 = ttSHORT(info->data, g + 2); + if(y0) *y0 = ttSHORT(info->data, g + 4); + if(x1) *x1 = ttSHORT(info->data, g + 6); + if(y1) *y1 = ttSHORT(info->data, g + 8); + } + return 1; +} + +STBTT_DEF int stbtt_GetCodepointBox(const stbtt_fontinfo * info, int codepoint, int * x0, int * y0, int * x1, int * y1) +{ + return stbtt_GetGlyphBox(info, stbtt_FindGlyphIndex(info, codepoint), x0, y0, x1, y1); +} + +STBTT_DEF int stbtt_IsGlyphEmpty(const stbtt_fontinfo * info, int glyph_index) +{ + stbtt_int16 numberOfContours; + int g; + if(info->cff.size) + return stbtt__GetGlyphInfoT2(info, glyph_index, NULL, NULL, NULL, NULL) == 0; + g = stbtt__GetGlyfOffset(info, glyph_index); + if(g < 0) return 1; + numberOfContours = ttSHORT(info->data, g); + return numberOfContours == 0; +} + +static int stbtt__close_shape(stbtt_vertex * vertices, int num_vertices, int was_off, int start_off, + stbtt_int32 sx, stbtt_int32 sy, stbtt_int32 scx, stbtt_int32 scy, stbtt_int32 cx, stbtt_int32 cy) +{ + if(start_off) { + if(was_off) + stbtt_setvertex(&vertices[num_vertices++], STBTT_vcurve, (cx + scx) >> 1, (cy + scy) >> 1, cx, cy); + stbtt_setvertex(&vertices[num_vertices++], STBTT_vcurve, sx, sy, scx, scy); + } + else { + if(was_off) + stbtt_setvertex(&vertices[num_vertices++], STBTT_vcurve, sx, sy, cx, cy); + else + stbtt_setvertex(&vertices[num_vertices++], STBTT_vline, sx, sy, 0, 0); + } + return num_vertices; +} + +static int stbtt__GetGlyphShapeTT(const stbtt_fontinfo * info, int glyph_index, stbtt_vertex * *pvertices) +{ + stbtt_int16 numberOfContours; + stbtt_uint32 endPtsOfContours; +#ifdef STBTT_STREAM_TYPE + STBTT_STREAM_TYPE data = info->data; +#else + stbtt_uint8 * data = info->data; +#endif + stbtt_vertex * vertices = 0; + int num_vertices = 0; + int g = stbtt__GetGlyfOffset(info, glyph_index); + + *pvertices = NULL; + + if(g < 0) return 0; + + numberOfContours = ttSHORT(data, g); + + if(numberOfContours > 0) { + stbtt_uint8 flags = 0, flagcount; + stbtt_int32 ins, i, j = 0, m, n, next_move, was_off = 0, off, start_off = 0; + stbtt_int32 x, y, cx, cy, sx, sy, scx, scy; + stbtt_uint32 points; + endPtsOfContours = (g + 10); + ins = ttUSHORT(data, g + 10 + numberOfContours * 2); + points = g + 10 + numberOfContours * 2 + 2 + ins; + + n = 1 + ttUSHORT(data, endPtsOfContours + numberOfContours * 2 - 2); + + m = n + 2 * numberOfContours; // a loose bound on how many vertices we might need + vertices = (stbtt_vertex *)STBTT_malloc(m * sizeof(vertices[0]), info->userdata); + if(vertices == 0) + return 0; + + next_move = 0; + flagcount = 0; + + // in first pass, we load uninterpreted data into the allocated array + // above, shifted to the end of the array so we won't overwrite it when + // we create our final data starting from the front + + off = m - n; // starting offset for uninterpreted data, regardless of how m ends up being calculated + + // first load flags + + for(i = 0; i < n; ++i) { + if(flagcount == 0) { + flags = ttBYTE(data, points++); + if(flags & 8) + flagcount = ttBYTE(data, points++); + } + else + --flagcount; + vertices[off + i].type = flags; + } + + // now load x coordinates + x = 0; + for(i = 0; i < n; ++i) { + flags = vertices[off + i].type; + if(flags & 2) { + stbtt_int16 dx = ttBYTE(data, points++); + x += (flags & 16) ? dx : -dx; // ??? + } + else { + if(!(flags & 16)) { + x = x + (stbtt_int16)(ttBYTE(data, points) * 256 + ttBYTE(data, points + 1)); + points += 2; + } + } + vertices[off + i].x = (stbtt_int16)x; + } + + // now load y coordinates + y = 0; + for(i = 0; i < n; ++i) { + flags = vertices[off + i].type; + if(flags & 4) { + stbtt_int16 dy = ttBYTE(data, points++); + y += (flags & 32) ? dy : -dy; // ??? + } + else { + if(!(flags & 32)) { + y = y + (stbtt_int16)(ttBYTE(data, points) * 256 + ttBYTE(data, points + 1)); + points += 2; + } + } + vertices[off + i].y = (stbtt_int16)y; + } + + // now convert them to our format + num_vertices = 0; + sx = sy = cx = cy = scx = scy = 0; + for(i = 0; i < n; ++i) { + flags = vertices[off + i].type; + x = (stbtt_int16)vertices[off + i].x; + y = (stbtt_int16)vertices[off + i].y; + + if(next_move == i) { + if(i != 0) + num_vertices = stbtt__close_shape(vertices, num_vertices, was_off, start_off, sx, sy, scx, scy, cx, cy); + + // now start the new one + start_off = !(flags & 1); + if(start_off) { + // if we start off with an off-curve point, then when we need to find a point on the curve + // where we can start, and we need to save some state for when we wraparound. + scx = x; + scy = y; + if(!(vertices[off + i + 1].type & 1)) { + // next point is also a curve point, so interpolate an on-point curve + sx = (x + (stbtt_int32)vertices[off + i + 1].x) >> 1; + sy = (y + (stbtt_int32)vertices[off + i + 1].y) >> 1; + } + else { + // otherwise just use the next point as our start point + sx = (stbtt_int32)vertices[off + i + 1].x; + sy = (stbtt_int32)vertices[off + i + 1].y; + ++i; // we're using point i+1 as the starting point, so skip it + } + } + else { + sx = x; + sy = y; + } + stbtt_setvertex(&vertices[num_vertices++], STBTT_vmove, sx, sy, 0, 0); + was_off = 0; + next_move = 1 + ttUSHORT(data, endPtsOfContours + j * 2); + ++j; + } + else { + if(!(flags & 1)) { // if it's a curve + if(was_off) // two off-curve control points in a row means interpolate an on-curve midpoint + stbtt_setvertex(&vertices[num_vertices++], STBTT_vcurve, (cx + x) >> 1, (cy + y) >> 1, cx, cy); + cx = x; + cy = y; + was_off = 1; + } + else { + if(was_off) + stbtt_setvertex(&vertices[num_vertices++], STBTT_vcurve, x, y, cx, cy); + else + stbtt_setvertex(&vertices[num_vertices++], STBTT_vline, x, y, 0, 0); + was_off = 0; + } + } + } + num_vertices = stbtt__close_shape(vertices, num_vertices, was_off, start_off, sx, sy, scx, scy, cx, cy); + } + else if(numberOfContours < 0) { + // Compound shapes. + int more = 1; + stbtt_uint32 comp = g + 10; + num_vertices = 0; + vertices = 0; + while(more) { + stbtt_uint16 flags, gidx; + int comp_num_verts = 0, i; + stbtt_vertex * comp_verts = 0, * tmp = 0; + float mtx[6] = { 1, 0, 0, 1, 0, 0 }, m, n; + + flags = ttSHORT(data, comp); + comp += 2; + gidx = ttSHORT(data, comp); + comp += 2; + + if(flags & 2) { // XY values + if(flags & 1) { // shorts + mtx[4] = ttSHORT(data, comp); + comp += 2; + mtx[5] = ttSHORT(data, comp); + comp += 2; + } + else { + mtx[4] = ttCHAR(data, comp); + comp += 1; + mtx[5] = ttCHAR(data, comp); + comp += 1; + } + } + else { + // @TODO handle matching point + STBTT_assert(0); + } + if(flags & (1 << 3)) { // WE_HAVE_A_SCALE + mtx[0] = mtx[3] = ttSHORT(data, comp) / 16384.0f; + comp += 2; + mtx[1] = mtx[2] = 0; + } + else if(flags & (1 << 6)) { // WE_HAVE_AN_X_AND_YSCALE + mtx[0] = ttSHORT(data, comp) / 16384.0f; + comp += 2; + mtx[1] = mtx[2] = 0; + mtx[3] = ttSHORT(data, comp) / 16384.0f; + comp += 2; + } + else if(flags & (1 << 7)) { // WE_HAVE_A_TWO_BY_TWO + mtx[0] = ttSHORT(data, comp) / 16384.0f; + comp += 2; + mtx[1] = ttSHORT(data, comp) / 16384.0f; + comp += 2; + mtx[2] = ttSHORT(data, comp) / 16384.0f; + comp += 2; + mtx[3] = ttSHORT(data, comp) / 16384.0f; + comp += 2; + } + + // Find transformation scales. + m = (float)STBTT_sqrt(mtx[0] * mtx[0] + mtx[1] * mtx[1]); + n = (float)STBTT_sqrt(mtx[2] * mtx[2] + mtx[3] * mtx[3]); + + // Get indexed glyph. + comp_num_verts = stbtt_GetGlyphShape(info, gidx, &comp_verts); + if(comp_num_verts > 0) { + // Transform vertices. + for(i = 0; i < comp_num_verts; ++i) { + stbtt_vertex * v = &comp_verts[i]; + stbtt_vertex_type x, y; + x = v->x; + y = v->y; + v->x = (stbtt_vertex_type)(m * (mtx[0] * x + mtx[2] * y + mtx[4])); + v->y = (stbtt_vertex_type)(n * (mtx[1] * x + mtx[3] * y + mtx[5])); + x = v->cx; + y = v->cy; + v->cx = (stbtt_vertex_type)(m * (mtx[0] * x + mtx[2] * y + mtx[4])); + v->cy = (stbtt_vertex_type)(n * (mtx[1] * x + mtx[3] * y + mtx[5])); + } + // Append vertices. + tmp = (stbtt_vertex *)STBTT_malloc((num_vertices + comp_num_verts) * sizeof(stbtt_vertex), info->userdata); + if(!tmp) { + if(vertices) STBTT_free(vertices, info->userdata); + if(comp_verts) STBTT_free(comp_verts, info->userdata); + return 0; + } + if(num_vertices > 0 && vertices) STBTT_memcpy(tmp, vertices, num_vertices * sizeof(stbtt_vertex)); + STBTT_memcpy(tmp + num_vertices, comp_verts, comp_num_verts * sizeof(stbtt_vertex)); + if(vertices) STBTT_free(vertices, info->userdata); + vertices = tmp; + STBTT_free(comp_verts, info->userdata); + num_vertices += comp_num_verts; + } + // More components ? + more = flags & (1 << 5); + } + } + else { + // numberOfCounters == 0, do nothing + } + + *pvertices = vertices; + return num_vertices; +} + +typedef struct { + int bounds; + int started; + float first_x, first_y; + float x, y; + stbtt_int32 min_x, max_x, min_y, max_y; + + stbtt_vertex * pvertices; + int num_vertices; +} stbtt__csctx; + +#define STBTT__CSCTX_INIT(bounds) {bounds,0, 0,0, 0,0, 0,0,0,0, NULL, 0} + +static void stbtt__track_vertex(stbtt__csctx * c, stbtt_int32 x, stbtt_int32 y) +{ + if(x > c->max_x || !c->started) c->max_x = x; + if(y > c->max_y || !c->started) c->max_y = y; + if(x < c->min_x || !c->started) c->min_x = x; + if(y < c->min_y || !c->started) c->min_y = y; + c->started = 1; +} + +static void stbtt__csctx_v(stbtt__csctx * c, stbtt_uint8 type, stbtt_int32 x, stbtt_int32 y, stbtt_int32 cx, + stbtt_int32 cy, stbtt_int32 cx1, stbtt_int32 cy1) +{ + if(c->bounds) { + stbtt__track_vertex(c, x, y); + if(type == STBTT_vcubic) { + stbtt__track_vertex(c, cx, cy); + stbtt__track_vertex(c, cx1, cy1); + } + } + else { + stbtt_setvertex(&c->pvertices[c->num_vertices], type, x, y, cx, cy); + c->pvertices[c->num_vertices].cx1 = (stbtt_int16)cx1; + c->pvertices[c->num_vertices].cy1 = (stbtt_int16)cy1; + } + c->num_vertices++; +} + +static void stbtt__csctx_close_shape(stbtt__csctx * ctx) +{ + if(ctx->first_x != ctx->x || ctx->first_y != ctx->y) + stbtt__csctx_v(ctx, STBTT_vline, (int)ctx->first_x, (int)ctx->first_y, 0, 0, 0, 0); +} + +static void stbtt__csctx_rmove_to(stbtt__csctx * ctx, float dx, float dy) +{ + stbtt__csctx_close_shape(ctx); + ctx->first_x = ctx->x = ctx->x + dx; + ctx->first_y = ctx->y = ctx->y + dy; + stbtt__csctx_v(ctx, STBTT_vmove, (int)ctx->x, (int)ctx->y, 0, 0, 0, 0); +} + +static void stbtt__csctx_rline_to(stbtt__csctx * ctx, float dx, float dy) +{ + ctx->x += dx; + ctx->y += dy; + stbtt__csctx_v(ctx, STBTT_vline, (int)ctx->x, (int)ctx->y, 0, 0, 0, 0); +} + +static void stbtt__csctx_rccurve_to(stbtt__csctx * ctx, float dx1, float dy1, float dx2, float dy2, float dx3, + float dy3) +{ + float cx1 = ctx->x + dx1; + float cy1 = ctx->y + dy1; + float cx2 = cx1 + dx2; + float cy2 = cy1 + dy2; + ctx->x = cx2 + dx3; + ctx->y = cy2 + dy3; + stbtt__csctx_v(ctx, STBTT_vcubic, (int)ctx->x, (int)ctx->y, (int)cx1, (int)cy1, (int)cx2, (int)cy2); +} + +static stbtt__buf stbtt__get_subr(stbtt__buf idx, int n) +{ + int count = stbtt__cff_index_count(&idx); + int bias = 107; + if(count >= 33900) + bias = 32768; + else if(count >= 1240) + bias = 1131; + n += bias; + if(n < 0 || n >= count) + return stbtt__new_buf(NULL, 0); + return stbtt__cff_index_get(idx, n); +} + +static stbtt__buf stbtt__cid_get_glyph_subrs(const stbtt_fontinfo * info, int glyph_index) +{ + stbtt__buf fdselect = info->fdselect; + int nranges, start, end, v, fmt, fdselector = -1, i; + + stbtt__buf_seek(&fdselect, 0); + fmt = stbtt__buf_get8(&fdselect); + if(fmt == 0) { + // untested + stbtt__buf_skip(&fdselect, glyph_index); + fdselector = stbtt__buf_get8(&fdselect); + } + else if(fmt == 3) { + nranges = stbtt__buf_get16(&fdselect); + start = stbtt__buf_get16(&fdselect); + for(i = 0; i < nranges; i++) { + v = stbtt__buf_get8(&fdselect); + end = stbtt__buf_get16(&fdselect); + if(glyph_index >= start && glyph_index < end) { + fdselector = v; + break; + } + start = end; + } + } + if(fdselector == -1) stbtt__new_buf(NULL, 0); + return stbtt__get_subrs(info->cff, stbtt__cff_index_get(info->fontdicts, fdselector)); +} + +static int stbtt__run_charstring(const stbtt_fontinfo * info, int glyph_index, stbtt__csctx * c) +{ + int in_header = 1, maskbits = 0, subr_stack_height = 0, sp = 0, v, i, b0; + int has_subrs = 0, clear_stack; + float s[48]; + stbtt__buf subr_stack[10], subrs = info->subrs, b; + float f; + +#define STBTT__CSERR(s) (0) + + // this currently ignores the initial width value, which isn't needed if we have hmtx + b = stbtt__cff_index_get(info->charstrings, glyph_index); + while(b.cursor < b.size) { + i = 0; + clear_stack = 1; + b0 = stbtt__buf_get8(&b); + switch(b0) { + // @TODO implement hinting + case 0x13: // hintmask + case 0x14: // cntrmask + if(in_header) + maskbits += (sp / 2); // implicit "vstem" + in_header = 0; + stbtt__buf_skip(&b, (maskbits + 7) / 8); + break; + + case 0x01: // hstem + case 0x03: // vstem + case 0x12: // hstemhm + case 0x17: // vstemhm + maskbits += (sp / 2); + break; + + case 0x15: // rmoveto + in_header = 0; + if(sp < 2) return STBTT__CSERR("rmoveto stack"); + stbtt__csctx_rmove_to(c, s[sp - 2], s[sp - 1]); + break; + case 0x04: // vmoveto + in_header = 0; + if(sp < 1) return STBTT__CSERR("vmoveto stack"); + stbtt__csctx_rmove_to(c, 0, s[sp - 1]); + break; + case 0x16: // hmoveto + in_header = 0; + if(sp < 1) return STBTT__CSERR("hmoveto stack"); + stbtt__csctx_rmove_to(c, s[sp - 1], 0); + break; + + case 0x05: // rlineto + if(sp < 2) return STBTT__CSERR("rlineto stack"); + for(; i + 1 < sp; i += 2) + stbtt__csctx_rline_to(c, s[i], s[i + 1]); + break; + + // hlineto/vlineto and vhcurveto/hvcurveto alternate horizontal and vertical + // starting from a different place. + + case 0x07: // vlineto + if(sp < 1) return STBTT__CSERR("vlineto stack"); + goto vlineto; + case 0x06: // hlineto + if(sp < 1) return STBTT__CSERR("hlineto stack"); + for(;;) { + if(i >= sp) break; + stbtt__csctx_rline_to(c, s[i], 0); + i++; +vlineto: + if(i >= sp) break; + stbtt__csctx_rline_to(c, 0, s[i]); + i++; + } + break; + + case 0x1F: // hvcurveto + if(sp < 4) return STBTT__CSERR("hvcurveto stack"); + goto hvcurveto; + case 0x1E: // vhcurveto + if(sp < 4) return STBTT__CSERR("vhcurveto stack"); + for(;;) { + if(i + 3 >= sp) break; + stbtt__csctx_rccurve_to(c, 0, s[i], s[i + 1], s[i + 2], s[i + 3], (sp - i == 5) ? s[i + 4] : 0.0f); + i += 4; +hvcurveto: + if(i + 3 >= sp) break; + stbtt__csctx_rccurve_to(c, s[i], 0, s[i + 1], s[i + 2], (sp - i == 5) ? s[i + 4] : 0.0f, s[i + 3]); + i += 4; + } + break; + + case 0x08: // rrcurveto + if(sp < 6) return STBTT__CSERR("rcurveline stack"); + for(; i + 5 < sp; i += 6) + stbtt__csctx_rccurve_to(c, s[i], s[i + 1], s[i + 2], s[i + 3], s[i + 4], s[i + 5]); + break; + + case 0x18: // rcurveline + if(sp < 8) return STBTT__CSERR("rcurveline stack"); + for(; i + 5 < sp - 2; i += 6) + stbtt__csctx_rccurve_to(c, s[i], s[i + 1], s[i + 2], s[i + 3], s[i + 4], s[i + 5]); + if(i + 1 >= sp) return STBTT__CSERR("rcurveline stack"); + stbtt__csctx_rline_to(c, s[i], s[i + 1]); + break; + + case 0x19: // rlinecurve + if(sp < 8) return STBTT__CSERR("rlinecurve stack"); + for(; i + 1 < sp - 6; i += 2) + stbtt__csctx_rline_to(c, s[i], s[i + 1]); + if(i + 5 >= sp) return STBTT__CSERR("rlinecurve stack"); + stbtt__csctx_rccurve_to(c, s[i], s[i + 1], s[i + 2], s[i + 3], s[i + 4], s[i + 5]); + break; + + case 0x1A: // vvcurveto + case 0x1B: // hhcurveto + if(sp < 4) return STBTT__CSERR("(vv|hh)curveto stack"); + f = 0.0; + if(sp & 1) { + f = s[i]; + i++; + } + for(; i + 3 < sp; i += 4) { + if(b0 == 0x1B) + stbtt__csctx_rccurve_to(c, s[i], f, s[i + 1], s[i + 2], s[i + 3], 0.0); + else + stbtt__csctx_rccurve_to(c, f, s[i], s[i + 1], s[i + 2], 0.0, s[i + 3]); + f = 0.0; + } + break; + + case 0x0A: // callsubr + if(!has_subrs) { + if(info->fdselect.size) + subrs = stbtt__cid_get_glyph_subrs(info, glyph_index); + has_subrs = 1; + } + // FALLTHROUGH + case 0x1D: // callgsubr + if(sp < 1) return STBTT__CSERR("call(g|)subr stack"); + v = (int)s[--sp]; + if(subr_stack_height >= 10) return STBTT__CSERR("recursion limit"); + subr_stack[subr_stack_height++] = b; + b = stbtt__get_subr(b0 == 0x0A ? subrs : info->gsubrs, v); + if(b.size == 0) return STBTT__CSERR("subr not found"); + b.cursor = 0; + clear_stack = 0; + break; + + case 0x0B: // return + if(subr_stack_height <= 0) return STBTT__CSERR("return outside subr"); + b = subr_stack[--subr_stack_height]; + clear_stack = 0; + break; + + case 0x0E: // endchar + stbtt__csctx_close_shape(c); + return 1; + + case 0x0C: { // two-byte escape + float dx1, dx2, dx3, dx4, dx5, dx6, dy1, dy2, dy3, dy4, dy5, dy6; + float dx, dy; + int b1 = stbtt__buf_get8(&b); + switch(b1) { + // @TODO These "flex" implementations ignore the flex-depth and resolution, + // and always draw beziers. + case 0x22: // hflex + if(sp < 7) return STBTT__CSERR("hflex stack"); + dx1 = s[0]; + dx2 = s[1]; + dy2 = s[2]; + dx3 = s[3]; + dx4 = s[4]; + dx5 = s[5]; + dx6 = s[6]; + stbtt__csctx_rccurve_to(c, dx1, 0, dx2, dy2, dx3, 0); + stbtt__csctx_rccurve_to(c, dx4, 0, dx5, -dy2, dx6, 0); + break; + + case 0x23: // flex + if(sp < 13) return STBTT__CSERR("flex stack"); + dx1 = s[0]; + dy1 = s[1]; + dx2 = s[2]; + dy2 = s[3]; + dx3 = s[4]; + dy3 = s[5]; + dx4 = s[6]; + dy4 = s[7]; + dx5 = s[8]; + dy5 = s[9]; + dx6 = s[10]; + dy6 = s[11]; + //fd is s[12] + stbtt__csctx_rccurve_to(c, dx1, dy1, dx2, dy2, dx3, dy3); + stbtt__csctx_rccurve_to(c, dx4, dy4, dx5, dy5, dx6, dy6); + break; + + case 0x24: // hflex1 + if(sp < 9) return STBTT__CSERR("hflex1 stack"); + dx1 = s[0]; + dy1 = s[1]; + dx2 = s[2]; + dy2 = s[3]; + dx3 = s[4]; + dx4 = s[5]; + dx5 = s[6]; + dy5 = s[7]; + dx6 = s[8]; + stbtt__csctx_rccurve_to(c, dx1, dy1, dx2, dy2, dx3, 0); + stbtt__csctx_rccurve_to(c, dx4, 0, dx5, dy5, dx6, -(dy1 + dy2 + dy5)); + break; + + case 0x25: // flex1 + if(sp < 11) return STBTT__CSERR("flex1 stack"); + dx1 = s[0]; + dy1 = s[1]; + dx2 = s[2]; + dy2 = s[3]; + dx3 = s[4]; + dy3 = s[5]; + dx4 = s[6]; + dy4 = s[7]; + dx5 = s[8]; + dy5 = s[9]; + dx6 = dy6 = s[10]; + dx = dx1 + dx2 + dx3 + dx4 + dx5; + dy = dy1 + dy2 + dy3 + dy4 + dy5; + if(STBTT_fabs(dx) > STBTT_fabs(dy)) + dy6 = -dy; + else + dx6 = -dx; + stbtt__csctx_rccurve_to(c, dx1, dy1, dx2, dy2, dx3, dy3); + stbtt__csctx_rccurve_to(c, dx4, dy4, dx5, dy5, dx6, dy6); + break; + + default: + return STBTT__CSERR("unimplemented"); + } + } + break; + + default: + if(b0 != 255 && b0 != 28 && b0 < 32) + return STBTT__CSERR("reserved operator"); + + // push immediate + if(b0 == 255) { + f = (float)(stbtt_int32)stbtt__buf_get32(&b) / 0x10000; + } + else { + stbtt__buf_skip(&b, -1); + f = (float)(stbtt_int16)stbtt__cff_int(&b); + } + if(sp >= 48) return STBTT__CSERR("push stack overflow"); + s[sp++] = f; + clear_stack = 0; + break; + } + if(clear_stack) sp = 0; + } + return STBTT__CSERR("no endchar"); + +#undef STBTT__CSERR +} + +static int stbtt__GetGlyphShapeT2(const stbtt_fontinfo * info, int glyph_index, stbtt_vertex * *pvertices) +{ + // runs the charstring twice, once to count and once to output (to avoid realloc) + stbtt__csctx count_ctx = STBTT__CSCTX_INIT(1); + stbtt__csctx output_ctx = STBTT__CSCTX_INIT(0); + if(stbtt__run_charstring(info, glyph_index, &count_ctx)) { + *pvertices = (stbtt_vertex *)STBTT_malloc(count_ctx.num_vertices * sizeof(stbtt_vertex), info->userdata); + output_ctx.pvertices = *pvertices; + if(stbtt__run_charstring(info, glyph_index, &output_ctx)) { + STBTT_assert(output_ctx.num_vertices == count_ctx.num_vertices); + return output_ctx.num_vertices; + } + } + *pvertices = NULL; + return 0; +} + +static int stbtt__GetGlyphInfoT2(const stbtt_fontinfo * info, int glyph_index, int * x0, int * y0, int * x1, int * y1) +{ + stbtt__csctx c = STBTT__CSCTX_INIT(1); + int r = stbtt__run_charstring(info, glyph_index, &c); + if(x0) *x0 = r ? c.min_x : 0; + if(y0) *y0 = r ? c.min_y : 0; + if(x1) *x1 = r ? c.max_x : 0; + if(y1) *y1 = r ? c.max_y : 0; + return r ? c.num_vertices : 0; +} + +STBTT_DEF int stbtt_GetGlyphShape(const stbtt_fontinfo * info, int glyph_index, stbtt_vertex * *pvertices) +{ + if(!info->cff.size) + return stbtt__GetGlyphShapeTT(info, glyph_index, pvertices); + else + return stbtt__GetGlyphShapeT2(info, glyph_index, pvertices); +} + +STBTT_DEF void stbtt_GetGlyphHMetrics(const stbtt_fontinfo * info, int glyph_index, int * advanceWidth, + int * leftSideBearing) +{ + stbtt_uint16 numOfLongHorMetrics = ttUSHORT(info->data, info->hhea + 34); + if(glyph_index < numOfLongHorMetrics) { + if(advanceWidth) *advanceWidth = ttSHORT(info->data, info->hmtx + 4 * glyph_index); + if(leftSideBearing) *leftSideBearing = ttSHORT(info->data, info->hmtx + 4 * glyph_index + 2); + } + else { + if(advanceWidth) *advanceWidth = ttSHORT(info->data, info->hmtx + 4 * (numOfLongHorMetrics - 1)); + if(leftSideBearing) *leftSideBearing = ttSHORT(info->data, + info->hmtx + 4 * numOfLongHorMetrics + 2 * (glyph_index - numOfLongHorMetrics)); + } +} + +STBTT_DEF int stbtt_GetKerningTableLength(const stbtt_fontinfo * info) +{ + // we only look at the first table. it must be 'horizontal' and format 0. + if(!info->kern) + return 0; + if(ttUSHORT(info->data, 2 + info->kern) < 1) // number of tables, need at least 1 + return 0; + if(ttUSHORT(info->data, 8 + info->kern) != 1) // horizontal flag must be set in format + return 0; + + return ttUSHORT(info->data, 10 + info->kern); +} + +STBTT_DEF int stbtt_GetKerningTable(const stbtt_fontinfo * info, stbtt_kerningentry * table, int table_length) +{ + int k, length; + + // we only look at the first table. it must be 'horizontal' and format 0. + if(!info->kern) + return 0; + if(ttUSHORT(info->data, 2 + info->kern) < 1) // number of tables, need at least 1 + return 0; + if(ttUSHORT(info->data, 8 + info->kern) != 1) // horizontal flag must be set in format + return 0; + + length = ttUSHORT(info->data, 10 + info->kern); + if(table_length < length) + length = table_length; + + for(k = 0; k < length; k++) { + table[k].glyph1 = ttUSHORT(info->data, 18 + (k * 6) + info->kern); + table[k].glyph2 = ttUSHORT(info->data, 20 + (k * 6) + info->kern); + table[k].advance = ttSHORT(info->data, 22 + (k * 6) + info->kern); + } + + return length; +} + +static int stbtt__GetGlyphKernInfoAdvance(const stbtt_fontinfo * info, int glyph1, int glyph2) +{ + stbtt_uint32 needle, straw; + int l, r, m; + + // we only look at the first table. it must be 'horizontal' and format 0. + if(!info->kern) + return 0; + if(ttUSHORT(info->data, info->kern + 2) < 1) // number of tables, need at least 1 + return 0; + if(ttUSHORT(info->data, info->kern + 8) != 1) // horizontal flag must be set in format + return 0; + + l = 0; + r = ttUSHORT(info->data, info->kern + 10) - 1; + needle = glyph1 << 16 | glyph2; + while(l <= r) { + m = (l + r) >> 1; + straw = ttULONG(info->data, info->kern + 18 + (m * 6)); // note: unaligned read + if(needle < straw) + r = m - 1; + else if(needle > straw) + l = m + 1; + else + return ttSHORT(info->data, info->kern + 22 + (m * 6)); + } + return 0; +} +#ifdef STBTT_STREAM_TYPE + static stbtt_int32 stbtt__GetCoverageIndex(STBTT_STREAM_TYPE data, stbtt_uint32 coverageTable, int glyph) +#else + static stbtt_int32 stbtt__GetCoverageIndex(const stbtt_uint8 * data, stbtt_uint32 coverageTable, int glyph) +#endif +{ + stbtt_uint16 coverageFormat = ttUSHORT(data, coverageTable); + switch(coverageFormat) { + case 1: { + stbtt_uint16 glyphCount = ttUSHORT(data, coverageTable + 2); + + // Binary search. + stbtt_int32 l = 0, r = glyphCount - 1, m; + int straw, needle = glyph; + while(l <= r) { + stbtt_uint32 glyphArray = coverageTable + 4; + stbtt_uint16 glyphID; + m = (l + r) >> 1; + glyphID = ttUSHORT(data, glyphArray + 2 * m); + straw = glyphID; + if(needle < straw) + r = m - 1; + else if(needle > straw) + l = m + 1; + else { + return m; + } + } + break; + } + + case 2: { + stbtt_uint16 rangeCount = ttUSHORT(data, coverageTable + 2); + stbtt_uint32 rangeArray = coverageTable + 4; + + // Binary search. + stbtt_int32 l = 0, r = rangeCount - 1, m; + int strawStart, strawEnd, needle = glyph; + while(l <= r) { + stbtt_uint32 rangeRecord; + m = (l + r) >> 1; + rangeRecord = rangeArray + 6 * m; + strawStart = ttUSHORT(data, rangeRecord); + strawEnd = ttUSHORT(data, rangeRecord + 2); + if(needle < strawStart) + r = m - 1; + else if(needle > strawEnd) + l = m + 1; + else { + stbtt_uint16 startCoverageIndex = ttUSHORT(data, rangeRecord + 4); + return startCoverageIndex + glyph - strawStart; + } + } + break; + } + + default: + return -1; // unsupported + } + + return -1; +} +#ifdef STBTT_STREAM_TYPE + static stbtt_int32 stbtt__GetGlyphClass(STBTT_STREAM_TYPE data, stbtt_uint32 classDefTable, int glyph) +#else + static stbtt_int32 stbtt__GetGlyphClass(const stbtt_uint8 * data, stbtt_uint32 classDefTable, int glyph) +#endif +{ + stbtt_uint16 classDefFormat = ttUSHORT(data, classDefTable); + switch(classDefFormat) { + case 1: { + stbtt_uint16 startGlyphID = ttUSHORT(data, classDefTable + 2); + stbtt_uint16 glyphCount = ttUSHORT(data, classDefTable + 4); + stbtt_uint32 classDef1ValueArray = classDefTable + 6; + + if(glyph >= startGlyphID && glyph < startGlyphID + glyphCount) + return (stbtt_int32)ttUSHORT(data, classDef1ValueArray + 2 * (glyph - startGlyphID)); + break; + } + + case 2: { + stbtt_uint16 classRangeCount = ttUSHORT(data, classDefTable + 2); + stbtt_uint32 classRangeRecords = classDefTable + 4; + + // Binary search. + stbtt_int32 l = 0, r = classRangeCount - 1, m; + int strawStart, strawEnd, needle = glyph; + while(l <= r) { + stbtt_uint32 classRangeRecord; + m = (l + r) >> 1; + classRangeRecord = classRangeRecords + 6 * m; + strawStart = ttUSHORT(data, classRangeRecord); + strawEnd = ttUSHORT(data, classRangeRecord + 2); + if(needle < strawStart) + r = m - 1; + else if(needle > strawEnd) + l = m + 1; + else + return (stbtt_int32)ttUSHORT(data, classRangeRecord + 4); + } + break; + } + + default: + return -1; // Unsupported definition type, return an error. + } + + // "All glyphs not assigned to a class fall into class 0". (OpenType spec) + return 0; +} + +// Define to STBTT_assert(x) if you want to break on unimplemented formats. +#define STBTT_GPOS_TODO_assert(x) + +static stbtt_int32 stbtt__GetGlyphGPOSInfoAdvance(const stbtt_fontinfo * info, int glyph1, int glyph2) +{ + stbtt_uint16 lookupListOffset; + stbtt_uint32 lookupList; + stbtt_uint16 lookupCount; +#ifdef STBTT_STREAM_TYPE + STBTT_STREAM_TYPE data = info->data; +#else + const stbtt_uint8 * data = info->data; +#endif + stbtt_int32 i, sti; + + if(!info->gpos) return 0; + + if(ttUSHORT(data, 0 + info->gpos) != 1) return 0; // Major version 1 + if(ttUSHORT(data, 2 + info->gpos) != 0) return 0; // Minor version 0 + + lookupListOffset = ttUSHORT(data, 8 + info->gpos); + lookupList = lookupListOffset; + lookupCount = ttUSHORT(data, lookupList); + + for(i = 0; i < lookupCount; ++i) { + stbtt_uint16 lookupOffset = ttUSHORT(data, lookupList + 2 + 2 * i); + stbtt_uint32 lookupTable = lookupList + lookupOffset; + + stbtt_uint16 lookupType = ttUSHORT(data, lookupTable); + stbtt_uint16 subTableCount = ttUSHORT(data, lookupTable + 4); + stbtt_uint32 subTableOffsets = lookupTable + 6; + if(lookupType != 2) // Pair Adjustment Positioning Subtable + continue; + + for(sti = 0; sti < subTableCount; sti++) { + stbtt_uint16 subtableOffset = ttUSHORT(data, subTableOffsets + 2 * sti); + stbtt_uint32 table = lookupTable + subtableOffset; + stbtt_uint16 posFormat = ttUSHORT(data, table); + stbtt_uint16 coverageOffset = ttUSHORT(data, table + 2); + stbtt_int32 coverageIndex = stbtt__GetCoverageIndex(data, table + coverageOffset, glyph1); + if(coverageIndex == -1) continue; + + switch(posFormat) { + case 1: { + stbtt_int32 l, r, m; + int straw, needle; + stbtt_uint16 valueFormat1 = ttUSHORT(data, table + 4); + stbtt_uint16 valueFormat2 = ttUSHORT(data, table + 6); + if(valueFormat1 == 4 && valueFormat2 == 0) { // Support more formats? + stbtt_int32 valueRecordPairSizeInBytes = 2; + stbtt_uint16 pairSetCount = ttUSHORT(data, table + 8); + stbtt_uint16 pairPosOffset = ttUSHORT(data, table + 10 + 2 * coverageIndex); + stbtt_uint32 pairValueTable = table + pairPosOffset; + stbtt_uint16 pairValueCount = ttUSHORT(data, pairValueTable); + stbtt_uint32 pairValueArray = pairValueTable + 2; + + if(coverageIndex >= pairSetCount) return 0; + + needle = glyph2; + r = pairValueCount - 1; + l = 0; + + // Binary search. + while(l <= r) { + stbtt_uint16 secondGlyph; + stbtt_uint32 pairValue; + m = (l + r) >> 1; + pairValue = pairValueArray + (2 + valueRecordPairSizeInBytes) * m; + secondGlyph = ttUSHORT(data, pairValue); + straw = secondGlyph; + if(needle < straw) + r = m - 1; + else if(needle > straw) + l = m + 1; + else { + stbtt_int16 xAdvance = ttSHORT(data, pairValue + 2); + return xAdvance; + } + } + } + else + return 0; + break; + } + + case 2: { + stbtt_uint16 valueFormat1 = ttUSHORT(data, table + 4); + stbtt_uint16 valueFormat2 = ttUSHORT(data, table + 6); + if(valueFormat1 == 4 && valueFormat2 == 0) { // Support more formats? + stbtt_uint16 classDef1Offset = ttUSHORT(data, table + 8); + stbtt_uint16 classDef2Offset = ttUSHORT(data, table + 10); + int glyph1class = stbtt__GetGlyphClass(data, table + classDef1Offset, glyph1); + int glyph2class = stbtt__GetGlyphClass(data, table + classDef2Offset, glyph2); + + stbtt_uint16 class1Count = ttUSHORT(data, table + 12); + stbtt_uint16 class2Count = ttUSHORT(data, table + 14); + stbtt_uint32 class1Records, class2Records; + stbtt_int16 xAdvance; + + if(glyph1class < 0 || glyph1class >= class1Count) return 0; // malformed + if(glyph2class < 0 || glyph2class >= class2Count) return 0; // malformed + + class1Records = table + 16; + class2Records = class1Records + 2 * (glyph1class * class2Count); + xAdvance = ttSHORT(data, class2Records + 2 * glyph2class); + return xAdvance; + } + else + return 0; + break; + } + + default: + return 0; // Unsupported position format + } + } + } + + return 0; +} + +STBTT_DEF int stbtt_GetGlyphKernAdvance(const stbtt_fontinfo * info, int g1, int g2) +{ + int xAdvance = 0; + + if(info->gpos) + xAdvance += stbtt__GetGlyphGPOSInfoAdvance(info, g1, g2); + else if(info->kern) + xAdvance += stbtt__GetGlyphKernInfoAdvance(info, g1, g2); + + return xAdvance; +} + +STBTT_DEF int stbtt_GetCodepointKernAdvance(const stbtt_fontinfo * info, int ch1, int ch2) +{ + if(!info->kern && !info->gpos) // if no kerning table, don't waste time looking up both codepoint->glyphs + return 0; + return stbtt_GetGlyphKernAdvance(info, stbtt_FindGlyphIndex(info, ch1), stbtt_FindGlyphIndex(info, ch2)); +} + +STBTT_DEF void stbtt_GetCodepointHMetrics(const stbtt_fontinfo * info, int codepoint, int * advanceWidth, + int * leftSideBearing) +{ + stbtt_GetGlyphHMetrics(info, stbtt_FindGlyphIndex(info, codepoint), advanceWidth, leftSideBearing); +} + +STBTT_DEF void stbtt_GetFontVMetrics(const stbtt_fontinfo * info, int * ascent, int * descent, int * lineGap) +{ + if(ascent) *ascent = ttSHORT(info->data, info->hhea + 4); + if(descent) *descent = ttSHORT(info->data, info->hhea + 6); + if(lineGap) *lineGap = ttSHORT(info->data, info->hhea + 8); +} + +STBTT_DEF int stbtt_GetFontVMetricsOS2(const stbtt_fontinfo * info, int * typoAscent, int * typoDescent, + int * typoLineGap) +{ + int tab = stbtt__find_table(info->data, info->fontstart, "OS/2"); + if(!tab) + return 0; + if(typoAscent) *typoAscent = ttSHORT(info->data, tab + 68); + if(typoDescent) *typoDescent = ttSHORT(info->data, tab + 70); + if(typoLineGap) *typoLineGap = ttSHORT(info->data, tab + 72); + return 1; +} + +STBTT_DEF void stbtt_GetFontBoundingBox(const stbtt_fontinfo * info, int * x0, int * y0, int * x1, int * y1) +{ + *x0 = ttSHORT(info->data, info->head + 36); + *y0 = ttSHORT(info->data, info->head + 38); + *x1 = ttSHORT(info->data, info->head + 40); + *y1 = ttSHORT(info->data, info->head + 42); +} + +STBTT_DEF float stbtt_ScaleForPixelHeight(const stbtt_fontinfo * info, float height) +{ + int fheight = ttSHORT(info->data, info->hhea + 4) - ttSHORT(info->data, info->hhea + 6); + return (float)height / fheight; +} + +STBTT_DEF float stbtt_ScaleForMappingEmToPixels(const stbtt_fontinfo * info, float pixels) +{ + int unitsPerEm = ttUSHORT(info->data, info->head + 18); + return pixels / unitsPerEm; +} + +STBTT_DEF void stbtt_FreeShape(const stbtt_fontinfo * info, stbtt_vertex * v) +{ + STBTT_free(v, info->userdata); +} + +STBTT_DEF stbtt_uint32 stbtt_FindSVGDoc(const stbtt_fontinfo * info, int gl) +{ + int i; + stbtt_uint32 svg_doc_list = stbtt__get_svg((stbtt_fontinfo *)info); + + int numEntries = ttUSHORT(info->data, svg_doc_list); + stbtt_uint32 svg_docs = svg_doc_list + 2; + + for(i = 0; i < numEntries; i++) { + stbtt_uint32 svg_doc = svg_docs + (12 * i); + if((gl >= ttUSHORT(info->data, svg_doc)) && (gl <= ttUSHORT(info->data, svg_doc + 2))) + return svg_doc; + } + return 0; +} + +STBTT_DEF int stbtt_GetGlyphSVG(const stbtt_fontinfo * info, int gl, stbtt_uint32 * svgOfs) +{ + stbtt_uint32 svg_doc; + + if(info->svg == 0) + return 0; + + svg_doc = stbtt_FindSVGDoc(info, gl); + if(svg_doc != 0) { + *svgOfs = info->svg + ttULONG(info->data, svg_doc + 4); + return ttULONG(info->data, svg_doc + 8); + } + else { + return 0; + } +} + +STBTT_DEF int stbtt_GetCodepointSVG(const stbtt_fontinfo * info, int unicode_codepoint, stbtt_uint32 * svgOfs) +{ + return stbtt_GetGlyphSVG(info, stbtt_FindGlyphIndex(info, unicode_codepoint), svgOfs); +} + +////////////////////////////////////////////////////////////////////////////// +// +// antialiasing software rasterizer +// + +STBTT_DEF void stbtt_GetGlyphBitmapBoxSubpixel(const stbtt_fontinfo * font, int glyph, float scale_x, float scale_y, + float shift_x, float shift_y, int * ix0, int * iy0, int * ix1, int * iy1) +{ + int x0 = 0, y0 = 0, x1, y1; // =0 suppresses compiler warning + if(!stbtt_GetGlyphBox(font, glyph, &x0, &y0, &x1, &y1)) { + // e.g. space character + if(ix0) *ix0 = 0; + if(iy0) *iy0 = 0; + if(ix1) *ix1 = 0; + if(iy1) *iy1 = 0; + } + else { + // move to integral bboxes (treating pixels as little squares, what pixels get touched)? + if(ix0) *ix0 = STBTT_ifloor(x0 * scale_x + shift_x); + if(iy0) *iy0 = STBTT_ifloor(-y1 * scale_y + shift_y); + if(ix1) *ix1 = STBTT_iceil(x1 * scale_x + shift_x); + if(iy1) *iy1 = STBTT_iceil(-y0 * scale_y + shift_y); + } +} + +STBTT_DEF void stbtt_GetGlyphBitmapBox(const stbtt_fontinfo * font, int glyph, float scale_x, float scale_y, int * ix0, + int * iy0, int * ix1, int * iy1) +{ + stbtt_GetGlyphBitmapBoxSubpixel(font, glyph, scale_x, scale_y, 0.0f, 0.0f, ix0, iy0, ix1, iy1); +} + +STBTT_DEF void stbtt_GetCodepointBitmapBoxSubpixel(const stbtt_fontinfo * font, int codepoint, float scale_x, + float scale_y, float shift_x, float shift_y, int * ix0, int * iy0, int * ix1, int * iy1) +{ + stbtt_GetGlyphBitmapBoxSubpixel(font, stbtt_FindGlyphIndex(font, codepoint), scale_x, scale_y, shift_x, shift_y, ix0, + iy0, ix1, iy1); +} + +STBTT_DEF void stbtt_GetCodepointBitmapBox(const stbtt_fontinfo * font, int codepoint, float scale_x, float scale_y, + int * ix0, int * iy0, int * ix1, int * iy1) +{ + stbtt_GetCodepointBitmapBoxSubpixel(font, codepoint, scale_x, scale_y, 0.0f, 0.0f, ix0, iy0, ix1, iy1); +} + +////////////////////////////////////////////////////////////////////////////// +// +// Rasterizer + +typedef struct stbtt__hheap_chunk { + struct stbtt__hheap_chunk * next; +} stbtt__hheap_chunk; + +typedef struct stbtt__hheap { + struct stbtt__hheap_chunk * head; + void * first_free; + int num_remaining_in_head_chunk; +} stbtt__hheap; + +static void * stbtt__hheap_alloc(stbtt__hheap * hh, size_t size, void * userdata) +{ + if(hh->first_free) { + void * p = hh->first_free; + hh->first_free = *(void **)p; + return p; + } + else { + if(hh->num_remaining_in_head_chunk == 0) { + int count = (size < 32 ? STBTT_HEAP_FACTOR_SIZE_32 : size < 128 ? STBTT_HEAP_FACTOR_SIZE_128 : + STBTT_HEAP_FACTOR_SIZE_DEFAULT); + stbtt__hheap_chunk * c = (stbtt__hheap_chunk *)STBTT_malloc(sizeof(stbtt__hheap_chunk) + size * count, userdata); + if(c == NULL) + return NULL; + c->next = hh->head; + hh->head = c; + hh->num_remaining_in_head_chunk = count; + } + --hh->num_remaining_in_head_chunk; + return (char *)(hh->head) + sizeof(stbtt__hheap_chunk) + size * hh->num_remaining_in_head_chunk; + } +} + +static void stbtt__hheap_free(stbtt__hheap * hh, void * p) +{ + *(void **)p = hh->first_free; + hh->first_free = p; +} + +static void stbtt__hheap_cleanup(stbtt__hheap * hh, void * userdata) +{ + stbtt__hheap_chunk * c = hh->head; + while(c) { + stbtt__hheap_chunk * n = c->next; + STBTT_free(c, userdata); + c = n; + } +} + +typedef struct stbtt__edge { + float x0, y0, x1, y1; + int invert; +} stbtt__edge; + + +typedef struct stbtt__active_edge { + struct stbtt__active_edge * next; +#if STBTT_RASTERIZER_VERSION==1 + int x, dx; + float ey; + int direction; +#elif STBTT_RASTERIZER_VERSION==2 + float fx, fdx, fdy; + float direction; + float sy; + float ey; +#else +#error "Unrecognized value of STBTT_RASTERIZER_VERSION" +#endif +} stbtt__active_edge; + +#if STBTT_RASTERIZER_VERSION == 1 +#define STBTT_FIXSHIFT 10 +#define STBTT_FIX (1 << STBTT_FIXSHIFT) +#define STBTT_FIXMASK (STBTT_FIX-1) + +static stbtt__active_edge * stbtt__new_active(stbtt__hheap * hh, stbtt__edge * e, int off_x, float start_point, + void * userdata) +{ + stbtt__active_edge * z = (stbtt__active_edge *)stbtt__hheap_alloc(hh, sizeof(*z), userdata); + float dxdy = (e->x1 - e->x0) / (e->y1 - e->y0); + STBTT_assert(z != NULL); + if(!z) return z; + + // round dx down to avoid overshooting + if(dxdy < 0) + z->dx = -STBTT_ifloor(STBTT_FIX * -dxdy); + else + z->dx = STBTT_ifloor(STBTT_FIX * dxdy); + + z->x = STBTT_ifloor(STBTT_FIX * e->x0 + z->dx * (start_point - + e->y0)); // use z->dx so when we offset later it's by the same amount + z->x -= off_x * STBTT_FIX; + + z->ey = e->y1; + z->next = 0; + z->direction = e->invert ? 1 : -1; + return z; +} +#elif STBTT_RASTERIZER_VERSION == 2 +static stbtt__active_edge * stbtt__new_active(stbtt__hheap * hh, stbtt__edge * e, int off_x, float start_point, + void * userdata) +{ + stbtt__active_edge * z = (stbtt__active_edge *)stbtt__hheap_alloc(hh, sizeof(*z), userdata); + float dxdy = (e->x1 - e->x0) / (e->y1 - e->y0); + STBTT_assert(z != NULL); + //STBTT_assert(e->y0 <= start_point); + if(!z) return z; + z->fdx = dxdy; + z->fdy = dxdy != 0.0f ? (1.0f / dxdy) : 0.0f; + z->fx = e->x0 + dxdy * (start_point - e->y0); + z->fx -= off_x; + z->direction = e->invert ? 1.0f : -1.0f; + z->sy = e->y0; + z->ey = e->y1; + z->next = 0; + return z; +} +#else +#error "Unrecognized value of STBTT_RASTERIZER_VERSION" +#endif + +#if STBTT_RASTERIZER_VERSION == 1 +// note: this routine clips fills that extend off the edges... ideally this +// wouldn't happen, but it could happen if the truetype glyph bounding boxes +// are wrong, or if the user supplies a too-small bitmap +static void stbtt__fill_active_edges(unsigned char * scanline, int len, stbtt__active_edge * e, int max_weight) +{ + // non-zero winding fill + int x0 = 0, w = 0; + + while(e) { + if(w == 0) { + // if we're currently at zero, we need to record the edge start point + x0 = e->x; + w += e->direction; + } + else { + int x1 = e->x; + w += e->direction; + // if we went to zero, we need to draw + if(w == 0) { + int i = x0 >> STBTT_FIXSHIFT; + int j = x1 >> STBTT_FIXSHIFT; + + if(i < len && j >= 0) { + if(i == j) { + // x0,x1 are the same pixel, so compute combined coverage + scanline[i] = scanline[i] + (stbtt_uint8)((x1 - x0) * max_weight >> STBTT_FIXSHIFT); + } + else { + if(i >= 0) // add antialiasing for x0 + scanline[i] = scanline[i] + (stbtt_uint8)(((STBTT_FIX - (x0 & STBTT_FIXMASK)) * max_weight) >> STBTT_FIXSHIFT); + else + i = -1; // clip + + if(j < len) // add antialiasing for x1 + scanline[j] = scanline[j] + (stbtt_uint8)(((x1 & STBTT_FIXMASK) * max_weight) >> STBTT_FIXSHIFT); + else + j = len; // clip + + for(++i; i < j; ++i) // fill pixels between x0 and x1 + scanline[i] = scanline[i] + (stbtt_uint8)max_weight; + } + } + } + } + + e = e->next; + } +} + +static void stbtt__rasterize_sorted_edges(stbtt__bitmap * result, stbtt__edge * e, int n, int vsubsample, int off_x, + int off_y, void * userdata) +{ + stbtt__hheap hh = { 0, 0, 0 }; + stbtt__active_edge * active = NULL; + int y, j = 0; + int max_weight = (255 / vsubsample); // weight per vertical scanline + int s; // vertical subsample index + unsigned char scanline_data[512], * scanline; + + if(result->w > 512) + scanline = (unsigned char *)STBTT_malloc(result->w, userdata); + else + scanline = scanline_data; + + y = off_y * vsubsample; + e[n].y0 = (off_y + result->h) * (float)vsubsample + 1; + + while(j < result->h) { + STBTT_memset(scanline, 0, result->w); + for(s = 0; s < vsubsample; ++s) { + // find center of pixel for this scanline + float scan_y = y + 0.5f; + stbtt__active_edge ** step = &active; + + // update all active edges; + // remove all active edges that terminate before the center of this scanline + while(*step) { + stbtt__active_edge * z = *step; + if(z->ey <= scan_y) { + *step = z->next; // delete from list + STBTT_assert(z->direction); + z->direction = 0; + stbtt__hheap_free(&hh, z); + } + else { + z->x += z->dx; // advance to position for current scanline + step = &((*step)->next); // advance through list + } + } + + // resort the list if needed + for(;;) { + int changed = 0; + step = &active; + while(*step && (*step)->next) { + if((*step)->x > (*step)->next->x) { + stbtt__active_edge * t = *step; + stbtt__active_edge * q = t->next; + + t->next = q->next; + q->next = t; + *step = q; + changed = 1; + } + step = &(*step)->next; + } + if(!changed) break; + } + + // insert all edges that start before the center of this scanline -- omit ones that also end on this scanline + while(e->y0 <= scan_y) { + if(e->y1 > scan_y) { + stbtt__active_edge * z = stbtt__new_active(&hh, e, off_x, scan_y, userdata); + if(z != NULL) { + // find insertion point + if(active == NULL) + active = z; + else if(z->x < active->x) { + // insert at front + z->next = active; + active = z; + } + else { + // find thing to insert AFTER + stbtt__active_edge * p = active; + while(p->next && p->next->x < z->x) + p = p->next; + // at this point, p->next->x is NOT < z->x + z->next = p->next; + p->next = z; + } + } + } + ++e; + } + + // now process all active edges in XOR fashion + if(active) + stbtt__fill_active_edges(scanline, result->w, active, max_weight); + + ++y; + } + STBTT_memcpy(result->pixels + j * result->stride, scanline, result->w); + ++j; + } + + stbtt__hheap_cleanup(&hh, userdata); + + if(scanline != scanline_data) + STBTT_free(scanline, userdata); +} + +#elif STBTT_RASTERIZER_VERSION == 2 + +// the edge passed in here does not cross the vertical line at x or the vertical line at x+1 +// (i.e. it has already been clipped to those) +static void stbtt__handle_clipped_edge(float * scanline, int x, stbtt__active_edge * e, float x0, float y0, float x1, + float y1) +{ + if(y0 == y1) return; + STBTT_assert(y0 < y1); + STBTT_assert(e->sy <= e->ey); + if(y0 > e->ey) return; + if(y1 < e->sy) return; + if(y0 < e->sy) { + x0 += (x1 - x0) * (e->sy - y0) / (y1 - y0); + y0 = e->sy; + } + if(y1 > e->ey) { + x1 += (x1 - x0) * (e->ey - y1) / (y1 - y0); + y1 = e->ey; + } + + if(x0 == x) + STBTT_assert(x1 <= x + 1); + else if(x0 == x + 1) + STBTT_assert(x1 >= x); + else if(x0 <= x) + STBTT_assert(x1 <= x); + else if(x0 >= x + 1) + STBTT_assert(x1 >= x + 1); + else + STBTT_assert(x1 >= x && x1 <= x + 1); + + if(x0 <= x && x1 <= x) + scanline[x] += e->direction * (y1 - y0); + else if(x0 >= x + 1 && x1 >= x + 1) { + /*Nothing to do*/; + } + else { + STBTT_assert(x0 >= x && x0 <= x + 1 && x1 >= x && x1 <= x + 1); + scanline[x] += e->direction * (y1 - y0) * (1 - ((x0 - x) + (x1 - x)) / 2); // coverage = 1 - average x position + } +} + +static float stbtt__sized_trapezoid_area(float height, float top_width, float bottom_width) +{ + STBTT_assert(top_width >= 0); + STBTT_assert(bottom_width >= 0); + return (top_width + bottom_width) / 2.0f * height; +} + +static float stbtt__position_trapezoid_area(float height, float tx0, float tx1, float bx0, float bx1) +{ + return stbtt__sized_trapezoid_area(height, tx1 - tx0, bx1 - bx0); +} + +static float stbtt__sized_triangle_area(float height, float width) +{ + return height * width / 2; +} + +static void stbtt__fill_active_edges_new(float * scanline, float * scanline_fill, int len, stbtt__active_edge * e, + float y_top) +{ + float y_bottom = y_top + 1; + + while(e) { + // brute force every pixel + + // compute intersection points with top & bottom + STBTT_assert(e->ey >= y_top); + + if(e->fdx == 0) { + float x0 = e->fx; + if(x0 < len) { + if(x0 >= 0) { + stbtt__handle_clipped_edge(scanline, (int)x0, e, x0, y_top, x0, y_bottom); + stbtt__handle_clipped_edge(scanline_fill - 1, (int)x0 + 1, e, x0, y_top, x0, y_bottom); + } + else { + stbtt__handle_clipped_edge(scanline_fill - 1, 0, e, x0, y_top, x0, y_bottom); + } + } + } + else { + float x0 = e->fx; + float dx = e->fdx; + float xb = x0 + dx; + float x_top, x_bottom; + float sy0, sy1; + float dy = e->fdy; + STBTT_assert(e->sy <= y_bottom && e->ey >= y_top); + + // compute endpoints of line segment clipped to this scanline (if the + // line segment starts on this scanline. x0 is the intersection of the + // line with y_top, but that may be off the line segment. + if(e->sy > y_top) { + x_top = x0 + dx * (e->sy - y_top); + sy0 = e->sy; + } + else { + x_top = x0; + sy0 = y_top; + } + if(e->ey < y_bottom) { + x_bottom = x0 + dx * (e->ey - y_top); + sy1 = e->ey; + } + else { + x_bottom = xb; + sy1 = y_bottom; + } + + if(x_top >= 0 && x_bottom >= 0 && x_top < len && x_bottom < len) { + // from here on, we don't have to range check x values + + if((int)x_top == (int)x_bottom) { + float height; + // simple case, only spans one pixel + int x = (int)x_top; + height = (sy1 - sy0) * e->direction; + STBTT_assert(x >= 0 && x < len); + scanline[x] += stbtt__position_trapezoid_area(height, x_top, x + 1.0f, x_bottom, x + 1.0f); + scanline_fill[x] += height; // everything right of this pixel is filled + } + else { + int x, x1, x2; + float y_crossing, y_final, step, sign, area; + // covers 2+ pixels + if(x_top > x_bottom) { + // flip scanline vertically; signed area is the same + float t; + sy0 = y_bottom - (sy0 - y_top); + sy1 = y_bottom - (sy1 - y_top); + t = sy0, sy0 = sy1, sy1 = t; + t = x_bottom, x_bottom = x_top, x_top = t; + dx = -dx; + dy = -dy; + t = x0, x0 = xb, xb = t; + } + STBTT_assert(dy >= 0); + STBTT_assert(dx >= 0); + + x1 = (int)x_top; + x2 = (int)x_bottom; + // compute intersection with y axis at x1+1 + y_crossing = y_top + dy * (x1 + 1 - x0); + + // compute intersection with y axis at x2 + y_final = y_top + dy * (x2 - x0); + + // x1 x_top x2 x_bottom + // y_top +------|-----+------------+------------+--------|---+------------+ + // | | | | | | + // | | | | | | + // sy0 | Txxxxx|............|............|............|............| + // y_crossing | *xxxxx.......|............|............|............| + // | | xxxxx..|............|............|............| + // | | /- xx*xxxx........|............|............| + // | | dy < | xxxxxx..|............|............| + // y_final | | \- | xx*xxx.........|............| + // sy1 | | | | xxxxxB...|............| + // | | | | | | + // | | | | | | + // y_bottom +------------+------------+------------+------------+------------+ + // + // goal is to measure the area covered by '.' in each pixel + + // if x2 is right at the right edge of x1, y_crossing can blow up, github #1057 + // @TODO: maybe test against sy1 rather than y_bottom? + if(y_crossing > y_bottom) + y_crossing = y_bottom; + + sign = e->direction; + + // area of the rectangle covered from sy0..y_crossing + area = sign * (y_crossing - sy0); + + // area of the triangle (x_top,sy0), (x1+1,sy0), (x1+1,y_crossing) + scanline[x1] += stbtt__sized_triangle_area(area, x1 + 1 - x_top); + + // check if final y_crossing is blown up; no test case for this + if(y_final > y_bottom) { + y_final = y_bottom; + dy = (y_final - y_crossing) / (x2 - (x1 + 1)); // if denom=0, y_final = y_crossing, so y_final <= y_bottom + } + + // in second pixel, area covered by line segment found in first pixel + // is always a rectangle 1 wide * the height of that line segment; this + // is exactly what the variable 'area' stores. it also gets a contribution + // from the line segment within it. the THIRD pixel will get the first + // pixel's rectangle contribution, the second pixel's rectangle contribution, + // and its own contribution. the 'own contribution' is the same in every pixel except + // the leftmost and rightmost, a trapezoid that slides down in each pixel. + // the second pixel's contribution to the third pixel will be the + // rectangle 1 wide times the height change in the second pixel, which is dy. + + step = sign * dy * 1; // dy is dy/dx, change in y for every 1 change in x, + // which multiplied by 1-pixel-width is how much pixel area changes for each step in x + // so the area advances by 'step' every time + + for(x = x1 + 1; x < x2; ++x) { + scanline[x] += area + step / 2; // area of trapezoid is 1*step/2 + area += step; + } + STBTT_assert(STBTT_fabs(area) <= 1.01f); // accumulated error from area += step unless we round step down + STBTT_assert(sy1 > y_final - 0.01f); + + // area covered in the last pixel is the rectangle from all the pixels to the left, + // plus the trapezoid filled by the line segment in this pixel all the way to the right edge + scanline[x2] += area + sign * stbtt__position_trapezoid_area(sy1 - y_final, (float)x2, x2 + 1.0f, x_bottom, x2 + 1.0f); + + // the rest of the line is filled based on the total height of the line segment in this pixel + scanline_fill[x2] += sign * (sy1 - sy0); + } + } + else { + // if edge goes outside of box we're drawing, we require + // clipping logic. since this does not match the intended use + // of this library, we use a different, very slow brute + // force implementation + // note though that this does happen some of the time because + // x_top and x_bottom can be extrapolated at the top & bottom of + // the shape and actually lie outside the bounding box + int x; + for(x = 0; x < len; ++x) { + // cases: + // + // there can be up to two intersections with the pixel. any intersection + // with left or right edges can be handled by splitting into two (or three) + // regions. intersections with top & bottom do not necessitate case-wise logic. + // + // the old way of doing this found the intersections with the left & right edges, + // then used some simple logic to produce up to three segments in sorted order + // from top-to-bottom. however, this had a problem: if an x edge was epsilon + // across the x border, then the corresponding y position might not be distinct + // from the other y segment, and it might ignored as an empty segment. to avoid + // that, we need to explicitly produce segments based on x positions. + + // rename variables to clearly-defined pairs + float y0 = y_top; + float x1 = (float)(x); + float x2 = (float)(x + 1); + float x3 = xb; + float y3 = y_bottom; + + // x = e->x + e->dx * (y-y_top) + // (y-y_top) = (x - e->x) / e->dx + // y = (x - e->x) / e->dx + y_top + float y1 = (x - x0) / dx + y_top; + float y2 = (x + 1 - x0) / dx + y_top; + + if(x0 < x1 && x3 > x2) { // three segments descending down-right + stbtt__handle_clipped_edge(scanline, x, e, x0, y0, x1, y1); + stbtt__handle_clipped_edge(scanline, x, e, x1, y1, x2, y2); + stbtt__handle_clipped_edge(scanline, x, e, x2, y2, x3, y3); + } + else if(x3 < x1 && x0 > x2) { // three segments descending down-left + stbtt__handle_clipped_edge(scanline, x, e, x0, y0, x2, y2); + stbtt__handle_clipped_edge(scanline, x, e, x2, y2, x1, y1); + stbtt__handle_clipped_edge(scanline, x, e, x1, y1, x3, y3); + } + else if(x0 < x1 && x3 > x1) { // two segments across x, down-right + stbtt__handle_clipped_edge(scanline, x, e, x0, y0, x1, y1); + stbtt__handle_clipped_edge(scanline, x, e, x1, y1, x3, y3); + } + else if(x3 < x1 && x0 > x1) { // two segments across x, down-left + stbtt__handle_clipped_edge(scanline, x, e, x0, y0, x1, y1); + stbtt__handle_clipped_edge(scanline, x, e, x1, y1, x3, y3); + } + else if(x0 < x2 && x3 > x2) { // two segments across x+1, down-right + stbtt__handle_clipped_edge(scanline, x, e, x0, y0, x2, y2); + stbtt__handle_clipped_edge(scanline, x, e, x2, y2, x3, y3); + } + else if(x3 < x2 && x0 > x2) { // two segments across x+1, down-left + stbtt__handle_clipped_edge(scanline, x, e, x0, y0, x2, y2); + stbtt__handle_clipped_edge(scanline, x, e, x2, y2, x3, y3); + } + else { // one segment + stbtt__handle_clipped_edge(scanline, x, e, x0, y0, x3, y3); + } + } + } + } + e = e->next; + } +} + +// directly AA rasterize edges w/o supersampling +static void stbtt__rasterize_sorted_edges(stbtt__bitmap * result, stbtt__edge * e, int n, int vsubsample, int off_x, + int off_y, void * userdata) +{ + stbtt__hheap hh = { 0, 0, 0 }; + stbtt__active_edge * active = NULL; + int y, j = 0, i; + float scanline_data[129], * scanline, * scanline2; + + STBTT__NOTUSED(vsubsample); + + if(result->w > 64) + scanline = (float *)STBTT_malloc((result->w * 2 + 1) * sizeof(float), userdata); + else + scanline = scanline_data; + + scanline2 = scanline + result->w; + + y = off_y; + e[n].y0 = (float)(off_y + result->h) + 1; + + while(j < result->h) { + // find center of pixel for this scanline + float scan_y_top = y + 0.0f; + float scan_y_bottom = y + 1.0f; + stbtt__active_edge ** step = &active; + + STBTT_memset(scanline, 0, result->w * sizeof(scanline[0])); + STBTT_memset(scanline2, 0, (result->w + 1) * sizeof(scanline[0])); + + // update all active edges; + // remove all active edges that terminate before the top of this scanline + while(*step) { + stbtt__active_edge * z = *step; + if(z->ey <= scan_y_top) { + *step = z->next; // delete from list + STBTT_assert(z->direction); + z->direction = 0; + stbtt__hheap_free(&hh, z); + } + else { + step = &((*step)->next); // advance through list + } + } + + // insert all edges that start before the bottom of this scanline + while(e->y0 <= scan_y_bottom) { + if(e->y0 != e->y1) { + stbtt__active_edge * z = stbtt__new_active(&hh, e, off_x, scan_y_top, userdata); + if(z != NULL) { + if(j == 0 && off_y != 0) { + if(z->ey < scan_y_top) { + // this can happen due to subpixel positioning and some kind of fp rounding error i think + z->ey = scan_y_top; + } + } + STBTT_assert(z->ey >= scan_y_top); // if we get really unlucky a tiny bit of an edge can be out of bounds + // insert at front + z->next = active; + active = z; + } + } + ++e; + } + + // now process all active edges + if(active) + stbtt__fill_active_edges_new(scanline, scanline2 + 1, result->w, active, scan_y_top); + + { + float sum = 0; + for(i = 0; i < result->w; ++i) { + float k; + int m; + sum += scanline2[i]; + k = scanline[i] + sum; + k = (float)STBTT_fabs(k) * 255 + 0.5f; + m = (int)k; + if(m > 255) m = 255; + result->pixels[j * result->stride + i] = (unsigned char)m; + } + } + // advance all the edges + step = &active; + while(*step) { + stbtt__active_edge * z = *step; + z->fx += z->fdx; // advance to position for current scanline + step = &((*step)->next); // advance through list + } + + ++y; + ++j; + } + + stbtt__hheap_cleanup(&hh, userdata); + + if(scanline != scanline_data) + STBTT_free(scanline, userdata); +} +#else +#error "Unrecognized value of STBTT_RASTERIZER_VERSION" +#endif + +#define STBTT__COMPARE(a,b) ((a)->y0 < (b)->y0) + +static void stbtt__sort_edges_ins_sort(stbtt__edge * p, int n) +{ + int i, j; + for(i = 1; i < n; ++i) { + stbtt__edge t = p[i], * a = &t; + j = i; + while(j > 0) { + stbtt__edge * b = &p[j - 1]; + int c = STBTT__COMPARE(a, b); + if(!c) break; + p[j] = p[j - 1]; + --j; + } + if(i != j) + p[j] = t; + } +} + +static void stbtt__sort_edges_quicksort(stbtt__edge * p, int n) +{ + /* threshold for transitioning to insertion sort */ + while(n > 12) { + stbtt__edge t; + int c01, c12, c, m, i, j; + + /* compute median of three */ + m = n >> 1; + c01 = STBTT__COMPARE(&p[0], &p[m]); + c12 = STBTT__COMPARE(&p[m], &p[n - 1]); + /* if 0 >= mid >= end, or 0 < mid < end, then use mid */ + if(c01 != c12) { + /* otherwise, we'll need to swap something else to middle */ + int z; + c = STBTT__COMPARE(&p[0], &p[n - 1]); + /* 0>mid && midn => n; 0 0 */ + /* 0n: 0>n => 0; 0 n */ + z = (c == c12) ? 0 : n - 1; + t = p[z]; + p[z] = p[m]; + p[m] = t; + } + /* now p[m] is the median-of-three */ + /* swap it to the beginning so it won't move around */ + t = p[0]; + p[0] = p[m]; + p[m] = t; + + /* partition loop */ + i = 1; + j = n - 1; + for(;;) { + /* handling of equality is crucial here */ + /* for sentinels & efficiency with duplicates */ + for(;; ++i) { + if(!STBTT__COMPARE(&p[i], &p[0])) break; + } + for(;; --j) { + if(!STBTT__COMPARE(&p[0], &p[j])) break; + } + /* make sure we haven't crossed */ + if(i >= j) break; + t = p[i]; + p[i] = p[j]; + p[j] = t; + + ++i; + --j; + } + /* recurse on smaller side, iterate on larger */ + if(j < (n - i)) { + stbtt__sort_edges_quicksort(p, j); + p = p + i; + n = n - i; + } + else { + stbtt__sort_edges_quicksort(p + i, n - i); + n = j; + } + } +} + +static void stbtt__sort_edges(stbtt__edge * p, int n) +{ + stbtt__sort_edges_quicksort(p, n); + stbtt__sort_edges_ins_sort(p, n); +} + +typedef struct { + float x, y; +} stbtt__point; + +static void stbtt__rasterize(stbtt__bitmap * result, stbtt__point * pts, int * wcount, int windings, float scale_x, + float scale_y, float shift_x, float shift_y, int off_x, int off_y, int invert, void * userdata) +{ + float y_scale_inv = invert ? -scale_y : scale_y; + stbtt__edge * e; + int n, i, j, k, m; +#if STBTT_RASTERIZER_VERSION == 1 + int vsubsample = result->h < 8 ? 15 : 5; +#elif STBTT_RASTERIZER_VERSION == 2 + int vsubsample = 1; +#else +#error "Unrecognized value of STBTT_RASTERIZER_VERSION" +#endif + // vsubsample should divide 255 evenly; otherwise we won't reach full opacity + + // now we have to blow out the windings into explicit edge lists + n = 0; + for(i = 0; i < windings; ++i) + n += wcount[i]; + + e = (stbtt__edge *)STBTT_malloc(sizeof(*e) * (n + 1), userdata); // add an extra one as a sentinel + if(e == 0) return; + n = 0; + + m = 0; + for(i = 0; i < windings; ++i) { + stbtt__point * p = pts + m; + m += wcount[i]; + j = wcount[i] - 1; + for(k = 0; k < wcount[i]; j = k++) { + int a = k, b = j; + // skip the edge if horizontal + if(p[j].y == p[k].y) + continue; + // add edge from j to k to the list + e[n].invert = 0; + if(invert ? p[j].y > p[k].y : p[j].y < p[k].y) { + e[n].invert = 1; + a = j, b = k; + } + e[n].x0 = p[a].x * scale_x + shift_x; + e[n].y0 = (p[a].y * y_scale_inv + shift_y) * vsubsample; + e[n].x1 = p[b].x * scale_x + shift_x; + e[n].y1 = (p[b].y * y_scale_inv + shift_y) * vsubsample; + ++n; + } + } + + // now sort the edges by their highest point (should snap to integer, and then by x) + //STBTT_sort(e, n, sizeof(e[0]), stbtt__edge_compare); + stbtt__sort_edges(e, n); + + // now, traverse the scanlines and find the intersections on each scanline, use xor winding rule + stbtt__rasterize_sorted_edges(result, e, n, vsubsample, off_x, off_y, userdata); + + STBTT_free(e, userdata); +} + +static void stbtt__add_point(stbtt__point * points, int n, float x, float y) +{ + if(!points) return; // during first pass, it's unallocated + points[n].x = x; + points[n].y = y; +} + +// tessellate until threshold p is happy... @TODO warped to compensate for non-linear stretching +static int stbtt__tesselate_curve(stbtt__point * points, int * num_points, float x0, float y0, float x1, float y1, + float x2, float y2, float objspace_flatness_squared, int n) +{ + // midpoint + float mx = (x0 + 2 * x1 + x2) / 4; + float my = (y0 + 2 * y1 + y2) / 4; + // versus directly drawn line + float dx = (x0 + x2) / 2 - mx; + float dy = (y0 + y2) / 2 - my; + if(n > 16) // 65536 segments on one curve better be enough! + return 1; + if(dx * dx + dy * dy > objspace_flatness_squared) { // half-pixel error allowed... need to be smaller if AA + stbtt__tesselate_curve(points, num_points, x0, y0, (x0 + x1) / 2.0f, (y0 + y1) / 2.0f, mx, my, + objspace_flatness_squared, n + 1); + stbtt__tesselate_curve(points, num_points, mx, my, (x1 + x2) / 2.0f, (y1 + y2) / 2.0f, x2, y2, + objspace_flatness_squared, n + 1); + } + else { + stbtt__add_point(points, *num_points, x2, y2); + *num_points = *num_points + 1; + } + return 1; +} + +static void stbtt__tesselate_cubic(stbtt__point * points, int * num_points, float x0, float y0, float x1, float y1, + float x2, float y2, float x3, float y3, float objspace_flatness_squared, int n) +{ + // @TODO this "flatness" calculation is just made-up nonsense that seems to work well enough + float dx0 = x1 - x0; + float dy0 = y1 - y0; + float dx1 = x2 - x1; + float dy1 = y2 - y1; + float dx2 = x3 - x2; + float dy2 = y3 - y2; + float dx = x3 - x0; + float dy = y3 - y0; + float longlen = (float)(STBTT_sqrt(dx0 * dx0 + dy0 * dy0) + STBTT_sqrt(dx1 * dx1 + dy1 * dy1) + STBTT_sqrt( + dx2 * dx2 + dy2 * dy2)); + float shortlen = (float)STBTT_sqrt(dx * dx + dy * dy); + float flatness_squared = longlen * longlen - shortlen * shortlen; + + if(n > 16) // 65536 segments on one curve better be enough! + return; + + if(flatness_squared > objspace_flatness_squared) { + float x01 = (x0 + x1) / 2; + float y01 = (y0 + y1) / 2; + float x12 = (x1 + x2) / 2; + float y12 = (y1 + y2) / 2; + float x23 = (x2 + x3) / 2; + float y23 = (y2 + y3) / 2; + + float xa = (x01 + x12) / 2; + float ya = (y01 + y12) / 2; + float xb = (x12 + x23) / 2; + float yb = (y12 + y23) / 2; + + float mx = (xa + xb) / 2; + float my = (ya + yb) / 2; + + stbtt__tesselate_cubic(points, num_points, x0, y0, x01, y01, xa, ya, mx, my, objspace_flatness_squared, n + 1); + stbtt__tesselate_cubic(points, num_points, mx, my, xb, yb, x23, y23, x3, y3, objspace_flatness_squared, n + 1); + } + else { + stbtt__add_point(points, *num_points, x3, y3); + *num_points = *num_points + 1; + } +} + +// returns number of contours +static stbtt__point * stbtt_FlattenCurves(stbtt_vertex * vertices, int num_verts, float objspace_flatness, + int ** contour_lengths, int * num_contours, void * userdata) +{ + stbtt__point * points = 0; + int num_points = 0; + + float objspace_flatness_squared = objspace_flatness * objspace_flatness; + int i, n = 0, start = 0, pass; + + // count how many "moves" there are to get the contour count + for(i = 0; i < num_verts; ++i) + if(vertices[i].type == STBTT_vmove) + ++n; + + *num_contours = n; + if(n == 0) return 0; + + *contour_lengths = (int *)STBTT_malloc(sizeof(**contour_lengths) * n, userdata); + + if(*contour_lengths == 0) { + *num_contours = 0; + return 0; + } + + // make two passes through the points so we don't need to realloc + for(pass = 0; pass < 2; ++pass) { + float x = 0, y = 0; + if(pass == 1) { + points = (stbtt__point *)STBTT_malloc(num_points * sizeof(points[0]), userdata); + if(points == NULL) goto error; + } + num_points = 0; + n = -1; + for(i = 0; i < num_verts; ++i) { + switch(vertices[i].type) { + case STBTT_vmove: + // start the next contour + if(n >= 0) + (*contour_lengths)[n] = num_points - start; + ++n; + start = num_points; + + x = vertices[i].x, y = vertices[i].y; + stbtt__add_point(points, num_points++, x, y); + break; + case STBTT_vline: + x = vertices[i].x, y = vertices[i].y; + stbtt__add_point(points, num_points++, x, y); + break; + case STBTT_vcurve: + stbtt__tesselate_curve(points, &num_points, x, y, + vertices[i].cx, vertices[i].cy, + vertices[i].x, vertices[i].y, + objspace_flatness_squared, 0); + x = vertices[i].x, y = vertices[i].y; + break; + case STBTT_vcubic: + stbtt__tesselate_cubic(points, &num_points, x, y, + vertices[i].cx, vertices[i].cy, + vertices[i].cx1, vertices[i].cy1, + vertices[i].x, vertices[i].y, + objspace_flatness_squared, 0); + x = vertices[i].x, y = vertices[i].y; + break; + } + } + (*contour_lengths)[n] = num_points - start; + } + + return points; +error: + STBTT_free(points, userdata); + STBTT_free(*contour_lengths, userdata); + *contour_lengths = 0; + *num_contours = 0; + return NULL; +} + +STBTT_DEF void stbtt_Rasterize(stbtt__bitmap * result, float flatness_in_pixels, stbtt_vertex * vertices, int num_verts, + float scale_x, float scale_y, float shift_x, float shift_y, int x_off, int y_off, int invert, void * userdata) +{ + float scale = scale_x > scale_y ? scale_y : scale_x; + int winding_count = 0; + int * winding_lengths = NULL; + stbtt__point * windings = stbtt_FlattenCurves(vertices, num_verts, flatness_in_pixels / scale, &winding_lengths, + &winding_count, userdata); + if(windings) { + stbtt__rasterize(result, windings, winding_lengths, winding_count, scale_x, scale_y, shift_x, shift_y, x_off, y_off, + invert, userdata); + STBTT_free(winding_lengths, userdata); + STBTT_free(windings, userdata); + } +} + +STBTT_DEF void stbtt_FreeBitmap(unsigned char * bitmap, void * userdata) +{ + STBTT_free(bitmap, userdata); +} + +STBTT_DEF unsigned char * stbtt_GetGlyphBitmapSubpixel(const stbtt_fontinfo * info, float scale_x, float scale_y, + float shift_x, float shift_y, int glyph, int * width, int * height, int * xoff, int * yoff) +{ + int ix0, iy0, ix1, iy1; + stbtt__bitmap gbm; + stbtt_vertex * vertices; + int num_verts = stbtt_GetGlyphShape(info, glyph, &vertices); + + if(scale_x == 0) scale_x = scale_y; + if(scale_y == 0) { + if(scale_x == 0) { + STBTT_free(vertices, info->userdata); + return NULL; + } + scale_y = scale_x; + } + + stbtt_GetGlyphBitmapBoxSubpixel(info, glyph, scale_x, scale_y, shift_x, shift_y, &ix0, &iy0, &ix1, &iy1); + + // now we get the size + gbm.w = (ix1 - ix0); + gbm.h = (iy1 - iy0); + gbm.pixels = NULL; // in case we error + + if(width) *width = gbm.w; + if(height) *height = gbm.h; + if(xoff) *xoff = ix0; + if(yoff) *yoff = iy0; + + if(gbm.w && gbm.h) { + gbm.pixels = (unsigned char *)STBTT_malloc(gbm.w * gbm.h, info->userdata); + if(gbm.pixels) { + gbm.stride = gbm.w; + + stbtt_Rasterize(&gbm, 0.35f, vertices, num_verts, scale_x, scale_y, shift_x, shift_y, ix0, iy0, 1, info->userdata); + } + } + STBTT_free(vertices, info->userdata); + return gbm.pixels; +} + +STBTT_DEF unsigned char * stbtt_GetGlyphBitmap(const stbtt_fontinfo * info, float scale_x, float scale_y, int glyph, + int * width, int * height, int * xoff, int * yoff) +{ + return stbtt_GetGlyphBitmapSubpixel(info, scale_x, scale_y, 0.0f, 0.0f, glyph, width, height, xoff, yoff); +} + +STBTT_DEF void stbtt_MakeGlyphBitmapSubpixel(const stbtt_fontinfo * info, unsigned char * output, int out_w, int out_h, + int out_stride, float scale_x, float scale_y, float shift_x, float shift_y, int glyph) +{ + int ix0, iy0; + stbtt_vertex * vertices; + int num_verts = stbtt_GetGlyphShape(info, glyph, &vertices); + stbtt__bitmap gbm; + + stbtt_GetGlyphBitmapBoxSubpixel(info, glyph, scale_x, scale_y, shift_x, shift_y, &ix0, &iy0, 0, 0); + gbm.pixels = output; + gbm.w = out_w; + gbm.h = out_h; + gbm.stride = out_stride; + + if(gbm.w && gbm.h) + stbtt_Rasterize(&gbm, 0.35f, vertices, num_verts, scale_x, scale_y, shift_x, shift_y, ix0, iy0, 1, info->userdata); + + STBTT_free(vertices, info->userdata); +} + +STBTT_DEF void stbtt_MakeGlyphBitmap(const stbtt_fontinfo * info, unsigned char * output, int out_w, int out_h, + int out_stride, float scale_x, float scale_y, int glyph) +{ + stbtt_MakeGlyphBitmapSubpixel(info, output, out_w, out_h, out_stride, scale_x, scale_y, 0.0f, 0.0f, glyph); +} + +STBTT_DEF unsigned char * stbtt_GetCodepointBitmapSubpixel(const stbtt_fontinfo * info, float scale_x, float scale_y, + float shift_x, float shift_y, int codepoint, int * width, int * height, int * xoff, int * yoff) +{ + return stbtt_GetGlyphBitmapSubpixel(info, scale_x, scale_y, shift_x, shift_y, stbtt_FindGlyphIndex(info, codepoint), + width, height, xoff, yoff); +} + +STBTT_DEF void stbtt_MakeCodepointBitmapSubpixelPrefilter(const stbtt_fontinfo * info, unsigned char * output, + int out_w, int out_h, int out_stride, float scale_x, float scale_y, float shift_x, float shift_y, int oversample_x, + int oversample_y, float * sub_x, float * sub_y, int codepoint) +{ + stbtt_MakeGlyphBitmapSubpixelPrefilter(info, output, out_w, out_h, out_stride, scale_x, scale_y, shift_x, shift_y, + oversample_x, oversample_y, sub_x, sub_y, stbtt_FindGlyphIndex(info, codepoint)); +} + +STBTT_DEF void stbtt_MakeCodepointBitmapSubpixel(const stbtt_fontinfo * info, unsigned char * output, int out_w, + int out_h, int out_stride, float scale_x, float scale_y, float shift_x, float shift_y, int codepoint) +{ + stbtt_MakeGlyphBitmapSubpixel(info, output, out_w, out_h, out_stride, scale_x, scale_y, shift_x, shift_y, + stbtt_FindGlyphIndex(info, codepoint)); +} + +STBTT_DEF unsigned char * stbtt_GetCodepointBitmap(const stbtt_fontinfo * info, float scale_x, float scale_y, + int codepoint, int * width, int * height, int * xoff, int * yoff) +{ + return stbtt_GetCodepointBitmapSubpixel(info, scale_x, scale_y, 0.0f, 0.0f, codepoint, width, height, xoff, yoff); +} + +STBTT_DEF void stbtt_MakeCodepointBitmap(const stbtt_fontinfo * info, unsigned char * output, int out_w, int out_h, + int out_stride, float scale_x, float scale_y, int codepoint) +{ + stbtt_MakeCodepointBitmapSubpixel(info, output, out_w, out_h, out_stride, scale_x, scale_y, 0.0f, 0.0f, codepoint); +} + +////////////////////////////////////////////////////////////////////////////// +// +// bitmap baking +// +// This is SUPER-CRAPPY packing to keep source code small +#ifdef STBTT_STREAM_TYPE +static int stbtt_BakeFontBitmap_internal(STBTT_STREAM_TYPE data, + int offset, // font location (use offset=0 for plain .ttf) + float pixel_height, // height of font in pixels + unsigned char * pixels, int pw, int ph, // bitmap to be filled in + int first_char, int num_chars, // characters to bake + stbtt_bakedchar * chardata) +#else +static int stbtt_BakeFontBitmap_internal(unsigned char * data, + int offset, // font location (use offset=0 for plain .ttf) + float pixel_height, // height of font in pixels + unsigned char * pixels, int pw, int ph, // bitmap to be filled in + int first_char, int num_chars, // characters to bake + stbtt_bakedchar * chardata) +#endif +{ + float scale; + int x, y, bottom_y, i; + stbtt_fontinfo f; + f.userdata = NULL; + if(!stbtt_InitFont(&f, data, offset)) + return -1; + STBTT_memset(pixels, 0, pw * ph); // background of 0 around pixels + x = y = 1; + bottom_y = 1; + + scale = stbtt_ScaleForPixelHeight(&f, pixel_height); + + for(i = 0; i < num_chars; ++i) { + int advance, lsb, x0, y0, x1, y1, gw, gh; + int g = stbtt_FindGlyphIndex(&f, first_char + i); + stbtt_GetGlyphHMetrics(&f, g, &advance, &lsb); + stbtt_GetGlyphBitmapBox(&f, g, scale, scale, &x0, &y0, &x1, &y1); + gw = x1 - x0; + gh = y1 - y0; + if(x + gw + 1 >= pw) + y = bottom_y, x = 1; // advance to next row + if(y + gh + 1 >= ph) // check if it fits vertically AFTER potentially moving to next row + return -i; + STBTT_assert(x + gw < pw); + STBTT_assert(y + gh < ph); + stbtt_MakeGlyphBitmap(&f, pixels + x + y * pw, gw, gh, pw, scale, scale, g); + chardata[i].x0 = (stbtt_int16)x; + chardata[i].y0 = (stbtt_int16)y; + chardata[i].x1 = (stbtt_int16)(x + gw); + chardata[i].y1 = (stbtt_int16)(y + gh); + chardata[i].xadvance = scale * advance; + chardata[i].xoff = (float)x0; + chardata[i].yoff = (float)y0; + x = x + gw + 1; + if(y + gh + 1 > bottom_y) + bottom_y = y + gh + 1; + } + return bottom_y; +} + +STBTT_DEF void stbtt_GetBakedQuad(const stbtt_bakedchar * chardata, int pw, int ph, int char_index, float * xpos, + float * ypos, stbtt_aligned_quad * q, int opengl_fillrule) +{ + float d3d_bias = opengl_fillrule ? 0 : -0.5f; + float ipw = 1.0f / pw, iph = 1.0f / ph; + const stbtt_bakedchar * b = chardata + char_index; + int round_x = STBTT_ifloor((*xpos + b->xoff) + 0.5f); + int round_y = STBTT_ifloor((*ypos + b->yoff) + 0.5f); + + q->x0 = round_x + d3d_bias; + q->y0 = round_y + d3d_bias; + q->x1 = round_x + b->x1 - b->x0 + d3d_bias; + q->y1 = round_y + b->y1 - b->y0 + d3d_bias; + + q->s0 = b->x0 * ipw; + q->t0 = b->y0 * iph; + q->s1 = b->x1 * ipw; + q->t1 = b->y1 * iph; + + *xpos += b->xadvance; +} + +////////////////////////////////////////////////////////////////////////////// +// +// rectangle packing replacement routines if you don't have stb_rect_pack.h +// + +#ifndef STB_RECT_PACK_VERSION + +typedef int stbrp_coord; + +//////////////////////////////////////////////////////////////////////////////////// +// // +// // +// COMPILER WARNING ?!?!? // +// // +// // +// if you get a compile warning due to these symbols being defined more than // +// once, move #include "stb_rect_pack.h" before #include "stb_truetype.h" // +// // +//////////////////////////////////////////////////////////////////////////////////// + +typedef struct { + int width, height; + int x, y, bottom_y; +} stbrp_context; + +typedef struct { + unsigned char x; +} stbrp_node; + +struct stbrp_rect { + stbrp_coord x, y; + int id, w, h, was_packed; +}; + +static void stbrp_init_target(stbrp_context * con, int pw, int ph, stbrp_node * nodes, int num_nodes) +{ + con->width = pw; + con->height = ph; + con->x = 0; + con->y = 0; + con->bottom_y = 0; + STBTT__NOTUSED(nodes); + STBTT__NOTUSED(num_nodes); +} + +static void stbrp_pack_rects(stbrp_context * con, stbrp_rect * rects, int num_rects) +{ + int i; + for(i = 0; i < num_rects; ++i) { + if(con->x + rects[i].w > con->width) { + con->x = 0; + con->y = con->bottom_y; + } + if(con->y + rects[i].h > con->height) + break; + rects[i].x = con->x; + rects[i].y = con->y; + rects[i].was_packed = 1; + con->x += rects[i].w; + if(con->y + rects[i].h > con->bottom_y) + con->bottom_y = con->y + rects[i].h; + } + for(; i < num_rects; ++i) + rects[i].was_packed = 0; +} +#endif + +////////////////////////////////////////////////////////////////////////////// +// +// bitmap baking +// +// This is SUPER-AWESOME (tm Ryan Gordon) packing using stb_rect_pack.h. If +// stb_rect_pack.h isn't available, it uses the BakeFontBitmap strategy. + +STBTT_DEF int stbtt_PackBegin(stbtt_pack_context * spc, unsigned char * pixels, int pw, int ph, int stride_in_bytes, + int padding, void * alloc_context) +{ + stbrp_context * context = (stbrp_context *)STBTT_malloc(sizeof(*context), alloc_context); + int num_nodes = pw - padding; + stbrp_node * nodes = (stbrp_node *)STBTT_malloc(sizeof(*nodes) * num_nodes, alloc_context); + + if(context == NULL || nodes == NULL) { + if(context != NULL) STBTT_free(context, alloc_context); + if(nodes != NULL) STBTT_free(nodes, alloc_context); + return 0; + } + + spc->user_allocator_context = alloc_context; + spc->width = pw; + spc->height = ph; + spc->pixels = pixels; + spc->pack_info = context; + spc->nodes = nodes; + spc->padding = padding; + spc->stride_in_bytes = stride_in_bytes != 0 ? stride_in_bytes : pw; + spc->h_oversample = 1; + spc->v_oversample = 1; + spc->skip_missing = 0; + + stbrp_init_target(context, pw - padding, ph - padding, nodes, num_nodes); + + if(pixels) + STBTT_memset(pixels, 0, pw * ph); // background of 0 around pixels + + return 1; +} + +STBTT_DEF void stbtt_PackEnd(stbtt_pack_context * spc) +{ + STBTT_free(spc->nodes, spc->user_allocator_context); + STBTT_free(spc->pack_info, spc->user_allocator_context); +} + +STBTT_DEF void stbtt_PackSetOversampling(stbtt_pack_context * spc, unsigned int h_oversample, unsigned int v_oversample) +{ + STBTT_assert(h_oversample <= STBTT_MAX_OVERSAMPLE); + STBTT_assert(v_oversample <= STBTT_MAX_OVERSAMPLE); + if(h_oversample <= STBTT_MAX_OVERSAMPLE) + spc->h_oversample = h_oversample; + if(v_oversample <= STBTT_MAX_OVERSAMPLE) + spc->v_oversample = v_oversample; +} + +STBTT_DEF void stbtt_PackSetSkipMissingCodepoints(stbtt_pack_context * spc, int skip) +{ + spc->skip_missing = skip; +} + +#define STBTT__OVER_MASK (STBTT_MAX_OVERSAMPLE-1) + +static void stbtt__h_prefilter(unsigned char * pixels, int w, int h, int stride_in_bytes, unsigned int kernel_width) +{ + unsigned char buffer[STBTT_MAX_OVERSAMPLE]; + int safe_w = w - kernel_width; + int j; + STBTT_memset(buffer, 0, STBTT_MAX_OVERSAMPLE); // suppress bogus warning from VS2013 -analyze + for(j = 0; j < h; ++j) { + int i; + unsigned int total; + STBTT_memset(buffer, 0, kernel_width); + + total = 0; + + // make kernel_width a constant in common cases so compiler can optimize out the divide + switch(kernel_width) { + case 2: + for(i = 0; i <= safe_w; ++i) { + total += pixels[i] - buffer[i & STBTT__OVER_MASK]; + buffer[(i + kernel_width) & STBTT__OVER_MASK] = pixels[i]; + pixels[i] = (unsigned char)(total / 2); + } + break; + case 3: + for(i = 0; i <= safe_w; ++i) { + total += pixels[i] - buffer[i & STBTT__OVER_MASK]; + buffer[(i + kernel_width) & STBTT__OVER_MASK] = pixels[i]; + pixels[i] = (unsigned char)(total / 3); + } + break; + case 4: + for(i = 0; i <= safe_w; ++i) { + total += pixels[i] - buffer[i & STBTT__OVER_MASK]; + buffer[(i + kernel_width) & STBTT__OVER_MASK] = pixels[i]; + pixels[i] = (unsigned char)(total / 4); + } + break; + case 5: + for(i = 0; i <= safe_w; ++i) { + total += pixels[i] - buffer[i & STBTT__OVER_MASK]; + buffer[(i + kernel_width) & STBTT__OVER_MASK] = pixels[i]; + pixels[i] = (unsigned char)(total / 5); + } + break; + default: + for(i = 0; i <= safe_w; ++i) { + total += pixels[i] - buffer[i & STBTT__OVER_MASK]; + buffer[(i + kernel_width) & STBTT__OVER_MASK] = pixels[i]; + pixels[i] = (unsigned char)(total / kernel_width); + } + break; + } + + for(; i < w; ++i) { + STBTT_assert(pixels[i] == 0); + total -= buffer[i & STBTT__OVER_MASK]; + pixels[i] = (unsigned char)(total / kernel_width); + } + + pixels += stride_in_bytes; + } +} + +static void stbtt__v_prefilter(unsigned char * pixels, int w, int h, int stride_in_bytes, unsigned int kernel_width) +{ + unsigned char buffer[STBTT_MAX_OVERSAMPLE]; + int safe_h = h - kernel_width; + int j; + STBTT_memset(buffer, 0, STBTT_MAX_OVERSAMPLE); // suppress bogus warning from VS2013 -analyze + for(j = 0; j < w; ++j) { + int i; + unsigned int total; + STBTT_memset(buffer, 0, kernel_width); + + total = 0; + + // make kernel_width a constant in common cases so compiler can optimize out the divide + switch(kernel_width) { + case 2: + for(i = 0; i <= safe_h; ++i) { + total += pixels[i * stride_in_bytes] - buffer[i & STBTT__OVER_MASK]; + buffer[(i + kernel_width) & STBTT__OVER_MASK] = pixels[i * stride_in_bytes]; + pixels[i * stride_in_bytes] = (unsigned char)(total / 2); + } + break; + case 3: + for(i = 0; i <= safe_h; ++i) { + total += pixels[i * stride_in_bytes] - buffer[i & STBTT__OVER_MASK]; + buffer[(i + kernel_width) & STBTT__OVER_MASK] = pixels[i * stride_in_bytes]; + pixels[i * stride_in_bytes] = (unsigned char)(total / 3); + } + break; + case 4: + for(i = 0; i <= safe_h; ++i) { + total += pixels[i * stride_in_bytes] - buffer[i & STBTT__OVER_MASK]; + buffer[(i + kernel_width) & STBTT__OVER_MASK] = pixels[i * stride_in_bytes]; + pixels[i * stride_in_bytes] = (unsigned char)(total / 4); + } + break; + case 5: + for(i = 0; i <= safe_h; ++i) { + total += pixels[i * stride_in_bytes] - buffer[i & STBTT__OVER_MASK]; + buffer[(i + kernel_width) & STBTT__OVER_MASK] = pixels[i * stride_in_bytes]; + pixels[i * stride_in_bytes] = (unsigned char)(total / 5); + } + break; + default: + for(i = 0; i <= safe_h; ++i) { + total += pixels[i * stride_in_bytes] - buffer[i & STBTT__OVER_MASK]; + buffer[(i + kernel_width) & STBTT__OVER_MASK] = pixels[i * stride_in_bytes]; + pixels[i * stride_in_bytes] = (unsigned char)(total / kernel_width); + } + break; + } + + for(; i < h; ++i) { + STBTT_assert(pixels[i * stride_in_bytes] == 0); + total -= buffer[i & STBTT__OVER_MASK]; + pixels[i * stride_in_bytes] = (unsigned char)(total / kernel_width); + } + + pixels += 1; + } +} + +static float stbtt__oversample_shift(int oversample) +{ + if(!oversample) + return 0.0f; + + // The prefilter is a box filter of width "oversample", + // which shifts phase by (oversample - 1)/2 pixels in + // oversampled space. We want to shift in the opposite + // direction to counter this. + return (float) - (oversample - 1) / (2.0f * (float)oversample); +} + +// rects array must be big enough to accommodate all characters in the given ranges +STBTT_DEF int stbtt_PackFontRangesGatherRects(stbtt_pack_context * spc, const stbtt_fontinfo * info, + stbtt_pack_range * ranges, int num_ranges, stbrp_rect * rects) +{ + int i, j, k; + int missing_glyph_added = 0; + + k = 0; + for(i = 0; i < num_ranges; ++i) { + float fh = ranges[i].font_size; + float scale = fh > 0 ? stbtt_ScaleForPixelHeight(info, fh) : stbtt_ScaleForMappingEmToPixels(info, -fh); + ranges[i].h_oversample = (unsigned char)spc->h_oversample; + ranges[i].v_oversample = (unsigned char)spc->v_oversample; + for(j = 0; j < ranges[i].num_chars; ++j) { + int x0, y0, x1, y1; + int codepoint = ranges[i].array_of_unicode_codepoints == NULL ? ranges[i].first_unicode_codepoint_in_range + j : + ranges[i].array_of_unicode_codepoints[j]; + int glyph = stbtt_FindGlyphIndex(info, codepoint); + if(glyph == 0 && (spc->skip_missing || missing_glyph_added)) { + rects[k].w = rects[k].h = 0; + } + else { + stbtt_GetGlyphBitmapBoxSubpixel(info, glyph, + scale * spc->h_oversample, + scale * spc->v_oversample, + 0, 0, + &x0, &y0, &x1, &y1); + rects[k].w = (stbrp_coord)(x1 - x0 + spc->padding + spc->h_oversample - 1); + rects[k].h = (stbrp_coord)(y1 - y0 + spc->padding + spc->v_oversample - 1); + if(glyph == 0) + missing_glyph_added = 1; + } + ++k; + } + } + + return k; +} + +STBTT_DEF void stbtt_MakeGlyphBitmapSubpixelPrefilter(const stbtt_fontinfo * info, unsigned char * output, int out_w, + int out_h, int out_stride, float scale_x, float scale_y, float shift_x, float shift_y, int prefilter_x, int prefilter_y, + float * sub_x, float * sub_y, int glyph) +{ + stbtt_MakeGlyphBitmapSubpixel(info, + output, + out_w - (prefilter_x - 1), + out_h - (prefilter_y - 1), + out_stride, + scale_x, + scale_y, + shift_x, + shift_y, + glyph); + + if(prefilter_x > 1) + stbtt__h_prefilter(output, out_w, out_h, out_stride, prefilter_x); + + if(prefilter_y > 1) + stbtt__v_prefilter(output, out_w, out_h, out_stride, prefilter_y); + + *sub_x = stbtt__oversample_shift(prefilter_x); + *sub_y = stbtt__oversample_shift(prefilter_y); +} + +// rects array must be big enough to accommodate all characters in the given ranges +STBTT_DEF int stbtt_PackFontRangesRenderIntoRects(stbtt_pack_context * spc, const stbtt_fontinfo * info, + stbtt_pack_range * ranges, int num_ranges, stbrp_rect * rects) +{ + int i, j, k, missing_glyph = -1, return_value = 1; + + // save current values + int old_h_over = spc->h_oversample; + int old_v_over = spc->v_oversample; + + k = 0; + for(i = 0; i < num_ranges; ++i) { + float fh = ranges[i].font_size; + float scale = fh > 0 ? stbtt_ScaleForPixelHeight(info, fh) : stbtt_ScaleForMappingEmToPixels(info, -fh); + float recip_h, recip_v, sub_x, sub_y; + spc->h_oversample = ranges[i].h_oversample; + spc->v_oversample = ranges[i].v_oversample; + recip_h = 1.0f / spc->h_oversample; + recip_v = 1.0f / spc->v_oversample; + sub_x = stbtt__oversample_shift(spc->h_oversample); + sub_y = stbtt__oversample_shift(spc->v_oversample); + for(j = 0; j < ranges[i].num_chars; ++j) { + stbrp_rect * r = &rects[k]; + if(r->was_packed && r->w != 0 && r->h != 0) { + stbtt_packedchar * bc = &ranges[i].chardata_for_range[j]; + int advance, lsb, x0, y0, x1, y1; + int codepoint = ranges[i].array_of_unicode_codepoints == NULL ? ranges[i].first_unicode_codepoint_in_range + j : + ranges[i].array_of_unicode_codepoints[j]; + int glyph = stbtt_FindGlyphIndex(info, codepoint); + stbrp_coord pad = (stbrp_coord)spc->padding; + + // pad on left and top + r->x += pad; + r->y += pad; + r->w -= pad; + r->h -= pad; + stbtt_GetGlyphHMetrics(info, glyph, &advance, &lsb); + stbtt_GetGlyphBitmapBox(info, glyph, + scale * spc->h_oversample, + scale * spc->v_oversample, + &x0, &y0, &x1, &y1); + stbtt_MakeGlyphBitmapSubpixel(info, + spc->pixels + r->x + r->y * spc->stride_in_bytes, + r->w - spc->h_oversample + 1, + r->h - spc->v_oversample + 1, + spc->stride_in_bytes, + scale * spc->h_oversample, + scale * spc->v_oversample, + 0, 0, + glyph); + + if(spc->h_oversample > 1) + stbtt__h_prefilter(spc->pixels + r->x + r->y * spc->stride_in_bytes, + r->w, r->h, spc->stride_in_bytes, + spc->h_oversample); + + if(spc->v_oversample > 1) + stbtt__v_prefilter(spc->pixels + r->x + r->y * spc->stride_in_bytes, + r->w, r->h, spc->stride_in_bytes, + spc->v_oversample); + + bc->x0 = (stbtt_int16)r->x; + bc->y0 = (stbtt_int16)r->y; + bc->x1 = (stbtt_int16)(r->x + r->w); + bc->y1 = (stbtt_int16)(r->y + r->h); + bc->xadvance = scale * advance; + bc->xoff = (float)x0 * recip_h + sub_x; + bc->yoff = (float)y0 * recip_v + sub_y; + bc->xoff2 = (x0 + r->w) * recip_h + sub_x; + bc->yoff2 = (y0 + r->h) * recip_v + sub_y; + + if(glyph == 0) + missing_glyph = j; + } + else if(spc->skip_missing) { + return_value = 0; + } + else if(r->was_packed && r->w == 0 && r->h == 0 && missing_glyph >= 0) { + ranges[i].chardata_for_range[j] = ranges[i].chardata_for_range[missing_glyph]; + } + else { + return_value = 0; // if any fail, report failure + } + + ++k; + } + } + + // restore original values + spc->h_oversample = old_h_over; + spc->v_oversample = old_v_over; + + return return_value; +} + +#ifdef STBTT_STREAM_TYPE +STBTT_DEF int stbtt_PackFontRanges(stbtt_pack_context * spc, STBTT_STREAM_TYPE fontdata, int font_index, + stbtt_pack_range * ranges, int num_ranges); +#else +STBTT_DEF int stbtt_PackFontRanges(stbtt_pack_context * spc, const unsigned char * fontdata, int font_index, + stbtt_pack_range * ranges, int num_ranges); +#endif + + +STBTT_DEF void stbtt_PackFontRangesPackRects(stbtt_pack_context * spc, stbrp_rect * rects, int num_rects) +{ + stbrp_pack_rects((stbrp_context *)spc->pack_info, rects, num_rects); +} +#ifdef STBTT_STREAM_TYPE +STBTT_DEF int stbtt_PackFontRanges(stbtt_pack_context * spc, STBTT_STREAM_TYPE fontdata, int font_index, + stbtt_pack_range * ranges, int num_ranges) +#else +STBTT_DEF int stbtt_PackFontRanges(stbtt_pack_context * spc, const unsigned char * fontdata, int font_index, + stbtt_pack_range * ranges, int num_ranges) +#endif +{ + stbtt_fontinfo info; + int i, j, n, return_value = 1; + //stbrp_context *context = (stbrp_context *) spc->pack_info; + stbrp_rect * rects; + + // flag all characters as NOT packed + for(i = 0; i < num_ranges; ++i) + for(j = 0; j < ranges[i].num_chars; ++j) + ranges[i].chardata_for_range[j].x0 = + ranges[i].chardata_for_range[j].y0 = + ranges[i].chardata_for_range[j].x1 = + ranges[i].chardata_for_range[j].y1 = 0; + + n = 0; + for(i = 0; i < num_ranges; ++i) + n += ranges[i].num_chars; + + rects = (stbrp_rect *)STBTT_malloc(sizeof(*rects) * n, spc->user_allocator_context); + if(rects == NULL) + return 0; + + info.userdata = spc->user_allocator_context; + stbtt_InitFont(&info, fontdata, stbtt_GetFontOffsetForIndex(fontdata, font_index)); + + n = stbtt_PackFontRangesGatherRects(spc, &info, ranges, num_ranges, rects); + + stbtt_PackFontRangesPackRects(spc, rects, n); + + return_value = stbtt_PackFontRangesRenderIntoRects(spc, &info, ranges, num_ranges, rects); + + STBTT_free(rects, spc->user_allocator_context); + return return_value; +} + +#ifdef STBTT_STREAM_TYPE +STBTT_DEF int stbtt_PackFontRange(stbtt_pack_context * spc, STBTT_STREAM_TYPE fontdata, int font_index, float font_size, + int first_unicode_codepoint_in_range, int num_chars_in_range, stbtt_packedchar * chardata_for_range); +#else +STBTT_DEF int stbtt_PackFontRange(stbtt_pack_context * spc, const unsigned char * fontdata, int font_index, + float font_size, + int first_unicode_codepoint_in_range, int num_chars_in_range, stbtt_packedchar * chardata_for_range); +#endif + +#ifdef STBTT_STREAM_TYPE +STBTT_DEF int stbtt_PackFontRange(stbtt_pack_context * spc, STBTT_STREAM_TYPE fontdata, int font_index, float font_size, + int first_unicode_codepoint_in_range, int num_chars_in_range, stbtt_packedchar * chardata_for_range) +#else +STBTT_DEF int stbtt_PackFontRange(stbtt_pack_context * spc, const unsigned char * fontdata, int font_index, + float font_size, + int first_unicode_codepoint_in_range, int num_chars_in_range, stbtt_packedchar * chardata_for_range) +#endif +{ + stbtt_pack_range range; + range.first_unicode_codepoint_in_range = first_unicode_codepoint_in_range; + range.array_of_unicode_codepoints = NULL; + range.num_chars = num_chars_in_range; + range.chardata_for_range = chardata_for_range; + range.font_size = font_size; + return stbtt_PackFontRanges(spc, fontdata, font_index, &range, 1); +} + + +#ifdef STBTT_STREAM_TYPE +STBTT_DEF void stbtt_GetScaledFontVMetrics(STBTT_STREAM_TYPE fontdata, int index, float size, float * ascent, + float * descent, float * lineGap); +#else +STBTT_DEF void stbtt_GetScaledFontVMetrics(const unsigned char * fontdata, int index, float size, float * ascent, + float * descent, float * lineGap); +#endif + + +#ifdef STBTT_STREAM_TYPE +STBTT_DEF void stbtt_GetScaledFontVMetrics(STBTT_STREAM_TYPE fontdata, int index, float size, float * ascent, + float * descent, float * lineGap) +#else +STBTT_DEF void stbtt_GetScaledFontVMetrics(const unsigned char * fontdata, int index, float size, float * ascent, + float * descent, float * lineGap) +#endif +{ + int i_ascent, i_descent, i_lineGap; + float scale; + stbtt_fontinfo info; + stbtt_InitFont(&info, fontdata, stbtt_GetFontOffsetForIndex(fontdata, index)); + scale = size > 0 ? stbtt_ScaleForPixelHeight(&info, size) : stbtt_ScaleForMappingEmToPixels(&info, -size); + stbtt_GetFontVMetrics(&info, &i_ascent, &i_descent, &i_lineGap); + *ascent = (float)i_ascent * scale; + *descent = (float)i_descent * scale; + *lineGap = (float)i_lineGap * scale; +} + +STBTT_DEF void stbtt_GetPackedQuad(const stbtt_packedchar * chardata, int pw, int ph, int char_index, float * xpos, + float * ypos, stbtt_aligned_quad * q, int align_to_integer) +{ + float ipw = 1.0f / pw, iph = 1.0f / ph; + const stbtt_packedchar * b = chardata + char_index; + + if(align_to_integer) { + float x = (float)STBTT_ifloor((*xpos + b->xoff) + 0.5f); + float y = (float)STBTT_ifloor((*ypos + b->yoff) + 0.5f); + q->x0 = x; + q->y0 = y; + q->x1 = x + b->xoff2 - b->xoff; + q->y1 = y + b->yoff2 - b->yoff; + } + else { + q->x0 = *xpos + b->xoff; + q->y0 = *ypos + b->yoff; + q->x1 = *xpos + b->xoff2; + q->y1 = *ypos + b->yoff2; + } + + q->s0 = b->x0 * ipw; + q->t0 = b->y0 * iph; + q->s1 = b->x1 * ipw; + q->t1 = b->y1 * iph; + + *xpos += b->xadvance; +} + +////////////////////////////////////////////////////////////////////////////// +// +// sdf computation +// + +#define STBTT_min(a,b) ((a) < (b) ? (a) : (b)) +#define STBTT_max(a,b) ((a) < (b) ? (b) : (a)) + +static int stbtt__ray_intersect_bezier(float orig[2], float ray[2], float q0[2], float q1[2], float q2[2], + float hits[2][2]) +{ + float q0perp = q0[1] * ray[0] - q0[0] * ray[1]; + float q1perp = q1[1] * ray[0] - q1[0] * ray[1]; + float q2perp = q2[1] * ray[0] - q2[0] * ray[1]; + float roperp = orig[1] * ray[0] - orig[0] * ray[1]; + + float a = q0perp - 2 * q1perp + q2perp; + float b = q1perp - q0perp; + float c = q0perp - roperp; + + float s0 = 0., s1 = 0.; + int num_s = 0; + + if(a != 0.0f) { + float discr = b * b - a * c; + if(discr > 0.0f) { + float rcpna = -1 / a; + float d = (float)STBTT_sqrt(discr); + s0 = (b + d) * rcpna; + s1 = (b - d) * rcpna; + if(s0 >= 0.0f && s0 <= 1.0f) + num_s = 1; + if(d > 0.0f && s1 >= 0.0f && s1 <= 1.0f) { + if(num_s == 0) s0 = s1; + ++num_s; + } + } + } + else { + // 2*b*s + c = 0 + // s = -c / (2*b) + s0 = c / (-2 * b); + if(s0 >= 0.0f && s0 <= 1.0f) + num_s = 1; + } + + if(num_s == 0) + return 0; + else { + float rcp_len2 = 1 / (ray[0] * ray[0] + ray[1] * ray[1]); + float rayn_x = ray[0] * rcp_len2, rayn_y = ray[1] * rcp_len2; + + float q0d = q0[0] * rayn_x + q0[1] * rayn_y; + float q1d = q1[0] * rayn_x + q1[1] * rayn_y; + float q2d = q2[0] * rayn_x + q2[1] * rayn_y; + float rod = orig[0] * rayn_x + orig[1] * rayn_y; + + float q10d = q1d - q0d; + float q20d = q2d - q0d; + float q0rd = q0d - rod; + + hits[0][0] = q0rd + s0 * (2.0f - 2.0f * s0) * q10d + s0 * s0 * q20d; + hits[0][1] = a * s0 + b; + + if(num_s > 1) { + hits[1][0] = q0rd + s1 * (2.0f - 2.0f * s1) * q10d + s1 * s1 * q20d; + hits[1][1] = a * s1 + b; + return 2; + } + else { + return 1; + } + } +} + +static int equal(float * a, float * b) +{ + return (a[0] == b[0] && a[1] == b[1]); +} + +static int stbtt__compute_crossings_x(float x, float y, int nverts, stbtt_vertex * verts) +{ + int i; + float orig[2], ray[2] = { 1, 0 }; + float y_frac; + int winding = 0; + + // make sure y never passes through a vertex of the shape + y_frac = (float)STBTT_fmod(y, 1.0f); + if(y_frac < 0.01f) + y += 0.01f; + else if(y_frac > 0.99f) + y -= 0.01f; + + orig[0] = x; + orig[1] = y; + + // test a ray from (-infinity,y) to (x,y) + for(i = 0; i < nverts; ++i) { + if(verts[i].type == STBTT_vline) { + int x0 = (int)verts[i - 1].x, y0 = (int)verts[i - 1].y; + int x1 = (int)verts[i].x, y1 = (int)verts[i].y; + if(y > STBTT_min(y0, y1) && y < STBTT_max(y0, y1) && x > STBTT_min(x0, x1)) { + float x_inter = (y - y0) / (y1 - y0) * (x1 - x0) + x0; + if(x_inter < x) + winding += (y0 < y1) ? 1 : -1; + } + } + if(verts[i].type == STBTT_vcurve) { + int x0 = (int)verts[i - 1].x, y0 = (int)verts[i - 1].y; + int x1 = (int)verts[i].cx, y1 = (int)verts[i].cy; + int x2 = (int)verts[i].x, y2 = (int)verts[i].y; + int ax = STBTT_min(x0, STBTT_min(x1, x2)), ay = STBTT_min(y0, STBTT_min(y1, y2)); + int by = STBTT_max(y0, STBTT_max(y1, y2)); + if(y > ay && y < by && x > ax) { + float q0[2], q1[2], q2[2]; + float hits[2][2]; + q0[0] = (float)x0; + q0[1] = (float)y0; + q1[0] = (float)x1; + q1[1] = (float)y1; + q2[0] = (float)x2; + q2[1] = (float)y2; + if(equal(q0, q1) || equal(q1, q2)) { + x0 = (int)verts[i - 1].x; + y0 = (int)verts[i - 1].y; + x1 = (int)verts[i].x; + y1 = (int)verts[i].y; + if(y > STBTT_min(y0, y1) && y < STBTT_max(y0, y1) && x > STBTT_min(x0, x1)) { + float x_inter = (y - y0) / (y1 - y0) * (x1 - x0) + x0; + if(x_inter < x) + winding += (y0 < y1) ? 1 : -1; + } + } + else { + int num_hits = stbtt__ray_intersect_bezier(orig, ray, q0, q1, q2, hits); + if(num_hits >= 1) + if(hits[0][0] < 0) + winding += (hits[0][1] < 0 ? -1 : 1); + if(num_hits >= 2) + if(hits[1][0] < 0) + winding += (hits[1][1] < 0 ? -1 : 1); + } + } + } + } + return winding; +} + +static float stbtt__cuberoot(float x) +{ + if(x < 0) + return -(float)STBTT_pow(-x, 1.0f / 3.0f); + else + return (float)STBTT_pow(x, 1.0f / 3.0f); +} + +// x^3 + a*x^2 + b*x + c = 0 +static int stbtt__solve_cubic(float a, float b, float c, float * r) +{ + float s = -a / 3; + float p = b - a * a / 3; + float q = a * (2 * a * a - 9 * b) / 27 + c; + float p3 = p * p * p; + float d = q * q + 4 * p3 / 27; + if(d >= 0) { + float z = (float)STBTT_sqrt(d); + float u = (-q + z) / 2; + float v = (-q - z) / 2; + u = stbtt__cuberoot(u); + v = stbtt__cuberoot(v); + r[0] = s + u + v; + return 1; + } + else { + float u = (float)STBTT_sqrt(-p / 3); + float v = (float)STBTT_acos(-STBTT_sqrt(-27 / p3) * q / 2) / 3; // p3 must be negative, since d is negative + float m = (float)STBTT_cos(v); + float n = (float)STBTT_cos(v - 3.141592f / 2) * 1.732050808f; + r[0] = s + u * 2 * m; + r[1] = s - u * (m + n); + r[2] = s - u * (m - n); + + //STBTT_assert( STBTT_fabs(((r[0]+a)*r[0]+b)*r[0]+c) < 0.05f); // these asserts may not be safe at all scales, though they're in bezier t parameter units so maybe? + //STBTT_assert( STBTT_fabs(((r[1]+a)*r[1]+b)*r[1]+c) < 0.05f); + //STBTT_assert( STBTT_fabs(((r[2]+a)*r[2]+b)*r[2]+c) < 0.05f); + return 3; + } +} + +STBTT_DEF unsigned char * stbtt_GetGlyphSDF(const stbtt_fontinfo * info, float scale, int glyph, int padding, + unsigned char onedge_value, float pixel_dist_scale, int * width, int * height, int * xoff, int * yoff) +{ + float scale_x = scale, scale_y = scale; + int ix0, iy0, ix1, iy1; + int w, h; + unsigned char * data; + + if(scale == 0) return NULL; + + stbtt_GetGlyphBitmapBoxSubpixel(info, glyph, scale, scale, 0.0f, 0.0f, &ix0, &iy0, &ix1, &iy1); + + // if empty, return NULL + if(ix0 == ix1 || iy0 == iy1) + return NULL; + + ix0 -= padding; + iy0 -= padding; + ix1 += padding; + iy1 += padding; + + w = (ix1 - ix0); + h = (iy1 - iy0); + + if(width) *width = w; + if(height) *height = h; + if(xoff) *xoff = ix0; + if(yoff) *yoff = iy0; + + // invert for y-downwards bitmaps + scale_y = -scale_y; + + { + int x, y, i, j; + float * precompute; + stbtt_vertex * verts; + int num_verts = stbtt_GetGlyphShape(info, glyph, &verts); + data = (unsigned char *)STBTT_malloc(w * h, info->userdata); + precompute = (float *)STBTT_malloc(num_verts * sizeof(float), info->userdata); + + for(i = 0, j = num_verts - 1; i < num_verts; j = i++) { + if(verts[i].type == STBTT_vline) { + float x0 = verts[i].x * scale_x, y0 = verts[i].y * scale_y; + float x1 = verts[j].x * scale_x, y1 = verts[j].y * scale_y; + float dist = (float)STBTT_sqrt((x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0)); + precompute[i] = (dist == 0) ? 0.0f : 1.0f / dist; + } + else if(verts[i].type == STBTT_vcurve) { + float x2 = verts[j].x * scale_x, y2 = verts[j].y * scale_y; + float x1 = verts[i].cx * scale_x, y1 = verts[i].cy * scale_y; + float x0 = verts[i].x * scale_x, y0 = verts[i].y * scale_y; + float bx = x0 - 2 * x1 + x2, by = y0 - 2 * y1 + y2; + float len2 = bx * bx + by * by; + if(len2 != 0.0f) + precompute[i] = 1.0f / (bx * bx + by * by); + else + precompute[i] = 0.0f; + } + else + precompute[i] = 0.0f; + } + + for(y = iy0; y < iy1; ++y) { + for(x = ix0; x < ix1; ++x) { + float val; + float min_dist = 999999.0f; + float sx = (float)x + 0.5f; + float sy = (float)y + 0.5f; + float x_gspace = (sx / scale_x); + float y_gspace = (sy / scale_y); + + int winding = stbtt__compute_crossings_x(x_gspace, y_gspace, num_verts, + verts); // @OPTIMIZE: this could just be a rasterization, but needs to be line vs. non-tesselated curves so a new path + + for(i = 0; i < num_verts; ++i) { + float x0 = verts[i].x * scale_x, y0 = verts[i].y * scale_y; + + if(verts[i].type == STBTT_vline && precompute[i] != 0.0f) { + float x1 = verts[i - 1].x * scale_x, y1 = verts[i - 1].y * scale_y; + + float dist, dist2 = (x0 - sx) * (x0 - sx) + (y0 - sy) * (y0 - sy); + if(dist2 < min_dist * min_dist) + min_dist = (float)STBTT_sqrt(dist2); + + // coarse culling against bbox + //if (sx > STBTT_min(x0,x1)-min_dist && sx < STBTT_max(x0,x1)+min_dist && + // sy > STBTT_min(y0,y1)-min_dist && sy < STBTT_max(y0,y1)+min_dist) + dist = (float)STBTT_fabs((x1 - x0) * (y0 - sy) - (y1 - y0) * (x0 - sx)) * precompute[i]; + STBTT_assert(i != 0); + if(dist < min_dist) { + // check position along line + // x' = x0 + t*(x1-x0), y' = y0 + t*(y1-y0) + // minimize (x'-sx)*(x'-sx)+(y'-sy)*(y'-sy) + float dx = x1 - x0, dy = y1 - y0; + float px = x0 - sx, py = y0 - sy; + // minimize (px+t*dx)^2 + (py+t*dy)^2 = px*px + 2*px*dx*t + t^2*dx*dx + py*py + 2*py*dy*t + t^2*dy*dy + // derivative: 2*px*dx + 2*py*dy + (2*dx*dx+2*dy*dy)*t, set to 0 and solve + float t = -(px * dx + py * dy) / (dx * dx + dy * dy); + if(t >= 0.0f && t <= 1.0f) + min_dist = dist; + } + } + else if(verts[i].type == STBTT_vcurve) { + float x2 = verts[i - 1].x * scale_x, y2 = verts[i - 1].y * scale_y; + float x1 = verts[i].cx * scale_x, y1 = verts[i].cy * scale_y; + float box_x0 = STBTT_min(STBTT_min(x0, x1), x2); + float box_y0 = STBTT_min(STBTT_min(y0, y1), y2); + float box_x1 = STBTT_max(STBTT_max(x0, x1), x2); + float box_y1 = STBTT_max(STBTT_max(y0, y1), y2); + // coarse culling against bbox to avoid computing cubic unnecessarily + if(sx > box_x0 - min_dist && sx < box_x1 + min_dist && sy > box_y0 - min_dist && sy < box_y1 + min_dist) { + int num = 0; + float ax = x1 - x0, ay = y1 - y0; + float bx = x0 - 2 * x1 + x2, by = y0 - 2 * y1 + y2; + float mx = x0 - sx, my = y0 - sy; + float res[3] = { 0.f, 0.f, 0.f }; + float px, py, t, it, dist2; + float a_inv = precompute[i]; + if(a_inv == 0.0f) { // if a_inv is 0, it's 2nd degree so use quadratic formula + float a = 3 * (ax * bx + ay * by); + float b = 2 * (ax * ax + ay * ay) + (mx * bx + my * by); + float c = mx * ax + my * ay; + if(a == 0.0f) { // if a is 0, it's linear + if(b != 0.0f) { + res[num++] = -c / b; + } + } + else { + float discriminant = b * b - 4 * a * c; + if(discriminant < 0) + num = 0; + else { + float root = (float)STBTT_sqrt(discriminant); + res[0] = (-b - root) / (2 * a); + res[1] = (-b + root) / (2 * a); + num = 2; // don't bother distinguishing 1-solution case, as code below will still work + } + } + } + else { + float b = 3 * (ax * bx + ay * by) * a_inv; // could precompute this as it doesn't depend on sample point + float c = (2 * (ax * ax + ay * ay) + (mx * bx + my * by)) * a_inv; + float d = (mx * ax + my * ay) * a_inv; + num = stbtt__solve_cubic(b, c, d, res); + } + dist2 = (x0 - sx) * (x0 - sx) + (y0 - sy) * (y0 - sy); + if(dist2 < min_dist * min_dist) + min_dist = (float)STBTT_sqrt(dist2); + + if(num >= 1 && res[0] >= 0.0f && res[0] <= 1.0f) { + t = res[0], it = 1.0f - t; + px = it * it * x0 + 2 * t * it * x1 + t * t * x2; + py = it * it * y0 + 2 * t * it * y1 + t * t * y2; + dist2 = (px - sx) * (px - sx) + (py - sy) * (py - sy); + if(dist2 < min_dist * min_dist) + min_dist = (float)STBTT_sqrt(dist2); + } + if(num >= 2 && res[1] >= 0.0f && res[1] <= 1.0f) { + t = res[1], it = 1.0f - t; + px = it * it * x0 + 2 * t * it * x1 + t * t * x2; + py = it * it * y0 + 2 * t * it * y1 + t * t * y2; + dist2 = (px - sx) * (px - sx) + (py - sy) * (py - sy); + if(dist2 < min_dist * min_dist) + min_dist = (float)STBTT_sqrt(dist2); + } + if(num >= 3 && res[2] >= 0.0f && res[2] <= 1.0f) { + t = res[2], it = 1.0f - t; + px = it * it * x0 + 2 * t * it * x1 + t * t * x2; + py = it * it * y0 + 2 * t * it * y1 + t * t * y2; + dist2 = (px - sx) * (px - sx) + (py - sy) * (py - sy); + if(dist2 < min_dist * min_dist) + min_dist = (float)STBTT_sqrt(dist2); + } + } + } + } + if(winding == 0) + min_dist = -min_dist; // if outside the shape, value is negative + val = onedge_value + pixel_dist_scale * min_dist; + if(val < 0) + val = 0; + else if(val > 255) + val = 255; + data[(y - iy0) * w + (x - ix0)] = (unsigned char)val; + } + } + STBTT_free(precompute, info->userdata); + STBTT_free(verts, info->userdata); + } + return data; +} + +STBTT_DEF unsigned char * stbtt_GetCodepointSDF(const stbtt_fontinfo * info, float scale, int codepoint, int padding, + unsigned char onedge_value, float pixel_dist_scale, int * width, int * height, int * xoff, int * yoff) +{ + return stbtt_GetGlyphSDF(info, scale, stbtt_FindGlyphIndex(info, codepoint), padding, onedge_value, pixel_dist_scale, + width, height, xoff, yoff); +} + +STBTT_DEF void stbtt_FreeSDF(unsigned char * bitmap, void * userdata) +{ + STBTT_free(bitmap, userdata); +} + +////////////////////////////////////////////////////////////////////////////// +// +// font name matching -- recommended not to use this +// + +// check if a utf8 string contains a prefix which is the utf16 string; if so return length of matching utf8 string +#ifdef STBTT_STREAM_TYPE +static stbtt_int32 stbtt__CompareUTF8toUTF16_bigendian_prefix(stbtt_uint8 * s1, stbtt_int32 len1, STBTT_STREAM_TYPE s2, + stbtt_uint32 s2offs, stbtt_int32 len2) +#else +static stbtt_int32 stbtt__CompareUTF8toUTF16_bigendian_prefix(stbtt_uint8 * s1, stbtt_int32 len1, stbtt_uint8 * s2, + stbtt_uint32 s2offs, stbtt_int32 len2) +#endif +{ + stbtt_int32 i = 0; + + // convert utf16 to utf8 and compare the results while converting + while(len2) { + stbtt_uint16 ch = ttUSHORT(s2, s2offs); + if(ch < 0x80) { + if(i >= len1) return -1; + if(s1[i++] != ch) return -1; + } + else if(ch < 0x800) { + if(i + 1 >= len1) return -1; + if(s1[i++] != 0xc0 + (ch >> 6)) return -1; + if(s1[i++] != 0x80 + (ch & 0x3f)) return -1; + } + else if(ch >= 0xd800 && ch < 0xdc00) { + stbtt_uint32 c; + stbtt_uint16 ch2 = ttUSHORT(s2, s2offs + 2); + if(i + 3 >= len1) return -1; + c = ((ch - 0xd800) << 10) + (ch2 - 0xdc00) + 0x10000; + if(s1[i++] != 0xf0 + (c >> 18)) return -1; + if(s1[i++] != 0x80 + ((c >> 12) & 0x3f)) return -1; + if(s1[i++] != 0x80 + ((c >> 6) & 0x3f)) return -1; + if(s1[i++] != 0x80 + ((c) & 0x3f)) return -1; + s2offs += 2; // plus another 2 below + len2 -= 2; + } + else if(ch >= 0xdc00 && ch < 0xe000) { + return -1; + } + else { + if(i + 2 >= len1) return -1; + if(s1[i++] != 0xe0 + (ch >> 12)) return -1; + if(s1[i++] != 0x80 + ((ch >> 6) & 0x3f)) return -1; + if(s1[i++] != 0x80 + ((ch) & 0x3f)) return -1; + } + s2offs += 2; + len2 -= 2; + } + return i; +} +#ifdef STBTT_STREAM_TYPE +static int stbtt_CompareUTF8toUTF16_bigendian_internal(char * s1, int len1, STBTT_STREAM_TYPE s2, stbtt_uint32 s2offs, + int len2) +{ + return len1 == stbtt__CompareUTF8toUTF16_bigendian_prefix((stbtt_uint8 *)s1, len1, s2, s2offs, len2); +} +#else +static int stbtt_CompareUTF8toUTF16_bigendian_internal(char * s1, int len1, char * s2, stbtt_uint32 s2offs, int len2) +{ + return len1 == stbtt__CompareUTF8toUTF16_bigendian_prefix((stbtt_uint8 *)s1, len1, (stbtt_uint8 *)s2, s2offs, len2); +} +#endif +// returns results in whatever encoding you request... but note that 2-byte encodings +// will be BIG-ENDIAN... use stbtt_CompareUTF8toUTF16_bigendian() to compare +STBTT_DEF stbtt_uint32 stbtt_GetFontNameString(const stbtt_fontinfo * font, int * length, int platformID, + int encodingID, int languageID, int nameID) +{ + stbtt_int32 i, count, stringOffset; + stbtt_uint32 offset = font->fontstart; + stbtt_uint32 nm = stbtt__find_table(font->data, offset, "name"); + if(!nm) return 0; + + count = ttUSHORT(font->data, nm + 2); + stringOffset = nm + ttUSHORT(font->data, nm + 4); + for(i = 0; i < count; ++i) { + stbtt_uint32 loc = nm + 6 + 12 * i; + if(platformID == ttUSHORT(font->data, loc + 0) && encodingID == ttUSHORT(font->data, loc + 2) + && languageID == ttUSHORT(font->data, loc + 4) && nameID == ttUSHORT(font->data, loc + 6)) { + *length = ttUSHORT(font->data, loc + 8); + return stringOffset + ttUSHORT(font->data, loc + 10); + } + } + return 0; +} +#ifdef STBTT_STREAM_TYPE +static int stbtt__matchpair(STBTT_STREAM_TYPE fc, stbtt_uint32 nm, stbtt_uint8 * name, stbtt_int32 nlen, + stbtt_int32 target_id, stbtt_int32 next_id) +#else +static int stbtt__matchpair(stbtt_uint8 * fc, stbtt_uint32 nm, stbtt_uint8 * name, stbtt_int32 nlen, + stbtt_int32 target_id, stbtt_int32 next_id) +#endif +{ + stbtt_int32 i; + stbtt_int32 count = ttUSHORT(fc, nm + 2); + stbtt_int32 stringOffset = nm + ttUSHORT(fc, nm + 4); + + for(i = 0; i < count; ++i) { + stbtt_uint32 loc = nm + 6 + 12 * i; + stbtt_int32 id = ttUSHORT(fc, loc + 6); + if(id == target_id) { + // find the encoding + stbtt_int32 platform = ttUSHORT(fc, loc + 0), encoding = ttUSHORT(fc, loc + 2), language = ttUSHORT(fc, loc + 4); + + // is this a Unicode encoding? + if(platform == 0 || (platform == 3 && encoding == 1) || (platform == 3 && encoding == 10)) { + stbtt_int32 slen = ttUSHORT(fc, loc + 8); + stbtt_int32 off = ttUSHORT(fc, loc + 10); + + // check if there's a prefix match + stbtt_int32 matchlen = stbtt__CompareUTF8toUTF16_bigendian_prefix(name, nlen, fc, stringOffset + off, slen); + if(matchlen >= 0) { + // check for target_id+1 immediately following, with same encoding & language + if(i + 1 < count && ttUSHORT(fc, loc + 12 + 6) == next_id && ttUSHORT(fc, loc + 12) == platform && + ttUSHORT(fc, loc + 12 + 2) == encoding && ttUSHORT(fc, loc + 12 + 4) == language) { + slen = ttUSHORT(fc, loc + 12 + 8); + off = ttUSHORT(fc, loc + 12 + 10); + if(slen == 0) { + if(matchlen == nlen) + return 1; + } + else if(matchlen < nlen && name[matchlen] == ' ') { + ++matchlen; +#ifdef STBTT_STREAM_TYPE + if(stbtt_CompareUTF8toUTF16_bigendian_internal((char *)(name + matchlen), nlen - matchlen, fc, stringOffset + off, + slen)) +#else + if(stbtt_CompareUTF8toUTF16_bigendian_internal((char *)(name + matchlen), nlen - matchlen, (char *)fc, + stringOffset + off, slen)) +#endif + return 1; + } + } + else { + // if nothing immediately following + if(matchlen == nlen) + return 1; + } + } + } + + // @TODO handle other encodings + } + } + return 0; +} +#ifdef STBTT_STREAM_TYPE + static int stbtt__matches(STBTT_STREAM_TYPE fc, stbtt_uint32 offset, stbtt_uint8 * name, stbtt_int32 flags) +#else + static int stbtt__matches(stbtt_uint8 * fc, stbtt_uint32 offset, stbtt_uint8 * name, stbtt_int32 flags) +#endif + +{ + stbtt_int32 nlen = (stbtt_int32)STBTT_strlen((char *)name); + stbtt_uint32 nm, hd; + if(!stbtt__isfont(fc, offset)) return 0; + + // check italics/bold/underline flags in macStyle... + if(flags) { + hd = stbtt__find_table(fc, offset, "head"); + if((ttUSHORT(fc, hd + 44) & 7) != (flags & 7)) return 0; + } + + nm = stbtt__find_table(fc, offset, "name"); + if(!nm) return 0; + + if(flags) { + if(name == NULL) return 1; + // if we checked the macStyle flags, then just check the family and ignore the subfamily + if(stbtt__matchpair(fc, nm, name, nlen, 16, -1)) return 1; + if(stbtt__matchpair(fc, nm, name, nlen, 1, -1)) return 1; + if(stbtt__matchpair(fc, nm, name, nlen, 3, -1)) return 1; + } + else { + if(name == NULL) return 1; + if(stbtt__matchpair(fc, nm, name, nlen, 16, 17)) return 1; + if(stbtt__matchpair(fc, nm, name, nlen, 1, 2)) return 1; + if(stbtt__matchpair(fc, nm, name, nlen, 3, -1)) return 1; + } + + return 0; +} +#ifdef STBTT_STREAM_TYPE + static int stbtt_FindMatchingFont_internal(STBTT_STREAM_TYPE font_collection, char * name_utf8, stbtt_int32 flags) +#else + static int stbtt_FindMatchingFont_internal(unsigned char * font_collection, char * name_utf8, stbtt_int32 flags) +#endif +{ + stbtt_int32 i; + for(i = 0;; ++i) { + stbtt_int32 off = stbtt_GetFontOffsetForIndex(font_collection, i); + if(off < 0) return off; +#ifdef STBTT_STREAM_TYPE + if(stbtt__matches(font_collection, off, (stbtt_uint8 *)name_utf8, flags)) +#else + if(stbtt__matches((stbtt_uint8 *)font_collection, off, (stbtt_uint8 *)name_utf8, flags)) +#endif + return off; + } +} + +#if defined(__GNUC__) || defined(__clang__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wcast-qual" +#endif + + +#ifdef STBTT_STREAM_TYPE +STBTT_DEF int stbtt_BakeFontBitmap(STBTT_STREAM_TYPE data, int offset, + float pixel_height, unsigned char * pixels, int pw, int ph, + int first_char, int num_chars, stbtt_bakedchar * chardata); +#else +STBTT_DEF int stbtt_BakeFontBitmap(const unsigned char * data, int offset, + float pixel_height, unsigned char * pixels, int pw, int ph, + int first_char, int num_chars, stbtt_bakedchar * chardata); +#endif + +#ifdef STBTT_STREAM_TYPE +STBTT_DEF int stbtt_BakeFontBitmap(STBTT_STREAM_TYPE data, int offset, + float pixel_height, unsigned char * pixels, int pw, int ph, + int first_char, int num_chars, stbtt_bakedchar * chardata) +#else +STBTT_DEF int stbtt_BakeFontBitmap(const unsigned char * data, int offset, + float pixel_height, unsigned char * pixels, int pw, int ph, + int first_char, int num_chars, stbtt_bakedchar * chardata) +#endif +{ +#ifdef STBTT_STREAM_TYPE + return stbtt_BakeFontBitmap_internal(data, offset, pixel_height, pixels, pw, ph, first_char, num_chars, chardata); +#else + return stbtt_BakeFontBitmap_internal((unsigned char *)data, offset, pixel_height, pixels, pw, ph, first_char, num_chars, + chardata); +#endif +} +#ifdef STBTT_STREAM_TYPE +STBTT_DEF int stbtt_GetFontOffsetForIndex(STBTT_STREAM_TYPE data, int index) +{ + return stbtt_GetFontOffsetForIndex_internal(data, index); +} +#else +STBTT_DEF int stbtt_GetFontOffsetForIndex(const unsigned char * data, int index) +{ + return stbtt_GetFontOffsetForIndex_internal((unsigned char *)data, index); +} +#endif +#ifdef STBTT_STREAM_TYPE +STBTT_DEF int stbtt_GetNumberOfFonts(STBTT_STREAM_TYPE data) +{ + return stbtt_GetNumberOfFonts_internal(data); +} +#else +STBTT_DEF int stbtt_GetNumberOfFonts(const unsigned char * data) +{ + return stbtt_GetNumberOfFonts_internal((unsigned char *)data); +} +#endif +#ifdef STBTT_STREAM_TYPE +STBTT_DEF int stbtt_InitFont(stbtt_fontinfo * info, STBTT_STREAM_TYPE data, int offset) +{ + return stbtt_InitFont_internal(info, data, offset); +} +#else +STBTT_DEF int stbtt_InitFont(stbtt_fontinfo * info, const unsigned char * data, int offset) +{ + return stbtt_InitFont_internal(info, (unsigned char *)data, offset); +} +#endif +#ifdef STBTT_STREAM_TYPE +STBTT_DEF int stbtt_FindMatchingFont(STBTT_STREAM_TYPE fontdata, const char * name, int flags) +{ + return stbtt_FindMatchingFont_internal(fontdata, (char *)name, flags); +} +#else +STBTT_DEF int stbtt_FindMatchingFont(const unsigned char * fontdata, const char * name, int flags) +{ + return stbtt_FindMatchingFont_internal((unsigned char *)fontdata, (char *)name, flags); +} +#endif +#ifdef STBTT_STREAM_TYPE +STBTT_DEF int stbtt_CompareUTF8toUTF16_bigendian(const char * s1, int len1, STBTT_STREAM_TYPE s2, stbtt_uint32 s2offs, + int len2) +{ + return stbtt_CompareUTF8toUTF16_bigendian_internal((char *)s1, len1, s2, s2offs, len2); +} +#else +STBTT_DEF int stbtt_CompareUTF8toUTF16_bigendian(const char * s1, int len1, const char * s2, stbtt_uint32 s2offs, + int len2) +{ + return stbtt_CompareUTF8toUTF16_bigendian_internal((char *)s1, len1, (char *)s2, s2offs, len2); +} +#endif + +#if defined(__GNUC__) || defined(__clang__) + #pragma GCC diagnostic pop + #pragma GCC diagnostic pop +#endif + +#endif // STB_TRUETYPE_IMPLEMENTATION + + +// FULL VERSION HISTORY +// +// 1.25 (2021-07-11) many fixes +// 1.24 (2020-02-05) fix warning +// 1.23 (2020-02-02) query SVG data for glyphs; query whole kerning table (but only kern not GPOS) +// 1.22 (2019-08-11) minimize missing-glyph duplication; fix kerning if both 'GPOS' and 'kern' are defined +// 1.21 (2019-02-25) fix warning +// 1.20 (2019-02-07) PackFontRange skips missing codepoints; GetScaleFontVMetrics() +// 1.19 (2018-02-11) OpenType GPOS kerning (horizontal only), STBTT_fmod +// 1.18 (2018-01-29) add missing function +// 1.17 (2017-07-23) make more arguments const; doc fix +// 1.16 (2017-07-12) SDF support +// 1.15 (2017-03-03) make more arguments const +// 1.14 (2017-01-16) num-fonts-in-TTC function +// 1.13 (2017-01-02) support OpenType fonts, certain Apple fonts +// 1.12 (2016-10-25) suppress warnings about casting away const with -Wcast-qual +// 1.11 (2016-04-02) fix unused-variable warning +// 1.10 (2016-04-02) allow user-defined fabs() replacement +// fix memory leak if fontsize=0.0 +// fix warning from duplicate typedef +// 1.09 (2016-01-16) warning fix; avoid crash on outofmem; use alloc userdata for PackFontRanges +// 1.08 (2015-09-13) document stbtt_Rasterize(); fixes for vertical & horizontal edges +// 1.07 (2015-08-01) allow PackFontRanges to accept arrays of sparse codepoints; +// allow PackFontRanges to pack and render in separate phases; +// fix stbtt_GetFontOFfsetForIndex (never worked for non-0 input?); +// fixed an assert() bug in the new rasterizer +// replace assert() with STBTT_assert() in new rasterizer +// 1.06 (2015-07-14) performance improvements (~35% faster on x86 and x64 on test machine) +// also more precise AA rasterizer, except if shapes overlap +// remove need for STBTT_sort +// 1.05 (2015-04-15) fix misplaced definitions for STBTT_STATIC +// 1.04 (2015-04-15) typo in example +// 1.03 (2015-04-12) STBTT_STATIC, fix memory leak in new packing, various fixes +// 1.02 (2014-12-10) fix various warnings & compile issues w/ stb_rect_pack, C++ +// 1.01 (2014-12-08) fix subpixel position when oversampling to exactly match +// non-oversampled; STBTT_POINT_SIZE for packed case only +// 1.00 (2014-12-06) add new PackBegin etc. API, w/ support for oversampling +// 0.99 (2014-09-18) fix multiple bugs with subpixel rendering (ryg) +// 0.9 (2014-08-07) support certain mac/iOS fonts without an MS platformID +// 0.8b (2014-07-07) fix a warning +// 0.8 (2014-05-25) fix a few more warnings +// 0.7 (2013-09-25) bugfix: subpixel glyph bug fixed in 0.5 had come back +// 0.6c (2012-07-24) improve documentation +// 0.6b (2012-07-20) fix a few more warnings +// 0.6 (2012-07-17) fix warnings; added stbtt_ScaleForMappingEmToPixels, +// stbtt_GetFontBoundingBox, stbtt_IsGlyphEmpty +// 0.5 (2011-12-09) bugfixes: +// subpixel glyph renderer computed wrong bounding box +// first vertex of shape can be off-curve (FreeSans) +// 0.4b (2011-12-03) fixed an error in the font baking example +// 0.4 (2011-12-01) kerning, subpixel rendering (tor) +// bugfixes for: +// codepoint-to-glyph conversion using table fmt=12 +// codepoint-to-glyph conversion using table fmt=4 +// stbtt_GetBakedQuad with non-square texture (Zer) +// updated Hello World! sample to use kerning and subpixel +// fixed some warnings +// 0.3 (2009-06-24) cmap fmt=12, compound shapes (MM) +// userdata, malloc-from-userdata, non-zero fill (stb) +// 0.2 (2009-03-11) Fix unsigned/signed char warnings +// 0.1 (2009-03-09) First public release +// + +/* +------------------------------------------------------------------------------ +This software is available under 2 licenses -- choose whichever you prefer. +------------------------------------------------------------------------------ +ALTERNATIVE A - MIT License +Copyright (c) 2017 Sean Barrett +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +------------------------------------------------------------------------------ +ALTERNATIVE B - Public Domain (www.unlicense.org) +This is free and unencumbered software released into the public domain. +Anyone is free to copy, modify, publish, use, compile, sell, or distribute this +software, either in source code form or as a compiled binary, for any purpose, +commercial or non-commercial, and by any means. +In jurisdictions that recognize copyright laws, the author or authors of this +software dedicate any and all copyright interest in the software to the public +domain. We make this dedication for the benefit of the public at large and to +the detriment of our heirs and successors. We intend this dedication to be an +overt act of relinquishment in perpetuity of all present and future rights to +this software under copyright law. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +------------------------------------------------------------------------------ +*/ diff --git a/lib/libesp32_lvgl/lvgl/src/extra/lv_extra.c b/lib/libesp32_lvgl/lvgl/src/extra/lv_extra.c index 0b5000240..380833725 100644 --- a/lib/libesp32_lvgl/lvgl/src/extra/lv_extra.c +++ b/lib/libesp32_lvgl/lvgl/src/extra/lv_extra.c @@ -50,6 +50,10 @@ void lv_extra_init(void) lv_fs_fatfs_init(); #endif +#if LV_USE_FS_LITTLEFS != '\0' + lv_fs_littlefs_init(); +#endif + #if LV_USE_FS_STDIO != '\0' lv_fs_stdio_init(); #endif diff --git a/lib/libesp32_lvgl/lvgl/src/extra/others/ime/lv_ime_pinyin.c b/lib/libesp32_lvgl/lvgl/src/extra/others/ime/lv_ime_pinyin.c index b1661e4f7..9834154fb 100644 --- a/lib/libesp32_lvgl/lvgl/src/extra/others/ime/lv_ime_pinyin.c +++ b/lib/libesp32_lvgl/lvgl/src/extra/others/ime/lv_ime_pinyin.c @@ -562,6 +562,8 @@ static void lv_ime_pinyin_constructor(const lv_obj_class_t * class_p, lv_obj_t * lv_memset_00(pinyin_ime->py_num, sizeof(pinyin_ime->py_num)); lv_memset_00(pinyin_ime->py_pos, sizeof(pinyin_ime->py_pos)); + lv_obj_add_flag(obj, LV_OBJ_FLAG_HIDDEN); + lv_obj_set_size(obj, LV_PCT(100), LV_PCT(55)); lv_obj_align(obj, LV_ALIGN_BOTTOM_MID, 0, 0); @@ -576,6 +578,7 @@ static void lv_ime_pinyin_constructor(const lv_obj_class_t * class_p, lv_obj_t * lv_obj_add_flag(pinyin_ime->cand_panel, LV_OBJ_FLAG_HIDDEN); lv_btnmatrix_set_one_checked(pinyin_ime->cand_panel, true); + lv_obj_clear_flag(pinyin_ime->cand_panel, LV_OBJ_FLAG_CLICK_FOCUSABLE); /* Set cand_panel style*/ // Default style diff --git a/lib/libesp32_lvgl/lvgl/src/extra/widgets/keyboard/lv_keyboard.c b/lib/libesp32_lvgl/lvgl/src/extra/widgets/keyboard/lv_keyboard.c index 8e052e33a..cbb5e1c4f 100644 --- a/lib/libesp32_lvgl/lvgl/src/extra/widgets/keyboard/lv_keyboard.c +++ b/lib/libesp32_lvgl/lvgl/src/extra/widgets/keyboard/lv_keyboard.c @@ -73,7 +73,7 @@ static const lv_btnmatrix_ctrl_t default_kb_ctrl_uc_map[] = { }; static const char * const default_kb_map_spec[] = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "0", LV_SYMBOL_BACKSPACE, "\n", - "abc", "+", "-", "/", "*", "=", "%", "!", "?", "#", "<", ">", "\n", + "abc", "+", "&", "/", "*", "=", "%", "!", "?", "#", "<", ">", "\n", "\\", "@", "$", "(", ")", "{", "}", "[", "]", ";", "\"", "'", "\n", LV_SYMBOL_KEYBOARD, LV_SYMBOL_LEFT, " ", LV_SYMBOL_RIGHT, LV_SYMBOL_OK, "" }; diff --git a/lib/libesp32_lvgl/lvgl/src/extra/widgets/meter/lv_meter.c b/lib/libesp32_lvgl/lvgl/src/extra/widgets/meter/lv_meter.c index 89e9e5433..f1ea9d507 100644 --- a/lib/libesp32_lvgl/lvgl/src/extra/widgets/meter/lv_meter.c +++ b/lib/libesp32_lvgl/lvgl/src/extra/widgets/meter/lv_meter.c @@ -360,6 +360,8 @@ static void draw_arcs(lv_obj_t * obj, lv_draw_ctx_t * draw_ctx, const lv_area_t int32_t end_angle = lv_map(indic->end_value, scale->min, scale->max, scale->rotation, scale->rotation + scale->angle_range); + arc_dsc.start_angle = start_angle; + arc_dsc.end_angle = end_angle; part_draw_dsc.radius = r_out + indic->type_data.arc.r_mod; part_draw_dsc.sub_part_ptr = indic; part_draw_dsc.p1 = &scale_center; @@ -511,7 +513,8 @@ static void draw_ticks_and_labels(lv_obj_t * obj, lv_draw_ctx_t * draw_ctx, cons lv_event_send(obj, LV_EVENT_DRAW_PART_BEGIN, &part_draw_dsc); lv_point_t label_size; - lv_txt_get_size(&label_size, part_draw_dsc.text, label_dsc.font, label_dsc.letter_space, label_dsc.line_space, + lv_txt_get_size(&label_size, part_draw_dsc.text, label_dsc_tmp.font, label_dsc_tmp.letter_space, + label_dsc_tmp.line_space, LV_COORD_MAX, LV_TEXT_FLAG_NONE); lv_area_t label_cord; @@ -569,6 +572,7 @@ static void draw_needles(lv_obj_t * obj, lv_draw_ctx_t * draw_ctx, const lv_area lv_obj_draw_dsc_init(&part_draw_dsc, draw_ctx); part_draw_dsc.class_p = MY_CLASS; part_draw_dsc.p1 = &scale_center; + part_draw_dsc.part = LV_PART_INDICATOR; lv_meter_indicator_t * indic; _LV_LL_READ_BACK(&meter->indicator_ll, indic) { @@ -585,12 +589,12 @@ static void draw_needles(lv_obj_t * obj, lv_draw_ctx_t * draw_ctx, const lv_area line_dsc.width = indic->type_data.needle_line.width; line_dsc.opa = indic->opa > LV_OPA_MAX ? opa_main : (opa_main * indic->opa) >> 8; - part_draw_dsc.id = LV_METER_DRAW_PART_NEEDLE_LINE; + part_draw_dsc.type = LV_METER_DRAW_PART_NEEDLE_LINE; part_draw_dsc.line_dsc = &line_dsc; part_draw_dsc.p2 = &p_end; - + part_draw_dsc.p1 = &scale_center; lv_event_send(obj, LV_EVENT_DRAW_PART_BEGIN, &part_draw_dsc); - lv_draw_line(draw_ctx, &line_dsc, &scale_center, &p_end); + lv_draw_line(draw_ctx, &line_dsc, part_draw_dsc.p1, &p_end); lv_event_send(obj, LV_EVENT_DRAW_PART_END, &part_draw_dsc); } else if(indic->type == LV_METER_INDICATOR_TYPE_NEEDLE_IMG) { @@ -612,7 +616,7 @@ static void draw_needles(lv_obj_t * obj, lv_draw_ctx_t * draw_ctx, const lv_area if(angle > 3600) angle -= 3600; img_dsc.angle = angle; - part_draw_dsc.id = LV_METER_DRAW_PART_NEEDLE_IMG; + part_draw_dsc.type = LV_METER_DRAW_PART_NEEDLE_IMG; part_draw_dsc.img_dsc = &img_dsc; lv_event_send(obj, LV_EVENT_DRAW_PART_BEGIN, &part_draw_dsc); diff --git a/lib/libesp32_lvgl/lvgl/src/extra/widgets/meter/lv_meter.h b/lib/libesp32_lvgl/lvgl/src/extra/widgets/meter/lv_meter.h index 24c1dae0f..330bc2a95 100644 --- a/lib/libesp32_lvgl/lvgl/src/extra/widgets/meter/lv_meter.h +++ b/lib/libesp32_lvgl/lvgl/src/extra/widgets/meter/lv_meter.h @@ -42,7 +42,6 @@ typedef struct { uint16_t tick_major_width; int16_t label_gap; - int16_t label_color; int32_t min; int32_t max; diff --git a/lib/libesp32_lvgl/lvgl/src/lv_conf_internal.h b/lib/libesp32_lvgl/lvgl/src/lv_conf_internal.h index a625ba960..0c297081c 100644 --- a/lib/libesp32_lvgl/lvgl/src/lv_conf_internal.h +++ b/lib/libesp32_lvgl/lvgl/src/lv_conf_internal.h @@ -2099,6 +2099,31 @@ #endif #endif +/*API for LittleFS (library needs to be added separately). Uses lfs_file_open, lfs_file_read, etc*/ +#ifndef LV_USE_FS_LITTLEFS + #ifdef CONFIG_LV_USE_FS_LITTLEFS + #define LV_USE_FS_LITTLEFS CONFIG_LV_USE_FS_LITTLEFS + #else + #define LV_USE_FS_LITTLEFS 0 + #endif +#endif +#if LV_USE_FS_LITTLEFS + #ifndef LV_FS_LITTLEFS_LETTER + #ifdef CONFIG_LV_FS_LITTLEFS_LETTER + #define LV_FS_LITTLEFS_LETTER CONFIG_LV_FS_LITTLEFS_LETTER + #else + #define LV_FS_LITTLEFS_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/ + #endif + #endif + #ifndef LV_FS_LITTLEFS_CACHE_SIZE + #ifdef CONFIG_LV_FS_LITTLEFS_CACHE_SIZE + #define LV_FS_LITTLEFS_CACHE_SIZE CONFIG_LV_FS_LITTLEFS_CACHE_SIZE + #else + #define LV_FS_LITTLEFS_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/ + #endif + #endif +#endif + /*PNG decoder library*/ #ifndef LV_USE_PNG #ifdef CONFIG_LV_USE_PNG @@ -2192,6 +2217,25 @@ #endif #endif +/*Tiny TTF library*/ +#ifndef LV_USE_TINY_TTF + #ifdef CONFIG_LV_USE_TINY_TTF + #define LV_USE_TINY_TTF CONFIG_LV_USE_TINY_TTF + #else + #define LV_USE_TINY_TTF 0 + #endif +#endif +#if LV_USE_TINY_TTF + /*Load TTF data from files*/ + #ifndef LV_TINY_TTF_FILE_SUPPORT + #ifdef CONFIG_LV_TINY_TTF_FILE_SUPPORT + #define LV_TINY_TTF_FILE_SUPPORT CONFIG_LV_TINY_TTF_FILE_SUPPORT + #else + #define LV_TINY_TTF_FILE_SUPPORT 0 + #endif + #endif +#endif + /*Rlottie library*/ #ifndef LV_USE_RLOTTIE #ifdef CONFIG_LV_USE_RLOTTIE diff --git a/lib/libesp32_lvgl/lvgl/src/misc/lv_fs.h b/lib/libesp32_lvgl/lvgl/src/misc/lv_fs.h index 9f65e1b2a..c941402c5 100644 --- a/lib/libesp32_lvgl/lvgl/src/misc/lv_fs.h +++ b/lib/libesp32_lvgl/lvgl/src/misc/lv_fs.h @@ -57,7 +57,6 @@ enum { }; typedef uint8_t lv_fs_mode_t; - /** * Seek modes. */ diff --git a/lib/libesp32_lvgl/lvgl/src/misc/lv_printf.h b/lib/libesp32_lvgl/lvgl/src/misc/lv_printf.h index 4cbbd84c0..09563db6e 100644 --- a/lib/libesp32_lvgl/lvgl/src/misc/lv_printf.h +++ b/lib/libesp32_lvgl/lvgl/src/misc/lv_printf.h @@ -40,14 +40,20 @@ /* platform-specific printf format for int32_t, usually "d" or "ld" */ #define LV_PRId32 PRId32 #define LV_PRIu32 PRIu32 + #define LV_PRIx32 PRIx32 + #define LV_PRIX32 PRIX32 #else #define LV_PRId32 "d" #define LV_PRIu32 "u" + #define LV_PRIx32 "x" + #define LV_PRIX32 "X" #endif #else /* hope this is correct for ports without __has_include or without inttypes.h */ #define LV_PRId32 "d" #define LV_PRIu32 "u" + #define LV_PRIx32 "x" + #define LV_PRIX32 "X" #endif #ifdef __cplusplus diff --git a/lib/libesp32_lvgl/lvgl/src/widgets/lv_arc.c b/lib/libesp32_lvgl/lvgl/src/widgets/lv_arc.c index 848c20a72..63cf57740 100644 --- a/lib/libesp32_lvgl/lvgl/src/widgets/lv_arc.c +++ b/lib/libesp32_lvgl/lvgl/src/widgets/lv_arc.c @@ -21,6 +21,10 @@ #define MY_CLASS &lv_arc_class #define VALUE_UNSET INT16_MIN +#define CLICK_OUTSIDE_BG_ANGLES ((uint32_t) 0x00U) +#define CLICK_INSIDE_BG_ANGLES ((uint32_t) 0x01U) +#define CLICK_CLOSER_TO_MAX_END ((uint32_t) 0x00U) +#define CLICK_CLOSER_TO_MIN_END ((uint32_t) 0x01U) /********************** * TYPEDEFS @@ -40,6 +44,7 @@ static lv_coord_t get_angle(const lv_obj_t * obj); static void get_knob_area(lv_obj_t * arc, const lv_point_t * center, lv_coord_t r, lv_area_t * knob_area); static void value_update(lv_obj_t * arc); static lv_coord_t knob_get_extra_size(lv_obj_t * obj); +static bool lv_arc_angle_within_bg_bounds(lv_obj_t * obj, const uint32_t angle, const uint32_t tolerance_deg); /********************** * STATIC VARIABLES @@ -399,6 +404,7 @@ static void lv_arc_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) arc->chg_rate = 720; arc->last_tick = lv_tick_get(); arc->last_angle = arc->indic_angle_end; + arc->in_out = CLICK_OUTSIDE_BG_ANGLES; lv_obj_add_flag(obj, LV_OBJ_FLAG_CLICKABLE); lv_obj_clear_flag(obj, LV_OBJ_FLAG_SCROLL_CHAIN | LV_OBJ_FLAG_SCROLLABLE); @@ -478,29 +484,54 @@ static void lv_arc_event(const lv_obj_class_t * class_p, lv_event_t * e) angle -= arc->rotation; angle -= arc->bg_angle_start; /*Make the angle relative to the start angle*/ + /* If we click near the bg_angle_start the angle will be close to 360° instead of an small angle */ if(angle < 0) angle += 360; - int16_t deg_range = bg_end - arc->bg_angle_start; + const uint32_t circumference = (uint32_t)((2U * r * 314U) / 100U); /* Equivalent to: 2r * 3.14, avoiding floats */ + const uint32_t tolerance_deg = (360U * LV_DPX(50U)) / circumference; + const uint32_t min_close_prev = (uint32_t) arc->min_close; + const bool is_angle_within_bg_bounds = lv_arc_angle_within_bg_bounds(obj, (uint32_t) angle, tolerance_deg); + if(!is_angle_within_bg_bounds) { + return; + } + + int16_t deg_range = bg_end - arc->bg_angle_start; int16_t last_angle_rel = arc->last_angle - arc->bg_angle_start; int16_t delta_angle = angle - last_angle_rel; - /*Do not allow big jumps. + /*Do not allow big jumps (jumps bigger than 280°). *It's mainly to avoid jumping to the opposite end if the "dead" range between min. and max. is crossed. *Check which end was closer on the last valid press (arc->min_close) and prefer that end*/ if(LV_ABS(delta_angle) > 280) { if(arc->min_close) angle = 0; else angle = deg_range; } - else { - if(angle < deg_range / 2)arc->min_close = 1; - else arc->min_close = 0; + /* Check if click was outside the background arc start and end angles */ + else if(CLICK_OUTSIDE_BG_ANGLES == arc->in_out) { + if(arc->min_close) angle = -deg_range; + else angle = deg_range; } + else { /* Keep the angle value */ } + + /* Prevent big jumps when the click goes from start to end angle in the invisible + * part of the background arc without being released */ + if(((min_close_prev == CLICK_CLOSER_TO_MIN_END) && (arc->min_close == CLICK_CLOSER_TO_MAX_END)) + && ((CLICK_OUTSIDE_BG_ANGLES == arc->in_out) && (LV_ABS(delta_angle) > 280))) { + angle = 0; + } + else if(((min_close_prev == CLICK_CLOSER_TO_MAX_END) && (arc->min_close == CLICK_CLOSER_TO_MIN_END)) + && (CLICK_OUTSIDE_BG_ANGLES == arc->in_out)) { + angle = deg_range; + } + else { /* Keep the angle value */ } /*Calculate the slew rate limited angle based on change rate (degrees/sec)*/ delta_angle = angle - last_angle_rel; + uint32_t delta_tick = lv_tick_elaps(arc->last_tick); - int16_t delta_angle_max = (arc->chg_rate * delta_tick) / 1000; + /* delta_angle_max can never be signed. delta_tick is always signed, same for ch_rate */ + const uint16_t delta_angle_max = (arc->chg_rate * delta_tick) / 1000; if(delta_angle > delta_angle_max) { delta_angle = delta_angle_max; @@ -508,6 +539,7 @@ static void lv_arc_event(const lv_obj_class_t * class_p, lv_event_t * e) else if(delta_angle < -delta_angle_max) { delta_angle = -delta_angle_max; } + else { /* Nothing to do */ } angle = last_angle_rel + delta_angle; /*Apply the limited angle change*/ @@ -564,7 +596,7 @@ static void lv_arc_event(const lv_obj_class_t * class_p, lv_event_t * e) } } else if(code == LV_EVENT_HIT_TEST) { - lv_hit_test_info_t * info = lv_event_get_param(e);; + lv_hit_test_info_t * info = lv_event_get_param(e); lv_point_t p; lv_coord_t r; @@ -868,4 +900,121 @@ static lv_coord_t knob_get_extra_size(lv_obj_t * obj) return LV_MAX(knob_shadow_size, knob_outline_size); } +/** + * Check if angle is within arc background bounds + * + * In order to avoid unexpected value update of the arc value when the user clicks + * outside of the arc background we need to check if the angle (of the clicked point) + * is within the bounds of the background. + * + * A tolerance (extra room) also should be taken into consideration. + * + * E.g. Arc with start angle of 0° and end angle of 90°, the background is only visible in + * that range, from 90° to 360° the background is invisible. Click in 150° should not update + * the arc value, click within the arc angle range should. + * + * IMPORTANT NOTE: angle is always relative to bg_angle_start, e.g. if bg_angle_start is 30 + * and we click a bit to the left, angle is 10, not the expected 40. + * + * @param obj Pointer to lv_arc + * @param angle Angle to be checked + * @param tolerance_deg Tolerance + * + * @return true if angle is within arc background bounds, false otherwise + */ +static bool lv_arc_angle_within_bg_bounds(lv_obj_t * obj, const uint32_t angle, const uint32_t tolerance_deg) +{ + LV_ASSERT_OBJ(obj, MY_CLASS); + lv_arc_t * arc = (lv_arc_t *)obj; + + uint32_t smaller_angle = 0; + uint32_t bigger_angle = 0; + + /* Determine which background angle is smaller and bigger */ + if(arc->bg_angle_start < arc->bg_angle_end) { + bigger_angle = arc->bg_angle_end; + smaller_angle = arc->bg_angle_start; + } + else { + bigger_angle = (360 - arc->bg_angle_start) + arc->bg_angle_end; + smaller_angle = 0; + } + + /* Angle is between both background angles */ + if((smaller_angle <= angle) && (angle <= bigger_angle)) { + + if(((bigger_angle - smaller_angle) / 2U) >= angle) { + arc->min_close = 1; + } + else { + arc->min_close = 0; + } + + arc->in_out = CLICK_INSIDE_BG_ANGLES; + + return true; + } + /* Distance between background start and end angles is less than tolerance, + * consider the click inside the arc */ + else if(((smaller_angle - tolerance_deg) <= 0U) && + (360U - (bigger_angle + (smaller_angle - tolerance_deg)))) { + + arc->min_close = 1; + arc->in_out = CLICK_INSIDE_BG_ANGLES; + return true; + } + else { /* Case handled below */ } + + /* Legends: + * 0° = angle 0 + * 360° = angle 360 + * T: Tolerance + * A: Angle + * S: Arc background start angle + * E: Arc background end angle + * + * Start angle is bigger or equal to tolerance */ + if((smaller_angle >= tolerance_deg) + /* (360° - T) --- A --- 360° */ + && ((angle >= (360U - tolerance_deg)) && (angle <= 360U))) { + + arc->min_close = 1; + arc->in_out = CLICK_OUTSIDE_BG_ANGLES; + return true; + } + /* Tolerance is bigger than bg start angle */ + else if((smaller_angle < tolerance_deg) + /* (360° - (T - S)) --- A --- 360° */ + && (((360U - (tolerance_deg - smaller_angle)) <= angle)) && (angle <= 360U)) { + + arc->min_close = 1; + arc->in_out = CLICK_OUTSIDE_BG_ANGLES; + return true; + } + /* 360° is bigger than background end angle + tolerance */ + else if((360U >= (bigger_angle + tolerance_deg)) + /* E --- A --- (E + T) */ + && ((bigger_angle <= (angle + smaller_angle)) && + ((angle + smaller_angle) <= (bigger_angle + tolerance_deg)))) { + + arc->min_close = 0; + arc->in_out = CLICK_OUTSIDE_BG_ANGLES; + return true; + } + /* Background end angle + tolerance is bigger than 360° and bg_start_angle + tolerance is not near 0° + ((bg_end_angle + tolerance) - 360°) + * Here we can assume background is not near 0° because of the first two initial checks */ + else if((360U < (bigger_angle + tolerance_deg)) + && (angle <= 0U + ((bigger_angle + tolerance_deg) - 360U)) && (angle > bigger_angle)) { + + arc->min_close = 0; + arc->in_out = CLICK_OUTSIDE_BG_ANGLES; + return true; + } + else { + /* Nothing to do */ + } + + return false; +} + #endif diff --git a/lib/libesp32_lvgl/lvgl/src/widgets/lv_arc.h b/lib/libesp32_lvgl/lvgl/src/widgets/lv_arc.h index fd53fc15c..6a8a07246 100644 --- a/lib/libesp32_lvgl/lvgl/src/widgets/lv_arc.h +++ b/lib/libesp32_lvgl/lvgl/src/widgets/lv_arc.h @@ -44,10 +44,11 @@ typedef struct { int16_t value; /*Current value of the arc*/ int16_t min_value; /*Minimum value of the arc*/ int16_t max_value; /*Maximum value of the arc*/ - uint16_t dragging : 1; - uint16_t type : 2; - uint16_t min_close : 1; /*1: the last pressed angle was closer to minimum end*/ - uint16_t chg_rate; /*Drag angle rate of change of the arc (degrees/sec)*/ + uint32_t dragging : 1; + uint32_t type : 2; + uint32_t min_close : 1; /*1: the last pressed angle was closer to minimum end*/ + uint32_t in_out : 1; /* 1: The click was within the background arc angles. 0: Click outside */ + uint32_t chg_rate; /*Drag angle rate of change of the arc (degrees/sec)*/ uint32_t last_tick; /*Last dragging event timestamp of the arc*/ int16_t last_angle; /*Last dragging angle of the arc*/ } lv_arc_t; diff --git a/lib/libesp32_lvgl/lvgl/src/widgets/lv_btnmatrix.c b/lib/libesp32_lvgl/lvgl/src/widgets/lv_btnmatrix.c index b0dc8df3f..fd14e56e9 100644 --- a/lib/libesp32_lvgl/lvgl/src/widgets/lv_btnmatrix.c +++ b/lib/libesp32_lvgl/lvgl/src/widgets/lv_btnmatrix.c @@ -448,6 +448,9 @@ static void lv_btnmatrix_event(const lv_obj_class_t * class_p, lv_event_t * e) invalidate_button_area(obj, btnm->btn_id_sel); /*Invalidate the new area*/ } } + else { + btnm->btn_id_sel = LV_BTNMATRIX_BTN_NONE; + } } if(btnm->btn_id_sel != LV_BTNMATRIX_BTN_NONE) { diff --git a/lib/libesp32_lvgl/lvgl/src/widgets/lv_checkbox.c b/lib/libesp32_lvgl/lvgl/src/widgets/lv_checkbox.c index dd3b3d157..fa79b3793 100644 --- a/lib/libesp32_lvgl/lvgl/src/widgets/lv_checkbox.c +++ b/lib/libesp32_lvgl/lvgl/src/widgets/lv_checkbox.c @@ -74,14 +74,16 @@ void lv_checkbox_set_text(lv_obj_t * obj, const char * txt) size_t len = strlen(txt); #endif - if(!cb->static_txt) cb->txt = lv_mem_realloc(cb->txt, len + 1); - else cb->txt = lv_mem_alloc(len + 1); + char * _txt = (char *)cb->txt; + if(!cb->static_txt) _txt = lv_mem_realloc(_txt, len + 1); + else _txt = lv_mem_alloc(len + 1); #if LV_USE_ARABIC_PERSIAN_CHARS - _lv_txt_ap_proc(txt, cb->txt); + _lv_txt_ap_proc(txt, _txt); #else - strcpy(cb->txt, txt); + strcpy(_txt, txt); #endif + cb->txt = _txt; cb->static_txt = 0; lv_obj_refresh_self_size(obj); @@ -92,7 +94,7 @@ void lv_checkbox_set_text_static(lv_obj_t * obj, const char * txt) { lv_checkbox_t * cb = (lv_checkbox_t *)obj; - if(!cb->static_txt) lv_mem_free(cb->txt); + if(!cb->static_txt) lv_mem_free((void *)cb->txt); cb->txt = (char *)txt; cb->static_txt = 1; @@ -138,7 +140,7 @@ static void lv_checkbox_destructor(const lv_obj_class_t * class_p, lv_obj_t * ob lv_checkbox_t * cb = (lv_checkbox_t *)obj; if(!cb->static_txt) { - lv_mem_free(cb->txt); + lv_mem_free((void *)cb->txt); cb->txt = NULL; } LV_TRACE_OBJ_CREATE("finished"); diff --git a/lib/libesp32_lvgl/lvgl/src/widgets/lv_checkbox.h b/lib/libesp32_lvgl/lvgl/src/widgets/lv_checkbox.h index 772f500d5..11405bd21 100644 --- a/lib/libesp32_lvgl/lvgl/src/widgets/lv_checkbox.h +++ b/lib/libesp32_lvgl/lvgl/src/widgets/lv_checkbox.h @@ -28,7 +28,7 @@ extern "C" { typedef struct { lv_obj_t obj; - char * txt; + const char * txt; uint32_t static_txt : 1; } lv_checkbox_t; diff --git a/lib/libesp32_lvgl/lvgl/src/widgets/lv_dropdown.c b/lib/libesp32_lvgl/lvgl/src/widgets/lv_dropdown.c index 974435b2d..765bdde81 100644 --- a/lib/libesp32_lvgl/lvgl/src/widgets/lv_dropdown.c +++ b/lib/libesp32_lvgl/lvgl/src/widgets/lv_dropdown.c @@ -407,14 +407,19 @@ int32_t lv_dropdown_get_option_index(lv_obj_t * obj, const char * option) const char * opts = lv_dropdown_get_options(obj); uint32_t char_i = 0; uint32_t opt_i = 0; + uint32_t option_len = strlen(option); const char * start = opts; while(start[char_i] != '\0') { for(char_i = 0; (start[char_i] != '\n') && (start[char_i] != '\0'); char_i++); - if(memcmp(start, option, LV_MIN(strlen(option), char_i)) == 0) return opt_i; + if(option_len == char_i && memcmp(start, option, LV_MIN(option_len, char_i)) == 0) { + return opt_i; + } + start = &start[char_i]; if(start[0] == '\n') start++; + char_i = 0; opt_i++; } diff --git a/lib/libesp32_lvgl/lvgl/src/widgets/lv_table.c b/lib/libesp32_lvgl/lvgl/src/widgets/lv_table.c index f789e8d33..968cf8703 100644 --- a/lib/libesp32_lvgl/lvgl/src/widgets/lv_table.c +++ b/lib/libesp32_lvgl/lvgl/src/widgets/lv_table.c @@ -40,7 +40,7 @@ static void refr_size_form_row(lv_obj_t * obj, uint32_t start_row); static void refr_cell_size(lv_obj_t * obj, uint32_t row, uint32_t col); static lv_res_t get_pressed_cell(lv_obj_t * obj, uint16_t * row, uint16_t * col); static size_t get_cell_txt_len(const char * txt); -static void copy_cell_txt(char * dst, const char * txt); +static void copy_cell_txt(lv_table_cell_t * dst, const char * txt); static void get_cell_area(lv_obj_t * obj, uint16_t row, uint16_t col, lv_area_t * area); static void scroll_to_selected_cell(lv_obj_t * obj); @@ -98,7 +98,14 @@ void lv_table_set_cell_value(lv_obj_t * obj, uint16_t row, uint16_t col, const c lv_table_cell_ctrl_t ctrl = 0; /*Save the control byte*/ - if(table->cell_data[cell]) ctrl = table->cell_data[cell][0]; + if(table->cell_data[cell]) ctrl = table->cell_data[cell]->ctrl; + +#if LV_USE_USER_DATA + void * user_data = NULL; + + /*Save the user data*/ + if(table->cell_data[cell]) user_data = table->cell_data[cell]->user_data; +#endif size_t to_allocate = get_cell_txt_len(txt); @@ -108,7 +115,10 @@ void lv_table_set_cell_value(lv_obj_t * obj, uint16_t row, uint16_t col, const c copy_cell_txt(table->cell_data[cell], txt); - table->cell_data[cell][0] = ctrl; + table->cell_data[cell]->ctrl = ctrl; +#if LV_USE_USER_DATA + table->cell_data[cell]->user_data = user_data; +#endif refr_cell_size(obj, row, col); } @@ -131,7 +141,14 @@ void lv_table_set_cell_value_fmt(lv_obj_t * obj, uint16_t row, uint16_t col, con lv_table_cell_ctrl_t ctrl = 0; /*Save the control byte*/ - if(table->cell_data[cell]) ctrl = table->cell_data[cell][0]; + if(table->cell_data[cell]) ctrl = table->cell_data[cell]->ctrl; + +#if LV_USE_USER_DATA + void * user_data = NULL; + + /*Save the user_data*/ + if(table->cell_data[cell]) user_data = table->cell_data[cell]->user_data; +#endif va_list ap, ap2; va_start(ap, fmt); @@ -154,32 +171,35 @@ void lv_table_set_cell_value_fmt(lv_obj_t * obj, uint16_t row, uint16_t col, con /*Get the size of the Arabic text and process it*/ size_t len_ap = _lv_txt_ap_calc_bytes_cnt(raw_txt); - table->cell_data[cell] = lv_mem_realloc(table->cell_data[cell], len_ap + 1); + table->cell_data[cell] = lv_mem_realloc(table->cell_data[cell], sizeof(lv_table_cell_t) + len_ap + 1); LV_ASSERT_MALLOC(table->cell_data[cell]); if(table->cell_data[cell] == NULL) { va_end(ap2); return; } - _lv_txt_ap_proc(raw_txt, &table->cell_data[cell][1]); + _lv_txt_ap_proc(raw_txt, table->cell_data[cell]->txt); lv_mem_buf_release(raw_txt); #else - table->cell_data[cell] = lv_mem_realloc(table->cell_data[cell], len + 2); /*+1: trailing '\0; +1: format byte*/ + table->cell_data[cell] = lv_mem_realloc(table->cell_data[cell], + sizeof(lv_table_cell_t) + len + 1); /*+1: trailing '\0; */ LV_ASSERT_MALLOC(table->cell_data[cell]); if(table->cell_data[cell] == NULL) { va_end(ap2); return; } - table->cell_data[cell][len + 1] = 0; /*Ensure NULL termination*/ + table->cell_data[cell]->txt[len] = 0; /*Ensure NULL termination*/ - lv_vsnprintf(&table->cell_data[cell][1], len + 1, fmt, ap2); + lv_vsnprintf(table->cell_data[cell]->txt, len + 1, fmt, ap2); #endif va_end(ap2); - table->cell_data[cell][0] = ctrl; - + table->cell_data[cell]->ctrl = ctrl; +#if LV_USE_USER_DATA + table->cell_data[cell]->user_data = user_data; +#endif refr_cell_size(obj, row, col); } @@ -204,11 +224,17 @@ void lv_table_set_row_cnt(lv_obj_t * obj, uint16_t row_cnt) uint32_t new_cell_cnt = table->col_cnt * table->row_cnt; uint32_t i; for(i = new_cell_cnt; i < old_cell_cnt; i++) { +#if LV_USE_USER_DATA + if(table->cell_data[i]->user_data) { + lv_mem_free(table->cell_data[i]->user_data); + table->cell_data[i]->user_data = NULL; + } +#endif lv_mem_free(table->cell_data[i]); } } - table->cell_data = lv_mem_realloc(table->cell_data, table->row_cnt * table->col_cnt * sizeof(char *)); + table->cell_data = lv_mem_realloc(table->cell_data, table->row_cnt * table->col_cnt * sizeof(lv_table_cell_t *)); LV_ASSERT_MALLOC(table->cell_data); if(table->cell_data == NULL) return; @@ -233,7 +259,7 @@ void lv_table_set_col_cnt(lv_obj_t * obj, uint16_t col_cnt) uint16_t old_col_cnt = table->col_cnt; table->col_cnt = col_cnt; - char ** new_cell_data = lv_mem_alloc(table->row_cnt * table->col_cnt * sizeof(char *)); + lv_table_cell_t ** new_cell_data = lv_mem_alloc(table->row_cnt * table->col_cnt * sizeof(lv_table_cell_t *)); LV_ASSERT_MALLOC(new_cell_data); if(new_cell_data == NULL) return; uint32_t new_cell_cnt = table->col_cnt * table->row_cnt; @@ -256,6 +282,12 @@ void lv_table_set_col_cnt(lv_obj_t * obj, uint16_t col_cnt) int32_t i; for(i = 0; i < (int32_t)old_col_cnt - col_cnt; i++) { uint32_t idx = old_col_start + min_col_cnt + i; +#if LV_USE_USER_DATA + if(table->cell_data[idx]->user_data) { + lv_mem_free(table->cell_data[idx]->user_data); + table->cell_data[idx]->user_data = NULL; + } +#endif lv_mem_free(table->cell_data[idx]); table->cell_data[idx] = NULL; } @@ -304,15 +336,18 @@ void lv_table_add_cell_ctrl(lv_obj_t * obj, uint16_t row, uint16_t col, lv_table uint32_t cell = row * table->col_cnt + col; if(is_cell_empty(table->cell_data[cell])) { - table->cell_data[cell] = lv_mem_alloc(2); /*+1: trailing '\0; +1: format byte*/ + table->cell_data[cell] = lv_mem_alloc(sizeof(lv_table_cell_t) + 1); /*+1: trailing '\0 */ LV_ASSERT_MALLOC(table->cell_data[cell]); if(table->cell_data[cell] == NULL) return; - table->cell_data[cell][0] = 0; - table->cell_data[cell][1] = '\0'; + table->cell_data[cell]->ctrl = 0; +#if LV_USE_USER_DATA + table->cell_data[cell]->user_data = NULL; +#endif + table->cell_data[cell]->txt[0] = '\0'; } - table->cell_data[cell][0] |= ctrl; + table->cell_data[cell]->ctrl |= ctrl; } void lv_table_clear_cell_ctrl(lv_obj_t * obj, uint16_t row, uint16_t col, lv_table_cell_ctrl_t ctrl) @@ -328,17 +363,51 @@ void lv_table_clear_cell_ctrl(lv_obj_t * obj, uint16_t row, uint16_t col, lv_tab uint32_t cell = row * table->col_cnt + col; if(is_cell_empty(table->cell_data[cell])) { - table->cell_data[cell] = lv_mem_alloc(2); /*+1: trailing '\0; +1: format byte*/ + table->cell_data[cell] = lv_mem_alloc(sizeof(lv_table_cell_t) + 1); /*+1: trailing '\0 */ LV_ASSERT_MALLOC(table->cell_data[cell]); if(table->cell_data[cell] == NULL) return; - table->cell_data[cell][0] = 0; - table->cell_data[cell][1] = '\0'; + table->cell_data[cell]->ctrl = 0; +#if LV_USE_USER_DATA + table->cell_data[cell]->user_data = NULL; +#endif + table->cell_data[cell]->txt[0] = '\0'; } - table->cell_data[cell][0] &= (~ctrl); + table->cell_data[cell]->ctrl &= (~ctrl); } +#if LV_USE_USER_DATA +void lv_table_set_cell_user_data(lv_obj_t * obj, uint16_t row, uint16_t col, void * user_data) +{ + LV_ASSERT_OBJ(obj, MY_CLASS); + + lv_table_t * table = (lv_table_t *)obj; + + /*Auto expand*/ + if(col >= table->col_cnt) lv_table_set_col_cnt(obj, col + 1); + if(row >= table->row_cnt) lv_table_set_row_cnt(obj, row + 1); + + uint32_t cell = row * table->col_cnt + col; + + if(is_cell_empty(table->cell_data[cell])) { + table->cell_data[cell] = lv_mem_alloc(sizeof(lv_table_cell_t) + 1); /*+1: trailing '\0 */ + LV_ASSERT_MALLOC(table->cell_data[cell]); + if(table->cell_data[cell] == NULL) return; + + table->cell_data[cell]->ctrl = 0; + table->cell_data[cell]->user_data = NULL; + table->cell_data[cell]->txt[0] = '\0'; + } + + if(table->cell_data[cell]->user_data) { + lv_mem_free(table->cell_data[cell]->user_data); + } + + table->cell_data[cell]->user_data = user_data; +} +#endif + /*===================== * Getter functions *====================*/ @@ -356,7 +425,7 @@ const char * lv_table_get_cell_value(lv_obj_t * obj, uint16_t row, uint16_t col) if(is_cell_empty(table->cell_data[cell])) return ""; - return &table->cell_data[cell][1]; /*Skip the format byte*/ + return table->cell_data[cell]->txt; } uint16_t lv_table_get_row_cnt(lv_obj_t * obj) @@ -401,7 +470,7 @@ bool lv_table_has_cell_ctrl(lv_obj_t * obj, uint16_t row, uint16_t col, lv_table uint32_t cell = row * table->col_cnt + col; if(is_cell_empty(table->cell_data[cell])) return false; - else return (table->cell_data[cell][0] & ctrl) == ctrl; + else return (table->cell_data[cell]->ctrl & ctrl) == ctrl; } void lv_table_get_selected_cell(lv_obj_t * obj, uint16_t * row, uint16_t * col) @@ -411,6 +480,24 @@ void lv_table_get_selected_cell(lv_obj_t * obj, uint16_t * row, uint16_t * col) *col = table->col_act; } +#if LV_USE_USER_DATA +void * lv_table_get_cell_user_data(lv_obj_t * obj, uint16_t row, uint16_t col) +{ + LV_ASSERT_OBJ(obj, MY_CLASS); + + lv_table_t * table = (lv_table_t *)obj; + if(row >= table->row_cnt || col >= table->col_cnt) { + LV_LOG_WARN("invalid row or column"); + return NULL; + } + uint32_t cell = row * table->col_cnt + col; + + if(is_cell_empty(table->cell_data[cell])) return NULL; + + return table->cell_data[cell]->user_data; +} +#endif + /********************** * STATIC FUNCTIONS **********************/ @@ -428,7 +515,7 @@ static void lv_table_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) table->row_h = lv_mem_alloc(table->row_cnt * sizeof(table->row_h[0])); table->col_w[0] = LV_DPI_DEF; table->row_h[0] = LV_DPI_DEF; - table->cell_data = lv_mem_realloc(table->cell_data, table->row_cnt * table->col_cnt * sizeof(char *)); + table->cell_data = lv_mem_realloc(table->cell_data, table->row_cnt * table->col_cnt * sizeof(lv_table_cell_t *)); table->cell_data[0] = NULL; LV_TRACE_OBJ_CREATE("finished"); @@ -442,6 +529,12 @@ static void lv_table_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj) uint16_t i; for(i = 0; i < table->col_cnt * table->row_cnt; i++) { if(table->cell_data[i]) { +#if LV_USE_USER_DATA + if(table->cell_data[i]->user_data) { + lv_mem_free(table->cell_data[i]->user_data); + table->cell_data[i]->user_data = NULL; + } +#endif lv_mem_free(table->cell_data[i]); table->cell_data[i] = NULL; } @@ -639,7 +732,7 @@ static void draw_main(lv_event_t * e) for(col = 0; col < table->col_cnt; col++) { lv_table_cell_ctrl_t ctrl = 0; - if(table->cell_data[cell]) ctrl = table->cell_data[cell][0]; + if(table->cell_data[cell]) ctrl = table->cell_data[cell]->ctrl; if(rtl) { cell_area.x2 = cell_area.x1 - 1; @@ -652,11 +745,11 @@ static void draw_main(lv_event_t * e) uint16_t col_merge = 0; for(col_merge = 0; col_merge + col < table->col_cnt - 1; col_merge++) { - char * next_cell_data = table->cell_data[cell + col_merge]; + lv_table_cell_t * next_cell_data = table->cell_data[cell + col_merge]; if(is_cell_empty(next_cell_data)) break; - lv_table_cell_ctrl_t merge_ctrl = (lv_table_cell_ctrl_t) next_cell_data[0]; + lv_table_cell_ctrl_t merge_ctrl = (lv_table_cell_ctrl_t) next_cell_data->ctrl; if(merge_ctrl & LV_TABLE_CELL_CTRL_MERGE_RIGHT) { lv_coord_t offset = table->col_w[col + col_merge + 1]; @@ -739,7 +832,7 @@ static void draw_main(lv_event_t * e) bool crop = ctrl & LV_TABLE_CELL_CTRL_TEXT_CROP ? true : false; if(crop) txt_flags = LV_TEXT_FLAG_EXPAND; - lv_txt_get_size(&txt_size, table->cell_data[cell] + 1, label_dsc_def.font, + lv_txt_get_size(&txt_size, table->cell_data[cell]->txt, label_dsc_def.font, label_dsc_act.letter_space, label_dsc_act.line_space, lv_area_get_width(&txt_area), txt_flags); @@ -754,7 +847,7 @@ static void draw_main(lv_event_t * e) label_mask_ok = _lv_area_intersect(&label_clip_area, &clip_area, &cell_area); if(label_mask_ok) { draw_ctx->clip_area = &label_clip_area; - lv_draw_label(draw_ctx, &label_dsc_act, &txt_area, table->cell_data[cell] + 1, NULL); + lv_draw_label(draw_ctx, &label_dsc_act, &txt_area, table->cell_data[cell]->txt, NULL); draw_ctx->clip_area = &clip_area; } } @@ -845,7 +938,7 @@ static lv_coord_t get_row_height(lv_obj_t * obj, uint16_t row_id, const lv_font_ uint16_t cell; uint16_t col; for(cell = row_start, col = 0; cell < row_start + table->col_cnt; cell++, col++) { - char * cell_data = table->cell_data[cell]; + lv_table_cell_t * cell_data = table->cell_data[cell]; if(is_cell_empty(cell_data)) { continue; @@ -858,11 +951,11 @@ static lv_coord_t get_row_height(lv_obj_t * obj, uint16_t row_id, const lv_font_ * exit the traversal when the current cell control is not LV_TABLE_CELL_CTRL_MERGE_RIGHT */ uint16_t col_merge = 0; for(col_merge = 0; col_merge + col < table->col_cnt - 1; col_merge++) { - char * next_cell_data = table->cell_data[cell + col_merge]; + lv_table_cell_t * next_cell_data = table->cell_data[cell + col_merge]; if(is_cell_empty(next_cell_data)) break; - lv_table_cell_ctrl_t ctrl = (lv_table_cell_ctrl_t) next_cell_data[0]; + lv_table_cell_ctrl_t ctrl = (lv_table_cell_ctrl_t) next_cell_data->ctrl; if(ctrl & LV_TABLE_CELL_CTRL_MERGE_RIGHT) { txt_w += table->col_w[col + col_merge + 1]; } @@ -871,7 +964,7 @@ static lv_coord_t get_row_height(lv_obj_t * obj, uint16_t row_id, const lv_font_ } } - lv_table_cell_ctrl_t ctrl = (lv_table_cell_ctrl_t) cell_data[0]; + lv_table_cell_ctrl_t ctrl = (lv_table_cell_ctrl_t) cell_data->ctrl; /*When cropping the text we can assume the row height is equal to the line height*/ if(ctrl & LV_TABLE_CELL_CTRL_TEXT_CROP) { @@ -883,7 +976,7 @@ static lv_coord_t get_row_height(lv_obj_t * obj, uint16_t row_id, const lv_font_ lv_point_t txt_size; txt_w -= cell_left + cell_right; - lv_txt_get_size(&txt_size, table->cell_data[cell] + 1, font, + lv_txt_get_size(&txt_size, table->cell_data[cell]->txt, font, letter_space, line_space, txt_w, LV_TEXT_FLAG_NONE); h_max = LV_MAX(txt_size.y + cell_top + cell_bottom, h_max); @@ -953,23 +1046,21 @@ static size_t get_cell_txt_len(const char * txt) size_t retval = 0; #if LV_USE_ARABIC_PERSIAN_CHARS - retval = _lv_txt_ap_calc_bytes_cnt(txt) + 1; + retval = sizeof(lv_table_cell_t) + _lv_txt_ap_calc_bytes_cnt(txt) + 1; #else - /* cell_data layout: [ctrl][txt][trailing '\0' terminator] - * +2 because of the trailing '\0' and the ctrl */ - retval = strlen(txt) + 2; + retval = sizeof(lv_table_cell_t) + strlen(txt) + 1; #endif return retval; } /* Copy txt into dst skipping the format byte */ -static void copy_cell_txt(char * dst, const char * txt) +static void copy_cell_txt(lv_table_cell_t * dst, const char * txt) { #if LV_USE_ARABIC_PERSIAN_CHARS - _lv_txt_ap_proc(txt, &dst[1]); + _lv_txt_ap_proc(txt, dst->txt); #else - strcpy(&dst[1], txt); + strcpy(dst->txt, txt); #endif } diff --git a/lib/libesp32_lvgl/lvgl/src/widgets/lv_table.h b/lib/libesp32_lvgl/lvgl/src/widgets/lv_table.h index 910627087..9c60a7673 100644 --- a/lib/libesp32_lvgl/lvgl/src/widgets/lv_table.h +++ b/lib/libesp32_lvgl/lvgl/src/widgets/lv_table.h @@ -46,12 +46,21 @@ enum { typedef uint8_t lv_table_cell_ctrl_t; +/*Data of cell*/ +typedef struct { + lv_table_cell_ctrl_t ctrl; +#if LV_USE_USER_DATA + void * user_data; /**< Custom user data*/ +#endif + char txt[]; +} lv_table_cell_t; + /*Data of table*/ typedef struct { lv_obj_t obj; uint16_t col_cnt; uint16_t row_cnt; - char ** cell_data; + lv_table_cell_t ** cell_data; lv_coord_t * row_h; lv_coord_t * col_w; uint16_t col_act; @@ -144,6 +153,17 @@ void lv_table_add_cell_ctrl(lv_obj_t * obj, uint16_t row, uint16_t col, lv_table */ void lv_table_clear_cell_ctrl(lv_obj_t * obj, uint16_t row, uint16_t col, lv_table_cell_ctrl_t ctrl); +#if LV_USE_USER_DATA +/** + * Add custom user data to the cell. + * @param obj pointer to a Table object + * @param row id of the row [0 .. row_cnt -1] + * @param col id of the column [0 .. col_cnt -1] + * @param user_data pointer to the new user_data. It must be allocated by user as it will be freed automatically + */ +void lv_table_set_cell_user_data(lv_obj_t * obj, uint16_t row, uint16_t col, void * user_data); +#endif + /*===================== * Getter functions *====================*/ @@ -197,6 +217,16 @@ bool lv_table_has_cell_ctrl(lv_obj_t * obj, uint16_t row, uint16_t col, lv_table */ void lv_table_get_selected_cell(lv_obj_t * obj, uint16_t * row, uint16_t * col); +#if LV_USE_USER_DATA +/** + * Get custom user data to the cell. + * @param obj pointer to a Table object + * @param row id of the row [0 .. row_cnt -1] + * @param col id of the column [0 .. col_cnt -1] + */ +void * lv_table_get_cell_user_data(lv_obj_t * obj, uint16_t row, uint16_t col); +#endif + /********************** * MACROS **********************/ diff --git a/pio-tools/add_c_flags.py b/pio-tools/add_c_flags.py index 40d8a3937..0c39e777f 100644 --- a/pio-tools/add_c_flags.py +++ b/pio-tools/add_c_flags.py @@ -2,6 +2,3 @@ Import("env") # General options that are passed to the C compiler (C only; not C++). env.Append(CFLAGS=["-Wno-discarded-qualifiers", "-Wno-implicit-function-declaration"]) - -# General options that are passed to the C++ compiler -env.Append(CXXFLAGS=["-Wno-volatile"]) diff --git a/pio-tools/add_c_flags_ard3.py b/pio-tools/add_c_flags_ard3.py new file mode 100644 index 000000000..3c9acc66a --- /dev/null +++ b/pio-tools/add_c_flags_ard3.py @@ -0,0 +1,7 @@ +Import("env") + +# General options that are passed to the C++ compiler +env.Append(CXXFLAGS=["-Wno-volatile"]) + +# General options that are passed to the C compiler (C only; not C++). +env.Append(CFLAGS=["-Wno-incompatible-pointer-types"]) diff --git a/pio-tools/espupload.py b/pio-tools/espupload.py index 8b0993a55..a25345e65 100755 --- a/pio-tools/espupload.py +++ b/pio-tools/espupload.py @@ -20,7 +20,7 @@ Provides: Uploads binary file to OTA server. - Usually initated from http-uploader.py + Usually initiated from http-uploader.py Requirements: - Python diff --git a/pio-tools/get_flash_size.py b/pio-tools/get_flash_size.py deleted file mode 100644 index c0480d854..000000000 --- a/pio-tools/get_flash_size.py +++ /dev/null @@ -1,45 +0,0 @@ -from os.path import join -import subprocess -from SCons.Script import COMMAND_LINE_TARGETS - -Import("env") -env = DefaultEnvironment() -platform = env.PioPlatform() - -if "upload" in COMMAND_LINE_TARGETS: - - def esp32_detect_flashsize(): - esptoolpy = join(platform.get_package_dir("tool-esptoolpy") or "", "esptool.py") - esptoolpy_flags = ["flash_id"] - esptoolpy_cmd = [env["PYTHONEXE"], esptoolpy] + esptoolpy_flags - try: - output = subprocess.run(esptoolpy_cmd, capture_output=True).stdout.splitlines() - for l in output: - if l.decode().startswith("Detected flash size: "): - size = (l.decode().split(": ")[1]) - print("Did get flash size:",size) - return size, True - return "4MB",False - except subprocess.CalledProcessError as exc: - print("Did get chip info failed with " + str(exc)) - return "4MB",False - - size, overridden = esp32_detect_flashsize() - old_flash_size = env.BoardConfig().get("upload.flash_size") - old_maximum_size = env.BoardConfig().get("upload.maximum_size") - new_maximum_size = int(size.split("MB")[0]) * 0x100000 - - if new_maximum_size > old_maximum_size: - - extra_flags = env.BoardConfig().get("build.extra_flags").split(" ") - new_flags = "" - for flag in extra_flags: - if flag.startswith("-DESP32"): - flag = f"-DESP32_{size}" - new_flags += flag + " " - env.BoardConfig().update("build.extra_flags",new_flags) - env.BoardConfig().update("upload.flash_size",size) - - env.BoardConfig().update("upload.maximum_size", new_maximum_size) - - env.Replace(TASMOTA_flash_size=size) \ No newline at end of file diff --git a/pio-tools/name-firmware.py b/pio-tools/name-firmware.py index e2d38f6fd..6b32b771f 100644 --- a/pio-tools/name-firmware.py +++ b/pio-tools/name-firmware.py @@ -14,12 +14,14 @@ def bin_map_copy(source, target, env): map_file = tasmotapiolib.get_final_map_path(env) bin_file = tasmotapiolib.get_final_bin_path(env) one_bin_file = bin_file + firmware_name = env.subst("$BUILD_DIR/${PROGNAME}.bin") if env["PIOPLATFORM"] == "espressif32": - factory_tmp = pathlib.Path(firsttarget).with_suffix("") - factory = factory_tmp.with_suffix(factory_tmp.suffix + ".factory.bin") - one_bin_tmp = pathlib.Path(bin_file).with_suffix("") - one_bin_file = one_bin_tmp.with_suffix(one_bin_tmp.suffix + ".factory.bin") + if("safeboot" not in firmware_name): + factory_tmp = pathlib.Path(firsttarget).with_suffix("") + factory = factory_tmp.with_suffix(factory_tmp.suffix + ".factory.bin") + one_bin_tmp = pathlib.Path(bin_file).with_suffix("") + one_bin_file = one_bin_tmp.with_suffix(one_bin_tmp.suffix + ".factory.bin") # check if new target files exist and remove if necessary for f in [map_file, bin_file, one_bin_file]: @@ -29,9 +31,10 @@ def bin_map_copy(source, target, env): # copy firmware.bin and map to final destination shutil.copy(firsttarget, bin_file) if env["PIOPLATFORM"] == "espressif32": - # the map file is needed later for fimrmware-metrics.py + # the map file is needed later for firmware-metrics.py shutil.copy(tasmotapiolib.get_source_map_path(env), map_file) - shutil.copy(factory, one_bin_file) + if("safeboot" not in firmware_name): + shutil.copy(factory, one_bin_file) else: map_firm = join(env.subst("$BUILD_DIR")) + os.sep + "firmware.map" shutil.copy(tasmotapiolib.get_source_map_path(env), map_firm) diff --git a/pio-tools/post_esp32.py b/pio-tools/post_esp32.py index facff33e7..dbc1651ff 100644 --- a/pio-tools/post_esp32.py +++ b/pio-tools/post_esp32.py @@ -16,7 +16,7 @@ # - 0x1000 | ~\.platformio\packages\framework-arduinoespressif32\tools\sdk\esp32\bin\bootloader_dout_40m.bin # - 0x8000 | ~\Tasmota\.pio\build\\partitions.bin # - 0xe000 | ~\.platformio\packages\framework-arduinoespressif32\tools\partitions\boot_app0.bin -# - 0x10000 | ~\.platformio/packages/framework-arduinoespressif32/variants/tasmota/\-safeboot.bin +# - 0x10000 | ~\Tasmota\/-safeboot.bin # - 0xe0000 | ~\Tasmota\.pio\build\/firmware.bin # - 0x3b0000| ~\Tasmota\.pio\build\/littlefs.bin @@ -37,6 +37,13 @@ from SCons.Script import COMMAND_LINE_TARGETS sys.path.append(join(platform.get_package_dir("tool-esptoolpy"))) import esptool +variants_dir = env.BoardConfig().get("build.variants_dir", "") +variant = env.BoardConfig().get("build.variant", "") +sections = env.subst(env.get("FLASH_EXTRA_IMAGES")) +chip = env.get("BOARD_MCU") +mcu_build_variant = env.BoardConfig().get("build.variant", "").lower() + +# Copy safeboots firmwares in place when running in Github github_actions = os.getenv('GITHUB_ACTIONS') extra_flags = ''.join([element.replace("-D", " ") for element in env.BoardConfig().get("build.extra_flags", "")]) build_flags = ''.join([element.replace("-D", " ") for element in env.GetProjectOption("build_flags")]) @@ -45,16 +52,60 @@ if "CORE32SOLO1" in extra_flags or "FRAMEWORK_ARDUINO_SOLO1" in build_flags: FRAMEWORK_DIR = platform.get_package_dir("framework-arduino-solo1") if github_actions and os.path.exists("./firmware/firmware"): shutil.copytree("./firmware/firmware", "/home/runner/.platformio/packages/framework-arduino-solo1/variants/tasmota") + if variants_dir: + shutil.copytree("./firmware/firmware", variants_dir, dirs_exist_ok=True) elif "CORE32ITEAD" in extra_flags or "FRAMEWORK_ARDUINO_ITEAD" in build_flags: FRAMEWORK_DIR = platform.get_package_dir("framework-arduino-ITEAD") if github_actions and os.path.exists("./firmware/firmware"): shutil.copytree("./firmware/firmware", "/home/runner/.platformio/packages/framework-arduino-ITEAD/variants/tasmota") + if variants_dir: + shutil.copytree("./firmware/firmware", variants_dir, dirs_exist_ok=True) else: FRAMEWORK_DIR = platform.get_package_dir("framework-arduinoespressif32") if github_actions and os.path.exists("./firmware/firmware"): shutil.copytree("./firmware/firmware", "/home/runner/.platformio/packages/framework-arduinoespressif32/variants/tasmota") + if variants_dir: + shutil.copytree("./firmware/firmware", variants_dir, dirs_exist_ok=True) -variants_dir = join(FRAMEWORK_DIR, "variants", "tasmota") +# Copy pins_arduino.h to variants folder +if variants_dir: + mcu_build_variant_path = join(FRAMEWORK_DIR, "variants", mcu_build_variant, "pins_arduino.h") + custom_variant_build = join(env.subst("$PROJECT_DIR"), variants_dir , mcu_build_variant, "pins_arduino.h") + os.makedirs(join(env.subst("$PROJECT_DIR"), variants_dir , mcu_build_variant), exist_ok=True) + shutil.copy(mcu_build_variant_path, custom_variant_build) + +if not variants_dir: + variants_dir = join(FRAMEWORK_DIR, "variants", "tasmota") + env.BoardConfig().update("build.variants_dir", variants_dir) + +def esp32_detect_flashsize(): + uploader = env.subst("$UPLOADER") + if not "upload" in COMMAND_LINE_TARGETS: + return "4MB",False + if not "esptool" in uploader: + return "4MB",False + else: + esptoolpy = join(platform.get_package_dir("tool-esptoolpy") or "", "esptool.py") + esptoolpy_flags = ["flash_id"] + esptoolpy_cmd = [env["PYTHONEXE"], esptoolpy] + esptoolpy_flags + try: + output = subprocess.run(esptoolpy_cmd, capture_output=True).stdout.splitlines() + for l in output: + if l.decode().startswith("Detected flash size: "): + size = (l.decode().split(": ")[1]) + print("Did get flash size:", size) + stored_flash_size_mb = env.BoardConfig().get("upload.flash_size") + stored_flash_size = int(stored_flash_size_mb.split("MB")[0]) * 0x100000 + detected_flash_size = int(size.split("MB")[0]) * 0x100000 + if detected_flash_size > stored_flash_size: + env.BoardConfig().update("upload.flash_size", size) + return size, True + return "4MB",False + except subprocess.CalledProcessError as exc: + print("Did get chip info failed with " + str(exc)) + return "4MB",False + +flash_size_from_esp, flash_size_was_overridden = esp32_detect_flashsize() def patch_partitions_bin(size_string): partition_bin_path = join(env.subst("$BUILD_DIR"),"partitions.bin") @@ -62,24 +113,18 @@ def patch_partitions_bin(size_string): binary_data = file.read(0xb0) import hashlib bin_list = list(binary_data) - size = codecs.decode(size_string[2:], 'hex_codec') # 0xc50000 -> [c5,00,00] - bin_list[0x8a] = size[0] - bin_list[0x8b] = size[1] + size_string = int(size_string[2:],16) + size_string = f"{size_string:08X}" + size = codecs.decode(size_string, 'hex_codec') # 0xc50000 -> [00,c5,00,00] + bin_list[0x89] = size[2] + bin_list[0x8a] = size[1] + bin_list[0x8b] = size[0] result = hashlib.md5(bytes(bin_list[0:0xa0])) partition_data = bytes(bin_list) + result.digest() file.seek(0) file.write(partition_data) print("New partition hash:",result.digest().hex()) -def esp32_detect_flashsize(): - if not "upload" in COMMAND_LINE_TARGETS: - return "4MB",False - size = env.get("TASMOTA_flash_size") - if size == None: - return "4MB",False - else: - return size,True - def esp32_create_chip_string(chip): tasmota_platform = env.subst("$BUILD_DIR").split(os.path.sep)[-1] tasmota_platform = tasmota_platform.split('-')[0] @@ -142,13 +187,11 @@ def esp32_copy_new_safeboot_bin(tasmota_platform,new_local_safeboot_fw): def esp32_create_combined_bin(source, target, env): #print("Generating combined binary for serial flashing") - # The offset from begin of the file where the app0 partition starts # This is defined in the partition .csv file # factory_offset = -1 # error code value - currently unused app_offset = 0x10000 # default value for "old" scheme fs_offset = -1 # error code value - flash_size_from_esp, flash_size_was_overridden = esp32_detect_flashsize() with open(env.BoardConfig().get("build.partitions")) as csv_file: print("Read partitions from ",env.BoardConfig().get("build.partitions")) @@ -177,9 +220,7 @@ def esp32_create_combined_bin(source, target, env): new_file_name = env.subst("$BUILD_DIR/${PROGNAME}.factory.bin") - sections = env.subst(env.get("FLASH_EXTRA_IMAGES")) firmware_name = env.subst("$BUILD_DIR/${PROGNAME}.bin") - chip = env.get("BOARD_MCU") tasmota_platform = esp32_create_chip_string(chip) if "-DUSE_USB_CDC_CONSOLE" in env.BoardConfig().get("build.extra_flags") and "cdc" not in tasmota_platform: @@ -188,14 +229,12 @@ def esp32_create_combined_bin(source, target, env): if not os.path.exists(variants_dir): os.makedirs(variants_dir) - if("safeboot" in firmware_name): + if "safeboot" in firmware_name: esp32_copy_new_safeboot_bin(tasmota_platform,firmware_name) else: esp32_fetch_safeboot_bin(tasmota_platform) flash_size = env.BoardConfig().get("upload.flash_size", "4MB") - if flash_size_was_overridden: - flash_size = flash_size_from_esp flash_freq = env.BoardConfig().get("build.f_flash", "40000000L") flash_freq = str(flash_freq).replace("L", "") flash_freq = str(int(int(flash_freq) / 1000000)) + "m" @@ -227,16 +266,15 @@ def esp32_create_combined_bin(source, target, env): cmd += [sect_adr, sect_file] # "main" firmware to app0 - mandatory, except we just built a new safeboot bin locally - if("safeboot" not in firmware_name): + if "safeboot" not in firmware_name: print(f" - {hex(app_offset)} | {firmware_name}") cmd += [hex(app_offset), firmware_name] else: print("Upload new safeboot binary only") -# if(fs_offset != -1): - upload_port = env.subst("$UPLOAD_PORT") - if("upload-tasmota.php" not in upload_port) and (fs_offset != -1): + upload_protocol = env.subst("$UPLOAD_PROTOCOL") + if(upload_protocol == "esptool") and (fs_offset != -1): fs_bin = join(env.subst("$BUILD_DIR"),"littlefs.bin") if exists(fs_bin): before_reset = env.BoardConfig().get("upload.before_reset", "default_reset") @@ -259,9 +297,9 @@ def esp32_create_combined_bin(source, target, env): ) print("Will use custom upload command for flashing operation to add file system defined for this build target.") - # print('Using esptool.py arguments: %s' % ' '.join(cmd)) - - esptool.main(cmd) + if("safeboot" not in firmware_name): + #print('Using esptool.py arguments: %s' % ' '.join(cmd)) + esptool.main(cmd) -env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", esp32_create_combined_bin) \ No newline at end of file +env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", esp32_create_combined_bin) diff --git a/pio-tools/pre_source_dir.py b/pio-tools/pre_source_dir.py index 8ff1e8753..74d327f81 100644 --- a/pio-tools/pre_source_dir.py +++ b/pio-tools/pre_source_dir.py @@ -12,6 +12,11 @@ def FindInoNodes(env): env.AddMethod(FindInoNodes) # Pass flashmode at build time to macro -tasmota_flash_mode = "-DCONFIG_TASMOTA_FLASHMODE_" + (env.BoardConfig().get("build.flash_mode", "dio")).upper() +memory_type = env.BoardConfig().get("build.arduino.memory_type", "").upper() +flash_mode = env.BoardConfig().get("build.flash_mode", "dio").upper() +if "OPI_" in memory_type: + flash_mode = "OPI" + +tasmota_flash_mode = "-DCONFIG_TASMOTA_FLASHMODE_" + flash_mode env.Append(CXXFLAGS=[tasmota_flash_mode]) print(tasmota_flash_mode) diff --git a/platformio.ini b/platformio.ini index 5f55fe7f2..de12bf4a9 100644 --- a/platformio.ini +++ b/platformio.ini @@ -32,6 +32,7 @@ platform_packages = ${core.platform_packages} framework = arduino board = esp8266_1M board_build.filesystem = littlefs +board_build.variants_dir = variants/tasmota custom_unpack_dir = unpacked_littlefs build_unflags = ${core.build_unflags} build_flags = ${core.build_flags} @@ -54,7 +55,6 @@ lib_extra_dirs = lib/lib_div [tasmota] -; *** Settings here do NOT affect firmware building *** ; Uncomment if you do NOT want gzipped map file(s) ;disable_map_gz = 1 ; Uncomment and specify a folder where to place the map file(s) (default set to folder build_output) @@ -65,6 +65,9 @@ lib_extra_dirs = ;enable_esp32_gz = 1 ; Uncomment and specify a folder where to place the firmware file(s) (default set to folder build_output) ;bin_dir = /tmp/bin_files/ +; Global build flags (used for all env) can be overriden in "platformio_override.ini" +build_unflags = +build_flags = [scripts_defaults] extra_scripts = pre:pio-tools/pre_source_dir.py @@ -80,10 +83,12 @@ extra_scripts = post:pio-tools/name-firmware.py ; post:pio-tools/obj-dump.py ${scripts_defaults.extra_scripts} ; *** remove undesired all warnings -build_unflags = -Wall +build_unflags = ${tasmota.build_unflags} + -Wall ; -mtarget-align -Wdeprecated-declarations -build_flags = -DCORE_DEBUG_LEVEL=0 +build_flags = ${tasmota.build_flags} + -DCORE_DEBUG_LEVEL=0 -Wl,-Map,firmware.map -Wno-deprecated-declarations ; -mno-target-align diff --git a/platformio_override_sample.ini b/platformio_override_sample.ini index 707145ad4..e00872a6b 100644 --- a/platformio_override_sample.ini +++ b/platformio_override_sample.ini @@ -28,7 +28,6 @@ default_envs = ; tasmota-zbbridge ; tasmota-ir ; tasmota32 -; tasmota32-arduino30 ; tasmota32-zbbrdgpro ; tasmota32-bluetooth ; tasmota32-webcam @@ -45,7 +44,31 @@ default_envs = ; tasmota32-odroidgo ; tasmota32-core2 ; tasmota32-nspanel +; +; *** Build/upload environments for ESP32 Arduino Core 3.0 +; +; tasmota32-arduino30 +; tasmota32solo1-arduino30 +; tasmota32-psramfix_ard3 +; tasmota32s2-arduino30 +; tasmota32s2cdc-arduino30 +; tasmota32s3-arduino30 +; tasmota32s3-qio_opi-ard30 +; tasmota32s3cdc-qio_opi-ard30 +; tasmota32s3cdc-webcam3 +; tasmota32c2-arduino30 +; tasmota32c3-arduino30 +; tasmota32c3cdc-arduino30 +; tasmota32c6-arduino30 +; tasmota32c6cdc-arduino30 +; tasmota32c2-safeboot +; tasmota32c6-safeboot +; tasmota32c6cdc-safeboot +[tasmota] +; *** Global build / unbuild compile time flags for ALL Tasmota / Tasmota32 [env] +;build_unflags = +build_flags = -DUSE_BERRY_PARTITION_WIZARD [env] ;build_unflags = ${common.build_unflags} diff --git a/platformio_tasmota32.ini b/platformio_tasmota32.ini index 2a640c215..d27d9a7d6 100644 --- a/platformio_tasmota32.ini +++ b/platformio_tasmota32.ini @@ -47,7 +47,6 @@ lib_ignore = ArduinoOTA ESP32-HomeKit extra_scripts = pre:pio-tools/add_c_flags.py - ; pre:pio-tools/get_flash_size.py pre:pio-tools/gen-berry-structures.py post:pio-tools/post_esp32.py ${esp_defaults.extra_scripts} @@ -78,8 +77,30 @@ lib_ignore = ${esp32_defaults.lib_ignore} DHT sensor library ccronexpr +[core32_30_flags] +build_unflags = ${core32_30.build_unflags} +build_flags = ${core32_30.build_flags} +extra_scripts = pre:pio-tools/add_c_flags_ard3.py + ${esp32_defaults.extra_scripts} +lib_extra_dirs = lib/lib_ssl, lib/lib_basic, lib/lib_i2c, lib/lib_div, lib/lib_audio, lib/lib_display, lib/lib_rf, lib/libesp32, lib/libesp32_div, lib/libesp32_lvgl +lib_ignore = + HTTPUpdateServer + USB + ESP32 Async UDP + NetBIOS + Preferences + ArduinoOTA + NimBLE-Arduino + + [core32] -platform = https://github.com/tasmota/platform-espressif32/releases/download/2023.10.04/platform-espressif32.zip +platform = https://github.com/tasmota/platform-espressif32/releases/download/2023.11.01/platform-espressif32.zip platform_packages = build_unflags = ${esp32_defaults.build_unflags} build_flags = ${esp32_defaults.build_flags} + +[core32_30] +platform = https://github.com/tasmota/platform-espressif32/releases/download/2023.12.10/platform-espressif32.zip +platform_packages = +build_unflags = ${core32.build_unflags} +build_flags = ${core32.build_flags} diff --git a/platformio_tasmota_cenv_sample.ini b/platformio_tasmota_cenv_sample.ini index f3130cc9a..57b225ae4 100644 --- a/platformio_tasmota_cenv_sample.ini +++ b/platformio_tasmota_cenv_sample.ini @@ -1,3 +1,9 @@ +[tasmota] +; Reset global build / unbuild compile time flags for ALL Tasmota / Tasmota32 [env] +; since custom env are designed to enable options individual +build_unflags = +build_flags = + [env:tasmota-rangeextender] build_flags = ${env.build_flags} -DFIRMWARE_RANGE_EXTENDER @@ -39,6 +45,29 @@ build_flags = ${env:tasmota32_base.build_flags} -DUSE_LVGL_OPENHASP -DOTA_URL='""' +[env:tasmota32s3-opi_opi] +extends = env:tasmota32_base +board = esp32s3-opi_opi +board_build.f_cpu = 240000000L +board_build.f_flash = 80000000L +build_flags = ${env:tasmota32_base.build_flags} + -DUSE_BERRY_ULP + -DFIRMWARE_LVGL + -DUSE_LVGL_OPENHASP + -DOTA_URL='""' + +[env:tasmota32s3cdc-opi_opi] +extends = env:tasmota32_base +board = esp32s3cdc-opi_opi +board_build.f_cpu = 240000000L +board_build.f_flash = 80000000L +build_flags = ${env:tasmota32_base.build_flags} + -DUSE_BERRY_ULP + -DFIRMWARE_LVGL + -DUSE_LVGL_OPENHASP + -DOTA_URL='""' + + ;*** Tasmota ESP32-C3 version before ROM revision 3 ;*** Actual used Arduino/IDF does not support this old revisions ;*** This build env is without any support, unexpected issues can happen @@ -73,6 +102,48 @@ lib_ignore = TTGO TWatch Library Micro-RTSP epdiy +[env:tasmota32-mi32] +extends = env:tasmota32_base +build_flags = ${env:tasmota32_base.build_flags} + -DFIRMWARE_BLUETOOTH + -DUSE_MI_EXT_GUI + -DOTA_URL='""' +lib_extra_dirs = lib/libesp32, lib/libesp32_div, lib/lib_basic, lib/lib_i2c, lib/lib_div, lib/lib_ssl +lib_ignore = ESP8266Audio + ESP8266SAM + TTGO TWatch Library + Micro-RTSP + epdiy + NimBLE-Arduino + +[env:tasmota32c3-mi32] +extends = env:tasmota32c3 +build_flags = ${env:tasmota32_base.build_flags} + -DFIRMWARE_BLUETOOTH + -DUSE_MI_EXT_GUI + -DOTA_URL='""' +lib_extra_dirs = lib/libesp32, lib/libesp32_div, lib/lib_basic, lib/lib_i2c, lib/lib_div, lib/lib_ssl +lib_ignore = ESP8266Audio + ESP8266SAM + TTGO TWatch Library + Micro-RTSP + epdiy + NimBLE-Arduino + +[env:tasmota32s3-mi32] +extends = env:tasmota32s3 +build_flags = ${env:tasmota32_base.build_flags} + -DFIRMWARE_BLUETOOTH + -DUSE_MI_EXT_GUI + -DOTA_URL='""' +lib_extra_dirs = lib/libesp32, lib/libesp32_div, lib/lib_basic, lib/lib_i2c, lib/lib_div, lib/lib_ssl +lib_ignore = ESP8266Audio + ESP8266SAM + TTGO TWatch Library + Micro-RTSP + epdiy + NimBLE-Arduino + ; *** Debug version used for PlatformIO Home Project Inspection [env:tasmota-debug] build_type = debug diff --git a/platformio_tasmota_core3_env_sample.ini b/platformio_tasmota_core3_env_sample.ini index d1c63bfcf..e022bf70c 100644 --- a/platformio_tasmota_core3_env_sample.ini +++ b/platformio_tasmota_core3_env_sample.ini @@ -1,60 +1,19 @@ -[platformio] -; *** Build/upload environments for ESP32 Arduino Core 3.0 - -; *** Uncomment the line below and one or more env to select version(s) -;default_envs = -; tasmota32-arduino30 -; tasmota32solo1-arduino30 -; tasmota32-odroid30 -; tasmota32s2-arduino30 -; tasmota32s2cdc-arduino30 -; tasmota32s3-arduino30 -; tasmota32s3-qio_opi-ard30 -; tasmota32s3cdc-qio_opi-ard30 -; tasmota32s3cdc-webcam3 -; tasmota32c2-arduino30 -; tasmota32c3-arduino30 -; tasmota32c3cdc-arduino30 -; tasmota32c6-arduino30 -; tasmota32c6cdc-arduino30 -; tasmota32c2-safeboot -; tasmota32c6-safeboot -; tasmota32c6cdc-safeboot - -[core32_30] -platform = https://github.com/tasmota/platform-espressif32/releases/download/2023.10.10/platform-espressif32.zip -platform_packages = - -build_unflags = ${core32.build_unflags} -build_flags = ${core32.build_flags} - -[core32_30_flags] -build_unflags = ${core32_30.build_unflags} -build_flags = ${core32_30.build_flags} -lib_extra_dirs = lib/lib_ssl, lib/lib_basic, lib/lib_i2c, lib/lib_div, lib/lib_audio, lib/lib_display, lib/lib_rf, lib/libesp32, lib/libesp32_div, lib/libesp32_lvgl -lib_ignore = - HTTPUpdateServer - USB - SPIFFS - ESP32 Async UDP - NetBIOS - Preferences - BluetoothSerial - ArduinoOTA - IRremoteESP8266 - ESP32-HomeKit - NimBLE-Arduino +[tasmota] +; *** Global build / unbuild compile time flags for ALL Tasmota / Tasmota32 [env] +;build_unflags = +build_flags = -DUSE_BERRY_PARTITION_WIZARD [env:arduino30] framework = ${common.framework} platform = ${core32_30.platform} platform_packages = ${core32_30.platform_packages} board_build.filesystem = ${common.board_build.filesystem} +board_build.variants_dir = variants/tasmota_ard3 custom_unpack_dir = ${common.custom_unpack_dir} board = esp32 monitor_speed = 115200 upload_resetmethod = ${common.upload_resetmethod} -extra_scripts = ${esp32_defaults.extra_scripts} +extra_scripts = ${core32_30_flags.extra_scripts} build_unflags = ${core32_30_flags.build_unflags} build_flags = ${core32_30_flags.build_flags} lib_ldf_mode = ${common.lib_ldf_mode} @@ -63,14 +22,12 @@ lib_extra_dirs = ${core32_30_flags.lib_extra_dirs} lib_ignore = ${core32_30_flags.lib_ignore} - [env:tasmota32-arduino30] extends = env:arduino30 board = esp32 build_unflags = ${env:arduino30.build_unflags} build_flags = ${env:arduino30.build_flags} -DFIRMWARE_ARDUINO30 - -DUSE_MATTER_DEVICE monitor_filters = esp32_exception_decoder lib_ignore = ${env:arduino30.lib_ignore} @@ -80,11 +37,11 @@ board = esp32_solo1 build_unflags = ${env:arduino30.build_unflags} build_flags = ${env:arduino30.build_flags} -DFIRMWARE_ARDUINO30 - -DUSE_MATTER_DEVICE monitor_filters = esp32_exception_decoder lib_ignore = ${env:arduino30.lib_ignore} -[env:tasmota32-odroid30] +; *** ESP32 rev.0/1 with PSRAM needs a fix for faulty PSRAM ROM code +[env:tasmota32-psramfix_ard3] extends = env:arduino30 board = esp32-fix board_build.f_cpu = 240000000L @@ -140,8 +97,6 @@ board = esp32s3-qio_qspi build_unflags = ${env:arduino30.build_unflags} build_flags = ${env:arduino30.build_flags} -DFIRMWARE_ARDUINO30 - -DUSE_MI_HOMEKIT=0 ; 1 to enable; 0 to disable - -DUSE_MI_ESP32 monitor_filters = esp32_exception_decoder lib_ignore = ${env:arduino30.lib_ignore} @@ -166,7 +121,6 @@ build_unflags = ${env:arduino30.build_unflags} -DUSE_IPV6 -mtarget-align build_flags = ${env:arduino30.build_flags} - -DFIRMWARE_ARDUINO30 -DOTA_URL='""' monitor_filters = esp32_exception_decoder lib_ignore = ${env:arduino30.lib_ignore} @@ -175,14 +129,9 @@ lib_ignore = ${env:arduino30.lib_ignore} extends = env:arduino30 board = esp32c2 build_unflags = ${env:arduino30.build_unflags} - -flto -mtarget-align build_flags = ${env:arduino30.build_flags} -DFIRMWARE_ARDUINO30 - -DUSE_MATTER_DEVICE - ;-DUSE_MI_HOMEKIT=0 ; 1 to enable; 0 to disable - ;-DUSE_MI_ESP32 - -fno-lto -DOTA_URL='""' monitor_filters = esp32_exception_decoder lib_ignore = ${env:arduino30.lib_ignore} @@ -191,13 +140,9 @@ lib_ignore = ${env:arduino30.lib_ignore} extends = env:arduino30 board = esp32c3 build_unflags = ${env:arduino30.build_unflags} - -flto -mtarget-align build_flags = ${env:arduino30.build_flags} -DFIRMWARE_ARDUINO30 - -DUSE_MI_HOMEKIT=0 ; 1 to enable; 0 to disable - -DUSE_MI_ESP32 - -fno-lto monitor_filters = esp32_exception_decoder lib_ignore = ${env:arduino30.lib_ignore} @@ -205,11 +150,9 @@ lib_ignore = ${env:arduino30.lib_ignore} extends = env:arduino30 board = esp32c3cdc build_unflags = ${env:arduino30.build_unflags} - -flto -mtarget-align build_flags = ${env:arduino30.build_flags} -DFIRMWARE_ARDUINO30 - -fno-lto monitor_filters = esp32_exception_decoder lib_ignore = ${env:arduino30.lib_ignore} @@ -217,12 +160,9 @@ lib_ignore = ${env:arduino30.lib_ignore} extends = env:arduino30 board = esp32c6 build_unflags = ${env:arduino30.build_unflags} - -flto -mtarget-align build_flags = ${env:arduino30.build_flags} - -fno-lto -DFIRMWARE_ARDUINO30 - -DUSE_MATTER_DEVICE -DOTA_URL='""' monitor_filters = esp32_exception_decoder lib_ignore = ${env:arduino30.lib_ignore} @@ -231,12 +171,21 @@ lib_ignore = ${env:arduino30.lib_ignore} extends = env:arduino30 board = esp32c6cdc build_unflags = ${env:arduino30.build_unflags} - -flto -mtarget-align build_flags = ${env:arduino30.build_flags} - -fno-lto -DFIRMWARE_ARDUINO30 - -DUSE_MATTER_DEVICE + -DOTA_URL='""' +monitor_filters = esp32_exception_decoder +lib_ignore = ${env:arduino30.lib_ignore} + +[env:tasmota32c6cdc-mi32_ard3] +extends = env:arduino30 +board = esp32c6cdc +build_unflags = ${env:arduino30.build_unflags} + -mtarget-align +build_flags = ${env:arduino30.build_flags} + -DFIRMWARE_BLUETOOTH + -DUSE_MI_EXT_GUI -DOTA_URL='""' monitor_filters = esp32_exception_decoder lib_ignore = ${env:arduino30.lib_ignore} diff --git a/platformio_tasmota_env32.ini b/platformio_tasmota_env32.ini index bea48c5a6..5b62e0bc6 100644 --- a/platformio_tasmota_env32.ini +++ b/platformio_tasmota_env32.ini @@ -4,6 +4,7 @@ platform = ${core32.platform} platform_packages = ${core32.platform_packages} board_build.filesystem = ${common.board_build.filesystem} custom_unpack_dir = ${common.custom_unpack_dir} +board_build.variants_dir = ${common.board_build.variants_dir} board = esp32 monitor_speed = ${common.monitor_speed} monitor_echo = ${common.monitor_echo} diff --git a/tasmota/berry/haspmota_src/haspmota_core/haspmota.be b/tasmota/berry/haspmota_src/haspmota_core/haspmota.be index 17ddd2f02..a960af47b 100644 --- a/tasmota/berry/haspmota_src/haspmota_core/haspmota.be +++ b/tasmota/berry/haspmota_src/haspmota_core/haspmota.be @@ -44,11 +44,11 @@ var haspmota = module("haspmota") ################################################################################# ################################################################################# class lvh_obj - static _lv_class = lv.obj # _lv_class refers to the lvgl class encapsulated, and is overriden by subclasses - static _lv_part2_selector # selector for secondary part (like knob of arc) + static var _lv_class = lv.obj # _lv_class refers to the lvgl class encapsulated, and is overriden by subclasses + static var _lv_part2_selector # selector for secondary part (like knob of arc) # attributes to ignore when set at object level (they are managed by page) - static _attr_ignore = [ + static var _attr_ignore = [ "tostring", # avoid issues with Berry `tostring` method # "id", "obj", @@ -68,7 +68,7 @@ class lvh_obj # Ex: HASPmota attribute `w` is mapped to LVGL `width` # # If mapping is null, we use set_X and get_X from our own class - static _attr_map = { + static var _attr_map = { "x": "x", "y": "y", "w": "width", @@ -378,17 +378,17 @@ class lvh_obj end #==================================================================== - # `enabled` attributes mapped to OBJ_FLAG_CLICKABLE + # `enabled` attributes mapped to STATE_DISABLED #==================================================================== def set_enabled(h) if h - self._lv_obj.add_flag(lv.OBJ_FLAG_CLICKABLE) + self._lv_obj.clear_state(lv.STATE_DISABLED) else - self._lv_obj.clear_flag(lv.OBJ_FLAG_CLICKABLE) + self._lv_obj.add_state(lv.STATE_DISABLED) end end def get_enabled() - return self._lv_obj.has_flag(lv.OBJ_FLAG_CLICKABLE) + return !self._lv_obj.has_state(lv.STATE_DISABLED) end #==================================================================== @@ -400,17 +400,18 @@ class lvh_obj #==================================================================== # line_width #==================================================================== - def set_line_width(t) - self._lv_obj.set_style_line_width(int(t), 0 #- lv.PART_MAIN | lv.STATE_DEFAULT -#) + def set_line_width(t, style_modifier) + self._lv_obj.set_style_line_width(int(t), style_modifier) end - def get_line_width() - return self._lv_obj.get_style_line_width(0 #- lv.PART_MAIN | lv.STATE_DEFAULT -#) + def get_line_width(style_modifier) + return self._lv_obj.get_style_line_width(style_modifier) end #==================================================================== # `toggle` attributes mapped to STATE_CHECKED #==================================================================== def set_toggle(t) + import string if type(t) == 'string' t = string.toupper(str(t)) if t == "TRUE" t = true @@ -581,11 +582,11 @@ class lvh_obj #==================================================================== # `text_color` #==================================================================== - def set_text_color(t) - self._lv_obj.set_style_text_color(self.parse_color(t), 0 #- lv.PART_MAIN | lv.STATE_DEFAULT -#) + def set_text_color(t, style_modifier) + self._lv_obj.set_style_text_color(self.parse_color(t), style_modifier) end - def get_text_color() - return self._lv_obj.get_style_text_color(0 #- lv.PART_MAIN | lv.STATE_DEFAULT -#) + def get_text_color(style_modifier) + return self._lv_obj.get_style_text_color(style_modifier) end def set_value_color(t) self.set_text_color(t) end def get_value_color() return self.get_value_color() end @@ -684,6 +685,99 @@ class lvh_obj end end + #- ------------------------------------------------------------# + # `digits_to_style` + # + # Convert a 2 digits style descriptor to LVGL style modifier + # See https://www.openhasp.com/0.6.3/design/styling/ + # + # + # 00 = main part of the object (i.e. the background) + # 10 = the indicator or needle, highlighting the the current value + # 20 = the knob which can be used the change the value + # 30 = the background of the items/buttons + # 40 = the items/buttons + # 50 = the selected item + # 60 = major ticks of the gauge object + # 70 = the text cursor + # 80 = the scrollbar + # 90 = other special part, not listed above + # + # LV_PART_MAIN = 0x000000, /**< A background like rectangle*/ + # LV_PART_SCROLLBAR = 0x010000, /**< The scrollbar(s)*/ + # LV_PART_INDICATOR = 0x020000, /**< Indicator, e.g. for slider, bar, switch, or the tick box of the checkbox*/ + # LV_PART_KNOB = 0x030000, /**< Like handle to grab to adjust the value*/ + # LV_PART_SELECTED = 0x040000, /**< Indicate the currently selected option or section*/ + # LV_PART_ITEMS = 0x050000, /**< Used if the widget has multiple similar elements (e.g. table cells)*/ + # LV_PART_TICKS = 0x060000, /**< Ticks on scale e.g. for a chart or meter*/ + # LV_PART_CURSOR = 0x070000, /**< Mark a specific place e.g. for text area's cursor or on a chart*/ + # LV_PART_CUSTOM_FIRST = 0x080000, /**< Extension point for custom widgets*/ + # LV_PART_ANY = 0x0F0000, /**< Special value can be used in some functions to target all parts*/ + # + # 00 = default styling + # 01 = styling for toggled state + # 02 = styling for pressed, not toggled state + # 03 = styling for pressed and toggled state + # 04 = styling for disabled not toggled state + # 05 = styling for disabled and toggled state + # + # LV_STATE_DEFAULT = 0x0000, + # LV_STATE_CHECKED = 0x0001, + # LV_STATE_FOCUSED = 0x0002, + # LV_STATE_FOCUS_KEY = 0x0004, + # LV_STATE_EDITED = 0x0008, + # LV_STATE_HOVERED = 0x0010, + # LV_STATE_PRESSED = 0x0020, + # LV_STATE_SCROLLED = 0x0040, + # LV_STATE_DISABLED = 0x0080, + + # LV_STATE_USER_1 = 0x1000, + # LV_STATE_USER_2 = 0x2000, + # LV_STATE_USER_3 = 0x4000, + # LV_STATE_USER_4 = 0x8000, + # + #- ------------------------------------------------------------# + static var _digit2part = [ + lv.PART_MAIN, # 00 + lv.PART_INDICATOR, # 10 + lv.PART_KNOB, # 20 + lv.PART_ITEMS, # 30 TODO + lv.PART_ITEMS, # 40 + lv.PART_SELECTED, # 50 + lv.PART_TICKS, # 60 + lv.PART_CURSOR, # 70 + lv.PART_SCROLLBAR, # 80 + lv.PART_CUSTOM_FIRST, # 90 + ] + static var _digit2state = [ + lv.STATE_DEFAULT, # 00 + lv.STATE_CHECKED, # 01 + lv.STATE_PRESSED, # 02 + lv.STATE_CHECKED | lv.STATE_PRESSED, # 03 + lv.STATE_DISABLED, # 04 + lv.STATE_DISABLED | lv.STATE_PRESSED, # 05 + ] + def digits_to_style(digits) + if digits == nil return 0 end # lv.PART_MAIN | lv.STATE_DEFAULT + var first_digit = (digits / 10) % 10 + var second_digit = digits % 10 + var val = 0 # lv.PART_MAIN | lv.STATE_DEFAULT + if first_digit >= 0 && first_digit < size(self._digit2part) + val = val | self._digit2part[first_digit] + else + val = nil + end + if second_digit >= 0 && second_digit < size(self._digit2state) + val = val | self._digit2state[second_digit] + else + val = nil + end + if val == nil + raise "value_error", f"invalid style suffix {digits:02i}" + end + return val + end + #- ------------------------------------------------------------# # Internal utility functions # @@ -698,14 +792,31 @@ class lvh_obj # print("> getmember", k) var prefix = k[0..3] - if prefix == "set_" || prefix == "get_" return end + if prefix == "set_" || prefix == "get_" return end # avoid recursion + + # check if the attribute ends with 2 digits, if so remove the two suffix digits + var style_modifier = 0 + if size(k) >= 3 + var char_last_1 = string.byte(k[-1]) + var char_last_2 = string.byte(k[-2]) + var suffix_digits = nil + if (char_last_1 >= 0x30 && char_last_1 <= 0x39 && char_last_2 >= 0x30 && char_last_2 <= 0x39) + # we extract the last 2 digits + suffix_digits = int(k[-2..]) + k = k [0..-3] # remove 2 last digits + end + style_modifier = self.digits_to_style(suffix_digits) + end + # print(f">>>: getmember {k=} {style_modifier=}") + # if attribute name is in ignore list, abort if self._attr_ignore.find(k) != nil return end # first check if there is a method named `get_X()` var f = introspect.get(self, "get_" + k) # call self method if type(f) == 'function' - return f(self) + # print(f">>>: getmember local method get_{k}") + return f(self, style_modifier) end # next check if there is a mapping to an LVGL attribute @@ -715,9 +826,11 @@ class lvh_obj f = introspect.get(self._lv_obj, "get_" + kv) if type(f) == 'function' # found and function, call it if string.find(kv, "style_") == 0 + # print(f">>>: getmember style_ method get_{k}") # style function need a selector as second parameter - return f(self._lv_obj, 0 #- lv.PART_MAIN | lv.STATE_DEFAULT -#) + return f(self._lv_obj, style_modifier) else + # print(f">>>: getmember standard method get_{k}") return f(self._lv_obj) end end @@ -734,17 +847,33 @@ class lvh_obj import string import introspect - # print("> setmember", k, v) + # print(">>>: setmember", k, v) var prefix = k[0..3] - if prefix == "set_" || prefix == "get_" return end + if prefix == "set_" || prefix == "get_" return end # avoid infinite loop + + # check if the attribute ends with 2 digits, if so remove the two suffix digits + var style_modifier = 0 + if size(k) >= 3 + var char_last_1 = string.byte(k[-1]) + var char_last_2 = string.byte(k[-2]) + var suffix_digits = nil + if (char_last_1 >= 0x30 && char_last_1 <= 0x39 && char_last_2 >= 0x30 && char_last_2 <= 0x39) + # we extract the last 2 digits + suffix_digits = int(k[-2..]) + k = k [0..-3] # remove 2 last digits + end + style_modifier = self.digits_to_style(suffix_digits) + end + # print(f">>>: setmember {k=} {style_modifier=}") + # if attribute name is in ignore list, abort if self._attr_ignore.find(k) != nil return end - # first check if there is a method named `set_X()` var f = introspect.get(self, "set_" + k) if type(f) == 'function' - f(self, v) + # print(f">>>: setmember local method set_{k}") + f(self, v, style_modifier) return end @@ -761,9 +890,11 @@ class lvh_obj if type(f) == 'function' try if string.find(kv, "style_") == 0 + # print(f">>>: setmember style_ method set_{k}") # style function need a selector as second parameter - f(self._lv_obj, v, 0 #- lv.PART_MAIN | lv.STATE_DEFAULT -#) + f(self._lv_obj, v, style_modifier) else + # print(f">>>: setmember standard method set_{k}") f(self._lv_obj, v) end except .. as e, m @@ -893,14 +1024,14 @@ class lvh_obj end end - var format = self._text_rule_format - if type(format) == 'string' - format = format(format, val) + var fmt = self._text_rule_format + if type(fmt) == 'string' + fmt = format(fmt, val) else - format = "" + fmt = "" end - self.text = format + self.text = fmt return false # propagate the event further end end @@ -931,11 +1062,11 @@ class lvh_arc : lvh_obj static _lv_part2_selector = lv.PART_KNOB # line_width converts to arc_width - def set_line_width(t) - self._lv_obj.set_style_arc_width(int(t), 0 #- lv.PART_MAIN | lv.STATE_DEFAULT -#) + def set_line_width(t, style_modifier) + self._lv_obj.set_style_arc_width(int(t), style_modifier) end - def get_line_width() - return self._lv_obj.get_arc_line_width(0 #- lv.PART_MAIN | lv.STATE_DEFAULT -#) + def get_line_width(style_modifier) + return self._lv_obj.get_arc_line_width(style_modifier) end def set_line_width1(t) self._lv_obj.set_style_arc_width(int(t), lv.PART_INDICATOR | lv.STATE_DEFAULT) @@ -984,24 +1115,6 @@ class lvh_switch : lvh_obj def get_val() return self.get_toggle() end - def set_bg_color10(t) - self._lv_obj.set_style_bg_color(self.parse_color(t), lv.PART_INDICATOR | lv.STATE_CHECKED) - end - def set_bg_color20(t) - self._lv_obj.set_style_bg_color(self.parse_color(t), lv.PART_KNOB | lv.STATE_DEFAULT) - end - def set_radius20(t) - self._lv_obj.set_style_radius(int(t), lv.PART_KNOB | lv.STATE_DEFAULT) - end - def get_bg_color10() - return self._lv_obj.get_style_bg_color(lv.PART_INDICATOR) - end - def get_bg_color20() - return self._lv_obj.get_style_bg_color(lv.PART_KNOB) - end - def get_radius20() - return self._lv_obj.get_style_radius(lv.PART_KNOB) - end end #==================================================================== @@ -1207,13 +1320,20 @@ class lvh_dropdown : lvh_obj end end +class lvh_bar : lvh_obj + static _lv_class = lv.bar + + def set_val(t) + self._lv_obj.set_value(t, lv.ANIM_OFF) + end +end + ################################################################################# # # All other subclasses than just map the LVGL object # and doesn't have any specific behavior # ################################################################################# -class lvh_bar : lvh_obj static _lv_class = lv.bar end class lvh_btn : lvh_obj static _lv_class = lv.btn end class lvh_btnmatrix : lvh_obj static _lv_class = lv.btnmatrix end class lvh_checkbox : lvh_obj static _lv_class = lv.checkbox end @@ -1847,4 +1967,5 @@ haspmota.init = def (m) # `init(m)` is called during first `import haspm return oh() end +global.haspmota = haspmota return haspmota diff --git a/tasmota/berry/leds/leds_animate_demo_palette_background.be b/tasmota/berry/leds/leds_animate_demo_palette_background.be new file mode 100644 index 000000000..1e1681000 --- /dev/null +++ b/tasmota/berry/leds/leds_animate_demo_palette_background.be @@ -0,0 +1,51 @@ +# +# Example for M5Stack Led Matrix +# 5 x 5 WS2812 +# +import animate +class Background_demo : Leds_animator + static var PALETTE_STANDARD_TAG = bytes( + "40" "FF0000" # red + "40" "FFA500" # orange + "40" "FFFF00" # yellow + "40" "00EE00" # green + "40" "0000FF" # blue + "40" "4B00FF" # indigo + "40" "FF82FF" # violet + "00" "FF0000" # red + ) + + static var PALETTE_RAINBOW_WHITE = bytes( + "50" "FF0000" # red + "30" "FF0000" # red + "50" "FFA500" # orange + "30" "FFA500" # orange + "50" "FFFF00" # yellow + "30" "FFFF00" # yellow + "50" "00FF00" # green + "30" "00FF00" # green + "50" "0000FF" # blue + "30" "0000FF" # blue + "50" "FF00FF" # indigo + "30" "FF00FF" # indigo + "50" "FFFFFF" # white + "30" "FFFFFF" # white + "00" "FF0000" # red + ) + + # duration in seconds + def init(strip, duration) + import animate + super(self).init(strip) + # var pal = animate.palette(self.PALETTE_STANDARD_TAG, duration) + var pal = animate.palette(self.PALETTE_RAINBOW_WHITE, duration) + self.add_background_animator(pal) + end + + def animate() + end +end + +var strip = Leds(5 * 5, gpio.pin(gpio.WS2812, 0)) +var r = Background_demo(strip, 20) +r.start() diff --git a/tasmota/berry/leds/rainbow.be b/tasmota/berry/leds/rainbow.be index bf3801556..d29720c93 100644 --- a/tasmota/berry/leds/rainbow.be +++ b/tasmota/berry/leds/rainbow.be @@ -106,7 +106,7 @@ end #- var strip = Leds.matrix(5,5, gpio.pin(gpio.WS2812, 1)) -var r = Rainbow_Matrix(strip, 0.5) +var r = Rainbow_stripes(strip, 0.5) r.start() -# @@ -182,4 +182,4 @@ var strip = Leds.matrix(5,5, gpio.pin(gpio.WS2812, 1)) var r = Round(strip, 2, 30) r.start() --# \ No newline at end of file +-# diff --git a/tasmota/berry/modules/Partition_Wizard/partition_wizard.bec b/tasmota/berry/modules/Partition_Wizard/partition_wizard.bec new file mode 100644 index 000000000..e6e829533 Binary files /dev/null and b/tasmota/berry/modules/Partition_Wizard/partition_wizard.bec differ diff --git a/tasmota/displaydesc/ST7735S_128x128_Red_display.ini b/tasmota/displaydesc/ST7735S_128x128_Red_display.ini new file mode 100644 index 000000000..3c4c38b00 --- /dev/null +++ b/tasmota/displaydesc/ST7735S_128x128_Red_display.ini @@ -0,0 +1,34 @@ +:H,ST7735S,128,128,16,SPI,3,*,*,*,*,*,*,*,40 +:I +01,80 +11,80 +B1,3,01,2C,2D +B2,3,01,2C,2D +B3,3,01,2C,2D +B4,1,07 +C0,3,A2,02,84 +C1,1,C5 +C2,2,0A,00 +C3,2,8A,2A +C4,2,8A,EE +C5,1,0E +36,1,C8 +E0,10,02,1C,07,12,37,32,29,2D,29,25,2B,39,00,01,03,10 +E1,10,03,1D,07,06,2E,2C,29,2D,2E,2E,37,3F,00,00,02,10 +2A,4,00,00,00,7F +2B,4,00,00,00,7F +3A,1,05 +13,80 +2C,80 +29,80 +:o,28 +:O,29 +:A,2A,2B,2C,16 +:R,36 +:0,08,02,03,00 +:1,68,03,02,01 +:2,C8,02,03,02 +:3,A8,03,02,03 +:i,20,21 +:B,60,1 +# diff --git a/tasmota/include/i18n.h b/tasmota/include/i18n.h index 6bf37dd97..e5cdb2f61 100644 --- a/tasmota/include/i18n.h +++ b/tasmota/include/i18n.h @@ -302,6 +302,7 @@ #define D_CMND_GPIO "GPIO" #define D_JSON_NOT_SUPPORTED "Not supported" #define D_CMND_GPIOS "GPIOs" +#define D_CMND_GPIOREAD "GPIORead" #define D_CMND_PWM "PWM" #define D_CMND_PWMFREQUENCY "PWMFrequency" #define D_CMND_PWMRANGE "PWMRange" @@ -444,6 +445,7 @@ #define D_CMND_WEBQUERY "WebQuery" #define D_CMND_WEBCOLOR "WebColor" #define D_CMND_WEBBUTTON "WebButton" +#define D_CMND_WEBCANVAS "WebCanvas" #define D_CMND_WEBTIME "WebTime" #define D_CMND_WEBSENSOR "WebSensor" #define D_CMND_WEBGETCONFIG "WebGetConfig" diff --git a/tasmota/include/tasconsole.h b/tasmota/include/tasconsole.h new file mode 100644 index 000000000..ccb3ea93e --- /dev/null +++ b/tasmota/include/tasconsole.h @@ -0,0 +1,110 @@ +/* + tasconsole.h - ESP32 tasconsole driver for Tasmota + + SPDX-FileCopyrightText: 2023 Christian Baars (@staars) + + SPDX-License-Identifier: GPL-3.0-only +*/ + +#include + +class TASCONSOLE { + + struct Concept { + virtual ~Concept() = default; + virtual int available() = 0; + virtual void begin(uint32_t) = 0; + virtual void flush() = 0; + virtual size_t println() = 0; + virtual size_t print(char *) = 0; + virtual size_t printf(const char*, char *, const char*&, const char*&, const char*&) = 0; + virtual size_t printf(char *) = 0; + virtual size_t read() = 0; + virtual size_t setRxBufferSize(size_t) = 0; + }; + +public: + template + TASCONSOLE(T&& obj){ + object = std::make_unique>(std::forward(obj)); + } + + int available() { + return object->available(); + } + + void begin(uint32_t baud) { + object->begin(baud); + } + + void flush() { + object->flush(); + } + + size_t println() { + return object->println(); + } + + size_t print(char * string) { + return object->print(string); + } + + size_t printf(char *format) { + return object->printf(format); + } + + size_t printf(const char* a, char * b, const char*& c, const char*& d, const char*& f){ + return object->printf(a,b,c,d,f); + } + + size_t read() { + return object->read(); + } + + size_t setRxBufferSize(size_t rx_queue_len) { + return object->setRxBufferSize(rx_queue_len); + } + + template< typename T > + struct Model : Concept { + Model(T const& t) : object(t) {} + int available() override { + return object.available(); + } + + void begin(uint32_t baud) override { + object.begin(baud); + } + + void flush() override { + object.flush(); + } + + size_t println() override { + return object.println(); + } + size_t print(char * string) override { + return object.print(string); + } + + size_t printf(char *format) override { + return object.printf(format); + } + + size_t printf(const char* a, char * b, const char*& c, const char*& d, const char*& f) override { + return object.printf(a,b,c,d,f); + } + + size_t read() override { + return object.read(); + } + + size_t setRxBufferSize(size_t size) override { + return object.setRxBufferSize(size); + } + private: + T object; + }; + + std::unique_ptr object; +}; diff --git a/tasmota/include/tasmota.h b/tasmota/include/tasmota.h index 708e015d9..d6ff4b2b7 100644 --- a/tasmota/include/tasmota.h +++ b/tasmota/include/tasmota.h @@ -143,7 +143,7 @@ const uint8_t MAX_SWITCHES_TXT = 8; // Max number of switches user text const uint8_t MAX_SWITCHES_TXT = 28; // Max number of switches user text #endif // ESP32 -const uint8_t MAX_HUE_DEVICES = 15; // Max number of Philips Hue device per emulation +const uint8_t MAX_HUE_DEVICES = 32; // Max number of Philips Hue device per emulation const uint8_t MAX_ROTARIES = 2; // Max number of Rotary Encoders const char MQTT_TOKEN_PREFIX[] PROGMEM = "%prefix%"; // To be substituted by mqtt_prefix[x] @@ -484,6 +484,7 @@ enum SettingsTextIndex { SET_OTAURL, SET_SHD_PARAM, SET_RGX_SSID, SET_RGX_PASSWORD, SET_INFLUXDB_HOST, SET_INFLUXDB_PORT, SET_INFLUXDB_ORG, SET_INFLUXDB_TOKEN, SET_INFLUXDB_BUCKET, SET_INFLUXDB_RP, + SET_CANVAS, SET_MAX, // limit of texts stored in Settings // Index above are not stored in Settings and should be handled specifically in SettingText() SET_BUTTON17, SET_BUTTON18, SET_BUTTON19, SET_BUTTON20, SET_BUTTON21, SET_BUTTON22, SET_BUTTON23, SET_BUTTON24, diff --git a/tasmota/include/tasmota_configurations.h b/tasmota/include/tasmota_configurations.h index a572440f6..b55626794 100644 --- a/tasmota/include/tasmota_configurations.h +++ b/tasmota/include/tasmota_configurations.h @@ -823,7 +823,7 @@ #undef USE_HRE // Disable support for Badger HR-E Water Meter (+1k4 code) #undef USE_A4988_STEPPER // Disable support for A4988_Stepper #undef USE_PROMETHEUS // Disable support for https://prometheus.io/ metrics exporting over HTTP /metrics endpoint -#undef USE_NEOPOOL // Disable support for Sugar Valley NeoPool Controller - also known under brands Hidrolife, Aquascenic, Oxilife, Bionet, Hidroniser, UVScenic, Station, Brilix, Bayrol and Hay (+6k flash, +60 mem) +#undef USE_NEOPOOL // Disable support for Sugar Valley NeoPool Controller - also known under brands Hidrolife, Aquascenic, Oxilife, Bionet, Hidroniser, UVScenic, Station, Brilix, Bayrol and Hay (+14k flash, +120 mem) #undef USE_THERMOSTAT // Disable support for Thermostat #undef DEBUG_THEO // Disable debug code #undef USE_DEBUG_DRIVER // Disable debug code diff --git a/tasmota/include/tasmota_configurations_ESP32.h b/tasmota/include/tasmota_configurations_ESP32.h index 975ad6e9d..4a9716d16 100644 --- a/tasmota/include/tasmota_configurations_ESP32.h +++ b/tasmota/include/tasmota_configurations_ESP32.h @@ -200,30 +200,7 @@ #define CODE_IMAGE_STR "arduino30" #endif - -#undef FIRMWARE_LITE // Disable tasmota-lite with no sensors -#undef FIRMWARE_SENSORS // Disable tasmota-sensors with useful sensors enabled -#undef FIRMWARE_KNX_NO_EMULATION // Disable tasmota-knx with KNX but without Emulation -#undef FIRMWARE_DISPLAYS // Disable tasmota-display with display drivers enabled -#undef FIRMWARE_IR // Disable tasmota-ir with IR full protocols activated -#undef FIRMWARE_WEBCAM -#undef FIRMWARE_BLUETOOTH -#undef FIRMWARE_LVGL -#undef FIRMWARE_TASMOTA32 - - -// -- Optional modules ---------------------------- -#undef USE_SHUTTER // Disable Shutter support for up to 4 shutter with different motortypes (+6k code) - -#undef USE_IR_REMOTE // Disable IR driver -#undef USE_AC_ZERO_CROSS_DIMMER // Disable support for AC_ZERO_CROSS_DIMMER - -#define USE_TLS -#define USE_WEBSERVER -#define USE_WEBCLIENT -#define USE_WEBCLIENT_HTTPS -#define USE_SERIAL_BRIDGE // Add support for software Serial Bridge console Tee (+2k code) -#define USE_ETHERNET +#define FIRMWARE_TASMOTA32 #endif // FIRMWARE_ARDUINO30 @@ -295,19 +272,17 @@ #define USE_SDCARD -#define USE_ADC +#ifndef USE_BERRY_ULP // potential performance gains with ULP + #define USE_ADC // so do not use common ADC funtions in that case +#endif //#undef USE_BERRY // Disable Berry scripting language -#if defined(USE_MI_HOMEKIT) // Switch between Homekit and full BLE driver - #define USE_MI_ESP32 - #if(USE_MI_HOMEKIT != 1) // Enable(1)/ Disable(0) Homekit, only for the .c-file - #undef USE_MI_HOMEKIT - #endif // disable USE_MI_HOMEKIT -#else - #define USE_ETHERNET // Add support for ethernet (+20k code) - #define USE_BLE_ESP32 // Enable full BLE driver + +#define USE_ETHERNET // Add support for ethernet (+20k code) +#ifndef USE_MI_EXT_GUI + #define USE_BLE_ESP32 // Enable full BLE driver #define USE_EQ3_ESP32 - #define USE_MI_ESP32 // (ESP32 only) Add support for ESP32 as a BLE-bridge (+9k2 mem, +292k flash) -#endif // enable USE_MI_HOMEKIT +#endif // USE_MI_EXT_GUI +#define USE_MI_ESP32 // (ESP32 only) Add support for ESP32 as a BLE-bridge (+9k2 mem, +292k flash) #endif // FIRMWARE_BLUETOOTH diff --git a/tasmota/include/tasmota_globals.h b/tasmota/include/tasmota_globals.h index 3da0af66d..3fe15e195 100644 --- a/tasmota/include/tasmota_globals.h +++ b/tasmota/include/tasmota_globals.h @@ -74,7 +74,9 @@ String EthernetMacAddress(void); \*-------------------------------------------------------------------------------------------*/ // created in pio-tools/pre_source_dir.py -#if defined(CONFIG_TASMOTA_FLASHMODE_QIO) +#if defined(CONFIG_TASMOTA_FLASHMODE_OPI) + #define D_TASMOTA_FLASHMODE "OPI" +#elif (CONFIG_TASMOTA_FLASHMODE_QIO) #define D_TASMOTA_FLASHMODE "QIO" #elif defined(CONFIG_TASMOTA_FLASHMODE_QOUT) #define D_TASMOTA_FLASHMODE "QOUT" diff --git a/tasmota/include/tasmota_types.h b/tasmota/include/tasmota_types.h index a5fd504fe..7ed4dbab3 100755 --- a/tasmota/include/tasmota_types.h +++ b/tasmota/include/tasmota_types.h @@ -190,7 +190,7 @@ typedef union { // Restricted by MISRA-C Rule 18.4 bu uint32_t berry_light_scheme : 1; // bit 8 (v12.5.0.3) - SetOption154 - (Berry) Handle berry led using RMT0 as additional WS2812 scheme uint32_t zcfallingedge : 1; // bit 9 (v13.0.0.1) - SetOption155 - (ZCDimmer) Enable rare falling Edge dimmer instead of leading edge uint32_t sen5x_passive_mode : 1; // bit 10 (v13.1.0.1) - SetOption156 - (Sen5x) Run in passive mode when there is another I2C master (e.g. Ikea Vindstyrka), i.e. do not set up Sen5x sensor, higher polling interval - uint32_t spare11 : 1; // bit 11 + uint32_t neopool_outputsensitive : 1; // bit 11 (v13.2.0.1) - SetOption157 - (NeoPool) Output sensitive data (1) uint32_t spare12 : 1; // bit 12 uint32_t spare13 : 1; // bit 13 uint32_t spare14 : 1; // bit 14 diff --git a/tasmota/include/tasmota_version.h b/tasmota/include/tasmota_version.h index 6be0f698c..f1b6fc7ae 100644 --- a/tasmota/include/tasmota_version.h +++ b/tasmota/include/tasmota_version.h @@ -20,6 +20,6 @@ #ifndef _TASMOTA_VERSION_H_ #define _TASMOTA_VERSION_H_ -const uint32_t TASMOTA_VERSION = 0x0D020000; // 13.2.0.0 +const uint32_t TASMOTA_VERSION = 0x0D030000; // 13.3.0.0 #endif // _TASMOTA_VERSION_H_ diff --git a/tasmota/include/xsns_62_esp32_mi.h b/tasmota/include/xsns_62_esp32_mi.h index 69bc0c984..09413a9fa 100644 --- a/tasmota/include/xsns_62_esp32_mi.h +++ b/tasmota/include/xsns_62_esp32_mi.h @@ -141,6 +141,13 @@ struct ATCPacket_t{ //and PVVX }; }; +struct BLERingBufferItem_t{ + uint16_t returnCharUUID; + uint16_t handle; + uint32_t type; + uint8_t length; +}; + #pragma pack(0) @@ -158,22 +165,6 @@ struct MI32connectionContextBerry_t{ bool response; }; -struct MI32notificationBuffer_t{ - uint8_t buffer[256]; - uint16_t returnCharUUID; -}; - -struct BLEqueueBuffer_t{ - union{ - uint8_t *buffer; - int32_t value; - }; - size_t length; - uint16_t returnCharUUID; - uint16_t handle; - uint16_t type; -}; - struct { // uint32_t period; // set manually in addition to TELE-period, is set to TELE-period after start TaskHandle_t ScanTask = nullptr; @@ -235,6 +226,7 @@ struct { void *beServerCB; uint8_t *beAdvBuf; uint8_t infoMsg = 0; + uint8_t role = 0; } MI32; struct mi_sensor_t{ @@ -482,8 +474,14 @@ const char HTTP_MI32_SCRIPT_1[] PROGMEM = ; const char HTTP_MI32_STYLE[] PROGMEM = - ""; + ""; const char HTTP_MI32_STYLE_SVG[] PROGMEM = "" @@ -491,12 +489,15 @@ const char HTTP_MI32_STYLE_SVG[] PROGMEM = "" ; +const char HTTP_MI32_PARENT_BLE_ROLE[] PROGMEM = "None|Observer|Peripheral|Central"; + const char HTTP_MI32_PARENT_START[] PROGMEM = "
" - "

MI32 Bridge

" - "Observing %u devices
" - "Uptime: %u seconds
" - "Free Heap: %u kB" + "

MI32 Bridge

" + "Observing %u devices

" + "Uptime: %u seconds

" + "Free Heap: %u kB

" + "BLE Role: %s" "
"; const char HTTP_MI32_WIDGET[] PROGMEM = diff --git a/tasmota/language/af_AF.h b/tasmota/language/af_AF.h index c196f224f..95a4ff647 100644 --- a/tasmota/language/af_AF.h +++ b/tasmota/language/af_AF.h @@ -166,7 +166,6 @@ #define D_RESTART "Herbegin" #define D_RESTARTING "Herbegin" #define D_RESTART_REASON "Herlaai rede" -#define D_RESTORE "herstel" #define D_RETAINED "behou" #define D_RULE "Reël" #define D_SAVE "Stoor" @@ -192,7 +191,6 @@ #define D_TWILIGHT_ASTRONOMICAL "Astronomical" #define D_TWILIGHT_CIVIL "Civil" #define D_TWILIGHT_NAUTICAL "Nautical" -#define D_UPGRADE "opgradeer" #define D_UPLOAD "Laai op" #define D_UPTIME "Uptyd" #define D_USED "used" @@ -290,6 +288,7 @@ #define D_RESET_CONFIGURATION "Stel die konfigurasie terug" #define D_BACKUP_CONFIGURATION "Rugsteun die konfigurasie" #define D_RESTORE_CONFIGURATION "Herstel die konfigurasie" +#define D_START_RESTORE "Start restore" #define D_MAIN_MENU "Hoofkieslys" #define D_MODULE_PARAMETERS "Moduleparameters" @@ -547,6 +546,22 @@ #define D_DEVICE_INPUT "Invoer" #define D_DEVICE_OUTPUT "Uitvoer" +// xdrv_39_thermostat.ino +#define D_THERMOSTAT "Thermostat" +#define D_THERMOSTAT_SET_POINT "Set Point Temperature" +#define D_THERMOSTAT_SENSOR "Current Temperature" +#define D_THERMOSTAT_GRADIENT "Gradient Temperature" +#define D_THERMOSTAT_DUTY_CYCLE "Duty cycle" +#define D_THERMOSTAT_CYCLE_TIME "Cycle time" +#define D_THERMOSTAT_PI_AUTOTUNE "PI Auto tuning" +#define D_THERMOSTAT_CONTROL_METHOD "Control method" +#define D_THERMOSTAT_RAMP_UP "Ramp up" +#define D_THERMOSTAT_PI "PI" +#define D_THERMOSTAT_AUTOTUNE "Autotune" +#define D_THERMOSTAT_RAMP_UP_HYBRID "Ramp up (Hybrid)" +#define D_THERMOSTAT_PI_HYBRID "PI (Hybrid)" +#define D_THERMOSTAT_AUTOTUNE_HYBRID "Autotune (Hybrid)" + // xsns_05_ds18b20.ino #define D_SENSOR_BUSY "Sensor besig" #define D_SENSOR_CRC_ERROR "Sensor CRC fout" diff --git a/tasmota/language/bg_BG.h b/tasmota/language/bg_BG.h index 1702d9c4e..b7f00e51a 100644 --- a/tasmota/language/bg_BG.h +++ b/tasmota/language/bg_BG.h @@ -166,7 +166,6 @@ #define D_RESTART "Рестартиране" #define D_RESTARTING "Рестартиране" #define D_RESTART_REASON "Причина за рестарт" -#define D_RESTORE "възстановяване" #define D_RETAINED "запазено" #define D_RULE "Правило" #define D_SAVE "Запазване" @@ -192,7 +191,6 @@ #define D_TWILIGHT_ASTRONOMICAL "Astronomical" #define D_TWILIGHT_CIVIL "Civil" #define D_TWILIGHT_NAUTICAL "Nautical" -#define D_UPGRADE "Обновяване" #define D_UPLOAD "Качването е" #define D_UPTIME "Време на работа" #define D_USED "използвано" @@ -290,6 +288,7 @@ #define D_RESET_CONFIGURATION "Нулиране на настройки" #define D_BACKUP_CONFIGURATION "Резервно копие на настройки" #define D_RESTORE_CONFIGURATION "Възстановяване на настройки" +#define D_START_RESTORE "Start restore" #define D_MAIN_MENU "Начало" #define D_MODULE_PARAMETERS "Параметри на модула" @@ -547,6 +546,22 @@ #define D_DEVICE_INPUT "Вход" #define D_DEVICE_OUTPUT "Изход" +// xdrv_39_thermostat.ino +#define D_THERMOSTAT "Thermostat" +#define D_THERMOSTAT_SET_POINT "Set Point Temperature" +#define D_THERMOSTAT_SENSOR "Current Temperature" +#define D_THERMOSTAT_GRADIENT "Gradient Temperature" +#define D_THERMOSTAT_DUTY_CYCLE "Duty cycle" +#define D_THERMOSTAT_CYCLE_TIME "Cycle time" +#define D_THERMOSTAT_PI_AUTOTUNE "PI Auto tuning" +#define D_THERMOSTAT_CONTROL_METHOD "Control method" +#define D_THERMOSTAT_RAMP_UP "Ramp up" +#define D_THERMOSTAT_PI "PI" +#define D_THERMOSTAT_AUTOTUNE "Autotune" +#define D_THERMOSTAT_RAMP_UP_HYBRID "Ramp up (Hybrid)" +#define D_THERMOSTAT_PI_HYBRID "PI (Hybrid)" +#define D_THERMOSTAT_AUTOTUNE_HYBRID "Autotune (Hybrid)" + // xsns_05_ds18b20.ino #define D_SENSOR_BUSY "Датчикът DS18x20 е зает" #define D_SENSOR_CRC_ERROR "Датчик DS18x20 - грешка CRC" diff --git a/tasmota/language/ca_AD.h b/tasmota/language/ca_AD.h index e1681305b..4683b5c55 100644 --- a/tasmota/language/ca_AD.h +++ b/tasmota/language/ca_AD.h @@ -166,7 +166,6 @@ #define D_RESTART "Reinici" #define D_RESTARTING "Reinciant" #define D_RESTART_REASON "Raó de resinici" -#define D_RESTORE "recuperar" #define D_RETAINED "retingut" #define D_RULE "Regla" #define D_SAVE "Guardar" @@ -192,7 +191,6 @@ #define D_TWILIGHT_ASTRONOMICAL "Astronomical" #define D_TWILIGHT_CIVIL "Civil" #define D_TWILIGHT_NAUTICAL "Nautical" -#define D_UPGRADE "actualitza" #define D_UPLOAD "Envia" #define D_UPTIME "Temps engegat" #define D_USED "usat" @@ -290,6 +288,7 @@ #define D_RESET_CONFIGURATION "Reiniciar la Configuració" #define D_BACKUP_CONFIGURATION "Guardar la Configuració" #define D_RESTORE_CONFIGURATION "Restaurar la Configuració" +#define D_START_RESTORE "Start restore" #define D_MAIN_MENU "Menú Principal" #define D_MODULE_PARAMETERS "Paràmetes del Mòdul" @@ -547,6 +546,22 @@ #define D_DEVICE_INPUT "Input" #define D_DEVICE_OUTPUT "Output" +// xdrv_39_thermostat.ino +#define D_THERMOSTAT "Thermostat" +#define D_THERMOSTAT_SET_POINT "Set Point Temperature" +#define D_THERMOSTAT_SENSOR "Current Temperature" +#define D_THERMOSTAT_GRADIENT "Gradient Temperature" +#define D_THERMOSTAT_DUTY_CYCLE "Duty cycle" +#define D_THERMOSTAT_CYCLE_TIME "Cycle time" +#define D_THERMOSTAT_PI_AUTOTUNE "PI Auto tuning" +#define D_THERMOSTAT_CONTROL_METHOD "Control method" +#define D_THERMOSTAT_RAMP_UP "Ramp up" +#define D_THERMOSTAT_PI "PI" +#define D_THERMOSTAT_AUTOTUNE "Autotune" +#define D_THERMOSTAT_RAMP_UP_HYBRID "Ramp up (Hybrid)" +#define D_THERMOSTAT_PI_HYBRID "PI (Hybrid)" +#define D_THERMOSTAT_AUTOTUNE_HYBRID "Autotune (Hybrid)" + // xsns_05_ds18b20.ino #define D_SENSOR_BUSY "Sensor busy" #define D_SENSOR_CRC_ERROR "Sensor CRC error" diff --git a/tasmota/language/cs_CZ.h b/tasmota/language/cs_CZ.h index def1b6937..1441d328d 100644 --- a/tasmota/language/cs_CZ.h +++ b/tasmota/language/cs_CZ.h @@ -166,7 +166,6 @@ #define D_RESTART "Restart" #define D_RESTARTING "Restartování" #define D_RESTART_REASON "Příčina restartu" -#define D_RESTORE "Obnovit" #define D_RETAINED "Zachováno" #define D_RULE "Rule" #define D_SAVE "Ulož" @@ -192,7 +191,6 @@ #define D_TWILIGHT_ASTRONOMICAL "Astronomical" #define D_TWILIGHT_CIVIL "Civil" #define D_TWILIGHT_NAUTICAL "Nautical" -#define D_UPGRADE "aktualizace" #define D_UPLOAD "Nahrání..." #define D_UPTIME "Uptime" #define D_USED "used" @@ -290,6 +288,7 @@ #define D_RESET_CONFIGURATION "Reset nastavení" #define D_BACKUP_CONFIGURATION "Záloha nastavení" #define D_RESTORE_CONFIGURATION "Obnovení nastavení" +#define D_START_RESTORE "Start restore" #define D_MAIN_MENU "Hlavní menu" #define D_MODULE_PARAMETERS "Nastavení modulu" @@ -547,6 +546,22 @@ #define D_DEVICE_INPUT "Input" #define D_DEVICE_OUTPUT "Output" +// xdrv_39_thermostat.ino +#define D_THERMOSTAT "Thermostat" +#define D_THERMOSTAT_SET_POINT "Set Point Temperature" +#define D_THERMOSTAT_SENSOR "Current Temperature" +#define D_THERMOSTAT_GRADIENT "Gradient Temperature" +#define D_THERMOSTAT_DUTY_CYCLE "Duty cycle" +#define D_THERMOSTAT_CYCLE_TIME "Cycle time" +#define D_THERMOSTAT_PI_AUTOTUNE "PI Auto tuning" +#define D_THERMOSTAT_CONTROL_METHOD "Control method" +#define D_THERMOSTAT_RAMP_UP "Ramp up" +#define D_THERMOSTAT_PI "PI" +#define D_THERMOSTAT_AUTOTUNE "Autotune" +#define D_THERMOSTAT_RAMP_UP_HYBRID "Ramp up (Hybrid)" +#define D_THERMOSTAT_PI_HYBRID "PI (Hybrid)" +#define D_THERMOSTAT_AUTOTUNE_HYBRID "Autotune (Hybrid)" + // xsns_05_ds18b20.ino #define D_SENSOR_BUSY "Sensor DS18x20 obsazen" #define D_SENSOR_CRC_ERROR "Sensor DS18x20 chyba CRC" diff --git a/tasmota/language/de_DE.h b/tasmota/language/de_DE.h index 4a9c03642..8d5ef0279 100644 --- a/tasmota/language/de_DE.h +++ b/tasmota/language/de_DE.h @@ -28,7 +28,7 @@ * Use online command StateText to translate ON, OFF, HOLD and TOGGLE. * Use online command Prefix to translate cmnd, stat and tele. * - * Updated until v13.1.0.4 + * Updated until v13.2.0.2 - Last update 19.11.2023 \*********************************************************************/ //#define LANGUAGE_MODULE_NAME // Enable to display "Module Generic" (ie Spanish), Disable to display "Generic Module" (ie English) @@ -48,10 +48,10 @@ #define D_MONTH3LIST "JanFebMärAprMaiJunJulAugSepOktNovDez" // Non JSON decimal separator -#define D_DECIMAL_SEPARATOR "." +#define D_DECIMAL_SEPARATOR "," // Common -#define D_ABSOLUTE_HUMIDITY "Abs Humidity" +#define D_ABSOLUTE_HUMIDITY "Abs․ Feuchtigkeit" #define D_ADMIN "Admin" #define D_AIR_QUALITY "Luftqualität" #define D_AP "AP" // Access Point @@ -61,9 +61,9 @@ #define D_BATTERY_CHARGE "Ladung" // Battery charge in % #define D_BLINK "Blinken" #define D_BLINKOFF "BlinkenAus" -#define D_BOOT_COUNT "Anzahl Startvorgänge" +#define D_BOOT_COUNT "Startvorgänge" #define D_BRIGHTLIGHT "hell" -#define D_BSSID "BSSId" +#define D_BSSID "BSSID" #define D_BUTTON "Knopf" #define D_BY "von" // Written by me #define D_BYTES "Bytes" @@ -107,7 +107,7 @@ #define D_FILE "Datei" #define D_FILE_SYSTEM_SIZE "Dateisystemgröße" #define D_FLOW_RATE "Durchflussmenge" -#define D_FRAGMENTATION "frag." // Lower case abbreviated version of fragmentation used in "memory fragmentation" +#define D_FRAGMENTATION "frag․" // Lower case abbreviated version of fragmentation used in "memory fragmentation" #define D_FRAME_RATE "Frame Rate" #define D_FREE_MEMORY "Freier Arbeitsspeicher" #define D_PSR_MAX_MEMORY "PS-RAM Speicher" @@ -136,7 +136,7 @@ #define D_MULTI_PRESS "Mehrfachdruck" #define D_NOISE "Lautstärke" #define D_NONE "keine" -#define D_NOX "NOx" +#define D_NOX "NOₓ" #define D_O2 "Sauerstoff" #define D_OFF "aus" #define D_OFFLINE "Offline" @@ -158,7 +158,7 @@ #define D_PRESSURE "Luftdruck" #define D_PRESSUREATSEALEVEL "Luftdruck auf Meereshöhe" #define D_PROGRAM_FLASH_SIZE "Flash nutzbar" -#define D_PROGRAM_SIZE "Größe Programm" +#define D_PROGRAM_SIZE "Programmgröße" #define D_PROJECT "Projekt" #define D_RAIN "Regen" #define D_RANGE "Bereich" @@ -166,7 +166,6 @@ #define D_RESTART "Neustart" #define D_RESTARTING "starte neu" #define D_RESTART_REASON "Grund für Neustart" -#define D_RESTORE "Wiederherstellung" #define D_RETAINED "beibehalten" #define D_RULE "Regel" #define D_SAVE "Speichern" @@ -177,14 +176,14 @@ #define D_STOP "Stop" #define D_SUBNET_MASK "Subnetzmaske" #define D_SUBSCRIBE_TO "abonniere" -#define D_UNSUBSCRIBE_FROM "löse abo. von" +#define D_UNSUBSCRIBE_FROM "löse abo․ von" #define D_SUCCESSFUL "erfolgreich" #define D_SUNRISE "Sonnenaufgang" #define D_SUNSET "Sonnenuntergang" #define D_TEMPERATURE "Temperatur" #define D_TO "zu" #define D_TOGGLE "An/Aus" -#define D_TOPIC "topic" +#define D_TOPIC "Topic" #define D_TOTAL_USAGE "Gesamtverbrauch" #define D_TRANSMIT "Übertragen" #define D_TRUE "wahr" @@ -192,7 +191,6 @@ #define D_TWILIGHT_ASTRONOMICAL "astronomisch" #define D_TWILIGHT_CIVIL "zivil" #define D_TWILIGHT_NAUTICAL "nautisch" -#define D_UPGRADE "update" #define D_UPLOAD "Upload" #define D_UPTIME "Laufzeit" #define D_USED "genutzt" @@ -211,10 +209,10 @@ #define D_VERSION "Version" #define D_VOC "VOC" #define D_VOLTAGE "Spannung" -#define D_VOLUME "Volume" +#define D_VOLUME "Volumen" #define D_WEIGHT "Gewicht" #define D_WARMLIGHT "warm" -#define D_WEB_SERVER "Web-Server" +#define D_WEB_SERVER "Webserver" #define D_SOC "Ladestatus" #define D_SOH "Gesundheitsstatus" @@ -223,16 +221,16 @@ #define D_LEVEL_10 "level 1-0" #define D_LEVEL_01 "level 0-1" #define D_SERIAL_LOGGING_DISABLED "Serielles Logging deaktiviert" -#define D_SYSLOG_LOGGING_REENABLED "Syslog-Logging aktiviert" +#define D_SYSLOG_LOGGING_REENABLED "Syslog (re)aktiviert" #define D_SET_BAUDRATE_TO "Setze Baudrate auf" -#define D_RECEIVED_TOPIC "empfangenes topic" +#define D_RECEIVED_TOPIC "empfangenes Topic" #define D_DATA_SIZE "Datengröße" #define D_ANALOG_INPUT "Analog" // support.ino #define D_OSWATCH "osWatch" -#define D_BLOCKED_LOOP "Schleife blockiert." +#define D_BLOCKED_LOOP "Schleife blockiert" #define D_WPS_FAILED_WITH_STATUS "WPS fehlgeschlagen mit Status" #define D_ACTIVE_FOR_3_MINUTES "aktiv für 3 Minuten" #define D_FAILED_TO_START "Starten fehlgeschlagen" @@ -243,9 +241,9 @@ #define D_CONNECT_FAILED_AP_NOT_REACHED "Verbindung fehlgeschlagen, da AP nicht erreicht werden konnte" #define D_CONNECT_FAILED_WRONG_PASSWORD "Verbindung fehlgeschlagen" #define D_CONNECT_FAILED_AP_TIMEOUT "Verbindung fehlgeschlagen, da der AP nicht antwortet (timeout)" -#define D_ATTEMPTING_CONNECTION "Verbindungsversuch..." -#define D_CHECKING_CONNECTION "Prüfe Verbindung..." -#define D_QUERY_DONE "Suchanfrage abgeschlossen. MQTT-Services gefunden" +#define D_ATTEMPTING_CONNECTION "Verbindungsversuch…" +#define D_CHECKING_CONNECTION "Prüfe Verbindung…" +#define D_QUERY_DONE "Suchanfrage abgeschlossen․ MQTT-Services gefunden" #define D_MQTT_SERVICE_FOUND "MQTT-Service gefunden bei" #define D_FOUND_AT "gefunden bei" #define D_SYSLOG_HOST_NOT_FOUND "Syslog-Host nicht gefunden" @@ -260,11 +258,11 @@ #define D_NOSCRIPT "JavaScript aktivieren um Tasmota benutzen zu können" #define D_SAFEBOOT "SAFEBOOT" #define D_MINIMAL_FIRMWARE_PLEASE_UPGRADE "MINIMUM-Firmware
bitte upgraden" -#define D_WEBSERVER_ACTIVE_ON "Web-Server aktiv bei" +#define D_WEBSERVER_ACTIVE_ON "Webserver aktiv bei" #define D_WITH_IP_ADDRESS "mit IP-Adresse" -#define D_WEBSERVER_STOPPED "Web-Server angehalten" +#define D_WEBSERVER_STOPPED "Webserver angehalten" #define D_FILE_NOT_FOUND "Datei nicht gefunden" -#define D_REDIRECTED "umgeleitet zu captive portal" +#define D_REDIRECTED "umgeleitet zum Captive Portal" #define D_WIFIMANAGER_SET_ACCESSPOINT_AND_STATION "WLAN-Manager AccessPoint gesetzt und behält Station" #define D_WIFIMANAGER_SET_ACCESSPOINT "WLAN-Manager AccessPoint gesetzt" #define D_TRYING_TO_CONNECT "Versuche mit Netzwerk zu verbinden" @@ -290,9 +288,10 @@ #define D_RESET_CONFIGURATION "Konfiguration zurücksetzen" #define D_BACKUP_CONFIGURATION "Konfiguration sichern" #define D_RESTORE_CONFIGURATION "Konfiguration wiederherstellen" +#define D_START_RESTORE "Wiederherstellung starten" #define D_MAIN_MENU "Hauptmenü" -#define D_MODULE_PARAMETERS "Geräte-Einstellungen" +#define D_MODULE_PARAMETERS "Geräteeinstellungen" #define D_MODULE_TYPE "Gerätetyp" #define D_PULLUP_ENABLE "Pull-up aktiv" #define D_ADC "ADC" @@ -327,24 +326,24 @@ #define D_REDIRECTING_TO_NEW_IP "Umleitung zur neuen Geräte IP-Adresse" #define D_MQTT_PARAMETERS "MQTT-Einstellungen" -#define D_CLIENT "client" -#define D_FULL_TOPIC "full topic" +#define D_CLIENT "Client" +#define D_FULL_TOPIC "Full Topic" #define D_LOGGING_PARAMETERS "Logging-Einstellungen" #define D_SERIAL_LOG_LEVEL "Seriell-Log Level" -#define D_MQTT_LOG_LEVEL "Mqtt-Log Level" +#define D_MQTT_LOG_LEVEL "MQTT-Log Level" #define D_WEB_LOG_LEVEL "Web-Log Level" -#define D_SYS_LOG_LEVEL "Sys-Log Level" +#define D_SYS_LOG_LEVEL "Syslog Level" #define D_MORE_DEBUG "Mehr Details" -#define D_SYSLOG_HOST "Sys-Log Host" -#define D_SYSLOG_PORT "Sys-Log Port" +#define D_SYSLOG_HOST "Syslog Host" +#define D_SYSLOG_PORT "Syslog Port" #define D_TELEMETRY_PERIOD "Telemetrieperiode" #define D_OTHER_PARAMETERS "Sonstige Einstellungen" #define D_TEMPLATE "Vorlage" #define D_ACTIVATE "Aktivieren" -#define D_DEVICE_NAME "Geräte Name" -#define D_WEB_ADMIN_PASSWORD "Passwort für Web Oberfläche" +#define D_DEVICE_NAME "Gerätename" +#define D_WEB_ADMIN_PASSWORD "Passwort für Weboberfläche" #define D_MQTT_ENABLE "MQTT aktivieren" #define D_MQTT_TLS_ENABLE "MQTT TLS" #define D_HTTP_API "HTTP API" @@ -366,13 +365,13 @@ #define D_CONFIGURATION_RESET "Konfiguration zurücksetzen" #define D_PROGRAM_VERSION "Tasmota Version" -#define D_BUILD_DATE_AND_TIME "Erstellungs-Datum & -Uhrzeit" +#define D_BUILD_DATE_AND_TIME "Erstellungszeitpunkt" #define D_CORE_AND_SDK_VERSION "Core-/SDK-Version" -#define D_FLASH_WRITE_COUNT "Anz. Flash-Schreibzyklen" +#define D_FLASH_WRITE_COUNT "Flash-Schreibzyklen" #define D_MAC_ADDRESS "MAC-Adresse" #define D_MQTT_HOST "MQTT Host" #define D_MQTT_PORT "MQTT Port" -#define D_MQTT_CLIENT "MQTT Klient" +#define D_MQTT_CLIENT "MQTT Client" #define D_MQTT_USER "MQTT Benutzer" #define D_MQTT_TOPIC "MQTT Topic" #define D_MQTT_GROUP_TOPIC "MQTT Group Topic" @@ -385,7 +384,7 @@ #define D_FLASH_CHIP_SIZE "Größe Flash-Chip" #define D_FREE_PROGRAM_SPACE "Flash frei" -#define D_UPGRADE_BY_WEBSERVER "Update über Web-Server" +#define D_UPGRADE_BY_WEBSERVER "Update über Webserver" #define D_OTA_URL "OTA-URL" #define D_START_UPGRADE "Update starten" #define D_UPGRADE_BY_FILE_UPLOAD "Update Datei hochladen" @@ -396,11 +395,11 @@ #define D_UPLOAD_TRANSFER "Upload Übertragung" #define D_TRANSFER_STARTED "Transfer gestartet" #define D_UPLOAD_ERR_1 "Keine Datei ausgewählt" -#define D_UPLOAD_ERR_2 "Ungenügend Speicherplatz" +#define D_UPLOAD_ERR_2 "Nicht genug Speicherplatz" #define D_UPLOAD_ERR_3 "Falsche Dateisignatur" -#define D_UPLOAD_ERR_4 "Datei überschreitet vorhdn. Flashspeicher" +#define D_UPLOAD_ERR_4 "Datei überschreitet vorhdn․ Flashspeicher" #define D_UPLOAD_ERR_5 "Upload Buffer Vergleich weicht ab" -#define D_UPLOAD_ERR_6 "Upload fehlgeschlagen. Aktiviere logging 3" +#define D_UPLOAD_ERR_6 "Upload fehlgeschlagen․ Aktiviere logging 3" #define D_UPLOAD_ERR_7 "Upload abgebrochen" #define D_UPLOAD_ERR_8 "Datei ungültig" #define D_UPLOAD_ERR_9 "Datei zu groß" @@ -416,7 +415,7 @@ #define D_NEED_USER_AND_PASSWORD "Benötige user=&password=" // xdrv_01_mqtt.ino -#define D_FINGERPRINT "TLS-Fingerabdruck wird verifiziert..." +#define D_FINGERPRINT "TLS-Fingerabdruck wird verifiziert…" #define D_TLS_CONNECT_FAILED_TO "TLS-Verbindung fehlgeschlagen an" #define D_RETRY_IN "Wiederversuch in" #define D_VERIFIED "verifiziert mit Fingerabdruck" @@ -463,7 +462,7 @@ // xdrv_09_timers.ino #define D_CONFIGURE_TIMER "Zeitplan konfigurieren" -#define D_TIMER_PARAMETERS "Zeitplan-Einstellungen" +#define D_TIMER_PARAMETERS "Zeitplaneinstellungen" #define D_TIMER_ENABLE "Zeitpläne aktivieren" #define D_TIMER_ARM "Aktiv" #define D_TIMER_TIME "Uhrzeit" @@ -477,7 +476,7 @@ #define D_KNX_PARAMETERS "KNX-Parameter" #define D_KNX_GENERAL_CONFIG "Allgemein" #define D_KNX_PHYSICAL_ADDRESS "Physikalische Adresse" -#define D_KNX_PHYSICAL_ADDRESS_NOTE "( Muss einmalig im KNX-Netzwerk sein )" +#define D_KNX_PHYSICAL_ADDRESS_NOTE "(Muss einmalig im KNX-Netzwerk sein)" #define D_KNX_ENABLE "KNX aktivieren" #define D_KNX_GROUP_ADDRESS_TO_WRITE "Daten zum Senden an Gruppenadresse" #define D_ADD "Hinzufügen" @@ -489,7 +488,7 @@ #define D_KNX_COMMAND_READ "Lesen" #define D_KNX_COMMAND_OTHER "Andere" #define D_SENT_TO "gesendet an" -#define D_KNX_WARNING "Die Gruppenadresse (0/0/0) ist reserviert und kann nicht verwendet werden." +#define D_KNX_WARNING "Die Gruppenadresse (0/0/0) ist reserviert und kann nicht verwendet werden" #define D_KNX_ENHANCEMENT "Erweiterte Kommunikation" #define D_KNX_TX_SLOT "KNX TX" #define D_KNX_RX_SLOT "KNX RX" @@ -500,7 +499,7 @@ #define D_ZIGBEE_PERMITJOIN_ACTIVE "Gerätekopplung erlaubt" #define D_ZIGBEE_MAPPING_TITLE "Tasmota Zigbee Karte" #define D_ZIGBEE_NOT_STARTED "Zigbee nicht gestartet" -#define D_ZIGBEE_MAPPING_IN_PROGRESS_SEC "Karte in Erstellung (%d s. verbleibend)" +#define D_ZIGBEE_MAPPING_IN_PROGRESS_SEC "Karte in Erstellung (%d s․ verbleibend)" #define D_ZIGBEE_MAPPING_NOT_PRESENT "Keine Karte" #define D_ZIGBEE_MAP_REFRESH "Zigbee Karte erneuern" #define D_ZIGBEE_MAP "Zigbee Karte" @@ -512,14 +511,14 @@ #define D_ZIGBEE_INVALID_PARAM "Ungültiger Parameter" #define D_ZIGBEE_MISSING_PARAM "Fehlende Parameter" #define D_ZIGBEE_UNKNWON_ATTRIBUTE "Unbekannter Attribut Name (ignoriert): %s" -#define D_ZIGBEE_TOO_MANY_CLUSTERS "Nur eine Cluster id pro Kommando" +#define D_ZIGBEE_TOO_MANY_CLUSTERS "Nur eine Cluster-ID pro Kommando" #define D_ZIGBEE_CONFLICTING_ENDPOINTS "Kollidierende Endpunkte" #define D_ZIGBEE_WRONG_DELIMITER "Falscher Delimeter für Payload" #define D_ZIGBEE_UNRECOGNIZED_COMMAND "Unerkanntes Zigbee Kommando: %s" #define D_ZIGBEE_TOO_MANY_COMMANDS "Nur 1 Kommando zulässig (%d)" #define D_ZIGBEE_NO_ATTRIBUTE "Kein Attribut in der Liste" -#define D_ZIGBEE_UNSUPPORTED_ATTRIBUTE_TYPE "Nicht unterstützter Attribut Typ" -#define D_ZIGBEE_JSON_REQUIRED "Konfiguration muss JSON basiert sein" +#define D_ZIGBEE_UNSUPPORTED_ATTRIBUTE_TYPE "Nicht unterstützter Attributtyp" +#define D_ZIGBEE_JSON_REQUIRED "Konfiguration muss JSON-basiert sein" #define D_ZIGBEE_RESET_1_OR_2 "1 oder 2 für Reset" #define D_ZIGBEE_EEPROM_FOUND_AT_ADDRESS "ZBBridge EEPROM gefunden an Adresse" #define D_ZIGBEE_RANDOMIZING_ZBCONFIG "Zufällige Zigbee Parameter erstellt, Überprüfung mit 'ZbConfig'" @@ -527,7 +526,7 @@ // xdrv_89_dali.ino #define D_SENSOR_DALI_RX "Dali RX" #define D_SENSOR_DALI_TX "Dali TX" -#define D_CONFIGURE_DALI "Konfig. DALI" +#define D_CONFIGURE_DALI "Konfig․ DALI" // xdrv_03_energy.ino #define D_ENERGY_TODAY "Energie heute" @@ -547,6 +546,22 @@ #define D_DEVICE_INPUT "Eingang" #define D_DEVICE_OUTPUT "Ausgang" +// xdrv_39_thermostat.ino +#define D_THERMOSTAT "Thermostat" +#define D_THERMOSTAT_SET_POINT "Solltemperatur" +#define D_THERMOSTAT_SENSOR "Aktuelle Temperatur" +#define D_THERMOSTAT_GRADIENT "Temperaturänderung" +#define D_THERMOSTAT_DUTY_CYCLE "Aussteuergrad" +#define D_THERMOSTAT_CYCLE_TIME "Periodendauer" +#define D_THERMOSTAT_PI_AUTOTUNE "Auto PI-Abstimmung" +#define D_THERMOSTAT_CONTROL_METHOD "Reglertyp" +#define D_THERMOSTAT_RAMP_UP "Anlauf" +#define D_THERMOSTAT_PI "PI" +#define D_THERMOSTAT_AUTOTUNE "Autotune" +#define D_THERMOSTAT_RAMP_UP_HYBRID "Anlauf (Hybrid)" +#define D_THERMOSTAT_PI_HYBRID "PI (Hybrid)" +#define D_THERMOSTAT_AUTOTUNE_HYBRID "Autotune (Hybrid)" + // xsns_05_ds18b20.ino #define D_SENSOR_BUSY "Sensor beschäftigt" #define D_SENSOR_CRC_ERROR "Sensor CRC-Fehler" @@ -577,9 +592,9 @@ #define D_PROXIMITY "Nähe" // xsns_32_mpu6050.ino -#define D_AX_AXIS "Beschl. X-Achse" -#define D_AY_AXIS "Beschl. Y-Achse" -#define D_AZ_AXIS "Beschl. Z-Achse" +#define D_AX_AXIS "Beschl․ X-Achse" +#define D_AY_AXIS "Beschl․ Y-Achse" +#define D_AZ_AXIS "Beschl․ Z-Achse" #define D_GX_AXIS "Gyroskop X-Achse" #define D_GY_AXIS "Gyroskop Y-Achse" #define D_GZ_AXIS "Gyroskop Z-Achse" @@ -637,7 +652,7 @@ // xsns_86_tfminiplus.ino #define D_SIGNALSTRENGTH "Signalstärke" -#define D_CHIPTEMPERATURE "Chip Temperatur" +#define D_CHIPTEMPERATURE "Chiptemperatur" // tasmota_template.h - keep them as short as possible to be able to fit them in GUI drop down box #define D_SENSOR_NONE "None" @@ -1055,22 +1070,22 @@ #define D_SCRIPT_UPLOAD_FILES "Upload Dateien" //xdrv_50_filesystem.ino -#define D_MANAGE_FILE_SYSTEM "Verwalte Dateisystem" +#define D_MANAGE_FILE_SYSTEM "Dateisystem verwalten" #define D_FS_SIZE "Größe" #define D_FS_FREE "Frei" #define D_NEW_FILE "neue-datei.txt" -#define D_CREATE_NEW_FILE "Datei erstellen und bearbeiten" +#define D_CREATE_NEW_FILE "Neue Datei erstellen" #define D_EDIT_FILE "Datei bearbeiten" -#define D_CONFIRM_FILE_DEL "Datei löschen bestätigen" -#define D_SHOW_HIDDEN_FILES "Zeige versteckte Datei(en)" +#define D_CONFIRM_FILE_DEL "Datei wirklich löschen?" +#define D_SHOW_HIDDEN_FILES "Versteckte Datei(en) anzeigen" //xsns_67_as3935.ino -#define D_AS3935_GAIN "Umgebung:" -#define D_AS3935_ENERGY "Energie:" -#define D_AS3935_DISTANCE "Entfernung:" -#define D_AS3935_DISTURBER "Entstörer:" -#define D_AS3935_VRMS "µVrms:" -#define D_AS3935_APRX "ca.:" +#define D_AS3935_GAIN "Umgebung" +#define D_AS3935_ENERGY "Energie" +#define D_AS3935_DISTANCE "Entfernung" +#define D_AS3935_DISTURBER "Entstörer" +#define D_AS3935_VRMS "µVrms" +#define D_AS3935_APRX "ca․" #define D_AS3935_AWAY "entfernt" #define D_AS3935_LIGHT "Blitz" #define D_AS3935_OUT "ausserhalb der Reichweite" @@ -1081,13 +1096,13 @@ #define D_AS3935_INTNOEV "Interrupt ohne Grund!" #define D_AS3935_FLICKER "IRQ Pin flackert!" #define D_AS3935_POWEROFF "Ausgeschaltet" -#define D_AS3935_NOMESS "lausche..." +#define D_AS3935_NOMESS "lausche…" #define D_AS3935_ON "An" #define D_AS3935_OFF "Aus" #define D_AS3935_INDOORS "Indoors" #define D_AS3935_OUTDOORS "Outdoors" #define D_AS3935_CAL_FAIL "Kalibrierung fehlerhaft" -#define D_AS3935_CAL_OK "Cap gesetzt auf:" +#define D_AS3935_CAL_OK "Cap gesetzt auf" //xsns_68_opentherm.ino #define D_SENSOR_BOILER_OT_RX "OpenTherm RX" @@ -1099,8 +1114,8 @@ #define D_CURRENT_TARIFF "Aktueller Tarif" #define D_TARIFF "Tarif" #define D_OVERLOAD "ADPS" -#define D_MAX_POWER "max. Leistung" -#define D_MAX_CURRENT "max. Stromstärke" +#define D_MAX_POWER "max․ Leistung" +#define D_MAX_CURRENT "max․ Stromstärke" // xsns_79_as608.ino #define D_FP_ENROLL_PLACEFINGER "Finger auflegen" @@ -1183,7 +1198,7 @@ #define D_NEOPOOL_RELAY_VALVE "Ventil" #define D_NEOPOOL_RELAY_AUX "Aux" #define D_NEOPOOL_TIME "Zeit" -#define D_NEOPOOL_FILT_MODE "Filtration mode" +#define D_NEOPOOL_FILT_MODE "Filtermodus" #define D_NEOPOOL_CELL_RUNTIME "Laufzeit Zelle" #define D_NEOPOOL_POLARIZATION "Pol" // Sensor status #define D_NEOPOOL_PR_OFF "PrAus" diff --git a/tasmota/language/el_GR.h b/tasmota/language/el_GR.h index 72f2cbe21..4cf6fc13e 100644 --- a/tasmota/language/el_GR.h +++ b/tasmota/language/el_GR.h @@ -166,7 +166,6 @@ #define D_RESTART "Επανεκκίνηση" #define D_RESTARTING "Επανεκκινεί" #define D_RESTART_REASON "Αιτία επανεκκίνησης" -#define D_RESTORE "επαναφορά" #define D_RETAINED "διακράτηση" #define D_RULE "Κανόνας" #define D_SAVE "Αποθήκευση" @@ -192,7 +191,6 @@ #define D_TWILIGHT_ASTRONOMICAL "Astronomical" #define D_TWILIGHT_CIVIL "Civil" #define D_TWILIGHT_NAUTICAL "Nautical" -#define D_UPGRADE "αναβάθμιση" #define D_UPLOAD "Ανέβασμα" #define D_UPTIME "Χρόνος λειτουργίας" #define D_USED "used" @@ -290,6 +288,7 @@ #define D_RESET_CONFIGURATION "Reset" #define D_BACKUP_CONFIGURATION "Εξαγωγή" #define D_RESTORE_CONFIGURATION "Επαναφορά" +#define D_START_RESTORE "Start restore" #define D_MAIN_MENU "Κεντρικό μενού" #define D_MODULE_PARAMETERS "Παράμετροι μονάδας" @@ -547,6 +546,22 @@ #define D_DEVICE_INPUT "Input" #define D_DEVICE_OUTPUT "Output" +// xdrv_39_thermostat.ino +#define D_THERMOSTAT "Thermostat" +#define D_THERMOSTAT_SET_POINT "Set Point Temperature" +#define D_THERMOSTAT_SENSOR "Current Temperature" +#define D_THERMOSTAT_GRADIENT "Gradient Temperature" +#define D_THERMOSTAT_DUTY_CYCLE "Duty cycle" +#define D_THERMOSTAT_CYCLE_TIME "Cycle time" +#define D_THERMOSTAT_PI_AUTOTUNE "PI Auto tuning" +#define D_THERMOSTAT_CONTROL_METHOD "Control method" +#define D_THERMOSTAT_RAMP_UP "Ramp up" +#define D_THERMOSTAT_PI "PI" +#define D_THERMOSTAT_AUTOTUNE "Autotune" +#define D_THERMOSTAT_RAMP_UP_HYBRID "Ramp up (Hybrid)" +#define D_THERMOSTAT_PI_HYBRID "PI (Hybrid)" +#define D_THERMOSTAT_AUTOTUNE_HYBRID "Autotune (Hybrid)" + // xsns_05_ds18b20.ino #define D_SENSOR_BUSY "Ο αισθητήρας είναι απασχολημένος" #define D_SENSOR_CRC_ERROR "Σφάλμα CRC αισθητήρα" diff --git a/tasmota/language/en_GB.h b/tasmota/language/en_GB.h index 77f067bca..aa91d4c55 100644 --- a/tasmota/language/en_GB.h +++ b/tasmota/language/en_GB.h @@ -166,7 +166,6 @@ #define D_RESTART "Restart" #define D_RESTARTING "Restarting" #define D_RESTART_REASON "Restart Reason" -#define D_RESTORE "restore" #define D_RETAINED "retained" #define D_RULE "Rule" #define D_SAVE "Save" @@ -192,7 +191,6 @@ #define D_TWILIGHT_ASTRONOMICAL "Astronomical" #define D_TWILIGHT_CIVIL "Civil" #define D_TWILIGHT_NAUTICAL "Nautical" -#define D_UPGRADE "upgrade" #define D_UPLOAD "Upload" #define D_UPTIME "Uptime" #define D_USED "used" @@ -290,6 +288,7 @@ #define D_RESET_CONFIGURATION "Reset Configuration" #define D_BACKUP_CONFIGURATION "Backup Configuration" #define D_RESTORE_CONFIGURATION "Restore Configuration" +#define D_START_RESTORE "Start restore" #define D_MAIN_MENU "Main Menu" #define D_MODULE_PARAMETERS "Module parameters" @@ -547,6 +546,22 @@ #define D_DEVICE_INPUT "Input" #define D_DEVICE_OUTPUT "Output" +// xdrv_39_thermostat.ino +#define D_THERMOSTAT "Thermostat" +#define D_THERMOSTAT_SET_POINT "Set Point Temperature" +#define D_THERMOSTAT_SENSOR "Current Temperature" +#define D_THERMOSTAT_GRADIENT "Gradient Temperature" +#define D_THERMOSTAT_DUTY_CYCLE "Duty cycle" +#define D_THERMOSTAT_CYCLE_TIME "Cycle time" +#define D_THERMOSTAT_PI_AUTOTUNE "PI Auto tuning" +#define D_THERMOSTAT_CONTROL_METHOD "Control method" +#define D_THERMOSTAT_RAMP_UP "Ramp up" +#define D_THERMOSTAT_PI "PI" +#define D_THERMOSTAT_AUTOTUNE "Autotune" +#define D_THERMOSTAT_RAMP_UP_HYBRID "Ramp up (Hybrid)" +#define D_THERMOSTAT_PI_HYBRID "PI (Hybrid)" +#define D_THERMOSTAT_AUTOTUNE_HYBRID "Autotune (Hybrid)" + // xsns_05_ds18b20.ino #define D_SENSOR_BUSY "Sensor busy" #define D_SENSOR_CRC_ERROR "Sensor CRC error" diff --git a/tasmota/language/es_ES.h b/tasmota/language/es_ES.h index 4186ef707..06add4a53 100644 --- a/tasmota/language/es_ES.h +++ b/tasmota/language/es_ES.h @@ -166,7 +166,6 @@ #define D_RESTART "Reiniciar" #define D_RESTARTING "Reiniciando" #define D_RESTART_REASON "Causa Reinicio" -#define D_RESTORE "Restauración" #define D_RETAINED "Grabado" #define D_RULE "Regla" #define D_SAVE "Grabar" @@ -192,7 +191,6 @@ #define D_TWILIGHT_ASTRONOMICAL "Astronomical" #define D_TWILIGHT_CIVIL "Civil" #define D_TWILIGHT_NAUTICAL "Nautical" -#define D_UPGRADE "Actualización" #define D_UPLOAD "Carga" #define D_UPTIME "Tiempo Encendido" #define D_USED "used" @@ -290,6 +288,7 @@ #define D_RESET_CONFIGURATION "Reset de Configuración" #define D_BACKUP_CONFIGURATION "Backup de Configuración" #define D_RESTORE_CONFIGURATION "Restaurar Configuración" +#define D_START_RESTORE "Start restore" #define D_MAIN_MENU "Menú Principal" #define D_MODULE_PARAMETERS "Parámetros del módulo" @@ -547,6 +546,22 @@ #define D_DEVICE_INPUT "Entrada" #define D_DEVICE_OUTPUT "Salida" +// xdrv_39_thermostat.ino +#define D_THERMOSTAT "Thermostat" +#define D_THERMOSTAT_SET_POINT "Set Point Temperature" +#define D_THERMOSTAT_SENSOR "Current Temperature" +#define D_THERMOSTAT_GRADIENT "Gradient Temperature" +#define D_THERMOSTAT_DUTY_CYCLE "Duty cycle" +#define D_THERMOSTAT_CYCLE_TIME "Cycle time" +#define D_THERMOSTAT_PI_AUTOTUNE "PI Auto tuning" +#define D_THERMOSTAT_CONTROL_METHOD "Control method" +#define D_THERMOSTAT_RAMP_UP "Ramp up" +#define D_THERMOSTAT_PI "PI" +#define D_THERMOSTAT_AUTOTUNE "Autotune" +#define D_THERMOSTAT_RAMP_UP_HYBRID "Ramp up (Hybrid)" +#define D_THERMOSTAT_PI_HYBRID "PI (Hybrid)" +#define D_THERMOSTAT_AUTOTUNE_HYBRID "Autotune (Hybrid)" + // xsns_05_ds18b20.ino #define D_SENSOR_BUSY "Sensor ocupado" #define D_SENSOR_CRC_ERROR "Error CRC del Sensor" diff --git a/tasmota/language/fr_FR.h b/tasmota/language/fr_FR.h index f1f10d63c..861fe57cb 100644 --- a/tasmota/language/fr_FR.h +++ b/tasmota/language/fr_FR.h @@ -166,7 +166,6 @@ #define D_RESTART "Redémarrage" #define D_RESTARTING "Redémarre" #define D_RESTART_REASON "Raison du redémarrage" -#define D_RESTORE "restaurer" #define D_RETAINED "persistant" // MQTT #define D_RULE "Règle" #define D_SAVE "Enregistrer" @@ -192,7 +191,6 @@ #define D_TWILIGHT_ASTRONOMICAL "Astronomical" #define D_TWILIGHT_CIVIL "Civil" #define D_TWILIGHT_NAUTICAL "Nautical" -#define D_UPGRADE "la mise à jour" // "Lancer la mise à jour" #define D_UPLOAD "Upload" // Not better in french #define D_UPTIME "Durée d'activité" #define D_USED "utilisé" @@ -290,6 +288,7 @@ #define D_RESET_CONFIGURATION "Configuration par défaut" #define D_BACKUP_CONFIGURATION "Sauvegarde de la config." #define D_RESTORE_CONFIGURATION "Restauration de la config." +#define D_START_RESTORE "Start restore" #define D_MAIN_MENU "Menu principal" #define D_MODULE_PARAMETERS "Paramètres module" @@ -547,6 +546,22 @@ #define D_DEVICE_INPUT "Entrée" #define D_DEVICE_OUTPUT "Sortie" +// xdrv_39_thermostat.ino +#define D_THERMOSTAT "Thermostat" +#define D_THERMOSTAT_SET_POINT "Set Point Temperature" +#define D_THERMOSTAT_SENSOR "Current Temperature" +#define D_THERMOSTAT_GRADIENT "Gradient Temperature" +#define D_THERMOSTAT_DUTY_CYCLE "Duty cycle" +#define D_THERMOSTAT_CYCLE_TIME "Cycle time" +#define D_THERMOSTAT_PI_AUTOTUNE "PI Auto tuning" +#define D_THERMOSTAT_CONTROL_METHOD "Control method" +#define D_THERMOSTAT_RAMP_UP "Ramp up" +#define D_THERMOSTAT_PI "PI" +#define D_THERMOSTAT_AUTOTUNE "Autotune" +#define D_THERMOSTAT_RAMP_UP_HYBRID "Ramp up (Hybrid)" +#define D_THERMOSTAT_PI_HYBRID "PI (Hybrid)" +#define D_THERMOSTAT_AUTOTUNE_HYBRID "Autotune (Hybrid)" + // xsns_05_ds18b20.ino #define D_SENSOR_BUSY "Capteur occupé" #define D_SENSOR_CRC_ERROR "Erreur CRC capteur" diff --git a/tasmota/language/fy_NL.h b/tasmota/language/fy_NL.h index a023615f9..cf4d8a187 100644 --- a/tasmota/language/fy_NL.h +++ b/tasmota/language/fy_NL.h @@ -166,7 +166,6 @@ #define D_RESTART "Op 'e nij begjinne" #define D_RESTARTING "Op 'e nij begjinne" #define D_RESTART_REASON "Reden opnij starte" -#define D_RESTORE "herstelle" #define D_RETAINED "beholden" #define D_RULE "Regel" #define D_SAVE "Bewarje" @@ -192,7 +191,6 @@ #define D_TWILIGHT_ASTRONOMICAL "Astronomical" #define D_TWILIGHT_CIVIL "Civil" #define D_TWILIGHT_NAUTICAL "Nautical" -#define D_UPGRADE "upgrade" #define D_UPLOAD "Stjoere" #define D_UPTIME "Betjenstiid" #define D_USED "used" @@ -290,6 +288,7 @@ #define D_RESET_CONFIGURATION "Konfiguraasje weromsette" #define D_BACKUP_CONFIGURATION "Konfiguraasje opslaan" #define D_RESTORE_CONFIGURATION "Konfiguraasje herstelle" +#define D_START_RESTORE "Start restore" #define D_MAIN_MENU "Haadmenu" #define D_MODULE_PARAMETERS "Module parameters" @@ -547,6 +546,22 @@ #define D_DEVICE_INPUT "Yngong" #define D_DEVICE_OUTPUT "Útgong" +// xdrv_39_thermostat.ino +#define D_THERMOSTAT "Thermostat" +#define D_THERMOSTAT_SET_POINT "Set Point Temperature" +#define D_THERMOSTAT_SENSOR "Current Temperature" +#define D_THERMOSTAT_GRADIENT "Gradient Temperature" +#define D_THERMOSTAT_DUTY_CYCLE "Duty cycle" +#define D_THERMOSTAT_CYCLE_TIME "Cycle time" +#define D_THERMOSTAT_PI_AUTOTUNE "PI Auto tuning" +#define D_THERMOSTAT_CONTROL_METHOD "Control method" +#define D_THERMOSTAT_RAMP_UP "Ramp up" +#define D_THERMOSTAT_PI "PI" +#define D_THERMOSTAT_AUTOTUNE "Autotune" +#define D_THERMOSTAT_RAMP_UP_HYBRID "Ramp up (Hybrid)" +#define D_THERMOSTAT_PI_HYBRID "PI (Hybrid)" +#define D_THERMOSTAT_AUTOTUNE_HYBRID "Autotune (Hybrid)" + // xsns_05_ds18b20.ino #define D_SENSOR_BUSY "Sensor drok" #define D_SENSOR_CRC_ERROR "Sensor CRC flater" diff --git a/tasmota/language/he_HE.h b/tasmota/language/he_HE.h index 2474c88b1..e4199ab15 100644 --- a/tasmota/language/he_HE.h +++ b/tasmota/language/he_HE.h @@ -166,7 +166,6 @@ #define D_RESTART "איתחול" #define D_RESTARTING "הפעלה מחדש" #define D_RESTART_REASON "סיבת הפעלה מחדש" -#define D_RESTORE "שחזור" #define D_RETAINED "שמור" #define D_RULE "חוק" #define D_SAVE "שמירה" @@ -192,7 +191,6 @@ #define D_TWILIGHT_ASTRONOMICAL "Astronomical" #define D_TWILIGHT_CIVIL "Civil" #define D_TWILIGHT_NAUTICAL "Nautical" -#define D_UPGRADE "שדרוג" #define D_UPLOAD "העלאה" #define D_UPTIME "זמן עליה" #define D_USED "used" @@ -290,6 +288,7 @@ #define D_RESET_CONFIGURATION "אתחול הגדרות" #define D_BACKUP_CONFIGURATION "גיבוי הגדרות" #define D_RESTORE_CONFIGURATION "שחזור הגדרות" +#define D_START_RESTORE "Start restore" #define D_MAIN_MENU "תפריט ראשי" #define D_MODULE_PARAMETERS "מודול פרמטרים" @@ -547,6 +546,22 @@ #define D_DEVICE_INPUT "Input" #define D_DEVICE_OUTPUT "Output" +// xdrv_39_thermostat.ino +#define D_THERMOSTAT "Thermostat" +#define D_THERMOSTAT_SET_POINT "Set Point Temperature" +#define D_THERMOSTAT_SENSOR "Current Temperature" +#define D_THERMOSTAT_GRADIENT "Gradient Temperature" +#define D_THERMOSTAT_DUTY_CYCLE "Duty cycle" +#define D_THERMOSTAT_CYCLE_TIME "Cycle time" +#define D_THERMOSTAT_PI_AUTOTUNE "PI Auto tuning" +#define D_THERMOSTAT_CONTROL_METHOD "Control method" +#define D_THERMOSTAT_RAMP_UP "Ramp up" +#define D_THERMOSTAT_PI "PI" +#define D_THERMOSTAT_AUTOTUNE "Autotune" +#define D_THERMOSTAT_RAMP_UP_HYBRID "Ramp up (Hybrid)" +#define D_THERMOSTAT_PI_HYBRID "PI (Hybrid)" +#define D_THERMOSTAT_AUTOTUNE_HYBRID "Autotune (Hybrid)" + // xsns_05_ds18b20.ino #define D_SENSOR_BUSY "שרת עסוק" #define D_SENSOR_CRC_ERROR "בחיישן CRC שגיאת" diff --git a/tasmota/language/hu_HU.h b/tasmota/language/hu_HU.h index 817645cd8..914ae053a 100644 --- a/tasmota/language/hu_HU.h +++ b/tasmota/language/hu_HU.h @@ -166,7 +166,6 @@ #define D_RESTART "Újraindítás" #define D_RESTARTING "Újraindítás" #define D_RESTART_REASON "Utolsó újraindulás oka" -#define D_RESTORE "Visszaállítás" #define D_RETAINED "megtartott" #define D_RULE "Szabály" #define D_SAVE "Mentés" @@ -192,7 +191,6 @@ #define D_TWILIGHT_ASTRONOMICAL "Astronomical" #define D_TWILIGHT_CIVIL "Civil" #define D_TWILIGHT_NAUTICAL "Nautical" -#define D_UPGRADE "Frissítés" #define D_UPLOAD "Feltöltés" #define D_UPTIME "Üzemidő" #define D_USED "used" @@ -290,6 +288,7 @@ #define D_RESET_CONFIGURATION "Beállítások törlése" #define D_BACKUP_CONFIGURATION "Beállítások mentése" #define D_RESTORE_CONFIGURATION "Beállítások visszatöltése" +#define D_START_RESTORE "Start restore" #define D_MAIN_MENU "Menü" #define D_MODULE_PARAMETERS "Modul paraméterek" @@ -547,6 +546,22 @@ #define D_DEVICE_INPUT "Bemenet" #define D_DEVICE_OUTPUT "Kimenet" +// xdrv_39_thermostat.ino +#define D_THERMOSTAT "Thermostat" +#define D_THERMOSTAT_SET_POINT "Set Point Temperature" +#define D_THERMOSTAT_SENSOR "Current Temperature" +#define D_THERMOSTAT_GRADIENT "Gradient Temperature" +#define D_THERMOSTAT_DUTY_CYCLE "Duty cycle" +#define D_THERMOSTAT_CYCLE_TIME "Cycle time" +#define D_THERMOSTAT_PI_AUTOTUNE "PI Auto tuning" +#define D_THERMOSTAT_CONTROL_METHOD "Control method" +#define D_THERMOSTAT_RAMP_UP "Ramp up" +#define D_THERMOSTAT_PI "PI" +#define D_THERMOSTAT_AUTOTUNE "Autotune" +#define D_THERMOSTAT_RAMP_UP_HYBRID "Ramp up (Hybrid)" +#define D_THERMOSTAT_PI_HYBRID "PI (Hybrid)" +#define D_THERMOSTAT_AUTOTUNE_HYBRID "Autotune (Hybrid)" + // xsns_05_ds18b20.ino #define D_SENSOR_BUSY "Szenzor foglalt" #define D_SENSOR_CRC_ERROR "Szenzor CRC hiba" diff --git a/tasmota/language/it_IT.h b/tasmota/language/it_IT.h index 939747472..46b6a50cd 100644 --- a/tasmota/language/it_IT.h +++ b/tasmota/language/it_IT.h @@ -28,7 +28,7 @@ * Use online command StateText to translate ON, OFF, HOLD and TOGGLE. * Use online command Prefix to translate cmnd, stat and tele. * - * Updated until v9.4.0.1 - Last update 15.10.2023 + * Updated until v9.4.0.1 - Last update 18.11.2023 \*********************************************************************/ #define LANGUAGE_MODULE_NAME // Enable to display "Module Generic" (ie Spanish), Disable to display "Generic Module" (ie English) @@ -166,7 +166,6 @@ #define D_RESTART "Riavvia" #define D_RESTARTING "Riavvio" #define D_RESTART_REASON "Causa riavvio" -#define D_RESTORE "ripristino" #define D_RETAINED "salvato" #define D_RULE "Regola" #define D_SAVE "Salva" @@ -192,7 +191,6 @@ #define D_TWILIGHT_ASTRONOMICAL "astronomico" #define D_TWILIGHT_CIVIL "civile" #define D_TWILIGHT_NAUTICAL "nautico" -#define D_UPGRADE "aggiornamento" #define D_UPLOAD "Caricamento" #define D_UPTIME "Tempo accensione" #define D_USED "usati" @@ -290,6 +288,7 @@ #define D_RESET_CONFIGURATION "Impostazioni predefinite" #define D_BACKUP_CONFIGURATION "Salva impostazioni" #define D_RESTORE_CONFIGURATION "Carica impostazioni" +#define D_START_RESTORE "Avvia ripristino" #define D_MAIN_MENU "Menu principale" #define D_MODULE_PARAMETERS "Parametri modulo" @@ -547,6 +546,22 @@ #define D_DEVICE_INPUT "Ingresso" #define D_DEVICE_OUTPUT "Uscita" +// xdrv_39_thermostat.ino +#define D_THERMOSTAT "Termostato" +#define D_THERMOSTAT_SET_POINT "Temperatura impostata" +#define D_THERMOSTAT_SENSOR "Temperatura attuale" +#define D_THERMOSTAT_GRADIENT "Gradiente temperatura" +#define D_THERMOSTAT_DUTY_CYCLE "Ciclo lavoro" +#define D_THERMOSTAT_CYCLE_TIME "Tempo ciclo" +#define D_THERMOSTAT_PI_AUTOTUNE "Regolazione automatica PI" +#define D_THERMOSTAT_CONTROL_METHOD "Metodo controllo" +#define D_THERMOSTAT_RAMP_UP "Rampa" +#define D_THERMOSTAT_PI "PI" +#define D_THERMOSTAT_AUTOTUNE "Regolazione automatica" +#define D_THERMOSTAT_RAMP_UP_HYBRID "Rampa (ibrida)" +#define D_THERMOSTAT_PI_HYBRID "PI (ibdrida)" +#define D_THERMOSTAT_AUTOTUNE_HYBRID "Regolazione automatica (ibrida)" + // xsns_05_ds18b20.ino #define D_SENSOR_BUSY "Sensore occupato" #define D_SENSOR_CRC_ERROR "Errore CRC sensore" @@ -1204,6 +1219,7 @@ // xsns_106_gdk101.ino #define D_AVG_RAD_DOSE "Dose media radiazioni" +#define D_AVG_RAD_DOSE "Radiazioni" #define D_UNIT_US_H "µSv/h" #endif // _LANGUAGE_IT_IT_H_ diff --git a/tasmota/language/ko_KO.h b/tasmota/language/ko_KO.h index 6c5585d54..9ceffb0ab 100644 --- a/tasmota/language/ko_KO.h +++ b/tasmota/language/ko_KO.h @@ -166,7 +166,6 @@ #define D_RESTART "재시작" #define D_RESTARTING "재시작 중.." #define D_RESTART_REASON "재시작 사유" -#define D_RESTORE "복구" #define D_RETAINED "보류" #define D_RULE "규칙" #define D_SAVE "저장" @@ -192,7 +191,6 @@ #define D_TWILIGHT_ASTRONOMICAL "Astronomical" #define D_TWILIGHT_CIVIL "Civil" #define D_TWILIGHT_NAUTICAL "Nautical" -#define D_UPGRADE "업그레이드" #define D_UPLOAD "업로드" #define D_UPTIME "가동시간" #define D_USED "used" @@ -290,6 +288,7 @@ #define D_RESET_CONFIGURATION "설정 초기화" #define D_BACKUP_CONFIGURATION "설정 백업" #define D_RESTORE_CONFIGURATION "설정 복구" +#define D_START_RESTORE "Start restore" #define D_MAIN_MENU "메인 메뉴" #define D_MODULE_PARAMETERS "모듈 설정" @@ -547,6 +546,22 @@ #define D_DEVICE_INPUT "입력" #define D_DEVICE_OUTPUT "출력" +// xdrv_39_thermostat.ino +#define D_THERMOSTAT "Thermostat" +#define D_THERMOSTAT_SET_POINT "Set Point Temperature" +#define D_THERMOSTAT_SENSOR "Current Temperature" +#define D_THERMOSTAT_GRADIENT "Gradient Temperature" +#define D_THERMOSTAT_DUTY_CYCLE "Duty cycle" +#define D_THERMOSTAT_CYCLE_TIME "Cycle time" +#define D_THERMOSTAT_PI_AUTOTUNE "PI Auto tuning" +#define D_THERMOSTAT_CONTROL_METHOD "Control method" +#define D_THERMOSTAT_RAMP_UP "Ramp up" +#define D_THERMOSTAT_PI "PI" +#define D_THERMOSTAT_AUTOTUNE "Autotune" +#define D_THERMOSTAT_RAMP_UP_HYBRID "Ramp up (Hybrid)" +#define D_THERMOSTAT_PI_HYBRID "PI (Hybrid)" +#define D_THERMOSTAT_AUTOTUNE_HYBRID "Autotune (Hybrid)" + // xsns_05_ds18b20.ino #define D_SENSOR_BUSY "센서가 사용 중" #define D_SENSOR_CRC_ERROR "센서 CRC 에러" diff --git a/tasmota/language/nl_NL.h b/tasmota/language/nl_NL.h index 4ed85c94d..9927eb5e0 100644 --- a/tasmota/language/nl_NL.h +++ b/tasmota/language/nl_NL.h @@ -166,7 +166,6 @@ #define D_RESTART "Herstart" #define D_RESTARTING "Herstarten" #define D_RESTART_REASON "Reden herstart" -#define D_RESTORE "herstellen" #define D_RETAINED "behouden" #define D_RULE "Regel" #define D_SAVE "Opslaan" @@ -192,7 +191,6 @@ #define D_TWILIGHT_ASTRONOMICAL "Astronomical" #define D_TWILIGHT_CIVIL "Civil" #define D_TWILIGHT_NAUTICAL "Nautical" -#define D_UPGRADE "opwaarderen" #define D_UPLOAD "Verzenden" #define D_UPTIME "Bedrijfstijd" #define D_USED "used" @@ -290,6 +288,7 @@ #define D_RESET_CONFIGURATION "Reset Configuratie" #define D_BACKUP_CONFIGURATION "Bewaar Configuratie" #define D_RESTORE_CONFIGURATION "Herstel Configuration" +#define D_START_RESTORE "Start restore" #define D_MAIN_MENU "Hoofdmenu" #define D_MODULE_PARAMETERS "Module parameters" @@ -547,6 +546,22 @@ #define D_DEVICE_INPUT "Ingang" #define D_DEVICE_OUTPUT "Uitgang" +// xdrv_39_thermostat.ino +#define D_THERMOSTAT "Thermostat" +#define D_THERMOSTAT_SET_POINT "Set Point Temperature" +#define D_THERMOSTAT_SENSOR "Current Temperature" +#define D_THERMOSTAT_GRADIENT "Gradient Temperature" +#define D_THERMOSTAT_DUTY_CYCLE "Duty cycle" +#define D_THERMOSTAT_CYCLE_TIME "Cycle time" +#define D_THERMOSTAT_PI_AUTOTUNE "PI Auto tuning" +#define D_THERMOSTAT_CONTROL_METHOD "Control method" +#define D_THERMOSTAT_RAMP_UP "Ramp up" +#define D_THERMOSTAT_PI "PI" +#define D_THERMOSTAT_AUTOTUNE "Autotune" +#define D_THERMOSTAT_RAMP_UP_HYBRID "Ramp up (Hybrid)" +#define D_THERMOSTAT_PI_HYBRID "PI (Hybrid)" +#define D_THERMOSTAT_AUTOTUNE_HYBRID "Autotune (Hybrid)" + // xsns_05_ds18b20.ino #define D_SENSOR_BUSY "Sensor bezet" #define D_SENSOR_CRC_ERROR "Sensor CRC fout" diff --git a/tasmota/language/pl_PL.h b/tasmota/language/pl_PL.h index 6665faecf..1f1f44bef 100644 --- a/tasmota/language/pl_PL.h +++ b/tasmota/language/pl_PL.h @@ -166,7 +166,6 @@ #define D_RESTART "Restart" #define D_RESTARTING "Restartowanie" #define D_RESTART_REASON "Przyczyna restartu" -#define D_RESTORE "Przywracanie" #define D_RETAINED "Zachowane" #define D_RULE "Reguła" #define D_SAVE "Zapisz" @@ -192,7 +191,6 @@ #define D_TWILIGHT_ASTRONOMICAL "Astronomical" #define D_TWILIGHT_CIVIL "Civil" #define D_TWILIGHT_NAUTICAL "Nautical" -#define D_UPGRADE "aktualizacji" #define D_UPLOAD "Wgraj" #define D_UPTIME "Czas pracy" #define D_USED "użyte" @@ -290,6 +288,7 @@ #define D_RESET_CONFIGURATION "Reset ustawień" #define D_BACKUP_CONFIGURATION "Kopia ustawień" #define D_RESTORE_CONFIGURATION "Przywracanie ustawień" +#define D_START_RESTORE "Start restore" #define D_MAIN_MENU "Menu główne" #define D_MODULE_PARAMETERS "Parametry modułu" @@ -547,6 +546,22 @@ #define D_DEVICE_INPUT "Wejście" #define D_DEVICE_OUTPUT "Wyjście" +// xdrv_39_thermostat.ino +#define D_THERMOSTAT "Thermostat" +#define D_THERMOSTAT_SET_POINT "Set Point Temperature" +#define D_THERMOSTAT_SENSOR "Current Temperature" +#define D_THERMOSTAT_GRADIENT "Gradient Temperature" +#define D_THERMOSTAT_DUTY_CYCLE "Duty cycle" +#define D_THERMOSTAT_CYCLE_TIME "Cycle time" +#define D_THERMOSTAT_PI_AUTOTUNE "PI Auto tuning" +#define D_THERMOSTAT_CONTROL_METHOD "Control method" +#define D_THERMOSTAT_RAMP_UP "Ramp up" +#define D_THERMOSTAT_PI "PI" +#define D_THERMOSTAT_AUTOTUNE "Autotune" +#define D_THERMOSTAT_RAMP_UP_HYBRID "Ramp up (Hybrid)" +#define D_THERMOSTAT_PI_HYBRID "PI (Hybrid)" +#define D_THERMOSTAT_AUTOTUNE_HYBRID "Autotune (Hybrid)" + // xsns_05_ds18b20.ino #define D_SENSOR_BUSY "Czujnik zajęty" #define D_SENSOR_CRC_ERROR "Błąd CRC czujnika" diff --git a/tasmota/language/pt_BR.h b/tasmota/language/pt_BR.h index d4b07da40..3dac6d2bc 100644 --- a/tasmota/language/pt_BR.h +++ b/tasmota/language/pt_BR.h @@ -166,7 +166,6 @@ #define D_RESTART "Reiniciar" #define D_RESTARTING "Reiniciando" #define D_RESTART_REASON "Motivo do reinício" -#define D_RESTORE "Restauração" #define D_RETAINED "Manter" #define D_RULE "Regra" #define D_SAVE "Salvar" @@ -192,7 +191,6 @@ #define D_TWILIGHT_ASTRONOMICAL "Astronomical" #define D_TWILIGHT_CIVIL "Civil" #define D_TWILIGHT_NAUTICAL "Nautical" -#define D_UPGRADE "atualização" #define D_UPLOAD "Enviar" #define D_UPTIME "Tempo de atividade" #define D_USED "used" @@ -290,6 +288,7 @@ #define D_RESET_CONFIGURATION "Apagar configuração" #define D_BACKUP_CONFIGURATION "Salvar configuração" #define D_RESTORE_CONFIGURATION "Repor configuração" +#define D_START_RESTORE "Start restore" #define D_MAIN_MENU "Menu principal" #define D_MODULE_PARAMETERS "Parâmetros do módulo" @@ -547,6 +546,22 @@ #define D_DEVICE_INPUT "Entrada" #define D_DEVICE_OUTPUT "Saída" +// xdrv_39_thermostat.ino +#define D_THERMOSTAT "Thermostat" +#define D_THERMOSTAT_SET_POINT "Set Point Temperature" +#define D_THERMOSTAT_SENSOR "Current Temperature" +#define D_THERMOSTAT_GRADIENT "Gradient Temperature" +#define D_THERMOSTAT_DUTY_CYCLE "Duty cycle" +#define D_THERMOSTAT_CYCLE_TIME "Cycle time" +#define D_THERMOSTAT_PI_AUTOTUNE "PI Auto tuning" +#define D_THERMOSTAT_CONTROL_METHOD "Control method" +#define D_THERMOSTAT_RAMP_UP "Ramp up" +#define D_THERMOSTAT_PI "PI" +#define D_THERMOSTAT_AUTOTUNE "Autotune" +#define D_THERMOSTAT_RAMP_UP_HYBRID "Ramp up (Hybrid)" +#define D_THERMOSTAT_PI_HYBRID "PI (Hybrid)" +#define D_THERMOSTAT_AUTOTUNE_HYBRID "Autotune (Hybrid)" + // xsns_05_ds18b20.ino #define D_SENSOR_BUSY "Sensor ocupado" #define D_SENSOR_CRC_ERROR "Erro CRC sensor" diff --git a/tasmota/language/pt_PT.h b/tasmota/language/pt_PT.h index c2cc25392..8ae556c7e 100644 --- a/tasmota/language/pt_PT.h +++ b/tasmota/language/pt_PT.h @@ -166,7 +166,6 @@ #define D_RESTART "Reiniciar" #define D_RESTARTING "A reiniciar" #define D_RESTART_REASON "Razão do reinicio" -#define D_RESTORE "Restauro" #define D_RETAINED "Manter" #define D_RULE "Regra" #define D_SAVE "Guardar" @@ -192,7 +191,6 @@ #define D_TWILIGHT_ASTRONOMICAL "Astronomical" #define D_TWILIGHT_CIVIL "Civil" #define D_TWILIGHT_NAUTICAL "Nautical" -#define D_UPGRADE "Atualizar" #define D_UPLOAD "Enviar" #define D_UPTIME "Tempo de Atividade" #define D_USED "used" @@ -290,6 +288,7 @@ #define D_RESET_CONFIGURATION "Apagar configuração" #define D_BACKUP_CONFIGURATION "Guardar configuração" #define D_RESTORE_CONFIGURATION "Repor configuração" +#define D_START_RESTORE "Start restore" #define D_MAIN_MENU "Menu Principal" #define D_MODULE_PARAMETERS "Parametros do Módulo" @@ -547,6 +546,22 @@ #define D_DEVICE_INPUT "Entrada" #define D_DEVICE_OUTPUT "Saída" +// xdrv_39_thermostat.ino +#define D_THERMOSTAT "Thermostat" +#define D_THERMOSTAT_SET_POINT "Set Point Temperature" +#define D_THERMOSTAT_SENSOR "Current Temperature" +#define D_THERMOSTAT_GRADIENT "Gradient Temperature" +#define D_THERMOSTAT_DUTY_CYCLE "Duty cycle" +#define D_THERMOSTAT_CYCLE_TIME "Cycle time" +#define D_THERMOSTAT_PI_AUTOTUNE "PI Auto tuning" +#define D_THERMOSTAT_CONTROL_METHOD "Control method" +#define D_THERMOSTAT_RAMP_UP "Ramp up" +#define D_THERMOSTAT_PI "PI" +#define D_THERMOSTAT_AUTOTUNE "Autotune" +#define D_THERMOSTAT_RAMP_UP_HYBRID "Ramp up (Hybrid)" +#define D_THERMOSTAT_PI_HYBRID "PI (Hybrid)" +#define D_THERMOSTAT_AUTOTUNE_HYBRID "Autotune (Hybrid)" + // xsns_05_ds18b20.ino #define D_SENSOR_BUSY "Sensor ocupado" #define D_SENSOR_CRC_ERROR "Erro no CRC do sensor" diff --git a/tasmota/language/ro_RO.h b/tasmota/language/ro_RO.h index ce868f944..6f09c9a27 100644 --- a/tasmota/language/ro_RO.h +++ b/tasmota/language/ro_RO.h @@ -166,7 +166,6 @@ #define D_RESTART "Restart" #define D_RESTARTING "Restartare" #define D_RESTART_REASON "Motiv Restartare" -#define D_RESTORE "Restaurare" #define D_RETAINED "Păstrare" #define D_RULE "Regulă" #define D_SAVE "Salvare" @@ -192,7 +191,6 @@ #define D_TWILIGHT_ASTRONOMICAL "Astronomical" #define D_TWILIGHT_CIVIL "Civil" #define D_TWILIGHT_NAUTICAL "Nautical" -#define D_UPGRADE "actualizare" #define D_UPLOAD "Încărcăre" #define D_UPTIME "Folosință" #define D_USED "used" @@ -290,6 +288,7 @@ #define D_RESET_CONFIGURATION "Resetează Configurare" #define D_BACKUP_CONFIGURATION "Backup Configurare" #define D_RESTORE_CONFIGURATION "Restaurează Configurație" +#define D_START_RESTORE "Start restore" #define D_MAIN_MENU "Meniu Principal" #define D_MODULE_PARAMETERS "Parametri modul" @@ -547,6 +546,22 @@ #define D_DEVICE_INPUT "Intrare" #define D_DEVICE_OUTPUT "Ieșire" +// xdrv_39_thermostat.ino +#define D_THERMOSTAT "Thermostat" +#define D_THERMOSTAT_SET_POINT "Set Point Temperature" +#define D_THERMOSTAT_SENSOR "Current Temperature" +#define D_THERMOSTAT_GRADIENT "Gradient Temperature" +#define D_THERMOSTAT_DUTY_CYCLE "Duty cycle" +#define D_THERMOSTAT_CYCLE_TIME "Cycle time" +#define D_THERMOSTAT_PI_AUTOTUNE "PI Auto tuning" +#define D_THERMOSTAT_CONTROL_METHOD "Control method" +#define D_THERMOSTAT_RAMP_UP "Ramp up" +#define D_THERMOSTAT_PI "PI" +#define D_THERMOSTAT_AUTOTUNE "Autotune" +#define D_THERMOSTAT_RAMP_UP_HYBRID "Ramp up (Hybrid)" +#define D_THERMOSTAT_PI_HYBRID "PI (Hybrid)" +#define D_THERMOSTAT_AUTOTUNE_HYBRID "Autotune (Hybrid)" + // xsns_05_ds18b20.ino #define D_SENSOR_BUSY "Senzor ocupat" #define D_SENSOR_CRC_ERROR "Eroare senzor CRC" diff --git a/tasmota/language/ru_RU.h b/tasmota/language/ru_RU.h index 60aecb863..9de1e95cb 100644 --- a/tasmota/language/ru_RU.h +++ b/tasmota/language/ru_RU.h @@ -167,7 +167,6 @@ #define D_RESTART "Перезагрузка" #define D_RESTARTING "Перезагрузка" #define D_RESTART_REASON "Причина перезагрузки" -#define D_RESTORE "восстановление" #define D_RETAINED "нераспред." #define D_RULE "Правило" #define D_SAVE "Сохранить" @@ -193,7 +192,6 @@ #define D_TWILIGHT_ASTRONOMICAL "Astronomical" #define D_TWILIGHT_CIVIL "Civil" #define D_TWILIGHT_NAUTICAL "Nautical" -#define D_UPGRADE "обновление" #define D_UPLOAD "Загрузить" #define D_UPTIME "Аптайм" #define D_USED "использовано" @@ -291,6 +289,7 @@ #define D_RESET_CONFIGURATION "Сброс настроек" #define D_BACKUP_CONFIGURATION "Резервное копирование настроек" #define D_RESTORE_CONFIGURATION "Восстановление настроек" +#define D_START_RESTORE "Start restore" #define D_MAIN_MENU "Главное меню" #define D_MODULE_PARAMETERS "Настройки модуля" @@ -548,6 +547,22 @@ #define D_DEVICE_INPUT "Вход" #define D_DEVICE_OUTPUT "Выход" +// xdrv_39_thermostat.ino +#define D_THERMOSTAT "Thermostat" +#define D_THERMOSTAT_SET_POINT "Set Point Temperature" +#define D_THERMOSTAT_SENSOR "Current Temperature" +#define D_THERMOSTAT_GRADIENT "Gradient Temperature" +#define D_THERMOSTAT_DUTY_CYCLE "Duty cycle" +#define D_THERMOSTAT_CYCLE_TIME "Cycle time" +#define D_THERMOSTAT_PI_AUTOTUNE "PI Auto tuning" +#define D_THERMOSTAT_CONTROL_METHOD "Control method" +#define D_THERMOSTAT_RAMP_UP "Ramp up" +#define D_THERMOSTAT_PI "PI" +#define D_THERMOSTAT_AUTOTUNE "Autotune" +#define D_THERMOSTAT_RAMP_UP_HYBRID "Ramp up (Hybrid)" +#define D_THERMOSTAT_PI_HYBRID "PI (Hybrid)" +#define D_THERMOSTAT_AUTOTUNE_HYBRID "Autotune (Hybrid)" + // xsns_05_ds18b20.ino #define D_SENSOR_BUSY "Датчик DS18x20 занят" #define D_SENSOR_CRC_ERROR "Датчик DS18x20 - ошибка CRC" diff --git a/tasmota/language/sk_SK.h b/tasmota/language/sk_SK.h index c124beb66..e943a2438 100644 --- a/tasmota/language/sk_SK.h +++ b/tasmota/language/sk_SK.h @@ -166,7 +166,6 @@ #define D_RESTART "Reštart" #define D_RESTARTING "Reštartuje sa" #define D_RESTART_REASON "Príčina reštartu" -#define D_RESTORE "Obnoviť" #define D_RETAINED "Zachované" #define D_RULE "Pravidlo" #define D_SAVE "Ulož" @@ -192,7 +191,6 @@ #define D_TWILIGHT_ASTRONOMICAL "Astronomical" #define D_TWILIGHT_CIVIL "Civil" #define D_TWILIGHT_NAUTICAL "Nautical" -#define D_UPGRADE "aktualizáciu" #define D_UPLOAD "Nahrávanie..." #define D_UPTIME "Uptime" #define D_USED "used" @@ -290,6 +288,7 @@ #define D_RESET_CONFIGURATION "Reset nastavení" #define D_BACKUP_CONFIGURATION "Záloha nastavení" #define D_RESTORE_CONFIGURATION "Obnovenie nastavení" +#define D_START_RESTORE "Start restore" #define D_MAIN_MENU "Hlavné menu" #define D_MODULE_PARAMETERS "Nastavenia modulu" @@ -547,6 +546,22 @@ #define D_DEVICE_INPUT "Input" #define D_DEVICE_OUTPUT "Output" +// xdrv_39_thermostat.ino +#define D_THERMOSTAT "Thermostat" +#define D_THERMOSTAT_SET_POINT "Set Point Temperature" +#define D_THERMOSTAT_SENSOR "Current Temperature" +#define D_THERMOSTAT_GRADIENT "Gradient Temperature" +#define D_THERMOSTAT_DUTY_CYCLE "Duty cycle" +#define D_THERMOSTAT_CYCLE_TIME "Cycle time" +#define D_THERMOSTAT_PI_AUTOTUNE "PI Auto tuning" +#define D_THERMOSTAT_CONTROL_METHOD "Control method" +#define D_THERMOSTAT_RAMP_UP "Ramp up" +#define D_THERMOSTAT_PI "PI" +#define D_THERMOSTAT_AUTOTUNE "Autotune" +#define D_THERMOSTAT_RAMP_UP_HYBRID "Ramp up (Hybrid)" +#define D_THERMOSTAT_PI_HYBRID "PI (Hybrid)" +#define D_THERMOSTAT_AUTOTUNE_HYBRID "Autotune (Hybrid)" + // xsns_05_ds18b20.ino #define D_SENSOR_BUSY "Sensor DS18x20 obsadený" #define D_SENSOR_CRC_ERROR "Sensor DS18x20 chyba CRC" diff --git a/tasmota/language/sv_SE.h b/tasmota/language/sv_SE.h index dec707a3b..72e940b12 100644 --- a/tasmota/language/sv_SE.h +++ b/tasmota/language/sv_SE.h @@ -166,7 +166,6 @@ #define D_RESTART "Omstart" #define D_RESTARTING "Startar om" #define D_RESTART_REASON "Omstartsorsak" -#define D_RESTORE "återställ" #define D_RETAINED "bevarad" #define D_RULE "Regel" #define D_SAVE "Spara" @@ -192,7 +191,6 @@ #define D_TWILIGHT_ASTRONOMICAL "Astronomical" #define D_TWILIGHT_CIVIL "Civil" #define D_TWILIGHT_NAUTICAL "Nautical" -#define D_UPGRADE "uppgradera" #define D_UPLOAD "Ladda upp" #define D_UPTIME "Upptid" #define D_USED "used" @@ -290,6 +288,7 @@ #define D_RESET_CONFIGURATION "Nollställ konfiguration" #define D_BACKUP_CONFIGURATION "Säkerhetskopiera konfiguration" #define D_RESTORE_CONFIGURATION "Återställ konfiguration" +#define D_START_RESTORE "Start restore" #define D_MAIN_MENU "Huvudmeny" #define D_MODULE_PARAMETERS "Modulparameterar" @@ -547,6 +546,22 @@ #define D_DEVICE_INPUT "Input" #define D_DEVICE_OUTPUT "Output" +// xdrv_39_thermostat.ino +#define D_THERMOSTAT "Thermostat" +#define D_THERMOSTAT_SET_POINT "Set Point Temperature" +#define D_THERMOSTAT_SENSOR "Current Temperature" +#define D_THERMOSTAT_GRADIENT "Gradient Temperature" +#define D_THERMOSTAT_DUTY_CYCLE "Duty cycle" +#define D_THERMOSTAT_CYCLE_TIME "Cycle time" +#define D_THERMOSTAT_PI_AUTOTUNE "PI Auto tuning" +#define D_THERMOSTAT_CONTROL_METHOD "Control method" +#define D_THERMOSTAT_RAMP_UP "Ramp up" +#define D_THERMOSTAT_PI "PI" +#define D_THERMOSTAT_AUTOTUNE "Autotune" +#define D_THERMOSTAT_RAMP_UP_HYBRID "Ramp up (Hybrid)" +#define D_THERMOSTAT_PI_HYBRID "PI (Hybrid)" +#define D_THERMOSTAT_AUTOTUNE_HYBRID "Autotune (Hybrid)" + // xsns_05_ds18b20.ino #define D_SENSOR_BUSY "Sensor upptagen" #define D_SENSOR_CRC_ERROR "Sensor CRC-fel" diff --git a/tasmota/language/tr_TR.h b/tasmota/language/tr_TR.h index 175fa7e64..259825231 100644 --- a/tasmota/language/tr_TR.h +++ b/tasmota/language/tr_TR.h @@ -166,7 +166,6 @@ #define D_RESTART "Yeniden Başlat" #define D_RESTARTING "Yeniden Başlatılıyor" #define D_RESTART_REASON "Yeniden Başlatma Sebebi" -#define D_RESTORE "restore" #define D_RETAINED "tutulan" #define D_RULE "Kural" #define D_SAVE "Kaydet" @@ -192,7 +191,6 @@ #define D_TWILIGHT_ASTRONOMICAL "Astronomical" #define D_TWILIGHT_CIVIL "Civil" #define D_TWILIGHT_NAUTICAL "Nautical" -#define D_UPGRADE "yükseltme" #define D_UPLOAD "Yükleme" #define D_UPTIME "Açık Kalma Süresi" #define D_USED "used" @@ -290,6 +288,7 @@ #define D_RESET_CONFIGURATION "Tüm Ayarları Resetle" #define D_BACKUP_CONFIGURATION "Ayarları Yedekle" #define D_RESTORE_CONFIGURATION "Ayarları Geri Yükle" +#define D_START_RESTORE "Start restore" #define D_MAIN_MENU "Ana Menü" #define D_MODULE_PARAMETERS "Modül parametreleri" @@ -547,6 +546,22 @@ #define D_DEVICE_INPUT "Input" #define D_DEVICE_OUTPUT "Output" +// xdrv_39_thermostat.ino +#define D_THERMOSTAT "Thermostat" +#define D_THERMOSTAT_SET_POINT "Set Point Temperature" +#define D_THERMOSTAT_SENSOR "Current Temperature" +#define D_THERMOSTAT_GRADIENT "Gradient Temperature" +#define D_THERMOSTAT_DUTY_CYCLE "Duty cycle" +#define D_THERMOSTAT_CYCLE_TIME "Cycle time" +#define D_THERMOSTAT_PI_AUTOTUNE "PI Auto tuning" +#define D_THERMOSTAT_CONTROL_METHOD "Control method" +#define D_THERMOSTAT_RAMP_UP "Ramp up" +#define D_THERMOSTAT_PI "PI" +#define D_THERMOSTAT_AUTOTUNE "Autotune" +#define D_THERMOSTAT_RAMP_UP_HYBRID "Ramp up (Hybrid)" +#define D_THERMOSTAT_PI_HYBRID "PI (Hybrid)" +#define D_THERMOSTAT_AUTOTUNE_HYBRID "Autotune (Hybrid)" + // xsns_05_ds18b20.ino #define D_SENSOR_BUSY "Sensör başgül" #define D_SENSOR_CRC_ERROR "Sensor CRC hatası" diff --git a/tasmota/language/uk_UA.h b/tasmota/language/uk_UA.h index b8ea15e14..ad9834916 100644 --- a/tasmota/language/uk_UA.h +++ b/tasmota/language/uk_UA.h @@ -166,7 +166,6 @@ #define D_RESTART "Перезавантаження" #define D_RESTARTING "Перезавантаження" #define D_RESTART_REASON "Причина перезавантаження" -#define D_RESTORE "відновлення" #define D_RETAINED "зберігати" #define D_RULE "Правило" #define D_SAVE "Зберегти" @@ -192,7 +191,6 @@ #define D_TWILIGHT_ASTRONOMICAL "Astronomical" #define D_TWILIGHT_CIVIL "Civil" #define D_TWILIGHT_NAUTICAL "Nautical" -#define D_UPGRADE "оновлення" #define D_UPLOAD "Завантажити" #define D_UPTIME "Час роботи" #define D_USED "used" @@ -290,6 +288,7 @@ #define D_RESET_CONFIGURATION "Скидання конфігурації" #define D_BACKUP_CONFIGURATION "Резервне копіювання конфігурації" #define D_RESTORE_CONFIGURATION "Відновлення конфігурації" +#define D_START_RESTORE "Start restore" #define D_MAIN_MENU "Головне меню" #define D_MODULE_PARAMETERS "Параметри модуля" @@ -547,6 +546,22 @@ #define D_DEVICE_INPUT "Input" #define D_DEVICE_OUTPUT "Output" +// xdrv_39_thermostat.ino +#define D_THERMOSTAT "Thermostat" +#define D_THERMOSTAT_SET_POINT "Set Point Temperature" +#define D_THERMOSTAT_SENSOR "Current Temperature" +#define D_THERMOSTAT_GRADIENT "Gradient Temperature" +#define D_THERMOSTAT_DUTY_CYCLE "Duty cycle" +#define D_THERMOSTAT_CYCLE_TIME "Cycle time" +#define D_THERMOSTAT_PI_AUTOTUNE "PI Auto tuning" +#define D_THERMOSTAT_CONTROL_METHOD "Control method" +#define D_THERMOSTAT_RAMP_UP "Ramp up" +#define D_THERMOSTAT_PI "PI" +#define D_THERMOSTAT_AUTOTUNE "Autotune" +#define D_THERMOSTAT_RAMP_UP_HYBRID "Ramp up (Hybrid)" +#define D_THERMOSTAT_PI_HYBRID "PI (Hybrid)" +#define D_THERMOSTAT_AUTOTUNE_HYBRID "Autotune (Hybrid)" + // xsns_05_ds18b20.ino #define D_SENSOR_BUSY "Давач DS18x20 зайнятий" #define D_SENSOR_CRC_ERROR "Давач DS18x20 - помилка CRC" diff --git a/tasmota/language/vi_VN.h b/tasmota/language/vi_VN.h index c3327ae49..4f4297646 100644 --- a/tasmota/language/vi_VN.h +++ b/tasmota/language/vi_VN.h @@ -166,7 +166,6 @@ #define D_RESTART "Khởi động lại" #define D_RESTARTING "Đang khởi động" #define D_RESTART_REASON "Lý do khởi động lại" -#define D_RESTORE "khôi phục" #define D_RETAINED "lưu giữ" #define D_RULE "Quy luật" #define D_SAVE "Lưu" @@ -192,7 +191,6 @@ #define D_TWILIGHT_ASTRONOMICAL "Astronomical" #define D_TWILIGHT_CIVIL "Civil" #define D_TWILIGHT_NAUTICAL "Nautical" -#define D_UPGRADE "nâng cấp" #define D_UPLOAD "Tải lên" #define D_UPTIME "Thời gian chạy" #define D_USED "used" @@ -290,6 +288,7 @@ #define D_RESET_CONFIGURATION "Xóa cấu hình" #define D_BACKUP_CONFIGURATION "Tạo bản lưu cấu hình" #define D_RESTORE_CONFIGURATION "Khôi phục cấu hình" +#define D_START_RESTORE "Start restore" #define D_MAIN_MENU "Màn hình chính" #define D_MODULE_PARAMETERS "Các thông số mô đun" @@ -547,6 +546,22 @@ #define D_DEVICE_INPUT "Đầu vào" #define D_DEVICE_OUTPUT "Đầu ra" +// xdrv_39_thermostat.ino +#define D_THERMOSTAT "Thermostat" +#define D_THERMOSTAT_SET_POINT "Set Point Temperature" +#define D_THERMOSTAT_SENSOR "Current Temperature" +#define D_THERMOSTAT_GRADIENT "Gradient Temperature" +#define D_THERMOSTAT_DUTY_CYCLE "Duty cycle" +#define D_THERMOSTAT_CYCLE_TIME "Cycle time" +#define D_THERMOSTAT_PI_AUTOTUNE "PI Auto tuning" +#define D_THERMOSTAT_CONTROL_METHOD "Control method" +#define D_THERMOSTAT_RAMP_UP "Ramp up" +#define D_THERMOSTAT_PI "PI" +#define D_THERMOSTAT_AUTOTUNE "Autotune" +#define D_THERMOSTAT_RAMP_UP_HYBRID "Ramp up (Hybrid)" +#define D_THERMOSTAT_PI_HYBRID "PI (Hybrid)" +#define D_THERMOSTAT_AUTOTUNE_HYBRID "Autotune (Hybrid)" + // xsns_05_ds18b20.ino #define D_SENSOR_BUSY "Cảm biến đang bận" #define D_SENSOR_CRC_ERROR "Cảm biến CRC lỗi" diff --git a/tasmota/language/zh_CN.h b/tasmota/language/zh_CN.h index 651afcb15..1c49fd023 100644 --- a/tasmota/language/zh_CN.h +++ b/tasmota/language/zh_CN.h @@ -166,7 +166,6 @@ #define D_RESTART "重启" #define D_RESTARTING "正在重启" #define D_RESTART_REASON "重启原因" -#define D_RESTORE "恢复" #define D_RETAINED "已保留" #define D_RULE "规则" #define D_SAVE "保存" @@ -192,7 +191,6 @@ #define D_TWILIGHT_ASTRONOMICAL "Astronomical" #define D_TWILIGHT_CIVIL "Civil" #define D_TWILIGHT_NAUTICAL "Nautical" -#define D_UPGRADE "升级" #define D_UPLOAD "上传" #define D_UPTIME "运行时间" #define D_USED "已使用" @@ -290,6 +288,7 @@ #define D_RESET_CONFIGURATION "重置配置" #define D_BACKUP_CONFIGURATION "备份配置" #define D_RESTORE_CONFIGURATION "还原配置" +#define D_START_RESTORE "Start restore" #define D_MAIN_MENU "主菜单" #define D_MODULE_PARAMETERS "模块设置" @@ -547,6 +546,22 @@ #define D_DEVICE_INPUT "Input" #define D_DEVICE_OUTPUT "Output" +// xdrv_39_thermostat.ino +#define D_THERMOSTAT "Thermostat" +#define D_THERMOSTAT_SET_POINT "Set Point Temperature" +#define D_THERMOSTAT_SENSOR "Current Temperature" +#define D_THERMOSTAT_GRADIENT "Gradient Temperature" +#define D_THERMOSTAT_DUTY_CYCLE "Duty cycle" +#define D_THERMOSTAT_CYCLE_TIME "Cycle time" +#define D_THERMOSTAT_PI_AUTOTUNE "PI Auto tuning" +#define D_THERMOSTAT_CONTROL_METHOD "Control method" +#define D_THERMOSTAT_RAMP_UP "Ramp up" +#define D_THERMOSTAT_PI "PI" +#define D_THERMOSTAT_AUTOTUNE "Autotune" +#define D_THERMOSTAT_RAMP_UP_HYBRID "Ramp up (Hybrid)" +#define D_THERMOSTAT_PI_HYBRID "PI (Hybrid)" +#define D_THERMOSTAT_AUTOTUNE_HYBRID "Autotune (Hybrid)" + // xsns_05_ds18b20.ino #define D_SENSOR_BUSY "传感器正忙" #define D_SENSOR_CRC_ERROR "传感器 CRC 校验错误" diff --git a/tasmota/language/zh_TW.h b/tasmota/language/zh_TW.h index 897fad62f..f45bb2b90 100644 --- a/tasmota/language/zh_TW.h +++ b/tasmota/language/zh_TW.h @@ -166,7 +166,6 @@ #define D_RESTART "重新啟動" #define D_RESTARTING "正在重新啟動" #define D_RESTART_REASON "重新啟動的原因" -#define D_RESTORE "讀取設定" #define D_RETAINED "已保留" #define D_RULE "規則" #define D_SAVE "儲存" @@ -192,7 +191,6 @@ #define D_TWILIGHT_ASTRONOMICAL "Astronomical" #define D_TWILIGHT_CIVIL "Civil" #define D_TWILIGHT_NAUTICAL "Nautical" -#define D_UPGRADE "升級" #define D_UPLOAD "上傳" #define D_UPTIME "啟動時間" #define D_USED "used" @@ -290,6 +288,7 @@ #define D_RESET_CONFIGURATION "重設設定" #define D_BACKUP_CONFIGURATION "備份設定" #define D_RESTORE_CONFIGURATION "回復設定" +#define D_START_RESTORE "Start restore" #define D_MAIN_MENU "主選單" #define D_MODULE_PARAMETERS "模組參數" @@ -547,6 +546,22 @@ #define D_DEVICE_INPUT "輸入" #define D_DEVICE_OUTPUT "輸出" +// xdrv_39_thermostat.ino +#define D_THERMOSTAT "Thermostat" +#define D_THERMOSTAT_SET_POINT "Set Point Temperature" +#define D_THERMOSTAT_SENSOR "Current Temperature" +#define D_THERMOSTAT_GRADIENT "Gradient Temperature" +#define D_THERMOSTAT_DUTY_CYCLE "Duty cycle" +#define D_THERMOSTAT_CYCLE_TIME "Cycle time" +#define D_THERMOSTAT_PI_AUTOTUNE "PI Auto tuning" +#define D_THERMOSTAT_CONTROL_METHOD "Control method" +#define D_THERMOSTAT_RAMP_UP "Ramp up" +#define D_THERMOSTAT_PI "PI" +#define D_THERMOSTAT_AUTOTUNE "Autotune" +#define D_THERMOSTAT_RAMP_UP_HYBRID "Ramp up (Hybrid)" +#define D_THERMOSTAT_PI_HYBRID "PI (Hybrid)" +#define D_THERMOSTAT_AUTOTUNE_HYBRID "Autotune (Hybrid)" + // xsns_05_ds18b20.ino #define D_SENSOR_BUSY "感應器忙碌中" #define D_SENSOR_CRC_ERROR "感應器 CRC 校驗錯誤" diff --git a/tasmota/my_user_config.h b/tasmota/my_user_config.h index d1f672f68..2f5543e15 100644 --- a/tasmota/my_user_config.h +++ b/tasmota/my_user_config.h @@ -1029,7 +1029,7 @@ //#define USE_PROMETHEUS // Add support for https://prometheus.io/ metrics exporting over HTTP /metrics endpoint -//#define USE_NEOPOOL // Add support for Sugar Valley NeoPool Controller - also known under brands Hidrolife, Aquascenic, Oxilife, Bionet, Hidroniser, UVScenic, Station, Brilix, Bayrol and Hay (+6k flash, +60 mem) +//#define USE_NEOPOOL // Add support for Sugar Valley NeoPool Controller - also known under brands Hidrolife, Aquascenic, Oxilife, Bionet, Hidroniser, UVScenic, Station, Brilix, Bayrol and Hay (+14k flash, +120 mem) // #define NEOPOOL_MODBUS_ADDRESS 1 // Any modbus address //#define USE_FLOWRATEMETER // Add support for water flow meter YF-DN50 and similary (+1k7 code) @@ -1141,6 +1141,8 @@ // Note that only one cipher is enabled: ECDHE_RSA_WITH_AES_128_GCM_SHA256 which is very commonly used and highly secure #define USE_BERRY_WEBCLIENT_USERAGENT "TasmotaClient" // default user-agent used, can be changed with `wc.set_useragent()` #define USE_BERRY_WEBCLIENT_TIMEOUT 2000 // Default timeout in milliseconds + //#define USE_BERRY_PARTITION_WIZARD // Add a button to dynamically load the Partion Wizard from a bec file online (+1.3KB Flash) + #define USE_BERRY_PARTITION_WIZARD_URL "http://ota.tasmota.com/tapp/partition_wizard.bec" #define USE_BERRY_TCPSERVER // Enable TCP socket server (+0.6k) // #define USE_BERRY_ULP // Enable ULP (Ultra Low Power) support (+4.9k) // Berry crypto extensions below: diff --git a/tasmota/tasmota.ino b/tasmota/tasmota.ino index 39a48aff1..953db16b4 100644 --- a/tasmota/tasmota.ino +++ b/tasmota/tasmota.ino @@ -91,6 +91,14 @@ #endif // ESP32 #endif // USE_UFILESYS +#if ESP_IDF_VERSION_MAJOR >= 5 +#include "include/tasconsole.h" +#if SOC_USB_SERIAL_JTAG_SUPPORTED +#include "hal/usb_serial_jtag_ll.h" +#include "esp_private/rtc_clk.h" +#endif // SOC_USB_SERIAL_JTAG_SUPPORTED +#endif // ESP_IDF_VERSION_MAJOr + // Structs #include "include/tasmota_types.h" @@ -198,6 +206,47 @@ struct XDRVMAILBOX { WiFiUDP PortUdp; // UDP Syslog and Alexa #ifdef ESP32 +#if ESP_IDF_VERSION_MAJOR >= 5 + +/* +#if CONFIG_IDF_TARGET_ESP32C3 || // support USB via HWCDC using JTAG interface + CONFIG_IDF_TARGET_ESP32C6 || // support USB via HWCDC using JTAG interface + CONFIG_IDF_TARGET_ESP32S2 || // support USB via USBCDC + CONFIG_IDF_TARGET_ESP32S3 // support USB via HWCDC using JTAG interface or USBCDC +*/ +#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 + +//#if CONFIG_TINYUSB_CDC_ENABLED // This define is not recognized here so use USE_USB_CDC_CONSOLE +#ifdef USE_USB_CDC_CONSOLE +//#warning **** TasConsole use USB **** +bool tasconsole_serial = false; + +#if ARDUINO_USB_MODE +//#warning **** TasConsole ARDUINO_USB_MODE **** +//HWCDC HWCDCSerial; // Already defined in HWCDC.cpp +TASCONSOLE TasConsole{HWCDCSerial}; // ESP32C3/C6/S3 embedded USB using JTAG interface +//#warning **** TasConsole uses HWCDC **** +#else // No ARDUINO_USB_MODE +#include "USB.h" +#include "USBCDC.h" +//USBCDC USBSerial; // Already defined in USBCDC.cpp +TASCONSOLE TasConsole{USBSerial}; // ESP32Sx embedded USB interface +//#warning **** TasConsole uses USBCDC **** +#endif // ARDUINO_USB_MODE + +#else // No USE_USB_CDC_CONSOLE +TASCONSOLE TasConsole{Serial}; +bool tasconsole_serial = true; +//#warning **** TasConsole uses Serial **** +#endif // USE_USB_CDC_CONSOLE +#else // No ESP32C3, S2 or S3 +TASCONSOLE TasConsole{Serial}; +bool tasconsole_serial = true; +//#warning **** TasConsole uses Serial **** +#endif // ESP32C3, S2 or S3 + +#else // ESP_IDF_VERSION_MAJOR < 5 + /* #if CONFIG_IDF_TARGET_ESP32C3 || // support USB via HWCDC using JTAG interface CONFIG_IDF_TARGET_ESP32C6 || // support USB via HWCDC using JTAG interface @@ -235,6 +284,8 @@ bool tasconsole_serial = true; //#warning **** TasConsole uses Serial **** #endif // ESP32C3, S2 or S3 +#endif // ESP_IDF_VERSION_MAJOR >= 5 + #else // No ESP32 HardwareSerial TasConsole = Serial; // Only serial interface #endif // ESP32 @@ -478,11 +529,66 @@ void setup(void) { Settings = (TSettings*)malloc(sizeof(TSettings)); } +#ifdef ESP32 +#if ESP_IDF_VERSION_MAJOR >= 5 + +#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 +#ifdef USE_USB_CDC_CONSOLE + + bool is_connected_to_USB = false; +#if SOC_USB_SERIAL_JTAG_SUPPORTED // Not S2 + rtc_clk_bbpll_add_consumer(); // Maybe unneeded + usb_serial_jtag_ll_ena_intr_mask(USB_SERIAL_JTAG_INTR_SOF); + usb_serial_jtag_ll_clr_intsts_mask(USB_SERIAL_JTAG_INTR_SOF); + // First check if USB cable is connected - maybe add a new SetOption to prevent this + for (uint32_t i = 0; i < 1000; i++) { // Allow the host to send at least one SOF packet, 1ms should be enough but let's be very conservative here - maybe unneeded + is_connected_to_USB = ((usb_serial_jtag_ll_get_intraw_mask() & USB_SERIAL_JTAG_INTR_SOF) != 0); + if (is_connected_to_USB) { break; } + delay(1); + } + rtc_clk_bbpll_remove_consumer(); +#else + is_connected_to_USB = true; // S2 +#endif // SOC_USB_SERIAL_JTAG_SUPPORTED + + if (is_connected_to_USB) { + TasConsole.setRxBufferSize(INPUT_BUFFER_SIZE); + // TasConsole.setTxBufferSize(INPUT_BUFFER_SIZE); + TasConsole.begin(115200); // Will always be 115200 bps +#if !ARDUINO_USB_MODE + USB.begin(); // This needs a serial console with DTR/DSR support +#endif // No ARDUINO_USB_MODE + TasConsole.println(); + AddLog(LOG_LEVEL_INFO, PSTR("CMD: Using USB CDC")); + } else { + // Init command serial console preparing for AddLog use + Serial.begin(TasmotaGlobal.baudrate); + Serial.println(); + TasConsole = Serial; // Fallback + tasconsole_serial = true; + AddLog(LOG_LEVEL_INFO, PSTR("CMD: Fall back to serial port, no SOF packet detected on USB port")); + } +#else // No USE_USB_CDC_CONSOLE + // Init command serial console preparing for AddLog use + Serial.begin(TasmotaGlobal.baudrate); + Serial.println(); +// Serial.setRxBufferSize(INPUT_BUFFER_SIZE); // Default is 256 chars + TasConsole = Serial; +#endif // USE_USB_CDC_CONSOLE +#else // No ESP32C3, S2 or S3 + // Init command serial console preparing for AddLog use + Serial.begin(TasmotaGlobal.baudrate); + Serial.println(); +// Serial.setRxBufferSize(INPUT_BUFFER_SIZE); // Default is 256 chars + TasConsole = Serial; +#endif // ESP32C3, S2 or S3 + +#else // ESP_IDF_VERSION_MAJOR < 5 + // Init command console (either serial or USB) preparing for AddLog use Serial.begin(TasmotaGlobal.baudrate); Serial.println(); // Serial.setRxBufferSize(INPUT_BUFFER_SIZE); // Default is 256 chars -#ifdef ESP32 #if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 #ifdef USE_USB_CDC_CONSOLE TasConsole.setRxBufferSize(INPUT_BUFFER_SIZE); @@ -499,7 +605,14 @@ void setup(void) { #else // No ESP32C3, S2 or S3 TasConsole = Serial; #endif // ESP32C3, S2 or S3 + +#endif // ESP_IDF_VERSION_MAJOR >= 5 + #else // No ESP32 + // Init command serial console preparing for AddLog use + Serial.begin(TasmotaGlobal.baudrate); + Serial.println(); +// Serial.setRxBufferSize(INPUT_BUFFER_SIZE); // Default is 256 chars TasConsole = Serial; #endif // ESP32 diff --git a/tasmota/tasmota_support/homekit.c b/tasmota/tasmota_support/homekit.c deleted file mode 100644 index 55d71c239..000000000 --- a/tasmota/tasmota_support/homekit.c +++ /dev/null @@ -1,780 +0,0 @@ -/* - * ESPRESSIF MIT License - * - * Copyright (c) 2018 - * - * Permission is hereby granted for use on ESPRESSIF SYSTEMS products only, in which case, - * it is free of charge, to any person obtaining a copy of this software and associated - * documentation files (the "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the Software is furnished - * to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all copies or - * substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - */ -/* HomeKit Smart Outlet Example -*/ - -//#define USE_HOMEKIT - - -#ifdef USE_HOMEKIT -#ifdef ESP32 - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include - -//#include -//#include - -static const char *TAG = "HAP outlet"; -char *hk_desc; -char hk_code[12]; -uint8_t hk_services; - -extern void Ext_Replace_Cmd_Vars(char *srcbuf, uint32_t srcsize, char *dstbuf, uint32_t dstsize); -extern uint32_t Ext_UpdVar(char *vname, float *fvar, uint32_t mode); -extern void Ext_toLog(char *str); - -#define MAX_HAP_DEFS 16 -struct HAP_DESC { - char hap_name[24]; - char var_name[12]; - char var2_name[12]; - char var3_name[12]; - char var4_name[12]; - char var5_name[12]; - uint8_t hap_cid; - uint8_t type; - hap_acc_t *accessory; - hap_serv_t *service; -} hap_devs[MAX_HAP_DEFS]; - -#define HK_SRCBSIZE 256 - - -#define SMART_OUTLET_TASK_PRIORITY 1 -#define SMART_OUTLET_TASK_STACKSIZE 4 * 1024 -#define SMART_OUTLET_TASK_NAME "hap_outlet" - -//#define OUTLET_IN_USE_GPIO GPIO_NUM_0 -#define OUTLET_IN_USE_GPIO -1 - -#define ESP_INTR_FLAG_DEFAULT 0 - -static xQueueHandle s_esp_evt_queue = NULL; -/** - * @brief the recover outlet in use gpio interrupt function - */ -static void IRAM_ATTR outlet_in_use_isr(void* arg) -{ - uint32_t gpio_num = (uint32_t) arg; - xQueueSendFromISR(s_esp_evt_queue, &gpio_num, NULL); -} - -/** - * Enable a GPIO Pin for Outlet in Use Detection - */ -static void outlet_in_use_key_init(uint32_t key_gpio_pin) -{ - gpio_config_t io_conf; - /* Interrupt for both the edges */ - io_conf.intr_type = GPIO_INTR_ANYEDGE; - /* Bit mask of the pins */ - io_conf.pin_bit_mask = 1 << key_gpio_pin; - /* Set as input mode */ - io_conf.mode = GPIO_MODE_INPUT; - /* Enable internal pull-up */ - io_conf.pull_up_en = 1; - /* Disable internal pull-down */ - io_conf.pull_down_en = 0; - /* Set the GPIO configuration */ - gpio_config(&io_conf); - - /* Install gpio isr service */ - gpio_install_isr_service(ESP_INTR_FLAG_DEFAULT); - /* Hook isr handler for specified gpio pin */ - gpio_isr_handler_add(key_gpio_pin, outlet_in_use_isr, (void*)key_gpio_pin); -} - -/** - * Initialize the Smart Outlet Hardware.Here, we just enebale the Outlet-In-Use detection. - */ -void smart_outlet_hardware_init(int32_t gpio_num) { - s_esp_evt_queue = xQueueCreate(2, sizeof(uint32_t)); - - if (gpio_num < 0) return; - - if (s_esp_evt_queue != NULL) { - outlet_in_use_key_init(gpio_num); - } -} - - -static int bridge_identify(hap_acc_t *ha) -{ - ESP_LOGI(TAG, "Bridge identified"); - return HAP_SUCCESS; -} - -static int accessory_identify(hap_acc_t *ha) -{ - hap_serv_t *hs = hap_acc_get_serv_by_uuid(ha, HAP_SERV_UUID_ACCESSORY_INFORMATION); - hap_char_t *hc = hap_serv_get_char_by_uuid(hs, HAP_CHAR_UUID_NAME); - const hap_val_t *val = hap_char_get_val(hc); - char *name = val->s; - - ESP_LOGI(TAG, "Bridged Accessory %s identified", name); - return HAP_SUCCESS; -} - -const struct HAP_CHAR_TABLE { - char stype[4]; - char ntype; - int8_t index; -} hap_rtab[] = { - {HAP_CHAR_UUID_CURRENT_TEMPERATURE,'f',0}, - {HAP_CHAR_UUID_CURRENT_RELATIVE_HUMIDITY,'f',0}, - {HAP_CHAR_UUID_CURRENT_AMBIENT_LIGHT_LEVEL,'f',0}, - {HAP_CHAR_UUID_BATTERY_LEVEL,'u',0}, - {HAP_CHAR_UUID_STATUS_LOW_BATTERY,'u',1}, - {HAP_CHAR_UUID_CHARGING_STATE,'u',2}, - {HAP_CHAR_UUID_ON,'b',0}, - {HAP_CHAR_UUID_HUE,'f',1}, - {HAP_CHAR_UUID_SATURATION,'f',2}, - {HAP_CHAR_UUID_BRIGHTNESS,'u',3}, - {HAP_CHAR_UUID_COLOR_TEMPERATURE,'u',0}, - {HAP_CHAR_UUID_CONTACT_SENSOR_STATE,'u',0}, - {HAP_CHAR_UUID_WATTAGE,'f',0} -}; - -#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) - -/* A dummy callback for handling a write on the "On" characteristic of Outlet. - * In an actual accessory, this should control the hardware - */ -static int sensor_write(hap_write_data_t write_data[], int count, void *serv_priv, void *write_priv, uint32_t index) { - int i, ret = HAP_SUCCESS; - float fvar; - hap_write_data_t *write; - for (i = 0; i < count; i++) { - write = &write_data[i]; - bool found = false; - const char *hcp = hap_char_get_type_uuid(write->hc); - for (uint32_t cnt = 0; cnt < ARRAY_SIZE(hap_rtab); cnt++ ) { - if (!strcmp(hcp, hap_rtab[cnt].stype)) { - hap_char_update_val(write->hc, &(write->val)); - switch (hap_rtab[cnt].ntype) { - case 'f': fvar = write->val.f; break; - case 'u': fvar = write->val.u; break; - case 'b': fvar = write->val.b; break; - } - switch (hap_rtab[cnt].index) { - case 0: Ext_UpdVar(hap_devs[index].var_name, &fvar, 1);break; - case 1: Ext_UpdVar(hap_devs[index].var2_name, &fvar, 1);break; - case 2: Ext_UpdVar(hap_devs[index].var3_name, &fvar, 1);break; - case 3: Ext_UpdVar(hap_devs[index].var4_name, &fvar, 1);break; - } - *(write->status) = HAP_STATUS_SUCCESS; - found = true; - break; - } - } - if (!found) { - *(write->status) = HAP_STATUS_RES_ABSENT; - } - - } - return ret; -} - -// common read routine -static int sensor_read(hap_char_t *hc, hap_status_t *status_code, void *serv_priv, void *read_priv, uint32_t index) { - hap_val_t new_val; - float fvar = 0; - - if (hap_req_get_ctrl_id(read_priv)) { - ESP_LOGI(TAG, "Received read from %s", hap_req_get_ctrl_id(read_priv)); - } - - const char *hcp = hap_char_get_type_uuid(hc); - - printf("read values %s\n", hcp ); - - for (uint32_t cnt = 0; cnt < ARRAY_SIZE(hap_rtab); cnt++ ) { - if (!strcmp(hcp, hap_rtab[cnt].stype)) { - switch (hap_rtab[cnt].index) { - case 0: Ext_UpdVar(hap_devs[index].var_name, &fvar, 0);break; - case 1: Ext_UpdVar(hap_devs[index].var2_name, &fvar, 0);break; - case 2: Ext_UpdVar(hap_devs[index].var3_name, &fvar, 0);break; - case 3: Ext_UpdVar(hap_devs[index].var4_name, &fvar, 0);break; - } - switch (hap_rtab[cnt].ntype) { - case 'f': new_val.f = fvar; break; - case 'u': new_val.u = fvar; break; - case 'b': new_val.b = fvar; break; - } - hap_char_update_val(hc, &new_val); - *status_code = HAP_STATUS_SUCCESS; - } - } - return HAP_SUCCESS; -} - -// update values every 500 ms -void hap_update_from_vars(void) { - float fvar; - hap_char_t *hc; - hap_val_t new_val; - for (uint32_t cnt = 0; cnt < hk_services; cnt++) { - switch (hap_devs[cnt].hap_cid) { - case HAP_CID_SENSOR: - switch (hap_devs[cnt].type) { - case 0: - hc = hap_serv_get_char_by_uuid(hap_devs[cnt].service, HAP_CHAR_UUID_CURRENT_TEMPERATURE); - if (Ext_UpdVar(hap_devs[cnt].var_name, &fvar, 0)) { - new_val.f = fvar; - hap_char_update_val(hc, &new_val); - } - break; - case 1: - hc = hap_serv_get_char_by_uuid(hap_devs[cnt].service, HAP_CHAR_UUID_CURRENT_RELATIVE_HUMIDITY); - if (Ext_UpdVar(hap_devs[cnt].var_name, &fvar, 0)) { - new_val.f = fvar; - hap_char_update_val(hc, &new_val); - } - break; - case 2: - hc = hap_serv_get_char_by_uuid(hap_devs[cnt].service, HAP_CHAR_UUID_CURRENT_AMBIENT_LIGHT_LEVEL); - if (Ext_UpdVar(hap_devs[cnt].var_name, &fvar, 0)) { - new_val.f = fvar; - hap_char_update_val(hc, &new_val); - } - break; - case 3: - hc = hap_serv_get_char_by_uuid(hap_devs[cnt].service, HAP_CHAR_UUID_BATTERY_LEVEL); - if (Ext_UpdVar(hap_devs[cnt].var_name, &fvar, 0)) { - new_val.u = fvar; - hap_char_update_val(hc, &new_val); - } - hc = hap_serv_get_char_by_uuid(hap_devs[cnt].service, HAP_CHAR_UUID_STATUS_LOW_BATTERY); - if (Ext_UpdVar(hap_devs[cnt].var2_name, &fvar, 0)) { - new_val.u = fvar; - hap_char_update_val(hc, &new_val); - } - hc = hap_serv_get_char_by_uuid(hap_devs[cnt].service, HAP_CHAR_UUID_CHARGING_STATE); - if (Ext_UpdVar(hap_devs[cnt].var3_name, &fvar, 0)) { - new_val.u = fvar; - hap_char_update_val(hc, &new_val); - } - break; - case 4: - hc = hap_serv_get_char_by_uuid(hap_devs[cnt].service, HAP_CHAR_UUID_CURRENT_AMBIENT_LIGHT_LEVEL); - if (Ext_UpdVar(hap_devs[cnt].var_name, &fvar, 0)) { - new_val.f = fvar; - hap_char_update_val(hc, &new_val); - } - break; - case 5: - hc = hap_serv_get_char_by_uuid(hap_devs[cnt].service, HAP_CHAR_UUID_CONTACT_SENSOR_STATE); - if (Ext_UpdVar(hap_devs[cnt].var_name, &fvar, 0)) { - new_val.u = fvar; - hap_char_update_val(hc, &new_val); - } - break; - } - break; - case HAP_CID_OUTLET: - hc = hap_serv_get_char_by_uuid(hap_devs[cnt].service, HAP_CHAR_UUID_ON); - if (Ext_UpdVar(hap_devs[cnt].var_name, &fvar, 0)) { - new_val.b = fvar; - hap_char_update_val(hc, &new_val); - } - break; - case HAP_CID_LIGHTING: - hc = hap_serv_get_char_by_uuid(hap_devs[cnt].service, HAP_CHAR_UUID_ON); - if (Ext_UpdVar(hap_devs[cnt].var_name, &fvar, 0)) { - new_val.b = fvar; - hap_char_update_val(hc, &new_val); - } - hc = hap_serv_get_char_by_uuid(hap_devs[cnt].service, HAP_CHAR_UUID_HUE); - if (Ext_UpdVar(hap_devs[cnt].var2_name, &fvar, 0)) { - new_val.f = fvar; - hap_char_update_val(hc, &new_val); - } - hc = hap_serv_get_char_by_uuid(hap_devs[cnt].service, HAP_CHAR_UUID_SATURATION); - if (Ext_UpdVar(hap_devs[cnt].var3_name, &fvar, 0)) { - new_val.f = fvar; - hap_char_update_val(hc, &new_val); - } - hc = hap_serv_get_char_by_uuid(hap_devs[cnt].service, HAP_CHAR_UUID_BRIGHTNESS); - if (Ext_UpdVar(hap_devs[cnt].var4_name, &fvar, 0)) { - new_val.u = fvar; - hap_char_update_val(hc, &new_val); - } - if (hap_devs[cnt].var5_name[0]) { - hc = hap_serv_get_char_by_uuid(hap_devs[cnt].service, HAP_CHAR_UUID_COLOR_TEMPERATURE); - if (Ext_UpdVar(hap_devs[cnt].var5_name, &fvar, 0)) { - new_val.u = fvar; - hap_char_update_val(hc, &new_val); - } - } - break; - } - } - -} - -#define HAP_READ hap_char_t *hc, hap_status_t *status_code, void *serv_priv, void *read_priv) { return sensor_read(hc, status_code, serv_priv, read_priv - -static int sensor_read1(HAP_READ, 0);} -static int sensor_read2(HAP_READ, 1);} -static int sensor_read3(HAP_READ, 2);} -static int sensor_read4(HAP_READ, 3);} -static int sensor_read5(HAP_READ, 4);} -static int sensor_read6(HAP_READ, 5);} -static int sensor_read7(HAP_READ, 6);} -static int sensor_read8(HAP_READ, 7);} -static int sensor_read9(HAP_READ, 8);} -static int sensor_read10(HAP_READ, 9);} -static int sensor_read11(HAP_READ, 10);} -static int sensor_read12(HAP_READ, 11);} -static int sensor_read13(HAP_READ, 12);} -static int sensor_read14(HAP_READ, 13);} -static int sensor_read15(HAP_READ, 14);} -static int sensor_read16(HAP_READ, 15);} - -void hap_set_read(hap_serv_t *service, uint32_t index) { - switch (index) { - case 0: hap_serv_set_read_cb(service, sensor_read1);break; - case 1: hap_serv_set_read_cb(service, sensor_read2);break; - case 2: hap_serv_set_read_cb(service, sensor_read3);break; - case 3: hap_serv_set_read_cb(service, sensor_read4);break; - case 4: hap_serv_set_read_cb(service, sensor_read5);break; - case 5: hap_serv_set_read_cb(service, sensor_read6);break; - case 6: hap_serv_set_read_cb(service, sensor_read7);break; - case 7: hap_serv_set_read_cb(service, sensor_read8);break; - case 8: hap_serv_set_read_cb(service, sensor_read9);break; - case 9: hap_serv_set_read_cb(service, sensor_read10);break; - case 10: hap_serv_set_read_cb(service, sensor_read11);break; - case 11: hap_serv_set_read_cb(service, sensor_read12);break; - case 12: hap_serv_set_read_cb(service, sensor_read13);break; - case 13: hap_serv_set_read_cb(service, sensor_read14);break; - case 14: hap_serv_set_read_cb(service, sensor_read15);break; - case 15: hap_serv_set_read_cb(service, sensor_read16);break; - } -} - - -#define HAP_WRITE hap_write_data_t write_data[], int count, void *serv_priv, void *write_priv) { return sensor_write(write_data, count, serv_priv, write_priv - -static int sensor_write1(HAP_WRITE, 0);} -static int sensor_write2(HAP_WRITE, 1);} -static int sensor_write3(HAP_WRITE, 2);} -static int sensor_write4(HAP_WRITE, 3);} -static int sensor_write5(HAP_WRITE, 4);} -static int sensor_write6(HAP_WRITE, 5);} -static int sensor_write7(HAP_WRITE, 6);} -static int sensor_write8(HAP_WRITE, 7);} -static int sensor_write9(HAP_WRITE, 8);} -static int sensor_write10(HAP_WRITE, 9);} -static int sensor_write11(HAP_WRITE, 10);} -static int sensor_write12(HAP_WRITE, 11);} -static int sensor_write13(HAP_WRITE, 12);} -static int sensor_write14(HAP_WRITE, 13);} -static int sensor_write15(HAP_WRITE, 14);} -static int sensor_write16(HAP_WRITE, 15);} - - -void hap_set_write(hap_serv_t *service, uint32_t index) { - switch (index) { - case 0: hap_serv_set_write_cb(service, sensor_write1);break; - case 1: hap_serv_set_write_cb(service, sensor_write2);break; - case 2: hap_serv_set_write_cb(service, sensor_write3);break; - case 3: hap_serv_set_write_cb(service, sensor_write4);break; - case 4: hap_serv_set_write_cb(service, sensor_write5);break; - case 5: hap_serv_set_write_cb(service, sensor_write6);break; - case 6: hap_serv_set_write_cb(service, sensor_write7);break; - case 7: hap_serv_set_write_cb(service, sensor_write8);break; - case 8: hap_serv_set_write_cb(service, sensor_write9);break; - case 9: hap_serv_set_write_cb(service, sensor_write10);break; - case 10: hap_serv_set_write_cb(service, sensor_write11);break; - case 11: hap_serv_set_write_cb(service, sensor_write12);break; - case 12: hap_serv_set_write_cb(service, sensor_write13);break; - case 13: hap_serv_set_write_cb(service, sensor_write14);break; - case 14: hap_serv_set_write_cb(service, sensor_write15);break; - case 15: hap_serv_set_write_cb(service, sensor_write16);break; - } -} - - -uint32_t HK_getlinelen(char *lp) { -uint32_t cnt; - for (cnt=0; cnt= 0) { - hap_val_t appliance_value = { - .b = true, - }; - - /* Listen for Outlet-In-Use state change events. Other read/write functionality will be handled - * by the HAP Core. - * When the Outlet in Use GPIO goes low, it means Outlet is not in use. - * When the Outlet in Use GPIO goes high, it means Outlet is in use. - * Applications can define own logic as per their hardware. - */ - while (1) { - if (xQueueReceive(s_esp_evt_queue, &io_num, portMAX_DELAY) == pdFALSE) { - ESP_LOGI(TAG, "Outlet-In-Use trigger FAIL"); - } else { - appliance_value.b = gpio_get_level(io_num); - /* If any state change is detected, update the Outlet In Use characteristic value */ - hap_char_update_val(outlet_in_use, &appliance_value); - ESP_LOGI(TAG, "Outlet-In-Use triggered [%d]", appliance_value.b); - } - } - } else { - // vTaskDelete(NULL); - while (1) { - delay(500); - hap_update_from_vars(); - } - } -} - -#define HK_PASSCODE "111-11-111" -int hap_loop_stop(void); -int32_t homekit_pars(uint32_t sel); - -int32_t homekit_main(char *desc, uint32_t flag ) { - if (desc) { - char *cp = desc; - cp += 2; - while (*cp == ' ') cp++; - // "111-11-111" - - if (*cp == '*') { - strlcpy(hk_code, HK_PASSCODE, 10); - cp++; - } else { - uint32_t cnt; - for (cnt = 0; cnt < 10; cnt++) { - hk_code[cnt] = *cp++; - } - hk_code[cnt] = 0; - } - if (*cp != '\n') { - printf("init error\n"); - return -1; - } - cp++; - hk_desc = cp; - } else { - if (flag == 99) { - hap_loop_stop(); - hap_reset_to_factory(); - } else if (flag == 98) { - hap_loop_stop(); - // is just the folder in wrapper - hap_platfrom_keystore_erase_partition(hap_platform_keystore_get_nvs_partition_name()); - } else if (flag < 3) { - return homekit_pars(flag); - } else { - hap_loop_stop(); - } - - return 0; - } - - if (!hk_desc) return -2; - - /* Create the application thread */ - xTaskCreate(smart_outlet_thread_entry, SMART_OUTLET_TASK_NAME, SMART_OUTLET_TASK_STACKSIZE, NULL, SMART_OUTLET_TASK_PRIORITY, NULL); - - return 0; -} - -#include - -int32_t homekit_pars(uint32_t sel) { - - if (sel == 0) { - // return CONFIG_LWIP_MAX_SOCKETS; - return MEMP_NUM_NETCONN; - } else if (sel == 1) { - return LWIP_SOCKET_OFFSET; - } else { - struct sockaddr name; - socklen_t len = sizeof(name); - uint8_t open_socs = 0; - for (uint32_t cnt = 0; cnt < CONFIG_LWIP_MAX_SOCKETS; cnt++) { - //if (!getsockname(cnt, &name, &len)) { - if (!getpeername(LWIP_SOCKET_OFFSET + cnt, &name, &len)) { - open_socs++; - } - } - return open_socs; - } -} - -#endif // ESP32 -#endif // USE_HOMEKIT diff --git a/tasmota/tasmota_support/settings.ino b/tasmota/tasmota_support/settings.ino index 196bf2364..987192320 100644 --- a/tasmota/tasmota_support/settings.ino +++ b/tasmota/tasmota_support/settings.ino @@ -1762,6 +1762,13 @@ void SettingsDelta(void) { if (Settings->version < 0x0D000003) { // 13.0.0.3 Settings->battery_level_percent = 101; } +/* +#if (LANGUAGE_LCID == 1049) + if (Settings->version < 0x0D020003) { // 13.2.0.3 + SettingsUpdateText(SET_CANVAS, PSTR("linear-gradient(#F02 7%,#F93,#FF4,#082,#00F,#708 93%)")); + } +#endif +*/ Settings->version = TASMOTA_VERSION; SettingsSave(1); diff --git a/tasmota/tasmota_support/support.ino b/tasmota/tasmota_support/support.ino index 0b737f213..361e4c425 100755 --- a/tasmota/tasmota_support/support.ino +++ b/tasmota/tasmota_support/support.ino @@ -1442,26 +1442,16 @@ void SetPin(uint32_t lpin, uint32_t gpio) { TasmotaGlobal.gpio_pin[lpin] = gpio; } -#ifdef CONFIG_IDF_TARGET_ESP32C3 -#include "driver/gpio.h" // Include needed for Arduino 3 -#endif - void DigitalWrite(uint32_t gpio_pin, uint32_t index, uint32_t state) { static uint32_t pinmode_init[2] = { 0 }; // Pins 0 to 63 !!! if (PinUsed(gpio_pin, index)) { uint32_t pin = Pin(gpio_pin, index) & 0x3F; // Fix possible overflow over 63 gpios -#ifdef CONFIG_IDF_TARGET_ESP32C3 - gpio_hold_dis((gpio_num_t)pin); // Allow state change -#endif if (!bitRead(pinmode_init[pin / 32], pin % 32)) { bitSet(pinmode_init[pin / 32], pin % 32); pinMode(pin, OUTPUT); } digitalWrite(pin, state &1); -#ifdef CONFIG_IDF_TARGET_ESP32C3 - gpio_hold_en((gpio_num_t)pin); // Retain the state when the chip or system is reset, for example, when watchdog time-out or Deep-sleep -#endif } } @@ -1726,17 +1716,7 @@ uint32_t ValidPin(uint32_t pin, uint32_t gpio, uint8_t isTuya = false) { return GPIO_NONE; // Disable flash pins GPIO6, GPIO7, GPIO8 and GPIO11 } -#if CONFIG_IDF_TARGET_ESP32C2 -// ignore -#elif CONFIG_IDF_TARGET_ESP32C3 -// ignore -#elif CONFIG_IDF_TARGET_ESP32C6 -// ignore -#elif CONFIG_IDF_TARGET_ESP32S2 -// ignore -#elif CONFIG_IDF_TARGET_ESP32 -// ignore -#else // not ESP32C3 and not ESP32S2 +#ifdef ESP8266 if (((WEMOS == Settings->module) || isTuya) && !Settings->flag3.user_esp8285_enable) { // SetOption51 - Enable ESP8285 user GPIO's if ((9 == pin) || (10 == pin)) { return GPIO_NONE; // Disable possible flash GPIO9 and GPIO10 diff --git a/tasmota/tasmota_support/support_a_i2c.ino b/tasmota/tasmota_support/support_a_i2c.ino index 32237d173..68b557a54 100644 --- a/tasmota/tasmota_support/support_a_i2c.ino +++ b/tasmota/tasmota_support/support_a_i2c.ino @@ -49,15 +49,25 @@ bool I2c2Begin(int sda, int scl, uint32_t frequency) { } #endif +TwoWire& I2cGetWire(uint8_t bus = 0) { + if (!bus && TasmotaGlobal.i2c_enabled) { + return Wire; +#ifdef ESP32 + } else if (bus && TasmotaGlobal.i2c_enabled_2) { + return Wire1; +#endif // ESP32 + } else { +// AddLog(LOG_LEVEL_ERROR, PSTR("I2C: bus%d not initialized"), bus +1); + return *(TwoWire*)nullptr; + } +} + bool I2cValidRead(uint8_t addr, uint8_t reg, uint8_t size, uint8_t bus = 0) { i2c_buffer = 0; -#ifdef ESP32 - if (bus && !TasmotaGlobal.i2c_enabled_2) { return false; } // Error - TwoWire & myWire = (bus == 0) ? Wire : Wire1; -#else - if (bus) { return false; } // Second I2c bus ESP32 only - TwoWire & myWire = Wire; -#endif + + TwoWire& myWire = I2cGetWire(bus); + if (&myWire == nullptr) { return false; } // No valid I2c bus + uint8_t retry = I2C_RETRY_COUNTER; bool status = false; while (!status && retry) { @@ -147,13 +157,9 @@ int32_t I2cRead24(uint8_t addr, uint8_t reg, uint8_t bus = 0) { } bool I2cWrite(uint8_t addr, uint8_t reg, uint32_t val, uint8_t size, uint8_t bus = 0) { -#ifdef ESP32 - if (bus && !TasmotaGlobal.i2c_enabled_2) { return false; } // Error - TwoWire & myWire = (bus == 0) ? Wire : Wire1; -#else - if (bus) { return false; } // Second I2c bus ESP32 only - TwoWire & myWire = Wire; -#endif + TwoWire& myWire = I2cGetWire(bus); + if (&myWire == nullptr) { return false; } // No valid I2c bus + uint8_t x = I2C_RETRY_COUNTER; do { myWire.beginTransmission((uint8_t)addr); // start transmission to device @@ -176,13 +182,9 @@ bool I2cWrite16(uint8_t addr, uint8_t reg, uint32_t val, uint8_t bus = 0) { } bool I2cReadBuffer(uint8_t addr, uint8_t reg, uint8_t *reg_data, uint16_t len, uint8_t bus = 0) { -#ifdef ESP32 - if (bus && !TasmotaGlobal.i2c_enabled_2) { return true; } // Error - TwoWire & myWire = (bus == 0) ? Wire : Wire1; -#else - if (bus) { return true; } // Second I2c bus ESP32 only - TwoWire & myWire = Wire; -#endif + TwoWire& myWire = I2cGetWire(bus); + if (&myWire == nullptr) { return true; } // No valid I2c bus + myWire.beginTransmission((uint8_t)addr); myWire.write((uint8_t)reg); myWire.endTransmission(); @@ -197,13 +199,9 @@ bool I2cReadBuffer(uint8_t addr, uint8_t reg, uint8_t *reg_data, uint16_t len, u } int8_t I2cWriteBuffer(uint8_t addr, uint8_t reg, uint8_t *reg_data, uint16_t len, uint8_t bus = 0) { -#ifdef ESP32 - if (bus && !TasmotaGlobal.i2c_enabled_2) { return 1; } // Error - TwoWire & myWire = (bus == 0) ? Wire : Wire1; -#else - if (bus) { return 1; } // Second I2c bus ESP32 only - TwoWire & myWire = Wire; -#endif + TwoWire& myWire = I2cGetWire(bus); + if (&myWire == nullptr) { return 1; } // No valid I2c bus + myWire.beginTransmission((uint8_t)addr); myWire.write((uint8_t)reg); while (len--) { @@ -229,16 +227,14 @@ void I2cScan(uint8_t bus = 0) { // 3: received NACK on transmit of data // 4: other error // 5: timeout - + TwoWire& myWire = I2cGetWire(bus); + if (&myWire == nullptr) { return; } // No valid I2c bus #ifdef ESP32 - if (bus && !TasmotaGlobal.i2c_enabled_2) { return; } - TwoWire & myWire = (bus == 0) ? Wire : Wire1; Response_P(PSTR("{\"" D_CMND_I2CSCAN "\":\"Device(s) found on bus%d at"), bus +1); #else - if (bus) { return; } // Second I2c bus ESP32 only - TwoWire & myWire = Wire; Response_P(PSTR("{\"" D_CMND_I2CSCAN "\":\"Device(s) found at")); #endif + uint8_t error = 0; uint8_t address = 0; uint8_t any = 0; @@ -311,13 +307,9 @@ bool I2cActive(uint32_t addr, uint8_t bus = 0) { } bool I2cSetDevice(uint32_t addr, uint8_t bus = 0) { -#ifdef ESP32 - if (bus && !TasmotaGlobal.i2c_enabled_2) { return false; } // If no second bus report as not present; - TwoWire & myWire = (bus == 0) ? Wire : Wire1; -#else - bus = 0; - TwoWire & myWire = Wire; -#endif + TwoWire& myWire = I2cGetWire(bus); + if (&myWire == nullptr) { return false; } // No valid I2c bus + addr &= 0x7F; // Max I2C address is 127 if (I2cActive(addr, bus)) { return false; // If already active report as not present; diff --git a/tasmota/tasmota_support/support_command.ino b/tasmota/tasmota_support/support_command.ino index e5c627414..2c5828786 100644 --- a/tasmota/tasmota_support/support_command.ino +++ b/tasmota/tasmota_support/support_command.ino @@ -27,7 +27,7 @@ const char kTasmotaCommands[] PROGMEM = "|" // No prefix D_CMND_POWERONSTATE "|" D_CMND_PULSETIME "|" D_CMND_BLINKTIME "|" D_CMND_BLINKCOUNT "|" D_CMND_SAVEDATA "|" D_CMND_SO "|" D_CMND_SETOPTION "|" D_CMND_TEMPERATURE_RESOLUTION "|" D_CMND_HUMIDITY_RESOLUTION "|" D_CMND_PRESSURE_RESOLUTION "|" D_CMND_POWER_RESOLUTION "|" D_CMND_VOLTAGE_RESOLUTION "|" D_CMND_FREQUENCY_RESOLUTION "|" D_CMND_CURRENT_RESOLUTION "|" D_CMND_ENERGY_RESOLUTION "|" D_CMND_WEIGHT_RESOLUTION "|" - D_CMND_MODULE "|" D_CMND_MODULES "|" D_CMND_GPIO "|" D_CMND_GPIOS "|" D_CMND_TEMPLATE "|" D_CMND_PWM "|" D_CMND_PWMFREQUENCY "|" D_CMND_PWMRANGE "|" + D_CMND_MODULE "|" D_CMND_MODULES "|" D_CMND_GPIO "|" D_CMND_GPIOREAD "|" D_CMND_GPIOS "|" D_CMND_TEMPLATE "|" D_CMND_PWM "|" D_CMND_PWMFREQUENCY "|" D_CMND_PWMRANGE "|" D_CMND_BUTTONDEBOUNCE "|" D_CMND_SWITCHDEBOUNCE "|" D_CMND_SYSLOG "|" D_CMND_LOGHOST "|" D_CMND_LOGPORT "|" D_CMND_SERIALBUFFER "|" D_CMND_SERIALSEND "|" D_CMND_BAUDRATE "|" D_CMND_SERIALCONFIG "|" D_CMND_SERIALDELIMITER "|" D_CMND_IPADDRESS "|" D_CMND_NTPSERVER "|" D_CMND_AP "|" D_CMND_SSID "|" D_CMND_PASSWORD "|" D_CMND_HOSTNAME "|" D_CMND_WIFICONFIG "|" D_CMND_WIFI "|" D_CMND_DNSTIMEOUT "|" @@ -67,7 +67,7 @@ void (* const TasmotaCommand[])(void) PROGMEM = { &CmndPowerOnState, &CmndPulsetime, &CmndBlinktime, &CmndBlinkcount, &CmndSavedata, &CmndSetoption, &CmndSetoption, &CmndTemperatureResolution, &CmndHumidityResolution, &CmndPressureResolution, &CmndPowerResolution, &CmndVoltageResolution, &CmndFrequencyResolution, &CmndCurrentResolution, &CmndEnergyResolution, &CmndWeightResolution, - &CmndModule, &CmndModules, &CmndGpio, &CmndGpios, &CmndTemplate, &CmndPwm, &CmndPwmfrequency, &CmndPwmrange, + &CmndModule, &CmndModules, &CmndGpio, &CmndGpioRead, &CmndGpios, &CmndTemplate, &CmndPwm, &CmndPwmfrequency, &CmndPwmrange, &CmndButtonDebounce, &CmndSwitchDebounce, &CmndSyslog, &CmndLoghost, &CmndLogport, &CmndSerialBuffer, &CmndSerialSend, &CmndBaudrate, &CmndSerialConfig, &CmndSerialDelimiter, &CmndIpAddress, &CmndNtpServer, &CmndAp, &CmndSsid, &CmndPassword, &CmndHostname, &CmndWifiConfig, &CmndWifi, &CmndDnsTimeout, @@ -1768,6 +1768,27 @@ void CmndGpio(void) } } +void CmndGpioRead(void) { + // Perform a digitalRead on each configured GPIO + myio template_gp; + TemplateGpios(&template_gp); + bool jsflg = false; + Response_P(PSTR("{\"" D_CMND_GPIOREAD "\":{")); + for (uint32_t i = 0; i < nitems(Settings->my_gp.io); i++) { + uint32_t sensor_type = template_gp.io[i]; // Template GPIO + if (((sensor_type != GPIO_NONE) && (AGPIO(GPIO_USER) != sensor_type)) || + (Settings->my_gp.io[i] != GPIO_NONE)) { // Module GPIO + if (jsflg) { + ResponseAppend_P(PSTR(",")); + } + jsflg = true; + bool state = digitalRead(i); + ResponseAppend_P(PSTR("\"" D_CMND_GPIO "%d\":%d"), i, state); + } + } + ResponseAppend_P(PSTR("}}")); +} + void ShowGpios(const uint16_t *NiceList, uint32_t size, uint32_t offset, uint32_t &lines) { uint32_t ridx; uint32_t midx; diff --git a/tasmota/tasmota_support/support_esp.ino b/tasmota/tasmota_support/support_esp32.ino similarity index 83% rename from tasmota/tasmota_support/support_esp.ino rename to tasmota/tasmota_support/support_esp32.ino index 92346ab32..f3e362ee3 100644 --- a/tasmota/tasmota_support/support_esp.ino +++ b/tasmota/tasmota_support/support_esp32.ino @@ -1,218 +1,15 @@ /* - support_esp.ino - ESP specific code for Tasmota + support_esp32.ino - ESP32 specific support for Tasmota - Copyright (C) 2021 Theo Arends / Jörg Schüler-Maroldt + SPDX-FileCopyrightText: 2023 Theo Arends - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + SPDX-License-Identifier: GPL-3.0-only */ -/*********************************************************************************************\ - * ESP8266 and ESP32 specific code - * - * At the end the common Tasmota calls are provided -\*********************************************************************************************/ - -/*********************************************************************************************\ - * ESP8266 Support -\*********************************************************************************************/ - -#ifdef ESP8266 - -extern "C" { -extern struct rst_info resetInfo; -} - -/*********************************************************************************************\ - * Core overrides executed by core -\*********************************************************************************************/ - -// Add below line to tasmota_globals.h -// extern "C" void resetPins(); -// -// This function overrules __resetPins() which is executed by core init() as initPins() in core_esp8266_wiring.cpp -// -// 20221229 - (v12.3.1.2) Enabled with additional check to execute on power on only to fix relay clicks on power on -// 20200321 - (v8.2.0.1) Disable core functionality to fix relay clicks on restart after OTA - make function return without setting pinMode -void resetPins() { - if ((resetInfo.reason == REASON_DEFAULT_RST) || (resetInfo.reason == REASON_EXT_SYS_RST)) { - // Only perform at power on - for (int i = 0; i <= 5; ++i) { - pinMode(i, INPUT); - } - // pins 6-11 are used for the SPI flash interface ESP8266 - for (int i = 12; i <= 16; ++i) { - pinMode(i, INPUT); - } - } -} - -/*********************************************************************************************\ - * Hardware related -\*********************************************************************************************/ - -void HwWdtDisable(void) { - *((volatile uint32_t*) 0x60000900) &= ~(1); // Hardware WDT OFF -} - -void HwWdtEnable(void) { - *((volatile uint32_t*) 0x60000900) |= 1; // Hardware WDT ON -} - -void WdtDisable(void) { - ESP.wdtDisable(); - HwWdtDisable(); -} - -void WdtEnable(void) { - HwWdtEnable(); - ESP.wdtEnable(0); -} - -/*********************************************************************************************\ - * ESP8266 specifics -\*********************************************************************************************/ - -uint32_t ESP_ResetInfoReason(void) { - return resetInfo.reason; -} - -String ESP_getResetReason(void) { - return ESP.getResetReason(); -} - -uint32_t ESP_getChipId(void) { - return ESP.getChipId(); -} - -uint32_t ESP_getFreeSketchSpace(void) { - return ESP.getFreeSketchSpace(); -} - -uint32_t ESP_getSketchSize(void) { - return ESP.getSketchSize(); -} - -uint32_t ESP_getFreeHeap(void) { - return ESP.getFreeHeap(); -} - -uint32_t ESP_getFlashChipId(void) { - return ESP.getFlashChipId(); -} - -uint32_t ESP_getFlashChipRealSize(void) { - return ESP.getFlashChipRealSize(); -} - -uint32_t ESP_getFlashChipSize(void) { - return ESP.getFlashChipSize(); -} - -void ESP_Restart(void) { -// ESP.restart(); // This results in exception 3 on restarts on core 2.3.0 - ESP.reset(); -} - -uint32_t FlashWriteStartSector(void) { - return (ESP.getSketchSize() / SPI_FLASH_SEC_SIZE) + 2; // Stay on the safe side -} - -uint32_t FlashWriteMaxSector(void) { - return (((uint32_t)&_FS_start - 0x40200000) / SPI_FLASH_SEC_SIZE) - 2; -} - -uint8_t* FlashDirectAccess(void) { - return (uint8_t*)(0x40200000 + (FlashWriteStartSector() * SPI_FLASH_SEC_SIZE)); -} - -void *special_malloc(uint32_t size) { - return malloc(size); -} - -void *special_realloc(void *ptr, size_t size) { - return realloc(ptr, size); -} - -void *special_calloc(size_t num, size_t size) { - return calloc(num, size); -} - -String GetDeviceHardware(void) { - /* - ESP8266 SoCs - - 32-bit MCU & 2.4 GHz Wi-Fi - - High-performance 160 MHz single-core CPU - - +19.5 dBm output power ensures a good physical range - - Sleep current is less than 20 μA, making it suitable for battery-powered and wearable-electronics applications - - Peripherals include UART, GPIO, I2C, I2S, SDIO, PWM, ADC and SPI - */ - // esptool.py get_efuses - uint32_t efuse0 = *(uint32_t*)(0x3FF00050); -// uint32_t efuse1 = *(uint32_t*)(0x3FF00054); - uint32_t efuse2 = *(uint32_t*)(0x3FF00058); - uint32_t efuse3 = *(uint32_t*)(0x3FF0005C); - - bool r0_4 = efuse0 & (1 << 4); // ESP8285 - bool r2_16 = efuse2 & (1 << 16); // ESP8285 - if (r0_4 || r2_16) { // ESP8285 - // 1M 2M 2M 4M flash size - // r0_4 1 1 0 0 - bool r3_25 = efuse3 & (1 << 25); // flash matrix 0 0 1 1 - bool r3_26 = efuse3 & (1 << 26); // flash matrix 0 1 0 1 - bool r3_27 = efuse3 & (1 << 27); // flash matrix 0 0 0 0 - uint32_t pkg_version = 0; - if (!r3_27) { - if (r0_4 && !r3_25) { - pkg_version = (r3_26) ? 2 : 1; - } - else if (!r0_4 && r3_25) { - pkg_version = (r3_26) ? 4 : 2; - } - } - bool max_temp = efuse0 & (1 << 5); // Max flash temperature (0 = 85C, 1 = 105C) - switch (pkg_version) { - case 1: - if (max_temp) { return F("ESP8285H08"); } // 1M flash - else { return F("ESP8285N08"); } - case 2: - if (max_temp) { return F("ESP8285H16"); } // 2M flash - else { return F("ESP8285N16"); } - case 4: - if (max_temp) { return F("ESP8285H32"); } // 4M flash - else { return F("ESP8285N32"); } - } - return F("ESP8285"); - } - return F("ESP8266EX"); -} - -String GetDeviceHardwareRevision(void) { - // No known revisions for ESP8266/85 - return GetDeviceHardware(); -} - -String GetCodeCores(void) { - return F(""); -} - -#endif - -/*********************************************************************************************\ - * ESP32 Support -\*********************************************************************************************/ - #ifdef ESP32 +/*********************************************************************************************\ + * ESP32, ESP32-S2, ESP32-S3, ESP32-C2, ESP32-C3, ESP32-C6 and ESP32-H2 Support +\*********************************************************************************************/ #include "soc/soc.h" #include "soc/spi_reg.h" @@ -233,14 +30,12 @@ String GetCodeCores(void) { #define ESP32_ARCH "esp32c3" #elif CONFIG_IDF_TARGET_ESP32C6 #define ESP32_ARCH "esp32c6" +#elif CONFIG_IDF_TARGET_ESP32H2 + #define ESP32_ARCH "esp32h2" #else #define ESP32_ARCH "" #endif -// Handle 20k of NVM - -#include - // See libraries\ESP32\examples\ResetReason.ino #if ESP_IDF_VERSION_MAJOR > 3 // IDF 4+ #include "esp_chip_info.h" @@ -256,6 +51,8 @@ String GetCodeCores(void) { #include "esp32c3/rom/rtc.h" #elif CONFIG_IDF_TARGET_ESP32C6 // ESP32-C6 #include "esp32c6/rom/rtc.h" + #elif CONFIG_IDF_TARGET_ESP32H2 // ESP32-H2 + #include "esp32h2/rom/rtc.h" #else #error Target CONFIG_IDF_TARGET is not supported #endif @@ -263,18 +60,17 @@ String GetCodeCores(void) { #include "rom/rtc.h" #endif -#if ESP_IDF_VERSION_MAJOR >= 5 - #include "esp_chip_info.h" -#endif - // Set the Stacksize for Arduino core. Default is 8192, some builds may need a bigger one size_t getArduinoLoopTaskStackSize(void) { - return SET_ESP32_STACK_SIZE; + return SET_ESP32_STACK_SIZE; } - #include +// Handle 20k of NVM + +#include + bool NvmLoad(const char *sNvsName, const char *sName, void *pSettings, unsigned nSettingsLen) { nvs_handle_t handle; esp_err_t result = nvs_open(sNvsName, NVS_READONLY, &handle); @@ -440,6 +236,9 @@ extern "C" { #elif CONFIG_IDF_TARGET_ESP32C6 // ESP32-C6 #include "esp32c6/rom/spi_flash.h" #define ESP_FLASH_IMAGE_BASE 0x0000 // Esp32c6 is located at 0x0000 + #elif CONFIG_IDF_TARGET_ESP32H2 // ESP32-H2 + #include "esp32h2/rom/spi_flash.h" + #define ESP_FLASH_IMAGE_BASE 0x0000 // Esp32h2 is located at 0x0000 #else #error Target CONFIG_IDF_TARGET is not supported #endif @@ -634,9 +433,9 @@ String ESP_getResetReason(void) { uint32_t ESP_ResetInfoReason(void) { RESET_REASON reason = rtc_get_reset_reason(0); if (1 == reason) { return REASON_DEFAULT_RST; } // POWERON_RESET - if (12 == reason) { return REASON_SOFT_RESTART; } // SW_CPU_RESET / RTC_SW_CPU_RESET + if ((3 == reason) || (12 == reason)) { return REASON_SOFT_RESTART; } // SW_RESET / RTC_SW_SYS_RESET and SW_CPU_RESET / RTC_SW_CPU_RESET if (5 == reason) { return REASON_DEEP_SLEEP_AWAKE; } // DEEPSLEEP_RESET - if (3 == reason) { return REASON_EXT_SYS_RST; } // SW_RESET / RTC_SW_SYS_RESET +// if (3 == reason) { return REASON_EXT_SYS_RST; } // SW_RESET / RTC_SW_SYS_RESET return -1; //no "official error code", but should work with the current code base } @@ -659,9 +458,9 @@ uint32_t ESP_getFlashChipMagicSize(void) { return ESP_magicFlashChipSize(fhdr.spi_size); } -uint32_t ESP_magicFlashChipSize(uint8_t byte) -{ - switch(byte & 0x0F) { +uint32_t ESP_magicFlashChipSize(uint8_t spi_size) { +/* + switch(spi_size & 0x0F) { case 0x0: // 8 MBit (1MB) return 1048576; case 0x1: // 16 MBit (2MB) @@ -672,9 +471,14 @@ uint32_t ESP_magicFlashChipSize(uint8_t byte) return 8388608; case 0x4: // 128 MBit (16MB) return 16777216; - default: // fail? - return 0; + case 0x5: // 256 MBit (32MB) + return 33554432; + default: // fail so return (1KB) + return 1024; } +*/ + // When spi_size is bigger than 11 will return 0 (0x100000000 = 0x00000000) + return (uint32_t)0x100000 << (spi_size & 0x0F); // 0 = 8 MBit (1MB), 5 = 256 MBit (32MB) } uint32_t ESP_getSketchSize(void) { @@ -702,6 +506,15 @@ uint32_t ESP_getFreeHeap(void) { return heap_caps_get_free_size(MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT); } +uint32_t ESP_getFreeHeap1024(void) { + return ESP_getFreeHeap() / 1024; +} +/* +float ESP_getFreeHeap1024(void) { + return ((float)ESP_getFreeHeap()) / 1024; +} +*/ + uint32_t ESP_getMaxAllocHeap(void) { // arduino returns IRAM but we want only DRAM #ifdef USE_GT911 // GT911 IRQ crashes with heap_caps_get_largest_free_block @@ -775,6 +588,32 @@ bool UsePSRAM(void) { return FoundPSRAM() && can_use_psram; } +/* + * ESP32 v1 and v2 needs some special patches to use PSRAM. + * Standard Tasmota 32 do not include those patches. + * If using ESP32 v1, please add: `-mfix-esp32-psram-cache-issue -lc-psram-workaround -lm-psram-workaround` + * + * This function returns true if the chip supports PSRAM natively (v3) or if the + * patches are present. + */ +bool CanUsePSRAM(void) { + if (!FoundPSRAM()) return false; +#ifdef HAS_PSRAM_FIX + return true; +#endif +#ifdef CONFIG_IDF_TARGET_ESP32 + esp_chip_info_t chip_info; + esp_chip_info(&chip_info); + uint32_t chip_revision = chip_info.revision; + // idf5 efuse_hal_chip_revision(void) + if (chip_revision < 100) { chip_revision *= 100; } // Make = 5 +#include +#endif + // Based on code from https://raw.githubusercontent.com/espressif/esp-idf/master/components/esp32/hw_random.c uint32_t HwRandom(void) { -#if ESP8266 - // https://web.archive.org/web/20160922031242/http://esp8266-re.foogod.com/wiki/Random_Number_Generator - #define _RAND_ADDR 0x3FF20E44UL -#endif // ESP8266 -#ifdef ESP32 +#if ESP_IDF_VERSION_MAJOR >= 5 + // See for more info on the HW RNG: + // https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/api-reference/system/random.html + return esp_random(); +#else #define _RAND_ADDR 0x3FF75144UL -#endif // ESP32 static uint32_t last_ccount = 0; uint32_t ccount; uint32_t result = 0; @@ -1172,5 +974,55 @@ uint32_t HwRandom(void) { } while (ccount - last_ccount < 64); last_ccount = ccount; return result ^ *(volatile uint32_t *)_RAND_ADDR; -#undef _RAND_ADDR + #undef _RAND_ADDR +#endif // ESP_IDF_VERSION_MAJOR >= 5 } + +/********************************************************************************************/ +// Since ESP-IDF 4.4, GPIO matrix or I/O is not reset during a restart +// and GPIO configuration can get stuck because of leftovers +// +// This patched version of pinMode forces a full GPIO reset before setting new mode +// +#include "driver/gpio.h" + +extern "C" void ARDUINO_ISR_ATTR __pinMode(uint8_t pin, uint8_t mode); + +extern "C" void ARDUINO_ISR_ATTR pinMode(uint8_t pin, uint8_t mode) { + gpio_reset_pin((gpio_num_t)pin); + __pinMode(pin, mode); +#ifdef CONFIG_IDF_TARGET_ESP32C3 + // See GpioForceHoldRelay() below + static uint64_t pin_hold_mask = 0; + if (!bitRead(pin_hold_mask, pin)) { + bitSet(pin_hold_mask, pin); + gpio_hold_dis((gpio_num_t)pin); // Allow state change + } +#endif +} + +#ifdef CONFIG_IDF_TARGET_ESP32C3 +void GpioForceHoldRelay(void) { + // Only ESP32-C3 toggles outputs on restart unless gpio_hold_en() is called before restart + // Retain the state when the chip or system is reset, for example, when watchdog time-out or Deep-sleep + +// gpio_force_hold_all(); // This will hold flash/serial too so do not use + + // Use current gpio config +// for (uint32_t i = 0; i < nitems(TasmotaGlobal.gpio_pin); i++) { +// if ((TasmotaGlobal.gpio_pin[i] & 0xFFE0) == GPIO_REL1 << 5) { + // Use future gpio config + myio template_gp; + TemplateGpios(&template_gp); + for (uint32_t i = 0; i < nitems(Settings->my_gp.io); i++) { + if (((Settings->my_gp.io[i] & 0xFFE0) == GPIO_REL1 << 5) || + ((template_gp.io[i] & 0xFFE0) == GPIO_REL1 << 5)) { + gpio_hold_en((gpio_num_t)i); // Retain the state when the chip or system is reset, for example, when watchdog time-out or Deep-sleep + } + } +} +#endif + +/********************************************************************************************/ + +#endif // ESP32 \ No newline at end of file diff --git a/tasmota/tasmota_support/support_esp8266.ino b/tasmota/tasmota_support/support_esp8266.ino new file mode 100644 index 000000000..00df1731b --- /dev/null +++ b/tasmota/tasmota_support/support_esp8266.ino @@ -0,0 +1,221 @@ +/* + support_esp8266.ino - ESP8266 specific support for Tasmota + + SPDX-FileCopyrightText: 2023 Theo Arends + + SPDX-License-Identifier: GPL-3.0-only +*/ + +#ifdef ESP8266 +/*********************************************************************************************\ + * ESP8266 and ESP8285 Support +\*********************************************************************************************/ + +extern "C" { +extern struct rst_info resetInfo; +} + +/*********************************************************************************************\ + * Core overrides executed by core +\*********************************************************************************************/ + +// Add below line to tasmota_globals.h +// extern "C" void resetPins(); +// +// This function overrules __resetPins() which is executed by core init() as initPins() in core_esp8266_wiring.cpp +// +// 20221229 - (v12.3.1.2) Enabled with additional check to execute on power on only to fix relay clicks on power on +// 20200321 - (v8.2.0.1) Disable core functionality to fix relay clicks on restart after OTA - make function return without setting pinMode +void resetPins() { + if ((resetInfo.reason == REASON_DEFAULT_RST) || (resetInfo.reason == REASON_EXT_SYS_RST)) { + // Only perform at power on + for (int i = 0; i <= 5; ++i) { + pinMode(i, INPUT); + } + // pins 6-11 are used for the SPI flash interface ESP8266 + for (int i = 12; i <= 16; ++i) { + pinMode(i, INPUT); + } + } +} + +/*********************************************************************************************\ + * Hardware related +\*********************************************************************************************/ + +void HwWdtDisable(void) { + *((volatile uint32_t*) 0x60000900) &= ~(1); // Hardware WDT OFF +} + +void HwWdtEnable(void) { + *((volatile uint32_t*) 0x60000900) |= 1; // Hardware WDT ON +} + +void WdtDisable(void) { + ESP.wdtDisable(); + HwWdtDisable(); +} + +void WdtEnable(void) { + HwWdtEnable(); + ESP.wdtEnable(0); +} + +/*********************************************************************************************\ + * ESP8266 specifics +\*********************************************************************************************/ + +uint32_t ESP_ResetInfoReason(void) { + return resetInfo.reason; +} + +String ESP_getResetReason(void) { + return ESP.getResetReason(); +} + +uint32_t ESP_getChipId(void) { + return ESP.getChipId(); +} + +uint32_t ESP_getFreeSketchSpace(void) { + return ESP.getFreeSketchSpace(); +} + +uint32_t ESP_getSketchSize(void) { + return ESP.getSketchSize(); +} + +uint32_t ESP_getFreeHeap(void) { + return ESP.getFreeHeap(); +} + +uint32_t ESP_getFreeHeap1024(void) { + return ESP_getFreeHeap() / 1024; +} +/* +float ESP_getFreeHeap1024(void) { + return ((float)ESP_getFreeHeap()) / 1024; +} +*/ + +uint32_t ESP_getFlashChipId(void) { + return ESP.getFlashChipId(); +} + +uint32_t ESP_getFlashChipRealSize(void) { + return ESP.getFlashChipRealSize(); +} + +uint32_t ESP_getFlashChipSize(void) { + return ESP.getFlashChipSize(); +} + +void ESP_Restart(void) { +// ESP.restart(); // This results in exception 3 on restarts on core 2.3.0 + ESP.reset(); +} + +uint32_t FlashWriteStartSector(void) { + return (ESP.getSketchSize() / SPI_FLASH_SEC_SIZE) + 2; // Stay on the safe side +} + +uint32_t FlashWriteMaxSector(void) { + return (((uint32_t)&_FS_start - 0x40200000) / SPI_FLASH_SEC_SIZE) - 2; +} + +uint8_t* FlashDirectAccess(void) { + return (uint8_t*)(0x40200000 + (FlashWriteStartSector() * SPI_FLASH_SEC_SIZE)); +} + +void *special_malloc(uint32_t size) { + return malloc(size); +} + +void *special_realloc(void *ptr, size_t size) { + return realloc(ptr, size); +} + +void *special_calloc(size_t num, size_t size) { + return calloc(num, size); +} + +String GetDeviceHardware(void) { + /* + ESP8266 SoCs + - 32-bit MCU & 2.4 GHz Wi-Fi + - High-performance 160 MHz single-core CPU + - +19.5 dBm output power ensures a good physical range + - Sleep current is less than 20 μA, making it suitable for battery-powered and wearable-electronics applications + - Peripherals include UART, GPIO, I2C, I2S, SDIO, PWM, ADC and SPI + */ + // esptool.py get_efuses + uint32_t efuse0 = *(uint32_t*)(0x3FF00050); +// uint32_t efuse1 = *(uint32_t*)(0x3FF00054); + uint32_t efuse2 = *(uint32_t*)(0x3FF00058); + uint32_t efuse3 = *(uint32_t*)(0x3FF0005C); + + bool r0_4 = efuse0 & (1 << 4); // ESP8285 + bool r2_16 = efuse2 & (1 << 16); // ESP8285 + if (r0_4 || r2_16) { // ESP8285 + // 1M 2M 2M 4M flash size + // r0_4 1 1 0 0 + bool r3_25 = efuse3 & (1 << 25); // flash matrix 0 0 1 1 + bool r3_26 = efuse3 & (1 << 26); // flash matrix 0 1 0 1 + bool r3_27 = efuse3 & (1 << 27); // flash matrix 0 0 0 0 + uint32_t pkg_version = 0; + if (!r3_27) { + if (r0_4 && !r3_25) { + pkg_version = (r3_26) ? 2 : 1; + } + else if (!r0_4 && r3_25) { + pkg_version = (r3_26) ? 4 : 2; + } + } + bool max_temp = efuse0 & (1 << 5); // Max flash temperature (0 = 85C, 1 = 105C) + switch (pkg_version) { + case 1: + if (max_temp) { return F("ESP8285H08"); } // 1M flash + else { return F("ESP8285N08"); } + case 2: + if (max_temp) { return F("ESP8285H16"); } // 2M flash + else { return F("ESP8285N16"); } + case 4: + if (max_temp) { return F("ESP8285H32"); } // 4M flash + else { return F("ESP8285N32"); } + } + return F("ESP8285"); + } + return F("ESP8266EX"); +} + +String GetDeviceHardwareRevision(void) { + // No known revisions for ESP8266/85 + return GetDeviceHardware(); +} + +String GetCodeCores(void) { + return F(""); +} + +/*********************************************************************************************\ + * High entropy hardware random generator + * Thanks to DigitalAlchemist +\*********************************************************************************************/ + +// Based on code from https://raw.githubusercontent.com/espressif/esp-idf/master/components/esp32/hw_random.c +uint32_t HwRandom(void) { + // https://web.archive.org/web/20160922031242/http://esp8266-re.foogod.com/wiki/Random_Number_Generator + #define _RAND_ADDR 0x3FF20E44UL + static uint32_t last_ccount = 0; + uint32_t ccount; + uint32_t result = 0; + do { + ccount = ESP.getCycleCount(); + result ^= *(volatile uint32_t *)_RAND_ADDR; + } while (ccount - last_ccount < 64); + last_ccount = ccount; + return result ^ *(volatile uint32_t *)_RAND_ADDR; + #undef _RAND_ADDR +} + +#endif // ESP8266 \ No newline at end of file diff --git a/tasmota/tasmota_support/support_features.ino b/tasmota/tasmota_support/support_features.ino index de82e2d64..5c0e4e03b 100644 --- a/tasmota/tasmota_support/support_features.ino +++ b/tasmota/tasmota_support/support_features.ino @@ -18,907 +18,925 @@ */ /*********************************************************************************************\ - * Fill feature list + * Feature list + * + * Note: When extending/updating feature[] also extend/update a_features in decode-status.py \*********************************************************************************************/ -void ResponseAppendFeatures(void) -{ - static uint32_t feature1 = 0x00000000; - if (!feature1) { // Only fill this once +constexpr uint32_t feature[] = { #if defined(USE_ENERGY_SENSOR) && defined(USE_ENERGY_MARGIN_DETECTION) - feature1 |= 0x00000001; // xdrv_03_energy.ino + 0x00000001 | // xdrv_03_energy.ino #endif #ifdef USE_LIGHT - feature1 |= 0x00000002; // tasmota.ino, xdrv_04_light.ino + 0x00000002 | // tasmota.ino, xdrv_04_light.ino #endif #ifdef USE_I2C - feature1 |= 0x00000004; // tasmota.ino + 0x00000004 | // tasmota.ino #endif #ifdef USE_SPI - feature1 |= 0x00000008; // tasmota.ino + 0x00000008 | // tasmota.ino #endif #ifdef USE_DISCOVERY - feature1 |= 0x00000010; // tasmota.ino + 0x00000010 | // tasmota.ino #endif #ifdef USE_ARDUINO_OTA - feature1 |= 0x00000020; // tasmota.ino + 0x00000020 | // tasmota.ino #endif #ifdef USE_MQTT_TLS - feature1 |= 0x00000040; // xdrv_02_mqtt.ino + 0x00000040 | // xdrv_02_mqtt.ino #endif #ifdef USE_WEBSERVER - feature1 |= 0x00000080; // xdrv_01_webserver.ino + 0x00000080 | // xdrv_01_webserver.ino #endif #if defined(USE_WEBSERVER) && defined(WEBSERVER_ADVERTISE) - feature1 |= 0x00000100; // xdrv_01_webserver.ino + 0x00000100 | // xdrv_01_webserver.ino #endif #if defined(USE_WEBSERVER) && defined(USE_EMULATION_HUE) - feature1 |= 0x00000200; // xdrv_20_hue.ino + 0x00000200 | // xdrv_20_hue.ino #endif //#if (MQTT_LIBRARY_TYPE == MQTT_PUBSUBCLIENT) - feature1 |= 0x00000400; // xdrv_02_mqtt.ino + 0x00000400 | // xdrv_02_mqtt.ino //#endif //#if (MQTT_LIBRARY_TYPE == MQTT_TASMOTAMQTT) -// feature1 |= 0x00000800; // xdrv_02_mqtt.ino +// 0x00000800 | // xdrv_02_mqtt.ino //#endif #ifdef USE_MODBUS_BRIDGE - feature1 |= 0x00001000; // xdrv_63_modbus_bridge.ino + 0x00001000 | // xdrv_63_modbus_bridge.ino #endif #if defined(USE_DISCOVERY) && defined(MQTT_HOST_DISCOVERY) - feature1 |= 0x00002000; // xdrv_02_mqtt.ino + 0x00002000 | // xdrv_02_mqtt.ino #endif #if defined(USE_LIGHT) && defined(USE_ARILUX_RF) - feature1 |= 0x00004000; // xdrv_04_light.ino + 0x00004000 | // xdrv_04_light.ino #endif #if defined(USE_LIGHT) && defined(USE_WS2812) - feature1 |= 0x00008000; // xdrv_04_light.ino + 0x00008000 | // xdrv_04_light.ino #endif #if defined(USE_LIGHT) && defined(USE_WS2812) && defined(USE_WS2812_DMA) - feature1 |= 0x00010000; // xdrv_04_light.ino + 0x00010000 | // xdrv_04_light.ino #endif #if defined(USE_IR_REMOTE) || defined(USE_IR_REMOTE_FULL) - feature1 |= 0x00020000; // xdrv_05_irremote.ino + 0x00020000 | // xdrv_05_irremote.ino #endif #ifdef USE_IR_HVAC - feature1 |= 0x00040000; // xdrv_05_irremote.ino + 0x00040000 | // xdrv_05_irremote.ino #endif #if defined(USE_IR_REMOTE) && defined(USE_IR_RECEIVE) - feature1 |= 0x00080000; // xdrv_05_irremote.ino + 0x00080000 | // xdrv_05_irremote.ino #endif #ifdef USE_DOMOTICZ - feature1 |= 0x00100000; // xdrv_07_domoticz.ino + 0x00100000 | // xdrv_07_domoticz.ino #endif #ifdef USE_DISPLAY - feature1 |= 0x00200000; // xdrv_13_display.ino + 0x00200000 | // xdrv_13_display.ino #endif #ifdef USE_HOME_ASSISTANT - feature1 |= 0x00400000; // xdrv_12_home_assistant.ino + 0x00400000 | // xdrv_12_home_assistant.ino #endif #ifdef USE_SERIAL_BRIDGE - feature1 |= 0x00800000; // xdrv_08_serial_bridge.ino + 0x00800000 | // xdrv_08_serial_bridge.ino #endif #ifdef USE_TIMERS - feature1 |= 0x01000000; // xdrv_09_timers.ino + 0x01000000 | // xdrv_09_timers.ino #endif #if defined(USE_TIMERS) && defined(USE_SUNRISE) - feature1 |= 0x02000000; // xdrv_09_timers.ino + 0x02000000 | // xdrv_09_timers.ino #endif #if defined(USE_TIMERS) && defined(USE_TIMERS_WEB) - feature1 |= 0x04000000; // xdrv_09_timers.ino + 0x04000000 | // xdrv_09_timers.ino #endif #ifdef USE_RULES - feature1 |= 0x08000000; // xdrv_10_rules.ino + 0x08000000 | // xdrv_10_rules.ino #endif #ifdef USE_KNX - feature1 |= 0x10000000; // xdrv_11_knx.ino + 0x10000000 | // xdrv_11_knx.ino #endif #ifdef USE_WPS - feature1 |= 0x20000000; // support.ino - removed with version 6.6.0.21 + 0x20000000 | // support.ino - removed with version 6.6.0.21 #endif #ifdef USE_SMARTCONFIG - feature1 |= 0x40000000; // support.ino - removed with version 6.6.0.21 + 0x40000000 | // support.ino - removed with version 6.6.0.21 #endif #if defined(USE_ENERGY_SENSOR) && defined(USE_ENERGY_POWER_LIMIT) - feature1 |= 0x80000000; // xdrv_03_energy.ino + 0x80000000 | // xdrv_03_energy.ino #endif - } - - static uint32_t feature2 = 0x00000000; - if (!feature2) { // Only fill this once + 0, #ifdef USE_CONFIG_OVERRIDE - feature2 |= 0x00000001; // user_config(_override).h + 0x00000001 | // user_config(_override).h #endif #ifdef FIRMWARE_MINIMAL - feature2 |= 0x00000002; // user_config(_override).h + 0x00000002 | // user_config(_override).h #endif #ifdef FIRMWARE_SENSORS - feature2 |= 0x00000004; // user_config(_override).h + 0x00000004 | // user_config(_override).h #endif #ifdef FIRMWARE_CLASSIC - feature2 |= 0x00000008; // user_config(_override).h + 0x00000008 | // user_config(_override).h #endif #ifdef FIRMWARE_KNX_NO_EMULATION - feature2 |= 0x00000010; // user_config(_override).h + 0x00000010 | // user_config(_override).h #endif #if defined(USE_DISPLAY) && defined(USE_DISPLAY_MODES1TO5) - feature2 |= 0x00000020; // xdrv_13_display.ino + 0x00000020 | // xdrv_13_display.ino #endif #if defined(USE_DISPLAY) && defined(USE_DISPLAY_GRAPH) - feature2 |= 0x00000040; // xdrv_13_display.ino + 0x00000040 | // xdrv_13_display.ino #endif #if defined(USE_I2C) && defined(USE_DISPLAY) && defined(USE_DISPLAY_LCD) - feature2 |= 0x00000080; // xdsp_01_lcd.ino + 0x00000080 | // xdsp_01_lcd.ino #endif #if defined(USE_I2C) && defined(USE_DISPLAY) && defined(USE_DISPLAY_SSD1306) - feature2 |= 0x00000100; // xdsp_02_ssd1306.ino + 0x00000100 | // xdsp_02_ssd1306.ino #endif #if defined(USE_I2C) && defined(USE_DISPLAY) && defined(USE_DISPLAY_MATRIX) - feature2 |= 0x00000200; // xdsp_03_matrix.ino + 0x00000200 | // xdsp_03_matrix.ino #endif #if defined(USE_SPI) && defined(USE_DISPLAY) && defined(USE_DISPLAY_ILI9341) - feature2 |= 0x00000400; // xdsp_04_ili9341.ino + 0x00000400 | // xdsp_04_ili9341.ino #endif #if defined(USE_SPI) && defined(USE_DISPLAY) && defined(USE_DISPLAY_EPAPER_29) - feature2 |= 0x00000800; // xdsp_05_epaper.ino + 0x00000800 | // xdsp_05_epaper.ino #endif #if defined(USE_I2C) && defined(USE_DISPLAY) && defined(USE_DISPLAY_SH1106) - feature2 |= 0x00001000; // xdsp_07_sh1106.ino + 0x00001000 | // xdsp_07_sh1106.ino #endif #ifdef USE_MP3_PLAYER - feature2 |= 0x00002000; // xdrv_14_mp3.ino + 0x00002000 | // xdrv_14_mp3.ino #endif #if defined(USE_I2C) && (defined(USE_PCA9685) || defined(USE_PCA9685_V2)) - feature2 |= 0x00004000; // xdrv_15_pca9685.ino or xdrv_15_pca9685_v2.ino + 0x00004000 | // xdrv_15_pca9685.ino or xdrv_15_pca9685_v2.ino #endif #if defined(USE_LIGHT) && defined(USE_TUYA_MCU) - feature2 |= 0x00008000; // xdrv_16_tuyadimmer.ino + 0x00008000 | // xdrv_16_tuyadimmer.ino #endif #ifdef USE_RC_SWITCH - feature2 |= 0x00010000; // xdrv_17_rcswitch.ino + 0x00010000 | // xdrv_17_rcswitch.ino #endif #if defined(USE_LIGHT) && defined(USE_ARMTRONIX_DIMMERS) - feature2 |= 0x00020000; // xdrv_18_armtronixdimmer.ino + 0x00020000 | // xdrv_18_armtronixdimmer.ino #endif #if defined(USE_LIGHT) && defined(USE_SM16716) - feature2 |= 0x00040000; // xdrv_04_light.ino + 0x00040000 | // xdrv_04_light.ino #endif #ifdef USE_SCRIPT - feature2 |= 0x00080000; // xdrv_10_scripter.ino + 0x00080000 | // xdrv_10_scripter.ino #endif #if defined(USE_WEBSERVER) && defined(USE_EMULATION_WEMO) - feature2 |= 0x00100000; // xdrv_21_wemo.ino + 0x00100000 | // xdrv_21_wemo.ino #endif #ifdef USE_SONOFF_IFAN - feature2 |= 0x00200000; // xdrv_22_sonoff_ifan.ino + 0x00200000 | // xdrv_22_sonoff_ifan.ino #endif #ifdef USE_ZIGBEE - feature2 |= 0x00400000; // xdrv_23_zigbee.ino + 0x00400000 | // xdrv_23_zigbee.ino #endif #ifdef NO_EXTRA_4K_HEAP - feature2 |= 0x00800000; // sonoff_post.h + 0x00800000 | // sonoff_post.h #endif #ifdef VTABLES_IN_IRAM - feature2 |= 0x01000000; // platformio.ini + 0x01000000 | // platformio.ini #endif #ifdef VTABLES_IN_DRAM - feature2 |= 0x02000000; // platformio.ini + 0x02000000 | // platformio.ini #endif #ifdef VTABLES_IN_FLASH - feature2 |= 0x04000000; // platformio.ini + 0x04000000 | // platformio.ini #endif #ifdef PIO_FRAMEWORK_ARDUINO_LWIP_HIGHER_BANDWIDTH - feature2 |= 0x08000000; // platformio.ini + 0x08000000 | // platformio.ini #endif #ifdef PIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY - feature2 |= 0x10000000; // platformio.ini + 0x10000000 | // platformio.ini #endif #ifdef PIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH - feature2 |= 0x20000000; // platformio.ini + 0x20000000 | // platformio.ini #endif #ifdef DEBUG_THEO - feature2 |= 0x40000000; // xdrv_99_debug.ino + 0x40000000 | // xdrv_99_debug.ino #endif #ifdef USE_DEBUG_DRIVER - feature2 |= 0x80000000; // xdrv_99_debug.ino + 0x80000000 | // xdrv_99_debug.ino #endif - } - - static uint32_t feature3 = 0x00000000; - if (!feature3) { // Only fill this once + 0, #ifdef USE_COUNTER - feature3 |= 0x00000001; // xsns_01_counter.ino + 0x00000001 | // xsns_01_counter.ino #endif #if defined(USE_ADC_VCC) || defined(USE_ADC) - feature3 |= 0x00000002; // xsns_02_analog.ino + 0x00000002 | // xsns_02_analog.ino #endif #ifdef USE_ENERGY_SENSOR - feature3 |= 0x00000004; // xdrv_03_energy.ino + 0x00000004 | // xdrv_03_energy.ino #endif #if defined(USE_ENERGY_SENSOR) && defined(USE_PZEM004T) - feature3 |= 0x00000008; // xnrg_03_pzem004t.ino + 0x00000008 | // xnrg_03_pzem004t.ino #endif #ifdef USE_DS18B20 - feature3 |= 0x00000010; // xsns_05_ds18b20.ino - no more support since 6.6.0.18 + 0x00000010 | // xsns_05_ds18b20.ino - no more support since 6.6.0.18 #endif #ifdef USE_DS18x20_LEGACY - feature3 |= 0x00000020; // xsns_05_ds18x20_legacy.ino - no more support since 6.6.0.14 + 0x00000020 | // xsns_05_ds18x20_legacy.ino - no more support since 6.6.0.14 #endif #ifdef USE_DS18x20 - feature3 |= 0x00000040; // xsns_05_ds18x20.ino + 0x00000040 | // xsns_05_ds18x20.ino #endif #ifdef USE_DHT - feature3 |= 0x00000080; // xsns_06_dht.ino + 0x00000080 | // xsns_06_dht.ino #endif #if defined(USE_I2C) && defined(USE_SHT) - feature3 |= 0x00000100; // xsns_07_sht1x.ino + 0x00000100 | // xsns_07_sht1x.ino #endif #if defined(USE_I2C) && defined(USE_HTU) - feature3 |= 0x00000200; // xsns_08_htu21.ino + 0x00000200 | // xsns_08_htu21.ino #endif #if defined(USE_I2C) && defined(USE_BMP) - feature3 |= 0x00000400; // xsns_09_bmp.ino + 0x00000400 | // xsns_09_bmp.ino #endif #if defined(USE_I2C) && defined(USE_BMP) && defined(USE_BME68X) - feature3 |= 0x00000800; // xsns_09_bmp.ino - BME68x + 0x00000800 | // xsns_09_bmp.ino - BME68x #endif #if defined(USE_I2C) && defined(USE_BH1750) - feature3 |= 0x00001000; // xsns_10_bh1750.ino + 0x00001000 | // xsns_10_bh1750.ino #endif #if defined(USE_I2C) && defined(USE_VEML6070) - feature3 |= 0x00002000; // xsns_11_veml6070.ino + 0x00002000 | // xsns_11_veml6070.ino #endif #if defined(USE_I2C) && defined(USE_ADS1115_I2CDEV) - feature3 |= 0x00004000; // xsns_12_ads1115_i2cdev.ino + 0x00004000 | // xsns_12_ads1115_i2cdev.ino #endif #if defined(USE_I2C) && defined(USE_ADS1115) - feature3 |= 0x00008000; // xsns_12_ads1115.ino + 0x00008000 | // xsns_12_ads1115.ino #endif #if defined(USE_I2C) && defined(USE_INA219) - feature3 |= 0x00010000; // xsns_13_ina219.ino + 0x00010000 | // xsns_13_ina219.ino #endif #if defined(USE_I2C) && defined(USE_SHT3X) - feature3 |= 0x00020000; // xsns_14_sht3x.ino + 0x00020000 | // xsns_14_sht3x.ino #endif #ifdef USE_MHZ19 - feature3 |= 0x00040000; // xsns_15_mhz19.ino + 0x00040000 | // xsns_15_mhz19.ino #endif #if defined(USE_I2C) && defined(USE_TSL2561) - feature3 |= 0x00080000; // xsns_16_tsl2561.ino + 0x00080000 | // xsns_16_tsl2561.ino #endif #ifdef USE_SENSEAIR - feature3 |= 0x00100000; // xsns_17_senseair.ino + 0x00100000 | // xsns_17_senseair.ino #endif #ifdef USE_PMS5003 - feature3 |= 0x00200000; // xsns_18_pms5003.ino + 0x00200000 | // xsns_18_pms5003.ino #endif #if defined(USE_I2C) && defined(USE_MGS) - feature3 |= 0x00400000; // xsns_19_mgs.ino + 0x00400000 | // xsns_19_mgs.ino #endif #ifdef USE_NOVA_SDS - feature3 |= 0x00800000; // xsns_20_novasds.ino + 0x00800000 | // xsns_20_novasds.ino #endif #if defined(USE_I2C) && defined(USE_SGP30) - feature3 |= 0x01000000; // xsns_21_sgp30.ino + 0x01000000 | // xsns_21_sgp30.ino #endif #ifdef USE_SR04 - feature3 |= 0x02000000; // xsns_22_sr04.ino + 0x02000000 | // xsns_22_sr04.ino #endif #if defined(USE_ENERGY_SENSOR) && defined(USE_SDM120) - feature3 |= 0x04000000; // xnrg_08_sdm120.ino + 0x04000000 | // xnrg_08_sdm120.ino #endif #if defined(USE_I2C) && defined(USE_SI1145) - feature3 |= 0x08000000; // xsns_24_si1145.ino + 0x08000000 | // xsns_24_si1145.ino #endif #if defined(USE_ENERGY_SENSOR) && defined(USE_SDM630) - feature3 |= 0x10000000; // xnrg_10_sdm630.ino + 0x10000000 | // xnrg_10_sdm630.ino #endif #if defined(USE_I2C) && defined(USE_LM75AD) - feature3 |= 0x20000000; // xsns_26_lm75ad.ino + 0x20000000 | // xsns_26_lm75ad.ino #endif #if defined(USE_I2C) && defined(USE_APDS9960) - feature3 |= 0x40000000; // xsns_27_apds9960.ino + 0x40000000 | // xsns_27_apds9960.ino #endif #ifdef USE_TM1638 - feature3 |= 0x80000000; // xdrv_66_tm1638.ino + 0x80000000 | // xdrv_66_tm1638.ino #endif - } - - static uint32_t feature4 = 0x00000000; - if (!feature4) { // Only fill this once + 0, #if defined(USE_I2C) && defined(USE_MCP230xx) - feature4 |= 0x00000001; // xsns_29_mcp230xx.ino + 0x00000001 | // xsns_29_mcp230xx.ino #endif #if defined(USE_I2C) && defined(USE_MPR121) - feature4 |= 0x00000002; // xsns_30_mpr121.ino + 0x00000002 | // xsns_30_mpr121.ino #endif #if defined(USE_I2C) && (defined(USE_CCS811) || defined(USE_CCS811_V2)) - feature4 |= 0x00000004; // xsns_31_ccs811.ino or xsns_31_ccs811_v2.ino + 0x00000004 | // xsns_31_ccs811.ino or xsns_31_ccs811_v2.ino #endif #if defined(USE_I2C) && defined(USE_MPU6050) - feature4 |= 0x00000008; // xsns_32_mpu6050.ino + 0x00000008 | // xsns_32_mpu6050.ino #endif #if defined(USE_I2C) && defined(USE_MCP230xx) && defined(USE_MCP230xx_OUTPUT) - feature4 |= 0x00000010; // xsns_29_mcp230xx.ino + 0x00000010 | // xsns_29_mcp230xx.ino #endif #if defined(USE_I2C) && defined(USE_MCP230xx) && defined(USE_MCP230xx_DISPLAYOUTPUT) - feature4 |= 0x00000020; // xsns_29_mcp230xx.ino + 0x00000020 | // xsns_29_mcp230xx.ino #endif #if defined(USE_ENERGY_SENSOR) && defined(USE_HLW8012) - feature4 |= 0x00000040; // xnrg_01_hlw8012.ino + 0x00000040 | // xnrg_01_hlw8012.ino #endif #if defined(USE_ENERGY_SENSOR) && defined(USE_CSE7766) - feature4 |= 0x00000080; // xnrg_02_cse7766.ino + 0x00000080 | // xnrg_02_cse7766.ino #endif #if defined(USE_ENERGY_SENSOR) && defined(USE_MCP39F501) - feature4 |= 0x00000100; // xnrg_04_mcp39f501.ino + 0x00000100 | // xnrg_04_mcp39f501.ino #endif #if defined(USE_ENERGY_SENSOR) && defined(USE_PZEM_AC) - feature4 |= 0x00000200; // xnrg_05_pzem_ac.ino + 0x00000200 | // xnrg_05_pzem_ac.ino #endif #if defined(USE_I2C) && defined(USE_DS3231) - feature4 |= 0x00000400; // xsns_33_ds3231.ino + 0x00000400 | // xsns_33_ds3231.ino #endif #ifdef USE_HX711 - feature4 |= 0x00000800; // xsns_34_hx711.ino + 0x00000800 | // xsns_34_hx711.ino #endif #if defined(USE_ENERGY_SENSOR) && defined(USE_PZEM_DC) - feature4 |= 0x00001000; // xnrg_06_pzem_dc.ino + 0x00001000 | // xnrg_06_pzem_dc.ino #endif #if defined(USE_TX20_WIND_SENSOR) || defined(USE_TX23_WIND_SENSOR) || defined(USE_WS2300_WIND_SENSOR) - feature4 |= 0x00002000; // xsns_35_tx20.ino + 0x00002000 | // xsns_35_tx20.ino #endif #if defined(USE_I2C) && defined(USE_MGC3130) - feature4 |= 0x00004000; // xsns_36_mgc3130.ino + 0x00004000 | // xsns_36_mgc3130.ino #endif #ifdef USE_RF_SENSOR - feature4 |= 0x00008000; // xsns_37_rfsensor.ino + 0x00008000 | // xsns_37_rfsensor.ino #endif #if defined(USE_RF_SENSOR) && defined(USE_THEO_V2) - feature4 |= 0x00010000; // xsns_37_rfsensor.ino + 0x00010000 | // xsns_37_rfsensor.ino #endif #if defined(USE_RF_SENSOR) && defined(USE_ALECTO_V2) - feature4 |= 0x00020000; // xsns_37_rfsensor.ino + 0x00020000 | // xsns_37_rfsensor.ino #endif #ifdef USE_AZ7798 - feature4 |= 0x00040000; // xsns_38_az7798.ino + 0x00040000 | // xsns_38_az7798.ino #endif #ifdef USE_MAX31855 - feature4 |= 0x00080000; // xsns_39_max31855.ino + 0x00080000 | // xsns_39_max31855.ino #endif #ifdef USE_PN532_HSU - feature4 |= 0x00100000; // xsns_40_pn532.ino + 0x00100000 | // xsns_40_pn532.ino #endif #if defined(USE_I2C) && defined(USE_MAX44009) - feature4 |= 0x00200000; // xsns_41_max44009.ino + 0x00200000 | // xsns_41_max44009.ino #endif #if defined(USE_I2C) && defined(USE_SCD30) - feature4 |= 0x00400000; // xsns_42_scd30.ino + 0x00400000 | // xsns_42_scd30.ino #endif #ifdef USE_HRE - feature4 |= 0x00800000; // xsns_43_hre.ino + 0x00800000 | // xsns_43_hre.ino #endif #if defined(USE_ENERGY_SENSOR) && defined(USE_ADE7953) - feature4 |= 0x01000000; // xnrg_07_ade7953.ino + 0x01000000 | // xnrg_07_ade7953.ino #endif #if defined(USE_I2C) && defined(USE_SPS30) - feature4 |= 0x02000000; // xsns_44_sps30.ino + 0x02000000 | // xsns_44_sps30.ino #endif #if defined(USE_I2C) && defined(USE_VL53L0X) - feature4 |= 0x04000000; // xsns_45_vl53l0x.ino + 0x04000000 | // xsns_45_vl53l0x.ino #endif #if defined(USE_I2C) && defined(USE_MLX90614) - feature4 |= 0x08000000; // xsns_46_MLX90614.ino + 0x08000000 | // xsns_46_MLX90614.ino #endif #ifdef USE_MAX31865 - feature4 |= 0x10000000; // xsns_47-max31865.ino + 0x10000000 | // xsns_47-max31865.ino #endif #if defined(USE_I2C) && defined(USE_CHIRP) - feature4 |= 0x20000000; // xsns_48_chirp.ino + 0x20000000 | // xsns_48_chirp.ino #endif #if defined(USE_ENERGY_SENSOR) && defined(USE_SOLAX_X1) - feature4 |= 0x40000000; // xnrg_12_solaxX1.ino + 0x40000000 | // xnrg_12_solaxX1.ino #endif #if defined(USE_I2C) && defined(USE_PAJ7620) - feature4 |= 0x80000000; // xsns_50_paj7620.ino + 0x80000000 | // xsns_50_paj7620.ino #endif - } - - static uint32_t feature5 = 0x00000000; - if (!feature5) { // Only fill this once + 0, #ifdef USE_BUZZER - feature5 |= 0x00000001; // xdrv_24_buzzer.ino + 0x00000001 | // xdrv_24_buzzer.ino #endif #ifdef USE_RDM6300 - feature5 |= 0x00000002; // xsns_51_rdm6300.ino + 0x00000002 | // xsns_51_rdm6300.ino #endif #ifdef USE_IBEACON - feature5 |= 0x00000004; // xsns_52_ibeacon.ino + 0x00000004 | // xsns_52_ibeacon.ino #endif #ifdef USE_SML_M - feature5 |= 0x00000008; // xsns_53_sml.ino + 0x00000008 | // xsns_53_sml.ino #endif #if defined(USE_I2C) && defined(USE_INA226) - feature5 |= 0x00000010; // xsns_54_ina226.ino + 0x00000010 | // xsns_54_ina226.ino #endif #ifdef USE_A4988_STEPPER - feature5 |= 0x00000020; // xdrv_25_A4988.ino + 0x00000020 | // xdrv_25_A4988.ino #endif #if defined(USE_ENERGY_SENSOR) && defined(USE_DDS2382) - feature5 |= 0x00000040; // xnrg_09_dds2382.ino + 0x00000040 | // xnrg_09_dds2382.ino #endif #if defined(USE_LIGHT) && defined(USE_SM2135) - feature5 |= 0x00000080; // xdrv_026_sm2135.ino + 0x00000080 | // xdrv_026_sm2135.ino #endif #ifdef USE_SHUTTER - feature5 |= 0x00000100; // xdrv_027_shutter.ino + 0x00000100 | // xdrv_027_shutter.ino #endif #if defined(USE_I2C) && defined(USE_PCF8574) - feature5 |= 0x00000200; // xdrv_028_pcf8574.ino + 0x00000200 | // xdrv_028_pcf8574.ino #endif #if defined(USE_ENERGY_SENSOR) && defined(USE_DDSU666) - feature5 |= 0x00000400; // xnrg_11_ddsu666.ino + 0x00000400 | // xnrg_11_ddsu666.ino #endif #ifdef USE_DEEPSLEEP - feature5 |= 0x00000800; // xdrv_029_deepsleep.ino + 0x00000800 | // xdrv_029_deepsleep.ino #endif #ifdef USE_SONOFF_SC - feature5 |= 0x00001000; // xsns_04_snfsc.ino + 0x00001000 | // xsns_04_snfsc.ino #endif #ifdef USE_SONOFF_RF - feature5 |= 0x00002000; // xdrv_06_snfbridge.ino + 0x00002000 | // xdrv_06_snfbridge.ino #endif #if defined(USE_LIGHT) && defined(USE_SONOFF_L1) - feature5 |= 0x00004000; // xlgt_05_sonoff_l1.ino + 0x00004000 | // xlgt_05_sonoff_l1.ino #endif #if defined(USE_LIGHT) && defined(USE_EXS_DIMMER) - feature5 |= 0x00008000; // xdrv_30_exs_dimmer.ino + 0x00008000 | // xdrv_30_exs_dimmer.ino #endif #ifdef USE_TASMOTA_CLIENT - feature5 |= 0x00010000; // xdrv_31_tasmota_client.ino + 0x00010000 | // xdrv_31_tasmota_client.ino #endif #if defined(USE_I2C) && defined(USE_HIH6) - feature5 |= 0x00020000; // xsns_55_hih_series.ino + 0x00020000 | // xsns_55_hih_series.ino #endif #ifdef USE_HPMA - feature5 |= 0x00040000; // xsns_56_hpma.ino + 0x00040000 | // xsns_56_hpma.ino #endif #if defined(USE_I2C) && defined(USE_TSL2591) - feature5 |= 0x00080000; // xsns_57_tsl2591.ino + 0x00080000 | // xsns_57_tsl2591.ino #endif #if defined(USE_I2C) && defined(USE_DHT12) - feature5 |= 0x00100000; // xsns_58_dht12.ino + 0x00100000 | // xsns_58_dht12.ino #endif #if defined(USE_I2C) && defined(USE_DS1624) - feature5 |= 0x00200000; // xsns_59_ds1624.ino + 0x00200000 | // xsns_59_ds1624.ino #endif #ifdef USE_GPS - feature5 |= 0x00400000; // xsns_60_GPS.ino + 0x00400000 | // xsns_60_GPS.ino #endif #if defined(USE_I2C) && defined(USE_HOTPLUG) - feature5 |= 0x00800000; // xdrv_32_hotplug.ino + 0x00800000 | // xdrv_32_hotplug.ino #endif #ifdef USE_NRF24 - feature5 |= 0x01000000; // xsns_33_nrf24l01.ino + 0x01000000 | // xsns_33_nrf24l01.ino #endif #ifdef USE_MIBLE - feature5 |= 0x02000000; // xsns_61_MI_BLE.ino + 0x02000000 | // xsns_61_MI_BLE.ino #endif #ifdef USE_HM10 - feature5 |= 0x04000000; // xsns_62_MI_HM10.ino + 0x04000000 | // xsns_62_MI_HM10.ino #endif #if defined(USE_ENERGY_SENSOR) && defined(USE_LE01MR) - feature5 |= 0x08000000; // xnrg_13_fif_le01mr.ino + 0x08000000 | // xnrg_13_fif_le01mr.ino #endif #if defined(USE_I2C) && (defined(USE_AHT1x) || defined(USE_AHT2x)) - feature5 |= 0x10000000; // xsns_63_aht1x.ino + 0x10000000 | // xsns_63_aht1x.ino #endif #if defined(USE_I2C) && defined(USE_WEMOS_MOTOR_V1) - feature5 |= 0x20000000; // xdrv_34_wemos_motor_v1.ino + 0x20000000 | // xdrv_34_wemos_motor_v1.ino #endif #ifdef USE_DEVICE_GROUPS - feature5 |= 0x40000000; // support_device_groups.ino + 0x40000000 | // support_device_groups.ino #endif #ifdef USE_PWM_DIMMER - feature5 |= 0x80000000; // xdrv_35_pwm_dimmer + 0x80000000 | // xdrv_35_pwm_dimmer #endif - } - - static uint32_t feature6 = 0x00000000; - if (!feature6) { // Only fill this once + 0, #ifdef USE_KEELOQ - feature6 |= 0x00000001; // xdrv_36_keeloq.ino + 0x00000001 | // xdrv_36_keeloq.ino #endif #ifdef USE_HRXL - feature6 |= 0x00000002; // xsns_64_hrxl.ino + 0x00000002 | // xsns_64_hrxl.ino #endif #ifdef USE_SONOFF_D1 - feature6 |= 0x00000004; // xdrv_37_sonoff_d1.ino + 0x00000004 | // xdrv_37_sonoff_d1.ino #endif #if defined(USE_I2C) && defined(USE_HDC1080) - feature6 |= 0x00000008; // xsns_65_hdc1080.ino + 0x00000008 | // xsns_65_hdc1080.ino #endif #if defined(USE_I2C) && defined(USE_IAQ) - feature6 |= 0x00000010; // xsns_66_iAQ.ino + 0x00000010 | // xsns_66_iAQ.ino #endif #if defined(USE_DISPLAY) && defined(USE_DISPLAY_SEVENSEG) - feature6 |= 0x00000020; // xdsp_11_sevenseg.ino + 0x00000020 | // xdsp_11_sevenseg.ino #endif #if defined(USE_I2C) && defined(USE_AS3935) - feature6 |= 0x00000040; // xsns_67_as3935.ino + 0x00000040 | // xsns_67_as3935.ino #endif #ifdef USE_PING - feature6 |= 0x00000080; // xdrv_38_ping.ino + 0x00000080 | // xdrv_38_ping.ino #endif #ifdef USE_WINDMETER - feature6 |= 0x00000100; // xsns_68_windmeter.ino + 0x00000100 | // xsns_68_windmeter.ino #endif #ifdef USE_OPENTHERM - feature6 |= 0x00000200; // xsns_69_opentherm.ino + 0x00000200 | // xsns_69_opentherm.ino #endif #ifdef USE_THERMOSTAT - feature6 |= 0x00000400; // xdrv_39_heating.ino + 0x00000400 | // xdrv_39_heating.ino #endif #if defined(USE_I2C) && defined(USE_VEML6075) - feature6 |= 0x00000800; // xsns_70_veml6075.ino + 0x00000800 | // xsns_70_veml6075.ino #endif #if defined(USE_I2C) && defined(USE_VEML7700) - feature6 |= 0x00001000; // xsns_71_veml7700.ino + 0x00001000 | // xsns_71_veml7700.ino #endif #if defined(USE_I2C) && defined(USE_MCP9808) - feature6 |= 0x00002000; // xsns_72_mcp9808.ino + 0x00002000 | // xsns_72_mcp9808.ino #endif #if defined(USE_ENERGY_SENSOR) && (defined(USE_BL0940) || defined(USE_BL09XX)) - feature6 |= 0x00004000; // xnrg_14_bl09xx.ino + 0x00004000 | // xnrg_14_bl09xx.ino #endif #ifdef USE_TELEGRAM - feature6 |= 0x00008000; // xdrv_40_telegram.ino + 0x00008000 | // xdrv_40_telegram.ino #endif #if defined(USE_I2C) && defined(USE_HP303B) - feature6 |= 0x00010000; // xsns_73_hp303b.ino + 0x00010000 | // xsns_73_hp303b.ino #endif #ifdef USE_TCP_BRIDGE - feature6 |= 0x00020000; // xdrv_41_tcp_bridge.ino + 0x00020000 | // xdrv_41_tcp_bridge.ino #endif #if defined(USE_ENERGY_SENSOR) && defined(USE_TELEINFO) - feature6 |= 0x00040000; // xnrg_15_teleinfo.ino + 0x00040000 | // xnrg_15_teleinfo.ino #endif #ifdef USE_LMT01 - feature6 |= 0x00080000; // xsns_74_lmt01.ino + 0x00080000 | // xsns_74_lmt01.ino #endif #ifdef USE_PROMETHEUS - feature6 |= 0x00100000; // xsns_75_prometheus.ino + 0x00100000 | // xsns_75_prometheus.ino #endif #if defined(USE_ENERGY_SENSOR) && defined(USE_IEM3000) - feature6 |= 0x00200000; // xnrg_16_iem3000.ino + 0x00200000 | // xnrg_16_iem3000.ino #endif #ifdef USE_DYP - feature6 |= 0x00400000; // xsns_76_dyp.ino + 0x00400000 | // xsns_76_dyp.ino #endif #ifdef USE_I2S_AUDIO - feature6 |= 0x00800000; // xdrv_42_i2s_audio.ino + 0x00800000 | // xdrv_42_i2s_audio.ino #endif #ifdef USE_MLX90640 - feature6 |= 0x01000000; // xdrv_43_mlx90640.ino + 0x01000000 | // xdrv_43_mlx90640.ino #endif #if defined(USE_I2C) && defined(USE_VL53L1X) - feature6 |= 0x02000000; // xsns_77_vl53l1x.ino + 0x02000000 | // xsns_77_vl53l1x.ino #endif #ifdef USE_MIEL_HVAC - feature6 |= 0x04000000; // xdrv_44_miel_hvac.ino + 0x04000000 | // xdrv_44_miel_hvac.ino #endif #if defined(USE_ENERGY_SENSOR) && defined(USE_WE517) - feature6 |= 0x08000000; // xnrg_17_ornowe517.ino + 0x08000000 | // xnrg_17_ornowe517.ino #endif #if defined(USE_I2C) && defined(USE_EZOPH) - feature6 |= 0x10000000; // xsns_78_ezoph.ino + 0x10000000 | // xsns_78_ezoph.ino #endif #if defined(ESP32) && defined(USE_TTGO_WATCH) - feature6 |= 0x20000000; // xdrv_83_esp32watch.ino + 0x20000000 | // xdrv_83_esp32watch.ino #endif #if defined(ESP32) && defined(USE_ETHERNET) - feature6 |= 0x40000000; // xdrv_82_ethernet.ino + 0x40000000 | // xdrv_82_ethernet.ino #endif #if defined(ESP32) && defined(USE_WEBCAM) - feature6 |= 0x80000000; // xdrv_81_webcam.ino + 0x80000000 | // xdrv_81_webcam.ino #endif - } - - static uint32_t feature7 = 0x00000000; - if (!feature7) { // Only fill this once + 0, #if defined(USE_I2C) && defined(USE_EZOORP) - feature7 |= 0x00000001; // xsns_78_ezoorp.ino + 0x00000001 | // xsns_78_ezoorp.ino #endif #if defined(USE_I2C) && defined(USE_EZORTD) - feature7 |= 0x00000002; // xsns_78_ezortd.ino + 0x00000002 | // xsns_78_ezortd.ino #endif #if defined(USE_I2C) && defined(USE_EZOHUM) - feature7 |= 0x00000004; // xsns_78_ezohum.ino + 0x00000004 | // xsns_78_ezohum.ino #endif #if defined(USE_I2C) && defined(USE_EZOEC) - feature7 |= 0x00000008; // xsns_78_ezoec.ino + 0x00000008 | // xsns_78_ezoec.ino #endif #if defined(USE_I2C) && defined(USE_EZOCO2) - feature7 |= 0x00000010; // xsns_78_ezoco2.ino + 0x00000010 | // xsns_78_ezoco2.ino #endif #if defined(USE_I2C) && defined(USE_EZOO2) - feature7 |= 0x00000020; // xsns_78_ezoo2.ino + 0x00000020 | // xsns_78_ezoo2.ino #endif #if defined(USE_I2C) && defined(USE_EZOPRS) - feature7 |= 0x00000040; // xsns_78_ezoprs.ino + 0x00000040 | // xsns_78_ezoprs.ino #endif #if defined(USE_I2C) && defined(USE_EZOFLO) - feature7 |= 0x00000080; // xsns_78_ezoflo.ino + 0x00000080 | // xsns_78_ezoflo.ino #endif #if defined(USE_I2C) && defined(USE_EZODO) - feature7 |= 0x00000100; // xsns_78_ezodo.ino + 0x00000100 | // xsns_78_ezodo.ino #endif #if defined(USE_I2C) && defined(USE_EZORGB) - feature7 |= 0x00000200; // xsns_78_ezorgb.ino + 0x00000200 | // xsns_78_ezorgb.ino #endif #if defined(USE_I2C) && defined(USE_EZOPMP) - feature7 |= 0x00000400; // xsns_78_ezopmp.ino + 0x00000400 | // xsns_78_ezopmp.ino #endif #ifdef USE_AS608 - feature7 |= 0x00000800; // xsns_79_as608.ino + 0x00000800 | // xsns_79_as608.ino #endif #if defined(USE_SHELLY_DIMMER) - feature7 |= 0x00001000; // xdrv_45_shelly_dimmer.ino + 0x00001000 | // xdrv_45_shelly_dimmer.ino #endif #ifdef USE_RC522 - feature7 |= 0x00002000; // xsns_80_mfrc522.ino + 0x00002000 | // xsns_80_mfrc522.ino #endif #ifdef USE_FTC532 - feature7 |= 0x00004000; // xdrv_47_ftc532.ino + 0x00004000 | // xdrv_47_ftc532.ino #endif #if defined(USE_SPI) && defined(USE_DISPLAY) && defined(USE_DISPLAY_EPAPER_42) - feature7 |= 0x00008000; // xdsp_06_epaper_42.ino + 0x00008000 | // xdsp_06_epaper_42.ino #endif // #if defined(USE_SPI) && defined(USE_DISPLAY) && defined(USE_DISPLAY_ILI9488) -// feature7 |= 0x00010000; // xdsp_08_ILI9488.ino +// 0x00010000 | // xdsp_08_ILI9488.ino // #endif #if defined(USE_SPI) && defined(USE_DISPLAY) && defined(USE_DISPLAY_SSD1351) - feature7 |= 0x00020000; // xdsp_09_SSD1351.ino + 0x00020000 | // xdsp_09_SSD1351.ino #endif #if defined(USE_SPI) && defined(USE_DISPLAY) && defined(USE_DISPLAY_RA8876) - feature7 |= 0x00040000; // xdsp_10_RA8876.ino + 0x00040000 | // xdsp_10_RA8876.ino #endif #if defined(USE_SPI) && defined(USE_DISPLAY) && defined(USE_DISPLAY_ST7789) - feature7 |= 0x00080000; // xdsp_12_ST7789.ino + 0x00080000 | // xdsp_12_ST7789.ino #endif #if defined(USE_SPI) && defined(USE_DISPLAY) && defined(USE_DISPLAY_SSD1331) - feature7 |= 0x00100000; // xdsp_14_SSD1331.ino + 0x00100000 | // xdsp_14_SSD1331.ino #endif #ifdef USE_UFILESYS - feature7 |= 0x00200000; // xdrv_50_filesystem.ino + 0x00200000 | // xdrv_50_filesystem.ino #endif #ifdef USE_TIMEPROP - feature7 |= 0x00400000; // xdrv_48_timeprop.ino + 0x00400000 | // xdrv_48_timeprop.ino #endif #ifdef USE_PID - feature7 |= 0x00800000; // xdrv_49_pid.ino + 0x00800000 | // xdrv_49_pid.ino #endif #ifdef USE_BS814A2 - feature7 |= 0x01000000; // xdrv_51_bs814a2.ino + 0x01000000 | // xdrv_51_bs814a2.ino #endif #if defined(USE_I2C) && defined(USE_SEESAW_SOIL) - feature7 |= 0x02000000; // xsns_81_seesaw_soil.ino + 0x02000000 | // xsns_81_seesaw_soil.ino #endif #ifdef USE_WIEGAND - feature7 |= 0x04000000; // xsns_82_wiegand.ino + 0x04000000 | // xsns_82_wiegand.ino #endif #ifdef USE_NEOPOOL - feature7 |= 0x08000000; // xsns_83_neopool.ino + 0x08000000 | // xsns_83_neopool.ino #endif #if defined(USE_I2C) && defined(USE_TOF10120) - feature7 |= 0x10000000; // xsns_84_tof10120 + 0x10000000 | // xsns_84_tof10120 #endif #if defined(USE_ENERGY_SENSOR) && defined(USE_SDM72) - feature7 |= 0x20000000; // xnrg_18_sdm72.ino + 0x20000000 | // xnrg_18_sdm72.ino #endif #if defined(USE_DISPLAY) && defined(USE_DISPLAY_TM1637) - feature7 |= 0x40000000; + 0x40000000 | #endif #ifdef USE_PROJECTOR_CTRL - feature7 |= 0x80000000; // xdrv_53_projector_ctrl.ino + 0x80000000 | // xdrv_53_projector_ctrl.ino #endif - } - - static uint32_t feature8 = 0x00000000; - if (!feature8) { // Only fill this once + 0, #if defined(USE_I2C) && defined(USE_MPU_ACCEL) - feature8 |= 0x00000001; // xsns_85_mpu6886.ino + 0x00000001 | // xsns_85_mpu6886.ino #endif #ifdef USE_TFMINIPLUS - feature8 |= 0x00000002; // xsns_86_tfminiplus.ino + 0x00000002 | // xsns_86_tfminiplus.ino #endif #if defined(USE_ENERGY_SENSOR) && defined(USE_CSE7761) - feature8 |= 0x00000004; // xnrg_19_cse7761.ino + 0x00000004 | // xnrg_19_cse7761.ino #endif #ifdef USE_BERRY - feature8 |= 0x00000008; // xdrv_52_9_berry.ino + 0x00000008 | // xdrv_52_9_berry.ino #endif #if defined(USE_I2C) && defined(USE_BM8563) - feature8 |= 0x00000010; // xdrv_56_BM8563_RTC.ino + 0x00000010 | // xdrv_56_BM8563_RTC.ino #endif #if defined(USE_ENERGY_SENSOR) && defined(USE_ENERGY_DUMMY) - feature8 |= 0x00000020; // xnrg_30_dummy.ino + 0x00000020 | // xnrg_30_dummy.ino #endif #if defined(USE_I2C) && defined(USE_AM2320) - feature8 |= 0x00000040; // xsns_88_am2320.ino + 0x00000040 | // xsns_88_am2320.ino #endif #if defined(USE_I2C) && defined(USE_T67XX) - feature8 |= 0x00000080; // xsns_89_t67xx.ino + 0x00000080 | // xsns_89_t67xx.ino #endif #if defined(USE_SPI) && defined(USE_MCP2515) - feature8 |= 0x00000100; // xsns_87_mcp2515.ino + 0x00000100 | // xsns_87_mcp2515.ino #endif #ifdef USE_TASMESH - feature8 |= 0x00000200; // xdrv_57_9_tasmesh.ino + 0x00000200 | // xdrv_57_9_tasmesh.ino #endif #ifdef USE_WIFI_RANGE_EXTENDER - feature8 |= 0x00000400; // xdrv_58_range_extender.ino + 0x00000400 | // xdrv_58_range_extender.ino #endif #ifdef USE_INFLUXDB - feature8 |= 0x00000800; // xdrv_59_influxdb.ino + 0x00000800 | // xdrv_59_influxdb.ino #endif #ifdef USE_HRG15 - feature8 |= 0x00001000; // xsns_90_hrg15.ino + 0x00001000 | // xsns_90_hrg15.ino #endif #ifdef USE_VINDRIKTNING - feature8 |= 0x00002000; // xsns_91_vindriktning.ino + 0x00002000 | // xsns_91_vindriktning.ino #endif #if defined(USE_I2C) && defined(USE_SCD40) - feature8 |= 0x00004000; // xsns_92_scd40.ino + 0x00004000 | // xsns_92_scd40.ino #endif #if defined(USE_I2C) && defined(USE_HM330X) - feature8 |= 0x00008000; // xsns_93_hm330x.ino + 0x00008000 | // xsns_93_hm330x.ino #endif #if defined(USE_I2C) && defined(USE_HDC2010) - feature8 |= 0x00010000; // xsns_94_hdc2010.ino + 0x00010000 | // xsns_94_hdc2010.ino #endif #if defined(USE_LIGHT) && defined(USE_LSC_MCSL) - feature8 |= 0x00020000; // xlgt_07_lsc_mcsl.ino + 0x00020000 | // xlgt_07_lsc_mcsl.ino #endif #ifdef USE_SONOFF_SPM - feature8 |= 0x00040000; // xdrv_86_esp32_sonoff_spm.ino + 0x00040000 | // xdrv_86_esp32_sonoff_spm.ino #endif #ifdef USE_SHIFT595 - feature8 |= 0x00080000; // xdrv_60_shift595.ino + 0x00080000 | // xdrv_60_shift595.ino #endif #ifdef USE_SDM230 - feature8 |= 0x00100000; // xnrg_21_sdm230.ino + 0x00100000 | // xnrg_21_sdm230.ino #endif #ifdef USE_CM110x - feature8 |= 0x00200000; // xsns_95_cm110x.ino + 0x00200000 | // xsns_95_cm110x.ino #endif #if defined(USE_ENERGY_SENSOR) && defined(USE_BL6523) - feature8 |= 0x00400000; // xnrg_22_bl6523.ino + 0x00400000 | // xnrg_22_bl6523.ino #endif #if defined(USE_ENERGY_SENSOR) && defined(USE_I2C) && defined(USE_ADE7880) - feature8 |= 0x00800000; // xnrg_23_ade7880.ino + 0x00800000 | // xnrg_23_ade7880.ino #endif #if defined(USE_I2C) && defined(USE_PCF85363) - feature8 |= 0x01000000; // xdrv_56_rtc_chips.ino + 0x01000000 | // xdrv_56_rtc_chips.ino #endif #if defined(USE_I2C) && defined(USE_DS3502) - feature8 |= 0x02000000; // xdrv_61_ds3502.ino + 0x02000000 | // xdrv_61_ds3502.ino #endif #ifdef USE_IMPROV - feature8 |= 0x04000000; // xdrv_62_improv.ino + 0x04000000 | // xdrv_62_improv.ino #endif #ifdef USE_FLOWRATEMETER - feature8 |= 0x08000000; // xsns_96_flowratemeter.ino + 0x08000000 | // xsns_96_flowratemeter.ino #endif #if defined(USE_LIGHT) && defined(USE_BP5758D) - feature8 |= 0x10000000; // xlgt_08_bp5758d.ino + 0x10000000 | // xlgt_08_bp5758d.ino #endif #if defined(USE_I2C) && defined(USE_HYT) - feature8 |= 0x20000000; // xsns_97_hyt.ino + 0x20000000 | // xsns_97_hyt.ino #endif #if defined(USE_LIGHT) && defined(USE_SM2335) - feature8 |= 0x40000000; // xlgt_09_sm2335.ino + 0x40000000 | // xlgt_09_sm2335.ino #endif #ifdef USE_DISPLAY_TM1621_SONOFF - feature8 |= 0x80000000; // xdrv_87_esp32_sonoff_tm1621.ino + 0x80000000 | // xdrv_87_esp32_sonoff_tm1621.ino #endif - } - - static uint32_t feature9 = 0x00000000; - if (!feature9) { // Only fill this once + 0, #if defined(USE_I2C) && defined(USE_SGP40) - feature9 |= 0x00000001; // xsns_98_sgp40.ino + 0x00000001 | // xsns_98_sgp40.ino #endif #if defined(USE_I2C) && defined(USE_LUXV30B) - feature9 |= 0x00000002; // xsns_99_luxv30b.ino + 0x00000002 | // xsns_99_luxv30b.ino #endif #if defined(USE_SPI) && defined(USE_CANSNIFFER) - feature9 |= 0x00000004; // xsns_87_can_sniffer.ino + 0x00000004 | // xsns_87_can_sniffer.ino #endif #if defined(USE_I2C) && defined(USE_QMC5883L) - feature9 |= 0x00000008; // xsns_33_qmc5882l.ino + 0x00000008 | // xsns_33_qmc5882l.ino #endif #if defined(USE_ENERGY_SENSOR) && defined(USE_MODBUS_ENERGY) - feature9 |= 0x00000010; // xnrg_29_modbus.ino + 0x00000010 | // xnrg_29_modbus.ino #endif #if defined(USE_SPI) && defined(USE_SHELLY_PRO) - feature9 |= 0x00000020; // xdrv_88_esp32_shelly_pro.ino + 0x00000020 | // xdrv_88_esp32_shelly_pro.ino #endif #ifdef USE_DALI - feature9 |= 0x00000040; // xdrv_89_esp32_dali.ino + 0x00000040 | // xdrv_89_esp32_dali.ino #endif #if defined(USE_LIGHT) && defined(USE_BP1658CJ) - feature9 |= 0x00000080; // xlgt_10_bp1658cj.ino + 0x00000080 | // xlgt_10_bp1658cj.ino #endif #ifdef USE_DINGTIAN_RELAY - feature9 |= 0x00000100; // xdrv_90_dingtian_relay.ino + 0x00000100 | // xdrv_90_dingtian_relay.ino #endif #if defined(USE_I2C) && defined(USE_HMC5883L) - feature9 |= 0x00000200; // xsns_101_hmc5883l.ino + 0x00000200 | // xsns_101_hmc5883l.ino #endif #ifdef USE_LD2410 - feature9 |= 0x00000400; // xsns_102_ld2410.ino + 0x00000400 | // xsns_102_ld2410.ino #endif #ifdef USE_ME007 - feature9 |= 0x00000800; // xsns_23_me007.ino + 0x00000800 | // xsns_23_me007.ino #endif #if defined(USE_I2C) && defined(USE_DISPLAY) && defined(USE_DISPLAY_TM1650) - feature9 |= 0x00001000; // xdsp_20_tm1650.ino + 0x00001000 | // xdsp_20_tm1650.ino #endif #if defined(USE_I2C) && defined(USE_PCA9632) - feature9 |= 0x00002000; // xdrv_64_pca9632.ino + 0x00002000 | // xdrv_64_pca9632.ino #endif #ifdef USE_TUYAMCUBR - feature9 |= 0x00004000; // xdrv_65_tuyamcubr.ino + 0x00004000 | // xdrv_65_tuyamcubr.ino #endif #if defined(USE_I2C) && defined(USE_SEN5X) - feature9 |= 0x00008000; // xsns_103_sen5x.ino + 0x00008000 | // xsns_103_sen5x.ino #endif #if defined(USE_ENERGY_SENSOR) && defined(USE_BIOPDU) - feature9 |= 0x00010000; // xnrg_24_biopdu.ino + 0x00010000 | // xnrg_24_biopdu.ino #endif #if (defined(USE_I2C) || defined(USE_SPI)) && defined(USE_MCP23XXX_DRV) - feature9 |= 0x00020000; // xdrv_67_mcp23xxx.ino + 0x00020000 | // xdrv_67_mcp23xxx.ino #endif #if defined(USE_I2C) && defined(USE_PMSA003I) - feature9 |= 0x00040000; // xsns_104_pmsa003i.ino + 0x00040000 | // xsns_104_pmsa003i.ino #endif #ifdef USE_LOX_O2 - feature9 |= 0x00080000; // xsns_105_lox_o2.ino + 0x00080000 | // xsns_105_lox_o2.ino #endif #if defined(USE_I2C) && defined(USE_GDK101) - feature9 |= 0x00100000; // xsns_106_gdk101.ino + 0x00100000 | // xsns_106_gdk101.ino #endif #ifdef USE_GM861 - feature9 |= 0x00200000; // xsns_107_gm861.ino + 0x00200000 | // xsns_107_gm861.ino #endif #if defined(USE_I2C) && defined(USE_TC74) - feature9 |= 0x00400000; // xsns_108_tc74.ino + 0x00400000 | // xsns_108_tc74.ino #endif #if defined(USE_I2C) && defined(USE_PCA9557) - feature9 |= 0x00800000; // xdrv_69_pca9557.ino + 0x00800000 | // xdrv_69_pca9557.ino #endif #if defined(USE_I2C) && defined(USE_SGP4X) - feature9 |= 0x01000000; // xdrv_109_sgp4x.ino + 0x01000000 | // xdrv_109_sgp4x.ino #endif #if defined(USE_I2C) && defined(USE_MAX17043) - feature9 |= 0x02000000; // xsns_110_max17043 + 0x02000000 | // xsns_110_max17043 #endif #if defined(USE_I2C) && defined(USE_ENS16x) - feature9 |= 0x04000000; // xsns_111_ens16x.ino + 0x04000000 | // xsns_111_ens16x.ino #endif #if defined(USE_I2C) && defined(USE_ENS210) - feature9 |= 0x08000000; // xsns_112_ens210.ino + 0x08000000 | // xsns_112_ens210.ino #endif #ifdef USE_HC8 - feature9 |= 0x10000000; // xsns_113_hc8.ino + 0x10000000 | // xsns_113_hc8.ino #endif -// feature9 |= 0x20000000; -// feature9 |= 0x40000000; -// feature9 |= 0x80000000; - } +#ifdef USE_HDMI_CEC + 0x20000000 | // xdrv_70_0_hdmi_cec.ino +#endif +#ifdef USE_BLE_ESP32 + 0x40000000 | // xdrv_79_esp32_ble.ino +#endif +#ifdef USE_MATTER_DEVICE + 0x80000000 | // xdrv_52_9_berry.ino +#endif + 0, +// 0x00000001 | // +// 0x00000002 | // +// 0x00000004 | // +// 0x00000008 | // +// 0x00000010 | // +// 0x00000020 | // +// 0x00000040 | // +// 0x00000080 | // +// 0x00000100 | // +// 0x00000200 | // +// 0x00000400 | // +// 0x00000800 | // +// 0x00001000 | // +// 0x00002000 | // +// 0x00004000 | // +// 0x00008000 | // +// 0x00010000 | // +// 0x00020000 | // +// 0x00040000 | // +// 0x00080000 | // +// 0x00100000 | // +// 0x00200000 | // +// 0x00400000 | // +// 0x00800000 | // +// 0x01000000 | // +// 0x02000000 | // +// 0x04000000 | // +// 0x08000000 | // +// 0x10000000 | // +// 0x20000000 | // +// 0x40000000 | // +// 0x80000000 | // + 0 }; /*********************************************************************************************/ - ResponseAppend_P(PSTR(",\"" D_JSON_FEATURES "\":[\"%08X\",\"%08X\",\"%08X\",\"%08X\",\"%08X\",\"%08X\",\"%08X\",\"%08X\",\"%08X\",\"%08X\"]"), - LANGUAGE_LCID, feature1, feature2, feature3, feature4, feature5, feature6, feature7, feature8, feature9); +void ResponseAppendFeatures(void) { + ResponseAppend_P(PSTR(",\"" D_JSON_FEATURES "\":[\"%04X\""), LANGUAGE_LCID); // Locale ID + for (uint32_t i = 0; i < (sizeof(feature) / sizeof(uint32_t)); i++) { + ResponseAppend_P(PSTR(",\"%08X\""), feature[i]); // Tasmota feature list + } + ResponseAppend_P(PSTR("]")); } diff --git a/tasmota/tasmota_support/support_float.ino b/tasmota/tasmota_support/support_float.ino index dcef29671..ac7527302 100644 --- a/tasmota/tasmota_support/support_float.ino +++ b/tasmota/tasmota_support/support_float.ino @@ -376,8 +376,8 @@ float sqrt1(const float x) // // New version, you don't need the "to_min < to_max" precondition anymore // -// PRE-CONDITIONS (if not satisfied, you may 'halt and catch fire') -// from_min < from_max (not checked) +// PRE-CONDITIONS (if not satisfied, returns the smallest between to_min and to_max') +// from_min < from_max (checked) // from_min <= num <= from_max (checked) // POST-CONDITIONS // to_min <= result <= to_max @@ -412,8 +412,13 @@ uint16_t changeUIntScale(uint16_t inum, uint16_t ifrom_min, uint16_t ifrom_max, uint32_t result; if ((num - from_min) < 0x8000L) { // no overflow possible - uint32_t numerator = ((num - from_min) * 2 + 1) * (to_max - to_min + 1); - result = numerator / ((from_max - from_min + 1) * 2) + to_min; + if (to_max - to_min > from_max - from_min) { + uint32_t numerator = (num - from_min) * (to_max - to_min) * 2; + result = ((numerator / (from_max - from_min)) + 1 ) / 2 + to_min; + } else { + uint32_t numerator = ((num - from_min) * 2 + 1) * (to_max - to_min + 1); + result = numerator / ((from_max - from_min + 1) * 2) + to_min; + } } else { // no pre-rounding since it might create an overflow uint32_t numerator = (num - from_min) * (to_max - to_min + 1); result = numerator / (from_max - from_min) + to_min; @@ -422,6 +427,38 @@ uint16_t changeUIntScale(uint16_t inum, uint16_t ifrom_min, uint16_t ifrom_max, return (uint32_t) (result > to_max ? to_max : (result < to_min ? to_min : result)); } +// +// changeIntScale +// Change a value for range a..b to c..d, for signed ints (16 bits max to avoid overflow) +// +// PRE-CONDITIONS (if not satisfied, returns the smallest between to_min and to_max') +// from_min < from_max (checked) +// from_min <= num <= from_max (checked) +// POST-CONDITIONS +// to_min <= result <= to_max +// +int16_t changeIntScale(int16_t num, int16_t from_min, int16_t from_max, + int16_t to_min, int16_t to_max) { + + // guard-rails + if (from_min >= from_max) { + return (to_min > to_max ? to_max : to_min); // invalid input, return arbitrary value + } + int32_t from_offset = 0; + if (from_min < 0) { + from_offset = - from_min; + } + int32_t to_offset = 0; + if (to_min < 0) { + to_offset = - to_min; + } + if (to_max < (- to_offset)) { + to_offset = - to_max; + } + + return changeUIntScale(num + from_offset, from_min + from_offset, from_max + from_offset, to_min + to_offset, to_max + to_offset) - to_offset; +} + // Force a float value between two ranges, and adds or substract the range until we fit float ModulusRangef(float f, float a, float b) { if (b <= a) { return a; } // inconsistent, do what we can diff --git a/tasmota/tasmota_support/support_tasmota.ino b/tasmota/tasmota_support/support_tasmota.ino index 792c7dc83..6f8c2870a 100644 --- a/tasmota/tasmota_support/support_tasmota.ino +++ b/tasmota/tasmota_support/support_tasmota.ino @@ -1916,24 +1916,6 @@ void TasConsoleInput(void) { /********************************************************************************************/ -#ifdef ESP32 -// Since ESP-IDF 4.4, GPIO matrix or I/O is not reset during a restart -// and GPIO configuration can get stuck because of leftovers -// -// This patched version of pinMode forces a full GPIO reset before setting new mode -// -#include "driver/gpio.h" - -extern "C" void ARDUINO_ISR_ATTR __pinMode(uint8_t pin, uint8_t mode); - -extern "C" void ARDUINO_ISR_ATTR pinMode(uint8_t pin, uint8_t mode) { - gpio_reset_pin((gpio_num_t)pin); - __pinMode(pin, mode); -} -#endif - -/********************************************************************************************/ - void GpioInit(void) { if (!ValidModule(Settings->module)) { diff --git a/tasmota/tasmota_support/support_wifi.ino b/tasmota/tasmota_support/support_wifi.ino index 0b7c69c7d..348266166 100644 --- a/tasmota/tasmota_support/support_wifi.ino +++ b/tasmota/tasmota_support/support_wifi.ino @@ -648,10 +648,10 @@ String DNSGetIPStr(uint32_t idx) void WifiDumpAddressesIPv6(void) { for (netif* intf = netif_list; intf != nullptr; intf = intf->next) { - if (!ip_addr_isany_val(intf->ip_addr)) AddLog(LOG_LEVEL_DEBUG, "WIF: '%c%c' IPv4 %s", intf->name[0], intf->name[1], IPAddress(intf->ip_addr).toString().c_str()); + if (!ip_addr_isany_val(intf->ip_addr)) AddLog(LOG_LEVEL_DEBUG, "WIF: '%c%c%i' IPv4 %s", intf->name[0], intf->name[1], intf->num, IPAddress(intf->ip_addr).toString().c_str()); for (uint32_t i = 0; i < LWIP_IPV6_NUM_ADDRESSES; i++) { if (!ip_addr_isany_val(intf->ip6_addr[i])) - AddLog(LOG_LEVEL_DEBUG, "IP : '%c%c' IPv6 %s %s", intf->name[0], intf->name[1], + AddLog(LOG_LEVEL_DEBUG, "IP : '%c%c%i' IPv6 %s %s", intf->name[0], intf->name[1], intf->num, IPAddress(intf->ip6_addr[i]).toString().c_str(), ip_addr_islinklocal(&intf->ip6_addr[i]) ? "local" : ""); } @@ -1149,12 +1149,15 @@ void WifiDisable(void) { TasmotaGlobal.global_state.wifi_down = 1; } -void EspRestart(void) -{ +void EspRestart(void) { ResetPwm(); WifiShutdown(true); CrashDumpClear(); // Clear the stack dump in RTC +#ifdef CONFIG_IDF_TARGET_ESP32C3 + GpioForceHoldRelay(); // Retain the state when the chip or system is reset, for example, when watchdog time-out or Deep-sleep +#endif // CONFIG_IDF_TARGET_ESP32C3 + if (TasmotaGlobal.restart_halt) { // Restart 2 while (1) { OsWatchLoop(); // Feed OsWatch timer to prevent restart @@ -1165,7 +1168,12 @@ void EspRestart(void) } } else if (TasmotaGlobal.restart_deepsleep) { // Restart 9 + #ifdef USE_DEEPSLEEP + DeepSleepStart(); + // should never come to this line.... + #endif ESP.deepSleep(0); // Deep sleep mode with only hardware triggered wake up + } else { ESP_Restart(); diff --git a/tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino b/tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino index 6795a1c4b..79c953b72 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino @@ -247,7 +247,7 @@ const char HTTP_HEAD_STYLE3[] PROGMEM = "" "" - "
" // COLOR_TEXT + "
" // COLOR_BACKGROUND, COLOR_TEXT #ifdef FIRMWARE_MINIMAL #ifdef FIRMWARE_SAFEBOOT "

" D_SAFEBOOT "

" // COLOR_TEXT_WARNING @@ -360,7 +360,7 @@ const char HTTP_FORM_RST_UPG[] PROGMEM = "

" "
" + ">%s" "" "
" ""; @@ -371,7 +371,7 @@ const char HTTP_FORM_RST_UPG_FCT[] PROGMEM = "

" "
" + ">%s" "" "
" "" @@ -408,7 +408,7 @@ const char HTTP_COUNTER[] PROGMEM = "
"; const char HTTP_END[] PROGMEM = - "" + "" "
" "" ""; @@ -447,9 +447,9 @@ const char kUploadErrors[] PROGMEM = const uint16_t DNS_PORT = 53; enum HttpOptions { HTTP_OFF, HTTP_USER, HTTP_ADMIN, HTTP_MANAGER, HTTP_MANAGER_RESET_ONLY }; -enum WebCmndStatus { WEBCMND_DONE=0, WEBCMND_WRONG_PARAMETERS, WEBCMND_CONNECT_FAILED, WEBCMND_HOST_NOT_FOUND, WEBCMND_MEMORY_ERROR +enum WebCmndStatus { WEBCMND_DONE, WEBCMND_WRONG_PARAMETERS, WEBCMND_CONNECT_FAILED, WEBCMND_HOST_NOT_FOUND, WEBCMND_MEMORY_ERROR, WEBCMND_VALID_RESPONSE #ifdef USE_WEBGETCONFIG - , WEBCMND_FILE_NOT_FOUND, WEBCMND_OTHER_HTTP_ERROR, WEBCMND_CONNECTION_LOST, WEBCMND_INVALID_FILE + ,WEBCMND_FILE_NOT_FOUND, WEBCMND_OTHER_HTTP_ERROR, WEBCMND_CONNECTION_LOST, WEBCMND_INVALID_FILE #endif // USE_WEBGETCONFIG }; @@ -726,6 +726,9 @@ bool HttpCheckPriviledgedAccess(bool autorequestauth = true) AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_HTTP "Referer '%s' denied. Use 'SO128 1' for HTTP API commands. 'Webpassword' is recommended."), referer.c_str()); return false; } else { +#if defined(USE_MI_ESP32) && !defined(USE_BLE_ESP32) + MI32suspendScanTask(); +#endif // defined(USE_MI_ESP32) && !defined(USE_BLE_ESP32) return true; } } @@ -897,7 +900,11 @@ void WSContentSendStyle_P(const char* formatP, ...) { _WSContentSendBuffer(false, formatP, arg); va_end(arg); } - WSContentSend_P(HTTP_HEAD_STYLE3, WebColor(COL_TEXT), + if (strlen(SettingsText(SET_CANVAS))) { +// WSContentSend_P(PSTR("body{background:%s;background-repeat:no-repeat;background-attachment:fixed;background-size:cover;}"), SettingsText(SET_CANVAS)); + WSContentSend_P(PSTR("body{background:%s 0 0 / cover no-repeat fixed;}"), SettingsText(SET_CANVAS)); + } + WSContentSend_P(HTTP_HEAD_STYLE3, WebColor(COL_BACKGROUND), WebColor(COL_TEXT), #ifdef FIRMWARE_MINIMAL WebColor(COL_TEXT_WARNING), #endif @@ -997,6 +1004,9 @@ void WSContentEnd(void) { WSContentFlush(); // Flush chunk buffer _WSContentSend(""); // Signal end of chunked content Webserver->client().stop(); +#if defined(USE_MI_ESP32) && !defined(USE_BLE_ESP32) + MI32resumeScanTask(); +#endif // defined(USE_MI_ESP32) && !defined(USE_BLE_ESP32) } void WSContentStop(void) { @@ -1005,7 +1015,7 @@ void WSContentStop(void) { WSContentSend_P(HTTP_COUNTER); } } - WSContentSend_P(HTTP_END, TasmotaGlobal.version); + WSContentSend_P(HTTP_END, TasmotaGlobal.version, TasmotaGlobal.image_name); WSContentEnd(); } @@ -2318,7 +2328,7 @@ void HandleRestoreConfiguration(void) WSContentStart_P(PSTR(D_RESTORE_CONFIGURATION)); WSContentSendStyle(); WSContentSend_P(HTTP_FORM_RST); - WSContentSend_P(HTTP_FORM_RST_UPG, PSTR(D_RESTORE)); + WSContentSend_P(HTTP_FORM_RST_UPG, PSTR(D_START_RESTORE)); if (WifiIsInManagerMode()) { WSContentSpaceButton(BUTTON_MAIN); } else { @@ -2627,12 +2637,12 @@ void HandleUpgradeFirmware(void) { WSContentSend_P(HTTP_FORM_UPG, SettingsText(SET_OTAURL)); #ifdef ESP32 if (EspSingleOtaPartition() && !EspRunningFactoryPartition()) { - WSContentSend_P(HTTP_FORM_RST_UPG_FCT, PSTR(D_UPGRADE)); + WSContentSend_P(HTTP_FORM_RST_UPG_FCT, PSTR(D_START_UPGRADE)); } else { - WSContentSend_P(HTTP_FORM_RST_UPG, PSTR(D_UPGRADE)); + WSContentSend_P(HTTP_FORM_RST_UPG, PSTR(D_START_UPGRADE)); } #else - WSContentSend_P(HTTP_FORM_RST_UPG, PSTR(D_UPGRADE)); + WSContentSend_P(HTTP_FORM_RST_UPG, PSTR(D_START_UPGRADE)); #endif WSContentSpaceButton(BUTTON_MAIN); WSContentStop(); @@ -2851,7 +2861,7 @@ void HandleUploadLoop(void) { char tmp[16]; WebGetArg("fsz", tmp, sizeof(tmp)); // filesize uint32_t upload_size = (!strlen(tmp)) ? 0 : atoi(tmp); - AddLog(LOG_LEVEL_DEBUG, D_LOG_UPLOAD "freespace=%i filesize=%i", ESP.getFreeSketchSpace(), upload_size); + AddLog(LOG_LEVEL_DEBUG, D_LOG_UPLOAD "Freespace %i Filesize %i", ESP.getFreeSketchSpace(), upload_size); if (upload_size > ESP.getFreeSketchSpace()) { // TODO revisit this test #endif Web.upload_error = 4; // Program flash size is larger than real flash size @@ -3353,36 +3363,48 @@ int WebQuery(char *buffer) { else return status; if (http_code > 0) { // http_code will be negative on error - if (http_code == HTTP_CODE_OK || http_code == HTTP_CODE_MOVED_PERMANENTLY) { #ifdef USE_WEBSEND_RESPONSE + if (http_code == HTTP_CODE_OK || http_code == HTTP_CODE_MOVED_PERMANENTLY) { // Return received data to the user - Adds 900+ bytes to the code - const char* read = http.getString().c_str(); // File found at server - may need lot of ram or trigger out of memory! - ResponseClear(); - Response_P(PSTR("{\"" D_CMND_WEBQUERY "\":")); - char text[2] = { 0 }; + String response = http.getString(); // File found at server - may need lot of ram or trigger out of memory! + const char* read = response.c_str(); + +// uint32_t len = response.length() + 1; +// AddLog(LOG_LEVEL_DEBUG, PSTR("DBG: Response '%*_H' = %s"), len, (uint8_t*)read, read); + + char text[3] = { 0 }; // Make room foor double % text[0] = *read++; - bool assume_json = (text[0] == '{') || (text[0] == '['); - if (!assume_json) { ResponseAppend_P(PSTR("\"")); } - while (text[0] != '\0') { - if (text[0] > 31) { // Remove control characters like linefeed - if (assume_json) { - if (ResponseAppend_P(text) == ResponseSize()) { break; }; - } else { - if (ResponseAppend_P(EscapeJSONString(text).c_str()) == ResponseSize()) { break; }; + if (text[0] != '\0') { + Response_P(PSTR("{\"" D_CMND_WEBQUERY "\":")); + bool assume_json = (text[0] == '{') || (text[0] == '['); + if (!assume_json) { ResponseAppend_P(PSTR("\"")); } + while (text[0] != '\0') { + if (text[0] > 31) { // Remove control characters like linefeed + if ('%' == text[0]) { // Fix char string formatting for % + text[1] = '%'; + } + if (assume_json) { + if (ResponseAppend_P(text) == ResponseSize()) { break; }; + } else { + if (ResponseAppend_P(EscapeJSONString(text).c_str()) == ResponseSize()) { break; }; + } } + text[0] = *read++; + text[1] = '\0'; } - text[0] = *read++; - } - if (!assume_json) { ResponseAppend_P(PSTR("\"")); } - ResponseJsonEnd(); + if (!assume_json) { ResponseAppend_P(PSTR("\"")); } + ResponseJsonEnd(); #ifdef USE_SCRIPT - extern uint8_t tasm_cmd_activ; - // recursive call must be possible in this case - tasm_cmd_activ = 0; + extern uint8_t tasm_cmd_activ; + // recursive call must be possible in this case + tasm_cmd_activ = 0; #endif // USE_SCRIPT - MqttPublishPrefixTopicRulesProcess_P(RESULT_OR_STAT, PSTR(D_CMND_WEBQUERY)); + status = WEBCMND_VALID_RESPONSE; + } else { + status = WEBCMND_DONE; + } + } else #endif // USE_WEBSEND_RESPONSE - } status = WEBCMND_DONE; } else { status = WEBCMND_CONNECT_FAILED; @@ -3489,7 +3511,11 @@ bool JsonWebColor(const char* dataBuf) return true; } -const char kWebCmndStatus[] PROGMEM = D_JSON_DONE "|" D_JSON_WRONG_PARAMETERS "|" D_JSON_CONNECT_FAILED "|" D_JSON_HOST_NOT_FOUND "|" D_JSON_MEMORY_ERROR +/*********************************************************************************************\ + * Commands +\*********************************************************************************************/ + +const char kWebCmndStatus[] PROGMEM = D_JSON_DONE "|" D_JSON_WRONG_PARAMETERS "|" D_JSON_CONNECT_FAILED "|" D_JSON_HOST_NOT_FOUND "|" D_JSON_MEMORY_ERROR "|" #ifdef USE_WEBGETCONFIG "|" D_JSON_FILE_NOT_FOUND "|" D_JSON_OTHER_HTTP_ERROR "|" D_JSON_CONNECTION_LOST "|" D_JSON_INVALID_FILE_TYPE #endif // USE_WEBGETCONFIG @@ -3506,7 +3532,7 @@ const char kWebCommands[] PROGMEM = "|" // No prefix D_CMND_SENDMAIL "|" #endif D_CMND_WEBSERVER "|" D_CMND_WEBPASSWORD "|" D_CMND_WEBREFRESH "|" D_CMND_WEBSEND "|" D_CMND_WEBQUERY "|" - D_CMND_WEBCOLOR "|" D_CMND_WEBSENSOR "|" D_CMND_WEBBUTTON + D_CMND_WEBCOLOR "|" D_CMND_WEBSENSOR "|" D_CMND_WEBBUTTON "|" D_CMND_WEBCANVAS #ifdef USE_WEBGETCONFIG "|" D_CMND_WEBGETCONFIG #endif @@ -3527,7 +3553,7 @@ void (* const WebCommand[])(void) PROGMEM = { &CmndSendmail, #endif &CmndWebServer, &CmndWebPassword, &CmndWebRefresh, &CmndWebSend, &CmndWebQuery, - &CmndWebColor, &CmndWebSensor, &CmndWebButton + &CmndWebColor, &CmndWebSensor, &CmndWebButton, &CmndWebCanvas #ifdef USE_WEBGETCONFIG , &CmndWebGetConfig #endif @@ -3537,9 +3563,7 @@ void (* const WebCommand[])(void) PROGMEM = { #endif // FIRMWARE_MINIMAL_ONLY }; -/*********************************************************************************************\ - * Commands -\*********************************************************************************************/ +/*********************************************************************************************/ void CmndWebTime(void) { // 2017-03-07T11:08:02-07:00 @@ -3641,17 +3665,20 @@ void CmndWebSend(void) { if (XdrvMailbox.data_len > 0) { uint32_t result = WebSend(XdrvMailbox.data); - char stemp1[20]; - ResponseCmndChar(GetTextIndexed(stemp1, sizeof(stemp1), result, kWebCmndStatus)); + if (result != WEBCMND_VALID_RESPONSE) { + char stemp1[20]; + ResponseCmndChar(GetTextIndexed(stemp1, sizeof(stemp1), result, kWebCmndStatus)); + } } } -void CmndWebQuery(void) -{ +void CmndWebQuery(void) { if (XdrvMailbox.data_len > 0) { uint32_t result = WebQuery(XdrvMailbox.data); - char stemp1[20]; - ResponseCmndChar(GetTextIndexed(stemp1, sizeof(stemp1), result, kWebCmndStatus)); + if (result != WEBCMND_VALID_RESPONSE) { + char stemp1[20]; + ResponseCmndChar(GetTextIndexed(stemp1, sizeof(stemp1), result, kWebCmndStatus)); + } } } @@ -3743,6 +3770,28 @@ void CmndWebButton(void) } } +void CmndWebCanvas(void) { + /* + WebCanvas allows GUI body canvas configuration using a color, "url" or "gradient". + The provided text overrules the body CSS background property "body{background: 0 0 / cover no-repeat fixed;}" + - WebCanvas " // Set canvas to WebColor2 + - WebCanvas 0 // Set canvas to WebColor2 + - WebCanvas red // Red canvas + - WebCanvas linear-gradient(#F02 7%,#F93,#FF4,#082,#00F,#708 93%) // Gradient pride flag + - WebCanvas linear-gradient(#F02 16%,#F93 16% 33%,#FF4 33% 50%,#082 50% 67%,#00F 67% 84%,#708 84%) // Pride flag + - WebCanvas linear-gradient(90deg,#05A 33%,#FFF 33% 67%,#F43 67%) // Flag France + - WebCanvas linear-gradient(#059 33%,#FFF 33% 67%,#F43 67%) // Flag The Netherlands + - WebCanvas linear-gradient(#05B 50%,#FD0 50%) // Flag Ukraine + - WebCanvas linear-gradient(#FFF 33%,#07D 33% 67%,#F34 67%) // Flag Russia + - WebCanvas url(http://ota.tasmota.com/tasmota/images/prf.png) // Pride flag + - WebCanvas url(http://ota.tasmota.com/tasmota/images/tasmota_logo.png) // Tasmota logo + */ + if (XdrvMailbox.data_len > 0) { + SettingsUpdateText(SET_CANVAS, (SC_CLEAR == Shortcut()) ? "" : XdrvMailbox.data); + } + ResponseCmndChar(SettingsText(SET_CANVAS)); +} + #ifdef USE_CORS void CmndCors(void) { diff --git a/tasmota/tasmota_xdrv_driver/xdrv_03_esp32_energy.ino b/tasmota/tasmota_xdrv_driver/xdrv_03_esp32_energy.ino index 21d2e47e1..a4bb1c615 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_03_esp32_energy.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_03_esp32_energy.ino @@ -1379,9 +1379,6 @@ void EnergyDrvInit(void) { Energy = (tEnergy*)calloc(sizeof(tEnergy), 1); // Need calloc to reset registers to 0/false if (!Energy) { return; } - EnergySettingsLoad(0); - EnergyRtcSettingsLoad(); - Energy->value = nullptr; // Energy->voltage_common = false; // Energy->frequency_common = false; @@ -1399,9 +1396,13 @@ void EnergyDrvInit(void) { Energy->power_on = true; TasmotaGlobal.energy_driver = ENERGY_NONE; - XnrgCall(FUNC_PRE_INIT); // Find first energy driver + XnrgCall(FUNC_PRE_INIT); // Find first energy driver if (TasmotaGlobal.energy_driver) { + EnergySettingsLoad(0); + EnergyRtcSettingsLoad(); AddLog(LOG_LEVEL_INFO, PSTR("NRG: Init driver %d"), TasmotaGlobal.energy_driver); +// } else { +// free(Energy); // No energy driver found so release memory } } diff --git a/tasmota/tasmota_xdrv_driver/xdrv_07_domoticz.ino b/tasmota/tasmota_xdrv_driver/xdrv_07_domoticz.ino index 6fa70cfc4..d3e18c4d0 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_07_domoticz.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_07_domoticz.ino @@ -516,13 +516,15 @@ void CmndDomoticzUpdateTimer(void) { } void CmndDomoticzSend(void) { - // DzSend1 , - {\"idx\":,\"nvalue\":0,\"svalue\":\"\",\"Battery\":xx,\"RSSI\":yy} - // DzSend1 418,%var1%;%var2% or DzSend1 418,%var1%:%var2% - Notice colon as substitute to semi-colon - // DzSend2 , - USE_SHUTTER only - {\"idx\":,\"nvalue\":,\"svalue\":\"\",\"Battery\":xx,\"RSSI\":yy} - // DzSend3 , - {\"idx\":,\"nvalue\":,\"Battery\":xx,\"RSSI\":yy} - // DzSend4 , - {\"command\":\"switchlight\",\"idx\":,\"switchcmd\":\"\"} - // DzSend5 , - {\"command\":\"switchscene\",\"idx\":,\"switchcmd\":\"\"} - + /* + DzSend1 , - {\"idx\":,\"nvalue\":0,\"svalue\":\"\",\"Battery\":xx,\"RSSI\":yy} + rule1 on power1#state do dzsend1 9001,%value% endon + DzSend1 418,%var1%;%var2% or DzSend1 418,%var1%:%var2% - Notice colon as substitute to semi-colon + DzSend2 , - USE_SHUTTER only - {\"idx\":,\"nvalue\":,\"svalue\":\"\",\"Battery\":xx,\"RSSI\":yy} + DzSend3 , - {\"idx\":,\"nvalue\":,\"Battery\":xx,\"RSSI\":yy} + DzSend4 , - {\"command\":\"switchlight\",\"idx\":,\"switchcmd\":\"\"} + DzSend5 , - {\"command\":\"switchscene\",\"idx\":,\"switchcmd\":\"\"} + */ if ((XdrvMailbox.index > 0) && (XdrvMailbox.index <= 5)) { if (XdrvMailbox.data_len > 0) { if (strchr(XdrvMailbox.data, ',') != nullptr) { // Process parameter entry diff --git a/tasmota/tasmota_xdrv_driver/xdrv_10_scripter.ino b/tasmota/tasmota_xdrv_driver/xdrv_10_scripter.ino index bc99a3921..f18ba4bc7 100755 --- a/tasmota/tasmota_xdrv_driver/xdrv_10_scripter.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_10_scripter.ino @@ -552,6 +552,11 @@ struct SCRIPT_MEM { ScriptOneWire ow; #endif +#ifdef USE_SCRIPT_TCP_SERVER + WiFiServer *tcp_server; + WiFiClient tcp_client; +#endif + } glob_script_mem; @@ -612,7 +617,7 @@ int32_t opt_fext(File *fp, char *ts_from, char *ts_to, uint32_t flg); int32_t extract_from_file(File *fp, char *ts_from, char *ts_to, int8_t coffs, TS_FLOAT **a_ptr, uint16_t *a_len, uint8_t numa, int16_t accum); #endif char *eval_sub(char *lp, TS_FLOAT *fvar, char *rstr); -uint32_t script_ow(uint8_t sel, uint32_t val); +int32_t script_ow(uint8_t sel, uint32_t val); int32_t script_logfile_write(char *path, char *payload, uint32_t size); void script_sort_array(TS_FLOAT *array, uint16_t size); @@ -1190,6 +1195,8 @@ char *script; free(imemptr); if (strings_op) free(strings_op); } + + glob_script_mem.script_lastmillis = millis(); return err; } @@ -5798,6 +5805,184 @@ extern char *SML_GetSVal(uint32_t index); fvar = wav2mp3(path); goto nfuncexit; } +#endif +#ifdef USE_SCRIPT_TCP_SERVER + if (!strncmp_XP(lp, XPSTR("wso("), 4)) { + TS_FLOAT port; + lp = GetNumericArgument(lp + 4, OPER_EQU, &port, gv); + glob_script_mem.tcp_server = new WiFiServer(port); + fvar = 0; + if (!glob_script_mem.tcp_server) { + fvar = -1; + } else { + AddLog(LOG_LEVEL_INFO, PSTR("tcp server started")); + } + glob_script_mem.tcp_server->begin(); + glob_script_mem.tcp_server->setNoDelay(true); + + goto nfuncexit; + } + if (!strncmp_XP(lp, XPSTR("wsc("), 4)) { + if (glob_script_mem.tcp_server) { + glob_script_mem.tcp_client.stop(); + glob_script_mem.tcp_server->stop(); + delete glob_script_mem.tcp_server; + glob_script_mem.tcp_server = 0; + } + fvar = 0; + goto nfuncexit; + } + if (!strncmp_XP(lp, XPSTR("wsa("), 4)) { + fvar = 0; + if (glob_script_mem.tcp_server) { + if (glob_script_mem.tcp_server->hasClient()) { + glob_script_mem.tcp_client = glob_script_mem.tcp_server->available(); + AddLog(LOG_LEVEL_DEBUG, PSTR("tcp client connected")); + } + if (glob_script_mem.tcp_client && glob_script_mem.tcp_client.connected()) { + fvar = glob_script_mem.tcp_client.available(); + } else { + AddLog(LOG_LEVEL_DEBUG, PSTR("tcp client not connected")); + } + } else { + AddLog(LOG_LEVEL_DEBUG, PSTR("tcp server not active")); + } + goto nfuncexit; + } + if (!strncmp_XP(lp, XPSTR("wsrs("), 5)) { + fvar = 0; + char buff[SCRIPT_MAXSSIZE]; + if (glob_script_mem.tcp_server) { + if (glob_script_mem.tcp_client.connected()) { + uint16_t slen = glob_script_mem.tcp_client.available(); + if (slen > sizeof(buff)) { + slen = sizeof(buff); + } + for (uint16_t cnt = 0; cnt < slen; cnt++) { + buff[cnt] = glob_script_mem.tcp_client.read(); + } + buff[slen] = 0; + if (sp) strlcpy(sp, buff, glob_script_mem.max_ssize); + } + } + goto strexit; + } + if (!strncmp_XP(lp, XPSTR("wsws("), 5)) { + fvar = 0; + char buff[SCRIPT_MAXSSIZE]; + lp = GetStringArgument(lp + 5, OPER_EQU, buff, 0); + if (glob_script_mem.tcp_server) { + if (glob_script_mem.tcp_client.connected()) { + glob_script_mem.tcp_client.write(buff, strlen(buff)); + } + } + goto nfuncexit; + } + if (!strncmp_XP(lp, XPSTR("wsra("), 5)) { + TS_FLOAT *fpd = 0; + uint16_t alend; + uint16_t ipos; + lp = get_array_by_name(lp + 5, &fpd, &alend, &ipos); + SCRIPT_SKIP_SPACES + if (glob_script_mem.tcp_server) { + if (glob_script_mem.tcp_client.connected()) { + uint16_t slen = glob_script_mem.tcp_client.available(); + if (slen > alend) { + slen = alend; + } + for (uint16_t cnt = 0; cnt < slen; cnt++) { + *fpd++ = glob_script_mem.tcp_client.read(); + } + fvar = slen; + } + } + goto nfuncexit; + } + if (!strncmp_XP(lp, XPSTR("wswa("), 5)) { + TS_FLOAT *fpd = 0; + uint16_t alend; + uint16_t ipos; + lp = get_array_by_name(lp + 5, &fpd, &alend, &ipos); + SCRIPT_SKIP_SPACES + lp = GetNumericArgument(lp, OPER_EQU, &fvar, gv); + uint16_t al = fvar; + if (al > alend) { + al = alend; + } + SCRIPT_SKIP_SPACES + + uint16_t opts = 0; + if (*lp != ')') { + lp = GetNumericArgument(lp, OPER_EQU, &fvar, gv); + opts = fvar; + } + if (glob_script_mem.tcp_server) { + if (glob_script_mem.tcp_client.connected()) { + uint8_t *abf = (uint8_t*)malloc(al * 4); + uint8_t *oabf = abf; + uint16_t dlen = 0; + if (abf) { + for (uint16_t cnt = 0; cnt < al; cnt++) { + switch (opts) { + case 0: + //glob_script_mem.tcp_client.write((uint8_t)*fpd++); + *abf++ = (uint8_t)*fpd++; + dlen++; + break; + case 1: + { + uint16_t wval = *fpd++; + //glob_script_mem.tcp_client.write(wval >> 8); + //glob_script_mem.tcp_client.write(wval); + *abf++ = (wval >> 8); + *abf++ = wval; + dlen += 2; + } + break; + case 2: + { + int16_t swval = *fpd++; + //glob_script_mem.tcp_client.write(swval >> 8); + //glob_script_mem.tcp_client.write(swval); + *abf++ = (swval >> 8); + *abf++ = swval; + dlen += 2; + } + break; + case 3: + { + uint32_t lval = *(uint32_t*)fpd; + fpd++; + //glob_script_mem.tcp_client.write(lval >> 24); + //glob_script_mem.tcp_client.write(lval >> 16); + //glob_script_mem.tcp_client.write(lval >> 8); + //glob_script_mem.tcp_client.write(lval); + *abf++ = (lval >> 24); + *abf++ = (lval >> 16); + *abf++ = (lval >> 8); + *abf++ = lval; + dlen += 4; + } + break; + } + } + glob_script_mem.tcp_client.write(oabf, dlen); + free(oabf); + } + } + } + goto nfuncexit; + } + if (!strncmp_XP(lp, XPSTR("wsf("), 4)) { + fvar = -1; + if (glob_script_mem.tcp_server) { + if (glob_script_mem.tcp_client.connected()) { + glob_script_mem.tcp_client.flush(); + fvar = 0; + } + } + goto nfuncexit; + } #endif break; case 'y': @@ -7754,7 +7939,7 @@ bool script_OneWireCrc8(uint8_t *addr) { return (crc == *addr); // addr 8 } -uint32_t script_ow(uint8_t sel, uint32_t val) { +int32_t script_ow(uint8_t sel, uint32_t val) { uint32_t res = 0; uint8_t bits; bool invert = false; diff --git a/tasmota/tasmota_xdrv_driver/xdrv_16_tuyamcu_v1.ino b/tasmota/tasmota_xdrv_driver/xdrv_16_tuyamcu_v1.ino index a542e627c..5ea82165d 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_16_tuyamcu_v1.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_16_tuyamcu_v1.ino @@ -63,6 +63,8 @@ TasmotaSerial *TuyaSerial = nullptr; +void TuyaSendCmd(uint8_t cmd, uint8_t payload[], uint16_t payload_len); + struct TUYA { uint16_t Levels[5] = {0,0,0,0,0}; // Array to store the values of TuyaMCU channels uint16_t Snapshot[5] = {0,0,0,0,0}; // Array to store a snapshot of Tasmota actual channel values @@ -76,7 +78,6 @@ struct TUYA { bool SuspendTopic = false; // Used to reduce the load at init time or when polling the configuraton on demand uint32_t ignore_topic_timeout = 0; // Suppress the /STAT topic (if enabled) to avoid data overflow until the configuration is over bool ignore_dim = false; // Flag to skip serial send to prevent looping when processing inbound states from the faceplate interaction - uint8_t cmd_status = 0; // Current status of serial-read uint8_t cmd_checksum = 0; // Checksum of tuya command uint8_t data_len = 0; // Data lenght of command uint8_t wifi_state = -2; // Keep MCU wifi-status in sync with WifiState() @@ -170,9 +171,6 @@ TuyaSend6 11,ABCD -> Sends raw (Type 0) data to dpId */ void CmndTuyaSend(void) { - if (XdrvMailbox.index > 6 && XdrvMailbox.index < 8) { - return; - } if (XdrvMailbox.index == 0) { TuyaRequestState(0); ResponseCmndDone(); @@ -211,6 +209,18 @@ void CmndTuyaSend(void) { TuyaSendEnum(dpId, strtoul(data, nullptr, 0)); } else if (6 == XdrvMailbox.index) { TuyaSendRaw(dpId, data); + } else if (7 == XdrvMailbox.index) { + uint8_t cmd = dpId; + // send ANY cmd with payload from hex string + // calculates length and checksum for you. + // like "0," to send a heartbeat, "3,4" to set wifi led mode, + // "0x1c,0110041305060702" - set local time + // sends immediately.... + uint16_t strSize = strlen(data); + uint16_t len = strSize/2; + uint8_t value[len]; + convertHexStringtoBytes(value, data, len); + TuyaSendCmd(cmd, value, len); } ResponseCmndDone(); } @@ -1251,150 +1261,164 @@ void TuyaInit(void) { Tuya.active = false; } +void TuyaProcessMessage(void) { + char hex_char[(Tuya.byte_counter * 2) + 2]; + uint16_t len = Tuya.buffer[4] << 8 | Tuya.buffer[5]; + + Response_P(PSTR("{\"" D_JSON_TUYA_MCU_RECEIVED "\":{\"Data\":\"%s\",\"Cmnd\":%d"), ToHex_P((unsigned char*)Tuya.buffer, Tuya.byte_counter, hex_char, sizeof(hex_char)), Tuya.buffer[3]); + + uint16_t DataVal = 0; + uint8_t dpId = 0; + uint8_t dpDataType = 0; + char DataStr[15]; + bool isCmdToSuppress = false; + Tuya.time_last_cmd = 0; + + if (len > 0) { + ResponseAppend_P(PSTR(",\"CmndData\":\"%s\""), ToHex_P((unsigned char*)&Tuya.buffer[6], len, hex_char, sizeof(hex_char))); + if (TUYA_CMD_STATE == Tuya.buffer[3]) { + //55 AA 03 07 00 0D 01 04 00 01 02 02 02 00 04 00 00 00 1A 40 + // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 + uint8_t dpidStart = 6; + while (dpidStart + 4 < Tuya.byte_counter) { + dpId = Tuya.buffer[dpidStart]; + dpDataType = Tuya.buffer[dpidStart + 1]; + uint16_t dpDataLen = Tuya.buffer[dpidStart + 2] << 8 | Tuya.buffer[dpidStart + 3]; + const unsigned char *dpData = (unsigned char*)&Tuya.buffer[dpidStart + 4]; + const char *dpHexData = ToHex_P(dpData, dpDataLen, hex_char, sizeof(hex_char)); + + if (TUYA_CMD_STATE == Tuya.buffer[3]) { + ResponseAppend_P(PSTR(",\"DpType%uId%u\":"), dpDataType, dpId); + if (TUYA_TYPE_BOOL == dpDataType && dpDataLen == 1) { + ResponseAppend_P(PSTR("%u"), dpData[0]); + DataVal = dpData[0]; + } else if (TUYA_TYPE_VALUE == dpDataType && dpDataLen == 4) { + uint32_t dpValue = (uint32_t)dpData[0] << 24 | (uint32_t)dpData[1] << 16 | (uint32_t)dpData[2] << 8 | (uint32_t)dpData[3] << 0; + ResponseAppend_P(PSTR("%u"), dpValue); + DataVal = dpValue; + } else if (TUYA_TYPE_STRING == dpDataType) { + ResponseAppend_P(PSTR("\"%.*s\""), dpDataLen, dpData); + snprintf_P(DataStr, sizeof(DataStr), PSTR("%.*s"), dpDataLen, dpData); + } else if (TUYA_TYPE_ENUM == dpDataType && dpDataLen == 1) { + ResponseAppend_P(PSTR("%u"), dpData[0]); + DataVal = dpData[0]; + } else { + ResponseAppend_P(PSTR("\"0x%s\""), dpHexData); + snprintf_P(DataStr, sizeof(DataStr), PSTR("%s"), dpHexData); + } + } + + ResponseAppend_P(PSTR(",\"%d\":{\"DpId\":%d,\"DpIdType\":%d,\"DpIdData\":\"%s\""), dpId, dpId, dpDataType, dpHexData); + if (TUYA_TYPE_STRING == dpDataType) { + ResponseAppend_P(PSTR(",\"Type3Data\":\"%.*s\""), dpDataLen, dpData); + } + ResponseAppend_P(PSTR("}")); + dpidStart += dpDataLen + 4; + } + } + } + ResponseAppend_P(PSTR("}}")); + + if (Settings->flag3.tuya_serial_mqtt_publish) { // SetOption66 - Enable TuyaMcuReceived messages over Mqtt + for (uint8_t cmdsID = 0; cmdsID < sizeof(TuyaExcludeCMDsFromMQTT); cmdsID++) { + if (pgm_read_byte(TuyaExcludeCMDsFromMQTT +cmdsID) == Tuya.buffer[3]) { + isCmdToSuppress = true; + break; + } + } + + if (!(isCmdToSuppress && Settings->flag5.tuya_exclude_from_mqtt)) { // SetOption137 - (Tuya) When Set, avoid the (MQTT-) publish of defined Tuya CMDs (see TuyaExcludeCMDsFromMQTT) if SetOption66 is active + MqttPublishPrefixTopic_P(RESULT_OR_TELE, PSTR(D_JSON_TUYA_MCU_RECEIVED)); + } else { + AddLog(LOG_LEVEL_DEBUG, ResponseData()); + } + } else { + AddLog(LOG_LEVEL_DEBUG, ResponseData()); + } + XdrvRulesProcess(0); + + if (dpId != 0 && Settings->tuyamcu_topic) { // Publish a /STAT Topic ready to use for any home automation system + if (!Tuya.SuspendTopic) { + char scommand[13]; + snprintf_P(scommand, sizeof(scommand), PSTR("DpType%uId%u"), dpDataType, dpId); + if (dpDataType != 3 && dpDataType != 5) { Response_P(PSTR("%u"), DataVal); } + else { Response_P(PSTR("%s"), DataStr); } + MqttPublishPrefixTopic_P(STAT, scommand); + } + } + + if (!Tuya.low_power_mode) { + TuyaNormalPowerModePacketProcess(); + } else { + TuyaLowPowerModePacketProcess(); + } +} + void TuyaSerialInput(void) { + /* /-------------------------------- header 55 + * | /----------------------------- header AA + * | | /-------------------------- version, always 00 + * | | | /----------------------- command byte + * | | | | /--+----------------- data length in bytes, big endian (high then low) + * | | | | | | /-+-+-+-+------ data bytes + * | | | | | | | | | | | /--- checksum (sum of all bytes except checksum) + * 55 AA 00 cc lh ll dd .... dd xx + * 0 1 2 3 4 5 6 .... index in Tuya buffer + * 0 1 2 2 2 2 3 3 3 3 3 Tuya.cmd_status + */ + + static unsigned long time_last_byte_received = 0; + while (TuyaSerial->available()) { yield(); uint8_t serial_in_byte = TuyaSerial->read(); - - if (serial_in_byte == 0x55) { // Start TUYA Packet - Tuya.cmd_status = 1; + time_last_byte_received = millis(); + if (Tuya.byte_counter == 0) { + if (serial_in_byte == 0x55) { // Start TUYA Packet + Tuya.buffer[Tuya.byte_counter++] = 0x55; + } + } + else if (Tuya.byte_counter == 1) { + if (serial_in_byte == 0xAA) { // Only packets with header 0x55AA are valid + Tuya.buffer[Tuya.byte_counter++] = 0xAA; + Tuya.cmd_checksum = 0xFF; + } else { + Tuya.byte_counter = 0; // if not received 0xAA right after the 0x55, reset the state machine + AddLog(LOG_LEVEL_DEBUG_MORE,PSTR("TYA: 0x55 without 0xAA - resync")); + } + } + else if (Tuya.byte_counter < 6) { Tuya.buffer[Tuya.byte_counter++] = serial_in_byte; Tuya.cmd_checksum += serial_in_byte; - } - else if (Tuya.cmd_status == 1 && serial_in_byte == 0xAA) { // Only packtes with header 0x55AA are valid - Tuya.cmd_status = 2; - - Tuya.byte_counter = 0; - Tuya.buffer[Tuya.byte_counter++] = 0x55; - Tuya.buffer[Tuya.byte_counter++] = 0xAA; - Tuya.cmd_checksum = 0xFF; - } - else if (Tuya.cmd_status == 2) { - if (Tuya.byte_counter == 5) { // Get length of data - Tuya.cmd_status = 3; - Tuya.data_len = serial_in_byte; + if (Tuya.byte_counter == 6) { + // Get length of data, max buffer is 256 bytes, so only taking into account lowest byte of length + Tuya.data_len = serial_in_byte + 6; } - Tuya.cmd_checksum += serial_in_byte; + } + else if (Tuya.byte_counter == Tuya.data_len) { Tuya.buffer[Tuya.byte_counter++] = serial_in_byte; - } - else if ((Tuya.cmd_status == 3) && (Tuya.byte_counter == (6 + Tuya.data_len)) && (Tuya.cmd_checksum == serial_in_byte)) { // Compare checksum and process packet - Tuya.buffer[Tuya.byte_counter++] = serial_in_byte; - - char hex_char[(Tuya.byte_counter * 2) + 2]; - uint16_t len = Tuya.buffer[4] << 8 | Tuya.buffer[5]; - - Response_P(PSTR("{\"" D_JSON_TUYA_MCU_RECEIVED "\":{\"Data\":\"%s\",\"Cmnd\":%d"), ToHex_P((unsigned char*)Tuya.buffer, Tuya.byte_counter, hex_char, sizeof(hex_char)), Tuya.buffer[3]); - - uint16_t DataVal = 0; - uint8_t dpId = 0; - uint8_t dpDataType = 0; - char DataStr[15]; - bool isCmdToSuppress = false; - Tuya.time_last_cmd = 0; - - if (len > 0) { - ResponseAppend_P(PSTR(",\"CmndData\":\"%s\""), ToHex_P((unsigned char*)&Tuya.buffer[6], len, hex_char, sizeof(hex_char))); - if (TUYA_CMD_STATE == Tuya.buffer[3]) { - //55 AA 03 07 00 0D 01 04 00 01 02 02 02 00 04 00 00 00 1A 40 - // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 - uint8_t dpidStart = 6; - while (dpidStart + 4 < Tuya.byte_counter) { - dpId = Tuya.buffer[dpidStart]; - dpDataType = Tuya.buffer[dpidStart + 1]; - uint16_t dpDataLen = Tuya.buffer[dpidStart + 2] << 8 | Tuya.buffer[dpidStart + 3]; - const unsigned char *dpData = (unsigned char*)&Tuya.buffer[dpidStart + 4]; - const char *dpHexData = ToHex_P(dpData, dpDataLen, hex_char, sizeof(hex_char)); - - if (TUYA_CMD_STATE == Tuya.buffer[3]) { - ResponseAppend_P(PSTR(",\"DpType%uId%u\":"), dpDataType, dpId); - if (TUYA_TYPE_BOOL == dpDataType && dpDataLen == 1) { - ResponseAppend_P(PSTR("%u"), dpData[0]); - DataVal = dpData[0]; - } else if (TUYA_TYPE_VALUE == dpDataType && dpDataLen == 4) { - uint32_t dpValue = (uint32_t)dpData[0] << 24 | (uint32_t)dpData[1] << 16 | (uint32_t)dpData[2] << 8 | (uint32_t)dpData[3] << 0; - ResponseAppend_P(PSTR("%u"), dpValue); - DataVal = dpValue; - } else if (TUYA_TYPE_STRING == dpDataType) { - ResponseAppend_P(PSTR("\"%.*s\""), dpDataLen, dpData); - snprintf_P(DataStr, sizeof(DataStr), PSTR("%.*s"), dpDataLen, dpData); - } else if (TUYA_TYPE_ENUM == dpDataType && dpDataLen == 1) { - ResponseAppend_P(PSTR("%u"), dpData[0]); - DataVal = dpData[0]; - } else { - ResponseAppend_P(PSTR("\"0x%s\""), dpHexData); - snprintf_P(DataStr, sizeof(DataStr), PSTR("%s"), dpHexData); - } - } - - ResponseAppend_P(PSTR(",\"%d\":{\"DpId\":%d,\"DpIdType\":%d,\"DpIdData\":\"%s\""), dpId, dpId, dpDataType, dpHexData); - if (TUYA_TYPE_STRING == dpDataType) { - ResponseAppend_P(PSTR(",\"Type3Data\":\"%.*s\""), dpDataLen, dpData); - } - ResponseAppend_P(PSTR("}")); - dpidStart += dpDataLen + 4; - } - } - } - ResponseAppend_P(PSTR("}}")); - - if (Settings->flag3.tuya_serial_mqtt_publish) { // SetOption66 - Enable TuyaMcuReceived messages over Mqtt -/* - for (uint8_t cmdsID = 0; sizeof(TuyaExcludeCMDsFromMQTT) > cmdsID; cmdsID++){ - if (TuyaExcludeCMDsFromMQTT[cmdsID] == Tuya.buffer[3]) { - isCmdToSuppress = true; - break; - } - } -*/ - for (uint8_t cmdsID = 0; cmdsID < sizeof(TuyaExcludeCMDsFromMQTT); cmdsID++) { - if (pgm_read_byte(TuyaExcludeCMDsFromMQTT +cmdsID) == Tuya.buffer[3]) { - isCmdToSuppress = true; - break; - } - } - - if (!(isCmdToSuppress && Settings->flag5.tuya_exclude_from_mqtt)) { // SetOption137 - (Tuya) When Set, avoid the (MQTT-) publish of defined Tuya CMDs (see TuyaExcludeCMDsFromMQTT) if SetOption66 is active - MqttPublishPrefixTopic_P(RESULT_OR_TELE, PSTR(D_JSON_TUYA_MCU_RECEIVED)); - } else { - AddLog(LOG_LEVEL_DEBUG, ResponseData()); - } + if (Tuya.cmd_checksum == serial_in_byte) { // Compare checksum and process packet + AddLogBuffer(LOG_LEVEL_DEBUG_MORE,(uint8_t*)Tuya.buffer,Tuya.byte_counter); + TuyaProcessMessage(); } else { - AddLog(LOG_LEVEL_DEBUG, ResponseData()); + AddLog(LOG_LEVEL_DEBUG_MORE,PSTR("TYA: checksum error: 0x%02X instead of 0x%02X"), serial_in_byte, Tuya.cmd_checksum); } - XdrvRulesProcess(0); - - if (dpId != 0 && Settings->tuyamcu_topic) { // Publish a /STAT Topic ready to use for any home automation system - if (!Tuya.SuspendTopic) { - char scommand[13]; - snprintf_P(scommand, sizeof(scommand), PSTR("DpType%uId%u"), dpDataType, dpId); - if (dpDataType != 3 && dpDataType != 5) { Response_P(PSTR("%u"), DataVal); } - else { Response_P(PSTR("%s"), DataStr); } - MqttPublishPrefixTopic_P(STAT, scommand); - } - } - - if (!Tuya.low_power_mode) { - TuyaNormalPowerModePacketProcess(); - } else { - TuyaLowPowerModePacketProcess(); - } - Tuya.byte_counter = 0; - Tuya.cmd_status = 0; - Tuya.cmd_checksum = 0; - Tuya.data_len = 0; - } // read additional packets from TUYA + } else if (Tuya.byte_counter < TUYA_BUFFER_SIZE -1) { // add char to string if it still fits Tuya.buffer[Tuya.byte_counter++] = serial_in_byte; Tuya.cmd_checksum += serial_in_byte; - } else { + } + else { // buffer overflow, reset the state machine Tuya.byte_counter = 0; - Tuya.cmd_status = 0; - Tuya.cmd_checksum = 0; - Tuya.data_len = 0; } } + // reset the state machine if no bytes received since a long time + if (Tuya.byte_counter > 0 && (millis() - time_last_byte_received) > TUYA_CMD_TIMEOUT) { + Tuya.byte_counter = 0; + AddLog(LOG_LEVEL_DEBUG_MORE,PSTR("TYA: serial receive timeout")); + } } bool TuyaButtonPressed(void) { @@ -1640,6 +1664,7 @@ bool Xdrv16(uint32_t function) { if (FUNC_MODULE_INIT == function) { result = TuyaModuleSelected(); Tuya.active = result; + AddLog(LOG_LEVEL_DEBUG,PSTR("TYA: Active=%d"),Tuya.active); } else if (Tuya.active) { switch (function) { diff --git a/tasmota/tasmota_xdrv_driver/xdrv_23_zigbee_7_6_flash_fs.ino b/tasmota/tasmota_xdrv_driver/xdrv_23_zigbee_7_6_flash_fs.ino index 0554c8de4..e555f7d5e 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_23_zigbee_7_6_flash_fs.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_23_zigbee_7_6_flash_fs.ino @@ -17,7 +17,7 @@ along with this program. If not, see . */ -#ifdef USE_ZIGBEE +#if defined(USE_ZIGBEE) || defined(USE_BERRY) #ifdef ESP32 #include @@ -43,6 +43,12 @@ public: _seek = 0; } + FlashFileImpl(const void* buf, size_t len) { + _buf = (const char*)buf; + _len = len; + _seek = 0; + } + virtual ~FlashFileImpl() {} size_t write(const uint8_t *buf, size_t size) { diff --git a/tasmota/tasmota_xdrv_driver/xdrv_27_esp32_shutter.ino b/tasmota/tasmota_xdrv_driver/xdrv_27_esp32_shutter.ino index 3e32ef566..e42402bc2 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_27_esp32_shutter.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_27_esp32_shutter.ino @@ -559,7 +559,6 @@ void ShutterInit(void) //Initialize to get relay that changed ShutterGlobal.RelayOldMask = TasmotaGlobal.power; - ShutterGlobal.open_velocity_max = ShutterSettings.open_velocity_max; for (uint32_t i = 0; i < MAX_SHUTTERS_ESP32; i++) { // set startrelay to 1 on first init, but only to shutter 1. 90% usecase if (ShutterSettings.shutter_startrelay[i] && (ShutterSettings.shutter_startrelay[i] <= 32 )) { @@ -645,20 +644,19 @@ void ShutterInit(void) if (Shutter[i].tilt_config[2] == 0) { Shutter[i].tilt_config[3] = Shutter[i].tilt_config[4] = 0; } - Shutter[i].tilt_target_pos = Shutter[i].tilt_real_pos = ShutterSettings.shutter_tilt_pos[i]; - Shutter[i].tilt_velocity = Shutter[i].tilt_config[2] > 0 ? ((Shutter[i].tilt_config[1] - Shutter[i].tilt_config[0]) / Shutter[i].tilt_config[2]) + 1 : 1; - Shutter[i].close_velocity_max = ShutterGlobal.open_velocity_max*Shutter[i].open_time / Shutter[i].close_time; - Shutter[i].min_realPositionChange = 2 * tmax(ShutterGlobal.open_velocity_max, Shutter[i].close_velocity_max); - Shutter[i].min_TiltChange = 2 * Shutter[i].tilt_velocity; - switch (ShutterGlobal.position_mode) { case SHT_PWM_VALUE: - ShutterGlobal.open_velocity_max = RESOLUTION; // Initiate pwm range with defaults if not already set. ShutterSettings.shutter_pwmrange[0][i] = ShutterSettings.shutter_pwmrange[0][i] > 0 ? ShutterSettings.shutter_pwmrange[0][i] : pwm_servo_min; ShutterSettings.shutter_pwmrange[1][i] = ShutterSettings.shutter_pwmrange[1][i] > 0 ? ShutterSettings.shutter_pwmrange[1][i] : pwm_servo_max; Shutter[i].min_realPositionChange = 0; Shutter[i].min_TiltChange = 0; + + // set pwm to actual position. This may cause fast movements if not in sync + Shutter[i].pwm_value = SHT_DIV_ROUND((ShutterSettings.shutter_pwmrange[1][i] - ShutterSettings.shutter_pwmrange[0][i]) * Shutter[i].target_position , Shutter[i].open_max)+ShutterSettings.shutter_pwmrange[0][i]; + TasmotaGlobal.pwm_value[i] = Shutter[i].pwm_value; + AddLog(LOG_LEVEL_DEBUG, PSTR("SHT: Shtr%d pwmset: %d -> %d"), i+1, TasmotaGlobal.pwm_cur_value[i], TasmotaGlobal.pwm_value[i]); + PwmApplyGPIO(false); break; case SHT_TIME: // Test is the relays are in interlock mode. Disable shuttermode if error @@ -668,13 +666,34 @@ void ShutterInit(void) return; } break; + case SHT_COUNTER: + ShutterGlobal.open_velocity_max = ShutterSettings.open_velocity_max; + // Limit the numbers of shutter to 4 because only 4 counters can be defined + TasmotaGlobal.shutters_present = tmin(TasmotaGlobal.shutters_present, 4); + break; } + + Shutter[i].tilt_target_pos = Shutter[i].tilt_real_pos = ShutterSettings.shutter_tilt_pos[i]; + Shutter[i].tilt_velocity = Shutter[i].tilt_config[2] > 0 ? ((Shutter[i].tilt_config[1] - Shutter[i].tilt_config[0]) / Shutter[i].tilt_config[2]) + 1 : 1; + Shutter[i].close_velocity_max = ShutterGlobal.open_velocity_max*Shutter[i].open_time / Shutter[i].close_time; + Shutter[i].min_TiltChange = 2 * Shutter[i].tilt_velocity; + + //servo can make any movement without time restriction + Shutter[i].min_realPositionChange = 2 * tmax(ShutterGlobal.open_velocity_max, Shutter[i].close_velocity_max); + switch (ShutterGlobal.position_mode) { + case SHT_PWM_VALUE: + Shutter[i].min_realPositionChange = 0; + break; + case SHT_COUNTER: + Shutter[i].min_realPositionChange = SHT_DIV_ROUND(Shutter[i].min_realPositionChange, Shutter[i].motordelay); + break; + } + AddLog(LOG_LEVEL_DEBUG, PSTR("SHT: Shtr%d min realpos_chg: %d, min tilt_chg %d"), i+1, Shutter[i].min_realPositionChange, Shutter[i].min_TiltChange); - AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Shtr%d Openvel %d, Closevel: %d"), i+1, ShutterGlobal.open_velocity_max, Shutter[i].close_velocity_max); + AddLog(LOG_LEVEL_DEBUG, PSTR("SHT: Shtr%d Openvel %d, Closevel: %d"), i+1, ShutterGlobal.open_velocity_max, Shutter[i].close_velocity_max); AddLog(LOG_LEVEL_DEBUG, PSTR("SHT: Shtr%d Init. Pos %d, Inv %d, Locked %d, Endstop enab %d, webButt inv %d, Motordel: %d"), i+1, Shutter[i].real_position, (ShutterSettings.shutter_options[i] & 1) ? 1 : 0, (ShutterSettings.shutter_options[i] & 2) ? 1 : 0, (ShutterSettings.shutter_options[i] & 4) ? 1 : 0, (ShutterSettings.shutter_options[i] & 8) ? 1 : 0, Shutter[i].motordelay); - } else { // terminate loop at first INVALID Shutter[i]. break; @@ -757,6 +776,7 @@ int32_t ShutterPercentToRealPosition(int16_t percent, uint32_t index) void ShutterPowerOff(uint8_t i) { + bool pwm_apply = false; AddLog(LOG_LEVEL_DEBUG, PSTR("SHT: Stop %d Mode %d time %d, last source %d"), i+1,Shutter[i].switch_mode, Shutter[i].time, TasmotaGlobal.last_source); // fix log to indicate correct shutter number ShutterDecellerateForStop(i); uint8_t cur_relay = ShutterSettings.shutter_startrelay[i] + (Shutter[i].direction == 1 ? 0 : (uint8_t)(ShutterGlobal.position_mode == SHT_TIME)) ; @@ -796,17 +816,16 @@ void ShutterPowerOff(uint8_t i) // Store current PWM value to ensure proper position after reboot. switch (ShutterGlobal.position_mode) { case SHT_PWM_VALUE: - Shutter[i].pwm_value = SHT_DIV_ROUND((ShutterSettings.shutter_pwmrange[1][i]-ShutterSettings.shutter_pwmrange[0][i]) * Shutter[i].target_position , Shutter[i].open_max)+ShutterSettings.shutter_pwmrange[0][i]; - analogWrite(Pin(GPIO_PWM1, i), Shutter[i].pwm_value); - AddLog(LOG_LEVEL_DEBUG, PSTR("SHT: PWM final %d"),Shutter[i].pwm_value); + TasmotaGlobal.pwm_value[i] = Shutter[i].pwm_value; + pwm_apply = true; char scmnd[20]; #ifdef SHUTTER_CLEAR_PWM_ONSTOP // free the PWM servo lock on stop. - analogWrite(Pin(GPIO_PWM1, i), 0); + TasmotaGlobal.pwm_value[i] = 0; #endif break; } - + if (pwm_apply) { PwmApplyGPIO(false); } // restore save_data behavior if all shutters are in stopped state bool shutter_all_stopped = true; for (uint8_t j = 0 ; j < TasmotaGlobal.shutters_present ; j++) { @@ -962,7 +981,7 @@ void ShutterReportPosition(bool always, uint32_t index) void ShutterRtc50mS(void) { - bool pwm_apply = false; // ESP32 only, do we need to apply PWM changes + bool pwm_apply = false; // No Logging allowed. RTC Timer for (uint8_t i = 0; i < TasmotaGlobal.shutters_present; i++) { if (Shutter[i].direction) { @@ -974,8 +993,9 @@ void ShutterRtc50mS(void) case SHT_PWM_VALUE: ShutterUpdateVelocity(i); Shutter[i].real_position += Shutter[i].direction > 0 ? Shutter[i].pwm_velocity : (Shutter[i].direction < 0 ? -Shutter[i].pwm_velocity : 0); - Shutter[i].pwm_value = SHT_DIV_ROUND((ShutterSettings.shutter_pwmrange[1][i]-ShutterSettings.shutter_pwmrange[0][i]) * Shutter[i].real_position , Shutter[i].open_max)+ShutterSettings.shutter_pwmrange[0][i]; - analogWrite(Pin(GPIO_PWM1, i), Shutter[i].pwm_value); + Shutter[i].pwm_value = SHT_DIV_ROUND((ShutterSettings.shutter_pwmrange[1][i] - ShutterSettings.shutter_pwmrange[0][i]) * Shutter[i].real_position , Shutter[i].open_max) + ShutterSettings.shutter_pwmrange[0][i]; + TasmotaGlobal.pwm_value[i] = Shutter[i].pwm_value; + pwm_apply = true; break; case SHT_COUNTER: @@ -1158,7 +1178,7 @@ void ShutterStartInit(uint32_t i, int32_t direction, int32_t target_pos) switch (ShutterGlobal.position_mode) { #ifdef SHUTTER_STEPPER case SHT_COUNTER: - analogWriteFreq(PWM_MIN,Pin(GPIO_PWM1, i)); + //analogWriteFreq(PWM_MIN,Pin(GPIO_PWM1, i)); TasmotaGlobal.pwm_value[i] = 0; PwmApplyGPIO(false); RtcSettings.pulse_counter[i] = 0; @@ -1264,10 +1284,10 @@ void ShutterUpdatePosition(void) // Update time information int32_t deltatime = Shutter[i].time - Shutter[i].last_reported_time; Shutter[i].last_reported_time = Shutter[i].time + 1; - AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Shtr%d Time %d(%d), cStop %d, cVelo %d, mVelo %d, aVelo %d, mRun %d, aPos %d, aPos2 %d, nStop %d, Trgt %d, mVelo %d, Dir %d, Tilt %d, TrgtTilt: %d, Tiltmove: %d"), + AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Shtr%d Time %d(%d), cStop %d, cVelo %d, mVelo %d, aVelo %d, mRun %d, aPos %d, aPos2 %d, nStop %d, Trgt %d, mVelo %d, Dir %d, Tilt %d, TrgtTilt: %d, Tiltmove: %d, PWM: %d"), i+1, Shutter[i].time, deltatime, current_stop_way, current_pwm_velocity, velocity_max, Shutter[i].accelerator, min_runtime_ms, current_real_position,Shutter[i].real_position, next_possible_stop_position, Shutter[i].target_position, velocity_change_per_step_max, Shutter[i].direction,Shutter[i].tilt_real_pos, Shutter[i].tilt_target_pos, - Shutter[i].tiltmoving); + Shutter[i].tiltmoving, Shutter[i].pwm_value); // Check calibration mode and energy information // only execute every second step to remove some stress from the current sensor. @@ -1401,7 +1421,7 @@ void CmndShutterButton(void) char data_copy[strlen(XdrvMailbox.data) +1]; strncpy(data_copy, XdrvMailbox.data, sizeof(data_copy)); // Duplicate data as strtok_r will modify it. // Loop through the data string, splitting on ' ' seperators. - for (char *str = strtok_r(data_copy, " ", &str_ptr); str && i < (1+4+4+1); str = strtok_r(nullptr, " ", &str_ptr), i++) { + for (char *str = strtok_r(data_copy, " ,", &str_ptr); str && i < (1+4+4+1); str = strtok_r(nullptr, " ,", &str_ptr), i++) { int field = -1; int tilt = -128; int pos_incrdecr = 0; @@ -1629,7 +1649,7 @@ void CmndShutterCalibration(void) char data_copy[strlen(XdrvMailbox.data) + 1]; strncpy(data_copy, XdrvMailbox.data, sizeof(data_copy)); // Duplicate data as strtok_r will modify it. // Loop through the data string, splitting on ' ' seperators. - for (char *str = strtok_r(data_copy, " ", &str_ptr); str && i < 5; str = strtok_r(nullptr, " ", &str_ptr), i++) { + for (char *str = strtok_r(data_copy, " ,", &str_ptr); str && i < 5; str = strtok_r(nullptr, " ,", &str_ptr), i++) { int field = atoi(str); // The fields in a data string can only range from 1-30000. // and following value must be higher than previous one @@ -1687,7 +1707,7 @@ void CmndShutterFrequency(void) ShutterSettings.open_velocity_max = ShutterGlobal.open_velocity_max; ShutterInit(); } - ResponseCmndNumber(ShutterGlobal.open_velocity_max); + ResponseCmndNumber(ShutterSettings.open_velocity_max); } void CmndShutterIncDec(void) @@ -1833,12 +1853,6 @@ void CmndShutterPosition(void) } - //override tiltposition if explicit set (shutterbutton) - if (Shutter[index].tilt_target_pos_override != -128) { - Shutter[index].tilt_target_pos = tmin(tmax( Shutter[index].tilt_config[0],Shutter[index].tilt_target_pos_override ), Shutter[index].tilt_config[1]); - Shutter[index].tilt_target_pos_override = -128; - } - int8_t target_pos_percent = (XdrvMailbox.payload < 0) ? (XdrvMailbox.payload == -99 ? ShutterRealToPercentPosition(Shutter[index].real_position, index) : 0) : ((XdrvMailbox.payload > 100) ? 100 : XdrvMailbox.payload); target_pos_percent = ((ShutterSettings.shutter_options[index] & 1) && ((SRC_MQTT != TasmotaGlobal.last_source) // 1 && (SRC_SERIAL != TasmotaGlobal.last_source) // 6 @@ -1850,6 +1864,12 @@ void CmndShutterPosition(void) if (target_pos_percent == 0 && ShutterRealToPercentPosition(Shutter[index].real_position, index) > 0 ) {Shutter[index].tilt_target_pos = Shutter[index].tilt_config[4];} if (target_pos_percent == 100 && ShutterRealToPercentPosition(Shutter[index].real_position, index) < 100) {Shutter[index].tilt_target_pos = Shutter[index].tilt_config[3];} + //override tiltposition if explicit set (shutterbutton) + if (Shutter[index].tilt_target_pos_override != -128) { + Shutter[index].tilt_target_pos = tmin(tmax( Shutter[index].tilt_config[0],Shutter[index].tilt_target_pos_override ), Shutter[index].tilt_config[1]); + Shutter[index].tilt_target_pos_override = -128; + } + if (XdrvMailbox.payload != -99) { Shutter[index].target_position = ShutterPercentToRealPosition(target_pos_percent, index); //Shutter[i].accelerator[index] = ShutterGlobal.open_velocity_max / ((Shutter[i].motordelay[index] > 0) ? Shutter[i].motordelay[index] : 1); @@ -1948,7 +1968,7 @@ void CmndShutterPwmRange(void) char data_copy[strlen(XdrvMailbox.data) +1]; strncpy(data_copy, XdrvMailbox.data, sizeof(data_copy)); // Duplicate data as strtok_r will modify it. // Loop through the data string, splitting on ' ' seperators. - for (char *str = strtok_r(data_copy, " ", &str_ptr); str && i < 2; str = strtok_r(nullptr, " ", &str_ptr), i++) { + for (char *str = strtok_r(data_copy, " ,", &str_ptr); str && i < 2; str = strtok_r(nullptr, " ,", &str_ptr), i++) { uint16_t field = atoi(str); // The fields in a data string can only range from 1-30000. // and following value must be higher than previous one @@ -1957,14 +1977,11 @@ void CmndShutterPwmRange(void) } ShutterSettings.shutter_pwmrange[i][XdrvMailbox.index - 1] = field; } - AddLog(LOG_LEVEL_DEBUG, PSTR("SHT: Shtr%d Init1. pwmmin %d, pwmmax %d"), XdrvMailbox.index , ShutterSettings.shutter_pwmrange[0][XdrvMailbox.index -1], ShutterSettings.shutter_pwmrange[1][XdrvMailbox.index -1]); ShutterInit(); - ResponseCmndIdxChar(XdrvMailbox.data); - } else { - char setting_chr[30] = "0"; - snprintf_P(setting_chr, sizeof(setting_chr), PSTR("Shutter %d: min:%d max:%d"), XdrvMailbox.index, ShutterSettings.shutter_pwmrange[0][XdrvMailbox.index -1], ShutterSettings.shutter_pwmrange[1][XdrvMailbox.index -1]); - ResponseCmndIdxChar(setting_chr); - } + } + char setting_chr[30] = "0"; + snprintf_P(setting_chr, sizeof(setting_chr), PSTR("SHT %d: pwmmin:%d pwmmax:%d"), XdrvMailbox.index, ShutterSettings.shutter_pwmrange[0][XdrvMailbox.index -1], ShutterSettings.shutter_pwmrange[1][XdrvMailbox.index -1]); + ResponseCmndIdxChar(setting_chr); } } @@ -2209,7 +2226,7 @@ void CmndShutterTiltConfig(void) char data_copy[strlen(XdrvMailbox.data) +1]; strncpy(data_copy, XdrvMailbox.data, sizeof(data_copy)); // Duplicate data as strtok_r will modify it. // Loop through the data string, splitting on ' ' seperators. - for (char *str = strtok_r(data_copy, " ", &str_ptr); str && i < 6; str = strtok_r(nullptr, " ", &str_ptr), i++) { + for (char *str = strtok_r(data_copy, " ,", &str_ptr); str && i < 6; str = strtok_r(nullptr, " ,", &str_ptr), i++) { Shutter[XdrvMailbox.index -1].tilt_config[i] = ShutterSettings.shutter_tilt_config[i][XdrvMailbox.index -1] = atoi(str); } // avoid negative runtime diff --git a/tasmota/tasmota_xdrv_driver/xdrv_27_shutter.ino b/tasmota/tasmota_xdrv_driver/xdrv_27_shutter.ino index a22956f73..a3c926220 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_27_shutter.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_27_shutter.ino @@ -438,7 +438,7 @@ void ShutterInit(void) break; } AddLog(LOG_LEVEL_DEBUG, PSTR("SHT: Shtr%d min realpos_chg: %d, min tilt_chg %d"), i+1, Shutter[i].min_realPositionChange, Shutter[i].min_TiltChange); - AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Shtr%d Openvel %d, Closevel: %d"), i+1, ShutterGlobal.open_velocity_max, Shutter[i].close_velocity_max); + AddLog(LOG_LEVEL_DEBUG, PSTR("SHT: Shtr%d Openvel %d, Closevel: %d"), i+1, ShutterGlobal.open_velocity_max, Shutter[i].close_velocity_max); AddLog(LOG_LEVEL_DEBUG, PSTR("SHT: Shtr%d Init. Pos %d, Inv %d, Locked %d, Endstop enab %d, webButt inv %d, Motordel: %d"), i+1, Shutter[i].real_position, (Settings->shutter_options[i] & 1) ? 1 : 0, (Settings->shutter_options[i] & 2) ? 1 : 0, (Settings->shutter_options[i] & 4) ? 1 : 0, (Settings->shutter_options[i] & 8) ? 1 : 0, Shutter[i].motordelay); @@ -1323,12 +1323,6 @@ void CmndShutterPosition(void) } } - // manual override of tiltposition - if (Shutter[index].tilt_target_pos_override != -128) { - Shutter[index].tilt_target_pos = tmin(tmax( Shutter[index].tilt_config[0],Shutter[index].tilt_target_pos_override ), Shutter[index].tilt_config[1]); - Shutter[index].tilt_target_pos_override = -128; - } - int8_t target_pos_percent = (XdrvMailbox.payload < 0) ? (XdrvMailbox.payload == -99 ? ShutterRealToPercentPosition(Shutter[index].real_position, index) : 0) : ((XdrvMailbox.payload > 100) ? 100 : XdrvMailbox.payload); target_pos_percent = ((Settings->shutter_options[index] & 1) && ((SRC_MQTT != TasmotaGlobal.last_source) && (SRC_SERIAL != TasmotaGlobal.last_source) @@ -1339,7 +1333,14 @@ void CmndShutterPosition(void) // if position is either 0 or 100 reset the tilt to avoid tilt moving at the end if (target_pos_percent == 0 && ShutterRealToPercentPosition(Shutter[index].real_position, index) > 0 ) {Shutter[index].tilt_target_pos = Shutter[index].tilt_config[4];} if (target_pos_percent == 100 && ShutterRealToPercentPosition(Shutter[index].real_position, index) < 100) {Shutter[index].tilt_target_pos = Shutter[index].tilt_config[3];} - + + // manual override of tiltposition + if (Shutter[index].tilt_target_pos_override != -128) { + Shutter[index].tilt_target_pos = tmin(tmax( Shutter[index].tilt_config[0],Shutter[index].tilt_target_pos_override ), Shutter[index].tilt_config[1]); + AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Override tilt set: %d --> %d"),Shutter[index].tilt_target_pos_override, Shutter[index].tilt_target_pos); + Shutter[index].tilt_target_pos_override = -128; + } + if (XdrvMailbox.payload != -99) { //target_pos_percent = (Settings->shutter_options[index] & 1) ? 100 - target_pos_percent : target_pos_percent; Shutter[index].target_position = ShutterPercentToRealPosition(target_pos_percent, index); @@ -1727,7 +1728,7 @@ void CmndShutterPwmRange(void) char data_copy[strlen(XdrvMailbox.data) +1]; strncpy(data_copy, XdrvMailbox.data, sizeof(data_copy)); // Duplicate data as strtok_r will modify it. // Loop through the data string, splitting on ' ' seperators. - for (char *str = strtok_r(data_copy, " ", &str_ptr); str && i < 2; str = strtok_r(nullptr, " ", &str_ptr), i++) { + for (char *str = strtok_r(data_copy, " ,", &str_ptr); str && i < 2; str = strtok_r(nullptr, " ,", &str_ptr), i++) { uint16_t field = atoi(str); // The fields in a data string can only range from 1-30000. // and following value must be higher than previous one @@ -1757,7 +1758,7 @@ void CmndShutterCalibration(void) char data_copy[strlen(XdrvMailbox.data) +1]; strncpy(data_copy, XdrvMailbox.data, sizeof(data_copy)); // Duplicate data as strtok_r will modify it. // Loop through the data string, splitting on ' ' seperators. - for (char *str = strtok_r(data_copy, " ", &str_ptr); str && i < 5; str = strtok_r(nullptr, " ", &str_ptr), i++) { + for (char *str = strtok_r(data_copy, " ,", &str_ptr); str && i < 5; str = strtok_r(nullptr, " ,", &str_ptr), i++) { int field = atoi(str); // The fields in a data string can only range from 1-30000. // and following value must be higher than previous one @@ -1842,7 +1843,7 @@ void CmndShutterTiltConfig(void) char data_copy[strlen(XdrvMailbox.data) +1]; strncpy(data_copy, XdrvMailbox.data, sizeof(data_copy)); // Duplicate data as strtok_r will modify it. // Loop through the data string, splitting on ' ' seperators. - for (char *str = strtok_r(data_copy, " ", &str_ptr); str && i < 6; str = strtok_r(nullptr, " ", &str_ptr), i++) { + for (char *str = strtok_r(data_copy, " ,", &str_ptr); str && i < 6; str = strtok_r(nullptr, " ,", &str_ptr), i++) { Shutter[XdrvMailbox.index -1].tilt_config[i] = Settings->shutter_tilt_config[i][XdrvMailbox.index -1] = atoi(str); } // avoid negative runtime diff --git a/tasmota/tasmota_xdrv_driver/xdrv_29_deepsleep.ino b/tasmota/tasmota_xdrv_driver/xdrv_29_deepsleep.ino index 1867b2c41..bae29c8f1 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_29_deepsleep.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_29_deepsleep.ino @@ -38,7 +38,7 @@ const uint32_t DEEPSLEEP_MAX = 10 * 366 * 24 * 60 * 60; // Allow max 10 years sleep const uint32_t DEEPSLEEP_MAX_CYCLE = 60 * 60; // Maximum time for a deepsleep as defined by chip hardware -const uint32_t DEEPSLEEP_MIN_TIME = 5; // Allow 5 seconds skew +const uint32_t DEEPSLEEP_MIN_TIME = 15; // Allow 15 seconds skew const uint32_t DEEPSLEEP_START_COUNTDOWN = 4; // Allow 4 seconds to update web console before deepsleep const char kDeepsleepCommands[] PROGMEM = D_PRFX_DEEPSLEEP "|" @@ -52,8 +52,13 @@ uint8_t deepsleep_flag = 0; bool DeepSleepEnabled(void) { +#if defined(USE_RULES) && defined(USE_TIMERS) + if (GetRule(0) == "Wakeup" && bitRead(Settings->rule_enabled | Settings->rule_once, 0)) { + return true; + } +#endif if ((Settings->deepsleep < 10) || (Settings->deepsleep > DEEPSLEEP_MAX)) { - Settings->deepsleep = 0; // Issue #6961 + Settings->deepsleep = 0; // Issue #6961 return false; // Disabled } @@ -89,6 +94,89 @@ void DeepSleepReInit(void) RtcSettings.ultradeepsleep = 0; } +// Function to find the next relevant weekday +int8_t getNextWeekday(uint8_t currentDay, uint32_t day_bitarray, bool sameDayEventPassed) +{ + for (uint8_t daysChecked = 0; daysChecked < 7; ++daysChecked) { + uint8_t nextDay = (currentDay + daysChecked) % 7; + if ((day_bitarray & (1 << nextDay)) && (daysChecked > 0 || !sameDayEventPassed)) { + return nextDay; + } + } + return 0; +} + +// Funktion zur Berechnung der Sekunden bis zum nächsten ausgewählten Wochentag und Zeit +uint32_t calculateSecondsToTarget(uint32_t targetMinutesAfterMidnight, uint32_t day_bitarray) +{ + int32_t currentMinutesAfterMidnight = (RtcTime.hour *60) + RtcTime.minute; + + // samedayevent is a bit tricky. is wakeup is 10% before deepsleeptime this is tagged as "wakeup at time". + // e.g. deepsleep 3600 -> 360s (min) before the hour is fine and no other wakeup e.g in 6min. In this case the next + // wakeup is in 60+6min. A wakeup after the proposed time is no problem at all. + bool sameDayEventPassed = currentMinutesAfterMidnight + 1 + (RtcSettings.nextwakeup < LocalTime()?0:(Settings->deepsleep / 600)) >= targetMinutesAfterMidnight; + AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("DSL: passed: %d, currMin: %d, tagetMin: %d + error: %d->%d"), sameDayEventPassed, currentMinutesAfterMidnight, targetMinutesAfterMidnight, Settings->deepsleep, (RtcSettings.nextwakeup < LocalTime()?0:(Settings->deepsleep / 600))); + int8_t nextWeekday = getNextWeekday(RtcTime.day_of_week - 1, day_bitarray, sameDayEventPassed); + uint32_t secondsUntilTarget = 0; + int8_t daysUntilNextWeekday = (nextWeekday + 7 - (RtcTime.day_of_week - 1)) % 7; + + // Wenn das Zielereignis am selben Tag und bereits vorbei ist, wird der nächste mögliche Tag in der nächsten Woche berechnet + if (daysUntilNextWeekday == 0 && sameDayEventPassed) { + daysUntilNextWeekday = 7; + } + AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("DSL: nextDay %d, Duration %d"), + nextWeekday, daysUntilNextWeekday); + + secondsUntilTarget = daysUntilNextWeekday * 24 * 60 * 60 + (targetMinutesAfterMidnight - currentMinutesAfterMidnight) * 60; + return secondsUntilTarget; +} + +void DeepSleepCalculate() +{ + uint32_t secondsToTarget = 604800; // one week is the maximum + // Settings->deepsleep will be calculated by timers if timer is set to rule and rule is "Wakeup" + + // default add to the next wakeup. May be overwritten by "Wakeup" rule + RtcSettings.nextwakeup += Settings->deepsleep; +#if defined(USE_RULES) && defined(USE_TIMERS) + if (RtcTime.valid) { + if (!RtcTime.hour && !RtcTime.minute && !RtcTime.second) { TimerSetRandomWindows(); } // Midnight + if (Settings->flag3.timers_enable) { + int32_t time = (RtcTime.hour *60) + RtcTime.minute; + for (uint32_t i = 0; i < MAX_TIMERS; i++) { + Timer xtimer = Settings->timer[i]; + uint32_t day_bitarray = xtimer.days; + // day_bitarray>0 otherwhise no weekday selected + // rule keyword "Wakeup" + // Timer action: rule + if (xtimer.arm && day_bitarray && GetRule(0) == "Wakeup" && (TasmotaGlobal.restart_deepsleep || bitRead(Settings->rule_enabled | Settings->rule_once, 0)) && POWER_BLINK == xtimer.power) { +#ifdef USE_SUNRISE + if ((1 == xtimer.mode) || (2 == xtimer.mode)) { // Sunrise or Sunset + ApplyTimerOffsets(&xtimer); + if (xtimer.time>=2046) { continue; } + } +#endif + Settings->timer[i].arm = xtimer.repeat; + uint32_t secondsToTargetTemp = calculateSecondsToTarget(xtimer.time, day_bitarray); + secondsToTarget = tmin(secondsToTarget, secondsToTargetTemp); + } + } // loop over timers + // we found a timer 604800 == seconds in one week + if (secondsToTarget < 604800) { + Settings->deepsleep = secondsToTarget; + // check if rule ist just once + bitWrite(Settings->rule_once, 0, 0); + SettingsSaveAll(); + AddLog(LOG_LEVEL_DEBUG, PSTR("DSL: Wakeup: %ld [s]"), secondsToTarget); + RtcSettings.nextwakeup = LocalTime() + secondsToTarget - (LocalTime() % 60); + } + } + } //if (RtcTime.valid) +#endif // USE_RULES && TIMERS +} + + + void DeepSleepStart(void) { char stopic[TOPSZ]; @@ -104,7 +192,7 @@ void DeepSleepStart(void) RtcSettings.nextwakeup = 0; RtcSettings.deepsleep_slip = 10000; } - + // Timeslip in 0.1 seconds between the real wakeup and the calculated wakeup // Because deepsleep is in second and timeslip in 0.1 sec the compare always check if the slip is in the 10% range int32_t timeslip = (int32_t)(RtcSettings.nextwakeup + millis() / 1000 - LocalTime()) * 10; @@ -112,21 +200,21 @@ void DeepSleepStart(void) // Allow 10% of deepsleep error to count as valid deepsleep; expecting 3-4% // if more then 10% timeslip = 0 == non valid wakeup; maybe manual timeslip = (timeslip < -(int32_t)Settings->deepsleep) ? 0 : (timeslip > (int32_t)Settings->deepsleep) ? 0 : 1; + DeepSleepCalculate(); if (timeslip) { - RtcSettings.nextwakeup += Settings->deepsleep; RtcSettings.deepsleep_slip = (RtcSettings.nextwakeup - LocalTime()) * RtcSettings.deepsleep_slip / tmax((Settings->deepsleep - (millis() / 1000)),5); // Avoid crazy numbers. Again maximum 10% deviation. RtcSettings.deepsleep_slip = tmin(tmax(RtcSettings.deepsleep_slip, 9000), 11000); } -// AddLog(LOG_LEVEL_DEBUG, PSTR("DSL: Time %ld, next %ld, slip %ld"), timeslip, RtcSettings.nextwakeup, RtcSettings.deepsleep_slip ); + AddLog(LOG_LEVEL_DEBUG, PSTR("DSL: Time %ld, next %ld, slip %ld"), timeslip, RtcSettings.nextwakeup, RtcSettings.deepsleep_slip ); // It may happen that wakeup in just <5 seconds in future // In this case also add deepsleep to nextwakeup - if (RtcSettings.nextwakeup <= (LocalTime() + DEEPSLEEP_MIN_TIME)) { + if (RtcSettings.nextwakeup <= (LocalTime() + DEEPSLEEP_MIN_TIME) && Settings->deepsleep > 0 ) { // ensure nextwakeup is at least in the future, and add 5% RtcSettings.nextwakeup += (((LocalTime() + DEEPSLEEP_MIN_TIME - RtcSettings.nextwakeup) / Settings->deepsleep) + 1) * Settings->deepsleep; - RtcSettings.nextwakeup += Settings->deepsleep * 0.05; -// AddLog(LOG_LEVEL_DEBUG, PSTR("DSL: Time too short: time %ld, next %ld, slip %ld"), timeslip, RtcSettings.nextwakeup, RtcSettings.deepsleep_slip); + //RtcSettings.nextwakeup += Settings->deepsleep * 0.05; + //AddLog(LOG_LEVEL_DEBUG, PSTR("DSL: Time too short: time %ld, next %ld, slip %ld"), timeslip, RtcSettings.nextwakeup, RtcSettings.deepsleep_slip); } String dt = GetDT(RtcSettings.nextwakeup); // 2017-03-07T11:08:02 @@ -135,18 +223,20 @@ void DeepSleepStart(void) } // Limit sleeptime to DEEPSLEEP_MAX_CYCLE // uint32_t deepsleep_sleeptime = DEEPSLEEP_MAX_CYCLE < (RtcSettings.nextwakeup - LocalTime()) ? (uint32_t)DEEPSLEEP_MAX_CYCLE : RtcSettings.nextwakeup - LocalTime(); - deepsleep_sleeptime = tmin((uint32_t)DEEPSLEEP_MAX_CYCLE ,RtcSettings.nextwakeup - LocalTime()); + deepsleep_sleeptime = tmin((uint32_t)DEEPSLEEP_MAX_CYCLE ,RtcSettings.nextwakeup>0?RtcSettings.nextwakeup - LocalTime():0); + + // Sending Deepsleep parameters to automation for react Response_P(PSTR("{\"" D_PRFX_DEEPSLEEP "\":{\"" D_JSON_TIME "\":\"%s\",\"" D_PRFX_DEEPSLEEP "\":%d,\"Wakeup\":%d}}"), (char*)dt.c_str(), LocalTime(), RtcSettings.nextwakeup); MqttPublishPrefixTopicRulesProcess_P(TELE, PSTR(D_PRFX_DEEPSLEEP), true); - WifiShutdown(); - RtcSettings.ultradeepsleep = RtcSettings.nextwakeup - LocalTime(); - RtcSettingsSave(); - RtcRebootReset(); + WifiShutdown(); + RtcSettings.ultradeepsleep = RtcSettings.nextwakeup - LocalTime(); + RtcSettingsSave(); + RtcRebootReset(); #ifdef ESP8266 - ESP.deepSleep(100 * RtcSettings.deepsleep_slip * deepsleep_sleeptime); + ESP.deepSleep(100 * RtcSettings.deepsleep_slip * deepsleep_sleeptime); #endif // ESP8266 #ifdef ESP32 esp_sleep_enable_timer_wakeup(100 * RtcSettings.deepsleep_slip * deepsleep_sleeptime); @@ -161,14 +251,34 @@ void DeepSleepEverySecond(void) { //AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("Wifi Info: up %d, wifidown %d, wifistatus %d, flag %d"),TasmotaGlobal.uptime, TasmotaGlobal.global_state.wifi_down, Wifi.status , deepsleep_flag); if (DEEPSLEEP_NETWORK_TIMEOUT && TasmotaGlobal.uptime > DEEPSLEEP_NETWORK_TIMEOUT && Wifi.status != WL_CONNECTED && !deepsleep_flag && DeepSleepEnabled()) { - AddLog(LOG_LEVEL_ERROR, PSTR("Error Wifi could not connect %d seconds. Deepsleep"), DEEPSLEEP_NETWORK_TIMEOUT); + AddLog(LOG_LEVEL_ERROR, PSTR("Error Wifi no connect %d [s]. Deepsleep"), DEEPSLEEP_NETWORK_TIMEOUT); deepsleep_flag = DEEPSLEEP_START_COUNTDOWN; // Start deepsleep in 4 seconds } - +#if defined(USE_RULES) && defined(USE_TIMERS) + if (!deepsleep_flag) { + //AddLog(LOG_LEVEL_ERROR, PSTR("DSL: timers %d, rule: %d, once %d, comb %d, bitr %d"),Settings->flag3.timers_enable, Settings->rule_enabled, Settings->rule_once, Settings->rule_enabled | Settings->rule_once, bitRead(Settings->rule_enabled | Settings->rule_once, 0)); + if (Settings->flag3.timers_enable && GetRule(0) == "Wakeup" + && bitRead(Settings->rule_enabled | Settings->rule_once, 0) ) { + //AddLog(LOG_LEVEL_ERROR, PSTR("DSL: Start timer")); + deepsleep_flag = 60; + } + return; + } + //AddLog(LOG_LEVEL_ERROR, PSTR("DSL: wakeup: %d, timer %d, rules %d"),GetRule(0) == "Wakeup", Settings->flag3.timers_enable, bitRead(Settings->rule_enabled | Settings->rule_once, 0)); + if (GetRule(0) == "Wakeup" && ( !Settings->flag3.timers_enable || !bitRead(Settings->rule_enabled | Settings->rule_once, 0) )) { + deepsleep_flag = 0; + Settings->deepsleep = 0; + //AddLog(LOG_LEVEL_ERROR, PSTR("DSL: Stop timer")); + return; + } +#else if (!deepsleep_flag) { return; } +#endif + deepsleep_flag--; + AddLog(LOG_LEVEL_ERROR, PSTR("DSL: Countdown: %d"),deepsleep_flag); if (DeepSleepEnabled()) { - if (DEEPSLEEP_START_COUNTDOWN == deepsleep_flag) { + if (1 == deepsleep_flag) { SettingsSaveAll(); DeepSleepStart(); } @@ -187,7 +297,7 @@ void CmndDeepsleepTime(void) ((XdrvMailbox.payload > 10) && (XdrvMailbox.payload < DEEPSLEEP_MAX))) { Settings->deepsleep = XdrvMailbox.payload; RtcSettings.nextwakeup = 0; - deepsleep_flag = (0 == XdrvMailbox.payload) ? 0 : DEEPSLEEP_START_COUNTDOWN; + deepsleep_flag = (0 == XdrvMailbox.payload) ? 0 : DEEPSLEEP_START_COUNTDOWN + (ResetReason() != REASON_DEEP_SLEEP_AWAKE?60:0); if (deepsleep_flag) { if (!Settings->tele_period) { Settings->tele_period = TELE_PERIOD; // Need teleperiod to go back to sleep @@ -212,8 +322,9 @@ bool Xdrv29(uint32_t function) break; case FUNC_AFTER_TELEPERIOD: if (DeepSleepEnabled() && !deepsleep_flag && (Settings->tele_period == 10 || Settings->tele_period == 300 || millis() > 20000)) { - deepsleep_flag = DEEPSLEEP_START_COUNTDOWN; // Start deepsleep in 4 seconds - } + // on initial start the device will be 40 seconds awake. This allows to make changes + deepsleep_flag = DEEPSLEEP_START_COUNTDOWN + (ResetReason() != REASON_DEEP_SLEEP_AWAKE?60:0); // Start deepsleep in 4 seconds + } break; case FUNC_COMMAND: result = DecodeCommand(kDeepsleepCommands, DeepsleepCommand); diff --git a/tasmota/tasmota_xdrv_driver/xdrv_39_thermostat.ino b/tasmota/tasmota_xdrv_driver/xdrv_39_thermostat.ino index 3d7353c00..e4ea49af2 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_39_thermostat.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_39_thermostat.ino @@ -1285,7 +1285,7 @@ void ThermostatDebug(uint8_t ctr_output) { char ctr_output_chr[FLOATSZ]; char result_chr[FLOATSZ]; - dtostrfd(ctr_output, 0, ctr_output_chr); + dtostrfd(ctr_output + 1, 0, ctr_output_chr); dtostrfd(Thermostat[ctr_output].status.counter_seconds, 0, result_chr); AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_THERMOSTAT "Thermostat[%s].status.counter_seconds: %s"), ctr_output_chr, result_chr); dtostrfd(Thermostat[ctr_output].status.thermostat_mode, 0, result_chr); @@ -1340,7 +1340,7 @@ void DebugControllerParameters(uint8_t ctr_output) { char ctr_output_chr[FLOATSZ]; char result_chr[FLOATSZ]; - dtostrfd(ctr_output, 0, ctr_output_chr); + dtostrfd(ctr_output + 1, 0, ctr_output_chr); dtostrfd(Thermostat[ctr_output].status.controller_mode, 0, result_chr); AddLog(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_THERMOSTAT "Thermostat[%s].CONTROLLERMODESET: %s"), ctr_output_chr, result_chr); dtostrfd(Thermostat[ctr_output].time_pi_cycle, 0, result_chr); @@ -1394,16 +1394,12 @@ void ThermostatGetLocalSensor(uint8_t ctr_output) { JsonParserObject root = parser.getRootObject(); if (root) { String sensor_name = THERMOSTAT_SENSOR_NAME; - const char* value_c; if ( (THERMOSTAT_SENSOR_NUMBER > 1) &&(THERMOSTAT_CONTROLLER_OUTPUTS > 1) &&(ctr_output < THERMOSTAT_SENSOR_NUMBER)) { - char temp[4]; - temp[0] = IndexSeparator(); - snprintf(&temp[1], 4, "%u", (ctr_output + 1)); - sensor_name.concat(temp); + sensor_name.concat(IndexSeparator() + String(ctr_output + 1)); } - JsonParserToken value_token = root[sensor_name].getObject()[PSTR("Temperature")]; + JsonParserToken value_token = root[sensor_name].getObject()[PSTR(D_JSON_TEMPERATURE)]; if (value_token.isNum()) { int16_t value = value_token.getFloat() * 10; if (Thermostat[ctr_output].status.temp_format == TEMP_FAHRENHEIT) { @@ -2048,36 +2044,15 @@ void CmndEnableOutputSet(void) * Web UI \*********************************************************************************************/ - -// To be done, add all of this defines in according languages file when all will be finished -// Avoid multiple changes on all language files during development -// -------------------------------------------------- -// xdrv_39_thermostat.ino -#define D_THERMOSTAT "Thermostat" -#define D_THERMOSTAT_SET_POINT "Set Point" -#define D_THERMOSTAT_SENSOR "Current" -#define D_THERMOSTAT_GRADIENT "Gradient" -#define D_THERMOSTAT_DUTY_CYCLE "Duty cycle" -#define D_THERMOSTAT_CYCLE_TIME "Cycle time" -#define D_THERMOSTAT_PI_AUTOTUNE "PI Auto tuning" -#define D_THERMOSTAT_CONTROL_METHOD "Control method" -#define D_THERMOSTAT_RAMP_UP "Ramp up" -#define D_THERMOSTAT_PI "PI" -#define D_THERMOSTAT_AUTOTUNE "Autotune" -#define D_THERMOSTAT_RAMP_UP_HYBRID "Ramp up (Hybrid)" -#define D_THERMOSTAT_PI_HYBRID "PI (Hybrid)" -#define D_THERMOSTAT_AUTOTUNE_HYBRID "Autotune (Hybrid)" -// -------------------------------------------------- - - #ifdef USE_WEBSERVER -const char HTTP_THERMOSTAT_INFO[] PROGMEM = "{s}" D_THERMOSTAT "{m}%s{e}"; -const char HTTP_THERMOSTAT_TEMPERATURE[] PROGMEM = "{s}%s " D_TEMPERATURE "{m}%*_f " D_UNIT_DEGREE "%c{e}"; -const char HTTP_THERMOSTAT_DUTY_CYCLE[] PROGMEM = "{s}" D_THERMOSTAT_DUTY_CYCLE "{m}%d " D_UNIT_PERCENT "{e}"; -const char HTTP_THERMOSTAT_CYCLE_TIME[] PROGMEM = "{s}" D_THERMOSTAT_CYCLE_TIME "{m}%d " D_UNIT_MINUTE "{e}"; +const char HTTP_THERMOSTAT_INFO[] PROGMEM = "{s}" D_THERMOSTAT " %d{m}%s{e}"; +const char HTTP_THERMOSTAT_TEMPERATURE[] PROGMEM = "{s}%s{m}%*_f " D_UNIT_DEGREE "%c{e}"; +const char HTTP_THERMOSTAT_TEMP_GRAD[] PROGMEM = "{s}" D_THERMOSTAT_GRADIENT "{m}%c%*_f " D_UNIT_DEGREE "%c/" D_UNIT_HOUR "{e}"; +const char HTTP_THERMOSTAT_DUTY_CYCLE[] PROGMEM = "{s}" D_THERMOSTAT_DUTY_CYCLE "{m}%d " D_UNIT_PERCENT "{e}"; +const char HTTP_THERMOSTAT_CYCLE_TIME[] PROGMEM = "{s}" D_THERMOSTAT_CYCLE_TIME "{m}%d " D_UNIT_MINUTE "{e}"; const char HTTP_THERMOSTAT_CONTROL_METHOD[] PROGMEM = "{s}" D_THERMOSTAT_CONTROL_METHOD "{m}%s{e}"; -const char HTTP_THERMOSTAT_PI_AUTOTUNE[] PROGMEM = "{s}" D_THERMOSTAT_PI_AUTOTUNE "{m}%s{e}"; -const char HTTP_THERMOSTAT_HL[] PROGMEM = "{s}
{m}
{e}"; +const char HTTP_THERMOSTAT_PI_AUTOTUNE[] PROGMEM = "{s}" D_THERMOSTAT_PI_AUTOTUNE "{m}%s{e}"; +const char HTTP_THERMOSTAT_HL[] PROGMEM = "{s}
{m}
{e}"; #endif // USE_WEBSERVER @@ -2089,7 +2064,7 @@ void ThermostatShow(uint8_t ctr_output, bool json) { if (json) { float f_target_temp = Thermostat[ctr_output].temp_target_level / 10.0f; - ResponseAppend_P(PSTR(",\"Thermostat%i\":{"), ctr_output); + ResponseAppend_P(PSTR(",\"Thermostat%i\":{"), ctr_output + 1); ResponseAppend_P(PSTR("%s\"%s\":%i"), "", D_CMND_THERMOSTATMODESET, Thermostat[ctr_output].status.thermostat_mode); ResponseAppend_P(PSTR("%s\"%s\":%2_f"), ",", D_CMND_TEMPTARGETSET, &f_target_temp); ResponseAppend_P(PSTR("%s\"%s\":%i"), ",", D_CMND_CTRDUTYCYCLEREAD, ThermostatGetDutyCycle(ctr_output)); @@ -2104,13 +2079,13 @@ void ThermostatShow(uint8_t ctr_output, bool json) WSContentSend_P(HTTP_THERMOSTAT_HL); if (Thermostat[ctr_output].status.thermostat_mode == THERMOSTAT_OFF) { - WSContentSend_P(HTTP_THERMOSTAT_INFO, D_DISABLED ); + WSContentSend_P(HTTP_THERMOSTAT_INFO, ctr_output + 1, D_DISABLED ); } else { char c_unit = Thermostat[ctr_output].status.temp_format==TEMP_CELSIUS ? D_UNIT_CELSIUS[0] : D_UNIT_FAHRENHEIT[0]; float f_temperature; - WSContentSend_P(HTTP_THERMOSTAT_INFO, D_ENABLED); + WSContentSend_P(HTTP_THERMOSTAT_INFO, ctr_output + 1, D_ENABLED); f_temperature = Thermostat[ctr_output].temp_target_level / 10.0f; WSContentSend_PD(HTTP_THERMOSTAT_TEMPERATURE, D_THERMOSTAT_SET_POINT, Settings->flag2.temperature_resolution, &f_temperature, c_unit); @@ -2122,8 +2097,8 @@ void ThermostatShow(uint8_t ctr_output, bool json) if (Thermostat[ctr_output].status.temp_format == TEMP_FAHRENHEIT) { value = ThermostatCelsiusToFahrenheit((int32_t)Thermostat[ctr_output].temp_measured_gradient, TEMP_CONV_RELATIVE); } - f_temperature = value / 1000.0f; - WSContentSend_PD(HTTP_THERMOSTAT_TEMPERATURE, D_THERMOSTAT_GRADIENT, Settings->flag2.temperature_resolution, &f_temperature, c_unit); + f_temperature = abs(value) / 1000.0f; + WSContentSend_PD(HTTP_THERMOSTAT_TEMP_GRAD, value < 0 ? '-' : '+', Settings->flag2.temperature_resolution, &f_temperature, c_unit); WSContentSend_P(HTTP_THERMOSTAT_DUTY_CYCLE, ThermostatGetDutyCycle(ctr_output)); diff --git a/tasmota/tasmota_xdrv_driver/xdrv_41_tcp_bridge.ino b/tasmota/tasmota_xdrv_driver/xdrv_41_tcp_bridge.ino index 1ac33358b..811bbb7ce 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_41_tcp_bridge.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_41_tcp_bridge.ino @@ -37,6 +37,7 @@ uint8_t client_next = 0; uint8_t *tcp_buf = nullptr; // data transfer buffer bool ip_filter_enabled = false; IPAddress ip_filter; +bool tcp_serial = false; #include TasmotaSerial *TCPSerial = nullptr; @@ -58,8 +59,6 @@ void TCPLoop(void) bool busy; // did we transfer some data? int32_t buf_len; - if (!TCPSerial) return; - // check for a new client connection if ((server_tcp) && (server_tcp->hasClient())) { WiFiClient new_client = server_tcp->available(); @@ -138,14 +137,21 @@ void TCPLoop(void) void TCPInit(void) { if (PinUsed(GPIO_TCP_RX) && PinUsed(GPIO_TCP_TX)) { - if (0 == (0x80 & Settings->tcp_config)) // !0x80 means unitialized - Settings->tcp_config = 0x80 | ParseSerialConfig("8N1"); // default as 8N1 for backward compatibility + if (0 == (0x80 & Settings->tcp_config)) { // !0x80 means unitialized + Settings->tcp_config = 0x80 | ParseSerialConfig("8N1"); // default as 8N1 for backward compatibility + } tcp_buf = (uint8_t*) malloc(TCP_BRIDGE_BUF_SIZE); - if (!tcp_buf) { AddLog(LOG_LEVEL_ERROR, PSTR(D_LOG_TCP "could not allocate buffer")); return; } + if (!tcp_buf) { + AddLog(LOG_LEVEL_ERROR, PSTR(D_LOG_TCP "could not allocate buffer")); + return; + } - if (!Settings->tcp_baudrate) { Settings->tcp_baudrate = 115200 / 1200; } + if (!Settings->tcp_baudrate) { + Settings->tcp_baudrate = 115200 / 1200; + } TCPSerial = new TasmotaSerial(Pin(GPIO_TCP_RX), Pin(GPIO_TCP_TX), TasmotaGlobal.seriallog_level ? 1 : 2, 0, TCP_BRIDGE_BUF_SIZE); // set a receive buffer of 256 bytes - if (TCPSerial->begin(Settings->tcp_baudrate * 1200, ConvertSerialConfig(0x7F & Settings->tcp_config))) { + tcp_serial = TCPSerial->begin(Settings->tcp_baudrate * 1200, ConvertSerialConfig(0x7F & Settings->tcp_config)); + if (tcp_serial) { if (TCPSerial->hardwareSerial()) { ClaimSerial(); } @@ -167,9 +173,6 @@ void TCPInit(void) { // Params: port, // void CmndTCPStart(void) { - - if (!TCPSerial) { return; } - int32_t tcp_port = XdrvMailbox.payload; if (ArgC() == 2) { char sub_string[XdrvMailbox.data_len]; @@ -205,8 +208,6 @@ void CmndTCPStart(void) { } void CmndTCPBaudrate(void) { - if (!TCPSerial) { return; } - if ((XdrvMailbox.payload >= 1200) && (XdrvMailbox.payload <= 115200)) { XdrvMailbox.payload /= 1200; // Make it a valid baudrate if (Settings->tcp_baudrate != XdrvMailbox.payload) { @@ -220,8 +221,6 @@ void CmndTCPBaudrate(void) { } void CmndTCPConfig(void) { - if (!TCPSerial) { return; } - if (XdrvMailbox.data_len > 0) { uint8_t serial_config = ParseSerialConfig(XdrvMailbox.data); if ((serial_config >= 0) && (Settings->tcp_config != (0x80 | serial_config))) { @@ -241,8 +240,6 @@ void CmndTCPConfig(void) { void CmndTCPConnect(void) { int32_t tcp_port = XdrvMailbox.payload; - if (!TCPSerial) { return; } - if (ArgC() == 2) { char sub_string[XdrvMailbox.data_len]; WiFiClient new_client; @@ -283,16 +280,17 @@ bool Xdrv41(uint32_t function) { bool result = false; - switch (function) { - case FUNC_LOOP: - TCPLoop(); - break; - case FUNC_PRE_INIT: - TCPInit(); - break; - case FUNC_COMMAND: - result = DecodeCommand(kTCPCommands, TCPCommand); - break; + if (FUNC_PRE_INIT == function) { + TCPInit(); + } else if (tcp_serial) { + switch (function) { + case FUNC_LOOP: + TCPLoop(); + break; + case FUNC_COMMAND: + result = DecodeCommand(kTCPCommands, TCPCommand); + break; + } } return result; } diff --git a/tasmota/tasmota_xdrv_driver/xdrv_42_0_i2s_2_dacbuffer_idf51.ino b/tasmota/tasmota_xdrv_driver/xdrv_42_0_i2s_2_dacbuffer_idf51.ino new file mode 100644 index 000000000..cc0b55ad5 --- /dev/null +++ b/tasmota/tasmota_xdrv_driver/xdrv_42_0_i2s_2_dacbuffer_idf51.ino @@ -0,0 +1,163 @@ +/* + xdrv_42_0_i2s_2_dacbuffer_idf51.ino - Simplified Audio library, core class + + Copyright (C) 2021 Gerhard Mutz, Theo Arends, Staars, Stephan Hadinger + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#if defined(ESP32) && ESP_IDF_VERSION_MAJOR >= 5 +#ifdef USE_I2S_AUDIO +#ifdef SOC_DAC_SUPPORTED + +#include "driver/dac_continuous.h" +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include "freertos/semphr.h" +#include "driver/dac_continuous.h" + +// #define DAC_BUFFER_SIZE (960 * 2) +#define DAC_BUFFER_SIZE (240 * 2) + +SemaphoreHandle_t dac_buffer_Mutex; +size_t dac_buffer_len = 0; +TaskHandle_t dac_task_handle = NULL; +dac_continuous_handle_t dac_handle = NULL; +uint8_t *dac_buffer = NULL; + +int32_t dac_submit_buffer(uint8_t* data, size_t length) { +static int cnt = 0; +// if (cnt++ < 10) { AddLog(LOG_LEVEL_DEBUG, "dac_submit_buffer: %*_H", length, data); } + // send to dac audio + size_t i2s_bytes_written = 0; + if (length == 0) { return 0; } + +// Serial.printf("%i\n", length); + esp_err_t err = dac_continuous_write(dac_handle, data, length, &i2s_bytes_written, 0); + if (err && err != ESP_ERR_TIMEOUT) { + // AddLog(LOG_LEVEL_INFO, "I2S: Could not write samples (count=%i): %i", length, err); + return -1; + } else if (err == ESP_OK) { + // AddLog(LOG_LEVEL_DEBUG, "I2S: dac_continuous_write bytes_written=%i buf=%*_H", i2s_bytes_written, length, data); + } + + + // Submit buffer and return bytes consumed + return i2s_bytes_written; +} + +void dac_buffer_filling_task(void*) { + size_t bytesCopied; + while (true) { + // Wait for data + if (dac_buffer_Mutex != NULL) { + xSemaphoreTake(dac_buffer_Mutex, portMAX_DELAY); + // bytesCopied = fillBuffer(data, length); + if (dac_buffer_len > 0) { + int32_t bytes_consumed = dac_submit_buffer(dac_buffer, dac_buffer_len); + if (bytes_consumed > 0) { + if (bytes_consumed >= dac_buffer_len) { + dac_buffer_len = 0; + } else { + dac_buffer_len -= bytes_consumed; + memmove(dac_buffer, dac_buffer + bytes_consumed, dac_buffer_len); // shift what's left + } + } + } + xSemaphoreGive(dac_buffer_Mutex); + } + + // Wait 1ms + vTaskDelay(1); + } +} + +int32_t send_dac_data(uint8_t* buf, size_t len_in_bytes) { +// static int cnt = 11; +// cnt++; +// if (cnt < 10) { AddLog(LOG_LEVEL_DEBUG, "send_dac_data: %*_H", len_in_bytes, buf); } + if (dac_buffer_Mutex != NULL && len_in_bytes > 0 && buf != NULL) { + xSemaphoreTake(dac_buffer_Mutex, portMAX_DELAY); +// if (cnt < 10) { AddLog(LOG_LEVEL_DEBUG, "mutex gained"); } + + // Calculate available space + int32_t space_left = DAC_BUFFER_SIZE - dac_buffer_len; + int32_t bytes_sent = 0; + + if (space_left > 0) { + if (len_in_bytes > space_left) { + // send only the portion to fill the buffer + bytes_sent = space_left; + } else { + // send all of it + bytes_sent = len_in_bytes; + } +// if (cnt < 10) { AddLog(LOG_LEVEL_DEBUG, "memmove buf:%p from:%p len:%i", dac_buffer + dac_buffer_len, buf, bytes_sent); } + memmove(dac_buffer + dac_buffer_len, buf, bytes_sent); + dac_buffer_len += bytes_sent; +// if (cnt < 10) { AddLog(LOG_LEVEL_DEBUG, "dac_buffer_len:%i", dac_buffer_len); } + } + xSemaphoreGive(dac_buffer_Mutex); + return bytes_sent; + } else { + return -1; + } +} + +// returns `true` if successful +bool dac_task_start(void* _dac_handle) { + dac_handle = (dac_continuous_handle_t)_dac_handle; + + // allocate buffer TODO + if (dac_buffer == NULL) { + dac_buffer = (uint8_t*)malloc(DAC_BUFFER_SIZE); + if (dac_buffer == NULL) { + return false; + } + } + + // create mutex + if (dac_buffer_Mutex == NULL) { + dac_buffer_Mutex = xSemaphoreCreateMutex(); + if (dac_buffer_Mutex == NULL) { + return false; + } + } + + // create task + if (dac_task_handle == NULL) { + // Create task + xTaskCreatePinnedToCore( + dac_buffer_filling_task, /* Function to implement the task */ + "dac_buffer_fill", /* Name of the task */ + 1024, /* Stack size in words */ + NULL, /* Task input parameter */ + 1, /* Priority of the task */ + &dac_task_handle, /* Task handle. */ + 0); /* Core where the task should run */ + } + return true; +} + +bool dac_task_stop(void) { + if (dac_task_handle != NULL) { + vTaskDelete(dac_task_handle); + dac_task_handle = NULL; + } + return true; +} + +#endif // SOC_DAC_SUPPORTED +#endif // USE_I2S_AUDIO +#endif // defined(ESP32) && ESP_IDF_VERSION_MAJOR >= 5 diff --git a/tasmota/tasmota_xdrv_driver/xdrv_42_0_i2s_0_lib_idf51.ino b/tasmota/tasmota_xdrv_driver/xdrv_42_0_i2s_3_lib_idf51.ino similarity index 92% rename from tasmota/tasmota_xdrv_driver/xdrv_42_0_i2s_0_lib_idf51.ino rename to tasmota/tasmota_xdrv_driver/xdrv_42_0_i2s_3_lib_idf51.ino index c931b9e04..2207be6e3 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_42_0_i2s_0_lib_idf51.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_42_0_i2s_3_lib_idf51.ino @@ -1,5 +1,5 @@ /* - xdrv_42_0_i2s_0_lib_idf51.ino - Simplified Audio library, core class + xdrv_42_0_i2s_3_lib_idf51.ino - Simplified Audio library, core class Copyright (C) 2021 Gerhard Mutz, Theo Arends, Staars, Stephan Hadinger @@ -21,9 +21,8 @@ #ifdef USE_I2S_AUDIO #include "AudioOutput.h" -#include "driver/dac_continuous.h" -// If DAC is not supported, proide some placeholders +// If DAC is not supported, provide some placeholders #ifndef SOC_DAC_SUPPORTED #define dac_continuous_enable(...) (0xFF) #define dac_continuous_disable(...) (0xFF) @@ -72,8 +71,8 @@ public: TasmotaI2S() { // set some defaults hertz = 16000; - bps = I2S_DATA_BIT_WIDTH_16BIT; - channels = 2; + bps = I2S_DATA_BIT_WIDTH_16BIT; // bps sent to consumeAudio (this is different from channels of I2S stream) + channels = 2; // number of channels sent to consumeAudio (this is different from channels of I2S stream) gainF2P6 = 32; // equivalent of 0.5 } @@ -146,7 +145,7 @@ public: inline bool getExclusive(void) const {return _exclusive; } inline uint8_t getTxMode(void) const { return _tx_mode; } - inline uint8_t getTxChannels(void) const { return channels; } + inline uint8_t getTxChannels(void) const { return _tx_channels; } inline bool getTxRunning(void) const { return _tx_running; } inline i2s_chan_handle_t getTxHandle(void) const { return _tx_handle; } #ifdef SOC_DAC_SUPPORTED @@ -174,7 +173,7 @@ public: _tx_configured = true; } } - inline void setTxChannels(uint8_t channels) { SetChannels(channels); } + inline void setTxChannels(uint8_t channels) { _tx_channels = channels; } inline void setTxRunning(bool running) { _tx_running = running; } inline void setRxMode(uint8_t mode) { _rx_mode = mode; } inline void setRxChannels(uint8_t channels) { _rx_channels = channels; } @@ -236,13 +235,14 @@ protected: // local copy of useful settings for audio // TX - bool _tx_configured = false; // true = configured, false = not configured - uint8_t _tx_mode = I2S_MODE_STD; // I2S_MODE_STD / I2S_MODE_PDM / I2S_MODE_TDM / I2S_MODE_DAC - uint8_t _tx_slot_mask = I2S_SLOT_NOCHANGE; - bool _tx_running = false; // true = enabled, false = disabled - // uint8_t _tx_channels = 2; // number of channels, 1 = mono, 2 = stereo -- `channels` + bool _tx_configured = false; // true = configured, false = not configured + uint8_t _tx_mode = I2S_MODE_STD; // I2S_MODE_STD / I2S_MODE_PDM / I2S_MODE_TDM / I2S_MODE_DAC + uint8_t _tx_slot_mask = I2S_SLOT_NOCHANGE; + bool _tx_running = false; // true = enabled, false = disabled + uint8_t _tx_channels = 2; // number of channels, 1 = mono, 2 = stereo -- `channels` i2s_chan_handle_t _tx_handle = nullptr; // I2S channel handle, automatically computed - uint8_t _tx_slot_config = I2S_SLOT_MSB;// I2S slot configuration + uint8_t _tx_slot_config = I2S_SLOT_MSB;// I2S slot configuration + uint8_t _tx_bps = 16; // bits per sample, 16 or 8 // RX bool _rx_configured = false; // true = configured, false = not configured @@ -253,6 +253,7 @@ protected: i2s_chan_handle_t _rx_handle = nullptr; // I2S channel handle, automatically computed uint8_t _rx_slot_config = I2S_SLOT_MSB;// I2S slot configuration uint16_t _rx_freq = 16000; // I2S Rx sampling frequency in Hz + uint8_t _rx_bps = 16; // bits per sample, 16 or 8 uint16_t _rx_gain = 0x10; // Microphone gain in Q12.4 format (0x10 = 1.0) int16_t _rx_dc_offset = 0x8000; // DC offset for PCM data, or 0x8000 if not set yet @@ -315,9 +316,13 @@ bool TasmotaI2S::beginTx(void) { } esp_err_t err = ESP_OK; +#ifdef SOC_DAC_SUPPORTED if (isDACMode()) { err = dac_continuous_enable((dac_continuous_handle_t) _tx_handle); - } else { + dac_task_start((dac_continuous_handle_t) _tx_handle); + } else +#endif // SOC_DAC_SUPPORTED + { err = i2s_channel_enable(_tx_handle); } AddLog(LOG_LEVEL_INFO, "I2S: Tx i2s_channel_enable err=0x%04X", err); @@ -336,6 +341,7 @@ bool TasmotaI2S::stopTx() { if (!_tx_handle) { return true; } // nothing to do if (_tx_running) { if (isDACMode()) { + dac_task_stop(); err = dac_continuous_disable((dac_continuous_handle_t) _tx_handle); } else { err = i2s_channel_disable(_tx_handle); @@ -433,16 +439,18 @@ int32_t TasmotaI2S::consumeSamples(int16_t *samples, size_t count) { right = (((int16_t)(right & 0xff)) - 128) << 8; } + // apply gain + left = Amplify(left); + right = Amplify(right); + if (isDACMode()) { - left = Amplify(left) + 0x8000; - right = Amplify(right) + 0x8000; + ms[i*2 + LEFTCHANNEL] = left + 0x8000; + ms[i*2 + RIGHTCHANNEL] = right + 0x8000; } else { - left = Amplify(left); - right = Amplify(right); + ms[i*2 + LEFTCHANNEL] = left; + ms[i*2 + RIGHTCHANNEL] = right; } - ms[i*2 + LEFTCHANNEL] = left; - ms[i*2 + RIGHTCHANNEL] = right; } // AddLog(LOG_LEVEL_DEBUG, "I2S: consumeSamples: left=%i right=%i", ms[0], ms[1]); @@ -450,9 +458,7 @@ int32_t TasmotaI2S::consumeSamples(int16_t *samples, size_t count) { size_t i2s_bytes_written; esp_err_t err = ESP_OK; if (isDACMode()) { - err = dac_continuous_write((dac_continuous_handle_t) _tx_handle, (uint8_t*) ms, sizeof(ms), &i2s_bytes_written, -1); - // Serial.printf("."); Serial.flush(); - // AddLog(LOG_LEVEL_DEBUG, "I2S: dac_continuous_write err=0x%04X bytes_written=%i buf=%*_H", err, i2s_bytes_written, sizeof(ms), (uint8_t*) ms); + i2s_bytes_written = send_dac_data((uint8_t*)ms, sizeof(ms)); } else { err = i2s_channel_write(_tx_handle, ms, sizeof(ms), &i2s_bytes_written, 0); } @@ -508,9 +514,11 @@ bool TasmotaI2S::startI2SChannel(bool tx, bool rx) { } // by default we configure for MSB 2 slots `I2S_STD_MSB_SLOT_DEFAULT_CONFIG` + i2s_slot_mode_t tx_slot_mode = (_tx_channels == 1) ? I2S_SLOT_MODE_MONO : I2S_SLOT_MODE_STEREO; + i2s_data_bit_width_t tx_data_bit_width = (_tx_bps == 8) ? I2S_DATA_BIT_WIDTH_8BIT : I2S_DATA_BIT_WIDTH_16BIT; i2s_std_config_t tx_std_cfg = { .clk_cfg = I2S_STD_CLK_DEFAULT_CONFIG(hertz), - .slot_cfg = I2S_STD_MSB_SLOT_DEFAULT_CONFIG((i2s_data_bit_width_t)bps, (i2s_slot_mode_t)channels), + .slot_cfg = I2S_STD_MSB_SLOT_DEFAULT_CONFIG(tx_data_bit_width, tx_slot_mode), .gpio_cfg = { .mclk = _gpio_mclk, .bclk = _gpio_bclk, @@ -527,9 +535,9 @@ bool TasmotaI2S::startI2SChannel(bool tx, bool rx) { // change configuration if we are using PCM or PHILIPS if (_tx_slot_config == I2S_SLOT_PCM) { // PCM - tx_std_cfg.slot_cfg = I2S_STD_PCM_SLOT_DEFAULT_CONFIG((i2s_data_bit_width_t)bps, (i2s_slot_mode_t)channels); + tx_std_cfg.slot_cfg = I2S_STD_PCM_SLOT_DEFAULT_CONFIG(tx_data_bit_width, tx_slot_mode); } else if (_tx_slot_config == I2S_SLOT_PHILIPS) { // PHILIPS - tx_std_cfg.slot_cfg = I2S_STD_PHILIPS_SLOT_DEFAULT_CONFIG((i2s_data_bit_width_t)bps, (i2s_slot_mode_t)channels); + tx_std_cfg.slot_cfg = I2S_STD_PHILIPS_SLOT_DEFAULT_CONFIG(tx_data_bit_width, tx_slot_mode); } if (_tx_slot_mask != I2S_SLOT_NOCHANGE) { tx_std_cfg.slot_cfg.slot_mask = (i2s_std_slot_mask_t)_tx_slot_mask; } #if SOC_I2S_SUPPORTS_APLL @@ -559,7 +567,7 @@ bool TasmotaI2S::startI2SChannel(bool tx, bool rx) { .freq_hz = hertz, .offset = 0, .clk_src = DAC_DIGI_CLK_SRC_APLL, /*DAC_DIGI_CLK_SRC_DEFAULT*/ - .chan_mode = DAC_CHANNEL_MODE_SIMUL, + .chan_mode = DAC_CHANNEL_MODE_ALTER, }; // AddLog(LOG_LEVEL_DEBUG, "I2S: dac_chan_cfg chan_mask:%i clk_src:%i chan_mode:%i", // dac_chan_cfg.chan_mask, dac_chan_cfg.clk_src, dac_chan_cfg.chan_mode); @@ -577,10 +585,11 @@ bool TasmotaI2S::startI2SChannel(bool tx, bool rx) { if (rx) { gpio_num_t clk_gpio; - i2s_slot_mode_t slot_mode = (_rx_channels == 1) ? I2S_SLOT_MODE_MONO : I2S_SLOT_MODE_STEREO; - AddLog(LOG_LEVEL_DEBUG, "I2S: mic init rx_channels:%i rx_running:%i rx_handle:%p", slot_mode, _rx_running, _rx_handle); + i2s_slot_mode_t rx_slot_mode = (_rx_channels == 1) ? I2S_SLOT_MODE_MONO : I2S_SLOT_MODE_STEREO; + AddLog(LOG_LEVEL_DEBUG, "I2S: mic init rx_channels:%i rx_running:%i rx_handle:%p", rx_slot_mode, _rx_running, _rx_handle); i2s_chan_config_t rx_chan_cfg = I2S_CHANNEL_DEFAULT_CONFIG(_i2s_port, I2S_ROLE_MASTER); + i2s_data_bit_width_t rx_data_bit_width = (_rx_bps == 8) ? I2S_DATA_BIT_WIDTH_8BIT : I2S_DATA_BIT_WIDTH_16BIT; // change to 3 buffers of 512 samples rx_chan_cfg.dma_desc_num = 3; rx_chan_cfg.dma_frame_num = 512; @@ -597,7 +606,7 @@ bool TasmotaI2S::startI2SChannel(bool tx, bool rx) { i2s_pdm_rx_config_t rx_pdm_cfg = { .clk_cfg = I2S_PDM_RX_CLK_DEFAULT_CONFIG(_rx_freq), /* The default mono slot is the left slot (whose 'select pin' of the PDM microphone is pulled down) */ - .slot_cfg = I2S_PDM_RX_SLOT_DEFAULT_CONFIG(I2S_DATA_BIT_WIDTH_16BIT, (i2s_slot_mode_t)_rx_channels), + .slot_cfg = I2S_PDM_RX_SLOT_DEFAULT_CONFIG(rx_data_bit_width, rx_slot_mode), .gpio_cfg = { .clk = _gpio_ws, .din = _gpio_din, @@ -631,7 +640,7 @@ bool TasmotaI2S::startI2SChannel(bool tx, bool rx) { { i2s_std_config_t rx_std_cfg = { .clk_cfg = I2S_STD_CLK_DEFAULT_CONFIG(_rx_freq), - .slot_cfg = I2S_STD_MSB_SLOT_DEFAULT_CONFIG(I2S_DATA_BIT_WIDTH_16BIT, slot_mode), + .slot_cfg = I2S_STD_MSB_SLOT_DEFAULT_CONFIG(rx_data_bit_width, rx_slot_mode), .gpio_cfg = { .mclk = (gpio_num_t)Pin(GPIO_I2S_MCLK), .bclk = (gpio_num_t)Pin(GPIO_I2S_BCLK), @@ -649,7 +658,7 @@ bool TasmotaI2S::startI2SChannel(bool tx, bool rx) { err = i2s_channel_init_std_mode(_rx_handle, &rx_std_cfg); AddLog(LOG_LEVEL_DEBUG, "I2S: RX i2s_channel_init_std_mode err:%i", err); - AddLog(LOG_LEVEL_DEBUG, "I2S: RX channel in standard mode with 16 bit width on %i channel(s) initialized", slot_mode); + AddLog(LOG_LEVEL_DEBUG, "I2S: RX channel in standard mode with 16 bit width on %i channel(s) initialized", rx_slot_mode); if (err) { _rx_handle = nullptr; return false; @@ -713,8 +722,8 @@ uint32_t TasmotaI2S::startRx(void) { esp_err_t err = ESP_OK; gpio_num_t clk_gpio; - i2s_slot_mode_t slot_mode = (_rx_channels == 1) ? I2S_SLOT_MODE_MONO : I2S_SLOT_MODE_STEREO; - AddLog(LOG_LEVEL_DEBUG, "I2S: mic init rx_channels:%i rx_running:%i rx_handle:%p", slot_mode, _rx_running, _rx_handle); + i2s_slot_mode_t rx_slot_mode = (_rx_channels == 1) ? I2S_SLOT_MODE_MONO : I2S_SLOT_MODE_STEREO; + AddLog(LOG_LEVEL_DEBUG, "I2S: mic init rx_channels:%i rx_running:%i rx_handle:%p", rx_slot_mode, _rx_running, _rx_handle); if (!_rx_running) { err = i2s_channel_enable(_rx_handle); diff --git a/tasmota/tasmota_xdrv_driver/xdrv_42_0_i2s_audio_idf51.ino b/tasmota/tasmota_xdrv_driver/xdrv_42_0_i2s_audio_idf51.ino index 6263586d3..33dae7ec6 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_42_0_i2s_audio_idf51.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_42_0_i2s_audio_idf51.ino @@ -963,7 +963,7 @@ void CmndI2SGain(void) { void CmndI2SSay(void) { if (XdrvMailbox.data_len > 0) { - if (I2SPrepareTx()) { + if (I2SPrepareTx() != I2S_OK) { ResponseCmndChar("I2S output not configured"); return; } else { diff --git a/tasmota/tasmota_xdrv_driver/xdrv_49_pid.ino b/tasmota/tasmota_xdrv_driver/xdrv_49_pid.ino index 2d8089289..22d86dbf9 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_49_pid.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_49_pid.ino @@ -455,8 +455,6 @@ void PIDShowValues(void) { } #ifdef USE_WEBSERVER -void PIDShowValuesWeb(void) { - #define D_PID_DISPLAY_NAME "PID Controller" #define D_PID_SET_POINT "Set Point" #define D_PID_PRESENT_VALUE "Current Value" @@ -466,12 +464,13 @@ void PIDShowValuesWeb(void) { #define D_PID_MODE_MANUAL "Manual" #define D_PID_MODE_OFF "Off" - const char HTTP_PID_HL[] PROGMEM = "{s}
{m}
{e}"; - const char HTTP_PID_INFO[] PROGMEM = "{s}" D_PID_DISPLAY_NAME "{m}%s{e}"; - const char HTTP_PID_SP_FORMAT[] PROGMEM = "{s}%s " "{m}%*_f "; - const char HTTP_PID_PV_FORMAT[] PROGMEM = "{s}%s " "{m}%*_f "; - const char HTTP_PID_POWER_FORMAT[] PROGMEM = "{s}%s " "{m}%*_f " D_UNIT_PERCENT; +const char HTTP_PID_HL[] PROGMEM = "{s}
{m}
{e}"; +const char HTTP_PID_INFO[] PROGMEM = "{s}" D_PID_DISPLAY_NAME "{m}%s{e}"; +const char HTTP_PID_SP_FORMAT[] PROGMEM = "{s}%s " "{m}%*_f "; +const char HTTP_PID_PV_FORMAT[] PROGMEM = "{s}%s " "{m}%*_f "; +const char HTTP_PID_POWER_FORMAT[] PROGMEM = "{s}%s " "{m}%*_f " D_UNIT_PERCENT; +void PIDShowValuesWeb(void) { float f_buf; WSContentSend_P(HTTP_PID_HL); diff --git a/tasmota/tasmota_xdrv_driver/xdrv_50_filesystem.ino b/tasmota/tasmota_xdrv_driver/xdrv_50_filesystem.ino index dfc54172e..58240cf2a 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_50_filesystem.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_50_filesystem.ino @@ -792,8 +792,8 @@ const char UFS_FORM_FILE_UPGc2[] PROGMEM = const char UFS_FORM_FILE_UPG[] PROGMEM = "
" "

" - "
" - "
"; + "
" + "

"; const char UFS_FORM_SDC_DIRa[] PROGMEM = "
"; const char UFS_FORM_SDC_DIRc[] PROGMEM = @@ -910,7 +910,7 @@ void UfsDirectory(void) { } WSContentSend_P(UFS_FORM_FILE_UPGc2); - WSContentSend_P(UFS_FORM_FILE_UPG, PSTR(D_SCRIPT_UPLOAD)); + WSContentSend_P(UFS_FORM_FILE_UPG); if (isdir){ // if a folder, show 'folder: xxx' if not '/' diff --git a/tasmota/tasmota_xdrv_driver/xdrv_52_0_berry_struct.ino b/tasmota/tasmota_xdrv_driver/xdrv_52_0_berry_struct.ino index ba32bd06f..04dfede34 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_52_0_berry_struct.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_52_0_berry_struct.ino @@ -93,6 +93,9 @@ public: int32_t timeout = 0; // Berry heartbeat timeout, preventing code to run for too long. `0` means not enabled bool rules_busy = false; // are we already processing rules, avoid infinite loop bool web_add_handler_done = false; // did we already sent `web_add_handler` event +#ifdef USE_BERRY_PARTITION_WIZARD + bool partition_wizard_loaded = false; // did we already load Parition_Wizard +#endif // USE_BERRY_PARTITION_WIZARD bool autoexec_done = false; // do we still need to load 'autoexec.be' bool repl_active = false; // is REPL running (activates log recording) // output log is stored as a LinkedList of buffers diff --git a/tasmota/tasmota_xdrv_driver/xdrv_52_3_berry_crypto.ino b/tasmota/tasmota_xdrv_driver/xdrv_52_3_berry_crypto.ino index 6ac2b6ae4..63d7b750f 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_52_3_berry_crypto.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_52_3_berry_crypto.ino @@ -533,6 +533,89 @@ extern "C" { } } +/*********************************************************************************************\ + * AES_CBC class + * +\*********************************************************************************************/ +extern "C" { + // `AES_CBC.encrypt1(secret_key:bytes(16),iv:bytes(16),data:bytes(n*16))-> bool (true) + int32_t m_aes_cbc_encrypt1(bvm *vm); + int32_t m_aes_cbc_encrypt1(bvm *vm) { + int32_t argc = be_top(vm); // Get the number of arguments + if (argc >= 3 && be_isbytes(vm, 1) // secret_key - 16 bytes + && be_isbytes(vm, 2) // iv - 16 bytes + && be_isbytes(vm, 3) // data/cipher - multiple 16 bytes + ) { + + size_t key_len = 0; + const void * key = be_tobytes(vm, 1, &key_len); + if (key_len != 16) { + be_raise(vm, "value_error", "Key size must be 16 bytes"); + } + + size_t iv_len = 0; + void * iv = (void *) be_tobytes(vm, 2, &iv_len); + if (iv_len != 16) { + be_raise(vm, "value_error", "IV size must be 16"); + } + + size_t data_len = 0; + void * data = (void *) be_tobytes(vm, 3, &data_len); + if (data_len%16 != 0) { + be_raise(vm, "value_error", "Data size must be multiple of 16"); + } + + // Initialize an AES CBC encryption structure with the secret key, then run with IV and data + br_aes_small_cbcenc_keys cbc_ctx; + br_aes_small_cbcenc_init(&cbc_ctx, key, 16); + br_aes_small_cbcenc_run( &cbc_ctx, iv, data, data_len ); + + // (unchecked )success + be_pushbool(vm, btrue); + be_return(vm); + } + be_raise(vm, kTypeError, nullptr); + } + // `AES_CBC.decrypt1(secret_key:bytes(16),iv:bytes(16),cipher:bytes(n*16))-> bool (true) + int32_t m_aes_cbc_decrypt1(bvm *vm); + int32_t m_aes_cbc_decrypt1(bvm *vm) { + int32_t argc = be_top(vm); // Get the number of arguments + if (argc >= 3 && be_isbytes(vm, 1) // secret_key - 16 bytes + && be_isbytes(vm, 2) // iv - 16 bytes + && be_isbytes(vm, 3) // cipher/data - multiple 16 bytes + ) { + + size_t key_len = 0; + const void * key = be_tobytes(vm, 1, &key_len); + if (key_len != 16) { + be_raise(vm, "value_error", "Key size must be 16 bytes"); + } + + size_t iv_len = 0; + void * iv = (void *) be_tobytes(vm, 2, &iv_len); + if (iv_len != 16) { + be_raise(vm, "value_error", "IV size must be 16"); + } + + size_t data_len = 0; + void * data = (void *) be_tobytes(vm, 3, &data_len); + if (data_len%16 != 0) { + be_raise(vm, "value_error", "Cipher size must be multiple of 16"); + } + + // Initialize an AES CBC decryption structure with the secret key, then run with IV and data + br_aes_small_cbcdec_keys cbc_ctx; + br_aes_small_cbcdec_init(&cbc_ctx, key, 16); + br_aes_small_cbcdec_run( &cbc_ctx, iv, data, data_len ); + + // (unchecked )success + be_pushbool(vm, btrue); + be_return(vm); + } + be_raise(vm, kTypeError, nullptr); + } +} + /*********************************************************************************************\ * SHA256 class * @@ -1212,4 +1295,4 @@ extern "C" { be_raise(vm, kTypeError, nullptr); } } -#endif // USE_BERRY +#endif // USE_BERRY \ No newline at end of file diff --git a/tasmota/tasmota_xdrv_driver/xdrv_52_3_berry_gpio.ino b/tasmota/tasmota_xdrv_driver/xdrv_52_3_berry_gpio.ino index 191c0c8f6..7335665b2 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_52_3_berry_gpio.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_52_3_berry_gpio.ino @@ -160,8 +160,8 @@ extern "C" { esp_err_t err = dac_oneshot_new_channel(&channel_cfg, &channel_handle); #else dac_channel_t channel = (25 == pin) ? DAC_CHANNEL_1 : DAC_CHANNEL_2; -// esp_err_t err = dac_output_voltage(channel, dac_value); - esp_err_t err = dac_output_enable(channel); + esp_err_t err = dac_output_voltage(channel, dac_value); + // err = dac_output_enable(channel); #endif if (err) { be_raisef(vm, "internal_error", "Error: esp_err_tdac_output_voltage(%i, %i) -> %i", channel, dac_value, err); @@ -180,8 +180,8 @@ extern "C" { esp_err_t err = dac_oneshot_new_channel(&channel_cfg, &channel_handle); #else dac_channel_t channel = (17 == pin) ? DAC_CHANNEL_1 : DAC_CHANNEL_2; -// esp_err_t err = dac_output_voltage(channel, dac_value); - esp_err_t err = dac_output_enable(channel); + esp_err_t err = dac_output_voltage(channel, dac_value); + // err = dac_output_enable(channel); #endif if (err) { be_raisef(vm, "internal_error", "Error: esp_err_tdac_output_voltage(%i, %i) -> %i", channel, dac_value, err); diff --git a/tasmota/tasmota_xdrv_driver/xdrv_52_3_berry_leds.ino b/tasmota/tasmota_xdrv_driver/xdrv_52_3_berry_leds.ino index 249553a87..47d80c98f 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_52_3_berry_leds.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_52_3_berry_leds.ino @@ -199,22 +199,29 @@ extern "C" { case 9: // # 09 : ClearTo (color:??) -> void { uint32_t rgbw = be_toint(vm, 3); - uint8_t w = (rgbw & 0xFF000000) >> 24; - uint8_t r = (rgbw & 0xFF0000) >> 16; - uint8_t g = (rgbw & 0xFF00) >> 8; - uint8_t b = (rgbw & 0xFF); - if (s_ws2812_grb) s_ws2812_grb->ClearTo(RgbColor(r, g, b)); - if (s_sk6812_grbw) s_sk6812_grbw->ClearTo(RgbwColor(r, g, b, w)); + uint8_t w = (rgbw >> 24) & 0xFF; + uint8_t r = (rgbw >> 16) & 0xFF; + uint8_t g = (rgbw >> 8) & 0xFF; + uint8_t b = (rgbw ) & 0xFF; + if (argc >= 5 && be_isint(vm, 4) && be_isint(vm, 5)) { + uint32_t from = be_toint(vm, 4); + uint32_t len = be_toint(vm, 5); + if (s_ws2812_grb) s_ws2812_grb->ClearTo(RgbColor(r, g, b), from, from + len - 1); + if (s_sk6812_grbw) s_sk6812_grbw->ClearTo(RgbwColor(r, g, b, w), from, from + len - 1); + } else { + if (s_ws2812_grb) s_ws2812_grb->ClearTo(RgbColor(r, g, b)); + if (s_sk6812_grbw) s_sk6812_grbw->ClearTo(RgbwColor(r, g, b, w)); + } } break; case 10: // # 10 : SetPixelColor (idx:int, color:??) -> void { int32_t idx = be_toint(vm, 3); uint32_t rgbw = be_toint(vm, 4); - uint8_t w = (rgbw & 0xFF000000) >> 24; - uint8_t r = (rgbw & 0xFF0000) >> 16; - uint8_t g = (rgbw & 0xFF00) >> 8; - uint8_t b = (rgbw & 0xFF); + uint8_t w = (rgbw >> 24) & 0xFF; + uint8_t r = (rgbw >> 16) & 0xFF; + uint8_t g = (rgbw >> 8) & 0xFF; + uint8_t b = (rgbw ) & 0xFF; if (s_ws2812_grb) s_ws2812_grb->SetPixelColor(idx, RgbColor(r, g, b)); if (s_sk6812_grbw) s_sk6812_grbw->SetPixelColor(idx, RgbwColor(r, g, b, w)); } @@ -242,6 +249,234 @@ extern "C" { } be_raise(vm, kTypeError, nullptr); } +} + +extern "C" { + // Leds.blend_color(color_a:int, color_b:int [, alpha:int]) -> color:int + // + // color_a is 0x..RRGGBB + // color_b is 0xAARRGGBB, AA is transparency (00: opaque, FF: transparent) + // Note: the default is 00 considered opaque, so Transparency = 255 - alpha + // alpha is 0..255, and optional. If present it overrides `AA` from color_b + // Note: alpha `00` is transparent, `FF` is opaque + int32_t be_leds_blend_color(bvm *vm); + int32_t be_leds_blend_color(bvm *vm) { + int32_t top = be_top(vm); // Get the number of arguments + if (top >= 2 && be_isint(vm, 1) && be_isint(vm, 2)) { + uint32_t color_a = be_toint(vm, 1); + uint32_t color_b = be_toint(vm, 2); + uint32_t transpency = (color_b >> 24) & 0xFF; + if (top >= 3 && be_isint(vm, 3)) { + transpency = 255 - be_toint(vm, 3); + } + // remove any transparency + color_a = color_a & 0xFFFFFF; + color_b = color_b & 0xFFFFFF; + + if (transpency == 0) { // color_b is opaque, return color_b + be_pushint(vm, color_b); + be_return(vm); + } + if (transpency >= 255) { // color_b is transparent, return color_a + be_pushint(vm, color_a); + be_return(vm); + } + int32_t r = changeUIntScale(transpency, 0, 255, (color_b >> 16) & 0xFF, (color_a >> 16) & 0xFF); + int32_t g = changeUIntScale(transpency, 0, 255, (color_b >> 8) & 0xFF, (color_a >> 8) & 0xFF); + int32_t b = changeUIntScale(transpency, 0, 255, (color_b ) & 0xFF, (color_a ) & 0xFF); + uint32_t rgb = (r << 16) | (g << 8) | b; + be_pushint(vm, rgb); + be_return(vm); + } + be_raise(vm, kTypeError, nullptr); + } + + static uint32_t ApplyBriGamma(uint32_t color_a /* 0xRRGGBB */, uint32_t bri /* 0..100 */, bool gamma) { + if (bri == 0) { return 0x000000; } // if bri is zero, short-cut + uint32_t r = (color_a >> 16) & 0xFF; + uint32_t g = (color_a >> 8) & 0xFF; + uint32_t b = (color_a ) & 0xFF; + + if (bri < 100) { // apply bri + r = changeUIntScale(bri, 0, 100, 0, r); + g = changeUIntScale(bri, 0, 100, 0, g); + b = changeUIntScale(bri, 0, 100, 0, b); + } + + if (gamma) { // apply gamma + r = ledGamma(r); + g = ledGamma(g); + b = ledGamma(b); + } + uint32_t rgb = (r << 16) | (g << 8) | b; + return rgb; + } + + // Leds.apply_bri_gamma(color_rgb:int (0xRRGGBB) [bri:int (0..100), gamma:bool]) -> color:int (0xRRGGBB) + // + int32_t be_leds_apply_bri_gamma(bvm *vm); + int32_t be_leds_apply_bri_gamma(bvm *vm) { + int32_t top = be_top(vm); // Get the number of arguments + if (top >= 1 && be_isint(vm, 1)) { + uint32_t color_a = be_toint(vm, 1); + uint32_t bri = 100; + if (top >= 2 && be_isint(vm, 2)) { + bri = be_toint(vm, 2); + } + bool gamma = false; + if (top >= 3) { + gamma = be_tobool(vm, 3); + } + + uint32_t rgb = ApplyBriGamma(color_a, bri, gamma); + + be_pushint(vm, rgb); + be_return(vm); + } + be_raise(vm, kTypeError, nullptr); + } + + // Leds_frame.blend(color1:int, color2:int, alpha:int) -> int + // + int32_t be_leds_blend(bvm *vm); + int32_t be_leds_blend(bvm *vm) { + int32_t top = be_top(vm); // Get the number of arguments + if (top >= 3 && be_isint(vm, 1) && be_isint(vm, 2) && be_isint(vm, 3)) { + uint32_t color_a = be_toint(vm, 1); + uint32_t color_b = be_toint(vm, 2); + uint32_t alpha = be_toint(vm, 3); + uint32_t r = (color_a >> 16) & 0xFF; + uint32_t g = (color_a >> 8) & 0xFF; + uint32_t b = (color_a ) & 0xFF; + uint32_t r2 = (color_b >> 16) & 0xFF; + uint32_t g2 = (color_b >> 8) & 0xFF; + uint32_t b2 = (color_b ) & 0xFF; + uint32_t r3 = changeUIntScale(alpha, 0, 255, r2, r); + uint32_t g3 = changeUIntScale(alpha, 0, 255, g2, g); + uint32_t b3 = changeUIntScale(alpha, 0, 255, b2, b); + uint32_t rgb = (r3 << 16) | (g3 << 8) | b3; + be_pushint(vm, rgb); + be_return(vm); + } + be_raise(vm, kTypeError, nullptr); + } + + // Leds_frame.blend_pixels(dest:bytes(), foreground:bytes) -> nil + // Destination can be the same as foreground or background + // + // All calculation are done in `0xAARRGGBB` format, AA=0 if opaque (i.e. ignored) + // Background has always alpha = 0 (any other value is ignored) - for simplification + // Size is truncated to smallest of all 3 buffers + int32_t be_leds_blend_pixels(bvm *vm); + int32_t be_leds_blend_pixels(bvm *vm) { + int32_t top = be_top(vm); // Get the number of arguments + if (top >= 2 && be_isbytes(vm, 2)) { + size_t dest_len = 0; + uint32_t * dest_buf = (uint32_t*) be_tobytes(vm, 1, &dest_len); + // back = dest for now, could be changed in the future + size_t back_len = 0; + const uint32_t * back_buf = (const uint32_t*) be_tobytes(vm, 1, &back_len); + size_t fore_len = 0; + const uint32_t * fore_buf = (const uint32_t*) be_tobytes(vm, 2, &fore_len); + + if (fore_len < dest_len) { dest_len = fore_len; } + if (back_len < dest_len) { dest_len = back_len; } + size_t pixels_count = dest_len / 4; + if (pixels_count > 0) { + uint32_t * dest = (uint32_t *)dest_buf; + uint32_t * back = (uint32_t *)back_buf; + uint32_t * fore = (uint32_t *)fore_buf; + for (size_t i = 0; i < pixels_count; i++) { + uint32_t back_argb = back[i]; + uint32_t fore_argb = fore[i]; + uint32_t fore_alpha = (fore_argb >> 24) & 0xFF; + uint32_t dest_rgb_new = back_argb; + if (fore_alpha == 0) { // opaque layer, copy value from fore + dest_rgb_new = fore_argb; + } else if (fore_alpha == 255) { // fore is transparent, use back + // nothing to do, dest_rgb_new = back_argb above + } else { + uint32_t back_r = (back_argb >> 16) & 0xFF; + uint32_t fore_r = (fore_argb >> 16) & 0xFF; + uint32_t back_g = (back_argb >> 8) & 0xFF; + uint32_t fore_g = (fore_argb >> 8) & 0xFF; + uint32_t back_b = (back_argb ) & 0xFF; + uint32_t fore_b = (fore_argb ) & 0xFF; + uint32_t dest_r_new = changeUIntScale(fore_alpha, 0, 255, fore_r, back_r); + uint32_t dest_g_new = changeUIntScale(fore_alpha, 0, 255, fore_g, back_g); + uint32_t dest_b_new = changeUIntScale(fore_alpha, 0, 255, fore_b, back_b); + dest_rgb_new = (dest_r_new << 16) | (dest_g_new << 8) | dest_b_new; + } + dest[i] = dest_rgb_new; + } + } + be_return_nil(vm); + } + be_raise(vm, kTypeError, nullptr); + } + + // Leds_frame.fill_pixels(dest:bytes(), color:int) -> nil + // + // Fill buffer with same color + int32_t be_leds_fill_pixels(bvm *vm); + int32_t be_leds_fill_pixels(bvm *vm) { + int32_t top = be_top(vm); // Get the number of arguments + if (top >= 2 && be_isint(vm, 2)) { + size_t dest_len = 0; + uint32_t * dest_buf = (uint32_t*) be_tobytes(vm, 1, &dest_len); + uint32_t color = be_toint(vm, 2); + + size_t pixels_count = dest_len / 4; + if (pixels_count > 0) { + uint32_t * dest = (uint32_t *)dest_buf; + for (size_t i = 0; i < pixels_count; i++) { + dest[i] = color; + } + } + be_return_nil(vm); + } + be_raise(vm, kTypeError, nullptr); + } + + // Leds_frame.paste_pixels(neopixel:bytes(), led_buffer:bytes(), bri:int 0..100, gamma:bool) + // + // Copy from ARGB buffer to GRB + int32_t be_leds_paste_pixels(bvm *vm); + int32_t be_leds_paste_pixels(bvm *vm) { + int32_t top = be_top(vm); // Get the number of arguments + if (top >= 2 && be_isbytes(vm, 2)) { + size_t src_len = 0; + uint32_t * src_buf = (uint32_t*) be_tobytes(vm, 1, &src_len); + size_t dest_len = 0; + uint8_t * dest_buf = (uint8_t*) be_tobytes(vm, 2, &dest_len); + + uint32_t bri = 100; + if (top >= 3 && be_isint(vm, 3)) { + bri = be_toint(vm, 3); + } + bool gamma = false; + if (top >= 4 && be_isbool(vm, 4)) { + gamma = be_tobool(vm, 4); + } + + size_t pixels_count = src_len / 4; + if (pixels_count > dest_len / 3) { pixels_count = dest_len / 3; } + if (pixels_count > 0) { + for (size_t i = 0; i < pixels_count; i++) { + uint32_t src_argb = ApplyBriGamma(src_buf[i], bri, gamma); + uint32_t src_r = (src_argb >> 16) & 0xFF; + uint32_t src_g = (src_argb >> 8) & 0xFF; + uint32_t src_b = (src_argb ) & 0xFF; + dest_buf[i * 3 + 0] = src_g; + dest_buf[i * 3 + 1] = src_r; + dest_buf[i * 3 + 2] = src_b; + } + } + be_return_nil(vm); + } + be_raise(vm, kTypeError, nullptr); + } + } diff --git a/tasmota/tasmota_xdrv_driver/xdrv_52_3_berry_lvgl.ino b/tasmota/tasmota_xdrv_driver/xdrv_52_3_berry_lvgl.ino index e6ec58e56..59e49f58f 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_52_3_berry_lvgl.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_52_3_berry_lvgl.ino @@ -22,7 +22,15 @@ #ifdef USE_LVGL #include + +// silence warning with Core3 +#pragma GCC diagnostic push +#if defined(__GNUC__) && (__GNUC__ >= 10) +#pragma GCC diagnostic ignored "-Wdeprecated-enum-enum-conversion" +#endif #include "lvgl.h" +#pragma GCC diagnostic pop + #include "be_mapping.h" #include "be_ctypes.h" #include "lv_berry.h" diff --git a/tasmota/tasmota_xdrv_driver/xdrv_52_3_berry_tasmota.ino b/tasmota/tasmota_xdrv_driver/xdrv_52_3_berry_tasmota.ino index 498d80b15..320023b34 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_52_3_berry_tasmota.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_52_3_berry_tasmota.ino @@ -409,6 +409,24 @@ extern "C" { be_raise(vm, kTypeError, nullptr); } + // Berry: tasmota.scale_int(int * 5) -> int + // + int32_t l_scaleint(struct bvm *vm); + int32_t l_scaleint(struct bvm *vm) { + int32_t top = be_top(vm); // Get the number of arguments + if (top == 5 && be_isint(vm, 1) && be_isint(vm, 2) && be_isint(vm, 3) && be_isint(vm, 4) && be_isint(vm, 5)) { + int32_t val = be_toint(vm, 1); + int32_t from_min = be_toint(vm, 2); + int32_t from_max = be_toint(vm, 3); + int32_t to_min = be_toint(vm, 4); + int32_t to_max = be_toint(vm, 5); + int32_t scaled = changeIntScale(val, from_min, from_max, to_min, to_max); + be_pushint(vm, scaled); + be_return(vm); + } + be_raise(vm, kTypeError, nullptr); + } + int32_t l_respCmnd(bvm *vm); int32_t l_respCmnd(bvm *vm) { int32_t top = be_top(vm); // Get the number of arguments diff --git a/tasmota/tasmota_xdrv_driver/xdrv_52_3_berry_ulp.ino b/tasmota/tasmota_xdrv_driver/xdrv_52_3_berry_ulp.ino index 9d154a8da..24835b64f 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_52_3_berry_ulp.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_52_3_berry_ulp.ino @@ -26,19 +26,29 @@ #if defined(CONFIG_IDF_TARGET_ESP32) #include "esp32/ulp.h" #endif // esp32 -#if defined(CONFIG_IDF_TARGET_ESP32S2) -#include "esp32s2/ulp.h" -#include "esp32s2/ulp_riscv.h" -#include "esp32s2/ulp_riscv_adc.h" -#endif // s2 -#if defined(CONFIG_IDF_TARGET_ESP32S3) -#include "esp32s3/ulp.h" -#include "esp32s3/ulp_riscv.h" -#include "esp32s3/ulp_riscv_adc.h" -#endif //s3 +#if ESP_IDF_VERSION_MAJOR < 5 + #if defined(CONFIG_IDF_TARGET_ESP32S2) + #include "esp32s2/ulp.h" + #include "esp32s2/ulp_riscv.h" + #include "esp32s2/ulp_riscv_adc.h" + #endif // s2 + #if defined(CONFIG_IDF_TARGET_ESP32S3) + #include "esp32s3/ulp.h" + #include "esp32s3/ulp_riscv.h" + #include "esp32s3/ulp_riscv_adc.h" + #endif //s3 +#endif // ESP_IDF_VERSION_MAJOR < 5 #include "driver/rtc_io.h" #include "driver/gpio.h" -#include "driver/adc.h" +#if ESP_IDF_VERSION_MAJOR >= 5 + #include "esp_adc/adc_oneshot.h" + #include "ulp_adc.h" + #if defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32S3) + #include "ulp_riscv.h" + #endif // defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32S3) +#else + #include "driver/adc.h" +#endif // ESP_IDF_VERSION_MAJOR >= 5 #include "sdkconfig.h" @@ -92,20 +102,45 @@ extern "C" { // enums: channel 0-7, attenuation 0-3, width 0-3 void be_ULP_adc_config(struct bvm *vm, int32_t channel, int32_t attenuation, int32_t width) { #if defined(CONFIG_IDF_TARGET_ESP32) +#if ESP_IDF_VERSION_MAJOR >= 5 + ulp_adc_cfg_t cfg = { + .adc_n = ADC_UNIT_1, + .channel = (adc_channel_t)channel, + .atten = (adc_atten_t)attenuation, + .width = (adc_bitwidth_t)width, + .ulp_mode = ADC_ULP_MODE_FSM, + }; + esp_err_t err = ulp_adc_init(&cfg); +#else esp_err_t err = adc1_config_channel_atten((adc1_channel_t)channel, (adc_atten_t)attenuation); err += adc1_config_width((adc_bits_width_t)width); +#endif // ESP_IDF_VERSION_MAJOR >= 5 if (err != ESP_OK) { be_raisef(vm, "ulp_adc_config_error", "ULP: invalid code err=%i", err); - } else { + } +#if ESP_IDF_VERSION_MAJOR < 5 + else { adc1_ulp_enable(); } +#endif // ESP_IDF_VERSION_MAJOR < 5 #else // S2 or S3 +#if ESP_IDF_VERSION_MAJOR >= 5 + ulp_adc_cfg_t cfg = { + .adc_n = ADC_UNIT_1, + .channel = (adc_channel_t)channel, + .atten = (adc_atten_t)attenuation, + .width = (adc_bitwidth_t)width, + .ulp_mode = ADC_ULP_MODE_RISCV, + }; + esp_err_t err = ulp_adc_init(&cfg); +#else ulp_riscv_adc_cfg_t cfg = { .channel = (adc_channel_t)channel, .atten = (adc_atten_t)attenuation, .width = (adc_bits_width_t)width }; esp_err_t err = ulp_riscv_adc_init(&cfg); +#endif // ESP_IDF_VERSION_MAJOR >= 5 if (err != ESP_OK) { be_raisef(vm, "ulp_adc_config_error", "ULP: invalid code err=%i", err); } @@ -149,4 +184,4 @@ extern "C" { #endif //CONFIG_IDF_TARGET_ESP32 .. S2 .. S3 #endif // USE_BERRY_ULP -#endif // USE_BERRY +#endif // USE_BERRY \ No newline at end of file diff --git a/tasmota/tasmota_xdrv_driver/xdrv_52_9_berry.ino b/tasmota/tasmota_xdrv_driver/xdrv_52_9_berry.ino index e0a756071..a075a2e8d 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_52_9_berry.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_52_9_berry.ino @@ -23,6 +23,10 @@ #define XDRV_52 52 #include +extern "C" { + #include "be_bytecode.h" + #include "be_var.h" +} #include "berry_tasmota.h" #ifdef USE_MATTER_DEVICE #include "berry_matter.h" @@ -367,7 +371,7 @@ void BerryInit(void) { be_pop(berry.vm, 1); } - AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_BERRY "Berry initialized, RAM used=%u bytes"), callBerryGC()); + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_BERRY "Berry initialized, RAM used %u bytes"), callBerryGC()); berry_init_ok = true; // we generate a synthetic event `autoexec` @@ -757,6 +761,87 @@ void HandleBerryConsole(void) WSContentStop(); } +#ifdef USE_BERRY_PARTITION_WIZARD +// Display a Button to dynamically load the Partition Wizard +void HandleBerryPartiionWizardLoaderButton(void) { + bvm * vm = berry.vm; + static const char PARTITION_WIZARD_NAME[] = "partition_wizard"; + if (!berry.partition_wizard_loaded) { + if (be_global_find(vm, be_newstr(vm, PARTITION_WIZARD_NAME)) < 0) { // the global name `partition_wizard` doesn't exist + WSContentSend_P("

"); + } else { + berry.partition_wizard_loaded = true; + } + } +} + +void HandleBerryPartitionWizardLoader(void) { + if (BerryBECLoader(USE_BERRY_PARTITION_WIZARD_URL)) { + // All good, redirect + Webserver->sendHeader("Location", "/part_wiz", true); + Webserver->send(302, "text/plain", ""); + berry.partition_wizard_loaded = true; + } else { + Webserver->sendHeader("Location", "/mn?", true); + Webserver->send(302, "text/plain", ""); + } +} +#endif //USE_BERRY_PARTITION_WIZARD + +// return true if successful +bool BerryBECLoader(const char * url) { + bvm *vm = berry.vm; + + HTTPClientLight cl; + cl.setUserAgent(USE_BERRY_WEBCLIENT_USERAGENT); + cl.setConnectTimeout(USE_BERRY_WEBCLIENT_TIMEOUT); // set default timeout + cl.setFollowRedirects(HTTPC_STRICT_FOLLOW_REDIRECTS); + + if (!cl.begin(url)) { + AddLog(LOG_LEVEL_INFO, "BRY: unable to load URL '%s'", url); + // cl.end(); + return false; + } + + uint32_t http_connect_time = millis(); + int32_t httpCode = cl.GET(); + if (httpCode != 200) { + AddLog(LOG_LEVEL_INFO, "BRY: unable to load URL '%s' code %i", url, httpCode); + // cl.end(); + return false; + } + + int32_t sz = cl.getSize(); + AddLog(LOG_LEVEL_DEBUG, "BRY: Response http_code %i size %i bytes in %i ms", httpCode, sz, millis() - http_connect_time); + // abort if we exceed 32KB size, things will not go well otherwise + if (sz >= 32767 || sz <= 0) { + AddLog(LOG_LEVEL_DEBUG, "BRY: Response size too big %i bytes", sz); + return false; + } + + // create a bytes object at top of stack. + // the streamwriter knows how to get it. + uint8_t * buf = (uint8_t*) be_pushbytes(vm, nullptr, sz); + StreamBeBytesWriter memory_writer(vm); + int32_t written = cl.writeToStream(&memory_writer); + cl.end(); // free allocated memory ~16KB + + size_t loaded_sz = 0; + const void * loaded_buf = be_tobytes(vm, -1, &loaded_sz); + + FlashFileImplPtr fp = FlashFileImplPtr(new FlashFileImpl(loaded_buf, loaded_sz)); + File * f_ptr = new File(fp); // we need to allocate dynamically because be_close calls `delete` on it + bclosure* loaded_bec = be_bytecode_load_from_fs(vm, f_ptr); + be_pop(vm, 1); + if (loaded_bec != NULL) { + be_pushclosure(vm, loaded_bec); + be_call(vm, 0); + be_pop(vm, 1); + } + be_gc_collect(vm); // force a GC to free the buffer now + return true; +} + #endif // USE_WEBSERVER /*********************************************************************************************\ @@ -821,9 +906,6 @@ bool Xdrv52(uint32_t function) case FUNC_EVERY_100_MSECOND: callBerryEventDispatcher(PSTR("every_100ms"), nullptr, 0, nullptr); break; - case FUNC_EVERY_200_MSECOND: - callBerryEventDispatcher(PSTR("every_200ms"), nullptr, 0, nullptr); - break; case FUNC_EVERY_250_MSECOND: callBerryEventDispatcher(PSTR("every_250ms"), nullptr, 0, nullptr); break; @@ -839,6 +921,9 @@ bool Xdrv52(uint32_t function) XdrvMailbox.index++; } else { WSContentSend_P(HTTP_BTN_BERRY_CONSOLE); +#ifdef USE_BERRY_PARTITION_WIZARD + HandleBerryPartiionWizardLoaderButton(); +#endif // USE_BERRY_PARTITION_WIZARD callBerryEventDispatcher(PSTR("web_add_button"), nullptr, 0, nullptr); callBerryEventDispatcher(PSTR("web_add_console_button"), nullptr, 0, nullptr); } @@ -858,6 +943,9 @@ bool Xdrv52(uint32_t function) berry.web_add_handler_done = true; } WebServer_on(PSTR("/bc"), HandleBerryConsole); +#ifdef USE_BERRY_PARTITION_WIZARD + Webserver->on("/tapp", HTTP_GET, HandleBerryPartitionWizardLoader); +#endif // USE_BERRY_PARTITION_WIZARD break; #endif // USE_WEBSERVER case FUNC_SAVE_BEFORE_RESTART: diff --git a/tasmota/tasmota_xdrv_driver/xdrv_63_modbus_bridge.ino b/tasmota/tasmota_xdrv_driver/xdrv_63_modbus_bridge.ino index 0dea8d1da..c93be3cb5 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_63_modbus_bridge.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_63_modbus_bridge.ino @@ -102,7 +102,7 @@ struct ModbusBridgeTCP }; ModbusBridgeTCP modbusBridgeTCP; -#endif +#endif // USE_MODBUS_BRIDGE_TCP #include TasmotaModbus *modbusBridgeModbus = nullptr; @@ -171,6 +171,7 @@ struct ModbusBridge uint8_t count = 0; // Number of values to read / write bool raw = false; uint8_t *buffer = nullptr; // Buffer for storing read / write data + bool enabled = false; }; ModbusBridge modbusBridge; @@ -193,28 +194,28 @@ void ModbusBridgeAllocError(const char* s) // // Applies serial configuration to modbus serial port // -bool ModbusBridgeBegin(void) -{ - if ((Settings->modbus_sbaudrate < 1) || (Settings->modbus_sbaudrate > (115200 / 300))) +bool ModbusBridgeBegin(void) { + if ((Settings->modbus_sbaudrate < 1) || (Settings->modbus_sbaudrate > (115200 / 300))) { Settings->modbus_sbaudrate = (uint8_t)((uint32_t)MBR_BAUDRATE / 300); - if (Settings->modbus_sconfig > TS_SERIAL_8O2) + } + if (Settings->modbus_sconfig > TS_SERIAL_8O2) { Settings->modbus_sconfig = TS_SERIAL_8N1; + } int result = modbusBridgeModbus->Begin(Settings->modbus_sbaudrate * 300, ConvertSerialConfig(Settings->modbus_sconfig)); // Reinitialize modbus port with new baud rate - if (result) - { - if (2 == result) - { + if (result) { + if (2 == result) { ClaimSerial(); } AddLog(LOG_LEVEL_DEBUG, PSTR("MBS: MBR %s ser init at %d baud"), (2 == result ? "HW" : "SW"), Settings->modbus_sbaudrate * 300); - if (nullptr == modbusBridge.buffer) modbusBridge.buffer = (uint8_t *)malloc(MBR_RECEIVE_BUFFER_SIZE); - if (nullptr == modbusBridge.buffer) - { - ModbusBridgeAllocError(PSTR("BUFFER")); - result = false; - } + if (nullptr == modbusBridge.buffer) { + modbusBridge.buffer = (uint8_t *)malloc(MBR_RECEIVE_BUFFER_SIZE); + } + if (nullptr == modbusBridge.buffer) { + ModbusBridgeAllocError(PSTR("BUFFER")); + result = false; + } } return result; @@ -569,31 +570,29 @@ void ModbusBridgeHandle(void) // // Inits the tasmota modbus driver, sets serialport and if TCP enabled allocates a TCP buffer // -void ModbusBridgeInit(void) -{ - if (PinUsed(GPIO_MBR_RX) && PinUsed(GPIO_MBR_TX)) - { - if (nullptr == modbusBridgeModbus) modbusBridgeModbus = new TasmotaModbus(Pin(GPIO_MBR_RX), Pin(GPIO_MBR_TX), Pin(GPIO_MBR_TX_ENA)); - ModbusBridgeBegin(); +void ModbusBridgeInit(void) { + if (PinUsed(GPIO_MBR_RX) && PinUsed(GPIO_MBR_TX)) { + modbusBridgeModbus = new TasmotaModbus(Pin(GPIO_MBR_RX), Pin(GPIO_MBR_TX), Pin(GPIO_MBR_TX_ENA)); + if (ModbusBridgeBegin()) { + modbusBridge.enabled = true; #ifdef USE_MODBUS_BRIDGE_TCP - // If TCP bridge is enabled allocate a TCP receive buffer - if (nullptr == modbusBridgeTCP.tcp_buf) modbusBridgeTCP.tcp_buf = (uint8_t *)malloc(MODBUS_BRIDGE_TCP_BUF_SIZE); - if (nullptr == modbusBridgeTCP.tcp_buf) - { - ModbusBridgeAllocError(PSTR("TCP")); - return; - } + // If TCP bridge is enabled allocate a TCP receive buffer + if (nullptr == modbusBridgeTCP.tcp_buf) modbusBridgeTCP.tcp_buf = (uint8_t *)malloc(MODBUS_BRIDGE_TCP_BUF_SIZE); + if (nullptr == modbusBridgeTCP.tcp_buf) { + ModbusBridgeAllocError(PSTR("TCP")); + return; + } #ifdef MODBUS_BRIDGE_TCP_DEFAULT_PORT - else - { - AddLog(LOG_LEVEL_INFO, PSTR("MBS: MBRTCP Starting server on port %d"), MODBUS_BRIDGE_TCP_DEFAULT_PORT); + else { + AddLog(LOG_LEVEL_INFO, PSTR("MBS: MBRTCP Starting server on port %d"), MODBUS_BRIDGE_TCP_DEFAULT_PORT); - modbusBridgeTCP.server_tcp = new WiFiServer(MODBUS_BRIDGE_TCP_DEFAULT_PORT); - modbusBridgeTCP.server_tcp->begin(); // start TCP server - modbusBridgeTCP.server_tcp->setNoDelay(true); + modbusBridgeTCP.server_tcp = new WiFiServer(MODBUS_BRIDGE_TCP_DEFAULT_PORT); + modbusBridgeTCP.server_tcp->begin(); // start TCP server + modbusBridgeTCP.server_tcp->setNoDelay(true); + } +#endif // MODBUS_BRIDGE_TCP_DEFAULT_PORT +#endif // USE_MODBUS_BRIDGE_TCP } -#endif -#endif } } @@ -608,9 +607,6 @@ void ModbusTCPHandle(void) bool busy; // did we transfer some data? int32_t buf_len; - if (!modbusBridgeModbus) - return; - // check for a new client connection if ((modbusBridgeTCP.server_tcp) && (modbusBridgeTCP.server_tcp->hasClient())) { @@ -1055,13 +1051,8 @@ void CmndModbusBridgeSetConfig(void) // void CmndModbusTCPStart(void) { - - if (!modbusBridgeModbus) - { - return; - } - int32_t tcp_port = XdrvMailbox.payload; + if (ArgC() == 2) { char sub_string[XdrvMailbox.data_len]; @@ -1109,11 +1100,6 @@ void CmndModbusTCPConnect(void) { int32_t tcp_port = XdrvMailbox.payload; - if (!modbusBridgeModbus) - { - return; - } - if (ArgC() == 2) { char sub_string[XdrvMailbox.data_len]; @@ -1170,23 +1156,19 @@ bool Xdrv63(uint32_t function) { bool result = false; - if (FUNC_PRE_INIT == function) - { + if (FUNC_PRE_INIT == function) { ModbusBridgeInit(); - } - else if (modbusBridgeModbus) - { - switch (function) - { - case FUNC_COMMAND: - result = DecodeCommand(kModbusBridgeCommands, ModbusBridgeCommand); - break; - case FUNC_LOOP: - ModbusBridgeHandle(); + } else if (modbusBridge.enabled) { + switch (function) { + case FUNC_LOOP: + ModbusBridgeHandle(); #ifdef USE_MODBUS_BRIDGE_TCP - ModbusTCPHandle(); + ModbusTCPHandle(); #endif - break; + break; + case FUNC_COMMAND: + result = DecodeCommand(kModbusBridgeCommands, ModbusBridgeCommand); + break; } } return result; diff --git a/tasmota/tasmota_xdrv_driver/xdrv_68_zerocrossDimmer.ino b/tasmota/tasmota_xdrv_driver/xdrv_68_zerocrossDimmer.ino index e1856b5e3..49f6f9cfb 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_68_zerocrossDimmer.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_68_zerocrossDimmer.ino @@ -24,9 +24,6 @@ #define XDRV_68 68 - -#if !defined(ESP32) || (ESP_IDF_VERSION_MAJOR < 5) // temporarily disable for IDF 5.0 - static const uint8_t TRIGGER_PERIOD = 75; #define ZCDIMMERSET_SHOW 1 @@ -64,7 +61,7 @@ void (* const ZCDimmerCommand[])(void) PROGMEM = { &CmndZCDimmerSet//,&CmndZCGateEnableTime }; -void IRAM_ATTR ACDimmerZeroCross(uint32_t time) { +extern "C" void IRAM_ATTR ACDimmerZeroCross(uint32_t time) { ac_zero_cross_dimmer.dimmer_in_use = false; ac_zero_cross_dimmer.cycle_time_us = time - ac_zero_cross_dimmer.crossed_zero_at; ac_zero_cross_dimmer.crossed_zero_at = time; @@ -76,12 +73,6 @@ void IRAM_ATTR ACDimmerZeroCross(uint32_t time) { } } -uint32_t IRAM_ATTR ACDimmerTimer_intr_ESP8266() { - //ACDimmerTimer_intr(); - ACDimmerTimer_intr(); - return ac_zero_cross_dimmer.actual_tigger_Period * 80; -} - void ACDimmerInit() { for (uint8_t i = 0 ; i < 5; i++) { @@ -90,40 +81,7 @@ void ACDimmerInit() } } -void ACDimmerInterruptDisable(bool disable) -{ - AddLog(LOG_LEVEL_INFO, PSTR("ZCD: Zero-CrossDimmer enabled: %d"),!disable); - ac_zero_cross_dimmer.timer_iterrupt_started = !disable; - if (disable) { - //stop the interrupt -#ifdef ESP32 - if (dimmer_timer != nullptr) { - timerAlarmDisable(dimmer_timer); - } -#endif - } else { - for (uint8_t i = 0 ; i < MAX_PWMS; i++) { - if (Pin(GPIO_PWM1, i) != -1) { - pinMode(Pin(GPIO_PWM1, i), OUTPUT); - AddLog(LOG_LEVEL_INFO, PSTR("ZCD: Zero-CrossDimmer Pin %d set"),Pin(GPIO_PWM1, i)); - } - } -#ifdef ESP32 - if (dimmer_timer == nullptr) { - // 80 Divider -> 1 count=1µs - dimmer_timer = timerBegin(0, 80, true); - timerAttachInterrupt(dimmer_timer, &ACDimmerTimer_intr, true); - // For ESP32, we can't use dynamic interval calculation because the timerX functions - // are not callable from ISR (placed in flash storage). - // Here we just use an interrupt firing every 75 µs. - timerAlarmWrite(dimmer_timer, TRIGGER_PERIOD , true); - } - timerAlarmEnable(dimmer_timer); -#endif - } -} - -void IRAM_ATTR ACDimmerTimer_intr() { +extern "C" void IRAM_ATTR ACDimmerTimer_intr() { uint32_t time_since_zc = micros() - ac_zero_cross_dimmer.crossed_zero_at; // If no ZC signal received yet. @@ -165,6 +123,62 @@ void IRAM_ATTR ACDimmerTimer_intr() { } } +#ifdef ESP8266 +extern "C" uint32_t IRAM_ATTR ACDimmerTimer_intr_ESP8266() { + ACDimmerTimer_intr(); + return ac_zero_cross_dimmer.actual_tigger_Period * 80; +} +#endif // ESP8266 + +void ACDimmerInterruptDisable(bool disable) +{ + AddLog(LOG_LEVEL_INFO, PSTR("ZCD: Zero-CrossDimmer enabled: %d"),!disable); + ac_zero_cross_dimmer.timer_iterrupt_started = !disable; + if (disable) { + //stop the interrupt +#ifdef ESP32 + if (dimmer_timer != nullptr) { +#if ( defined(ESP_ARDUINO_VERSION_MAJOR) && (ESP_ARDUINO_VERSION_MAJOR >= 3) ) + timerStop(dimmer_timer); +#else // ESP_ARDUINO_VERSION_MAJOR >= 3 + timerAlarmDisable(dimmer_timer); +#endif // ESP_ARDUINO_VERSION_MAJOR >= 3 + } +#endif + } else { + for (uint8_t i = 0 ; i < MAX_PWMS; i++) { + if (Pin(GPIO_PWM1, i) != -1) { + pinMode(Pin(GPIO_PWM1, i), OUTPUT); + AddLog(LOG_LEVEL_INFO, PSTR("ZCD: Zero-CrossDimmer Pin %d set"),Pin(GPIO_PWM1, i)); + } + } +#ifdef ESP32 +#if ( defined(ESP_ARDUINO_VERSION_MAJOR) && (ESP_ARDUINO_VERSION_MAJOR >= 3) ) + if (dimmer_timer == nullptr) { + dimmer_timer = timerBegin(1000000); // 1 MHz + timerAttachInterrupt(dimmer_timer, &ACDimmerTimer_intr); + // For ESP32, we can't use dynamic interval calculation because the timerX functions + // are not callable from ISR (placed in flash storage). + // Here we just use an interrupt firing every 75 µs. + timerAlarm(dimmer_timer, TRIGGER_PERIOD, true, 0); + } + timerStart(dimmer_timer); +#else // ESP_ARDUINO_VERSION_MAJOR >= 3 + if (dimmer_timer == nullptr) { + // 80 Divider -> 1 count=1µs + dimmer_timer = timerBegin(0, 80, true); + timerAttachInterrupt(dimmer_timer, &ACDimmerTimer_intr, true); + // For ESP32, we can't use dynamic interval calculation because the timerX functions + // are not callable from ISR (placed in flash storage). + // Here we just use an interrupt firing every 75 µs. + timerAlarmWrite(dimmer_timer, TRIGGER_PERIOD , true); + } + timerAlarmEnable(dimmer_timer); +#endif // ESP_ARDUINO_VERSION_MAJOR >= 3 +#endif + } +} + void ACDimmerControllTrigger(void) { #ifdef ESP32 if (ac_zero_cross_dimmer.timer_iterrupt_started != ac_zero_cross_dimmer.dimmer_in_use) { @@ -204,10 +218,15 @@ void ACDimmerLogging(void) bool alarmEnabled = false; uint32_t timercounter = ac_zero_cross_dimmer.intr_counter; -#ifdef ESP32 +#ifdef ESP32 if (dimmer_timer != nullptr) { +#if ( defined(ESP_ARDUINO_VERSION_MAJOR) && (ESP_ARDUINO_VERSION_MAJOR >= 3) ) + alarmEnabled = true; // we assume it's started, there is no API to check whether it's running + timercounter = (uint32_t)timerRead(dimmer_timer); +#else // ESP_ARDUINO_VERSION_MAJOR >= 3 alarmEnabled = timerAlarmEnabled(dimmer_timer); timercounter = (uint32_t)timerRead(dimmer_timer); +#endif // ESP_ARDUINO_VERSION_MAJOR >= 3 } #endif @@ -302,6 +321,4 @@ bool Xdrv68(uint32_t function) return result; } -#endif // !enabled(ESP32) || (ESP_IDF_VERSION_MAJOR < 5) - #endif // USE_AC_ZERO_CROSS_DIMMER diff --git a/tasmota/tasmota_xdrv_driver/xdrv_70_0_hdmi_cec.ino b/tasmota/tasmota_xdrv_driver/xdrv_70_0_hdmi_cec.ino index dcc05fbaa..0581fba71 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_70_0_hdmi_cec.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_70_0_hdmi_cec.ino @@ -1116,7 +1116,7 @@ bool IRAM_ATTR CEC_Device::setLineState(bool state, bool check) // manage callbacks void CEC_Device::OnReady(int logical_address) { - if (_on_rx_cb) { _on_ready_cb(this, logical_address); } + if (_on_ready_cb) { _on_ready_cb(this, logical_address); } // This is called after the logical address has been allocated int physical_address = getPhysicalAddress(); diff --git a/tasmota/tasmota_xdrv_driver/xdrv_70_1_hdmi_cec.ino b/tasmota/tasmota_xdrv_driver/xdrv_70_1_hdmi_cec.ino index 346138199..e77e1a5b0 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_70_1_hdmi_cec.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_70_1_hdmi_cec.ino @@ -284,13 +284,13 @@ uint16_t HDMIGetPhysicalAddress(void) { void CmndHDMIAddr(void) { if (XdrvMailbox.data_len > 0) { - if ((XdrvMailbox.payload < 1)) { + if ((XdrvMailbox.payload > 0)) { uint16_t hdmi_addr = XdrvMailbox.payload; Settings->hdmi_addr[0] = (hdmi_addr) & 0xFF; Settings->hdmi_addr[1] = (hdmi_addr >> 8) & 0xFF; } } - uint16_t hdmi_addr = HDMIGetPhysicalAddress(); + uint16_t hdmi_addr = HDMI_CEC_device->discoverPhysicalAddress(); Response_P(PSTR("{\"%s\":\"0x%04X\"}"), XdrvMailbox.command, hdmi_addr); } diff --git a/tasmota/tasmota_xdrv_driver/xdrv_81_esp32_webcam.ino b/tasmota/tasmota_xdrv_driver/xdrv_81_esp32_webcam.ino index 572dc65d2..541e2c55b 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_81_esp32_webcam.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_81_esp32_webcam.ino @@ -1239,7 +1239,11 @@ void CmndWebcam(void) { void CmndWebcamStream(void) { if ((XdrvMailbox.payload >= 0) && (XdrvMailbox.payload <= 1)) { Settings->webcam_config.stream = XdrvMailbox.payload; - if (!Settings->webcam_config.stream) { WcInterruptControl(); } // Stop stream + if (!Settings->webcam_config.stream) { + WcInterruptControl(); // Stop stream + } else { + WcSetStreamserver(Settings->webcam_config.stream); // Ensure server is running + } } ResponseCmndStateText(Settings->webcam_config.stream); } diff --git a/tasmota/tasmota_xdrv_driver/xdrv_81_esp32_webcam_task.ino b/tasmota/tasmota_xdrv_driver/xdrv_81_esp32_webcam_task.ino index b1acfb724..2b0e637d8 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_81_esp32_webcam_task.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_81_esp32_webcam_task.ino @@ -701,6 +701,7 @@ void WcInterrupt(uint32_t state) { // Stop camera ISR if active to fix TG1WDT_SYS_RESET if (!Wc.up) { return; } + WcSetStreamserver(state); if (state) { // Re-enable interrupts cam_start(); diff --git a/tasmota/tasmota_xnrg_energy/xnrg_07_ade7953.ino b/tasmota/tasmota_xnrg_energy/xnrg_07_ade7953.ino index 1da04c912..526950d1d 100644 --- a/tasmota/tasmota_xnrg_energy/xnrg_07_ade7953.ino +++ b/tasmota/tasmota_xnrg_energy/xnrg_07_ade7953.ino @@ -730,7 +730,7 @@ void Ade7953DrvInit(void) { } } #ifdef USE_ESP32_SPI -#ifdef USE_SHELLY_PRO +#if (defined(USE_SHELLY_PRO) && defined(USE_MCP23XXX_DRV)) || defined(USE_SHELLY_PRO_V2) if (Ade7953.model == ADE7953_SHELLY_PRO_4PM) { ShellyPro4Reset(); } diff --git a/tasmota/tasmota_xsns_sensor/xsns_08_htu21.ino b/tasmota/tasmota_xsns_sensor/xsns_08_htu21.ino index c9b535ffd..311854dcb 100644 --- a/tasmota/tasmota_xsns_sensor/xsns_08_htu21.ino +++ b/tasmota/tasmota_xsns_sensor/xsns_08_htu21.ino @@ -63,6 +63,7 @@ struct { float temperature = 0; float humidity = 0; uint8_t address; + uint8_t bus; uint8_t type = 0; uint8_t delay_temp; uint8_t delay_humidity = 50; @@ -72,8 +73,7 @@ struct { /*********************************************************************************************/ -uint8_t HtuCheckCrc8(uint16_t data) -{ +uint8_t HtuCheckCrc8(uint16_t data) { for (uint32_t bit = 0; bit < 16; bit++) { if (data & 0x8000) { data = (data << 1) ^ HTU21_CRC8_POLYNOM; @@ -84,22 +84,33 @@ uint8_t HtuCheckCrc8(uint16_t data) return data >>= 8; } -uint8_t HtuReadDeviceId(void) -{ - HtuReset(); // Fixes ESP32 sensor loss at restart +bool HtuReset(void) { + TwoWire& myWire = I2cGetWire(Htu.bus); + if (&myWire == nullptr) { return false; } // No valid I2c bus + + myWire.beginTransmission(HTU21_ADDR); + myWire.write(HTU21_RESET); + myWire.endTransmission(); + delay(15); // Reset takes 15ms + return true; +} + +uint8_t HtuReadDeviceId(void) { + if (!HtuReset()) { return 0; }; // Fixes ESP32 sensor loss at restart uint16_t deviceID = 0; uint8_t checksum = 0; - Wire.beginTransmission(HTU21_ADDR); - Wire.write(HTU21_SERIAL2_READ1); - Wire.write(HTU21_SERIAL2_READ2); - Wire.endTransmission(); + TwoWire& myWire = I2cGetWire(Htu.bus); + myWire.beginTransmission(HTU21_ADDR); + myWire.write(HTU21_SERIAL2_READ1); + myWire.write(HTU21_SERIAL2_READ2); + myWire.endTransmission(); - Wire.requestFrom(HTU21_ADDR, 3); - deviceID = Wire.read() << 8; - deviceID |= Wire.read(); - checksum = Wire.read(); + myWire.requestFrom(HTU21_ADDR, 3); + deviceID = myWire.read() << 8; + deviceID |= myWire.read(); + checksum = myWire.read(); if (HtuCheckCrc8(deviceID) == checksum) { deviceID = deviceID >> 8; } else { @@ -108,28 +119,17 @@ uint8_t HtuReadDeviceId(void) return (uint8_t)deviceID; } -void HtuSetResolution(uint8_t resolution) -{ - uint8_t current = I2cRead8(HTU21_ADDR, HTU21_READREG); +void HtuSetResolution(uint8_t resolution) { + uint8_t current = I2cRead8(HTU21_ADDR, HTU21_READREG, Htu.bus); current &= 0x7E; // Replace current resolution bits with 0 current |= resolution; // Add new resolution bits to register - I2cWrite8(HTU21_ADDR, HTU21_WRITEREG, current); + I2cWrite8(HTU21_ADDR, HTU21_WRITEREG, current, Htu.bus); } -void HtuReset(void) -{ - Wire.beginTransmission(HTU21_ADDR); - Wire.write(HTU21_RESET); - Wire.endTransmission(); - delay(15); // Reset takes 15ms -} +void HtuHeater(uint8_t heater) { + uint8_t current = I2cRead8(HTU21_ADDR, HTU21_READREG, Htu.bus); -void HtuHeater(uint8_t heater) -{ - uint8_t current = I2cRead8(HTU21_ADDR, HTU21_READREG); - - switch(heater) - { + switch(heater) { case HTU21_HEATER_ON : current |= heater; break; case HTU21_HEATER_OFF : current &= heater; @@ -137,48 +137,47 @@ void HtuHeater(uint8_t heater) default : current &= heater; break; } - I2cWrite8(HTU21_ADDR, HTU21_WRITEREG, current); + I2cWrite8(HTU21_ADDR, HTU21_WRITEREG, current, Htu.bus); } -void HtuInit(void) -{ +void HtuInit(void) { HtuReset(); HtuHeater(HTU21_HEATER_OFF); HtuSetResolution(HTU21_RES_RH12_T14); } -bool HtuRead(void) -{ +bool HtuRead(void) { uint8_t checksum = 0; uint16_t sensorval = 0; if (Htu.valid) { Htu.valid--; } - Wire.beginTransmission(HTU21_ADDR); - Wire.write(HTU21_READTEMP); - if (Wire.endTransmission() != 0) { return false; } // In case of error + TwoWire& myWire = I2cGetWire(Htu.bus); + myWire.beginTransmission(HTU21_ADDR); + myWire.write(HTU21_READTEMP); + if (myWire.endTransmission() != 0) { return false; } // In case of error delay(Htu.delay_temp); // Sensor time at max resolution - Wire.requestFrom(HTU21_ADDR, 3); - if (3 == Wire.available()) { - sensorval = Wire.read() << 8; // MSB - sensorval |= Wire.read(); // LSB - checksum = Wire.read(); + myWire.requestFrom(HTU21_ADDR, 3); + if (3 == myWire.available()) { + sensorval = myWire.read() << 8; // MSB + sensorval |= myWire.read(); // LSB + checksum = myWire.read(); } if (HtuCheckCrc8(sensorval) != checksum) { return false; } // Checksum mismatch Htu.temperature = ConvertTemp(0.002681f * (float)sensorval - 46.85f); - Wire.beginTransmission(HTU21_ADDR); - Wire.write(HTU21_READHUM); - if (Wire.endTransmission() != 0) { return false; } // In case of error + myWire.beginTransmission(HTU21_ADDR); + myWire.write(HTU21_READHUM); + if (myWire.endTransmission() != 0) { return false; } // In case of error delay(Htu.delay_humidity); // Sensor time at max resolution - Wire.requestFrom(HTU21_ADDR, 3); - if (3 <= Wire.available()) { - sensorval = Wire.read() << 8; // MSB - sensorval |= Wire.read(); // LSB - checksum = Wire.read(); + myWire.requestFrom(HTU21_ADDR, 3); + if (3 <= myWire.available()) { + sensorval = myWire.read() << 8; // MSB + sensorval |= myWire.read(); // LSB + checksum = myWire.read(); } if (HtuCheckCrc8(sensorval) != checksum) { return false; } // Checksum mismatch @@ -201,41 +200,42 @@ bool HtuRead(void) /********************************************************************************************/ -void HtuDetect(void) -{ +void HtuDetect(void) { Htu.address = HTU21_ADDR; - if (!I2cSetDevice(Htu.address)) { return; } + for (Htu.bus = 0; Htu.bus < 2; Htu.bus++) { + if (!I2cSetDevice(Htu.address, Htu.bus)) { continue; } - Htu.type = HtuReadDeviceId(); - if (Htu.type) { - uint8_t index = 0; - HtuInit(); - switch (Htu.type) { - case HTU21_CHIPID: - Htu.delay_temp = 50; - Htu.delay_humidity = 16; - break; - case SI7021_CHIPID: - index++; // 3 - case SI7020_CHIPID: - index++; // 2 - case SI7013_CHIPID: - index++; // 1 - Htu.delay_temp = 12; - Htu.delay_humidity = 23; - break; - default: - index = 4; - Htu.delay_temp = 50; - Htu.delay_humidity = 23; + Htu.type = HtuReadDeviceId(); + if (Htu.type) { + uint8_t index = 0; + HtuInit(); + switch (Htu.type) { + case HTU21_CHIPID: + Htu.delay_temp = 50; + Htu.delay_humidity = 16; + break; + case SI7021_CHIPID: + index++; // 3 + case SI7020_CHIPID: + index++; // 2 + case SI7013_CHIPID: + index++; // 1 + Htu.delay_temp = 12; + Htu.delay_humidity = 23; + break; + default: + index = 4; + Htu.delay_temp = 50; + Htu.delay_humidity = 23; + } + GetTextIndexed(Htu.types, sizeof(Htu.types), index, kHtuTypes); + I2cSetActiveFound(Htu.address, Htu.types, Htu.bus); + break; } - GetTextIndexed(Htu.types, sizeof(Htu.types), index, kHtuTypes); - I2cSetActiveFound(Htu.address, Htu.types); } } -void HtuEverySecond(void) -{ +void HtuEverySecond(void) { if (TasmotaGlobal.uptime &1) { // Every 2 seconds // HTU21: 68mS, SI70xx: 37mS if (!HtuRead()) { @@ -244,8 +244,7 @@ void HtuEverySecond(void) } } -void HtuShow(bool json) -{ +void HtuShow(bool json) { if (Htu.valid) { TempHumDewShow(json, (0 == TasmotaGlobal.tele_period), Htu.types, Htu.temperature, Htu.humidity); } diff --git a/tasmota/tasmota_xsns_sensor/xsns_10_bh1750.ino b/tasmota/tasmota_xsns_sensor/xsns_10_bh1750.ino index 521defe68..6f49bd450 100644 --- a/tasmota/tasmota_xsns_sensor/xsns_10_bh1750.ino +++ b/tasmota/tasmota_xsns_sensor/xsns_10_bh1750.ino @@ -62,6 +62,7 @@ struct { struct { uint8_t address; + uint8_t bus; uint8_t valid = 0; uint8_t mtreg = 69; // Default Measurement Time uint16_t illuminance = 0; @@ -78,29 +79,33 @@ uint8_t Bh1750Resolution(uint32_t sensor_index) { } bool Bh1750SetResolution(uint32_t sensor_index) { - Wire.beginTransmission(Bh1750_sensors[sensor_index].address); - Wire.write(Bh1750.resolution[Bh1750Resolution(sensor_index)]); - return (!Wire.endTransmission()); + TwoWire& myWire = I2cGetWire(Bh1750_sensors[sensor_index].bus); + myWire.beginTransmission(Bh1750_sensors[sensor_index].address); + myWire.write(Bh1750.resolution[Bh1750Resolution(sensor_index)]); + return (!myWire.endTransmission()); } bool Bh1750SetMTreg(uint32_t sensor_index) { - Wire.beginTransmission(Bh1750_sensors[sensor_index].address); + TwoWire& myWire = I2cGetWire(Bh1750_sensors[sensor_index].bus); + if (&myWire == nullptr) { return false; } // No valid I2c bus + myWire.beginTransmission(Bh1750_sensors[sensor_index].address); uint8_t data = BH1750_MEASUREMENT_TIME_HIGH | ((Bh1750_sensors[sensor_index].mtreg >> 5) & 0x07); - Wire.write(data); - if (Wire.endTransmission()) { return false; } - Wire.beginTransmission(Bh1750_sensors[sensor_index].address); + myWire.write(data); + if (myWire.endTransmission()) { return false; } + myWire.beginTransmission(Bh1750_sensors[sensor_index].address); data = BH1750_MEASUREMENT_TIME_LOW | (Bh1750_sensors[sensor_index].mtreg & 0x1F); - Wire.write(data); - if (Wire.endTransmission()) { return false; } + myWire.write(data); + if (myWire.endTransmission()) { return false; } return Bh1750SetResolution(sensor_index); } bool Bh1750Read(uint32_t sensor_index) { if (Bh1750_sensors[sensor_index].valid) { Bh1750_sensors[sensor_index].valid--; } - if (2 != Wire.requestFrom(Bh1750_sensors[sensor_index].address, (uint8_t)2)) { return false; } + TwoWire& myWire = I2cGetWire(Bh1750_sensors[sensor_index].bus); + if (2 != myWire.requestFrom(Bh1750_sensors[sensor_index].address, (uint8_t)2)) { return false; } - float illuminance = (Wire.read() << 8) | Wire.read(); + float illuminance = (myWire.read() << 8) | myWire.read(); illuminance *= 57.5 / (float)Bh1750_sensors[sensor_index].mtreg; // Fix #16022 if (1 == Bh1750Resolution(sensor_index)) { illuminance /= 2; @@ -114,13 +119,17 @@ bool Bh1750Read(uint32_t sensor_index) { /********************************************************************************************/ void Bh1750Detect(void) { - for (uint32_t i = 0; i < sizeof(Bh1750.addresses); i++) { - if (!I2cSetDevice(Bh1750.addresses[i])) { continue; } + for (uint32_t bus = 0; bus < 2; bus++) { + for (uint32_t i = 0; i < sizeof(Bh1750.addresses); i++) { + if (!I2cSetDevice(Bh1750.addresses[i], bus)) { continue; } - Bh1750_sensors[Bh1750.count].address = Bh1750.addresses[i]; - if (Bh1750SetMTreg(Bh1750.count)) { - I2cSetActiveFound(Bh1750_sensors[Bh1750.count].address, Bh1750.types); - Bh1750.count++; + Bh1750_sensors[Bh1750.count].address = Bh1750.addresses[i]; + Bh1750_sensors[Bh1750.count].bus = bus; + if (Bh1750SetMTreg(Bh1750.count)) { + I2cSetActiveFound(Bh1750_sensors[Bh1750.count].address, Bh1750.types, Bh1750_sensors[Bh1750.count].bus); + Bh1750.count++; + if (2 == Bh1750.count) { return; } + } } } } diff --git a/tasmota/tasmota_xsns_sensor/xsns_12_ads1115.ino b/tasmota/tasmota_xsns_sensor/xsns_12_ads1115.ino index 0610ca9d0..11dbda0f9 100644 --- a/tasmota/tasmota_xsns_sensor/xsns_12_ads1115.ino +++ b/tasmota/tasmota_xsns_sensor/xsns_12_ads1115.ino @@ -120,210 +120,190 @@ CONFIG REGISTER #define ADS1115_REG_CONFIG_CQUE_4CONV (0x0002) // Assert ALERT/RDY after four conversions #define ADS1115_REG_CONFIG_CQUE_NONE (0x0003) // Disable the comparator and put ALERT/RDY in high state (default) +uint16_t ads1115_ranges[] = { ADS1115_REG_CONFIG_PGA_6_144V, ADS1115_REG_CONFIG_PGA_4_096V, ADS1115_REG_CONFIG_PGA_2_048V, ADS1115_REG_CONFIG_PGA_1_024V, ADS1115_REG_CONFIG_PGA_0_512V, ADS1115_REG_CONFIG_PGA_0_256V }; +uint8_t ads1115_addresses[] = { ADS1115_ADDRESS_ADDR_GND, ADS1115_ADDRESS_ADDR_VDD, ADS1115_ADDRESS_ADDR_SDA, ADS1115_ADDRESS_ADDR_SCL }; +uint8_t ads1115_count = 0; +uint16_t ads1115_range; +uint8_t ads1115_channels; + struct ADS1115 { - uint8_t count = 0; - uint8_t address; - uint8_t addresses[4] = { ADS1115_ADDRESS_ADDR_GND, ADS1115_ADDRESS_ADDR_VDD, ADS1115_ADDRESS_ADDR_SDA, ADS1115_ADDRESS_ADDR_SCL }; - uint8_t channels; - uint16_t range; - uint8_t found[4] = {false,false,false,false}; - int16_t last_values[4][4] = {{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}; -} Ads1115; + int16_t last_values[4] = { 0,0,0,0 }; + uint8_t address; + uint8_t bus; +} Ads1115[4]; //Ads1115StartComparator(channel, ADS1115_REG_CONFIG_MODE_SINGLE); //Ads1115StartComparator(channel, ADS1115_REG_CONFIG_MODE_CONTIN); -void Ads1115StartComparator(uint8_t channel, uint16_t mode) -{ +void Ads1115StartComparator(uint32_t device, uint8_t channel, uint16_t mode) { // Start with default values uint16_t config = mode | ADS1115_REG_CONFIG_CQUE_NONE | // Comparator enabled and asserts on 1 match ADS1115_REG_CONFIG_CLAT_NONLAT | // Non Latching mode - Ads1115.range | // ADC Input voltage range (Gain) + ads1115_range | // ADC Input voltage range (Gain) ADS1115_REG_CONFIG_CPOL_ACTVLOW | // Alert/Rdy active low (default val) ADS1115_REG_CONFIG_CMODE_TRAD | // Traditional comparator (default val) ADS1115_REG_CONFIG_DR_6000SPS; // 6000 samples per second // Set single-ended or differential input channel - if (Ads1115.channels == ADS1115_SINGLE_CHANNELS) { + if (ads1115_channels == ADS1115_SINGLE_CHANNELS) { config |= (ADS1115_REG_CONFIG_MUX_SINGLE_0 + (0x1000 * channel)); } else { config |= (ADS1115_REG_CONFIG_MUX_DIFF_0_1 + (0x3000 * channel)); } // Write config register to the ADC - I2cWrite16(Ads1115.address, ADS1115_REG_POINTER_CONFIG, config); + I2cWrite16(Ads1115[device].address, ADS1115_REG_POINTER_CONFIG, config, Ads1115[device].bus); } -int16_t Ads1115GetConversion(uint8_t channel) -{ - Ads1115StartComparator(channel, ADS1115_REG_CONFIG_MODE_SINGLE); +int16_t Ads1115GetConversion(uint32_t device, uint8_t channel) { + Ads1115StartComparator(device, channel, ADS1115_REG_CONFIG_MODE_SINGLE); // Wait for the conversion to complete delay(ADS1115_CONVERSIONDELAY); // Read the conversion results - I2cRead16(Ads1115.address, ADS1115_REG_POINTER_CONVERT); + I2cRead16(Ads1115[device].address, ADS1115_REG_POINTER_CONVERT, Ads1115[device].bus); - Ads1115StartComparator(channel, ADS1115_REG_CONFIG_MODE_CONTIN); + Ads1115StartComparator(device, channel, ADS1115_REG_CONFIG_MODE_CONTIN); delay(ADS1115_CONVERSIONDELAY); // Read the conversion results - uint16_t res = I2cRead16(Ads1115.address, ADS1115_REG_POINTER_CONVERT); + uint16_t res = I2cRead16(Ads1115[device].address, ADS1115_REG_POINTER_CONVERT, Ads1115[device].bus); return (int16_t)res; } /********************************************************************************************/ -void Ads1115Detect(void) -{ +void Ads1115Detect(void) { // Set default mode and range - Ads1115.channels = ADS1115_SINGLE_CHANNELS; - Ads1115.range = ADS1115_REG_CONFIG_PGA_6_144V; - - for (uint32_t i = 0; i < sizeof(Ads1115.addresses); i++) { - if (!Ads1115.found[i]) { - Ads1115.address = Ads1115.addresses[i]; - if (!I2cSetDevice(Ads1115.address)) { continue; } + ads1115_channels = ADS1115_SINGLE_CHANNELS; + ads1115_range = ADS1115_REG_CONFIG_PGA_6_144V; + for (uint32_t bus = 0; bus < 2; bus++) { + for (uint32_t i = 0; i < sizeof(ads1115_addresses); i++) { + if (!I2cSetDevice(ads1115_addresses[i], bus)) { continue; } uint16_t buffer; - if (I2cValidRead16(&buffer, Ads1115.address, ADS1115_REG_POINTER_CONVERT) && - I2cValidRead16(&buffer, Ads1115.address, ADS1115_REG_POINTER_CONFIG)) { - Ads1115StartComparator(i, ADS1115_REG_CONFIG_MODE_CONTIN); - I2cSetActiveFound(Ads1115.address, "ADS1115"); - Ads1115.found[i] = 1; - Ads1115.count++; + if (I2cValidRead16(&buffer, ads1115_addresses[i], ADS1115_REG_POINTER_CONVERT, bus) && + I2cValidRead16(&buffer, ads1115_addresses[i], ADS1115_REG_POINTER_CONFIG, bus)) { + Ads1115[ads1115_count].address = ads1115_addresses[i]; + Ads1115[ads1115_count].bus = bus; + Ads1115StartComparator(ads1115_count, 0, ADS1115_REG_CONFIG_MODE_CONTIN); + I2cSetActiveFound(Ads1115[ads1115_count].address, "ADS1115", Ads1115[ads1115_count].bus); + ads1115_count++; + if (4 == ads1115_count) { return; } } } } } -// Create the identifier of the the selected sensor -void Ads1115Label(char* label, uint32_t maxsize, uint8_t address) { - if (1 == Ads1115.count) { - // "ADS1115":{"A0":3240,"A1":3235,"A2":3269,"A3":3269} - snprintf_P(label, maxsize, PSTR("ADS1115")); - } else { +void Ads1115Label(char* label, uint32_t maxsize, uint32_t device) { + // Create the identifier of the the selected sensor + // "ADS1115":{"A0":3240,"A1":3235,"A2":3269,"A3":3269} + snprintf_P(label, maxsize, PSTR("ADS1115")); + if (ads1115_count > 1) { // "ADS1115-48":{"A0":3240,"A1":3235,"A2":3269,"A3":3269},"ADS1115-49":{"A0":3240,"A1":3235,"A2":3269,"A3":3269} - snprintf_P(label, maxsize, PSTR("ADS1115%c%02x"), IndexSeparator(), address); + snprintf_P(label, maxsize, PSTR("%s%c%02X"), label, IndexSeparator(), Ads1115[device].address); +#ifdef ESP32 + if (TasmotaGlobal.i2c_enabled_2) { // Second bus enabled + uint8_t bus = Ads1115[0].bus; + for (uint32_t i = 1; i < ads1115_count; i++) { + if (bus != Ads1115[i].bus) { // Different busses + // "ADS1115-48-1":{"A0":3240,"A1":3235,"A2":3269,"A3":3269},"ADS1115-48-2":{"A0":3240,"A1":3235,"A2":3269,"A3":3269} + snprintf_P(label, maxsize, PSTR("%s%c%d"), label, IndexSeparator(), Ads1115[device].bus +1); + break; + } + } + } +#endif } } #ifdef USE_RULES // Check every 250ms if there are relevant changes in any of the analog inputs // and if so then trigger a message -void AdsEvery250ms(void) -{ +void AdsEvery250ms(void) { int16_t value; - for (uint32_t t = 0; t < sizeof(Ads1115.addresses); t++) { - if (Ads1115.found[t]) { + for (uint32_t t = 0; t < ads1115_count; t++) { + // collect first wich addresses have changed. We can save on rule processing this way + uint32_t changed = 0; + for (uint32_t i = 0; i < ads1115_channels; i++) { + value = Ads1115GetConversion(t, i); - uint8_t old_address = Ads1115.address; - Ads1115.address = Ads1115.addresses[t]; + // Check if value has changed more than 1 percent from last stored value + // we assume that gain is set up correctly, and we could use the whole 16bit result space + if (value >= Ads1115[t].last_values[i] + 327 || value <= Ads1115[t].last_values[i] - 327) { + Ads1115[t].last_values[i] = value; + bitSet(changed, i); + } + } - // collect first wich addresses have changed. We can save on rule processing this way - uint32_t changed = 0; - for (uint32_t i = 0; i < Ads1115.channels; i++) { - value = Ads1115GetConversion(i); - - // Check if value has changed more than 1 percent from last stored value - // we assume that gain is set up correctly, and we could use the whole 16bit result space - if (value >= Ads1115.last_values[t][i] + 327 || value <= Ads1115.last_values[t][i] - 327) { - Ads1115.last_values[t][i] = value; - bitSet(changed, i); + if (changed) { + char label[16]; + Ads1115Label(label, sizeof(label), t); + Response_P(PSTR("{\"%s\":{"), label); + bool first = true; + for (uint32_t i = 0; i < ads1115_channels; i++) { + if (bitRead(changed, i)) { + ResponseAppend_P(PSTR("%s\"A%ddiv10\":%d"), (first) ? "" : ",", i, Ads1115[t].last_values[i]); + first = false; } } - Ads1115.address = old_address; - if (changed) { - char label[15]; - Ads1115Label(label, sizeof(label), Ads1115.addresses[t]); - - Response_P(PSTR("{\"%s\":{"), label); - - bool first = true; - for (uint32_t i = 0; i < Ads1115.channels; i++) { - if (bitRead(changed, i)) { - ResponseAppend_P(PSTR("%s\"A%ddiv10\":%d"), (first) ? "" : ",", i, Ads1115.last_values[t][i]); - first = false; - } - } - ResponseJsonEndEnd(); - - XdrvRulesProcess(0); - } + ResponseJsonEndEnd(); + XdrvRulesProcess(0); } } } #endif // USE_RULES -void Ads1115Show(bool json) -{ +void Ads1115Show(bool json) { int16_t values[4]; - for (uint32_t t = 0; t < sizeof(Ads1115.addresses); t++) { - //AddLog(LOG_LEVEL_INFO, "Logging ADS1115 %02x", Ads1115.addresses[t]); - if (Ads1115.found[t]) { - - uint8_t old_address = Ads1115.address; - Ads1115.address = Ads1115.addresses[t]; - for (uint32_t i = 0; i < Ads1115.channels; i++) { - values[i] = Ads1115GetConversion(i); - //AddLog(LOG_LEVEL_INFO, "Logging ADS1115 %02x (%i) = %i", Ads1115.address, i, values[i] ); - } - Ads1115.address = old_address; - - char label[15]; - Ads1115Label(label, sizeof(label), Ads1115.addresses[t]); - - if (json) { - ResponseAppend_P(PSTR(",\"%s\":{"), label); - for (uint32_t i = 0; i < Ads1115.channels; i++) { - ResponseAppend_P(PSTR("%s\"A%d\":%d"), (0 == i) ? "" : ",", i, values[i]); - } - ResponseJsonEnd(); - } -#ifdef USE_WEBSERVER - else { - for (uint32_t i = 0; i < Ads1115.channels; i++) { - WSContentSend_PD(HTTP_SNS_ANALOG, label, i, values[i]); - } - } -#endif // USE_WEBSERVER + for (uint32_t t = 0; t < ads1115_count; t++) { +// AddLog(LOG_LEVEL_INFO, "Logging ADS1115 %02x", Ads1115[t].address); + for (uint32_t i = 0; i < ads1115_channels; i++) { + values[i] = Ads1115GetConversion(t, i); +// AddLog(LOG_LEVEL_INFO, "Logging ADS1115 %02x (%i) = %i", Ads1115[t].address, i, values[i] ); } + + char label[16]; + Ads1115Label(label, sizeof(label), t); + if (json) { + ResponseAppend_P(PSTR(",\"%s\":{"), label); + for (uint32_t i = 0; i < ads1115_channels; i++) { + ResponseAppend_P(PSTR("%s\"A%d\":%d"), (0 == i) ? "" : ",", i, values[i]); + } + ResponseJsonEnd(); + } +#ifdef USE_WEBSERVER + else { + for (uint32_t i = 0; i < ads1115_channels; i++) { + WSContentSend_PD(HTTP_SNS_ANALOG, label, i, values[i]); + } + } +#endif // USE_WEBSERVER } } -bool ADS1115_Command(void) -{ - const char ds[2][13] = {"Differential","Single ended"}; - const uint16_t r[6] = {6144,4096,2048,1024,512,256}; +bool ADS1115_Command(void) { + // Sensor12 D2 + // Sensor12 S0 if (XdrvMailbox.data_len > 1) { - UpperCase(XdrvMailbox.data,XdrvMailbox.data); + UpperCase(XdrvMailbox.data, XdrvMailbox.data); switch (XdrvMailbox.data[0]) { case 'D': - Ads1115.channels = ADS1115_DIFFERENTIAL_CHANNELS; + ads1115_channels = ADS1115_DIFFERENTIAL_CHANNELS; break; case 'S': - Ads1115.channels = ADS1115_SINGLE_CHANNELS; + ads1115_channels = ADS1115_SINGLE_CHANNELS; } - switch (XdrvMailbox.data[1]) { - case '0': - Ads1115.range = ADS1115_REG_CONFIG_PGA_6_144V; - break; - case '1': - Ads1115.range = ADS1115_REG_CONFIG_PGA_4_096V; - break; - case '2': - Ads1115.range = ADS1115_REG_CONFIG_PGA_2_048V; - break; - case '3': - Ads1115.range = ADS1115_REG_CONFIG_PGA_1_024V; - break; - case '4': - Ads1115.range = ADS1115_REG_CONFIG_PGA_0_512V; - break; - case '5': - Ads1115.range = ADS1115_REG_CONFIG_PGA_0_256V; +// uint32_t range_index = atoi((const char*)XdrvMailbox.data[1]); + uint32_t range_index = atoi((const char*)XdrvMailbox.data +1); + if ((range_index >= 0) && (range_index <= 5)) { + ads1115_range = ads1115_ranges[range_index]; } } - Response_P("{\"ADS1115\":{\"Settings\":\"%c%u\",\"Mode\":\"%s\",\"Range\":%u,\"Unit\":\"mV\"}}",ds[(Ads1115.channels>>1)-1][0],Ads1115.range>>9,ds[(Ads1115.channels>>1)-1],r[Ads1115.range>>9]); + const char ds[2][13] = { "Differential", "Single ended" }; + const uint16_t r[6] = { 6144, 4096, 2048, 1024, 512, 256 }; + Response_P("{\"ADS1115\":{\"Settings\":\"%c%u\",\"Mode\":\"%s\",\"Range\":%u,\"Unit\":\"mV\"}}", + ds[(ads1115_channels>>1)-1][0], ads1115_range>>9, ds[(ads1115_channels>>1)-1], r[ads1115_range>>9]); return true; } @@ -340,7 +320,7 @@ bool Xsns12(uint32_t function) if (FUNC_INIT == function) { Ads1115Detect(); } - else if (Ads1115.count) { + else if (ads1115_count) { switch (function) { #ifdef USE_RULES case FUNC_EVERY_250_MSECOND: diff --git a/tasmota/tasmota_xsns_sensor/xsns_14_sht3x.ino b/tasmota/tasmota_xsns_sensor/xsns_14_sht3x.ino index 24dd17394..daf1b5a1f 100644 --- a/tasmota/tasmota_xsns_sensor/xsns_14_sht3x.ino +++ b/tasmota/tasmota_xsns_sensor/xsns_14_sht3x.ino @@ -34,11 +34,7 @@ #define SHT3X_TYPES 3 // SHT3X, SHTCX and SHT4X #define SHT3X_ADDRESSES 3 // 0x44, 0x45 and 0x70 -enum SHT3X_Types { - SHT3X_TYPE_SHT3X, - SHT3X_TYPE_SHTCX, - SHT3X_TYPE_SHT4X -}; +enum SHT3X_Types { SHT3X_TYPE_SHT3X, SHT3X_TYPE_SHTCX, SHT3X_TYPE_SHT4X }; const char kSht3xTypes[] PROGMEM = "SHT3X|SHTC3|SHT4X"; uint8_t sht3x_addresses[] = { 0x44, 0x45, 0x70 }; @@ -47,6 +43,7 @@ uint8_t sht3x_count = 0; struct SHT3XSTRUCT { uint8_t type; // Sensor type uint8_t address; // I2C bus address + uint8_t bus; char types[6]; // Sensor type name and address, e.g. "SHT3X" } sht3x_sensors[SHT3X_ADDRESSES]; @@ -67,39 +64,42 @@ uint8_t Sht3xComputeCrc(uint8_t data[], uint8_t len) { return crc; } -bool Sht3xRead(uint32_t type, float &t, float &h, uint8_t i2c_address) { - uint8_t data[6]; - +bool Sht3xRead(uint32_t sensor, float &t, float &h) { t = NAN; h = NAN; - Wire.beginTransmission(i2c_address); + TwoWire& myWire = I2cGetWire(sht3x_sensors[sensor].bus); + if (&myWire == nullptr) { return false; } // No valid I2c bus + uint32_t type = sht3x_sensors[sensor].type; + uint8_t i2c_address = sht3x_sensors[sensor].address; + myWire.beginTransmission(i2c_address); switch (type) { case SHT3X_TYPE_SHT3X: // TODO: Clock stretching is used for SHT3x but not for SHTC3. Why? - Wire.write(0x2C); // Enable clock stretching - Wire.write(0x06); // High repeatability measurement + myWire.write(0x2C); // Enable clock stretching + myWire.write(0x06); // High repeatability measurement break; case SHT3X_TYPE_SHTCX: - Wire.write(0x35); // Wake from - Wire.write(0x17); // sleep - Wire.endTransmission(); - Wire.beginTransmission(i2c_address); + myWire.write(0x35); // Wake from + myWire.write(0x17); // sleep + myWire.endTransmission(); + myWire.beginTransmission(i2c_address); // TODO: Clock stretching is used for SHT3x but not for SHTC3. Why? - Wire.write(0x78); // Disable clock stretching - Wire.write(0x66); // Normal mode measurement + myWire.write(0x78); // Disable clock stretching + myWire.write(0x66); // Normal mode measurement break; case SHT3X_TYPE_SHT4X: - Wire.write(0xFD); // High repeatability measurement + myWire.write(0xFD); // High repeatability measurement break; } - if (Wire.endTransmission() != 0) { // Stop I2C transmission + if (myWire.endTransmission() != 0) { // Stop I2C transmission return false; } - delay(30); // Timing verified with logic analyzer (10 is to short) - Wire.requestFrom(i2c_address, (uint8_t)6); // Request 6 bytes of data + delay(30); // Timing verified with logic analyzer (10 is to short) + uint8_t data[6]; + myWire.requestFrom(i2c_address, (uint8_t)6); // Request 6 bytes of data for (uint32_t i = 0; i < 6; i++) { - data[i] = Wire.read(); // temperature (MSB, LSB, CRC), humidity (MSB, LSB, CRC) + data[i] = myWire.read(); // temperature (MSB, LSB, CRC), humidity (MSB, LSB, CRC) }; if ((Sht3xComputeCrc(&data[0], 2) != data[2]) || (Sht3xComputeCrc(&data[3], 2) != data[5])) { return false; @@ -119,15 +119,21 @@ void Sht3xDetect(void) { float t; float h; - for (uint32_t k = 0; k < SHT3X_TYPES; k++) { - sht3x_sensors[sht3x_count].type = k; - for (uint32_t i = 0; i < SHT3X_ADDRESSES; i++) { - if (!I2cSetDevice(sht3x_addresses[i])) { continue; } - sht3x_sensors[sht3x_count].address = sht3x_addresses[i]; - if (Sht3xRead(sht3x_sensors[sht3x_count].type, t, h, sht3x_sensors[sht3x_count].address)) { - GetTextIndexed(sht3x_sensors[sht3x_count].types, sizeof(sht3x_sensors[sht3x_count].types), sht3x_sensors[sht3x_count].type, kSht3xTypes); - I2cSetActiveFound(sht3x_sensors[sht3x_count].address, sht3x_sensors[sht3x_count].types); - sht3x_count++; + for (uint32_t bus = 0; bus < 2; bus++) { + for (uint32_t k = 0; k < SHT3X_TYPES; k++) { + sht3x_sensors[sht3x_count].type = k; + for (uint32_t i = 0; i < SHT3X_ADDRESSES; i++) { + if (!I2cSetDevice(sht3x_addresses[i], bus)) { continue; } + sht3x_sensors[sht3x_count].address = sht3x_addresses[i]; + sht3x_sensors[sht3x_count].bus = bus; + if (Sht3xRead(sht3x_count, t, h)) { + GetTextIndexed(sht3x_sensors[sht3x_count].types, sizeof(sht3x_sensors[sht3x_count].types), sht3x_sensors[sht3x_count].type, kSht3xTypes); + I2cSetActiveFound(sht3x_sensors[sht3x_count].address, sht3x_sensors[sht3x_count].types, sht3x_sensors[sht3x_count].bus); + sht3x_count++; + if (SHT3X_ADDRESSES == sht3x_count) { + return; + } + } } } } @@ -139,7 +145,7 @@ void Sht3xShow(bool json) { char types[11]; for (uint32_t i = 0; i < sht3x_count; i++) { - if (Sht3xRead(sht3x_sensors[i].type, t, h, sht3x_sensors[i].address)) { + if (Sht3xRead(i, t, h)) { t = ConvertTemp(t); h = ConvertHumidity(h); strlcpy(types, sht3x_sensors[i].types, sizeof(types)); diff --git a/tasmota/tasmota_xsns_sensor/xsns_18_pms5003.ino b/tasmota/tasmota_xsns_sensor/xsns_18_pms5003.ino index 9471d9c18..426b6e286 100644 --- a/tasmota/tasmota_xsns_sensor/xsns_18_pms5003.ino +++ b/tasmota/tasmota_xsns_sensor/xsns_18_pms5003.ino @@ -27,6 +27,8 @@ * You can either support PMS3003 or PMS5003-7003 at one time. To enable the PMS3003 support * you must enable the define PMS_MODEL_PMS3003 on your configuration file. * For PMSx003T models that report temperature and humidity define PMS_MODEL_PMS5003T + * This module can also support de Winsen ZH03x series of dust particle sensors, + * To support those sensors, you must define PMS_MODEL_ZH03X in the confuguration file. \*********************************************************************************************/ #define XSNS_18 18 @@ -61,6 +63,15 @@ enum PmsCommands CMD_READ_DATA }; +#ifdef PMS_MODEL_ZH03X +const uint8_t kPmsCommands[][9] PROGMEM = { + // 0 1 2 3 4 5 6 7 8 + {0xFF, 0x01, 0x78, 0x40, 0x00, 0x00, 0x00, 0x00, 0x47}, // pms_set_active_mode + {0xFF, 0x01, 0xA7, 0x01, 0x00, 0x00, 0x00, 0x00, 0x57}, // pms_sleep + {0xFF, 0x01, 0xA7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58}, // pms_wake + {0xFF, 0x01, 0x78, 0x41, 0x00, 0x00, 0x00, 0x00, 0x46}, // pms_set_passive_mode + {0xFF, 0x01, 0x86, 0x00, 0x00, 0x00, 0x00, 0x00, 0x79}}; // pms_passive_mode_read +#else const uint8_t kPmsCommands[][7] PROGMEM = { // 0 1 2 3 4 5 6 {0x42, 0x4D, 0xE1, 0x00, 0x01, 0x01, 0x71}, // pms_set_active_mode @@ -68,12 +79,13 @@ const uint8_t kPmsCommands[][7] PROGMEM = { {0x42, 0x4D, 0xE4, 0x00, 0x01, 0x01, 0x74}, // pms_wake {0x42, 0x4D, 0xE1, 0x00, 0x00, 0x01, 0x70}, // pms_set_passive_mode {0x42, 0x4D, 0xE2, 0x00, 0x00, 0x01, 0x71}}; // pms_passive_mode_read +#endif // PMS_MODEL_ZH03X struct pmsX003data { uint16_t framelen; uint16_t pm10_standard, pm25_standard, pm100_standard; uint16_t pm10_env, pm25_env, pm100_env; -#ifdef PMS_MODEL_PMS3003 +#if defined(PMS_MODEL_PMS3003) || defined(PMS_MODEL_ZH03X) uint16_t reserved1, reserved2, reserved3; #else uint16_t particles_03um, particles_05um, particles_10um, particles_25um; @@ -104,7 +116,7 @@ bool PmsReadData(void) while ((PmsSerial->peek() != 0x42) && PmsSerial->available()) { PmsSerial->read(); } -#ifdef PMS_MODEL_PMS3003 +#if defined(PMS_MODEL_PMS3003) || defined(PMS_MODEL_ZH03X) if (PmsSerial->available() < 24) { #else if (PmsSerial->available() < 32) { @@ -112,7 +124,7 @@ bool PmsReadData(void) return false; } -#ifdef PMS_MODEL_PMS3003 +#if defined(PMS_MODEL_PMS3003) || defined(PMS_MODEL_ZH03X) uint8_t buffer[24]; PmsSerial->readBytes(buffer, 24); #else @@ -122,14 +134,14 @@ bool PmsReadData(void) uint16_t sum = 0; PmsSerial->flush(); // Make room for another burst -#ifdef PMS_MODEL_PMS3003 +#if defined(PMS_MODEL_PMS3003) || defined(PMS_MODEL_ZH03X) AddLogBuffer(LOG_LEVEL_DEBUG_MORE, buffer, 24); #else AddLogBuffer(LOG_LEVEL_DEBUG_MORE, buffer, 32); #endif // PMS_MODEL_PMS3003 // get checksum ready -#ifdef PMS_MODEL_PMS3003 +#if defined(PMS_MODEL_PMS3003) || defined(PMS_MODEL_ZH03X) for (uint32_t i = 0; i < 22; i++) { #else for (uint32_t i = 0; i < 30; i++) { @@ -137,7 +149,7 @@ bool PmsReadData(void) sum += buffer[i]; } // The data comes in endian'd, this solves it so it works on all platforms -#ifdef PMS_MODEL_PMS3003 +#if defined(PMS_MODEL_PMS3003) || defined(PMS_MODEL_ZH03X) uint16_t buffer_u16[12]; for (uint32_t i = 0; i < 12; i++) { #else @@ -147,7 +159,8 @@ bool PmsReadData(void) buffer_u16[i] = buffer[2 + i*2 + 1]; buffer_u16[i] += (buffer[2 + i*2] << 8); } -#ifdef PMS_MODEL_PMS3003 + +#if defined(PMS_MODEL_PMS3003) || defined(PMS_MODEL_ZH03X) if (sum != buffer_u16[10]) { #else if (sum != buffer_u16[14]) { @@ -156,7 +169,7 @@ bool PmsReadData(void) return false; } -#ifdef PMS_MODEL_PMS3003 +#if defined(PMS_MODEL_PMS3003) || defined(PMS_MODEL_ZH03X) memcpy((void *)&pms_data, (void *)buffer_u16, 22); #else memcpy((void *)&pms_data, (void *)buffer_u16, 30); @@ -170,6 +183,60 @@ bool PmsReadData(void) return true; } +#ifdef PMS_MODEL_ZH03X +bool ZH03ReadDataPassive() // process the passive mode response of the ZH03x sensor +{ + if (! PmsSerial->available()) { + return false; + } + while ((PmsSerial->peek() != 0xFF) && PmsSerial->available()) { + PmsSerial->read(); + } + if (PmsSerial->available() < 9) { + return false; + } + uint8_t buffer[9]; + PmsSerial->readBytes(buffer, 9); + if (buffer[1] != 0x86) { + return false; + } + PmsSerial->flush(); // Make room for another burst + + AddLogBuffer(LOG_LEVEL_DEBUG_MORE, buffer, 9); + + uint8_t sum = 0; + for (uint32_t i = 1; i < 7; i++) { + sum += buffer[i]; + } + sum=(~sum)+1; + if (sum != buffer[8]) { + AddLog(LOG_LEVEL_DEBUG, PSTR("ZH03x: " D_CHECKSUM_FAILURE)); + return false; + } + + uint16_t buffer_u16[12]; + for (uint32_t i = 1; i < 4; i++) { + buffer_u16[i] = buffer[i*2 + 1]; + buffer_u16[i] += (buffer[i*2] << 8); + buffer_u16[i+3] = buffer[i*2 + 1]; // Direct and Environment values identical + buffer_u16[i+3] += (buffer[i*2] << 8); // Direct and Environment values identical + buffer_u16[0] = 20; // set dummy framelength + buffer_u16[11] = buffer[8]; // copy checksum + } + + memcpy((void *)&pms_data, (void *)buffer_u16, 22); + + Pms.valid = 10; + + if (!Pms.discovery_triggered) { + TasmotaGlobal.discovery_counter = 1; // Force discovery + Pms.discovery_triggered = true; + } + + return true; + +} +#endif // PMS_MODEL_ZH03X /*********************************************************************************************\ * Command Sensor18 @@ -227,7 +294,18 @@ void PmsSecond(void) // Every second } if (Pms.ready) { +#ifdef PMS_MODEL_ZH03X + bool validread; + if (Settings->pms_wake_interval >= MIN_INTERVAL_PERIOD) { + validread = ZH03ReadDataPassive(); // in passive mode, the response is different from the PMS sensors + } + else { + validread = PmsReadData(); // In active mode the rsponse is identical to the PMS sensors + } + if (validread) { +#else if (PmsReadData()) { +#endif // PMS_MODEL_ZH03X Pms.valid = 10; if (Settings->pms_wake_interval >= MIN_INTERVAL_PERIOD) { PmsSendCmd(CMD_SLEEP); @@ -276,7 +354,10 @@ void PmsInit(void) { void PmsShow(bool json) { if (Pms.valid) { char types[10]; -#ifdef PMS_MODEL_PMS3003 + +#ifdef PMS_MODEL_ZH03X + strcpy_P(types, PSTR("ZH03x")); +#elif defined(PMS_MODEL_PMS3003) strcpy_P(types, PSTR("PMS3003")); #elif defined(PMS_MODEL_PMS5003T) strcpy_P(types, PSTR("PMS5003T")); @@ -294,7 +375,7 @@ void PmsShow(bool json) { types, pms_data.pm10_standard, pms_data.pm25_standard, pms_data.pm100_standard, pms_data.pm10_env, pms_data.pm25_env, pms_data.pm100_env); -#ifndef PMS_MODEL_PMS3003 +#if !(defined(PMS_MODEL_PMS3003) || defined(PMS_MODEL_ZH03X)) ResponseAppend_P(PSTR(",\"PB0.3\":%d,\"PB0.5\":%d,\"PB1\":%d,\"PB2.5\":%d,"), pms_data.particles_03um, pms_data.particles_05um, pms_data.particles_10um, pms_data.particles_25um); #ifdef PMS_MODEL_PMS5003T @@ -321,7 +402,7 @@ void PmsShow(bool json) { WSContentSend_PD(HTTP_SNS_ENVIRONMENTAL_CONCENTRATION, types, "1", pms_data.pm10_env); WSContentSend_PD(HTTP_SNS_ENVIRONMENTAL_CONCENTRATION, types, "2.5", pms_data.pm25_env); WSContentSend_PD(HTTP_SNS_ENVIRONMENTAL_CONCENTRATION, types, "10", pms_data.pm100_env); -#ifndef PMS_MODEL_PMS3003 +#if !(defined(PMS_MODEL_PMS3003) || defined(PMS_MODEL_ZH03X)) WSContentSend_PD(HTTP_SNS_PARTICALS_BEYOND, types, "0.3", pms_data.particles_03um); WSContentSend_PD(HTTP_SNS_PARTICALS_BEYOND, types, "0.5", pms_data.particles_05um); WSContentSend_PD(HTTP_SNS_PARTICALS_BEYOND, types, "1", pms_data.particles_10um); diff --git a/tasmota/tasmota_xsns_sensor/xsns_24_si1145.ino b/tasmota/tasmota_xsns_sensor/xsns_24_si1145.ino index 0f4df82e5..0cdc73a36 100644 --- a/tasmota/tasmota_xsns_sensor/xsns_24_si1145.ino +++ b/tasmota/tasmota_xsns_sensor/xsns_24_si1145.ino @@ -188,27 +188,24 @@ uint16_t si1145_infrared; uint16_t si1145_uvindex; bool si1145_type = false; +uint8_t si1145_bus = 0; uint8_t si1145_valid = 0; /********************************************************************************************/ -uint8_t Si1145ReadByte(uint8_t reg) -{ - return I2cRead8(SI114X_ADDR, reg); +uint8_t Si1145ReadByte(uint8_t reg) { + return I2cRead8(SI114X_ADDR, reg, si1145_bus); } -uint16_t Si1145ReadHalfWord(uint8_t reg) -{ - return I2cRead16LE(SI114X_ADDR, reg); +uint16_t Si1145ReadHalfWord(uint8_t reg) { + return I2cRead16LE(SI114X_ADDR, reg, si1145_bus); } -void Si1145WriteByte(uint8_t reg, uint16_t val) -{ - I2cWrite8(SI114X_ADDR, reg, val); +void Si1145WriteByte(uint8_t reg, uint16_t val) { + I2cWrite8(SI114X_ADDR, reg, val, si1145_bus); } -uint8_t Si1145WriteParamData(uint8_t p, uint8_t v) -{ +uint8_t Si1145WriteParamData(uint8_t p, uint8_t v) { Si1145WriteByte(SI114X_WR, v); Si1145WriteByte(SI114X_COMMAND, p | SI114X_SET); return Si1145ReadByte(SI114X_RD); @@ -324,13 +321,15 @@ bool Si1145Read(void) return true; } -void Si1145Detect(void) -{ - if (!I2cSetDevice(SI114X_ADDR)) { return; } +void Si1145Detect(void) { + for (si1145_bus = 0; si1145_bus < 2; si1145_bus++) { + if (!I2cSetDevice(SI114X_ADDR, si1145_bus)) { continue; } - if (Si1145Begin()) { - si1145_type = true; - I2cSetActiveFound(SI114X_ADDR, "SI1145"); + if (Si1145Begin()) { + si1145_type = true; + I2cSetActiveFound(SI114X_ADDR, "SI1145", si1145_bus); + return; + } } } diff --git a/tasmota/tasmota_xsns_sensor/xsns_26_lm75ad.ino b/tasmota/tasmota_xsns_sensor/xsns_26_lm75ad.ino index b8c271180..502deb515 100644 --- a/tasmota/tasmota_xsns_sensor/xsns_26_lm75ad.ino +++ b/tasmota/tasmota_xsns_sensor/xsns_26_lm75ad.ino @@ -47,31 +47,30 @@ bool lm75ad_type = false; uint8_t lm75ad_address; +uint8_t lm75ad_bus; uint8_t lm75ad_addresses[] = { LM75AD_ADDRESS1, LM75AD_ADDRESS2, LM75AD_ADDRESS3, LM75AD_ADDRESS4, LM75AD_ADDRESS5, LM75AD_ADDRESS6, LM75AD_ADDRESS7, LM75AD_ADDRESS8 }; -void LM75ADDetect(void) -{ - for (uint32_t i = 0; i < sizeof(lm75ad_addresses); i++) { - lm75ad_address = lm75ad_addresses[i]; - if (!I2cSetDevice(lm75ad_address)) { - continue; // do not make the next step without a confirmed device on the bus - } - uint16_t buffer; - if (I2cValidRead16(&buffer, lm75ad_address, LM75_THYST_REGISTER)) { - if (buffer == 0x4B00) { - lm75ad_type = true; - I2cSetActiveFound(lm75ad_address, "LM75AD"); - break; +void LM75ADDetect(void) { + for (lm75ad_bus = 0; lm75ad_bus < 2; lm75ad_bus++) { + for (uint32_t i = 0; i < sizeof(lm75ad_addresses); i++) { + lm75ad_address = lm75ad_addresses[i]; + if (!I2cSetDevice(lm75ad_address, lm75ad_bus)) { continue; } // do not make the next step without a confirmed device on the bus + uint16_t buffer; + if (I2cValidRead16(&buffer, lm75ad_address, LM75_THYST_REGISTER, lm75ad_bus)) { + if (buffer == 0x4B00) { + lm75ad_type = true; + I2cSetActiveFound(lm75ad_address, "LM75AD", lm75ad_bus); + return; + } } } } } -float LM75ADGetTemp(void) -{ +float LM75ADGetTemp(void) { int16_t sign = 1; - uint16_t t = I2cRead16(lm75ad_address, LM75_TEMP_REGISTER); + uint16_t t = I2cRead16(lm75ad_address, LM75_TEMP_REGISTER, lm75ad_bus); if (t & 0x8000) { // we are getting a negative temperature value t = (~t) +0x20; sign = -1; @@ -80,14 +79,13 @@ float LM75ADGetTemp(void) return ConvertTemp(sign * t * 0.125f); } -void LM75ADShow(bool json) -{ +void LM75ADShow(bool json) { float t = LM75ADGetTemp(); if (json) { ResponseAppend_P(JSON_SNS_F_TEMP, "LM75AD", Settings->flag2.temperature_resolution, &t); #ifdef USE_DOMOTICZ - if (0 == TasmotaGlobal.tele_period) DomoticzFloatSensor(DZ_TEMP, t); + if (0 == TasmotaGlobal.tele_period) { DomoticzFloatSensor(DZ_TEMP, t); } #endif // USE_DOMOTICZ #ifdef USE_WEBSERVER } else { diff --git a/tasmota/tasmota_xsns_sensor/xsns_53_sml.ino b/tasmota/tasmota_xsns_sensor/xsns_53_sml.ino index bc3c6e5b5..a1b81c9b3 100755 --- a/tasmota/tasmota_xsns_sensor/xsns_53_sml.ino +++ b/tasmota/tasmota_xsns_sensor/xsns_53_sml.ino @@ -90,6 +90,13 @@ #define SML_OBIS_LINE #endif +#ifdef ESP32 +#ifndef NO_USE_SML_CANBUS +// canbus support +#undef USE_SML_CANBUS +#define USE_SML_CANBUS +#endif +#endif #ifdef USE_SML_TCP_SECURE #define USE_SML_TCP_IP_STR @@ -111,6 +118,27 @@ #include "han_Parser.h" #endif + +#ifdef USE_SML_CANBUS + +#ifdef ESP8266 +// esp8266 uses SPI MPC2515 +#undef SML_CAN_MASKS +#undef SML_CAN_FILTERS +#define SML_CAN_MASKS 2 +#define SML_CAN_FILTERS 6 +#include "mcp2515.h" +#else +// esp32 uses native twai +#undef SML_CAN_MASKS +#undef SML_CAN_FILTERS +#define SML_CAN_MASKS 1 +#define SML_CAN_FILTERS 1 +#include +#include "driver/twai.h" +#endif +#endif // USE_SML_CANBUS + /* special options per meter 1: special binary SML option for meters that use a bit in the status register to sign import or export like ED300L, AS2020 or DTZ541 @@ -151,6 +179,13 @@ time serial pointer is reset to zero on esp32 the uart index may be set, normally it is allocated from 2 down to 0 automatically thus you can combine serial SML with serial script , berry or serial drivers. +8: +on esp32 1 filter mask +on esp8266 2 filter masks + +9: +on esp32 1 filter +on esp8266 6 filters */ //#define MODBUS_DEBUG @@ -479,6 +514,17 @@ struct METER_DESC { #endif // USE_SML_TCP + +#ifdef USE_SML_CANBUS +#ifdef ESP8266 + MCP2515 *mcp2515; +#else + //twai_handle_t *canp; +#endif + uint32_t can_masks[SML_CAN_MASKS]; + uint32_t can_filters[SML_CAN_FILTERS]; +#endif // USE_SML_CANBUS + #ifdef ESP32 int8_t uart_index; #endif @@ -549,6 +595,9 @@ struct SML_GLOBS { struct METER_DESC *mp; uint8_t to_cnt; bool ready; +#ifdef USE_SML_CANBUS + uint8_t twai_installed; +#endif // USE_SML_CANBUS } sml_globs; @@ -694,8 +743,9 @@ void dump2log(void) { //if (!SML_SAVAILABLE) return; if (!sml_globs.log_data) return; + struct METER_DESC *mp = &meter_desc[meter]; + #ifdef USE_SML_DECRYPT - struct METER_DESC *mp = &meter_desc[meter]; if (mp->use_crypt == true) { d_lastms = millis(); while ((millis() - d_lastms) < 50) { @@ -862,6 +912,81 @@ void dump2log(void) { } } break; + #ifdef USE_SML_CANBUS + case 'C': + #ifdef ESP8266 + if (mp->mcp2515 == nullptr) break; + { struct can_frame canFrame; + while (mp->mcp2515->checkReceive()) { + if (mp->mcp2515->readMessage(&canFrame) == MCP2515::ERROR_OK) { + mp->sbuff[0] = canFrame.can_id >> 24; + mp->sbuff[1] = canFrame.can_id >> 16; + mp->sbuff[2] = canFrame.can_id >> 8; + mp->sbuff[3] = canFrame.can_id; + mp->sbuff[4] = canFrame.can_dlc; + for (int i = 0; i < canFrame.can_dlc; i++) { + mp->sbuff[5 + i] = canFrame.data[i]; + } + sml_dump_start(' '); + for (uint8_t index = 0; index < canFrame.can_dlc + 5; index++) { + sprintf(&sml_globs.log_data[sml_globs.sml_logindex], "%02x", mp->sbuff[index]); + sml_globs.sml_logindex += 2; + if (index == 3) { + sml_globs.log_data[sml_globs.sml_logindex] = ':'; + sml_globs.sml_logindex++; + sml_globs.log_data[sml_globs.sml_logindex] = ' '; + sml_globs.sml_logindex++; + } + } + sml_globs.log_data[sml_globs.sml_logindex] = 0; + AddLogData(LOG_LEVEL_INFO, sml_globs.log_data); + } else { + if (mp->mcp2515->checkError()) { + uint8_t errFlags = mp->mcp2515->getErrorFlags(); + mp->mcp2515->clearRXnOVRFlags(); + AddLog(LOG_LEVEL_DEBUG, PSTR("SML CAN: Received error %d"), errFlags); + } + } + } + } + break; +#else + // esp32 native CAN + if (!sml_globs.twai_installed) break; + { + uint32_t alerts_triggered = sml_can_check_alerts(); + + // Check if message is received + if (alerts_triggered & TWAI_ALERT_RX_DATA) { + twai_message_t message; + while (twai_receive(&message, 0) == ESP_OK) { + mp->sbuff[0] = message.identifier >> 24; + mp->sbuff[1] = message.identifier >> 16; + mp->sbuff[2] = message.identifier >> 8; + mp->sbuff[3] = message.identifier; + mp->sbuff[4] = message.data_length_code; + for (int i = 0; i < message.data_length_code; i++) { + mp->sbuff[5 + i] = message.data[i]; + } + sml_dump_start(' '); + for (uint8_t index = 0; index < message.data_length_code + 5; index++) { + sprintf(&sml_globs.log_data[sml_globs.sml_logindex], "%02x", mp->sbuff[index]); + sml_globs.sml_logindex += 2; + if (index == 3) { + sml_globs.log_data[sml_globs.sml_logindex] = ':'; + sml_globs.sml_logindex++; + sml_globs.log_data[sml_globs.sml_logindex] = ' '; + sml_globs.sml_logindex++; + } + } + sml_globs.log_data[sml_globs.sml_logindex] = 0; + AddLogData(LOG_LEVEL_INFO, sml_globs.log_data); + } + } + } + break; +#endif +#endif // USE_SML_CANBUS default: // raw dump d_lastms = millis(); @@ -1212,6 +1337,19 @@ void ebus_esc(uint8_t *ebus_buffer, unsigned char len) { } +// check ebus escapes +uint8_t check_ebus_esc(uint8_t *ebus_buffer, unsigned char len) { + short count,count1; + count1 = 0; + for (count = 0; count < len; count++) { + if (ebus_buffer[count] == EBUS_ESC) { + //found escape + count1++; + } + } + return count1; +} + uint8_t ebus_crc8(uint8_t data, uint8_t crc_init) { uint8_t crc; uint8_t polynom; @@ -1333,6 +1471,7 @@ void sml_shift_in(uint32_t meters, uint32_t shard) { uint32_t timediff = millis() - mp->lastms; if (timediff > mp->tout_ms) { mp->spos = 0; + SML_Decode(meters); AddLog(LOG_LEVEL_DEBUG, PSTR("SML: sync")); } mp->lastms = millis(); @@ -1442,16 +1581,16 @@ void sml_shift_in(uint32_t meters, uint32_t shard) { if (iob == EBUS_SYNC) { // should be end of telegramm // QQ,ZZ,PB,SB,NN ..... CRC, ACK SYNC - if (mp->spos > 4 + 5) { + if (mp->spos > 5 && mp->spos > mp->sbuff[4] + 5) { // get telegramm lenght - uint16_t tlen = mp->sbuff[4] + 5; + uint16_t tlen = mp->sbuff[4] + 5 + check_ebus_esc(mp->sbuff, mp->spos); // test crc - if (mp->sbuff[tlen] = ebus_CalculateCRC(mp->sbuff, tlen)) { - ebus_esc(mp->sbuff, tlen); + if (mp->sbuff[tlen] == ebus_CalculateCRC(mp->sbuff, tlen)) { + ebus_esc(mp->sbuff, mp->spos); SML_Decode(meters); } else { // crc error - //AddLog(LOG_LEVEL_INFO, PSTR("ebus crc error")); + AddLog(LOG_LEVEL_INFO, PSTR("ebus crc error")); } } mp->spos = 0; @@ -1480,6 +1619,7 @@ uint32_t meters; for (meters = 0; meters < sml_globs.meters_used; meters++) { struct METER_DESC *mp = &meter_desc[meters]; + if (mp->type == 'C') continue; if (mp->type != 'c') { if (mp->srcpin != TCP_MODE_FLG) { if (!mp->meter_ss) continue; @@ -1776,7 +1916,7 @@ void SML_Decode(uint8_t index) { } if (sml_globs.mp[mindex].type == 'o' || sml_globs.mp[mindex].type == 'c') { if (*mp++ != *cp++) { - found=0; + found = 0; } } else { if (sml_globs.mp[mindex].type == 's') { @@ -1836,7 +1976,9 @@ void SML_Decode(uint8_t index) { } #endif } - } + } else { + found = 0; + } break; } uint8_t iob; @@ -2184,7 +2326,7 @@ void SML_Decode(uint8_t index) { } else { double dval; char type = sml_globs.mp[mindex].type; - if (type != 'e' && type != 'r' && type != 'R' && type != 'm' && type != 'M' && type != 'k' && type != 'p' && type != 'v') { + if (type != 'C' && type != 'e' && type != 'r' && type != 'R' && type != 'm' && type != 'M' && type != 'k' && type != 'p' && type != 'v') { // get numeric values if (type == 'o' || type == 'c') { if (*mp == '(') { @@ -2209,8 +2351,27 @@ void SML_Decode(uint8_t index) { goto getstr; } dval = CharToDouble((char*)lcp); + } else if (*mp == 's') { + mp++; + char delim = *mp; + mp++; + uint8_t toskip = strtol((char*)mp,(char**)&mp, 10); + mp++; + char *lcp = (char*)cp; + if (toskip) { + char *bp = (char*)cp; + for (uint32_t cnt = 0; cnt < toskip; cnt++) { + bp = strchr(bp, delim); + if (!bp) { + break; + } + bp++; + lcp = bp; + } + } + dval = CharToDouble((char*)lcp); } else { - dval = CharToDouble((char*)cp); + dval = CharToDouble((char*)cp); } } else { dval = sml_getvalue(cp, mindex); @@ -2256,7 +2417,6 @@ void SML_Decode(uint8_t index) { dval = ebus_dval; } } - } #ifdef USE_SML_MEDIAN_FILTER if (sml_globs.mp[mindex].flag & 16) { @@ -2375,11 +2535,9 @@ void SML_Show(boolean json) { tpowstr[i] = *mp++; } tpowstr[i] = 0; -#ifdef USE_WEBSERVER // export html //snprintf_P(b_mqtt_data, sizeof(b_mqtt_data), "%s{s}%s{e}", b_mqtt_data,tpowstr); WSContentSend_PD(PSTR("{s}%s{e}"), tpowstr); -#endif // USE_WEBSERVER // rewind, to ensure strchr mp--; mp = strchr(mp, '|'); @@ -2414,6 +2572,16 @@ void SML_Show(boolean json) { } else { mid = 0; } + } else if (*cp == 's') { + // skip values + if (sml_globs.mp[mindex].type == 'o') { + cp += 2; + strtol((char*)cp,(char**)&cp, 10); + cp++; + goto tststr; + } else { + mid = 0; + } } else if (*cp == 'b') { // bit value #ifdef SML_BIT_TEXT @@ -2493,12 +2661,11 @@ void SML_Show(boolean json) { } } } -#ifdef USE_WEBSERVER + } else { // web ui export //snprintf_P(b_mqtt_data, sizeof(b_mqtt_data), "%s{s}%s %s: {m}%s %s{e}", b_mqtt_data,meter_desc[mindex].prefix,name,tpowstr,unit); if (strcmp(name, "*")) WSContentSend_PD(PSTR("{s}%s %s {m}%s %s{e}"), sml_globs.mp[mindex].prefix, name,tpowstr, unit); -#endif // USE_WEBSERVER } } } @@ -2515,10 +2682,8 @@ void SML_Show(boolean json) { if (!nojson) { ResponseAppend_P(PSTR("}")); } -#ifdef USE_WEBSERVER } else { //WSContentSend_PD(PSTR("%s"),b_mqtt_data); -#endif // USE_WEBSERVER } @@ -2714,6 +2879,32 @@ struct METER_DESC *mp = &meter_desc[mnum]; mp->uart_index = strtol(cp, &cp, 10); #endif // ESP32 break; + +#ifdef USE_SML_CANBUS + case '8': + cp += 2; + for (uint8_t cnt = 0; cnt < SML_CAN_MASKS; cnt++) { + mp->can_masks[cnt] = sml_hex32(cp); + cp += 8; + if (*cp != ',') { + break; + } + cp++; + } + break; + case '9': + cp += 2; + for (uint8_t cnt = 0; cnt < SML_CAN_FILTERS; cnt++) { + mp->can_filters[cnt] = sml_hex32(cp); + cp += 8; + if (*cp != ',') { + break; + } + cp++; + } + break; + +#endif // USE_SML_CANBUS } return cp; } @@ -2797,6 +2988,15 @@ void reset_sml_vars(uint16_t maxmeters) { mp->uart_index = -1; #endif +#ifdef USE_SML_CANBUS + for (uint8_t cnt = 0; cnt < SML_CAN_MASKS; cnt++) { + mp->can_masks[cnt] = 0; + } + for (uint8_t cnt = 0; cnt < SML_CAN_FILTERS; cnt++) { + mp->can_filters[cnt] = 0; + } +#endif // USE_SML_CANBUS + #ifdef USE_SML_DECRYPT if (mp->use_crypt) { if (mp->hp) { @@ -2850,6 +3050,17 @@ void SML_Init(void) { sml_globs.sml_mf = 0; } #endif + +#ifdef USE_SML_CANBUS +#ifdef ESP32 + if (sml_globs.twai_installed) { + twai_stop(); + twai_driver_uninstall(); + sml_globs.twai_installed = false; + } +#endif +#endif // USE_SML_CANBUS + reset_sml_vars(sml_globs.meters_used); } @@ -3176,6 +3387,119 @@ next_line: InjektCounterValue(meters, RtcSettings.pulse_counter[cindex], 0.0); cindex++; } + } else if (mp->type == 'C') { +#ifdef USE_SML_CANBUS + +#ifdef ESP8266 + mp->mcp2515 = nullptr; + if ( PinUsed(GPIO_SPI_MISO) && PinUsed(GPIO_SPI_MOSI) && PinUsed(GPIO_SPI_CLK) ) { + mp->mcp2515 = new MCP2515(mp->srcpin); + if (MCP2515::ERROR_OK != mp->mcp2515->reset()) { + AddLog(LOG_LEVEL_DEBUG, PSTR("SML CAN: Failed to reset module")); + return; + } + + if (MCP2515::ERROR_OK != mp->mcp2515->setBitrate((CAN_SPEED)(mp->params%100), (CAN_CLOCK)(mp->params/100))) { + AddLog(LOG_LEVEL_DEBUG, PSTR("SML CAN: Failed to set module bitrate")); + return; + } + + //attachInterrupt(mp->trxpin, sml_canbus_irq, FALLING); + + if (MCP2515::ERROR_OK != mp->mcp2515->setConfigMode()) { + AddLog(LOG_LEVEL_DEBUG, PSTR("SML CAN: Failed to set config mode")); + } else { + if (mp->can_filters[0]) mp->mcp2515->setFilter(MCP2515::RXF0, true, mp->can_filters[0]); + if (mp->can_filters[1]) mp->mcp2515->setFilter(MCP2515::RXF1, true, mp->can_filters[1]); + if (mp->can_filters[2]) mp->mcp2515->setFilter(MCP2515::RXF2, true, mp->can_filters[2]); + if (mp->can_filters[3]) mp->mcp2515->setFilter(MCP2515::RXF3, true, mp->can_filters[3]); + if (mp->can_filters[4]) mp->mcp2515->setFilter(MCP2515::RXF4, true, mp->can_filters[4]); + if (mp->can_filters[5]) mp->mcp2515->setFilter(MCP2515::RXF5, true, mp->can_filters[5]); + + if (mp->can_masks[0]) mp->mcp2515->setFilterMask(MCP2515::MASK0, true, mp->can_masks[0]); + if (mp->can_masks[1]) mp->mcp2515->setFilterMask(MCP2515::MASK1, true, mp->can_masks[1]); + + } + + if (MCP2515::ERROR_OK != mp->mcp2515->setNormalMode()) { + AddLog(LOG_LEVEL_DEBUG, PSTR("SML CAN: Failed to set normal mode")); + return; + } + + AddLog(LOG_LEVEL_INFO, PSTR("SML CAN: Initialized")); + } else { + AddLog(LOG_LEVEL_DEBUG, PSTR("SML CAN: SPI not configuered")); + } + #else + // Initialize configuration structures using macro initializers + twai_general_config_t g_config = TWAI_GENERAL_CONFIG_DEFAULT((gpio_num_t)mp->trxpin, (gpio_num_t)mp->srcpin, TWAI_MODE_NORMAL); + uint8_t qlen = mp->params/100; + if (qlen < 8) { + qlen = 8; + } + g_config.rx_queue_len = qlen; + twai_timing_config_t t_config; + switch (mp->params%100) { + case 0: + t_config = TWAI_TIMING_CONFIG_25KBITS(); + break; + case 1: + t_config = TWAI_TIMING_CONFIG_50KBITS(); + break; + case 2: + t_config = TWAI_TIMING_CONFIG_100KBITS(); + break; + case 3: + t_config = TWAI_TIMING_CONFIG_125KBITS(); + break; + case 4: + t_config = TWAI_TIMING_CONFIG_250KBITS(); + break; + case 5: + t_config = TWAI_TIMING_CONFIG_500KBITS(); + break; + case 6: + t_config = TWAI_TIMING_CONFIG_800KBITS(); + break; + case 7: + t_config = TWAI_TIMING_CONFIG_1MBITS(); + break; + default: + t_config = TWAI_TIMING_CONFIG_125KBITS(); + break; + } + + twai_filter_config_t f_config = TWAI_FILTER_CONFIG_ACCEPT_ALL(); + + if (mp->can_filters[0]) { + f_config.acceptance_code = mp->can_filters[0] << 3; + f_config.acceptance_mask = mp->can_masks[0] << 3; + f_config.single_filter = true; + } + sml_globs.twai_installed = false; + // Install TWAI driver + if (twai_driver_install(&g_config, &t_config, &f_config) == ESP_OK) { + AddLog(LOG_LEVEL_DEBUG, PSTR("Can driver installed")); + // Start TWAI driver + if (twai_start() == ESP_OK) { + AddLog(LOG_LEVEL_DEBUG, PSTR("Can driver started")); + // Reconfigure alerts to detect frame receive, Bus-Off error and RX queue full states + uint32_t alerts_to_enable = TWAI_ALERT_RX_DATA | TWAI_ALERT_RX_QUEUE_FULL | TWAI_ALERT_TX_IDLE | TWAI_ALERT_TX_SUCCESS | TWAI_ALERT_TX_FAILED | TWAI_ALERT_ERR_PASS | TWAI_ALERT_BUS_ERROR; + if (twai_reconfigure_alerts(alerts_to_enable, NULL) == ESP_OK) { + AddLog(LOG_LEVEL_DEBUG, PSTR("CAN Alerts reconfigured")); + AddLog(LOG_LEVEL_INFO, PSTR("Can driver ready")); + sml_globs.twai_installed = true; + } else { + AddLog(LOG_LEVEL_DEBUG, PSTR("Failed to reconfigure CAN alerts")); + } + } else { + AddLog(LOG_LEVEL_DEBUG, PSTR("Failed to start can driver")); + } + } else { + AddLog(LOG_LEVEL_DEBUG, PSTR("Failed to install can driver")); + } + #endif +#endif // USE_SML_CANBUS } else { // serial input, init if (mp->srcpin == TCP_MODE_FLG) { @@ -3364,7 +3688,9 @@ uint32_t SML_Write(int32_t meter, char *hstr) { meter = abs(meter); if (meter < 1 || meter > sml_globs.meters_used) return 0; meter--; - if (!meter_desc[meter].meter_ss) return 0; + if (meter_desc[meter].type != 'C') { + if (!meter_desc[meter].meter_ss) return 0; + } if (flag > 0) { SML_Send_Seq(meter, hstr); } else { @@ -3444,6 +3770,19 @@ uint32_t sml_getv(uint32_t sel) { return sel; } +uint32_t SML_Shift_Num(uint32_t meter, uint32_t shift) { + struct METER_DESC *mp = &sml_globs.mp[meter]; + if (shift > mp->sbsiz) shift = mp->sbsiz; + for (uint16_t cnt = 0; cnt < shift; cnt++) { + for (uint16_t count = 0; count < mp->sbsiz - 1; count++) { + mp->sbuff[count] = mp->sbuff[count + 1]; + SML_Decode(meter); + } + } + return shift; +} + + double SML_GetVal(uint32_t index) { if (sml_globs.ready == false) return 0; if (index < 1 || index > sml_globs.maxvars) { index = 1;} @@ -3460,7 +3799,9 @@ int32_t SML_Set_WStr(uint32_t meter, char *hstr) { if (sml_globs.ready == false) return 0; if (meter < 1 || meter > sml_globs.meters_used) return -1; meter--; - if (!meter_desc[meter].meter_ss) return -2; + if (meter_desc[meter].type != 'C') { + if (!meter_desc[meter].meter_ss) return -2; + } meter_desc[meter].script_str = hstr; return 0; } @@ -3564,6 +3905,123 @@ uint32_t ctime = millis(); } #ifdef USE_SCRIPT + +#ifdef USE_SML_CANBUS + + +#ifdef ESP32 +#define POLLING_RATE_MS 100 +uint32_t sml_can_check_alerts() { + + uint32_t alerts_triggered; + twai_read_alerts(&alerts_triggered, pdMS_TO_TICKS(POLLING_RATE_MS)); + twai_status_info_t twaistatus; + twai_get_status_info(&twaistatus); + + // Handle alerts + if (alerts_triggered & TWAI_ALERT_ERR_PASS) { + AddLog(LOG_LEVEL_DEBUG, PSTR("Alert: TWAI controller has become error passive.")); + } + if (alerts_triggered & TWAI_ALERT_BUS_ERROR) { + AddLog(LOG_LEVEL_DEBUG, PSTR("Alert: A (Bit, Stuff, CRC, Form, ACK) error has occurred on the bus.")); + AddLog(LOG_LEVEL_DEBUG, PSTR("Bus error count: %d"), twaistatus.bus_error_count); + } + if (alerts_triggered & TWAI_ALERT_RX_QUEUE_FULL) { + AddLog(LOG_LEVEL_DEBUG, PSTR("Alert: The RX queue is full causing a received frame to be lost.")); + AddLog(LOG_LEVEL_DEBUG, PSTR("RX buffered: %d"), twaistatus.msgs_to_rx); + AddLog(LOG_LEVEL_DEBUG, PSTR("RX missed: %d"), twaistatus.rx_missed_count); + AddLog(LOG_LEVEL_DEBUG, PSTR("RX overrun %d"), twaistatus.rx_overrun_count); + } + + if (alerts_triggered & TWAI_ALERT_TX_FAILED) { + AddLog(LOG_LEVEL_DEBUG, PSTR("Alert: The Transmission failed.")); + AddLog(LOG_LEVEL_DEBUG, PSTR("TX buffered: %d"), twaistatus.msgs_to_tx); + AddLog(LOG_LEVEL_DEBUG, PSTR("TX error: %d"), twaistatus.tx_error_counter); + AddLog(LOG_LEVEL_DEBUG, PSTR("TX failed: %d"), twaistatus.tx_failed_count); + } + + if (alerts_triggered & TWAI_ALERT_TX_SUCCESS) { + AddLog(LOG_LEVEL_DEBUG, PSTR("Alert: The Transmission was successful.")); + AddLog(LOG_LEVEL_DEBUG, PSTR("TX buffered: %d"), twaistatus.msgs_to_tx); + } + + return alerts_triggered; +} + +#endif // ESP32 + + +#define SML_CAN_MAX_FRAMES 8 + +void SML_CANBUS_Read() { +#ifdef ESP8266 + struct can_frame canFrame; + + for (uint32_t meter = 0; meter < sml_globs.meters_used; meter++) { + struct METER_DESC *mp = &sml_globs.mp[meter]; + uint8_t nCounter = 0; + + if (mp->type != 'C') continue; + + if (mp->mcp2515 == nullptr) continue; + + while (mp->mcp2515->checkReceive() && nCounter <= SML_CAN_MAX_FRAMES) { + if (mp->mcp2515->readMessage(&canFrame) == MCP2515::ERROR_OK) { + mp->sbuff[0] = canFrame.can_id >> 24; + mp->sbuff[1] = canFrame.can_id >> 16; + mp->sbuff[2] = canFrame.can_id >> 8; + mp->sbuff[3] = canFrame.can_id; + mp->sbuff[4] = canFrame.can_dlc; + for (int i = 0; i < canFrame.can_dlc; i++) { + mp->sbuff[5 + i] = canFrame.data[i]; + } + SML_Decode(meter); + nCounter++; + } else { + if (mp->mcp2515->checkError()) { + uint8_t errFlags = mp->mcp2515->getErrorFlags(); + mp->mcp2515->clearRXnOVRFlags(); + AddLog(LOG_LEVEL_DEBUG, PSTR("SML CAN: Received error %d"), errFlags); + break; + } + } + } + } +#else + + for (uint32_t meter = 0; meter < sml_globs.meters_used; meter++) { + struct METER_DESC *mp = &sml_globs.mp[meter]; + uint8_t nCounter = 0; + + if (mp->type != 'C') continue; + + if (sml_globs.twai_installed) { + uint32_t alerts_triggered = sml_can_check_alerts(); + + // Check if message is received + if (alerts_triggered & TWAI_ALERT_RX_DATA) { + // One or more messages received. Handle all. + twai_message_t message; + while (twai_receive(&message, 0) == ESP_OK) { + mp->sbuff[0] = message.identifier >> 24; + mp->sbuff[1] = message.identifier >> 16; + mp->sbuff[2] = message.identifier >> 8; + mp->sbuff[3] = message.identifier; + mp->sbuff[4] = message.data_length_code; + for (int i = 0; i < message.data_length_code; i++) { + mp->sbuff[5 + i] = message.data[i]; + } + SML_Decode(meter); + } + } + + } + } + +#endif +} +#endif // USE_SML_CANBUS + char *SML_Get_Sequence(char *cp,uint32_t index) { if (!index) return cp; uint32_t cindex = 0; @@ -3584,7 +4042,7 @@ void SML_Check_Send(void) { sml_globs.sml_100ms_cnt++; char *cp; for (uint32_t cnt = sml_globs.sml_desc_cnt; cnt < sml_globs.meters_used; cnt++) { - if (meter_desc[cnt].trxpin >= 0 && meter_desc[cnt].txmem) { + if (meter_desc[cnt].trxpin >= 0 && (meter_desc[cnt].txmem || meter_desc[cnt].script_str)) { //AddLog(LOG_LEVEL_INFO, PSTR("100 ms>> %d - %s - %d"),sml_globs.sml_desc_cnt,meter_desc[cnt].txmem,meter_desc[cnt].tsecs); if ((sml_globs.sml_100ms_cnt >= meter_desc[cnt].tsecs)) { sml_globs.sml_100ms_cnt = 0; @@ -3651,6 +4109,18 @@ uint8_t sml_hexnibble(char chr) { return rVal; } +uint32_t sml_hex32(char *cp) { + uint32_t iob = (sml_hexnibble(*cp++) << 4) | sml_hexnibble(*cp++); + uint32_t result = iob << 24; + iob = (sml_hexnibble(*cp++) << 4) | sml_hexnibble(*cp++); + result |= iob << 16; + iob = (sml_hexnibble(*cp++) << 4) | sml_hexnibble(*cp++); + result |= iob << 8; + iob = (sml_hexnibble(*cp++) << 4) | sml_hexnibble(*cp++); + result |= iob; + return result; +} + typedef struct { uint16_t T_ID; uint16_t P_ID; @@ -3760,6 +4230,8 @@ void SML_Send_Seq(uint32_t meter, char *seq) { rflg = 1; cp++; } + + struct METER_DESC *mp = &meter_desc[meter]; while (*cp) { if (!*cp || !*(cp+1)) break; if (*cp == ',') break; @@ -3769,8 +4241,8 @@ void SML_Send_Seq(uint32_t meter, char *seq) { slen++; if (slen >= sizeof(sbuff)-6) break; // leave space for checksum } - if (meter_desc[meter].type == 'm' || meter_desc[meter].type == 'M' || meter_desc[meter].type == 'k') { - if (meter_desc[meter].type == 'k') { + if (mp->type == 'm' || mp->type == 'M' || mp->type == 'k') { + if (mp->type == 'k') { // kamstrup, append crc, cr *ucp++ = 0; *ucp++ = 0; @@ -3813,12 +4285,12 @@ void SML_Send_Seq(uint32_t meter, char *seq) { } } - if (meter_desc[meter].type == 'o') { + if (mp->type == 'o') { for (uint32_t cnt = 0; cnt < slen; cnt++) { sbuff[cnt] |= (CalcEvenParity(sbuff[cnt]) << 7); } } - if (meter_desc[meter].type == 'p') { + if (mp->type == 'p') { *ucp++ = 0xc0; *ucp++ = 0xa8; *ucp++ = 1; @@ -3828,18 +4300,59 @@ void SML_Send_Seq(uint32_t meter, char *seq) { slen += 6; } - if (meter_desc[meter].srcpin == TCP_MODE_FLG) { + if (mp->srcpin == TCP_MODE_FLG) { sml_tcp_send(meter, sbuff, slen); } else { - if (meter_desc[meter].trx_en.trxen) { - digitalWrite(meter_desc[meter].trx_en.trxenpin, meter_desc[meter].trx_en.trxenpol ^ 1); - } - meter_desc[meter].meter_ss->flush(); - meter_desc[meter].meter_ss->write(sbuff, slen); - if (meter_desc[meter].trx_en.trxen) { - // must wait for all data sent - meter_desc[meter].meter_ss->flush(); - digitalWrite(meter_desc[meter].trx_en.trxenpin, meter_desc[meter].trx_en.trxenpol); + if (mp->type == 'C') { +#ifdef USE_SML_CANBUS +#ifdef ESP8266 + if (mp->mcp2515 != nullptr) { + struct can_frame canMsg; + canMsg.can_id = (uint32_t) (sbuff[0] << 24 | sbuff[1] << 16 | sbuff[2] << 8 | sbuff[3]); + canMsg.can_dlc = sbuff[4]; + for (uint8_t i = 0; i < canMsg.can_dlc; i++) { + canMsg.data[i] = sbuff[i + 5]; + } + mp->mcp2515->sendMessage(&canMsg); + } +#else + if (sml_globs.twai_installed) { + twai_message_t message; + message.identifier = (uint32_t) (sbuff[0] << 24 | sbuff[1] << 16 | sbuff[2] << 8 | sbuff[3]); + message.data_length_code = sbuff[4]; + for (uint8_t i = 0; i < message.data_length_code; i++) { + message.data[i] = sbuff[i + 5]; + } + + message.flags = 0; + if (message.identifier & 0x80000000) { + message.extd = 1; + message.identifier &= 0x7fffffff; + } + + twai_clear_receive_queue(); + + // Queue message for transmission + if (twai_transmit(&message, pdMS_TO_TICKS(100)) == ESP_OK) { + AddLog(LOG_LEVEL_DEBUG, PSTR("Can message queued for transmission")); + } else { + AddLog(LOG_LEVEL_DEBUG, PSTR("Failed to queue can message for transmission")); + } + } +#endif +#endif // USE_SML_CANBUS + } else { + if (mp->trx_en.trxen) { + digitalWrite(meter_desc[meter].trx_en.trxenpin, meter_desc[meter].trx_en.trxenpol ^ 1); + } + mp->meter_ss->flush(); + mp->meter_ss->write(sbuff, slen); + if (mp->trx_en.trxen) { + // must wait for all data sent + mp->meter_ss->flush(); + digitalWrite(mp->trx_en.trxenpin, mp->trx_en.trxenpol); + } + } } @@ -3848,14 +4361,14 @@ void SML_Send_Seq(uint32_t meter, char *seq) { Hexdump(sbuff, slen); #else uint8_t type = sml_globs.mp[(sml_globs.dump2log&7) - 1].type; - if (type == 'm' || type == 'M' || type == 'k') { + if (type == 'm' || type == 'M' || type == 'k' || type == 'C') { Hexdump(sbuff, slen); } #endif } #ifdef MODBUS_DEBUG - uint8_t type = meter_desc[meter].type; + uint8_t type = mp->type; if (!sml_globs.dump2log && (type == 'm' || type == 'M' || type == 'k')) { AddLog(LOG_LEVEL_INFO, PSTR("transmit index >> %d"),sml_globs.mp[meter].index); Hexdump(sbuff, slen); @@ -4051,6 +4564,9 @@ bool Xsns53(uint32_t function) { dump2log(); } else { SML_Poll(); +#ifdef USE_SML_CANBUS + SML_CANBUS_Read(); +#endif// USE_SML_CANBUS } } } diff --git a/tasmota/tasmota_xsns_sensor/xsns_57_tsl2591.ino b/tasmota/tasmota_xsns_sensor/xsns_57_tsl2591.ino index 57d70f992..37f456bea 100644 --- a/tasmota/tasmota_xsns_sensor/xsns_57_tsl2591.ino +++ b/tasmota/tasmota_xsns_sensor/xsns_57_tsl2591.ino @@ -39,6 +39,9 @@ uint8_t tsl2591_type = 0; uint8_t tsl2591_valid = 0; float tsl2591_lux = 0; +tsl2591Gain_t gain_enum_array[4] = {TSL2591_GAIN_LOW,TSL2591_GAIN_MED,TSL2591_GAIN_HIGH,TSL2591_GAIN_MAX}; +tsl2591IntegrationTime_t int_enum_array[6] = {TSL2591_INTEGRATIONTIME_100MS,TSL2591_INTEGRATIONTIME_200MS,TSL2591_INTEGRATIONTIME_300MS,TSL2591_INTEGRATIONTIME_400MS,TSL2591_INTEGRATIONTIME_500MS,TSL2591_INTEGRATIONTIME_600MS}; + void Tsl2591Init(void) { // if (I2cSetDevice(0x29) || I2cSetDevice(0x39) || I2cSetDevice(0x49)) { @@ -90,6 +93,26 @@ void Tsl2591Show(bool json) } } +bool tsl2591CommandSensor() { + bool serviced = true; + char argument[XdrvMailbox.data_len]; + long value = 0; + + for (uint32_t ca = 0; ca < XdrvMailbox.data_len; ca++) { + if ((' ' == XdrvMailbox.data[ca]) || ('=' == XdrvMailbox.data[ca])) { XdrvMailbox.data[ca] = ','; } + } + + bool any_value = (strchr(XdrvMailbox.data, ',') != nullptr); + if (any_value) { value = strtol(ArgV(argument, 2), nullptr, 10); } + + tsl.setGain(gain_enum_array[XdrvMailbox.payload-1]); + tsl.setTiming(int_enum_array[value-1]); + + Response_P(PSTR("{\"Gain input\":%d,\"Gain hex\":0x%x,"),XdrvMailbox.payload,tsl.getGain()); + ResponseAppend_P(PSTR("\"Timing input\":%d,\"Timing hex\":0x0%x}"),value,tsl.getTiming()); + return serviced; +} + /*********************************************************************************************\ * Interface \*********************************************************************************************/ @@ -116,6 +139,11 @@ bool Xsns57(uint32_t function) Tsl2591Show(0); break; #endif // USE_WEBSERVER + case FUNC_COMMAND_SENSOR: + if (XSNS_57 == XdrvMailbox.index) { + result = tsl2591CommandSensor(); + } + break; } } return result; diff --git a/tasmota/tasmota_xsns_sensor/xsns_62_esp32_mi.ino b/tasmota/tasmota_xsns_sensor/xsns_62_esp32_mi.ino index 9a9d07a3f..c10a559c7 100644 --- a/tasmota/tasmota_xsns_sensor/xsns_62_esp32_mi.ino +++ b/tasmota/tasmota_xsns_sensor/xsns_62_esp32_mi.ino @@ -61,8 +61,15 @@ #define XSNS_62 62 #include +// undefine "trash" from the NimBLE stack, that collides with Tasmotas enum +#undef LOG_LEVEL_DEBUG +#undef LOG_LEVEL_NONE +#undef LOG_LEVEL_ERROR +#undef LOG_LEVEL_INFO +#undef LOG_LEVEL_DEBUG +#undef LOG_LEVEL_DEBUG_MORE #include -#include +#include "freertos/ringbuf.h" #include @@ -73,11 +80,11 @@ void MI32notifyCB(NimBLERemoteCharacteristic* pRemoteCharacteristic, uint8_t* pD void MI32AddKey(mi_bindKey_t keyMAC); std::vector MIBLEsensors; - +RingbufHandle_t BLERingBufferQueue = nullptr; static BLEScan* MI32Scan; /*********************************************************************************************\ - * Classes + * Callback Classes \*********************************************************************************************/ class MI32SensorCallback : public NimBLEClientCallbacks { @@ -94,22 +101,10 @@ class MI32SensorCallback : public NimBLEClientCallbacks { MI32.mode.triggerBerryConnCB = 1; //mainly for unexpected or requested disconnects //AddLog(LOG_LEVEL_DEBUG,PSTR("disconnected")); } - bool onConnParamsUpdateRequest(NimBLEClient* MI32Client, const ble_gap_upd_params* params) { - if(params->itvl_min < 24) { /** 1.25ms units */ - return false; - } else if(params->itvl_max > 40) { /** 1.25ms units */ - return false; - } else if(params->latency > 2) { /** Number of intervals allowed to skip */ - return false; - } else if(params->supervision_timeout > 100) { /** 10ms units */ - return false; - } - return true; - } }; class MI32AdvCallbacks: public NimBLEScanCallbacks { - void onResult(NimBLEAdvertisedDevice* advertisedDevice) { + void IRAM_ATTR onResult(NimBLEAdvertisedDevice* advertisedDevice) { static bool _mutex = false; if(_mutex) return; _mutex = true; @@ -152,24 +147,26 @@ class MI32AdvCallbacks: public NimBLEScanCallbacks { }; }; -static std::queue BLEmessageQueue; - class MI32ServerCallbacks: public NimBLEServerCallbacks { void onConnect(NimBLEServer* pServer, NimBLEConnInfo& connInfo) { - BLEqueueBuffer_t q; - q.length = 6; - q.type = BLE_OP_ON_CONNECT; - q.buffer = new uint8_t[q.length]; - memcpy(q.buffer,connInfo.getAddress().getNative(),6); // return MAC address in the queue buffer - BLEmessageQueue.push(q); + struct{ + BLERingBufferItem_t header; + uint8_t buffer[6]; + } item; + item.header.length = 6; + item.header.type = BLE_OP_ON_CONNECT; + memcpy(item.buffer,connInfo.getAddress().getNative(),6); + xRingbufferSend(BLERingBufferQueue, (const void*)&item, sizeof(BLERingBufferItem_t) + 6 , pdMS_TO_TICKS(1)); MI32.infoMsg = MI32_SERV_CLIENT_CONNECTED; }; void onDisconnect(NimBLEServer* pServer, NimBLEConnInfo& connInfo, int reason) { - BLEqueueBuffer_t q; - q.length = 0; - q.type = BLE_OP_ON_DISCONNECT; + struct{ + BLERingBufferItem_t header; + } item; + item.header.length = 0; + item.header.type = BLE_OP_ON_DISCONNECT; memset(MI32.conCtx->MAC,0,6); - BLEmessageQueue.push(q); + xRingbufferSend(BLERingBufferQueue, (const void*)&item, sizeof(BLERingBufferItem_t), pdMS_TO_TICKS(1)); MI32.infoMsg = MI32_SERV_CLIENT_DISCONNECTED; NimBLEDevice::startAdvertising(); }; @@ -177,45 +174,53 @@ class MI32ServerCallbacks: public NimBLEServerCallbacks { class MI32CharacteristicCallbacks: public NimBLECharacteristicCallbacks { void onRead(NimBLECharacteristic* pCharacteristic, NimBLEConnInfo& connInfo){ - BLEqueueBuffer_t q; - q.length = 0; - q.type = BLE_OP_ON_READ; - q.returnCharUUID = pCharacteristic->getUUID().getNative()->u16.value; - q.handle = pCharacteristic->getHandle(); - BLEmessageQueue.push(q); + struct{ + BLERingBufferItem_t header; + } item; + item.header.length = 0; + item.header.type = BLE_OP_ON_READ; + item.header.returnCharUUID = pCharacteristic->getUUID().getNative()->u16.value; + item.header.handle = pCharacteristic->getHandle(); + xRingbufferSend(BLERingBufferQueue, (const void*)&item, sizeof(BLERingBufferItem_t), pdMS_TO_TICKS(1)); }; void onWrite(NimBLECharacteristic* pCharacteristic, NimBLEConnInfo& connInfo) { - BLEqueueBuffer_t q; - q.type = BLE_OP_ON_WRITE; - q.returnCharUUID = pCharacteristic->getUUID().getNative()->u16.value; - q.handle = pCharacteristic->getHandle(); - q.length = pCharacteristic->getDataLength(); - q.buffer = new uint8_t[q.length]; - memcpy(q.buffer,pCharacteristic->getValue(),pCharacteristic->getDataLength()); - BLEmessageQueue.push(q); + struct{ + BLERingBufferItem_t header; + uint8_t buffer[255]; + } item; + item.header.length = pCharacteristic->getDataLength();; + item.header.type = BLE_OP_ON_WRITE; + item.header.returnCharUUID = pCharacteristic->getUUID().getNative()->u16.value; + item.header.handle = pCharacteristic->getHandle(); + memcpy(item.buffer,pCharacteristic->getValue(),pCharacteristic->getDataLength()); + xRingbufferSend(BLERingBufferQueue, (const void*)&item, sizeof(BLERingBufferItem_t) + item.header.length , pdMS_TO_TICKS(1)); }; /** The status returned in status is defined in NimBLECharacteristic.h. * The value returned in code is the NimBLE host return code. */ void onStatus(NimBLECharacteristic* pCharacteristic, int code) { - BLEqueueBuffer_t q; - q.length = 0; - q.type = BLE_OP_ON_STATUS; - q.returnCharUUID = pCharacteristic->getUUID().getNative()->u16.value; - q.handle = pCharacteristic->getHandle(); - q.value = code; - BLEmessageQueue.push(q); + struct{ + BLERingBufferItem_t header; + uint8_t buffer[4]; + } item; + item.header.length = 4; + item.header.type = BLE_OP_ON_STATUS; + item.header.returnCharUUID = pCharacteristic->getUUID().getNative()->u16.value; + item.header.handle = pCharacteristic->getHandle(); + xRingbufferSend(BLERingBufferQueue, (const void*)&item, sizeof(BLERingBufferItem_t) + 4, pdMS_TO_TICKS(1)); }; void onSubscribe(NimBLECharacteristic* pCharacteristic, NimBLEConnInfo& connInfo, uint16_t subValue) { - BLEqueueBuffer_t q; - q.length = 0; - q.type = BLE_OP_ON_UNSUBSCRIBE + subValue; - q.returnCharUUID = pCharacteristic->getUUID().getNative()->u16.value; - q.handle = pCharacteristic->getHandle(); - BLEmessageQueue.push(q); + struct{ + BLERingBufferItem_t header; + } item; + item.header.length = 0; + item.header.type = BLE_OP_ON_UNSUBSCRIBE + subValue;; + item.header.returnCharUUID = pCharacteristic->getUUID().getNative()->u16.value; + item.header.handle = pCharacteristic->getHandle(); + xRingbufferSend(BLERingBufferQueue, (const void*)&item, sizeof(BLERingBufferItem_t), pdMS_TO_TICKS(1)); }; }; @@ -224,7 +229,6 @@ static MI32AdvCallbacks MI32ScanCallbacks; static MI32SensorCallback MI32SensorCB; static MI32CharacteristicCallbacks MI32ChrCallback; static NimBLEClient* MI32Client; -static std::queue MI32NotificationQueue; /*********************************************************************************************\ * BLE callback functions @@ -237,15 +241,19 @@ void MI32scanEndedCB(NimBLEScanResults results){ void MI32notifyCB(NimBLERemoteCharacteristic* pRemoteCharacteristic, uint8_t* pData, size_t length, bool isNotify){ if(isNotify){ - MI32notificationBuffer_t _buf; - _buf.buffer[0] = (uint8_t)length; - memcpy(_buf.buffer+1, pData, length); - _buf.returnCharUUID = pRemoteCharacteristic->getUUID().getNative()->u16.value; - MI32NotificationQueue.push(_buf); + struct{ + BLERingBufferItem_t header; + uint8_t buffer[255]; + } item; + item.header.length = length; + // item.header.type = 103; does not matter for now + memcpy(item.buffer,pData,length); + item.header.returnCharUUID = pRemoteCharacteristic->getUUID().getNative()->u16.value; + item.header.handle = pRemoteCharacteristic->getHandle(); + xRingbufferSend(BLERingBufferQueue, (const void*)&item, sizeof(BLERingBufferItem_t) + length , pdMS_TO_TICKS(1)); MI32.mode.readingDone = 1; - MI32.mode.triggerBerryConnCB = 1; MI32.infoMsg = MI32_GOT_NOTIFICATION; - return; // do not discard data + return; } } /*********************************************************************************************\ @@ -271,9 +279,9 @@ void MI32stripColon(char* _string){ } /** - * @brief Convert string that repesents a hexadecimal number to a byte array + * @brief Convert string that represents a hexadecimal number to a byte array * - * @param _string input string in format: AABBCCDDEEFF or AA:BB:CC:DD:EE:FF, caseinsensitive + * @param _string input string in format: AABBCCDDEEFF or AA:BB:CC:DD:EE:FF, case insensitive * @param _mac target byte array must match the correct size (i.e. AA:BB -> uint8_t bytes[2]) */ @@ -298,7 +306,7 @@ void MI32HexStringToBytes(char* _string, uint8_t* _byteArray) { /** * @brief Reverse an array of 6 bytes * - * @param _mac a byte array of size 6 (typicalliy representing a MAC address) + * @param _mac a byte array of size 6 (typically representing a MAC address) */ void MI32_ReverseMAC(uint8_t _mac[]){ uint8_t _reversedMAC[6]; @@ -1011,6 +1019,7 @@ void MI32resumeScanTask(void){ void MI32StartTask(uint32_t task){ if (MI32.mode.willConnect == 1) return; // we are in the middle of connecting to something ... do not interrupt this. + MI32.role = 0; switch(task){ case MI32_TASK_SCAN: if (MI32.mode.connected == 1) return; @@ -1037,6 +1046,7 @@ void MI32StartScanTask(){ if(MI32.ScanTask!=nullptr) vTaskDelete(MI32.ScanTask); MI32.mode.runningScan = 1; MI32.mode.deleteScanTask = 0; + MI32.role = 1; xTaskCreatePinnedToCore( MI32ScanTask, /* Function to implement the task */ "MI32ScanTask", /* Name of the task */ @@ -1127,13 +1137,71 @@ bool MI32ConnectActiveSensor(){ // only use inside a task !! return true; } +/** + * @brief Retrieves all services of the connected BLE device and stores the result into the transfer buffer of Berry's BLE module +* buffer format: + * first byte: number of services + * next byte: format of the UUID in bits, next N bytes: the UUID as 16-bit-uint or uint8_t buffer of 16 bytes + * ... next service + */ +void MI32ConnectionGetServices(){ + std::vector *srvvector = MI32Client->getServices(true); // refresh + MI32.conCtx->buffer[1] = srvvector->size(); // number of services + uint32_t i = 2; + for (auto &srv: *srvvector) { + MI32.conCtx->buffer[i] = srv->getUUID().bitSize(); // 16/128 bit + if(MI32.conCtx->buffer[i] == 16){ + MI32.conCtx->buffer[i+1] = srv->getUUID().getNative()->u16.value & 0xff; + MI32.conCtx->buffer[i+2] = srv->getUUID().getNative()->u16.value >> 8; + } + else{ + memcpy((MI32.conCtx->buffer)+i+1,srv->getUUID().getNative()->u128.value,MI32.conCtx->buffer[i]); // the UUID + } + i += 1 + (MI32.conCtx->buffer[i]/8); + } + MI32.conCtx->buffer[0] = i; +} + +/** + * @brief Retrieves all characteristics of the given service and stores the result into the transfer buffer of Berry's BLE module + * buffer format: + * first byte: number of characteristics + * next byte: format of the UUID in bits, next N bytes: the UUID as 16-bit-uint or uint8_t buffer of 16 bytes + * next byte: properties in a bitfield + * ... next characteristic + * + * @param pSvc + */ +void MI32ConnectionGetCharacteristics(NimBLERemoteService* pSvc); +void MI32ConnectionGetCharacteristics(NimBLERemoteService* pSvc){ + std::vector *charvector = pSvc->getCharacteristics(true); // refresh + MI32.conCtx->buffer[1] = charvector->size(); // number of characteristics + uint32_t i = 2; + for (auto &chr: *charvector) { + MI32.conCtx->buffer[i] = chr->getUUID().bitSize(); // 16/128 bit + if(MI32.conCtx->buffer[i] == 16){ + MI32.conCtx->buffer[i+1] = chr->getUUID().getNative()->u16.value & 0xff; + MI32.conCtx->buffer[i+2] = chr->getUUID().getNative()->u16.value >> 8; + } + else{ + memcpy((MI32.conCtx->buffer)+i+1,chr->getUUID().getNative()->u128.value,MI32.conCtx->buffer[i]); // the UUID + } + i += 1 + (MI32.conCtx->buffer[i]/8); + MI32.conCtx->buffer[i] = chr->getProperties(); // flags as bitfield + MI32.conCtx->buffer[i+1] = chr->getHandle() & 0xff; + MI32.conCtx->buffer[i+2] = chr->getHandle() >> 8; + i += 3; + } + MI32.conCtx->buffer[0] = i; +} + bool MI32StartConnectionTask(){ if(MI32.conCtx == nullptr) return false; if(MI32.conCtx->buffer == nullptr) return false; - MI32NotificationQueue = {}; MI32.mode.willConnect = 1; MI32Scan->stop(); MI32suspendScanTask(); + MI32.role = 2; xTaskCreatePinnedToCore( MI32ConnectionTask, /* Function to implement the task */ "MI32ConnectionTask", /* Name of the task */ @@ -1173,6 +1241,7 @@ void MI32ConnectionTask(void *pvParameters){ } NimBLERemoteService* pSvc = nullptr; NimBLERemoteCharacteristic* pChr = nullptr; + std::vector*charvector = nullptr; // AddLog(LOG_LEVEL_INFO,PSTR("M32: start connection loop")); bool keepConnectionAlive = true; @@ -1193,12 +1262,26 @@ void MI32ConnectionTask(void *pvParameters){ MI32Client->disconnect(); break; } - pSvc = MI32Client->getService(MI32.conCtx->serviceUUID); - if(pSvc) { - pChr = pSvc->getCharacteristic(MI32.conCtx->charUUID); + + if(MI32.conCtx->operation == 6){ // get remote services to Berry + MI32ConnectionGetServices(); } else{ - MI32.conCtx->error = MI32_CONN_NO_SERVICE; + pSvc = MI32Client->getService(MI32.conCtx->serviceUUID); + } + + if(pSvc) { + if(MI32.conCtx->operation == 7){ // get remote characteristics to Berry + MI32ConnectionGetCharacteristics(pSvc); + } + else{ + pChr = pSvc->getCharacteristic(MI32.conCtx->charUUID); + } + } + else{ + if(MI32.conCtx->operation != 6){ + MI32.conCtx->error = MI32_CONN_NO_SERVICE; + } } if (pChr){ switch(MI32.conCtx->operation){ @@ -1228,13 +1311,22 @@ void MI32ConnectionTask(void *pvParameters){ MI32.mode.readingDone = 1; break; case 3: - if(pChr->canNotify()) { - if(pChr->subscribe(true,MI32notifyCB, MI32.conCtx->response)){ - // AddLog(LOG_LEVEL_DEBUG,PSTR("M32: subscribe")); + if (BLERingBufferQueue == nullptr){ + BLERingBufferQueue = xRingbufferCreate(2048, RINGBUF_TYPE_NOSPLIT); + if(!BLERingBufferQueue) { + MI32.conCtx->error = MI32_CONN_CAN_NOT_NOTIFY; + break; } } - else{ - MI32.conCtx->error = MI32_CONN_CAN_NOT_NOTIFY; + charvector = pSvc->getCharacteristics(true); // always try to subscribe to all characteristics with the same UUID + for (auto &it: *charvector) { + if (it->getUUID() == MI32.conCtx->charUUID) { + if (it->canNotify()) { + if(!it->subscribe(true, MI32notifyCB, MI32.conCtx->response)) { + MI32.conCtx->error = MI32_CONN_CAN_NOT_NOTIFY; // will return the last result only ATM, maybe check differently + } + } + } } break; default: @@ -1242,7 +1334,9 @@ void MI32ConnectionTask(void *pvParameters){ } } else{ - MI32.conCtx->error = MI32_CONN_NO_CHARACTERISTIC; + if(MI32.conCtx->operation < 5){ // no characteristics are fine for ops, that are not read, write or subscribe + MI32.conCtx->error = MI32_CONN_NO_CHARACTERISTIC; + } } timer = 0; @@ -1277,6 +1371,10 @@ void MI32ConnectionTask(void *pvParameters){ } MI32.mode.connected = 0; MI32.mode.triggerBerryConnCB = 1; + if (BLERingBufferQueue != nullptr){ + vRingbufferDelete(BLERingBufferQueue); + BLERingBufferQueue = nullptr; + } MI32StartTask(MI32_TASK_SCAN); vTaskDelete( NULL ); } @@ -1285,7 +1383,14 @@ void MI32ConnectionTask(void *pvParameters){ bool MI32StartServerTask(){ AddLog(LOG_LEVEL_DEBUG,PSTR("BLE: Server task ... start")); - MI32NotificationQueue = {}; + if (BLERingBufferQueue == nullptr){ + BLERingBufferQueue = xRingbufferCreate(2048, RINGBUF_TYPE_NOSPLIT); + if(!BLERingBufferQueue) { + AddLog(LOG_LEVEL_ERROR,PSTR("BLE: failed to create ringbuffer queue")); + return false; + } + } + MI32.role = 3; xTaskCreatePinnedToCore( MI32ServerTask, /* Function to implement the task */ "MI32ServerTask", /* Name of the task */ @@ -1298,12 +1403,21 @@ bool MI32StartServerTask(){ } void MI32ServerSetAdv(NimBLEServer *pServer, std::vector& servicesToStart, bool &shallStartServices); +/** + * @brief Sets the advertisement message from the data of the context, could be regular advertisement or scan response + * + * @param pServer - our server instance + * @param servicesToStart - for the first run, this vector holds all our services, would not be used for later modifications of the advertisement message + * @param shallStartServices - true only for the first call, which will finish the construction of the server by starting all services + */ void MI32ServerSetAdv(NimBLEServer *pServer, std::vector& servicesToStart, bool &shallStartServices){ NimBLEAdvertising *pAdvertising = NimBLEDevice::getAdvertising(); - BLEqueueBuffer_t q; - q.length = 0; + struct{ + BLERingBufferItem_t header; + uint8_t buffer[255]; + } item; + item.header.length = 0; if(shallStartServices && MI32.conCtx->operation == BLE_OP_SET_ADV){ - q.buffer = new uint8_t[256]; for (auto & pService : servicesToStart) { pService->start(); } @@ -1315,13 +1429,13 @@ void MI32ServerSetAdv(NimBLEServer *pServer, std::vector& servic std::vector characteristics = pService->getCharacteristics(); for (auto & pCharacteristic : characteristics) { uint16_t handle = pCharacteristic->getHandle(); // now we have handles, so pass them to Berry - q.buffer[idx] = (uint8_t)handle>>8; - q.buffer[idx+1] = (uint8_t)handle&0xff; + item.buffer[idx] = (uint8_t)handle>>8; + item.buffer[idx+1] = (uint8_t)handle&0xff; if (idx > 254) break; // limit to 127 characteristics idx += 2; } } - q.length = idx; + item.header.length = idx; } servicesToStart.clear(); // release vector } @@ -1337,13 +1451,20 @@ void MI32ServerSetAdv(NimBLEServer *pServer, std::vector& servic } MI32.infoMsg = MI32_SERV_SCANRESPONSE_ADDED + (MI32.conCtx->operation - BLE_OP_SET_SCAN_RESP); // .. ADV or SCAN RESPONSE - q.type = MI32.conCtx->operation; - q.returnCharUUID = 0; // does not matter - q.handle = 0; //dito - BLEmessageQueue.push(q); + item.header.type = MI32.conCtx->operation; + item.header.returnCharUUID = 0; + item.header.handle = 0; + xRingbufferSend(BLERingBufferQueue, (const void*)&item, sizeof(BLERingBufferItem_t) + item.header.length, pdMS_TO_TICKS(20)); } void MI32ServerSetCharacteristic(NimBLEServer *pServer, std::vector& servicesToStart, bool &shallStartServices); +/** + * @brief Create a characteristic or modify its value with data of the context + * + * @param pServer - our server instance + * @param servicesToStart - before the finish of the server construction, a characteristic and maybe the holding service will be created and added to this vector + * @param shallStartServices - true, if the server construction is not finished by first setting of advertisement data + */ void MI32ServerSetCharacteristic(NimBLEServer *pServer, std::vector& servicesToStart, bool &shallStartServices){ MI32.conCtx->error = MI32_CONN_NO_ERROR; NimBLEService *pService = pServer->getServiceByUUID(MI32.conCtx->serviceUUID); // retrieve ... @@ -1375,12 +1496,14 @@ void MI32ServerSetCharacteristic(NimBLEServer *pServer, std::vectorsetValue(MI32.conCtx->buffer + 1, MI32.conCtx->buffer[0]); // set value pCharacteristic->notify(true); // always notify .. for now - BLEqueueBuffer_t q; - q.length = 0; - q.type = BLE_OP_SET_CHARACTERISTIC; - q.returnCharUUID = pCharacteristic->getUUID().getNative()->u16.value; - q.handle = pCharacteristic->getHandle(); // this returns "-1", no valid handle yet :( - BLEmessageQueue.push(q); + struct{ + BLERingBufferItem_t header; + } item; + item.header.length = 0; + item.header.type = BLE_OP_SET_CHARACTERISTIC; + item.header.returnCharUUID = pCharacteristic->getUUID().getNative()->u16.value; + item.header.handle = pCharacteristic->getHandle(); + xRingbufferSend(BLERingBufferQueue, (const void*)&item, sizeof(BLERingBufferItem_t), pdMS_TO_TICKS(1)); } void MI32ServerTask(void *pvParameters){ @@ -1396,9 +1519,11 @@ void MI32ServerTask(void *pvParameters){ while(MI32.mode.triggerNextServerJob == 0){ if(MI32.mode.deleteServerTask == 1){ delete MI32.conCtx; - MI32.conCtx = nullptr; pServer->stopAdvertising(); MI32StartTask(MI32_TASK_SCAN); + vRingbufferDelete(BLERingBufferQueue); + BLERingBufferQueue = nullptr; + MI32.conCtx = nullptr; vTaskDelete( NULL ); } vTaskDelay(50/ portTICK_PERIOD_MS); @@ -1766,44 +1891,59 @@ void MI32Every50mSecond(){ } MI32.mode.triggerBerryAdvCB = 0; } - if(MI32.mode.triggerBerryConnCB || !MI32NotificationQueue.empty()){ - if(!MI32NotificationQueue.empty()){ - MI32notificationBuffer_t _buf = MI32NotificationQueue.front(); - MI32NotificationQueue.pop(); - memcpy(MI32.conCtx->buffer,_buf.buffer,_buf.buffer[0]+1); - MI32.conCtx->returnCharUUID = _buf.returnCharUUID; + + // client callback + // handle notification queue only if there is no message from read/write or subscribe, which is prioritized + if(MI32.mode.connected == 1 && BLERingBufferQueue != nullptr && MI32.mode.triggerBerryConnCB == 0) { + size_t size; + BLERingBufferItem_t *q = (BLERingBufferItem_t *)xRingbufferReceive(BLERingBufferQueue, &size, pdMS_TO_TICKS(1)); + + if(q != nullptr){ + if(q->length != 0){ + memcpy(MI32.conCtx->buffer,&q->length,q->length + 1); + } + MI32.conCtx->returnCharUUID = q->returnCharUUID; + MI32.conCtx->handle = q->handle; MI32.conCtx->operation = 103; MI32.conCtx->error = 0; + vRingbufferReturnItem(BLERingBufferQueue, (void *)q); + MI32.mode.triggerBerryConnCB = 1; } - if(MI32.beConnCB != nullptr){ - void (*func_ptr)(int, int, int) = (void (*)(int, int, int))MI32.beConnCB; - char _message[32]; - GetTextIndexed(_message, sizeof(_message), MI32.conCtx->error, kMI32_ConnErrorMsg); - AddLog(LOG_LEVEL_DEBUG,PSTR("M32: BryCbMsg: %s"),_message); - func_ptr(MI32.conCtx->error, MI32.conCtx->operation , MI32.conCtx->returnCharUUID); - } - MI32.mode.triggerBerryConnCB = 0; } - - if(!BLEmessageQueue.empty()){ - BLEqueueBuffer_t q = BLEmessageQueue.front(); - BLEmessageQueue.pop(); - MI32.conCtx->returnCharUUID = q.returnCharUUID; - MI32.conCtx->handle = q.handle; - MI32.conCtx->operation = q.type; - MI32.conCtx->error = 0; - if(q.length != 0){ - MI32.conCtx->buffer[0] = q.length; - memcpy(MI32.conCtx->buffer + 1,q.buffer,q.length); - delete q.buffer; - } - if(MI32.beServerCB != nullptr){ - void (*func_ptr)(int, int, int, int) = (void (*)(int, int, int, int))MI32.beServerCB; + if(MI32.mode.triggerBerryConnCB == 1){ + if(MI32.beConnCB != nullptr){ + void (*func_ptr)(int, int, int, int) = (void (*)(int, int, int, int))MI32.beConnCB; char _message[32]; GetTextIndexed(_message, sizeof(_message), MI32.conCtx->error, kMI32_ConnErrorMsg); AddLog(LOG_LEVEL_DEBUG,PSTR("M32: BryCbMsg: %s"),_message); func_ptr(MI32.conCtx->error, MI32.conCtx->operation , MI32.conCtx->returnCharUUID, MI32.conCtx->handle); } + MI32.mode.triggerBerryConnCB = 0; + } + + // server callback + if(MI32.mode.connected == 0 && BLERingBufferQueue != nullptr){ + size_t size; + BLERingBufferItem_t *q = (BLERingBufferItem_t *)xRingbufferReceive(BLERingBufferQueue, &size, pdMS_TO_TICKS(1)); + + if(q != nullptr){ + if(q->length != 0){ + memcpy(MI32.conCtx->buffer,&q->length,q->length + 1); + } + MI32.conCtx->buffer[0] = q->length; + MI32.conCtx->returnCharUUID = q->returnCharUUID; + MI32.conCtx->handle = q->handle; + MI32.conCtx->operation = q->type; + MI32.conCtx->error = 0; + vRingbufferReturnItem(BLERingBufferQueue, (void *)q); + if(MI32.beServerCB != nullptr){ + void (*func_ptr)(int, int, int, int) = (void (*)(int, int, int, int))MI32.beServerCB; + char _message[32]; + GetTextIndexed(_message, sizeof(_message), MI32.conCtx->error, kMI32_ConnErrorMsg); + AddLog(LOG_LEVEL_DEBUG,PSTR("M32: BryCbMsg: %s"),_message); + func_ptr(MI32.conCtx->error, MI32.conCtx->operation , MI32.conCtx->returnCharUUID, MI32.conCtx->handle); + } + } } if(MI32.infoMsg > 0){ @@ -1906,7 +2046,7 @@ void CmndMi32Option(void){ if(XdrvMailbox.data_len>0){ if(MI32.option.activeScan != onOff){ MI32.option.activeScan = onOff; - if(MI32.mode.runningScan){ + if(MI32.mode.runningScan == 1){ MI32.mode.updateScan = 1; } else{ @@ -1989,7 +2129,11 @@ void MI32sendEnergyWidget(){ #ifdef USE_WEBCAM void MI32sendCamWidget(){ if (Wc.CamServer && Wc.up) { - WSContentSend_P(PSTR(""), + WSContentSend_P(PSTR("
"), (uint32_t)WiFi.localIP()); } } @@ -2106,7 +2250,6 @@ void MI32sendWidget(uint32_t slot){ } void MI32InitGUI(void){ - MI32suspendScanTask(); MI32.widgetSlot=0; WSContentStart_P("m32"); WSContentSend_P(HTTP_MI32_SCRIPT_1); @@ -2116,11 +2259,15 @@ void MI32InitGUI(void){ WSContentSend_P(HTTP_MI32_STYLE_SVG,2,151,190,216,151,190,216); WSContentSend_P(HTTP_MI32_STYLE_SVG,3,242,240,176,242,240,176); - WSContentSend_P((HTTP_MI32_PARENT_START),MIBLEsensors.size(),UpTime(),ESP.getFreeHeap()/1024); + char _role[16]; + GetTextIndexed(_role, sizeof(_role), MI32.role, HTTP_MI32_PARENT_BLE_ROLE); + WSContentSend_P((HTTP_MI32_PARENT_START),MIBLEsensors.size(),UpTime(),ESP.getFreeHeap()/1024,_role); - for(uint32_t _slot = 0;_slot")); WSContentSpaceButton(BUTTON_MAIN); WSContentStop(); - MI32resumeScanTask(); } void MI32HandleWebGUI(void){ @@ -2390,10 +2536,9 @@ void MI32Show(bool json) int ExtStopBLE(){ if(Settings->flag5.mi32_enable == 0) return 0; if (MI32.ScanTask != nullptr){ - MI32Scan->stop(); MI32.mode.deleteScanTask = 1; AddLog(LOG_LEVEL_INFO,PSTR("M32: stop BLE")); - while (MI32.mode.runningScan) yield(); + while (MI32.mode.runningScan == 1) delay(5); } return 0; } diff --git a/tasmota/tasmota_xsns_sensor/xsns_62_esp32_mi_ble.ino b/tasmota/tasmota_xsns_sensor/xsns_62_esp32_mi_ble.ino index 56dcd8e16..85e332e3f 100644 --- a/tasmota/tasmota_xsns_sensor/xsns_62_esp32_mi_ble.ino +++ b/tasmota/tasmota_xsns_sensor/xsns_62_esp32_mi_ble.ino @@ -24,6 +24,8 @@ -------------------------------------------------------------------------------------------- Version yyyymmdd Action Description -------------------------------------------------------------------------------------------- + 0.9.2.2 20231123 changed - added support for Avago Tech Bluetooth buttons + ------- 0.9.2.1 20210217 changed - make features alos depend on received data - i.e. 'unknown' devices will show what they send. Add MI32Option6 1 to switch to tele/tasmota_ble/ style MQTT independent of HASS discovery. ------- @@ -483,8 +485,9 @@ void (*const MI32_Commands[])(void) PROGMEM = { #define MI_SCALE_V1 15 #define MI_SCALE_V2 16 #define MI_CGDK2 17 +#define AT_BTN 18 -#define MI_MI32_TYPES 17 //count this manually +#define MI_MI32_TYPES 18 //count this manually const uint16_t kMI32DeviceID[MI_MI32_TYPES]={ 0x0000, // Unkown @@ -504,6 +507,7 @@ const uint16_t kMI32DeviceID[MI_MI32_TYPES]={ 0x181d, // Mi Scale V1 0x181b, // Mi Scale V2 0x066f, // CGDK2 + 0x004e // Avago Tech Bluetooth Buttons (Company Id) }; const char kMI32DeviceType0[] PROGMEM = "Unknown"; @@ -523,7 +527,8 @@ const char kMI32DeviceType13[] PROGMEM ="DOOR"; const char kMI32DeviceType14[] PROGMEM ="MISCALEV1"; const char kMI32DeviceType15[] PROGMEM ="MISCALEV2"; const char kMI32DeviceType16[] PROGMEM ="CGDK2"; -const char * kMI32DeviceType[] PROGMEM = {kMI32DeviceType0,kMI32DeviceType1,kMI32DeviceType2,kMI32DeviceType3,kMI32DeviceType4,kMI32DeviceType5,kMI32DeviceType6,kMI32DeviceType7,kMI32DeviceType8,kMI32DeviceType9,kMI32DeviceType10,kMI32DeviceType11,kMI32DeviceType12,kMI32DeviceType13,kMI32DeviceType14,kMI32DeviceType15,kMI32DeviceType16}; +const char kMI32DeviceType17[] PROGMEM ="ATBTN"; +const char * kMI32DeviceType[] PROGMEM = {kMI32DeviceType0,kMI32DeviceType1,kMI32DeviceType2,kMI32DeviceType3,kMI32DeviceType4,kMI32DeviceType5,kMI32DeviceType6,kMI32DeviceType7,kMI32DeviceType8,kMI32DeviceType9,kMI32DeviceType10,kMI32DeviceType11,kMI32DeviceType12,kMI32DeviceType13,kMI32DeviceType14,kMI32DeviceType15,kMI32DeviceType16,kMI32DeviceType17}; typedef int BATREAD_FUNCTION(int slot); typedef int UNITWRITE_FUNCTION(int slot, int unit); @@ -558,6 +563,7 @@ const char FLORA_Svc[] PROGMEM = "00001204-0000-1000-8000-00805F9 const char FLORA_BattChar[] PROGMEM = "00001A02-0000-1000-8000-00805F9B34FB"; +const uint8_t ATBTN_Addr[] = { 0xc1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6 }; // All Avago Buttons seem to use same source address /*********************************************************************************************\ * enumerations @@ -1057,6 +1063,14 @@ int MI32advertismentCallback(BLE_ESP32::ble_advertisment_t *pStruct) } } + // ATBTN uses manufacturer data and not a service - bit more like an IBeacon + if (memcmp(ATBTN_Addr, addr, 6) == 0) + { + //AddLog(LOG_LEVEL_INFO, PSTR("M32: AvagoBtn: %s"), advertisedDevice->toString().c_str()); + MI32ParseATBtn((uint8_t*)advertisedDevice->getManufacturerData().data(), advertisedDevice->getManufacturerData().length(), addr, RSSI); + return 0; + } + int svcdataCount = advertisedDevice->getServiceDataCount(); if (svcdataCount == 0) { @@ -1463,9 +1477,11 @@ int MIParsePacket(const uint8_t* slotmac, struct mi_beacon_data_t *parsed, const * * @param _MAC BLE address of the sensor * @param _type Type number of the sensor + * @param counter sequence number of broadcast - same for duplicates + * @paramm ignoreDulicates ignore if counter matches lastCnt and previous broardcasts * @return uint32_t Known or new slot in the sensors-vector */ -uint32_t MIBLEgetSensorSlot(const uint8_t *mac, uint16_t _type, uint8_t counter){ +uint32_t MIBLEgetSensorSlot(const uint8_t *mac, uint16_t _type, uint8_t counter, bool ignoreDuplicate = false){ //AddLog(LOG_LEVEL_DEBUG_MORE,PSTR("M32: %s: will test ID-type: %x"),D_CMND_MI32, _type); bool _success = false; @@ -1490,7 +1506,7 @@ uint32_t MIBLEgetSensorSlot(const uint8_t *mac, uint16_t _type, uint8_t counter) if(MIBLEsensors[i].lastCnt==counter) { // AddLog(LOG_LEVEL_DEBUG,PSTR("Old packet")); if (BLE_ESP32::BLEDebugMode > 0) AddLog(LOG_LEVEL_DEBUG_MORE,PSTR("M32: %s: slot: %u/%u - ign repeat"),D_CMND_MI32, i, MIBLEsensors.size()); - //return 0xff; // packet received before, stop here + if(ignoreDuplicate) return 0xff; // packet received before, stop here } if (BLE_ESP32::BLEDebugMode > 0) AddLog(LOG_LEVEL_DEBUG,PSTR("M32: Frame %d, last %d"), counter, MIBLEsensors[i].lastCnt); MIBLEsensors[i].lastCnt = counter; @@ -1523,7 +1539,7 @@ uint32_t MIBLEgetSensorSlot(const uint8_t *mac, uint16_t _type, uint8_t counter) _newSensor.lux = 0x00ffffff; _newSensor.light = -1; _newSensor.Btn = -1; - + _newSensor.lastCnt = counter; switch (_type) { case MI_FLORA: @@ -1566,6 +1582,11 @@ uint32_t MIBLEgetSensorSlot(const uint8_t *mac, uint16_t _type, uint8_t counter) _newSensor.feature.scale=1; _newSensor.feature.impedance=1; break; + case AT_BTN: + _newSensor.feature.Btn=1; + _newSensor.needkey = KEY_NOT_REQUIRED; + break; + default: _newSensor.hum=NAN; _newSensor.feature.temp=1; @@ -2134,6 +2155,61 @@ int MI32parseMiPayload(int _slot, struct mi_beacon_data_t *parsed){ return res; } + +/* + AT Button Manufacturer Data + 0 Company ID = 2 bytes + 2 Unknown = 4 bytes 7fffffff + 6 Counter = 1 byte + 7 Unknown = 1 byte 05 + 8 Switch = 2 bytes + 10 Unknown = 1 byte 00 + 11 Button = 1 bytes 0x (x = 1 to 3) + 12 Unknown = 4 bytes 50000100 +*/ +struct __attribute__ ((packed)) ATBtn_data +{ + uint16_t company_id; + uint32_t unknown1; + uint8_t counter; + uint8_t unknown2; + union { + struct { + uint8_t switch1; + uint8_t switch2; + }; + uint16_t switch_id; + }; + uint8_t unknown3; + uint8_t button_id; + uint32_t unknown4; +}; + +void MI32ParseATBtn(uint8_t *buf, uint16_t bufsize, const uint8_t* addr, int RSSI) { + + ATBtn_data* data = (ATBtn_data*)buf; + // AddLog(LOG_LEVEL_INFO,PSTR("ATBTN %04x, %d, Counter(%u) Switch(%04x), Button(%x) %x"), data->company_id, bufsize, data->counter, data->switch_id, data->button_id, kMI32DeviceID[AT_BTN-1]); + if (bufsize != sizeof(ATBtn_data) || data->company_id != kMI32DeviceID[AT_BTN-1]) + return; + // since all have same address, we'll move the "switch Id" into the last two addr fields to give each switch a unique MAC address + uint8_t _addr[6]; + memcpy(_addr,addr,6); + _addr[4] = data->switch1; + _addr[5] = data->switch2; + uint32_t _slot = MIBLEgetSensorSlot(_addr, kMI32DeviceID[AT_BTN-1], data->counter, true); + if(_slot==0xff) return; + + // AddLog(LOG_LEVEL_DEBUG,PSTR("%s at slot %u"), MI32getDeviceName(_slot),_slot); + MIBLEsensors[_slot].RSSI=RSSI; + MIBLEsensors[_slot].lastTime = millis(); + MIBLEsensors[_slot].eventType.Btn = 1; + MI32.mode.shallTriggerTele = 1; + MIBLEsensors[_slot].shallSendMQTT = 1; + MIBLEsensors[_slot].feature.Btn = 1; + MIBLEsensors[_slot].Btn = data->button_id; +} + + //////////////////////////////////////////////////////////// // this SHOULD parse any MI packet, including encrypted. void MI32ParseResponse(const uint8_t *buf, uint16_t bufsize, const uint8_t* addr, int RSSI) { @@ -2745,6 +2821,9 @@ void MI32TimeoutSensors(){ // remove devices for which the adverts have timed out for (int i = MIBLEsensors.size()-1; i >= 0 ; i--) { //if (MIBLEsensors[i].MAC[2] || MIBLEsensors[i].MAC[3] || MIBLEsensors[i].MAC[4] || MIBLEsensors[i].MAC[5]){ + // Since we use a pseudo MAC for the ATBTN slots we need to ignore these warnings + if (memcmp(MIBLEsensors[i].MAC, ATBTN_Addr, 4) == 0) // Skip pseudo AT BTN addresses + continue; if (!BLE_ESP32::devicePresent(MIBLEsensors[i].MAC)){ uint8_t *mac = MIBLEsensors[i].MAC; AddLog(LOG_LEVEL_DEBUG,PSTR("M32: Dev no longer present MAC: %02x%02x%02x%02x%02x%02x"), mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); diff --git a/tasmota/tasmota_xsns_sensor/xsns_66_iAQ.ino b/tasmota/tasmota_xsns_sensor/xsns_66_iAQ.ino index 55b391a3a..04dab95dd 100644 --- a/tasmota/tasmota_xsns_sensor/xsns_66_iAQ.ino +++ b/tasmota/tasmota_xsns_sensor/xsns_66_iAQ.ino @@ -41,15 +41,43 @@ struct { uint16_t pred; uint16_t Tvoc; uint8_t i2c_address; + uint8_t i2c_bus; uint8_t status; bool ready; } iAQ; +bool IAQ_Read(void) { + TwoWire& myWire = I2cGetWire(iAQ.i2c_bus); + if (&myWire == nullptr) { return false; } // No valid I2c bus + + uint8_t buf[9]; + buf[2] = IAQ_STATUS_I2C_ERR; // populate entry with error code + myWire.requestFrom(iAQ.i2c_address, sizeof(buf)); + for (uint32_t i = 0; i < 9; i++) { + buf[i] = myWire.read(); + } + // AddLog(LOG_LEVEL_DEBUG, "iAQ: buffer %x %x %x %x %x %x %x %x %x ", buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6], buf[7], buf[8]); + if (IAQ_STATUS_I2C_ERR == buf[2]) { + return false; + } + iAQ.pred = (buf[0]<<8) + buf[1]; + iAQ.status = buf[2]; + iAQ.resistance = ((uint32_t)buf[3]<<24) + ((uint32_t)buf[4]<<16) + ((uint32_t)buf[5]<<8) + (uint32_t)buf[6]; + iAQ.Tvoc = (buf[7]<<8) + buf[8]; + return true; +} + void IAQ_Init(void) { - if (!I2cSetDevice(I2_ADR_IAQ)) { return; } - I2cSetActiveFound(I2_ADR_IAQ, "IAQ"); - iAQ.i2c_address = I2_ADR_IAQ; - iAQ.ready = true; + for (uint32_t bus = 0; bus < 2; bus++) { + if (!I2cSetDevice(I2_ADR_IAQ, bus)) { continue; } + iAQ.i2c_address = I2_ADR_IAQ; + iAQ.i2c_bus = bus; + if (!IAQ_Read()) { continue; } + I2cSetActiveFound(I2_ADR_IAQ, "IAQ", bus); + iAQ.ready = true; + break; + } + /* for (iAQ.i2c_address = I2_ADR_IAQ; iAQ.i2c_address < I2_ADR_IAQ +5; iAQ.i2c_address++) { if (I2cActive(iAQ.i2c_address)) { continue; } @@ -62,20 +90,6 @@ void IAQ_Init(void) { */ } -void IAQ_Read(void) { - uint8_t buf[9]; - buf[2] = IAQ_STATUS_I2C_ERR; // populate entry with error code - Wire.requestFrom(iAQ.i2c_address, sizeof(buf)); - for( uint32_t i=0; i<9; i++ ) { - buf[i]= Wire.read(); - } - // AddLog(LOG_LEVEL_DEBUG, "iAQ: buffer %x %x %x %x %x %x %x %x %x ", buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6], buf[7], buf[8]); - iAQ.pred = (buf[0]<<8) + buf[1]; - iAQ.status = buf[2]; - iAQ.resistance = ((uint32_t)buf[3]<<24) + ((uint32_t)buf[4]<<16) + ((uint32_t)buf[5]<<8) + (uint32_t)buf[6]; - iAQ.Tvoc = (buf[7]<<8) + buf[8]; -} - /*********************************************************************************************\ * Presentation \*********************************************************************************************/ diff --git a/tasmota/tasmota_xsns_sensor/xsns_83_neopool.ino b/tasmota/tasmota_xsns_sensor/xsns_83_neopool.ino index 5bd285729..ac4901c4f 100644 --- a/tasmota/tasmota_xsns_sensor/xsns_83_neopool.ino +++ b/tasmota/tasmota_xsns_sensor/xsns_83_neopool.ino @@ -64,7 +64,7 @@ #define NEOPOOL_READ_REGISTER 0x04 // Function code used to read register #define NEOPOOL_WRITE_REGISTER 0x10 // Function code used to write register #define NEOPOOL_READ_TIMEOUT 25 // read data timeout in ms -#define NEOPOOL_DATA_TIMEOUT 30000 // directly read data register data discard timout in ms +#define NEOPOOL_CACHE_INVALID_TIME 30 // data cache invalidation time in s // Pool LED RGB lights with different programs, the individual programs can be selected @@ -361,7 +361,7 @@ enum NeoPoolConstAndBitMask { MBMSK_NOTIF_MISC_CHANGED = 0x0020, // 5 Misc page changed // MBF_CELL_BOOST - MBMSK_CELL_BOOST_REDOX_CTL = 0x8000, // undocumented - Disable redox ctrl + MBMSK_CELL_BOOST_NO_REDOX_CTL = 0x8000, // undocumented - Disable redox ctrl MBMSK_CELL_BOOST_STATE = 0x0500, // undocumented - Boost MBMSK_CELL_BOOST_START = 0x00A0, // undocumented - Start boost @@ -576,14 +576,15 @@ enum NeoPoolConstAndBitMask { #include TasmotaModbus *NeoPoolModbus; -#define NEOPOOL_RELAY_MAX 7 // Number of relais build-in +// emulates a g/h system !!!! only for development purposes on % systems +// enables also cmnd 'NPgPerh [0|1]': 0 = disables emulation, 1 enables emulation +//#define NEOPOOL_EMULATE_GPERH 16 // Max g/h power of an emulated % system +#ifdef NEOPOOL_EMULATE_GPERH +bool neopool_system_gperh = false; // emulation defaults off +#endif -enum NeoPoolResult { - NEOPOOL_RESULT_DEC = false, - NEOPOOL_RESULT_HEX, - NEOPOOL_RESULT_MAX -}; -uint8_t neopool_result = NEOPOOL_RESULT_HEX; + +#define NEOPOOL_RELAY_MAX 7 // Number of relais build-in bool neopool_active = false; volatile bool neopool_poll = true; @@ -606,21 +607,87 @@ void (* neopoll_cmd)(void) = nullptr; // Modbus register set to read // Defines blocks of register read once with a single read -struct { +typedef struct { const uint16_t addr; const uint16_t cnt; uint16_t *data; -} NeoPoolReg[] = { - // complete poll cycle needs 1750 ms to read complete register set - {MBF_ION_CURRENT, MBF_NOTIFICATION - MBF_ION_CURRENT + 1, nullptr}, - {MBF_CELL_RUNTIME_LOW, MBF_CELL_RUNTIME_POL_CHANGES_HIGH - MBF_CELL_RUNTIME_LOW + 1, nullptr}, - {MBF_PAR_VERSION, MBF_PAR_HIDRO_NOM - MBF_PAR_VERSION + 1, nullptr}, - {MBF_PAR_TIME_LOW, MBF_PAR_HEATING_GPIO - MBF_PAR_TIME_LOW + 1, nullptr}, - {MBF_PAR_ION, MBF_PAR_FILTRATION_CONF - MBF_PAR_ION + 1, nullptr}, - {MBF_PAR_UICFG_MACHINE, MBF_PAR_UICFG_MACH_VISUAL_STYLE - MBF_PAR_UICFG_MACHINE + 1, nullptr}, - {MBF_VOLT_24_36, MBF_VOLT_12 - MBF_VOLT_24_36 + 1, nullptr}, - {MBF_VOLT_5, MBF_AMP_4_20_MICRO - MBF_VOLT_5 + 1, nullptr} +} TNeoPoolReg; + +// complete poll cycle needs 2000 ms to read complete register set +#define NEOPOOL_REG_QUERY {\ + {MBF_ION_CURRENT, MBF_NOTIFICATION - MBF_ION_CURRENT + 1, nullptr},\ + {MBF_CELL_RUNTIME_LOW, MBF_CELL_RUNTIME_POL_CHANGES_HIGH - MBF_CELL_RUNTIME_LOW + 1, nullptr},\ + {MBF_PAR_VERSION, MBF_PAR_HIDRO_NOM - MBF_PAR_VERSION + 1, nullptr},\ + {MBF_PAR_TIME_LOW, MBF_PAR_HEATING_GPIO - MBF_PAR_TIME_LOW + 1, nullptr},\ + {MBF_PAR_ION, MBF_PAR_FILTRATION_CONF - MBF_PAR_ION + 1, nullptr},\ + {MBF_PAR_UICFG_MACHINE, MBF_PAR_UICFG_MACH_VISUAL_STYLE - MBF_PAR_UICFG_MACHINE + 1, nullptr},\ + {MBF_VOLT_24_36, MBF_VOLT_12 - MBF_VOLT_24_36 + 1, nullptr},\ + {MBF_VOLT_5, MBF_AMP_4_20_MICRO - MBF_VOLT_5 + 1, nullptr}\ +} +TNeoPoolReg NeoPoolReg[] = NEOPOOL_REG_QUERY; + +// Register to check for NPTelePeriod changes +const uint16_t NeoPoolRegCheck[] PROGMEM = { + // excl. values that change almost continuously + // MBF_PAR_TIME_LOW, + // MBF_PAR_TIME_HIGH, + // MBF_VOLT_12, + // MBF_VOLT_24_36, + // MBF_VOLT_5, + // MBF_AMP_4_20_MICRO, + // MBF_CELL_RUNTIME_LOW, + // MBF_CELL_RUNTIME_HIGH, + // MBF_CELL_RUNTIME_PART_LOW, + // MBF_CELL_RUNTIME_PART_HIGH, + // MBF_CELL_RUNTIME_POLA_LOW, + // MBF_CELL_RUNTIME_POLA_HIGH, + // MBF_CELL_RUNTIME_POLB_LOW, + // MBF_CELL_RUNTIME_POLB_HIGH, + // MBF_CELL_RUNTIME_POL_CHANGES_LOW, + // MBF_CELL_RUNTIME_POL_CHANGES_HIGH, + + // measured values delayed (set bit 15 to indicate often value changes) + MBF_ION_CURRENT | 0x8000, + MBF_MEASURE_CL | 0x8000, + MBF_MEASURE_CONDUCTIVITY | 0x8000, + MBF_MEASURE_PH | 0x8000, + MBF_MEASURE_RX | 0x8000, + MBF_MEASURE_TEMPERATURE | 0x8000, + MBF_HIDRO_CURRENT | 0x8000, + + // undelayed measured values + MBF_HIDRO_STATUS, + MBF_PH_STATUS, + MBF_RELAY_STATE, + + // undelayed setting values + MBF_CELL_BOOST, + MBF_PAR_CL1, + MBF_PAR_FILT_MODE, + MBF_PAR_HIDRO, + MBF_PAR_HIDRO_NOM, + MBF_PAR_ION, + MBF_PAR_PH1, + MBF_PAR_PH2, + MBF_PAR_RX1, + + MBF_PAR_CD_RELAY_GPIO, + MBF_PAR_CL_RELAY_GPIO, + MBF_PAR_FILT_GPIO, + MBF_PAR_FILTVALVE_GPIO, + MBF_PAR_HEATING_GPIO, + MBF_PAR_LIGHTING_GPIO, + MBF_PAR_PH_ACID_RELAY_GPIO, + MBF_PAR_PH_BASE_RELAY_GPIO, + MBF_PAR_RX_RELAY_GPIO, + MBF_PAR_UV_RELAY_GPIO, + MBF_PAR_ION_NOM, + MBF_PAR_TEMPERATURE_ACTIVE, + MBF_PAR_UICFG_MACHINE }; +uint16_t *NeoPoolRegCheckData; +uint32_t NeoPoolRegCheckDataTimeout = 0; + typedef struct { uint16_t addr; @@ -639,17 +706,38 @@ enum NeoPoolModbusCode { NEOPOOL_MODBUS_ERROR_DEADLOCK }; + + +// NPResult possible values +enum NeoPoolResult { + NEOPOOL_RESULT_DEC = false, + NEOPOOL_RESULT_HEX, + NEOPOOL_RESULT_MAX +}; + +// Sensor saved variables +#define NEOPOOL_SETTING_VERSION 0x0100 +#define NEOPOOL_DEFAULT_PHRES 1 +#define NEOPOOL_DEFAULT_CLRES 1 +#define NEOPOOL_DEFAULT_IONRES 1 +#define NEOPOOL_DEFAULT_RESULT NEOPOOL_RESULT_HEX +#define NEOPOOL_DEFAULT_NPTELEPERIOD 0 + // NeoPool value resolutions typedef struct { uint16_t ph : 2; uint16_t cl : 2; uint16_t ion : 2; } NeoPoolResMBitfield; -NeoPoolResMBitfield neopool_resolution { - .ph = 1, - .cl = 1, - .ion = 1 -}; + +// Global structure containing sensor saved variables +struct { + uint32_t crc32; + uint16_t version; + NeoPoolResMBitfield resolution; + uint8_t result; + uint16_t npteleperiod; +} NeoPoolSettings; #define D_NEOPOOL_NAME "NeoPool" @@ -662,12 +750,14 @@ NeoPoolResMBitfield neopool_resolution { #define D_NEOPOOL_JSON_FILTRATION_INTELLIGENT "Intelligent" #define D_NEOPOOL_JSON_FILTRATION_BACKWASH "Backwash" #define D_NEOPOOL_JSON_MODULES "Modules" +#define D_NEOPOOL_JSON_POWERUNIT "Powerunit" #define D_NEOPOOL_JSON_CHLORINE "Chlorine" #define D_NEOPOOL_JSON_CONDUCTIVITY "Conductivity" #define D_NEOPOOL_JSON_FILTRATION "Filtration" #define D_NEOPOOL_JSON_FILTRATION_MODE "Mode" #define D_NEOPOOL_JSON_FILTRATION_SPEED "Speed" #define D_NEOPOOL_JSON_HYDROLYSIS "Hydrolysis" +#define D_NEOPOOL_JSON_PERCENT "Percent" #define D_NEOPOOL_JSON_CELL_RUNTIME "Runtime" #define D_NEOPOOL_JSON_CELL_RUNTIME_TOTAL "Total" #define D_NEOPOOL_JSON_CELL_RUNTIME_PART "Part" @@ -693,6 +783,8 @@ NeoPoolResMBitfield neopool_resolution { #define D_NEOPOOL_JSON_UNIT "Unit" #define D_NEOPOOL_JSON_COVER "Cover" #define D_NEOPOOL_JSON_SHOCK "Boost" +#define D_NEOPOOL_JSON_OFF "OFF" +#define D_NEOPOOL_JSON_ON "ON" #define D_NEOPOOL_JSON_LOW "Low" #define D_NEOPOOL_JSON_SETPOINT "Setpoint" #define D_NEOPOOL_JSON_MIN "Min" @@ -749,6 +841,17 @@ const char kNeoPoolFiltrationSpeed[] PROGMEM = D_NEOPOOL_FILTRATION_FAST ; +const char kNeoPoolBoostCmnd[] PROGMEM = + D_NEOPOOL_JSON_OFF "|" + D_NEOPOOL_JSON_ON "|" + D_NEOPOOL_JSON_REDOX + ; + +const uint16_t sNeoPoolBoost[] PROGMEM = { + 0x0000, + MBMSK_CELL_BOOST_STATE | MBMSK_CELL_BOOST_START | MBMSK_CELL_BOOST_NO_REDOX_CTL, + MBMSK_CELL_BOOST_STATE | MBMSK_CELL_BOOST_START }; + const char kNeoPoolpHAlarms[] PROGMEM = D_NEOPOOL_SETPOINT_OK "|" D_NEOPOOL_PH_HIGH "|" @@ -806,6 +909,21 @@ const char HTTP_SNS_NEOPOOL_STATUS_ACTIVE[] PROGMEM = "filter:invert(1)"; * 4 - Intelligent * 13 - Backwash * + * NPFiltrationSpeed {} + * (only available for non-standard filtration types) + * get/set manual filtration speed (speed = 1..3) + * get filtration speed if is omitted, otherwise set new speed + * 1 - low + * 2 - mid + * 3 - high + * + * NPBoost {} + * get/set hydrolysis/electrolysis boost mode (mode = 0..2) + * get mode if is omitted, otherwise set new mode according: + * 0|OFF - boost off + * 1|ON - boost on + * 2|REDOX - boost on with redox control + * * NPTime {