Merge branch 'development' into development+SCD40

This commit is contained in:
Theo Arends 2021-09-23 14:42:04 +02:00 committed by GitHub
commit 16f9e2bd88
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
118 changed files with 6662 additions and 5317 deletions

View File

@ -7,7 +7,7 @@
- [ ] Only relevant files were touched
- [ ] Only one feature/fix was added per PR and the code change compiles without warnings
- [ ] The code change is tested and works with Tasmota core ESP8266 V.2.7.4.9
- [ ] The code change is tested and works with Tasmota core ESP32 V.1.0.7.3
- [ ] The code change is tested and works with Tasmota core ESP32 V.1.0.7.4
- [ ] I accept the [CLA](https://github.com/arendst/Tasmota/blob/development/CONTRIBUTING.md#contributor-license-agreement-cla).
_NOTE: The code change must pass CI tests. **Your PR cannot be merged unless tests pass**_

View File

@ -55,6 +55,7 @@ m = minimal, l = lite, t = tasmota, k = knx, s = sensors, i = ir, d = display
| USE_KEELOQ | - | - | - / - | - | - | - | - |
| USE_SONOFF_D1 | - | - | x / - | x | - | - | - |
| USE_SHELLY_DIMMER | - | - | x / - | - | - | - | - |
| USE_AC_ZERO_CROSS_DIMMER | - | - | x / x | x | x | x | x |
| | | | | | | | |
| Feature or Sensor | m | l | t | k | s | i | d | Remarks
| USE_LIGHT | - | x | x / x | x | x | x | x |
@ -79,7 +80,7 @@ m = minimal, l = lite, t = tasmota, k = knx, s = sensors, i = ir, d = display
| USE_DDSU666 | - | - | - / x | - | x | - | - |
| USE_SOLAX_X1 | - | - | - / - | - | - | - | - |
| USE_LE01MR | - | - | - / - | - | - | - | - |
| USE_BL0940 | - | x | x / - | x | x | - | - |
| USE_BL09XX | - | x | x / x | x | x | - | - |
| USE_TELEINFO | - | - | - / - | - | - | - | - |
| USE_IEM3000 | - | - | - / - | - | - | - | - |
| USE_WE517 | - | - | - / - | - | - | - | - |

View File

@ -13,11 +13,14 @@ All notable changes to this project will be documented in this file.
- Support for ESP32/ESP32S2 DAC gpio via Berry
- Berry support for Serial
- Support for Sensirion SCD40/SCD41 CO2 sensor
- Support for BL0939 energy monitor as used in ESP32 based Sonoff Dual R3 V2 Pow (#13195)
### Changed
- M5 Stack Core2 uses UNIVERSAL_DISPLAY with enabled LVGL as default now
- ``DisplayDimmer`` has now range 0..100 instead of 0..15
- Minimum PWM Frequency lowered to 2Hz on ESP32 (#13123)
- Use Tasmota Arduino Core32 1.0.7.4 for ESP32 builds (#13154)
- Shrinked Webcam build, uses now `USE_TASMOTA_DISCOVERY` (#13148)
### Fixed
- OpenTherm invalid JSON (#13028)

View File

@ -107,9 +107,9 @@ The latter links can be used for OTA upgrades too like ``OtaUrl http://ota.tasmo
- Command ``SetSensor1..127 0|1`` to globally disable individual sensor driver
- Command ``Subscribe2 ...`` to subscribe to a MQTT topic without appended "/#" [#12858](https://github.com/arendst/Tasmota/issues/12858)
- Command ``WebGetConfig <url>`` if ``#define USE_WEBGETCONFIG`` is enabled to restore/init configuration from external webserver [#13034](https://github.com/arendst/Tasmota/issues/13034)
- Optional IP filter to command ``TCPStart`` [#12806](https://github.com/arendst/Tasmota/issues/12806)
- Neopool commands ``NPPHRes``, ``NPCLRes`` and ``NPIonRes`` [#12813](https://github.com/arendst/Tasmota/issues/12813)
- Support for second DNS server
- Support for (Yeelight) Mi Desk Pro using binary tasmota32solo1.bin
- Support for influxdb using ``#define USE_INFLUXDB`` and several ``Ifx`` commands
- Support for AM2320 Temperature and Humidity Sensor by Lars Wessels [#12485](https://github.com/arendst/Tasmota/issues/12485)
- Support for Technoline WS2300-15 Anemometer [#12573](https://github.com/arendst/Tasmota/issues/12573)
@ -118,29 +118,32 @@ The latter links can be used for OTA upgrades too like ``OtaUrl http://ota.tasmo
- Support for IEM3155 Wattmeter [#12940](https://github.com/arendst/Tasmota/issues/12940)
- Support for Hydreon RG-15 Solid State Rain sensor [#12974](https://github.com/arendst/Tasmota/issues/12974)
- Support for IKEA VINDRIKTNING particle concentration sensor [#12976](https://github.com/arendst/Tasmota/issues/12976)
- Support for BL0939 energy monitor as used in ESP32 based Sonoff Dual R3 V2 Pow [#13195](https://github.com/arendst/Tasmota/issues/13195)
- Initial support for Tasmota Mesh (TasMesh) providing node/broker communication using ESP-NOW [#11939](https://github.com/arendst/Tasmota/issues/11939)
- Inital support for Wi-Fi extender [#12784](https://github.com/arendst/Tasmota/issues/12784)
- Berry ESP32 partition manager [#12465](https://github.com/arendst/Tasmota/issues/12465)
- Berry ESP32 support for I2S audio mp3 playback
- Berry ESP32 support for vararg
- Berry ESP32 support for Curve 25519 EC crypto
- Initial support for Wi-Fi extender [#12784](https://github.com/arendst/Tasmota/issues/12784)
- Rule event support as JSON payload [#12496](https://github.com/arendst/Tasmota/issues/12496)
- MQTT minimum password length restriction in GUI [#12553](https://github.com/arendst/Tasmota/issues/12553)
- Optional IP filter to command ``TCPStart`` [#12806](https://github.com/arendst/Tasmota/issues/12806)
- ESP32 Berry partition manager [#12465](https://github.com/arendst/Tasmota/issues/12465)
- ESP32 Berry class ``webclient`` for HTTP/HTTPS requests
- ESP32 Berry support for I2S audio mp3 playback
- ESP32 Berry support for vararg
- ESP32 Berry support for Curve 25519 EC crypto
- ESP32 Berry support for ESP32/ESP32S2 DAC gpio
- ESP32 Berry support for Serial
- ESP32 support for (Yeelight) Mi Desk Pro using binary tasmota32solo1.bin
- ESP32-S2 support for GPIOs
- ESP32 add GPIO 6/7/8/11 to template and remove GPIO 28-31 (remapping so backwards compatible)
- ESP32 crash recorder ``Status 12`` for ESP32/ESP32-S2/ESP32-C3, supporting Esp-idf 3.3/4.4
### Changed
- Move firmware binaries to https://github.com/arendst/Tasmota-firmware/tree/main/release-firmware
- ESP32 core library from v1.0.6 to v1.0.7.3
- IRremoteESP8266 library from v2.7.18 to v2.7.20
- NeoPixelBus library from v2.6.3 to v2.6.7
- Message ``Upload buffer miscompare`` into ``Not enough space``
- ESP32 Ethernet Phy Type information to IDF v3+
- Command ``DisplayDimmer`` has now range 0..100 instead of 0..15
- Speed up initial GUI console refresh
- Enable UFILESYS, GUI_TRASH_FILE and GUI_EDIT_FILE for any device compiled with more than 1M flash size
- ESP32 internal sensor driver id moved from 87 to 127
- Supported sensor driver range extended from 96 to 128
- Disable PSRAM on unsupported hardware
- ESP32 remove GPIO initialization to INPUT from not used GPIOs to allow JTAG support
- Relax NTP poll if no ntpserver can be resolved by DNS
- Shelly EM template needs to use GPIO ``ADE7953_IRQ 2``
- Make Sonoff L1 MusicSync persistent [#12008](https://github.com/arendst/Tasmota/issues/12008)
@ -153,26 +156,27 @@ The latter links can be used for OTA upgrades too like ``OtaUrl http://ota.tasmo
- Prometheus: All metrics are prefixed with ``tasmota_`` [#12842](https://github.com/arendst/Tasmota/issues/12842)
Memory metrics have been cleaned up to work consistently between ESP8266 and ESP32
The device name is reported as an info metric
- ESP32 core library from v1.0.6 to v1.0.7.4
- ESP32 Ethernet Phy Type information to IDF v3+
- ESP32 internal sensor driver id moved from 87 to 127
- ESP32 disable PSRAM on unsupported hardware
- ESP32 remove GPIO initialization to INPUT from not used GPIOs to allow JTAG support
- ESP32 M5 Stack Core2 uses UNIVERSAL_DISPLAY with enabled LVGL as default now
- ESP32 minimum PWM Frequency lowered to 2Hz [#13123](https://github.com/arendst/Tasmota/issues/13123)
- ESP32 shrinked Webcam build, uses now `USE_TASMOTA_DISCOVERY` [#13148](https://github.com/arendst/Tasmota/issues/13148)
### Fixed
- ESP32 core v2.0.0 setting hostname
- ESP32-C3 settings layout for configuration backup and restore
- ESP32-Solo OTA upgrade
- Sonoff L1 (lite) smoother color transitions
- DDS238-2 wrong reactive power value [#12283](https://github.com/arendst/Tasmota/issues/12283)
- ESP32 Webcam add boundary marker before sending mjpeg image [#12376](https://github.com/arendst/Tasmota/issues/12376)
- NO VALID JSON regression from may 4th [#12440](https://github.com/arendst/Tasmota/issues/12440)
- Telegram response decoding stopped working after 20210621 and exception on long result message [#12451](https://github.com/arendst/Tasmota/issues/12451)
- Neopool compile error on DEBUG_TASMOTA_SENSOR [#12464](https://github.com/arendst/Tasmota/issues/12464)
- Berry button handlers and error messages [#12521](https://github.com/arendst/Tasmota/issues/12521)
- Scripter and Display MQTT errors due to MQTT_DATA move to String [#12525](https://github.com/arendst/Tasmota/issues/12525)
- Scripter moving average and sml input validation [#12541](https://github.com/arendst/Tasmota/issues/12541)
- Zigbee Hue angle encoding [#12545](https://github.com/arendst/Tasmota/issues/12545)
- Exception 28 when unable to send MQTT message and a topic name without a slash '/' [#12555](https://github.com/arendst/Tasmota/issues/12555)
- Wi-Fi initial setup workaround for 11n only routers [#12566](https://github.com/arendst/Tasmota/issues/12566)
- ESP32 do not use chip temperature sensor as global temperature if external temperature sensor is used [#12630](https://github.com/arendst/Tasmota/issues/12630)
- Discovery fails when using ``%hostname%`` in a topic [#12710](https://github.com/arendst/Tasmota/issues/12710)
- ESP32 buzzer in PWM mode exception [#12717](https://github.com/arendst/Tasmota/issues/12717)
- Neopool communication error [#12813](https://github.com/arendst/Tasmota/issues/12813)
- Shelly Dimmer 2 Energy usage [#12815](https://github.com/arendst/Tasmota/issues/12815)
- WDT reset on shutters with stepper motors during deceleration [#12849](https://github.com/arendst/Tasmota/issues/12849)
@ -182,4 +186,11 @@ The latter links can be used for OTA upgrades too like ``OtaUrl http://ota.tasmo
- Hass and Tasmota discovery prefix topic notifications [#12972](https://github.com/arendst/Tasmota/issues/12972)
- OpenTherm invalid JSON [#13028](https://github.com/arendst/Tasmota/issues/13028)
- MQTT TLS related connection timing errors [#13033](https://github.com/arendst/Tasmota/issues/13033)
- ESP32 core v2.0.0 setting hostname
- ESP32-C3 settings layout for configuration backup and restore
- ESP32-Solo OTA upgrade
- ESP32 Webcam add boundary marker before sending mjpeg image [#12376](https://github.com/arendst/Tasmota/issues/12376)
- ESP32 Berry button handlers and error messages [#12521](https://github.com/arendst/Tasmota/issues/12521)
- ESP32 do not use chip temperature sensor as global temperature if external temperature sensor is used [#12630](https://github.com/arendst/Tasmota/issues/12630)
- ESP32 buzzer in PWM mode exception [#12717](https://github.com/arendst/Tasmota/issues/12717)
- ESP32 crash when PSRAM is absent and ``BOARD_HAS_PSRAM`` set [#13037](https://github.com/arendst/Tasmota/issues/13037)

5
SECURITY.md Normal file
View File

@ -0,0 +1,5 @@
# Security Policy
## Reporting a Vulnerability
Please report security issues to https://sidweb.nl/cms3/en/contact

View File

@ -4,7 +4,6 @@
"ldscript": "esp32c3_out.ld"
},
"core": "esp32",
"extra_flags": "-DBOARD_HAS_PSRAM",
"f_cpu": "160000000L",
"f_flash": "80000000L",
"flash_mode": "dout",

View File

@ -1,12 +1,10 @@
/********************************************************************
* Tasmota LVGL ctypes mapping
* Tasmota ctypes mapping
*******************************************************************/
#include "be_constobj.h"
#include <string.h>
#ifdef USE_LVGL
#include "lvgl.h"
extern __attribute__((noreturn)) void be_raisef(bvm *vm, const char *except, const char *msg, ...);
// binary search within an array of sorted strings
// the first 4 bytes are a pointer to a string
@ -68,6 +66,7 @@ typedef struct be_ctypes_structure_item_t {
typedef struct be_ctypes_structure_t {
uint16_t size_bytes; /* size in bytes */
uint16_t size_elt; /* number of elements */
const char **instance_mapping; /* array of instance class names for automatic instanciation of class */
const be_ctypes_structure_item_t * items;
} be_ctypes_structure_t;
@ -97,14 +96,6 @@ int be_ctypes_init(bvm *vm) {
src_data = (void*) be_toint(vm, 2);
}
// get global array of classes from global variable '.ctypes_classes'
be_getglobal(vm, ".ctypes_classes");
const be_ctypes_classes_t * be_ctypes_classes = (const be_ctypes_classes_t *) be_tocomptr(vm, -1);
be_pop(vm, 1);
// berry_log_C("be_ctypes_init> be_ctypes_class = %p", be_ctypes_classes);
const char * class_name = be_classname(vm, 1);
// berry_log_C("be_ctypes_init> class_name = %s", class_name);
// call super(self, bytes)
be_getglobal(vm, "super"); // push super function
be_pushvalue(vm, 1); // push self instance
@ -121,16 +112,10 @@ int be_ctypes_init(bvm *vm) {
// berry_log_C("be_ctypes_init> init called");
// look for class definition
int32_t class_idx = bin_search_ctypes(class_name, &be_ctypes_classes->classes[0], sizeof(be_ctypes_class_t), be_ctypes_classes->size);
if (class_idx >= 0) {
// found
const be_ctypes_structure_t * definitions = be_ctypes_classes->classes[class_idx].definitions;
// store definition in '.def'
// berry_log_C("Found definitions = %p", definitions);
be_pushcomptr(vm, (void*) definitions);
be_setmember(vm, 1, ".def");
be_pop(vm, 1);
be_getmember(vm, 1, "_def"); // static class comptr
const be_ctypes_structure_t *definitions;
definitions = (const be_ctypes_structure_t *) be_tocomptr(vm, -1);
if (definitions) {
// call self.resize(definitions->size_bytes)
be_getmember(vm, 1, "resize");
be_pushvalue(vm, 1);
@ -167,9 +152,13 @@ int be_ctypes_copy(bvm *vm) {
be_return(vm);
}
// get an attribute from a ctypes structure
// arg1: ctypes instance
// arg2: name of the argument
// The class has a `_def` static class attribute with the C low-level mapping definition
int be_ctypes_member(bvm *vm) {
int argc = be_top(vm);
be_getmember(vm, 1, ".def");
be_getmember(vm, 1, "_def");
const be_ctypes_structure_t *definitions;
definitions = (const be_ctypes_structure_t *) be_tocomptr(vm, -1);
be_pop(vm, 1);
@ -194,14 +183,14 @@ int be_ctypes_member(bvm *vm) {
} else {
// general int support
int size = member->type; // eventually 1/2/4, positive if little endian, negative if big endian
int sign = false; // signed int
int sign = bfalse; // signed int
if (size >= ctypes_i8) {
size -= ctypes_i8 - 1;
sign = true;
sign = btrue;
}
if (size <= ctypes_be_i8) {
size += ctypes_be_i8 - 1;
sign = true;
sign = btrue;
}
// get
be_getmember(vm, 1, sign ? "geti" : "get"); // self.get or self.geti
@ -215,14 +204,7 @@ int be_ctypes_member(bvm *vm) {
// the int result is at top of the stack
// check if we need an instance mapping
if (member->mapping > 0) {
// find the name of the class
// get global array of classes from global variable '.ctypes_classes'
be_getglobal(vm, ".ctypes_classes");
const be_ctypes_classes_t * be_ctypes_classes = (const be_ctypes_classes_t *) be_tocomptr(vm, -1);
be_pop(vm, 1);
const char * mapping_name = be_ctypes_classes->instance_mapping[member->mapping - 1];
const char * mapping_name = definitions->instance_mapping[member->mapping - 1];
if (mapping_name) {
be_getglobal(vm, mapping_name); // stack: class
be_pushvalue(vm, -2); // stack: class, value
@ -259,7 +241,15 @@ int be_ctypes_setmember(bvm *vm) {
be_pop(vm, 1);
}
be_getmember(vm, 1, ".def");
// If the value is a pointer, replace with an int of same value (works only on 32 bits CPU)
if (be_iscomptr(vm, 3)) {
void * v = be_tocomptr(vm, 3);
be_pushint(vm, (int32_t) v);
be_moveto(vm, -1, 3);
be_pop(vm, 1);
}
be_getmember(vm, 1, "_def");
const be_ctypes_structure_t *definitions;
definitions = (const be_ctypes_structure_t *) be_tocomptr(vm, -1);
be_pop(vm, 1);
@ -285,14 +275,14 @@ int be_ctypes_setmember(bvm *vm) {
} else {
// general int support
int size = member->type; // eventually 1/2/4, positive if little endian, negative if big endian
int sign = false; // signed int
int sign = bfalse; // signed int
if (size >= ctypes_i8) {
size -= ctypes_i8 - 1;
sign = true;
sign = btrue;
}
if (size <= ctypes_be_i8) {
size += ctypes_be_i8 - 1;
sign = true;
sign = btrue;
}
// set
be_getmember(vm, 1, sign ? "seti" : "set"); // self.get or self.geti
@ -304,48 +294,28 @@ int be_ctypes_setmember(bvm *vm) {
be_pop(vm, 5);
be_return_nil(vm);
}
} else {
be_raisef(vm, "attribute_error", "class '%s' cannot assign to attribute '%s'",
be_classname(vm, 1), be_tostring(vm, 2));
}
be_return_nil(vm);
}
BE_EXPORT_VARIABLE extern const bclass be_class_bytes;
#if BE_USE_PRECOMPILED_OBJECT
#include "../generate/be_fixed_be_class_lv_ctypes.h"
#endif
#include "../generate/be_fixed_be_class_ctypes.h"
void be_load_lvgl_ctypes_lib(bvm *vm) {
#if !BE_USE_PRECOMPILED_OBJECT
static const bnfuncinfo members[] = {
{ ".def", NULL }, // pointer to definition
{ "init", be_ctypes_init },
{ "copy", be_ctypes_copy },
{ "member", be_ctypes_member },
{ "setmember", be_ctypes_setmember },
{ NULL, NULL }
};
be_regclass(vm, "ctypes_bytes", members);
be_getglobal(vm, "ctypes_bytes");
be_getglobal(vm, "bytes");
be_setsuper(vm, -2);
be_pop(vm, 2);
#else
be_pushntvclass(vm, &be_class_lv_ctypes);
void be_load_ctypes_lib(bvm *vm) {
be_pushntvclass(vm, &be_class_ctypes);
be_setglobal(vm, "ctypes_bytes");
be_pop(vm, 1);
#endif
}
/* @const_object_info_begin
class be_class_lv_ctypes (scope: global, name: ctypes_bytes, super: be_class_bytes) {
.def, var
class be_class_ctypes (scope: global, name: ctypes_bytes, super: be_class_bytes) {
_def, nil()
copy, func(be_ctypes_copy)
init, func(be_ctypes_init)
member, func(be_ctypes_member)
setmember, func(be_ctypes_setmember)
}
@const_object_info_end */
#endif // USE_LVGL

View File

@ -23,7 +23,7 @@ be_local_closure(init, /* name */
(be_nested_const_str("init", 380752755, 4)),
(be_nested_const_str("input", -103256197, 5)),
( &(const binstruction[ 1]) { /* code */
0x80000000, // 0000 RET 0 R0
0x80000000, // 0000 RET 0
})
)
);
@ -44,12 +44,12 @@ be_local_closure(get_tasmota, /* name */
NULL, /* no sub protos */
1, /* has constants */
( &(const bvalue[ 1]) { /* constants */
be_nested_string("tasmota", 424643812, 7), /* R256 - K0 */
/* K0 */ be_nested_string("tasmota", 424643812, 7),
}),
(be_nested_const_str("get_tasmota", 334356779, 11)),
(be_nested_const_str("input", -103256197, 5)),
( &(const binstruction[ 2]) { /* code */
0xB8060000, // 0000 GETNGBL R1 R256
0xB8060000, // 0000 GETNGBL R1 K0
0x80040200, // 0001 RET 1 R1
})
)
@ -98,19 +98,19 @@ be_local_closure(add_cmd, /* name */
}),
1, /* has constants */
( &(const bvalue[ 2]) { /* constants */
be_nested_string("tasmota", 424643812, 7), /* R256 - K0 */
be_nested_string("add_cmd", -933336417, 7), /* R257 - K1 */
/* K0 */ be_nested_string("tasmota", 424643812, 7),
/* K1 */ be_nested_string("add_cmd", -933336417, 7),
}),
(be_nested_const_str("add_cmd", -933336417, 7)),
(be_nested_const_str("input", -103256197, 5)),
( &(const binstruction[ 7]) { /* code */
0xB80E0000, // 0000 GETNGBL R3 R256
0x8C0C0701, // 0001 GETMET R3 R3 R257
0xB80E0000, // 0000 GETNGBL R3 K0
0x8C0C0701, // 0001 GETMET R3 R3 K1
0x5C140200, // 0002 MOVE R5 R1
0x84180000, // 0003 CLOSURE R6 P0
0x7C0C0600, // 0004 CALL R3 3
0xA0000000, // 0005 CLOSE 0
0x80000000, // 0006 RET 0 R0
0xA0000000, // 0005 CLOSE R0
0x80000000, // 0006 RET 0
})
)
);

View File

@ -11,19 +11,11 @@
extern int b_nrg_read(bvm *vm);
#if !BE_USE_PRECOMPILED_OBJECT
be_native_module_attr_table(energy) {
be_native_module_function("read", b_nrg_read),
};
be_define_native_module(energy, NULL);
#else
/* @const_object_info_begin
module energy (scope: global) {
read, func(b_nrg_read)
}
@const_object_info_end */
#include "../generate/be_fixed_energy.h"
#endif
#endif // USE_ENERGY_SENSOR

View File

@ -11,16 +11,6 @@ extern int p_flash_read(bvm *vm);
extern int p_flash_write(bvm *vm);
extern int p_flash_erase(bvm *vm);
#if !BE_USE_PRECOMPILED_OBJECT
be_native_module_attr_table(flash) {
be_native_module_function("read", p_flash_read),
be_native_module_function("write", p_flash_write),
be_native_module_function("erase", p_flash_erase),
};
be_define_native_module(flash, NULL);
#else
/* @const_object_info_begin
module flash (scope: global) {
read, func(p_flash_read)
@ -29,4 +19,3 @@ module flash (scope: global) {
}
@const_object_info_end */
#include "../generate/be_fixed_flash.h"
#endif

View File

@ -476,7 +476,7 @@ be_local_closure(init, /* name */
(be_nested_const_str("init", 380752755, 4)),
(be_nested_const_str("input", -103256197, 5)),
( &(const binstruction[ 9]) { /* code */
0x60040014, // 0000 GETGBL R1 G20
0x60040003, // 0000 GETGBL R1 G3
0x5C080000, // 0001 MOVE R2 R0
0xB80E0000, // 0002 GETNGBL R3 K0
0x7C040400, // 0003 CALL R1 2

View File

@ -11,333 +11,6 @@
extern bclass* be_class_Driver; // Parent class
/********************************************************************
** Solidified function: init
********************************************************************/
be_local_closure(init, /* name */
be_nested_proto(
10, /* nstack */
4, /* argc */
0, /* varg */
0, /* has upvals */
NULL, /* no upvals */
0, /* has sup protos */
NULL, /* no sub protos */
1, /* has constants */
( &(const bvalue[10]) { /* constants */
be_nested_string("get_tasmota", 334356779, 11),
be_nested_string("i2c_enabled", 218388101, 11),
be_nested_string("addr", 1087856498, 4),
be_nested_string("wire", -212213352, 4),
be_nested_string("wire_scan", -1623691416, 9),
be_nested_string("function", -1630125495, 8),
be_nested_string("name", -1925595674, 4),
be_nested_string("I2C:", 813483371, 4),
be_nested_string("detected on bus", 1432002650, 15),
be_nested_string("bus", 1607822841, 3),
}),
(be_nested_const_str("init", 380752755, 4)),
(be_nested_const_str("input", -103256197, 5)),
( &(const binstruction[44]) { /* code */
0x8C100100, // 0000 GETMET R4 R0 R256
0x7C100200, // 0001 CALL R4 1
0x4C140000, // 0002 LDNIL 5
0x20140605, // 0003 NE R5 R3 R5
0x78160004, // 0004 JMPF R5 #000A
0x8C140901, // 0005 GETMET R5 R4 R257
0x5C1C0600, // 0006 MOVE R7 R3
0x7C140400, // 0007 CALL R5 2
0x74160000, // 0008 JMPT R5 #000A
0x80000A00, // 0009 RET 0 R5
0x90020402, // 000A SETMBR R0 R258 R2
0x8C140904, // 000B GETMET R5 R4 R260
0x881C0102, // 000C GETMBR R7 R0 R258
0x7C140400, // 000D CALL R5 2
0x90020605, // 000E SETMBR R0 R259 R5
0x88140103, // 000F GETMBR R5 R0 R259
0x78160019, // 0010 JMPF R5 #002B
0x60140015, // 0011 GETGBL R5 G21
0x5C180200, // 0012 MOVE R6 R1
0x7C140200, // 0013 CALL R5 1
0x1C140B05, // 0014 EQ R5 R5 R261
0x78160004, // 0015 JMPF R5 #001B
0x5C140200, // 0016 MOVE R5 R1
0x5C180000, // 0017 MOVE R6 R0
0x7C140200, // 0018 CALL R5 1
0x90020C05, // 0019 SETMBR R0 R262 R5
0x70020000, // 001A JMP #001C
0x90020C01, // 001B SETMBR R0 R262 R1
0x88140106, // 001C GETMBR R5 R0 R262
0x4C180000, // 001D LDNIL 6
0x1C140A06, // 001E EQ R5 R5 R6
0x78160001, // 001F JMPF R5 #0022
0x4C140000, // 0020 LDNIL 5
0x90020605, // 0021 SETMBR R0 R259 R5
0x88140103, // 0022 GETMBR R5 R0 R259
0x78160006, // 0023 JMPF R5 #002B
0x6014000F, // 0024 GETGBL R5 G15
0x58180007, // 0025 LDCONST R6 K7
0x881C0106, // 0026 GETMBR R7 R0 R262
0x58200008, // 0027 LDCONST R8 K8
0x88240103, // 0028 GETMBR R9 R0 R259
0x88241309, // 0029 GETMBR R9 R9 R265
0x7C140800, // 002A CALL R5 4
0x80000000, // 002B RET 0 R0
})
)
);
/*******************************************************************/
/********************************************************************
** Solidified function: write8
********************************************************************/
be_local_closure(write8, /* name */
be_nested_proto(
9, /* nstack */
3, /* argc */
0, /* varg */
0, /* has upvals */
NULL, /* no upvals */
0, /* has sup protos */
NULL, /* no sub protos */
1, /* has constants */
( &(const bvalue[ 4]) { /* constants */
be_nested_string("wire", -212213352, 4),
be_nested_string("write", -1104765092, 5),
be_nested_string("addr", 1087856498, 4),
be_const_int(1),
}),
(be_nested_const_str("write8", -1160975764, 6)),
(be_nested_const_str("input", -103256197, 5)),
( &(const binstruction[ 8]) { /* code */
0x880C0100, // 0000 GETMBR R3 R0 R256
0x8C0C0701, // 0001 GETMET R3 R3 R257
0x88140102, // 0002 GETMBR R5 R0 R258
0x5C180200, // 0003 MOVE R6 R1
0x5C1C0400, // 0004 MOVE R7 R2
0x58200003, // 0005 LDCONST R8 K3
0x7C0C0A00, // 0006 CALL R3 5
0x80040600, // 0007 RET 1 R3
})
)
);
/*******************************************************************/
/********************************************************************
** Solidified function: write_bit
********************************************************************/
be_local_closure(write_bit, /* name */
be_nested_proto(
11, /* nstack */
4, /* argc */
0, /* varg */
0, /* has upvals */
NULL, /* no upvals */
0, /* has sup protos */
NULL, /* no sub protos */
1, /* has constants */
( &(const bvalue[ 4]) { /* constants */
be_const_int(0),
be_const_int(1),
be_nested_string("write8", -1160975764, 6),
be_nested_string("read8", -1492179129, 5),
}),
(be_nested_const_str("write_bit", -1633976860, 9)),
(be_nested_const_str("input", -103256197, 5)),
( &(const binstruction[26]) { /* code */
0x14100500, // 0000 LT R4 R2 R256
0x74120002, // 0001 JMPT R4 #0005
0x54120006, // 0002 LDINT R4 7
0x24100404, // 0003 GT R4 R2 R4
0x78120000, // 0004 JMPF R4 #0006
0x80000800, // 0005 RET 0 R4
0x38120202, // 0006 SHL R4 R257 R2
0x780E0007, // 0007 JMPF R3 #0010
0x8C140102, // 0008 GETMET R5 R0 R258
0x5C1C0200, // 0009 MOVE R7 R1
0x8C200103, // 000A GETMET R8 R0 R259
0x5C280200, // 000B MOVE R10 R1
0x7C200400, // 000C CALL R8 2
0x30201004, // 000D OR R8 R8 R4
0x7C140600, // 000E CALL R5 3
0x70020008, // 000F JMP #0019
0x8C140102, // 0010 GETMET R5 R0 R258
0x5C1C0200, // 0011 MOVE R7 R1
0x8C200103, // 0012 GETMET R8 R0 R259
0x5C280200, // 0013 MOVE R10 R1
0x7C200400, // 0014 CALL R8 2
0x542600FE, // 0015 LDINT R9 255
0x04241204, // 0016 SUB R9 R9 R4
0x2C201009, // 0017 AND R8 R8 R9
0x7C140600, // 0018 CALL R5 3
0x80000000, // 0019 RET 0 R0
})
)
);
/*******************************************************************/
/********************************************************************
** Solidified function: read8
********************************************************************/
be_local_closure(read8, /* name */
be_nested_proto(
7, /* nstack */
2, /* argc */
0, /* varg */
0, /* has upvals */
NULL, /* no upvals */
0, /* has sup protos */
NULL, /* no sub protos */
1, /* has constants */
( &(const bvalue[ 4]) { /* constants */
be_nested_string("wire", -212213352, 4),
be_nested_string("read", -824204347, 4),
be_nested_string("addr", 1087856498, 4),
be_const_int(1),
}),
(be_nested_const_str("read8", -1492179129, 5)),
(be_nested_const_str("input", -103256197, 5)),
( &(const binstruction[ 7]) { /* code */
0x88080100, // 0000 GETMBR R2 R0 R256
0x8C080501, // 0001 GETMET R2 R2 R257
0x88100102, // 0002 GETMBR R4 R0 R258
0x5C140200, // 0003 MOVE R5 R1
0x58180003, // 0004 LDCONST R6 K3
0x7C080800, // 0005 CALL R2 4
0x80040400, // 0006 RET 1 R2
})
)
);
/*******************************************************************/
/********************************************************************
** Solidified function: read12
********************************************************************/
be_local_closure(read12, /* name */
be_nested_proto(
7, /* nstack */
2, /* argc */
0, /* varg */
0, /* has upvals */
NULL, /* no upvals */
0, /* has sup protos */
NULL, /* no sub protos */
1, /* has constants */
( &(const bvalue[ 6]) { /* constants */
be_nested_string("wire", -212213352, 4),
be_nested_string("read_bytes", -718234123, 10),
be_nested_string("addr", 1087856498, 4),
be_const_int(2),
be_const_int(0),
be_const_int(1),
}),
(be_nested_const_str("read12", -3890326, 6)),
(be_nested_const_str("input", -103256197, 5)),
( &(const binstruction[12]) { /* code */
0x88080100, // 0000 GETMBR R2 R0 R256
0x8C080501, // 0001 GETMET R2 R2 R257
0x88100102, // 0002 GETMBR R4 R0 R258
0x5C140200, // 0003 MOVE R5 R1
0x58180003, // 0004 LDCONST R6 K3
0x7C080800, // 0005 CALL R2 4
0x940C0504, // 0006 GETIDX R3 R2 R260
0x54120003, // 0007 LDINT R4 4
0x380C0604, // 0008 SHL R3 R3 R4
0x94100505, // 0009 GETIDX R4 R2 R261
0x000C0604, // 000A ADD R3 R3 R4
0x80040600, // 000B RET 1 R3
})
)
);
/*******************************************************************/
/********************************************************************
** Solidified function: read13
********************************************************************/
be_local_closure(read13, /* name */
be_nested_proto(
7, /* nstack */
2, /* argc */
0, /* varg */
0, /* has upvals */
NULL, /* no upvals */
0, /* has sup protos */
NULL, /* no sub protos */
1, /* has constants */
( &(const bvalue[ 6]) { /* constants */
be_nested_string("wire", -212213352, 4),
be_nested_string("read_bytes", -718234123, 10),
be_nested_string("addr", 1087856498, 4),
be_const_int(2),
be_const_int(0),
be_const_int(1),
}),
(be_nested_const_str("read13", 12887293, 6)),
(be_nested_const_str("input", -103256197, 5)),
( &(const binstruction[12]) { /* code */
0x88080100, // 0000 GETMBR R2 R0 R256
0x8C080501, // 0001 GETMET R2 R2 R257
0x88100102, // 0002 GETMBR R4 R0 R258
0x5C140200, // 0003 MOVE R5 R1
0x58180003, // 0004 LDCONST R6 K3
0x7C080800, // 0005 CALL R2 4
0x940C0504, // 0006 GETIDX R3 R2 R260
0x54120004, // 0007 LDINT R4 5
0x380C0604, // 0008 SHL R3 R3 R4
0x94100505, // 0009 GETIDX R4 R2 R261
0x000C0604, // 000A ADD R3 R3 R4
0x80040600, // 000B RET 1 R3
})
)
);
/*******************************************************************/
/********************************************************************
** Solidified function: read24
********************************************************************/
be_local_closure(read24, /* name */
be_nested_proto(
7, /* nstack */
2, /* argc */
0, /* varg */
0, /* has upvals */
NULL, /* no upvals */
0, /* has sup protos */
NULL, /* no sub protos */
1, /* has constants */
( &(const bvalue[ 7]) { /* constants */
be_nested_string("wire", -212213352, 4),
be_nested_string("read_bytes", -718234123, 10),
be_nested_string("addr", 1087856498, 4),
be_const_int(3),
be_const_int(0),
be_const_int(1),
be_const_int(2),
}),
(be_nested_const_str("read24", 1808533811, 6)),
(be_nested_const_str("input", -103256197, 5)),
( &(const binstruction[16]) { /* code */
0x88080100, // 0000 GETMBR R2 R0 R256
0x8C080501, // 0001 GETMET R2 R2 R257
0x88100102, // 0002 GETMBR R4 R0 R258
0x5C140200, // 0003 MOVE R5 R1
0x58180003, // 0004 LDCONST R6 K3
0x7C080800, // 0005 CALL R2 4
0x940C0504, // 0006 GETIDX R3 R2 R260
0x5412000F, // 0007 LDINT R4 16
0x380C0604, // 0008 SHL R3 R3 R4
0x94100505, // 0009 GETIDX R4 R2 R261
0x54160007, // 000A LDINT R5 8
0x38100805, // 000B SHL R4 R4 R5
0x000C0604, // 000C ADD R3 R3 R4
0x94100506, // 000D GETIDX R4 R2 R262
0x000C0604, // 000E ADD R3 R3 R4
0x80040600, // 000F RET 1 R3
})
)
);
/*******************************************************************/
/********************************************************************
** Solidified function: read32
********************************************************************/
@ -352,35 +25,35 @@ be_local_closure(read32, /* name */
NULL, /* no sub protos */
1, /* has constants */
( &(const bvalue[ 7]) { /* constants */
be_nested_string("wire", -212213352, 4),
be_nested_string("read_bytes", -718234123, 10),
be_nested_string("addr", 1087856498, 4),
be_const_int(0),
be_const_int(1),
be_const_int(2),
be_const_int(3),
/* K0 */ be_nested_string("wire", -212213352, 4),
/* K1 */ be_nested_string("read_bytes", -718234123, 10),
/* K2 */ be_nested_string("addr", 1087856498, 4),
/* K3 */ be_const_int(0),
/* K4 */ be_const_int(1),
/* K5 */ be_const_int(2),
/* K6 */ be_const_int(3),
}),
(be_nested_const_str("read32", 1741276240, 6)),
(be_nested_const_str("input", -103256197, 5)),
( &(const binstruction[20]) { /* code */
0x88080100, // 0000 GETMBR R2 R0 R256
0x8C080501, // 0001 GETMET R2 R2 R257
0x88100102, // 0002 GETMBR R4 R0 R258
0x88080100, // 0000 GETMBR R2 R0 K0
0x8C080501, // 0001 GETMET R2 R2 K1
0x88100102, // 0002 GETMBR R4 R0 K2
0x5C140200, // 0003 MOVE R5 R1
0x541A0003, // 0004 LDINT R6 4
0x7C080800, // 0005 CALL R2 4
0x940C0503, // 0006 GETIDX R3 R2 R259
0x940C0503, // 0006 GETIDX R3 R2 K3
0x54120017, // 0007 LDINT R4 24
0x380C0604, // 0008 SHL R3 R3 R4
0x94100504, // 0009 GETIDX R4 R2 R260
0x94100504, // 0009 GETIDX R4 R2 K4
0x5416000F, // 000A LDINT R5 16
0x38100805, // 000B SHL R4 R4 R5
0x000C0604, // 000C ADD R3 R3 R4
0x94100505, // 000D GETIDX R4 R2 R261
0x94100505, // 000D GETIDX R4 R2 K5
0x54160007, // 000E LDINT R5 8
0x38100805, // 000F SHL R4 R4 R5
0x000C0604, // 0010 ADD R3 R3 R4
0x94100506, // 0011 GETIDX R4 R2 R262
0x94100506, // 0011 GETIDX R4 R2 K6
0x000C0604, // 0012 ADD R3 R3 R4
0x80040600, // 0013 RET 1 R3
})
@ -389,6 +62,339 @@ be_local_closure(read32, /* name */
/*******************************************************************/
/********************************************************************
** Solidified function: write8
********************************************************************/
be_local_closure(write8, /* name */
be_nested_proto(
9, /* nstack */
3, /* argc */
0, /* 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_string("wire", -212213352, 4),
/* K1 */ be_nested_string("write", -1104765092, 5),
/* K2 */ be_nested_string("addr", 1087856498, 4),
/* K3 */ be_const_int(1),
}),
(be_nested_const_str("write8", -1160975764, 6)),
(be_nested_const_str("input", -103256197, 5)),
( &(const binstruction[ 8]) { /* code */
0x880C0100, // 0000 GETMBR R3 R0 K0
0x8C0C0701, // 0001 GETMET R3 R3 K1
0x88140102, // 0002 GETMBR R5 R0 K2
0x5C180200, // 0003 MOVE R6 R1
0x5C1C0400, // 0004 MOVE R7 R2
0x58200003, // 0005 LDCONST R8 K3
0x7C0C0A00, // 0006 CALL R3 5
0x80040600, // 0007 RET 1 R3
})
)
);
/*******************************************************************/
/********************************************************************
** Solidified function: read12
********************************************************************/
be_local_closure(read12, /* name */
be_nested_proto(
7, /* nstack */
2, /* argc */
0, /* 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_string("wire", -212213352, 4),
/* K1 */ be_nested_string("read_bytes", -718234123, 10),
/* K2 */ be_nested_string("addr", 1087856498, 4),
/* K3 */ be_const_int(2),
/* K4 */ be_const_int(0),
/* K5 */ be_const_int(1),
}),
(be_nested_const_str("read12", -3890326, 6)),
(be_nested_const_str("input", -103256197, 5)),
( &(const binstruction[12]) { /* code */
0x88080100, // 0000 GETMBR R2 R0 K0
0x8C080501, // 0001 GETMET R2 R2 K1
0x88100102, // 0002 GETMBR R4 R0 K2
0x5C140200, // 0003 MOVE R5 R1
0x58180003, // 0004 LDCONST R6 K3
0x7C080800, // 0005 CALL R2 4
0x940C0504, // 0006 GETIDX R3 R2 K4
0x54120003, // 0007 LDINT R4 4
0x380C0604, // 0008 SHL R3 R3 R4
0x94100505, // 0009 GETIDX R4 R2 K5
0x000C0604, // 000A ADD R3 R3 R4
0x80040600, // 000B RET 1 R3
})
)
);
/*******************************************************************/
/********************************************************************
** Solidified function: write_bit
********************************************************************/
be_local_closure(write_bit, /* name */
be_nested_proto(
11, /* nstack */
4, /* argc */
0, /* 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_const_int(1),
/* K2 */ be_nested_string("write8", -1160975764, 6),
/* K3 */ be_nested_string("read8", -1492179129, 5),
}),
(be_nested_const_str("write_bit", -1633976860, 9)),
(be_nested_const_str("input", -103256197, 5)),
( &(const binstruction[26]) { /* code */
0x14100500, // 0000 LT R4 R2 K0
0x74120002, // 0001 JMPT R4 #0005
0x54120006, // 0002 LDINT R4 7
0x24100404, // 0003 GT R4 R2 R4
0x78120000, // 0004 JMPF R4 #0006
0x80000800, // 0005 RET 0
0x38120202, // 0006 SHL R4 K1 R2
0x780E0007, // 0007 JMPF R3 #0010
0x8C140102, // 0008 GETMET R5 R0 K2
0x5C1C0200, // 0009 MOVE R7 R1
0x8C200103, // 000A GETMET R8 R0 K3
0x5C280200, // 000B MOVE R10 R1
0x7C200400, // 000C CALL R8 2
0x30201004, // 000D OR R8 R8 R4
0x7C140600, // 000E CALL R5 3
0x70020008, // 000F JMP #0019
0x8C140102, // 0010 GETMET R5 R0 K2
0x5C1C0200, // 0011 MOVE R7 R1
0x8C200103, // 0012 GETMET R8 R0 K3
0x5C280200, // 0013 MOVE R10 R1
0x7C200400, // 0014 CALL R8 2
0x542600FE, // 0015 LDINT R9 255
0x04241204, // 0016 SUB R9 R9 R4
0x2C201009, // 0017 AND R8 R8 R9
0x7C140600, // 0018 CALL R5 3
0x80000000, // 0019 RET 0
})
)
);
/*******************************************************************/
/********************************************************************
** Solidified function: read24
********************************************************************/
be_local_closure(read24, /* name */
be_nested_proto(
7, /* nstack */
2, /* argc */
0, /* 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_string("wire", -212213352, 4),
/* K1 */ be_nested_string("read_bytes", -718234123, 10),
/* K2 */ be_nested_string("addr", 1087856498, 4),
/* K3 */ be_const_int(3),
/* K4 */ be_const_int(0),
/* K5 */ be_const_int(1),
/* K6 */ be_const_int(2),
}),
(be_nested_const_str("read24", 1808533811, 6)),
(be_nested_const_str("input", -103256197, 5)),
( &(const binstruction[16]) { /* code */
0x88080100, // 0000 GETMBR R2 R0 K0
0x8C080501, // 0001 GETMET R2 R2 K1
0x88100102, // 0002 GETMBR R4 R0 K2
0x5C140200, // 0003 MOVE R5 R1
0x58180003, // 0004 LDCONST R6 K3
0x7C080800, // 0005 CALL R2 4
0x940C0504, // 0006 GETIDX R3 R2 K4
0x5412000F, // 0007 LDINT R4 16
0x380C0604, // 0008 SHL R3 R3 R4
0x94100505, // 0009 GETIDX R4 R2 K5
0x54160007, // 000A LDINT R5 8
0x38100805, // 000B SHL R4 R4 R5
0x000C0604, // 000C ADD R3 R3 R4
0x94100506, // 000D GETIDX R4 R2 K6
0x000C0604, // 000E ADD R3 R3 R4
0x80040600, // 000F RET 1 R3
})
)
);
/*******************************************************************/
/********************************************************************
** Solidified function: read8
********************************************************************/
be_local_closure(read8, /* name */
be_nested_proto(
7, /* nstack */
2, /* argc */
0, /* 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_string("wire", -212213352, 4),
/* K1 */ be_nested_string("read", -824204347, 4),
/* K2 */ be_nested_string("addr", 1087856498, 4),
/* K3 */ be_const_int(1),
}),
(be_nested_const_str("read8", -1492179129, 5)),
(be_nested_const_str("input", -103256197, 5)),
( &(const binstruction[ 7]) { /* code */
0x88080100, // 0000 GETMBR R2 R0 K0
0x8C080501, // 0001 GETMET R2 R2 K1
0x88100102, // 0002 GETMBR R4 R0 K2
0x5C140200, // 0003 MOVE R5 R1
0x58180003, // 0004 LDCONST R6 K3
0x7C080800, // 0005 CALL R2 4
0x80040400, // 0006 RET 1 R2
})
)
);
/*******************************************************************/
/********************************************************************
** Solidified function: init
********************************************************************/
be_local_closure(init, /* name */
be_nested_proto(
10, /* nstack */
4, /* argc */
0, /* 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_string("get_tasmota", 334356779, 11),
/* K1 */ be_nested_string("i2c_enabled", 218388101, 11),
/* K2 */ be_nested_string("addr", 1087856498, 4),
/* K3 */ be_nested_string("wire", -212213352, 4),
/* K4 */ be_nested_string("wire_scan", -1623691416, 9),
/* K5 */ be_nested_string("function", -1630125495, 8),
/* K6 */ be_nested_string("name", -1925595674, 4),
/* K7 */ be_nested_string("I2C:", 813483371, 4),
/* K8 */ be_nested_string("detected on bus", 1432002650, 15),
/* K9 */ be_nested_string("bus", 1607822841, 3),
}),
(be_nested_const_str("init", 380752755, 4)),
(be_nested_const_str("input", -103256197, 5)),
( &(const binstruction[44]) { /* code */
0x8C100100, // 0000 GETMET R4 R0 K0
0x7C100200, // 0001 CALL R4 1
0x4C140000, // 0002 LDNIL R5
0x20140605, // 0003 NE R5 R3 R5
0x78160004, // 0004 JMPF R5 #000A
0x8C140901, // 0005 GETMET R5 R4 K1
0x5C1C0600, // 0006 MOVE R7 R3
0x7C140400, // 0007 CALL R5 2
0x74160000, // 0008 JMPT R5 #000A
0x80000A00, // 0009 RET 0
0x90020402, // 000A SETMBR R0 K2 R2
0x8C140904, // 000B GETMET R5 R4 K4
0x881C0102, // 000C GETMBR R7 R0 K2
0x7C140400, // 000D CALL R5 2
0x90020605, // 000E SETMBR R0 K3 R5
0x88140103, // 000F GETMBR R5 R0 K3
0x78160019, // 0010 JMPF R5 #002B
0x60140004, // 0011 GETGBL R5 G4
0x5C180200, // 0012 MOVE R6 R1
0x7C140200, // 0013 CALL R5 1
0x1C140B05, // 0014 EQ R5 R5 K5
0x78160004, // 0015 JMPF R5 #001B
0x5C140200, // 0016 MOVE R5 R1
0x5C180000, // 0017 MOVE R6 R0
0x7C140200, // 0018 CALL R5 1
0x90020C05, // 0019 SETMBR R0 K6 R5
0x70020000, // 001A JMP #001C
0x90020C01, // 001B SETMBR R0 K6 R1
0x88140106, // 001C GETMBR R5 R0 K6
0x4C180000, // 001D LDNIL R6
0x1C140A06, // 001E EQ R5 R5 R6
0x78160001, // 001F JMPF R5 #0022
0x4C140000, // 0020 LDNIL R5
0x90020605, // 0021 SETMBR R0 K3 R5
0x88140103, // 0022 GETMBR R5 R0 K3
0x78160006, // 0023 JMPF R5 #002B
0x60140001, // 0024 GETGBL R5 G1
0x58180007, // 0025 LDCONST R6 K7
0x881C0106, // 0026 GETMBR R7 R0 K6
0x58200008, // 0027 LDCONST R8 K8
0x88240103, // 0028 GETMBR R9 R0 K3
0x88241309, // 0029 GETMBR R9 R9 K9
0x7C140800, // 002A CALL R5 4
0x80000000, // 002B RET 0
})
)
);
/*******************************************************************/
/********************************************************************
** Solidified function: read13
********************************************************************/
be_local_closure(read13, /* name */
be_nested_proto(
7, /* nstack */
2, /* argc */
0, /* 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_string("wire", -212213352, 4),
/* K1 */ be_nested_string("read_bytes", -718234123, 10),
/* K2 */ be_nested_string("addr", 1087856498, 4),
/* K3 */ be_const_int(2),
/* K4 */ be_const_int(0),
/* K5 */ be_const_int(1),
}),
(be_nested_const_str("read13", 12887293, 6)),
(be_nested_const_str("input", -103256197, 5)),
( &(const binstruction[12]) { /* code */
0x88080100, // 0000 GETMBR R2 R0 K0
0x8C080501, // 0001 GETMET R2 R2 K1
0x88100102, // 0002 GETMBR R4 R0 K2
0x5C140200, // 0003 MOVE R5 R1
0x58180003, // 0004 LDCONST R6 K3
0x7C080800, // 0005 CALL R2 4
0x940C0504, // 0006 GETIDX R3 R2 K4
0x54120004, // 0007 LDINT R4 5
0x380C0604, // 0008 SHL R3 R3 R4
0x94100505, // 0009 GETIDX R4 R2 K5
0x000C0604, // 000A ADD R3 R3 R4
0x80040600, // 000B RET 1 R3
})
)
);
/*******************************************************************/
#include "../generate/be_fixed_be_class_I2C_Driver.h"
void be_load_driver_i2c_lib(bvm *vm) {

View File

@ -32,7 +32,6 @@ extern int i2s_file_source_fs_deinit(bvm *vm);
#endif // USE_UFILESYS
#if BE_USE_PRECOMPILED_OBJECT
#include "../generate/be_fixed_be_class_audio_output.h"
#include "../generate/be_fixed_be_class_audio_output_i2s.h"
#include "../generate/be_fixed_be_class_audio_generator.h"
@ -40,7 +39,6 @@ extern int i2s_file_source_fs_deinit(bvm *vm);
#include "../generate/be_fixed_be_class_audio_generator_mp3.h"
#include "../generate/be_fixed_be_class_audio_file_source.h"
#include "../generate/be_fixed_be_class_audio_file_source_fs.h"
#endif
void be_load_driver_audio_lib(bvm *vm) {
be_pushntvclass(vm, &be_class_audio_output);

View File

@ -13,22 +13,6 @@ extern int l_gamma8(bvm *vm);
extern int l_gamma10(bvm *vm);
extern int l_rev_gamma10(bvm *vm);
#if !BE_USE_PRECOMPILED_OBJECT
be_native_module_attr_table(light) {
be_native_module_function("get", l_getlight),
be_native_module_function("set", l_setlight),
be_native_module_function("gamma8", l_gamma8),
be_native_module_function("gamma10", l_gamma10),
be_native_module_function("reverse_gamma10", l_rev_gamma10),
};
be_define_native_module(light, NULL);
#else
/* @const_object_info_begin
module light (scope: global) {
get, func(l_getlight)
@ -40,6 +24,5 @@ module light (scope: global) {
}
@const_object_info_end */
#include "../generate/be_fixed_light.h"
#endif
#endif // USE_LIGHT

View File

@ -102,94 +102,32 @@ class be_lvgl_cb (scope: global, name: lv_cb) {
// 'lv_gauge_format_cb'
//
#if BE_USE_PRECOMPILED_OBJECT
#include "../generate/be_fixed_be_lv_group_focus_cb.h"
#include "../generate/be_fixed_be_lv_event_cb.h"
#include "../generate/be_fixed_be_lv_signal_cb.h"
#include "../generate/be_fixed_be_lv_design_cb.h"
#include "../generate/be_fixed_be_lv_gauge_format_cb.h"
#endif
void be_load_lvgl_cb_all_lib(bvm *vm) {
#if !BE_USE_PRECOMPILED_OBJECT
static const bnfuncinfo members_lv_group_focus_cb[] = {
{ "()", lv_group_focus_cb_call },
{ NULL, NULL }
};
be_regclass(vm, "lv_group_focus_cb", members);
be_getglobal(vm, "lv_group_focus_cb");
be_getglobal(vm, "lv_cb");
be_setsuper(vm, -2);
be_pop(vm, 2);
#else
be_pushntvclass(vm, &be_lv_group_focus_cb);
be_setglobal(vm, "lv_group_focus_cb");
be_pop(vm, 1);
#endif
#if !BE_USE_PRECOMPILED_OBJECT
static const bnfuncinfo members_lv_event_cb[] = {
{ "()", lv_event_cb_call },
{ NULL, NULL }
};
be_regclass(vm, "lv_event_cb", members);
be_getglobal(vm, "lv_event_cb");
be_getglobal(vm, "lv_cb");
be_setsuper(vm, -2);
be_pop(vm, 2);
#else
be_pushntvclass(vm, &be_lv_event_cb);
be_setglobal(vm, "lv_event_cb");
be_pop(vm, 1);
#endif
#if !BE_USE_PRECOMPILED_OBJECT
static const bnfuncinfo members_lv_signal_cb[] = {
{ "()", lv_signal_cb_call },
{ NULL, NULL }
};
be_regclass(vm, "lv_signal_cb", members);
be_getglobal(vm, "lv_signal_cb");
be_getglobal(vm, "lv_cb");
be_setsuper(vm, -2);
be_pop(vm, 2);
#else
be_pushntvclass(vm, &be_lv_signal_cb);
be_setglobal(vm, "lv_signal_cb");
be_pop(vm, 1);
#endif
#if !BE_USE_PRECOMPILED_OBJECT
static const bnfuncinfo members_lv_design_cb[] = {
{ "()", lv_design_cb_call },
{ NULL, NULL }
};
be_regclass(vm, "lv_design_cb", members);
be_getglobal(vm, "lv_design_cb");
be_getglobal(vm, "lv_cb");
be_setsuper(vm, -2);
be_pop(vm, 2);
#else
be_pushntvclass(vm, &be_lv_design_cb);
be_setglobal(vm, "lv_design_cb");
be_pop(vm, 1);
#endif
#if !BE_USE_PRECOMPILED_OBJECT
static const bnfuncinfo members_lv_gauge_format_cb[] = {
{ "()", lv_gauge_format_cb_call },
{ NULL, NULL }
};
be_regclass(vm, "lv_gauge_format_cb", members);
be_getglobal(vm, "lv_gauge_format_cb");
be_getglobal(vm, "lv_cb");
be_setsuper(vm, -2);
be_pop(vm, 2);
#else
be_pushntvclass(vm, &be_lv_gauge_format_cb);
be_setglobal(vm, "lv_gauge_format_cb");
be_pop(vm, 1);
#endif
}
/* @const_object_info_begin

View File

@ -157,7 +157,7 @@ be_local_closure(init, /* name */
(be_nested_const_str("init", 380752755, 4)),
(be_nested_const_str("input", -103256197, 5)),
( &(const binstruction[76]) { /* code */
0x600C0014, // 0000 GETGBL R3 G20
0x600C0003, // 0000 GETGBL R3 G3
0x5C100000, // 0001 MOVE R4 R0
0x7C0C0200, // 0002 CALL R3 1
0x8C0C0700, // 0003 GETMET R3 R3 K0
@ -260,7 +260,7 @@ be_local_closure(del, /* name */
(be_nested_const_str("del", -816214454, 3)),
(be_nested_const_str("input", -103256197, 5)),
( &(const binstruction[10]) { /* code */
0x60040014, // 0000 GETGBL R1 G20
0x60040003, // 0000 GETGBL R1 G3
0x5C080000, // 0001 MOVE R2 R0
0x7C040200, // 0002 CALL R1 1
0x8C040300, // 0003 GETMET R1 R1 K0

View File

@ -12,28 +12,12 @@ extern int lco_tostring(bvm *vm); // generic function
extern int lco_toint(bvm *vm); // generic function
#if BE_USE_PRECOMPILED_OBJECT
#include "../generate/be_fixed_be_class_lv_color.h"
#endif
void be_load_lvgl_color_lib(bvm *vm) {
#if !BE_USE_PRECOMPILED_OBJECT
static const bnfuncinfo members[] = {
{ ".p", NULL }, // keeping track of styles to avoid GC
{ "init", lco_init },
{ "tostring", lco_tostring },
{ "toint", lco_toint },
// { NULL, (bntvfunc) BE_CLOSURE }, /* mark section for berry closures */
{ NULL, NULL }
};
be_regclass(vm, "lv_color", members);
#else
be_pushntvclass(vm, &be_class_lv_color);
be_setglobal(vm, "lv_color");
be_pop(vm, 1);
#endif
}
/* @const_object_info_begin

View File

@ -42,6 +42,7 @@ typedef struct be_ctypes_structure_item_t {
typedef struct be_ctypes_structure_t {
uint16_t size_bytes; /* size in bytes */
uint16_t size_elt; /* number of elements */
const char **instance_mapping; /* array of instance class names for automatic instanciation of class */
const be_ctypes_structure_item_t * items;
} be_ctypes_structure_t;
@ -56,7 +57,7 @@ typedef struct be_ctypes_classes_t {
const be_ctypes_class_t * classes;
} be_ctypes_classes_t;
BE_EXPORT_VARIABLE extern const bclass be_class_lv_ctypes;
BE_EXPORT_VARIABLE extern const bclass be_class_ctypes;
void ctypes_register_class(bvm *vm, const bclass * ctypes_class, const be_ctypes_structure_t * definitions) {
be_pushntvclass(vm, ctypes_class);
@ -64,10 +65,26 @@ void ctypes_register_class(bvm *vm, const bclass * ctypes_class, const be_ctypes
be_pop(vm, 1);
}
const char * be_ctypes_instance_mappings[]; /* forward definition */
// Define a sub-class of ctypes with only one member which points to the ctypes defintion
#define be_define_ctypes_class(_c_name, _def, _super, _name) \
be_local_class(_c_name, \
0, \
_super, \
be_nested_map(1, \
( (struct bmapnode*) &(const bmapnode[]) { \
{ be_nested_key("_def", 1985022181, 4, -1), be_const_comptr(_def) },\
})), \
(be_nested_const_str(_name, 0, sizeof(_name)-1)) \
)
/********************************************************************/
const be_ctypes_structure_t be_lv_point = {
4, /* size in bytes */
2, /* number of elements */
be_ctypes_instance_mappings,
(const be_ctypes_structure_item_t[2]) {
{ "x", 0, 0, 0, 12, 0 },
{ "y", 2, 0, 0, 12, 0 },
@ -76,6 +93,7 @@ const be_ctypes_structure_t be_lv_point = {
const be_ctypes_structure_t be_lv_area = {
8, /* size in bytes */
4, /* number of elements */
be_ctypes_instance_mappings,
(const be_ctypes_structure_item_t[4]) {
{ "x1", 0, 0, 0, 12, 0 },
{ "x2", 4, 0, 0, 12, 0 },
@ -86,6 +104,7 @@ const be_ctypes_structure_t be_lv_area = {
const be_ctypes_structure_t be_lv_draw_rect_dsc = {
77, /* size in bytes */
43, /* number of elements */
be_ctypes_instance_mappings,
(const be_ctypes_structure_item_t[43]) {
{ "bg_blend_mode", 12, 0, 0, 1, 0 },
{ "bg_color", 2, 0, 0, 2, 1 },
@ -135,6 +154,7 @@ const be_ctypes_structure_t be_lv_draw_rect_dsc = {
const be_ctypes_structure_t be_lv_draw_line_dsc = {
10, /* size in bytes */
9, /* number of elements */
be_ctypes_instance_mappings,
(const be_ctypes_structure_item_t[9]) {
{ "blend_mode", 9, 0, 2, 0, 0 },
{ "color", 0, 0, 0, 2, 1 },
@ -150,6 +170,7 @@ const be_ctypes_structure_t be_lv_draw_line_dsc = {
const be_ctypes_structure_t be_lv_draw_img_dsc = {
14, /* size in bytes */
9, /* number of elements */
be_ctypes_instance_mappings,
(const be_ctypes_structure_item_t[9]) {
{ "angle", 1, 0, 0, 2, 0 },
{ "antialias", 13, 0, 1, 0, 0 },
@ -165,6 +186,7 @@ const be_ctypes_structure_t be_lv_draw_img_dsc = {
const be_ctypes_structure_t be_lv_draw_label_dsc = {
31, /* size in bytes */
15, /* number of elements */
be_ctypes_instance_mappings,
(const be_ctypes_structure_item_t[15]) {
{ "bidi_dir", 27, 0, 0, 1, 0 },
{ "blend_mode", 30, 0, 0, 1, 0 },
@ -186,6 +208,7 @@ const be_ctypes_structure_t be_lv_draw_label_dsc = {
const be_ctypes_structure_t be_lv_draw_mask_common_dsc = {
5, /* size in bytes */
2, /* number of elements */
be_ctypes_instance_mappings,
(const be_ctypes_structure_item_t[2]) {
{ "cb", 0, 0, 0, 4, 0 },
{ "type", 4, 0, 0, 1, 0 },
@ -194,6 +217,7 @@ const be_ctypes_structure_t be_lv_draw_mask_common_dsc = {
const be_ctypes_structure_t be_lv_draw_mask_line_param_cfg = {
9, /* size in bytes */
5, /* number of elements */
be_ctypes_instance_mappings,
(const be_ctypes_structure_item_t[5]) {
{ "p1_x", 0, 0, 0, 12, 0 },
{ "p1_y", 2, 0, 0, 12, 0 },
@ -205,6 +229,7 @@ const be_ctypes_structure_t be_lv_draw_mask_line_param_cfg = {
const be_ctypes_structure_t be_lv_draw_mask_line_param = {
35, /* size in bytes */
15, /* number of elements */
be_ctypes_instance_mappings,
(const be_ctypes_structure_item_t[15]) {
{ "cfg_p1_x", 5, 0, 0, 12, 0 },
{ "cfg_p1_y", 7, 0, 0, 12, 0 },
@ -226,6 +251,7 @@ const be_ctypes_structure_t be_lv_draw_mask_line_param = {
const be_ctypes_structure_t be_lv_draw_mask_angle_param_cfg = {
8, /* size in bytes */
4, /* number of elements */
be_ctypes_instance_mappings,
(const be_ctypes_structure_item_t[4]) {
{ "end_angle", 6, 0, 0, 12, 0 },
{ "start_angle", 4, 0, 0, 12, 0 },
@ -236,6 +262,7 @@ const be_ctypes_structure_t be_lv_draw_mask_angle_param_cfg = {
const be_ctypes_structure_t be_lv_draw_mask_angle_param = {
85, /* size in bytes */
37, /* number of elements */
be_ctypes_instance_mappings,
(const be_ctypes_structure_item_t[37]) {
{ "cfg_end_angle", 11, 0, 0, 12, 0 },
{ "cfg_start_angle", 9, 0, 0, 12, 0 },
@ -279,6 +306,7 @@ const be_ctypes_structure_t be_lv_draw_mask_angle_param = {
const be_ctypes_structure_t be_lv_draw_mask_radius_param_cfg = {
11, /* size in bytes */
6, /* number of elements */
be_ctypes_instance_mappings,
(const be_ctypes_structure_item_t[6]) {
{ "outer", 10, 0, 1, 0, 0 },
{ "radius", 8, 0, 0, 12, 0 },
@ -291,6 +319,7 @@ const be_ctypes_structure_t be_lv_draw_mask_radius_param_cfg = {
const be_ctypes_structure_t be_lv_sqrt_res = {
4, /* size in bytes */
2, /* number of elements */
be_ctypes_instance_mappings,
(const be_ctypes_structure_item_t[2]) {
{ "f", 2, 0, 0, 2, 0 },
{ "i", 0, 0, 0, 2, 0 },
@ -299,6 +328,7 @@ const be_ctypes_structure_t be_lv_sqrt_res = {
const be_ctypes_structure_t be_lv_draw_mask_radius_param = {
24, /* size in bytes */
11, /* number of elements */
be_ctypes_instance_mappings,
(const be_ctypes_structure_item_t[11]) {
{ "cfg_outer", 15, 0, 1, 0, 0 },
{ "cfg_radius", 13, 0, 0, 12, 0 },
@ -316,6 +346,7 @@ const be_ctypes_structure_t be_lv_draw_mask_radius_param = {
const be_ctypes_structure_t be_lv_draw_mask_fade_param_cfg = {
14, /* size in bytes */
8, /* number of elements */
be_ctypes_instance_mappings,
(const be_ctypes_structure_item_t[8]) {
{ "coords_x1", 0, 0, 0, 12, 0 },
{ "coords_x2", 4, 0, 0, 12, 0 },
@ -330,6 +361,7 @@ const be_ctypes_structure_t be_lv_draw_mask_fade_param_cfg = {
const be_ctypes_structure_t be_lv_draw_mask_fade_param = {
19, /* size in bytes */
10, /* number of elements */
be_ctypes_instance_mappings,
(const be_ctypes_structure_item_t[10]) {
{ "cfg_coords_x1", 5, 0, 0, 12, 0 },
{ "cfg_coords_x2", 9, 0, 0, 12, 0 },
@ -346,6 +378,7 @@ const be_ctypes_structure_t be_lv_draw_mask_fade_param = {
const be_ctypes_structure_t be_lv_draw_mask_map_param_cfg = {
12, /* size in bytes */
5, /* number of elements */
be_ctypes_instance_mappings,
(const be_ctypes_structure_item_t[5]) {
{ "coords_x1", 0, 0, 0, 12, 0 },
{ "coords_x2", 4, 0, 0, 12, 0 },
@ -357,6 +390,7 @@ const be_ctypes_structure_t be_lv_draw_mask_map_param_cfg = {
const be_ctypes_structure_t be_lv_draw_mask_map_param = {
17, /* size in bytes */
7, /* number of elements */
be_ctypes_instance_mappings,
(const be_ctypes_structure_item_t[7]) {
{ "cfg_coords_x1", 5, 0, 0, 12, 0 },
{ "cfg_coords_x2", 9, 0, 0, 12, 0 },
@ -370,6 +404,7 @@ const be_ctypes_structure_t be_lv_draw_mask_map_param = {
const be_ctypes_structure_t be_lv_draw_mask_saved = {
8, /* size in bytes */
2, /* number of elements */
be_ctypes_instance_mappings,
(const be_ctypes_structure_item_t[2]) {
{ "custom_id", 4, 0, 0, 4, 0 },
{ "param", 0, 0, 0, 4, 0 },
@ -380,97 +415,45 @@ const char * be_ctypes_instance_mappings[] = {
NULL
};
const be_ctypes_classes_t be_ctypes_classes[] = {
19,
be_ctypes_instance_mappings,
(const be_ctypes_class_t[19]) {
{ "lv_area", &be_lv_area },
{ "lv_draw_img_dsc", &be_lv_draw_img_dsc },
{ "lv_draw_label_dsc", &be_lv_draw_label_dsc },
{ "lv_draw_line_dsc", &be_lv_draw_line_dsc },
{ "lv_draw_mask_angle_param", &be_lv_draw_mask_angle_param },
{ "lv_draw_mask_angle_param_cfg", &be_lv_draw_mask_angle_param_cfg },
{ "lv_draw_mask_common_dsc", &be_lv_draw_mask_common_dsc },
{ "lv_draw_mask_fade_param", &be_lv_draw_mask_fade_param },
{ "lv_draw_mask_fade_param_cfg", &be_lv_draw_mask_fade_param_cfg },
{ "lv_draw_mask_line_param", &be_lv_draw_mask_line_param },
{ "lv_draw_mask_line_param_cfg", &be_lv_draw_mask_line_param_cfg },
{ "lv_draw_mask_map_param", &be_lv_draw_mask_map_param },
{ "lv_draw_mask_map_param_cfg", &be_lv_draw_mask_map_param_cfg },
{ "lv_draw_mask_radius_param", &be_lv_draw_mask_radius_param },
{ "lv_draw_mask_radius_param_cfg", &be_lv_draw_mask_radius_param_cfg },
{ "lv_draw_mask_saved", &be_lv_draw_mask_saved },
{ "lv_draw_rect_dsc", &be_lv_draw_rect_dsc },
{ "lv_point", &be_lv_point },
{ "lv_sqrt_res", &be_lv_sqrt_res },
}};
/* @const_object_info_begin
class be_class_ctypes_classes (scope: global) {
lv_area, int(0)
lv_draw_img_dsc, int(0)
lv_draw_label_dsc, int(0)
lv_draw_line_dsc, int(0)
lv_draw_mask_angle_param, int(0)
lv_draw_mask_angle_param_cfg, int(0)
lv_draw_mask_common_dsc, int(0)
lv_draw_mask_fade_param, int(0)
lv_draw_mask_fade_param_cfg, int(0)
lv_draw_mask_line_param, int(0)
lv_draw_mask_line_param_cfg, int(0)
lv_draw_mask_map_param, int(0)
lv_draw_mask_map_param_cfg, int(0)
lv_draw_mask_radius_param, int(0)
lv_draw_mask_radius_param_cfg, int(0)
lv_draw_mask_saved, int(0)
lv_draw_rect_dsc, int(0)
lv_point, int(0)
lv_sqrt_res, int(0)
}
@const_object_info_end */
static be_define_ctypes_class(lv_area, &be_lv_area, &be_class_ctypes, "lv_area");
static be_define_ctypes_class(lv_draw_img_dsc, &be_lv_draw_img_dsc, &be_class_ctypes, "lv_draw_img_dsc");
static be_define_ctypes_class(lv_draw_label_dsc, &be_lv_draw_label_dsc, &be_class_ctypes, "lv_draw_label_dsc");
static be_define_ctypes_class(lv_draw_line_dsc, &be_lv_draw_line_dsc, &be_class_ctypes, "lv_draw_line_dsc");
static be_define_ctypes_class(lv_draw_mask_angle_param, &be_lv_draw_mask_angle_param, &be_class_ctypes, "lv_draw_mask_angle_param");
static be_define_ctypes_class(lv_draw_mask_angle_param_cfg, &be_lv_draw_mask_angle_param_cfg, &be_class_ctypes, "lv_draw_mask_angle_param_cfg");
static be_define_ctypes_class(lv_draw_mask_common_dsc, &be_lv_draw_mask_common_dsc, &be_class_ctypes, "lv_draw_mask_common_dsc");
static be_define_ctypes_class(lv_draw_mask_fade_param, &be_lv_draw_mask_fade_param, &be_class_ctypes, "lv_draw_mask_fade_param");
static be_define_ctypes_class(lv_draw_mask_fade_param_cfg, &be_lv_draw_mask_fade_param_cfg, &be_class_ctypes, "lv_draw_mask_fade_param_cfg");
static be_define_ctypes_class(lv_draw_mask_line_param, &be_lv_draw_mask_line_param, &be_class_ctypes, "lv_draw_mask_line_param");
static be_define_ctypes_class(lv_draw_mask_line_param_cfg, &be_lv_draw_mask_line_param_cfg, &be_class_ctypes, "lv_draw_mask_line_param_cfg");
static be_define_ctypes_class(lv_draw_mask_map_param, &be_lv_draw_mask_map_param, &be_class_ctypes, "lv_draw_mask_map_param");
static be_define_ctypes_class(lv_draw_mask_map_param_cfg, &be_lv_draw_mask_map_param_cfg, &be_class_ctypes, "lv_draw_mask_map_param_cfg");
static be_define_ctypes_class(lv_draw_mask_radius_param, &be_lv_draw_mask_radius_param, &be_class_ctypes, "lv_draw_mask_radius_param");
static be_define_ctypes_class(lv_draw_mask_radius_param_cfg, &be_lv_draw_mask_radius_param_cfg, &be_class_ctypes, "lv_draw_mask_radius_param_cfg");
static be_define_ctypes_class(lv_draw_mask_saved, &be_lv_draw_mask_saved, &be_class_ctypes, "lv_draw_mask_saved");
static be_define_ctypes_class(lv_draw_rect_dsc, &be_lv_draw_rect_dsc, &be_class_ctypes, "lv_draw_rect_dsc");
static be_define_ctypes_class(lv_point, &be_lv_point, &be_class_ctypes, "lv_point");
static be_define_ctypes_class(lv_sqrt_res, &be_lv_sqrt_res, &be_class_ctypes, "lv_sqrt_res");
void be_load_ctypes_definitions_lib(bvm *vm) {
be_pushcomptr(vm, (void*) be_ctypes_classes);
be_setglobal(vm, ".ctypes_classes");
be_pop(vm, 1);
static be_define_const_empty_class(be_class_lv_area, &be_class_lv_ctypes, lv_area);
ctypes_register_class(vm, &be_class_lv_area, &be_lv_area);
static be_define_const_empty_class(be_class_lv_draw_img_dsc, &be_class_lv_ctypes, lv_draw_img_dsc);
ctypes_register_class(vm, &be_class_lv_draw_img_dsc, &be_lv_draw_img_dsc);
static be_define_const_empty_class(be_class_lv_draw_label_dsc, &be_class_lv_ctypes, lv_draw_label_dsc);
ctypes_register_class(vm, &be_class_lv_draw_label_dsc, &be_lv_draw_label_dsc);
static be_define_const_empty_class(be_class_lv_draw_line_dsc, &be_class_lv_ctypes, lv_draw_line_dsc);
ctypes_register_class(vm, &be_class_lv_draw_line_dsc, &be_lv_draw_line_dsc);
static be_define_const_empty_class(be_class_lv_draw_mask_angle_param, &be_class_lv_ctypes, lv_draw_mask_angle_param);
ctypes_register_class(vm, &be_class_lv_draw_mask_angle_param, &be_lv_draw_mask_angle_param);
static be_define_const_empty_class(be_class_lv_draw_mask_angle_param_cfg, &be_class_lv_ctypes, lv_draw_mask_angle_param_cfg);
ctypes_register_class(vm, &be_class_lv_draw_mask_angle_param_cfg, &be_lv_draw_mask_angle_param_cfg);
static be_define_const_empty_class(be_class_lv_draw_mask_common_dsc, &be_class_lv_ctypes, lv_draw_mask_common_dsc);
ctypes_register_class(vm, &be_class_lv_draw_mask_common_dsc, &be_lv_draw_mask_common_dsc);
static be_define_const_empty_class(be_class_lv_draw_mask_fade_param, &be_class_lv_ctypes, lv_draw_mask_fade_param);
ctypes_register_class(vm, &be_class_lv_draw_mask_fade_param, &be_lv_draw_mask_fade_param);
static be_define_const_empty_class(be_class_lv_draw_mask_fade_param_cfg, &be_class_lv_ctypes, lv_draw_mask_fade_param_cfg);
ctypes_register_class(vm, &be_class_lv_draw_mask_fade_param_cfg, &be_lv_draw_mask_fade_param_cfg);
static be_define_const_empty_class(be_class_lv_draw_mask_line_param, &be_class_lv_ctypes, lv_draw_mask_line_param);
ctypes_register_class(vm, &be_class_lv_draw_mask_line_param, &be_lv_draw_mask_line_param);
static be_define_const_empty_class(be_class_lv_draw_mask_line_param_cfg, &be_class_lv_ctypes, lv_draw_mask_line_param_cfg);
ctypes_register_class(vm, &be_class_lv_draw_mask_line_param_cfg, &be_lv_draw_mask_line_param_cfg);
static be_define_const_empty_class(be_class_lv_draw_mask_map_param, &be_class_lv_ctypes, lv_draw_mask_map_param);
ctypes_register_class(vm, &be_class_lv_draw_mask_map_param, &be_lv_draw_mask_map_param);
static be_define_const_empty_class(be_class_lv_draw_mask_map_param_cfg, &be_class_lv_ctypes, lv_draw_mask_map_param_cfg);
ctypes_register_class(vm, &be_class_lv_draw_mask_map_param_cfg, &be_lv_draw_mask_map_param_cfg);
static be_define_const_empty_class(be_class_lv_draw_mask_radius_param, &be_class_lv_ctypes, lv_draw_mask_radius_param);
ctypes_register_class(vm, &be_class_lv_draw_mask_radius_param, &be_lv_draw_mask_radius_param);
static be_define_const_empty_class(be_class_lv_draw_mask_radius_param_cfg, &be_class_lv_ctypes, lv_draw_mask_radius_param_cfg);
ctypes_register_class(vm, &be_class_lv_draw_mask_radius_param_cfg, &be_lv_draw_mask_radius_param_cfg);
static be_define_const_empty_class(be_class_lv_draw_mask_saved, &be_class_lv_ctypes, lv_draw_mask_saved);
ctypes_register_class(vm, &be_class_lv_draw_mask_saved, &be_lv_draw_mask_saved);
static be_define_const_empty_class(be_class_lv_draw_rect_dsc, &be_class_lv_ctypes, lv_draw_rect_dsc);
ctypes_register_class(vm, &be_class_lv_draw_rect_dsc, &be_lv_draw_rect_dsc);
static be_define_const_empty_class(be_class_lv_point, &be_class_lv_ctypes, lv_point);
ctypes_register_class(vm, &be_class_lv_point, &be_lv_point);
static be_define_const_empty_class(be_class_lv_sqrt_res, &be_class_lv_ctypes, lv_sqrt_res);
ctypes_register_class(vm, &be_class_lv_sqrt_res, &be_lv_sqrt_res);
}
/********************************************************************/

View File

@ -10,27 +10,12 @@
extern int lvx_init(bvm *vm); // generic function
extern int lvx_tostring(bvm *vm); // generic function
#if BE_USE_PRECOMPILED_OBJECT
#include "../generate/be_fixed_be_class_lv_font.h"
#endif
void be_load_lvgl_font_lib(bvm *vm) {
#if !BE_USE_PRECOMPILED_OBJECT
static const bnfuncinfo members[] = {
{ ".p", NULL }, // keeping track of styles to avoid GC
{ "init", lvx_init },
{ "tostring", lvx_tostring },
// { NULL, (bntvfunc) BE_CLOSURE }, /* mark section for berry closures */
{ NULL, NULL }
};
be_regclass(vm, "lv_font", members);
#else
be_pushntvclass(vm, &be_class_lv_font);
be_setglobal(vm, "lv_font");
be_pop(vm, 1);
#endif
}
/* @const_object_info_begin

View File

@ -157,14 +157,14 @@ be_local_closure(my_design_cb, /* name */
0x04380A08, // 0046 SUB R14 R5 R8
0x0C3C0D03, // 0047 DIV R15 R6 K3
0x043C1E09, // 0048 SUB R15 R15 R9
0x60400007, // 0049 GETGBL R16 G7
0x60400009, // 0049 GETGBL R16 G9
0x54460059, // 004A LDINT R17 90
0x8C480719, // 004B GETMET R18 R3 K25
0x8C50071A, // 004C GETMET R20 R3 K26
0x60580011, // 004D GETGBL R22 G17
0x6058000A, // 004D GETGBL R22 G10
0x5C5C1E00, // 004E MOVE R23 R15
0x7C580200, // 004F CALL R22 1
0x605C0011, // 0050 GETGBL R23 G17
0x605C000A, // 0050 GETGBL R23 G10
0x5C601C00, // 0051 MOVE R24 R14
0x7C5C0200, // 0052 CALL R23 1
0x0C582C17, // 0053 DIV R22 R22 R23
@ -327,7 +327,7 @@ be_local_closure(init, /* name */
(be_nested_const_str("init", 380752755, 4)),
(be_nested_const_str("input", -103256197, 5)),
( &(const binstruction[28]) { /* code */
0x600C0014, // 0000 GETGBL R3 G20
0x600C0003, // 0000 GETGBL R3 G3
0x5C100000, // 0001 MOVE R4 R0
0x7C0C0200, // 0002 CALL R3 1
0x8C0C0700, // 0003 GETMET R3 R3 K0

View File

@ -149,7 +149,7 @@ be_local_closure(my_design_cb, /* name */
0xB83E0800, // 003F GETNGBL R15 K4
0x883C1F16, // 0040 GETMBR R15 R15 K22
0x7C300600, // 0041 CALL R12 3
0x60340000, // 0042 GETGBL R13 G0
0x60340010, // 0042 GETGBL R13 G16
0x403A3102, // 0043 CONNECT R14 K24 K2
0x7C340200, // 0044 CALL R13 1
0xA802002C, // 0045 EXBLK 0 #0073
@ -268,7 +268,7 @@ be_local_closure(init, /* name */
(be_nested_const_str("init", 380752755, 4)),
(be_nested_const_str("input", -103256197, 5)),
( &(const binstruction[28]) { /* code */
0x600C0014, // 0000 GETGBL R3 G20
0x600C0003, // 0000 GETGBL R3 G3
0x5C100000, // 0001 MOVE R4 R0
0x7C0C0200, // 0002 CALL R3 1
0x8C0C0700, // 0003 GETMET R3 R3 K0

View File

@ -41,7 +41,7 @@ be_local_closure(init, /* name */
(be_nested_const_str("init", 380752755, 4)),
(be_nested_const_str("input", -103256197, 5)),
( &(const binstruction[52]) { /* code */
0x600C0014, // 0000 GETGBL R3 G20
0x600C0003, // 0000 GETGBL R3 G3
0x5C100000, // 0001 MOVE R4 R0
0x7C0C0200, // 0002 CALL R3 1
0x8C0C0700, // 0003 GETMET R3 R3 K0

View File

@ -84,7 +84,7 @@ be_local_closure(init, /* name */
(be_nested_const_str("init", 380752755, 4)),
(be_nested_const_str("input", -103256197, 5)),
( &(const binstruction[15]) { /* code */
0x600C0014, // 0000 GETGBL R3 G20
0x600C0003, // 0000 GETGBL R3 G3
0x5C100000, // 0001 MOVE R4 R0
0x7C0C0200, // 0002 CALL R3 1
0x8C0C0700, // 0003 GETMET R3 R3 K0
@ -126,7 +126,7 @@ be_local_closure(del, /* name */
(be_nested_const_str("del", -816214454, 3)),
(be_nested_const_str("input", -103256197, 5)),
( &(const binstruction[10]) { /* code */
0x60040014, // 0000 GETGBL R1 G20
0x60040003, // 0000 GETGBL R1 G3
0x5C080000, // 0001 MOVE R2 R0
0x7C040200, // 0002 CALL R1 1
0x8C040300, // 0003 GETMET R1 R1 K0

View File

@ -40,7 +40,7 @@ be_local_closure(init, /* name */
(be_nested_const_str("init", 380752755, 4)),
(be_nested_const_str("input", -103256197, 5)),
( &(const binstruction[49]) { /* code */
0x600C0014, // 0000 GETGBL R3 G20
0x600C0003, // 0000 GETGBL R3 G3
0x5C100000, // 0001 MOVE R4 R0
0x7C0C0200, // 0002 CALL R3 1
0x8C0C0700, // 0003 GETMET R3 R3 K0

View File

@ -84,7 +84,7 @@ be_local_closure(init, /* name */
(be_nested_const_str("init", 380752755, 4)),
(be_nested_const_str("input", -103256197, 5)),
( &(const binstruction[15]) { /* code */
0x600C0014, // 0000 GETGBL R3 G20
0x600C0003, // 0000 GETGBL R3 G3
0x5C100000, // 0001 MOVE R4 R0
0x7C0C0200, // 0002 CALL R3 1
0x8C0C0700, // 0003 GETMET R3 R3 K0
@ -126,7 +126,7 @@ be_local_closure(del, /* name */
(be_nested_const_str("del", -816214454, 3)),
(be_nested_const_str("input", -103256197, 5)),
( &(const binstruction[10]) { /* code */
0x60040014, // 0000 GETGBL R1 G20
0x60040003, // 0000 GETGBL R1 G3
0x5C080000, // 0001 MOVE R2 R0
0x7C040200, // 0002 CALL R1 1
0x8C040300, // 0003 GETMET R1 R1 K0

View File

@ -11,27 +11,12 @@ extern int m_md5_init(bvm *vm);
extern int m_md5_update(bvm *vm);
extern int m_md5_finish(bvm *vm);
#if BE_USE_PRECOMPILED_OBJECT
#include "../generate/be_fixed_be_class_md5.h"
#endif
void be_load_md5_lib(bvm *vm) {
#if !BE_USE_PRECOMPILED_OBJECT
static const bnfuncinfo members[] = {
{ ".p", NULL },
{ "init", m_md5_init },
{ "update", m_md5_update },
{ "finish", m_md5_finish },
{ NULL, NULL }
};
be_regclass(vm, "MD5", members);
#else
be_pushntvclass(vm, &be_class_md5);
be_setglobal(vm, "MD5");
be_pop(vm, 1);
#endif
}
/* @const_object_info_begin

View File

@ -114,6 +114,8 @@ extern void be_load_md5_lib(bvm *vm);
extern void be_load_webclient_lib(bvm *vm);
extern void be_load_crypto_lib(bvm *vm);
extern void be_load_ctypes_lib(bvm *vm);
#ifdef USE_I2S_AUDIO_BERRY
extern void be_load_driver_audio_lib(bvm *vm);
#endif
@ -124,7 +126,6 @@ extern void be_load_lvgl_font_lib(bvm *vm);
extern void be_load_lv_all_lib(bvm *vm);
extern void be_load_lvgl_cb_lib(bvm *vm);
extern void be_load_lvgl_cb_all_lib(bvm *vm);
extern void be_load_lvgl_ctypes_lib(bvm *vm);
extern void be_load_ctypes_definitions_lib(bvm *vm);
// custom widgets
extern void be_load_lv_signal_bars_class(bvm *vm);
@ -150,6 +151,7 @@ BERRY_API void be_load_custom_libs(bvm *vm)
be_load_Driver_class(vm);
be_load_md5_lib(vm);
be_load_serial_lib(vm);
be_load_ctypes_lib(vm);
#ifdef USE_ALEXA_AVS
be_load_crypto_lib(vm);
#endif
@ -175,7 +177,6 @@ BERRY_API void be_load_custom_libs(bvm *vm)
be_load_lv_all_lib(vm);
be_load_lvgl_cb_lib(vm);
be_load_lvgl_cb_all_lib(vm);
be_load_lvgl_ctypes_lib(vm);
be_load_ctypes_definitions_lib(vm);
// custom widgets
be_load_lv_signal_bars_class(vm);

View File

@ -16,6 +16,7 @@
#include "be_strlib.h"
#include "be_mem.h"
#include "be_sys.h"
#include <time.h>
static int m_path_exists(bvm *vm)
{
@ -26,20 +27,25 @@ static int m_path_exists(bvm *vm)
be_pushbool(vm, be_isexist(path));
be_return(vm);
}
extern time_t be_last_modified(void *hfile);
#if !BE_USE_PRECOMPILED_OBJECT
be_native_module_attr_table(path) {
be_native_module_function("exists", m_path_exists),
};
static int m_path_last_modified(bvm *vm)
{
if (be_top(vm) >= 1 && be_isstring(vm, 1)) {
const char *path = be_tostring(vm, 1);
void * f = be_fopen(path, "r");
if (f) {
be_pushint(vm, be_last_modified(f));
be_return(vm);
}
}
be_return_nil(vm);
}
static be_define_native_module(path, NULL);
#else
/* @const_object_info_begin
module path (scope: global, file: tasmota_path) {
exists, func(m_path_exists)
last_modified, func(m_path_last_modified)
}
@const_object_info_end */
#include "../generate/be_fixed_tasmota_path.h"
#endif

View File

@ -248,6 +248,17 @@ size_t be_fsize(void *hfile)
return 0;
}
extern "C" time_t be_last_modified(void *hfile)
{
#ifdef USE_UFILESYS
if (ufsp != nullptr && hfile != nullptr) {
File * f_ptr = (File*) hfile;
return f_ptr->getLastWrite();
}
#endif // USE_UFILESYS
return 0;
}
int be_isexist(const char *filename)
{
#ifdef USE_UFILESYS

File diff suppressed because it is too large Load Diff

View File

@ -19,35 +19,35 @@ be_local_closure(tostring, /* name */
NULL, /* no sub protos */
1, /* has constants */
( &(const bvalue[ 6]) { /* constants */
be_nested_string("string", 398550328, 6), /* R256 - K0 */
be_nested_string("format", -1180859054, 6), /* R257 - K1 */
be_nested_string("<instance: %s(%s, %s, %s)", 257363333, 25), /* R258 - K2 */
be_nested_string("due", -399437003, 3), /* R259 - K3 */
be_nested_string("f", -485742695, 1), /* R260 - K4 */
be_nested_string("id", 926444256, 2), /* R261 - K5 */
/* K0 */ be_nested_string("string", 398550328, 6),
/* K1 */ be_nested_string("format", -1180859054, 6),
/* K2 */ be_nested_string("<instance: %s(%s, %s, %s)", 257363333, 25),
/* K3 */ be_nested_string("due", -399437003, 3),
/* K4 */ be_nested_string("f", -485742695, 1),
/* K5 */ be_nested_string("id", 926444256, 2),
}),
(be_nested_const_str("tostring", -1995258651, 8)),
(be_nested_const_str("input", -103256197, 5)),
(be_nested_const_str("Tasmota.be", 825809411, 10)),
( &(const binstruction[19]) { /* code */
0xA4060000, // 0000 IMPORT R1 R256
0x8C080301, // 0001 GETMET R2 R1 R257
0x58100002, // 0002 LDCONST R4 K2
0x60140013, // 0003 GETGBL R5 G19
0x60180004, // 0004 GETGBL R6 G4
0x5C1C0000, // 0005 MOVE R7 R0
0x7C180200, // 0006 CALL R6 1
0x7C140200, // 0007 CALL R5 1
0x60180013, // 0008 GETGBL R6 G19
0x881C0103, // 0009 GETMBR R7 R0 R259
0x7C180200, // 000A CALL R6 1
0x601C0013, // 000B GETGBL R7 G19
0x88200104, // 000C GETMBR R8 R0 R260
0x7C1C0200, // 000D CALL R7 1
0x60200013, // 000E GETGBL R8 G19
0x88240105, // 000F GETMBR R9 R0 R261
0x7C200200, // 0010 CALL R8 1
0x7C080C00, // 0011 CALL R2 6
0x80040400, // 0012 RET 1 R2
0xA4060000, // 0000 IMPORT R1 K0
0x8C080301, // 0001 GETMET R2 R1 K1
0x58100002, // 0002 LDCONST R4 K2
0x60140008, // 0003 GETGBL R5 G8
0x60180006, // 0004 GETGBL R6 G6
0x5C1C0000, // 0005 MOVE R7 R0
0x7C180200, // 0006 CALL R6 1
0x7C140200, // 0007 CALL R5 1
0x60180008, // 0008 GETGBL R6 G8
0x881C0103, // 0009 GETMBR R7 R0 K3
0x7C180200, // 000A CALL R6 1
0x601C0008, // 000B GETGBL R7 G8
0x88200104, // 000C GETMBR R8 R0 K4
0x7C1C0200, // 000D CALL R7 1
0x60200008, // 000E GETGBL R8 G8
0x88240105, // 000F GETMBR R9 R0 K5
0x7C200200, // 0010 CALL R8 1
0x7C080C00, // 0011 CALL R2 6
0x80040400, // 0012 RET 1 R2
})
)
);
@ -68,17 +68,17 @@ be_local_closure(init, /* name */
NULL, /* no sub protos */
1, /* has constants */
( &(const bvalue[ 3]) { /* constants */
be_nested_string("due", -399437003, 3), /* R256 - K0 */
be_nested_string("f", -485742695, 1), /* R257 - K1 */
be_nested_string("id", 926444256, 2), /* R258 - K2 */
/* K0 */ be_nested_string("due", -399437003, 3),
/* K1 */ be_nested_string("f", -485742695, 1),
/* K2 */ be_nested_string("id", 926444256, 2),
}),
(be_nested_const_str("init", 380752755, 4)),
(be_nested_const_str("input", -103256197, 5)),
(be_nested_const_str("Tasmota.be", 825809411, 10)),
( &(const binstruction[ 4]) { /* code */
0x90020001, // 0000 SETMBR R0 R256 R1
0x90020202, // 0001 SETMBR R0 R257 R2
0x90020403, // 0002 SETMBR R0 R258 R3
0x80000000, // 0003 RET 0 R0
0x90020001, // 0000 SETMBR R0 K0 R1
0x90020202, // 0001 SETMBR R0 K1 R2
0x90020403, // 0002 SETMBR R0 K2 R3
0x80000000, // 0003 RET 0
})
)
);

View File

@ -27,32 +27,7 @@ extern int w_webserver_arg(bvm *vm);
extern int w_webserver_arg_name(bvm *vm);
extern int w_webserver_has_arg(bvm *vm);
#if !BE_USE_PRECOMPILED_OBJECT
be_native_module_attr_table(webserver) {
be_native_module_function("member", w_webserver_member),
be_native_module_function("on", w_webserver_on),
be_native_module_function("state", w_webserver_state),
be_native_module_function("check_privileged_access", w_webserver_check_privileged_access),
be_native_module_function("redirect", w_webserver_redirect),
be_native_module_function("content_start", w_webserver_content_start),
be_native_module_function("content_send", w_webserver_content_send),
be_native_module_function("content_send_style", w_webserver_content_send_style),
be_native_module_function("content_flush", w_webserver_content_flush),
be_native_module_function("content_start", w_webserver_content_start),
be_native_module_function("content_stop", w_webserver_content_stop),
be_native_module_function("content_button", w_webserver_content_button),
be_native_module_function("arg_size", w_webserver_argsize),
be_native_module_function("arg", w_webserver_arg),
be_native_module_function("arg_name", w_webserver_arg_name),
be_native_module_function("has_arg", w_webserver_has_arg),
};
be_define_native_module(webserver, NULL);
#else
/* @const_object_info_begin
module webserver (scope: global) {
member, func(w_webserver_member)
@ -77,6 +52,5 @@ module webserver (scope: global) {
}
@const_object_info_end */
#include "../generate/be_fixed_webserver.h"
#endif
#endif // USE_WEBSERVER

View File

@ -25,18 +25,43 @@ extern int b_wire_validread(bvm *vm);
extern int b_wire_detect(bvm *vm);
/********************************************************************
"def read_bytes(addr,reg,size) "
"self._begin_transmission(addr) "
"self._write(reg) "
"self._end_transmission(false) "
"self._request_from(addr,size) "
"var ret=bytes(size) "
"while (self._available()) "
"ret..self._read() "
"end "
"return ret "
"end "
** Solidified function: write_bytes
********************************************************************/
be_local_closure(write_bytes, /* name */
be_nested_proto(
7, /* nstack */
4, /* argc */
0, /* 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_string("_begin_transmission", -1515506120, 19),
/* K1 */ be_nested_string("_write", -2079504471, 6),
/* K2 */ be_nested_string("_end_transmission", -1057486896, 17),
}),
(be_nested_const_str("write_bytes", 1227543792, 11)),
(be_nested_const_str("input", -103256197, 5)),
( &(const binstruction[12]) { /* code */
0x8C100100, // 0000 GETMET R4 R0 K0
0x5C180200, // 0001 MOVE R6 R1
0x7C100400, // 0002 CALL R4 2
0x8C100101, // 0003 GETMET R4 R0 K1
0x5C180400, // 0004 MOVE R6 R2
0x7C100400, // 0005 CALL R4 2
0x8C100101, // 0006 GETMET R4 R0 K1
0x5C180600, // 0007 MOVE R6 R3
0x7C100400, // 0008 CALL R4 2
0x8C100102, // 0009 GETMET R4 R0 K2
0x7C100200, // 000A CALL R4 1
0x80000000, // 000B RET 0
})
)
);
/*******************************************************************/
/********************************************************************
** Solidified function: read_bytes
@ -51,37 +76,37 @@ be_local_closure(read_bytes, /* name */
0, /* has sup protos */
NULL, /* no sub protos */
1, /* has constants */
( &(const bvalue[ 6]) { /* upvals */
{ { .s=be_nested_const_str("_begin_transmission", -1515506120, 19) }, BE_STRING},
{ { .s=be_nested_const_str("_write", -2079504471, 6) }, BE_STRING},
{ { .s=be_nested_const_str("_end_transmission", -1057486896, 17) }, BE_STRING},
{ { .s=be_nested_const_str("_request_from", -329818692, 13) }, BE_STRING},
{ { .s=be_nested_const_str("_available", 1306196581, 10) }, BE_STRING},
{ { .s=be_nested_const_str("_read", 346717030, 5) }, BE_STRING},
( &(const bvalue[ 6]) { /* constants */
/* K0 */ be_nested_string("_begin_transmission", -1515506120, 19),
/* K1 */ be_nested_string("_write", -2079504471, 6),
/* K2 */ be_nested_string("_end_transmission", -1057486896, 17),
/* K3 */ be_nested_string("_request_from", -329818692, 13),
/* K4 */ be_nested_string("_available", 1306196581, 10),
/* K5 */ be_nested_string("_read", 346717030, 5),
}),
(be_nested_const_str("read_bytes", -718234123, 10)),
(be_nested_const_str("string", 398550328, 6)),
(be_nested_const_str("input", -103256197, 5)),
( &(const binstruction[24]) { /* code */
0x8C100100, // 0000 GETMET R4 R0 R256
0x8C100100, // 0000 GETMET R4 R0 K0
0x5C180200, // 0001 MOVE R6 R1
0x7C100400, // 0002 CALL R4 2
0x8C100101, // 0003 GETMET R4 R0 R257
0x8C100101, // 0003 GETMET R4 R0 K1
0x5C180400, // 0004 MOVE R6 R2
0x7C100400, // 0005 CALL R4 2
0x8C100102, // 0006 GETMET R4 R0 R258
0x8C100102, // 0006 GETMET R4 R0 K2
0x50180000, // 0007 LDBOOL R6 0 0
0x7C100400, // 0008 CALL R4 2
0x8C100103, // 0009 GETMET R4 R0 R259
0x8C100103, // 0009 GETMET R4 R0 K3
0x5C180200, // 000A MOVE R6 R1
0x5C1C0600, // 000B MOVE R7 R3
0x7C100600, // 000C CALL R4 3
0x60100002, // 000D GETGBL R4 G2
0x60100015, // 000D GETGBL R4 G21
0x5C140600, // 000E MOVE R5 R3
0x7C100200, // 000F CALL R4 1
0x8C140104, // 0010 GETMET R5 R0 R260
0x8C140104, // 0010 GETMET R5 R0 K4
0x7C140200, // 0011 CALL R5 1
0x78160003, // 0012 JMPF R5 #0017
0x8C140105, // 0013 GETMET R5 R0 R261
0x8C140105, // 0013 GETMET R5 R0 K5
0x7C140200, // 0014 CALL R5 1
0x40140805, // 0015 CONNECT R5 R4 R5
0x7001FFF8, // 0016 JMP #0010
@ -92,85 +117,12 @@ be_local_closure(read_bytes, /* name */
/*******************************************************************/
/********************************************************************
"def write_bytes(addr,reg,b) "
"self._begin_transmission(addr) "
"self._write(reg) "
"self._write(b) "
"self._end_transmission() "
"end "
********************************************************************/
/********************************************************************
** Solidified function: write_bytes
********************************************************************/
be_local_closure(write_bytes, /* name */
be_nested_proto(
7, /* nstack */
4, /* argc */
0, /* varg */
0, /* has upvals */
NULL, /* no upvals */
0, /* has sup protos */
NULL, /* no sub protos */
1, /* has constants */
( &(const bvalue[ 3]) { /* upvals */
{ { .s=be_nested_const_str("_begin_transmission", -1515506120, 19) }, BE_STRING},
{ { .s=be_nested_const_str("_write", -2079504471, 6) }, BE_STRING},
{ { .s=be_nested_const_str("_end_transmission", -1057486896, 17) }, BE_STRING},
}),
(be_nested_const_str("write_bytes", 1227543792, 11)),
(be_nested_const_str("string", 398550328, 6)),
( &(const binstruction[12]) { /* code */
0x8C100100, // 0000 GETMET R4 R0 R256
0x5C180200, // 0001 MOVE R6 R1
0x7C100400, // 0002 CALL R4 2
0x8C100101, // 0003 GETMET R4 R0 R257
0x5C180400, // 0004 MOVE R6 R2
0x7C100400, // 0005 CALL R4 2
0x8C100101, // 0006 GETMET R4 R0 R257
0x5C180600, // 0007 MOVE R6 R3
0x7C100400, // 0008 CALL R4 2
0x8C100102, // 0009 GETMET R4 R0 R258
0x7C100200, // 000A CALL R4 1
0x80000000, // 000B RET 0 R0
})
)
);
/*******************************************************************/
#if BE_USE_PRECOMPILED_OBJECT
#include "../generate/be_fixed_be_class_tasmota_wire.h"
#endif
void be_load_wirelib(bvm *vm) {
#if !BE_USE_PRECOMPILED_OBJECT
static const bnfuncinfo members[] = {
{ "bus", NULL }, // bus number
{ "init", b_wire_init },
{ "_begin_transmission", b_wire_begintransmission },
{ "_end_transmission", b_wire_endtransmission },
{ "_request_from", b_wire_requestfrom },
{ "_available", b_wire_available },
{ "_write", b_wire_write },
{ "_read", b_wire_read },
{ "scan", b_wire_scan },
{ "write", b_wire_validwrite },
{ "read", b_wire_validread },
{ "detect", b_wire_detect },
{ NULL, (bntvfunc) BE_CLOSURE }, /* mark section for berry closures */
{ "read_bytes", (bntvfunc) &read_bytes_closure },
{ "write_bytes", (bntvfunc) &write_bytes_closure },
{ NULL, NULL }
};
be_regclass(vm, "Wire", members);
#else
be_pushntvclass(vm, &be_class_tasmota_wire);
be_setglobal(vm, "Wire");
be_pop(vm, 1);
#endif
}
/* @const_object_info_begin

View File

@ -0,0 +1,25 @@
#- Native code used for testing and code solidification -#
#- Do not use it -#
class Wire
var bus
def read_bytes(addr,reg,size)
self._begin_transmission(addr)
self._write(reg)
self._end_transmission(false)
self._request_from(addr,size)
var ret=bytes(size)
while (self._available())
ret..self._read()
end
return ret
end
def write_bytes(addr,reg,b)
self._begin_transmission(addr)
self._write(reg)
self._write(b)
self._end_transmission()
end
end

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,21 +1,21 @@
#include "be_constobj.h"
static be_define_const_map_slots(be_class_lv_ctypes_map) {
static be_define_const_map_slots(be_class_ctypes_map) {
{ be_const_key(init, -1), be_const_func(be_ctypes_init) },
{ be_const_key(setmember, 2), be_const_func(be_ctypes_setmember) },
{ be_const_key(_def, 3), be_const_nil() },
{ be_const_key(member, -1), be_const_func(be_ctypes_member) },
{ be_const_key(dot_def, -1), be_const_var(0) },
{ be_const_key(copy, -1), be_const_func(be_ctypes_copy) },
};
static be_define_const_map(
be_class_lv_ctypes_map,
be_class_ctypes_map,
5
);
BE_EXPORT_VARIABLE be_define_const_class(
be_class_lv_ctypes,
1,
be_class_ctypes,
0,
(bclass *)&be_class_bytes,
ctypes_bytes
);

View File

@ -1,35 +0,0 @@
#include "be_constobj.h"
static be_define_const_map_slots(be_class_ctypes_classes_map) {
{ be_const_key(lv_draw_mask_radius_param_cfg, -1), be_const_int(0) },
{ be_const_key(lv_draw_img_dsc, 14), be_const_int(0) },
{ be_const_key(lv_draw_mask_radius_param, -1), be_const_int(0) },
{ be_const_key(lv_point, 4), be_const_int(0) },
{ be_const_key(lv_draw_mask_fade_param_cfg, 5), be_const_int(0) },
{ be_const_key(lv_draw_mask_map_param, -1), be_const_int(0) },
{ be_const_key(lv_draw_label_dsc, -1), be_const_int(0) },
{ be_const_key(lv_area, 17), be_const_int(0) },
{ be_const_key(lv_draw_mask_angle_param_cfg, 3), be_const_int(0) },
{ be_const_key(lv_draw_mask_line_param_cfg, -1), be_const_int(0) },
{ be_const_key(lv_draw_mask_saved, 12), be_const_int(0) },
{ be_const_key(lv_draw_mask_map_param_cfg, -1), be_const_int(0) },
{ be_const_key(lv_draw_rect_dsc, -1), be_const_int(0) },
{ be_const_key(lv_draw_mask_angle_param, -1), be_const_int(0) },
{ be_const_key(lv_draw_line_dsc, 15), be_const_int(0) },
{ be_const_key(lv_draw_mask_common_dsc, -1), be_const_int(0) },
{ be_const_key(lv_draw_mask_line_param, -1), be_const_int(0) },
{ be_const_key(lv_sqrt_res, -1), be_const_int(0) },
{ be_const_key(lv_draw_mask_fade_param, 13), be_const_int(0) },
};
static be_define_const_map(
be_class_ctypes_classes_map,
19
);
BE_EXPORT_VARIABLE be_define_const_class(
be_class_ctypes_classes,
0,
NULL,
be_class_ctypes_classes
);

View File

@ -1,74 +1,75 @@
#include "be_constobj.h"
static be_define_const_map_slots(be_class_tasmota_map) {
{ be_const_key(log, -1), be_const_func(l_logInfo) },
{ be_const_key(gc, -1), be_const_closure(gc_closure) },
{ be_const_key(_cmd, 45), be_const_func(l_cmd) },
{ be_const_key(millis, 53), be_const_func(l_millis) },
{ be_const_key(web_send, -1), be_const_func(l_webSend) },
{ be_const_key(wire1, -1), be_const_var(0) },
{ be_const_key(response_append, -1), be_const_func(l_respAppend) },
{ be_const_key(_get_cb, 30), be_const_func(l_get_cb) },
{ be_const_key(get_free_heap, 22), be_const_func(l_getFreeHeap) },
{ be_const_key(resp_cmnd_failed, 2), be_const_func(l_respCmndFailed) },
{ be_const_key(exec_cmd, -1), be_const_closure(exec_cmd_closure) },
{ be_const_key(set_light, 8), be_const_closure(set_light_closure) },
{ be_const_key(resp_cmnd, 16), be_const_func(l_respCmnd) },
{ be_const_key(find_op, 34), be_const_closure(find_op_closure) },
{ be_const_key(eth, -1), be_const_func(l_eth) },
{ be_const_key(cmd, -1), be_const_closure(cmd_closure) },
{ be_const_key(resp_cmnd_done, -1), be_const_func(l_respCmndDone) },
{ be_const_key(remove_rule, 1), be_const_closure(remove_rule_closure) },
{ be_const_key(get_power, -1), be_const_func(l_getpower) },
{ be_const_key(add_cmd, -1), be_const_closure(add_cmd_closure) },
{ be_const_key(get_light, -1), be_const_closure(get_light_closure) },
{ be_const_key(exec_rules, 37), be_const_closure(exec_rules_closure) },
{ be_const_key(time_str, -1), be_const_closure(time_str_closure) },
{ be_const_key(remove_driver, 29), be_const_closure(remove_driver_closure) },
{ be_const_key(publish_result, 38), be_const_func(l_publish_result) },
{ be_const_key(rtc, -1), be_const_func(l_rtc) },
{ be_const_key(try_rule, -1), be_const_closure(try_rule_closure) },
{ be_const_key(gen_cb, 42), be_const_closure(gen_cb_closure) },
{ be_const_key(wire_scan, -1), be_const_closure(wire_scan_closure) },
{ be_const_key(add_rule, -1), be_const_closure(add_rule_closure) },
{ be_const_key(_timers, -1), be_const_var(1) },
{ be_const_key(wire2, -1), be_const_var(2) },
{ be_const_key(run_deferred, 20), be_const_closure(run_deferred_closure) },
{ be_const_key(get_option, -1), be_const_func(l_getoption) },
{ be_const_key(remove_timer, -1), be_const_closure(remove_timer_closure) },
{ be_const_key(scale_uint, -1), be_const_func(l_scaleuint) },
{ be_const_key(resp_cmnd_str, 51), be_const_func(l_respCmndStr) },
{ be_const_key(memory, -1), be_const_func(l_memory) },
{ be_const_key(chars_in_string, -1), be_const_closure(chars_in_string_closure) },
{ be_const_key(resolvecmnd, -1), be_const_func(l_resolveCmnd) },
{ be_const_key(load, -1), be_const_closure(load_closure) },
{ be_const_key(publish, 55), be_const_func(l_publish) },
{ be_const_key(_ccmd, -1), be_const_var(3) },
{ be_const_key(resp_cmnd_error, 23), be_const_func(l_respCmndError) },
{ be_const_key(cb_dispatch, -1), be_const_closure(cb_dispatch_closure) },
{ be_const_key(save, -1), be_const_func(l_save) },
{ be_const_key(_drivers, -1), be_const_var(4) },
{ be_const_key(find_key_i, -1), be_const_closure(find_key_i_closure) },
{ be_const_key(wifi, 36), be_const_func(l_wifi) },
{ be_const_key(set_timer, 40), be_const_closure(set_timer_closure) },
{ be_const_key(i2c_enabled, 44), be_const_func(l_i2cenabled) },
{ be_const_key(set_power, 54), be_const_func(l_setpower) },
{ be_const_key(_rules, 14), be_const_var(5) },
{ be_const_key(delay, -1), be_const_func(l_delay) },
{ be_const_key(strftime, -1), be_const_func(l_strftime) },
{ be_const_key(time_dump, -1), be_const_func(l_time_dump) },
{ be_const_key(time_reached, 26), be_const_func(l_timereached) },
{ be_const_key(web_send_decimal, 58), be_const_func(l_webSendDecimal) },
{ be_const_key(_cb, -1), be_const_var(6) },
{ be_const_key(yield, 56), be_const_func(l_yield) },
{ be_const_key(event, -1), be_const_closure(event_closure) },
{ be_const_key(remove_cmd, -1), be_const_closure(remove_cmd_closure) },
{ be_const_key(remove_rule, -1), be_const_closure(remove_rule_closure) },
{ be_const_key(add_driver, -1), be_const_closure(add_driver_closure) },
{ be_const_key(web_send, -1), be_const_func(l_webSend) },
{ be_const_key(response_append, 1), be_const_func(l_respAppend) },
{ be_const_key(get_free_heap, -1), be_const_func(l_getFreeHeap) },
{ be_const_key(i2c_enabled, 55), be_const_func(l_i2cenabled) },
{ be_const_key(wifi, 57), be_const_func(l_wifi) },
{ be_const_key(add_rule, -1), be_const_closure(add_rule_closure) },
{ be_const_key(save, 21), be_const_func(l_save) },
{ be_const_key(resp_cmnd_done, -1), be_const_func(l_respCmndDone) },
{ be_const_key(add_cmd, 19), be_const_closure(add_cmd_closure) },
{ be_const_key(wire1, -1), be_const_var(0) },
{ be_const_key(_rules, 16), be_const_var(1) },
{ be_const_key(resolvecmnd, -1), be_const_func(l_resolveCmnd) },
{ be_const_key(remove_driver, -1), be_const_closure(remove_driver_closure) },
{ be_const_key(_cb, -1), be_const_var(2) },
{ be_const_key(log, -1), be_const_func(l_logInfo) },
{ be_const_key(get_power, 12), be_const_func(l_getpower) },
{ be_const_key(scale_uint, -1), be_const_func(l_scaleuint) },
{ be_const_key(event, 47), be_const_closure(event_closure) },
{ be_const_key(publish_result, -1), be_const_func(l_publish_result) },
{ be_const_key(run_deferred, 6), be_const_closure(run_deferred_closure) },
{ be_const_key(find_key_i, 38), be_const_closure(find_key_i_closure) },
{ be_const_key(millis, 33), be_const_func(l_millis) },
{ be_const_key(delay, -1), be_const_func(l_delay) },
{ be_const_key(_drivers, -1), be_const_var(3) },
{ be_const_key(resp_cmnd_failed, -1), be_const_func(l_respCmndFailed) },
{ be_const_key(get_switch, -1), be_const_func(l_getswitch) },
{ be_const_key(web_send_decimal, 53), be_const_func(l_webSendDecimal) },
{ be_const_key(set_power, -1), be_const_func(l_setpower) },
{ be_const_key(wire2, -1), be_const_var(4) },
{ be_const_key(gen_cb, 10), be_const_closure(gen_cb_closure) },
{ be_const_key(find_op, -1), be_const_closure(find_op_closure) },
{ be_const_key(remove_timer, -1), be_const_closure(remove_timer_closure) },
{ be_const_key(_get_cb, -1), be_const_func(l_get_cb) },
{ be_const_key(strftime, 51), be_const_func(l_strftime) },
{ be_const_key(exec_rules, 27), be_const_closure(exec_rules_closure) },
{ be_const_key(_ccmd, -1), be_const_var(5) },
{ be_const_key(resp_cmnd_str, 18), be_const_func(l_respCmndStr) },
{ be_const_key(exec_cmd, -1), be_const_closure(exec_cmd_closure) },
{ be_const_key(wire_scan, -1), be_const_closure(wire_scan_closure) },
{ be_const_key(load, -1), be_const_closure(load_closure) },
{ be_const_key(resp_cmnd, -1), be_const_func(l_respCmnd) },
{ be_const_key(cmd, -1), be_const_closure(cmd_closure) },
{ be_const_key(get_light, 50), be_const_closure(get_light_closure) },
{ be_const_key(memory, -1), be_const_func(l_memory) },
{ be_const_key(yield, 45), be_const_func(l_yield) },
{ be_const_key(resp_cmnd_error, -1), be_const_func(l_respCmndError) },
{ be_const_key(rtc, -1), be_const_func(l_rtc) },
{ be_const_key(get_option, -1), be_const_func(l_getoption) },
{ be_const_key(chars_in_string, -1), be_const_closure(chars_in_string_closure) },
{ be_const_key(cb_dispatch, -1), be_const_closure(cb_dispatch_closure) },
{ be_const_key(_timers, -1), be_const_var(6) },
{ be_const_key(time_str, -1), be_const_closure(time_str_closure) },
{ be_const_key(remove_cmd, -1), be_const_closure(remove_cmd_closure) },
{ be_const_key(set_timer, 58), be_const_closure(set_timer_closure) },
{ be_const_key(set_light, 14), be_const_closure(set_light_closure) },
{ be_const_key(publish, 2), be_const_func(l_publish) },
{ be_const_key(time_reached, -1), be_const_func(l_timereached) },
{ be_const_key(time_dump, 9), be_const_func(l_time_dump) },
{ be_const_key(eth, -1), be_const_func(l_eth) },
{ be_const_key(try_rule, 4), be_const_closure(try_rule_closure) },
{ be_const_key(_cmd, -1), be_const_func(l_cmd) },
{ be_const_key(gc, -1), be_const_closure(gc_closure) },
};
static be_define_const_map(
be_class_tasmota_map,
63
64
);
BE_EXPORT_VARIABLE be_define_const_class(

View File

@ -1,15 +1,16 @@
#include "be_constobj.h"
static be_define_const_map_slots(m_libintrospect_map) {
{ be_const_key(members, -1), be_const_func(m_attrlist) },
{ be_const_key(vcall, -1), be_const_func(m_vcall) },
{ be_const_key(get, -1), be_const_func(m_findmember) },
{ be_const_key(set, 2), be_const_func(m_setmember) },
{ be_const_key(toptr, 3), be_const_func(m_toptr) },
{ be_const_key(set, -1), be_const_func(m_setmember) },
{ be_const_key(fromptr, -1), be_const_func(m_fromptr) },
{ be_const_key(members, 1), be_const_func(m_attrlist) },
};
static be_define_const_map(
m_libintrospect_map,
4
5
);
static be_define_const_module(

View File

@ -1,62 +1,64 @@
#include "be_constobj.h"
static be_define_const_map_slots(m_builtin_map) {
{ be_const_key(print, 19), be_const_int(15) },
{ be_const_key(isinstance, -1), be_const_int(8) },
{ be_const_key(classname, -1), be_const_int(3) },
{ be_const_key(module, -1), be_const_int(12) },
{ be_const_key(size, -1), be_const_int(18) },
{ be_const_key(type, 9), be_const_int(21) },
{ be_const_key(compile, -1), be_const_int(5) },
{ be_const_key(open, -1), be_const_int(14) },
{ be_const_key(real, -1), be_const_int(17) },
{ be_const_key(__iterator__, -1), be_const_int(0) },
{ be_const_key(super, -1), be_const_int(20) },
{ be_const_key(issubclass, -1), be_const_int(9) },
{ be_const_key(classof, -1), be_const_int(4) },
{ be_const_key(map, 8), be_const_int(11) },
{ be_const_key(int, 2), be_const_int(7) },
{ be_const_key(input, 3), be_const_int(6) },
{ be_const_key(number, -1), be_const_int(13) },
{ be_const_key(list, 7), be_const_int(10) },
{ be_const_key(str, 1), be_const_int(19) },
{ be_const_key(range, -1), be_const_int(16) },
{ be_const_key(bytes, -1), be_const_int(2) },
{ be_const_key(assert, -1), be_const_int(1) },
{ be_const_key(number, 16), be_const_int(7) },
{ be_const_key(map, -1), be_const_int(19) },
{ be_const_key(classname, 22), be_const_int(5) },
{ be_const_key(bytes, 2), be_const_int(21) },
{ be_const_key(int, 12), be_const_int(9) },
{ be_const_key(module, -1), be_const_int(11) },
{ be_const_key(print, 20), be_const_int(1) },
{ be_const_key(issubclass, -1), be_const_int(14) },
{ be_const_key(assert, -1), be_const_int(0) },
{ be_const_key(list, -1), be_const_int(18) },
{ be_const_key(__iterator__, -1), be_const_int(16) },
{ be_const_key(real, -1), be_const_int(10) },
{ be_const_key(super, 21), be_const_int(3) },
{ be_const_key(isinstance, 8), be_const_int(15) },
{ be_const_key(classof, 4), be_const_int(6) },
{ be_const_key(input, -1), be_const_int(2) },
{ be_const_key(call, 19), be_const_int(22) },
{ be_const_key(compile, -1), be_const_int(13) },
{ be_const_key(open, -1), be_const_int(17) },
{ be_const_key(size, -1), be_const_int(12) },
{ be_const_key(range, -1), be_const_int(20) },
{ be_const_key(str, -1), be_const_int(8) },
{ be_const_key(type, -1), be_const_int(4) },
};
static be_define_const_map(
m_builtin_map,
22
23
);
static const bvalue __vlist_array[] = {
be_const_func(l_iterator),
be_const_func(l_assert),
be_const_class(be_class_bytes),
be_const_func(l_classname),
be_const_func(l_classof),
be_const_func(l_compile),
be_const_func(l_input),
be_const_func(l_int),
be_const_func(l_isinstance),
be_const_func(l_issubclass),
be_const_class(be_class_list),
be_const_class(be_class_map),
be_const_func(l_module),
be_const_func(l_number),
be_const_func(be_nfunc_open),
be_const_func(l_print),
be_const_class(be_class_range),
be_const_func(l_real),
be_const_func(l_size),
be_const_func(l_str),
be_const_func(l_input),
be_const_func(l_super),
be_const_func(l_type),
be_const_func(l_classname),
be_const_func(l_classof),
be_const_func(l_number),
be_const_func(l_str),
be_const_func(l_int),
be_const_func(l_real),
be_const_func(l_module),
be_const_func(l_size),
be_const_func(l_compile),
be_const_func(l_issubclass),
be_const_func(l_isinstance),
be_const_func(l_iterator),
be_const_func(be_nfunc_open),
be_const_class(be_class_list),
be_const_class(be_class_map),
be_const_class(be_class_range),
be_const_class(be_class_bytes),
be_const_func(l_call),
};
static be_define_const_vector(
m_builtin_vector,
__vlist_array,
22
23
);

View File

@ -2,11 +2,12 @@
static be_define_const_map_slots(m_libpath_map) {
{ be_const_key(exists, -1), be_const_func(m_path_exists) },
{ be_const_key(last_modified, 0), be_const_func(m_path_last_modified) },
};
static be_define_const_map(
m_libpath_map,
1
2
);
static be_define_const_module(

View File

@ -231,6 +231,8 @@ static int l_int(bvm *vm)
be_pushint(vm, (bint)be_toreal(vm, 1));
} else if (be_isint(vm, 1)) {
be_pushvalue(vm, 1);
} else if (be_iscomptr(vm, 1)) {
be_pushint(vm, (int) be_tocomptr(vm, 1));
} else {
be_return_nil(vm);
}
@ -277,6 +279,55 @@ static int l_iterator(bvm *vm)
be_return_nil(vm);
}
/* call a function with variable number of arguments */
/* first argument is a callable object (function, closure, native function, native closure) */
/* then all subsequent arguments are pushed except the last one */
/* If the last argument is a 'list', then all elements are pushed as arguments */
/* otherwise the last argument is pushed as well */
static int l_call(bvm *vm)
{
int top = be_top(vm);
if (top >= 1 && be_isfunction(vm, 1)) {
size_t arg_count = top - 1; /* we have at least 'top - 1' arguments */
/* test if last argument is a list */
if (top > 1 && be_isinstance(vm, top) && be_getmember(vm, top, ".p") && be_islist(vm, top + 1)) {
int32_t list_size = be_data_size(vm, top + 1);
if (list_size > 0) {
be_stack_require(vm, list_size + 3); /* make sure we don't overflow the stack */
for (int i = 0; i < list_size; i++) {
be_pushnil(vm);
}
be_moveto(vm, top + 1, top + 1 + list_size);
be_moveto(vm, top, top + list_size);
be_refpush(vm, -2);
be_pushiter(vm, -1);
while (be_iter_hasnext(vm, -2)) {
be_iter_next(vm, -2);
be_moveto(vm, -1, top);
top++;
be_pop(vm, 1);
}
be_pop(vm, 1); /* remove iterator */
be_refpop(vm);
}
be_pop(vm, 2);
arg_count = arg_count - 1 + list_size;
}
/* actual call */
be_call(vm, arg_count);
/* remove args */
be_pop(vm, arg_count);
/* return value */
be_return(vm);
}
be_raise(vm, "value_error", "first argument must be a function");
be_return_nil(vm);
}
static int l_str(bvm *vm)
{
if (be_top(vm)) {
@ -407,6 +458,12 @@ void be_load_baselib(bvm *vm)
be_regfunc(vm, "isinstance", l_isinstance);
be_regfunc(vm, "__iterator__", l_iterator);
}
/* call must be added later to respect order of builtins */
void be_load_baselib_call(bvm *vm)
{
be_regfunc(vm, "call", l_call);
}
#else
extern const bclass be_class_list;
extern const bclass be_class_map;
@ -437,6 +494,7 @@ vartab m_builtin (scope: local) {
map, class(be_class_map)
range, class(be_class_range)
bytes, class(be_class_bytes)
call, func(l_call)
}
@const_object_info_end */
#include "../generate/be_fixed_m_builtin.h"

View File

@ -72,6 +72,11 @@ extern "C" {
.type = BE_STRING \
}
#define be_const_comptr(_val) { \
.v.p = (void*)(_val), \
.type = BE_COMPTR \
}
#define be_const_class(_class) { \
.v.c = &(_class), \
.type = BE_CLASS \
@ -218,6 +223,11 @@ const bntvmodule be_native_module(_module) = { \
BE_REAL \
}
#define be_const_comptr(_val) { \
bvaldata((void*)(_val)), \
BE_COMPTR \
}
#define be_const_str(_string) { \
bvaldata(bstring(_string)), \
BE_STRING \

View File

@ -13,6 +13,8 @@
#include "be_debug.h"
#include "be_map.h"
#include "be_vm.h"
#include "be_exec.h"
#include "be_gc.h"
#include <string.h>
#if BE_USE_INTROSPECT_MODULE
@ -76,52 +78,45 @@ static int m_setmember(bvm *vm)
be_return_nil(vm);
}
/* call a function with variable number of arguments */
/* first argument is a callable object (function, closure, native function, native closure) */
/* then all subsequent arguments are pushed except the last one */
/* If the last argument is a 'list', then all elements are pushed as arguments */
/* otherwise the last argument is pushed as well */
static int m_vcall(bvm *vm)
static int m_toptr(bvm *vm)
{
int top = be_top(vm);
if (top >= 1 && be_isfunction(vm, 1)) {
size_t arg_count = top - 1; /* we have at least 'top - 1' arguments */
/* test if last argument is a list */
if (top > 1 && be_isinstance(vm, top) && be_getmember(vm, top, ".p") && be_islist(vm, top + 1)) {
int32_t list_size = be_data_size(vm, top + 1);
if (list_size > 0) {
be_stack_require(vm, list_size + 3); /* make sure we don't overflow the stack */
for (int i = 0; i < list_size; i++) {
be_pushnil(vm);
}
be_moveto(vm, top + 1, top + 1 + list_size);
be_moveto(vm, top, top + list_size);
be_refpush(vm, -2);
be_pushiter(vm, -1);
while (be_iter_hasnext(vm, -2)) {
be_iter_next(vm, -2);
be_moveto(vm, -1, top);
top++;
be_pop(vm, 1);
}
be_pop(vm, 1); /* remove iterator */
be_refpop(vm);
}
be_pop(vm, 2);
arg_count = arg_count - 1 + list_size;
if (top >= 1) {
bvalue *v = be_indexof(vm, 1);
if (var_basetype(v) >= BE_GCOBJECT) {
be_pushcomptr(vm, var_toobj(v));
be_return(vm);
} else if (var_type(v) == BE_INT) {
be_pushcomptr(vm, (void*) var_toint(v));
be_return(vm);
} else {
be_raise(vm, "value_error", "unsupported for this type");
}
}
be_return_nil(vm);
}
static int m_fromptr(bvm *vm)
{
int top = be_top(vm);
if (top >= 1) {
void* v;
if (be_iscomptr(vm, 1)) {
v = be_tocomptr(vm, 1);
} else {
v = (void*) be_toint(vm, 1);
}
if (v) {
bgcobject * ptr = (bgcobject*) v;
if (var_basetype(ptr) >= BE_GCOBJECT) {
bvalue *top = be_incrtop(vm);
var_setobj(top, ptr->type, ptr);
} else {
be_raise(vm, "value_error", "unsupported for this type");
}
be_return(vm);
}
/* actual call */
be_call(vm, arg_count);
/* remove args */
be_pop(vm, arg_count);
/* return value */
be_return(vm);
}
be_raise(vm, "value_error", "first argument must be a function");
be_return_nil(vm);
}
@ -131,7 +126,6 @@ be_native_module_attr_table(introspect) {
be_native_module_function("get", m_findmember),
be_native_module_function("set", m_setmember),
be_native_module_function("vcall", m_vcall),
};
be_define_native_module(introspect, NULL);
@ -142,7 +136,9 @@ module introspect (scope: global, depend: BE_USE_INTROSPECT_MODULE) {
get, func(m_findmember)
set, func(m_setmember)
vcall, func(m_vcall)
toptr, func(m_toptr)
fromptr, func(m_fromptr)
}
@const_object_info_end */
#include "../generate/be_fixed_introspect.h"

View File

@ -8,6 +8,7 @@
#include "be_libs.h"
extern void be_load_baselib(bvm *vm);
extern void be_load_baselib_call(bvm *vm);
extern void be_load_listlib(bvm *vm);
extern void be_load_maplib(bvm *vm);
extern void be_load_rangelib(bvm *vm);
@ -23,5 +24,6 @@ void be_loadlibs(bvm *vm)
be_load_rangelib(vm);
be_load_filelib(vm);
be_load_byteslib(vm);
be_load_baselib_call(vm);
#endif
}

View File

@ -900,10 +900,12 @@ static void suffix_expr(bparser *parser, bexpdesc *e)
static void suffix_alloc_reg(bparser *parser, bexpdesc *l)
{
bfuncinfo *finfo = parser->finfo;
bbool suffix = l->type == ETINDEX || l->type == ETMEMBER;
bbool is_suffix = l->type == ETINDEX || l->type == ETMEMBER; /* is suffix */
bbool is_suffix_reg = l->v.ss.tt == ETREG || l->v.ss.tt == ETLOCAL || l->v.ss.tt == ETGLOBAL || l->v.ss.tt == ETNGLOBAL; /* if suffix, does it need a register */
bbool is_global = l->type == ETGLOBAL || l->type == ETNGLOBAL;
/* in the suffix expression, if the object is a temporary
* variable (l->v.ss.tt == ETREG), it needs to be cached. */
if (suffix && l->v.ss.tt == ETREG) {
if (is_global || (is_suffix && is_suffix_reg)) {
be_code_allocregs(finfo, 1);
}
}

View File

@ -97,6 +97,9 @@ static bstring* sim2str(bvm *vm, bvalue *v)
case BE_MODULE:
module2str(sbuf, v);
break;
case BE_COMPTR:
sprintf(sbuf, "<ptr: %p>", var_toobj(v));
break;
default:
strcpy(sbuf, "(unknow value)");
break;
@ -323,15 +326,47 @@ BERRY_API const char *be_str2num(bvm *vm, const char *str)
return sout;
}
static bstring* string_range(bvm *vm, bstring *str, binstance *range)
{
bint lower, upper;
bint size = str_len(str); /* size of source string */
// bint size = be_data_size(vm, -1); /* get source list size */
/* get index range */
bvalue temp;
be_instance_member(vm, range, be_newstr(vm, "__lower__"), &temp);
lower = var_toint(&temp);
be_instance_member(vm, range, be_newstr(vm, "__upper__"), &temp);
upper = var_toint(&temp);
/* protection scope */
if (upper < 0) { upper = size + upper; }
if (lower < 0) { lower = size + lower; }
upper = upper < size ? upper : size - 1;
lower = lower < 0 ? 0 : lower;
if (lower > upper) {
return be_newstrn(vm, "", 0); /* empty string */
}
return be_newstrn(vm, str(str) + lower, upper - lower + 1);
}
/* string subscript operation */
bstring* be_strindex(bvm *vm, bstring *str, bvalue *idx)
{
if (var_isint(idx)) {
int pos = var_toidx(idx);
if (pos < str_len(str)) {
int size = str_len(str);
if (pos < 0) { pos = size + pos; }
if ((pos < size) && (pos >= 0)) {
return be_newstrn(vm, str(str) + pos, 1);
}
be_raise(vm, "index_error", "string index out of range");
} else if (var_isinstance(idx)) {
binstance * ins = var_toobj(idx);
const char *cname = str(be_instance_name(ins));
if (!strcmp(cname, "range")) {
return string_range(vm, str, ins);
}
// str(be_instance_name(i))
}
be_raise(vm, "index_error", "string indices must be integers");
return NULL;

View File

@ -0,0 +1,19 @@
# test bug in compound statements
a = 0
assert(a == 0)
a += 1
assert(a == 1)
a += 10/2
assert(a == 6)
class A var a def init() self.a = 1 end def f(x) self.a+=x/2 end def g(x) self.a = self.a + x/2 end end
a = A()
assert(a.a == 1)
a.f(10)
assert(a.a == 6)
b=A()
assert(b.a == 1)
b.g(10)
assert(b.a == 6)

View File

@ -33,10 +33,12 @@ block_builder::block_builder(const object_block *object, const macro_table *macr
m_strtab.push_back(it->second);
}
for (auto i : object->data) {
if (i.second.depend.empty() || macro->query(i.second.depend)) {
m_block.data[i.first] = i.second.value;
m_strtab.push_back(i.first);
for (auto key : object->data_ordered) {
auto second = object->data.at(key);
if (second.depend.empty() || macro->query(second.depend)) {
m_block.data[key] = second.value;
m_strtab.push_back(key);
m_block.data_ordered.push_back(key); /* record insertion order */
}
}
}
@ -106,10 +108,9 @@ std::string block_builder::vartab_tostring(const block &block)
idxblk = block;
idxblk.data.clear();
for (auto it : block.data) {
varvec.push_back(it.second);
it.second = "int(" + std::to_string(index++) + ")";
idxblk.data.insert(it);
for (auto key : block.data_ordered) {
varvec.push_back(block.data.at(key));
idxblk.data[key] = "int(" + std::to_string(index++) + ")";
}
ostr << map_tostring(idxblk, block.name + "_map", true) << std::endl;

View File

@ -28,6 +28,7 @@ private:
std::string name;
std::map<std::string, std::string> attr;
std::map<std::string, std::string> data;
std::vector<std::string> data_ordered; /* used to retrieve in insertion order */
};
std::string block_tostring(const block &block);

View File

@ -186,4 +186,5 @@ void coc_parser::parse_body_item(object_block *object)
if (parse_char_continue(','))
value.depend = parse_tonewline();
object->data[key] = value;
object->data_ordered.push_back(key);
}

View File

@ -20,6 +20,7 @@ struct object_block {
std::string name;
std::map<std::string, std::string> attr;
std::map<std::string, data_value> data;
std::vector<std::string> data_ordered; /* preserve order of keys */
};
#endif

View File

@ -80,7 +80,7 @@ class:
method_count: 4 -- number of method
method_table: [
string -- method name
function -- method function body
function | nil -- method function body or nil (static member) if the first byte is null (which would be an empty func name)
](method_count)
member_index_table -> [
string -- member name

View File

@ -17,7 +17,7 @@ func_body = '(' [arg_field {',' arg_field}] ')' block 'end';
arg_field = ['*'] ID;
(* class define statement *)
class_stmt = 'class' ID [':' ID] class_block 'end';
class_block = {'var' ID {',' ID} | func_stmt};
class_block = {'var' ID {',' ID} | 'static' ID ['=' expr] {',' ID ['=' expr] } | func_stmt};
import_stmt = 'import' (ID (['as' ID] | {',' ID}) | STRING 'as' ID);
(* exceptional handling statement *)
try_stmt = 'try' block except_block {except_block} 'end';

View File

@ -29,7 +29,7 @@ build_flags = ${esp_defaults.build_flags}
[core32]
platform = espressif32 @ 3.3.1
platform_packages = framework-arduinoespressif32 @ https://github.com/tasmota/arduino-esp32/releases/download/1.0.7.3/tasmota-arduinoespressif32-release_v3.3.5.tar.gz
platform_packages = framework-arduinoespressif32 @ https://github.com/tasmota/arduino-esp32/releases/download/1.0.7.4/tasmota-arduinoespressif32-release_v3.3.5.tar.gz
platformio/tool-mklittlefs @ ~1.203.200522
build_unflags = ${esp32_defaults.build_unflags}
build_flags = ${esp32_defaults.build_flags}

View File

@ -38,7 +38,7 @@ build_flags = ${env.build_flags}
[env:tasmota32idf3]
extends = env:tasmota32_base
platform = espressif32 @ 3.3.0
platform_packages = framework-arduinoespressif32 @ https://github.com/tasmota/arduino-esp32/releases/download/1.0.7.3/tasmota-arduinoespressif32-release_v3.3.5.tar.gz
platform_packages = framework-arduinoespressif32 @ https://github.com/tasmota/arduino-esp32/releases/download/1.0.7.4/tasmota-arduinoespressif32-release_v3.3.5.tar.gz
platformio/tool-mklittlefs @ ~1.203.200522
build_unflags = ${env:tasmota32_base.build_unflags}
build_flags = ${env:tasmota32_base.build_flags}
@ -49,7 +49,7 @@ build_flags = ${env:tasmota32_base.build_flags}
extends = env:tasmota32_base
board = esp32s2
platform = https://github.com/platformio/platform-espressif32.git#feature/arduino-idf-master
platform_packages = tasmota/framework-arduinoespressif32 @ 2.0.0+tasmota
platform_packages = framework-arduinoespressif32 @ https://github.com/Jason2866/arduino-esp32/releases/download/v.2.0-post/framework-arduinoespressif32_i2c.zip
platformio/tool-mklittlefs @ ~1.203.200522
build_unflags = ${env:tasmota32_base.build_unflags}
-Wswitch-unreachable
@ -75,7 +75,7 @@ lib_ignore =
extends = env:tasmota32_base
board = esp32c3
platform = https://github.com/platformio/platform-espressif32.git#feature/arduino-idf-master
platform_packages = framework-arduinoespressif32 @ https://github.com/Jason2866/esp32-arduino-lib-builder/releases/download/427/framework-arduinoespressif32-master-583026f04.tar.gz
platform_packages = framework-arduinoespressif32 @ https://github.com/Jason2866/arduino-esp32/releases/download/v.2.0-post/framework-arduinoespressif32_i2c.zip
platformio/tool-mklittlefs @ ~1.203.200522
build_unflags = ${env:tasmota32_base.build_unflags}
-Wswitch-unreachable
@ -106,7 +106,7 @@ lib_ignore =
[env:tasmota32idf4]
extends = env:tasmota32_base
platform = https://github.com/platformio/platform-espressif32.git#feature/arduino-idf-master
platform_packages = tasmota/framework-arduinoespressif32 @ 2.0.0+tasmota
platform_packages = framework-arduinoespressif32 @ https://github.com/Jason2866/arduino-esp32/releases/download/v.2.0-post/framework-arduinoespressif32_i2c.zip
platformio/tool-mklittlefs @ ~1.203.200522
build_unflags = ${env:tasmota32_base.build_unflags}
-Wswitch-unreachable
@ -149,6 +149,7 @@ build_flags = ${env:tasmota32_base.build_flags}
; -Wstack-usage=300
; *** JTAG Debug version, needs esp-prog or FT2232H or FT232H
; *** Install howto for Windows https://community.platformio.org/t/esp32-pio-unified-debugger/4541/20
[env:tasmota32-ocd]
;build_type = debug
extends = env:tasmota32_base
@ -162,7 +163,7 @@ build_flags = ${env:tasmota32_base.build_flags}
[env:tasmota32solo1-ocd]
;build_type = debug
extends = env:tasmota32_base
platform_packages = framework-arduinoespressif32 @ https://github.com/tasmota/arduino-esp32/releases/download/1.0.7.3/tasmota-arduinoespressif32-solo1-release_v3.3.5.tar.gz
platform_packages = framework-arduinoespressif32 @ https://github.com/tasmota/arduino-esp32/releases/download/1.0.7.4/tasmota-arduinoespressif32-solo1-release_v3.3.5.tar.gz
platformio/tool-esptoolpy @ ~1.30100
platformio/tool-mklittlefs @ ~1.203.200522
board = esp32_solo1_4M

View File

@ -50,7 +50,7 @@ build_flags = ${env:tasmota32_base.build_flags} -DFIRMWARE_TASMOTA32
[env:tasmota32solo1]
extends = env:tasmota32_base
platform_packages = framework-arduinoespressif32 @ https://github.com/tasmota/arduino-esp32/releases/download/1.0.7.3/tasmota-arduinoespressif32-solo1-release_v3.3.5.tar.gz
platform_packages = framework-arduinoespressif32 @ https://github.com/tasmota/arduino-esp32/releases/download/1.0.7.4/tasmota-arduinoespressif32-solo1-release_v3.3.5.tar.gz
platformio/tool-esptoolpy @ ~1.30100
platformio/tool-mklittlefs @ ~1.203.200522
build_flags = ${env:tasmota32_base.build_flags} -DFIRMWARE_TASMOTA32
@ -59,7 +59,7 @@ build_flags = ${env:tasmota32_base.build_flags} -DFIRMWARE_TASMOTA32
extends = env:tasmota32_base
board = esp32-cam
build_flags = ${env:tasmota32_base.build_flags} -DFIRMWARE_WEBCAM
lib_extra_dirs = lib/libesp32, lib/lib_basic
lib_extra_dirs = lib/libesp32
[env:tasmota32-odroidgo]
extends = env:tasmota32_base

View File

@ -58,6 +58,7 @@ ctypes.bf_12 = 112
ctypes.bf_13 = 113
ctypes.bf_14 = 114
ctypes.bf_15 = 115
ctypes.bf_16 = 116
def findinlist(l, x)
for i:0..size(l)-1
@ -193,6 +194,7 @@ ctypes.print_types = def ()
print("typedef struct be_ctypes_structure_t {")
print(" uint16_t size_bytes; /* size in bytes */")
print(" uint16_t size_elt; /* number of elements */")
print(" const char **instance_mapping; /* array of instance class names for automatic instanciation of class */")
print(" const be_ctypes_structure_item_t * items;")
print("} be_ctypes_structure_t;")
print()
@ -207,7 +209,7 @@ ctypes.print_types = def ()
print(" const be_ctypes_class_t * classes;")
print("} be_ctypes_classes_t;")
print()
print("BE_EXPORT_VARIABLE extern const bclass be_class_lv_ctypes;")
print("BE_EXPORT_VARIABLE extern const bclass be_class_ctypes;")
print()
print("void ctypes_register_class(bvm *vm, const bclass * ctypes_class, const be_ctypes_structure_t * definitions) {")
print(" be_pushntvclass(vm, ctypes_class);")
@ -215,7 +217,23 @@ ctypes.print_types = def ()
print(" be_pop(vm, 1);")
print("}")
print()
print("const char * be_ctypes_instance_mappings[]; /* forward definition */")
print()
print("// Define a sub-class of ctypes with only one member which points to the ctypes defintion")
print("#define be_define_ctypes_class(_c_name, _def, _super, _name) \\")
print(" be_local_class(_c_name, \\")
print(" 0, \\")
print(" _super, \\")
print(" be_nested_map(1, \\")
print(" ( (struct bmapnode*) &(const bmapnode[]) { \\")
print(" { be_nested_key(\"_def\", 1985022181, 4, -1), be_const_comptr(_def) },\\")
print(" })), \\")
print(" (be_nested_const_str(_name, 0, sizeof(_name)-1)) \\")
print(" )")
print()
print("/********************************************************************/")
print()
end
global_classes = [] # track the list of all classes and
@ -236,33 +254,13 @@ ctypes.print_classes = def ()
ctypes.sort(global_classes)
print("const be_ctypes_classes_t be_ctypes_classes[] = {")
print(string.format(" %i,", size(global_classes)))
print(string.format(" be_ctypes_instance_mappings,"))
print(string.format(" (const be_ctypes_class_t[%i]) {", size(global_classes)))
for elt:global_classes
print(string.format(" { \"%s\", &be_%s },", elt, elt))
print(string.format("static be_define_ctypes_class(%s, &be_%s, &be_class_ctypes, \"%s\");", elt, elt, elt))
end
print("}};")
print()
print("/* @const_object_info_begin")
print("class be_class_ctypes_classes (scope: global) {")
for elt:global_classes
print(string.format(" %s, int(0)", elt))
end
print("}")
print("@const_object_info_end */")
print()
print("void be_load_ctypes_definitions_lib(bvm *vm) {")
print(" be_pushcomptr(vm, (void*) be_ctypes_classes);")
print(" be_setglobal(vm, \".ctypes_classes\");")
print(" be_pop(vm, 1);")
print()
for elt:global_classes
print(string.format(" static be_define_const_empty_class(be_class_%s, &be_class_lv_ctypes, %s);", elt, elt))
print(string.format(" ctypes_register_class(vm, &be_class_%s, &be_%s);", elt, elt))
end
print("}")
@ -316,6 +314,7 @@ class structure
print(string.format("const be_ctypes_structure_t be_%s = {", name))
print(string.format(" %i, /* size in bytes */", self.size_bytes))
print(string.format(" %i, /* number of elements */", size(self.mapping)))
print(string.format(" be_ctypes_instance_mappings,"))
print(string.format(" (const be_ctypes_structure_item_t[%i]) {", size(self.mapping)))
# list keys for future binary search
var names = []
@ -447,7 +446,6 @@ class structure
self.get_closures[name] = def (b, p) return ctypes.get_bits(b, cur_offset + p, bit_offset, size_in_bits) end
self.set_closures[name] = def (b, p, v) return ctypes.set_bits(b, cur_offset+ p, bit_offset, size_in_bits, v) end
self.cur_offset += size_in_bits / 8
self.cur_offset += (self.bit_offset + size_in_bits) / 8
self.bit_offset = (self.bit_offset + size_in_bits) % 8
end

Binary file not shown.

View File

@ -710,6 +710,7 @@
#define D_SENSOR_CSE7761_RX "CSE7761 Rx"
#define D_SENSOR_CSE7766_TX "CSE7766 Tx"
#define D_SENSOR_CSE7766_RX "CSE7766 Rx"
#define D_SENSOR_BL0939_RX "BL0939 Rx"
#define D_SENSOR_PN532_TX "PN532 Tx"
#define D_SENSOR_PN532_RX "PN532 Rx"
#define D_SENSOR_SM16716_CLK "SM16716 CLK"

View File

@ -709,6 +709,7 @@
#define D_SENSOR_CSE7761_RX "CSE7761 Rx"
#define D_SENSOR_CSE7766_TX "CSE7766 Tx"
#define D_SENSOR_CSE7766_RX "CSE7766 Rx"
#define D_SENSOR_BL0939_RX "BL0939 Rx"
#define D_SENSOR_PN532_TX "PN532 Tx"
#define D_SENSOR_PN532_RX "PN532 Rx"
#define D_SENSOR_SM16716_CLK "SM16716 CLK"

View File

@ -710,6 +710,7 @@
#define D_SENSOR_CSE7761_RX "CSE7761 Rx"
#define D_SENSOR_CSE7766_TX "CSE7766 Tx"
#define D_SENSOR_CSE7766_RX "CSE7766 Rx"
#define D_SENSOR_BL0939_RX "BL0939 Rx"
#define D_SENSOR_PN532_TX "PN532 Tx"
#define D_SENSOR_PN532_RX "PN532 Rx"
#define D_SENSOR_SM16716_CLK "SM16716 CLK"

View File

@ -710,6 +710,7 @@
#define D_SENSOR_CSE7761_RX "CSE7761 Rx"
#define D_SENSOR_CSE7766_TX "CSE7766 Tx"
#define D_SENSOR_CSE7766_RX "CSE7766 Rx"
#define D_SENSOR_BL0939_RX "BL0939 Rx"
#define D_SENSOR_PN532_TX "PN532 Tx"
#define D_SENSOR_PN532_RX "PN532 Rx"
#define D_SENSOR_SM16716_CLK "SM16716 CLK"

View File

@ -710,6 +710,7 @@
#define D_SENSOR_CSE7761_RX "CSE7761 Rx"
#define D_SENSOR_CSE7766_TX "CSE7766 Tx"
#define D_SENSOR_CSE7766_RX "CSE7766 Rx"
#define D_SENSOR_BL0939_RX "BL0939 Rx"
#define D_SENSOR_PN532_TX "PN532 Tx"
#define D_SENSOR_PN532_RX "PN532 Rx"
#define D_SENSOR_SM16716_CLK "SM16716 CLK"

View File

@ -710,6 +710,7 @@
#define D_SENSOR_CSE7761_RX "CSE7761 Rx"
#define D_SENSOR_CSE7766_TX "CSE7766 Tx"
#define D_SENSOR_CSE7766_RX "CSE7766 Rx"
#define D_SENSOR_BL0939_RX "BL0939 Rx"
#define D_SENSOR_PN532_TX "PN532 Tx"
#define D_SENSOR_PN532_RX "PN532 Rx"
#define D_SENSOR_SM16716_CLK "SM16716 CLK"

View File

@ -710,6 +710,7 @@
#define D_SENSOR_CSE7761_RX "CSE7761 Rx"
#define D_SENSOR_CSE7766_TX "CSE7766 Tx"
#define D_SENSOR_CSE7766_RX "CSE7766 Rx"
#define D_SENSOR_BL0939_RX "BL0939 Rx"
#define D_SENSOR_PN532_TX "PN532 Tx"
#define D_SENSOR_PN532_RX "PN532 Rx"
#define D_SENSOR_SM16716_CLK "SM16716 CLK"

View File

@ -709,7 +709,8 @@
#define D_SENSOR_CSE7761_TX "CSE7761 TX"
#define D_SENSOR_CSE7761_RX "CSE7761 RX"
#define D_SENSOR_CSE7766_TX "CSE7766 TX"
#define D_SENSOR_CSE7766_RX "CSE7766 RX"
#define D_SENSOR_CSE7766_RX "CSE7766 Rx"
#define D_SENSOR_BL0939_RX "BL0939 Rx"
#define D_SENSOR_PN532_TX "PN532 TX"
#define D_SENSOR_PN532_RX "PN532 RX"
#define D_SENSOR_SM16716_CLK "SM16716 CLK"

View File

@ -710,6 +710,7 @@
#define D_SENSOR_CSE7761_RX "CSE7761 Rx"
#define D_SENSOR_CSE7766_TX "CSE7766 Tx"
#define D_SENSOR_CSE7766_RX "CSE7766 Rx"
#define D_SENSOR_BL0939_RX "BL0939 Rx"
#define D_SENSOR_PN532_TX "PN532 Tx"
#define D_SENSOR_PN532_RX "PN532 Rx"
#define D_SENSOR_SM16716_CLK "SM16716 CLK"

View File

@ -710,6 +710,7 @@
#define D_SENSOR_CSE7761_RX "CSE7761 Rx"
#define D_SENSOR_CSE7766_TX "CSE7766 Tx"
#define D_SENSOR_CSE7766_RX "CSE7766 Rx"
#define D_SENSOR_BL0939_RX "BL0939 Rx"
#define D_SENSOR_PN532_TX "PN532 Tx"
#define D_SENSOR_PN532_RX "PN532 Rx"
#define D_SENSOR_SM16716_CLK "SM16716 CLK"

View File

@ -710,6 +710,7 @@
#define D_SENSOR_CSE7761_RX "CSE7761 Rx"
#define D_SENSOR_CSE7766_TX "CSE7766 Tx"
#define D_SENSOR_CSE7766_RX "CSE7766 Rx"
#define D_SENSOR_BL0939_RX "BL0939 Rx"
#define D_SENSOR_PN532_TX "PN532 Tx"
#define D_SENSOR_PN532_RX "PN532 Rx"
#define D_SENSOR_SM16716_CLK "SM16716 CLK"

View File

@ -764,6 +764,7 @@
#define D_SENSOR_LE01MR_RX "LE-01MR - RX"
#define D_SENSOR_LE01MR_TX "LE-01MR - TX"
#define D_SENSOR_BL0940_RX "BL0940 - RX"
#define D_SENSOR_BL0939_RX "BL0939 - RX"
#define D_SENSOR_CC1101_GDO0 "CC1101 - GDO0"
#define D_SENSOR_CC1101_GDO2 "CC1101 - GDO2"
#define D_SENSOR_HRXL_RX "HRXL - RX"

View File

@ -710,6 +710,7 @@
#define D_SENSOR_CSE7761_RX "CSE7761 Rx"
#define D_SENSOR_CSE7766_TX "CSE7766 Tx"
#define D_SENSOR_CSE7766_RX "CSE7766 Rx"
#define D_SENSOR_BL0939_RX "BL0939 Rx"
#define D_SENSOR_PN532_TX "PN532 Tx"
#define D_SENSOR_PN532_RX "PN532 Rx"
#define D_SENSOR_SM16716_CLK "SM16716 CLK"

View File

@ -710,6 +710,7 @@
#define D_SENSOR_CSE7761_RX "CSE7761 Rx"
#define D_SENSOR_CSE7766_TX "CSE7766 Tx"
#define D_SENSOR_CSE7766_RX "CSE7766 Rx"
#define D_SENSOR_BL0939_RX "BL0939 Rx"
#define D_SENSOR_PN532_TX "PN532 Tx"
#define D_SENSOR_PN532_RX "PN532 Rx"
#define D_SENSOR_SM16716_CLK "SM16716 CLK"

View File

@ -710,6 +710,7 @@
#define D_SENSOR_CSE7761_RX "CSE7761 Rx"
#define D_SENSOR_CSE7766_TX "CSE7766 Tx"
#define D_SENSOR_CSE7766_RX "CSE7766 Rx"
#define D_SENSOR_BL0939_RX "BL0939 Rx"
#define D_SENSOR_PN532_TX "PN532 Tx"
#define D_SENSOR_PN532_RX "PN532 Rx"
#define D_SENSOR_SM16716_CLK "SM16716 CLK"

View File

@ -710,6 +710,7 @@
#define D_SENSOR_CSE7761_RX "CSE7761 Rx"
#define D_SENSOR_CSE7766_TX "CSE7766 Tx"
#define D_SENSOR_CSE7766_RX "CSE7766 Rx"
#define D_SENSOR_BL0939_RX "BL0939 Rx"
#define D_SENSOR_PN532_TX "PN532 Tx"
#define D_SENSOR_PN532_RX "PN532 Rx"
#define D_SENSOR_SM16716_CLK "SM16716 CLK"

View File

@ -710,6 +710,7 @@
#define D_SENSOR_CSE7761_RX "CSE7761 Rx"
#define D_SENSOR_CSE7766_TX "CSE7766 Tx"
#define D_SENSOR_CSE7766_RX "CSE7766 Rx"
#define D_SENSOR_BL0939_RX "BL0939 Rx"
#define D_SENSOR_PN532_TX "PN532 Tx"
#define D_SENSOR_PN532_RX "PN532 Rx"
#define D_SENSOR_SM16716_CLK "SM16716 CLK"

View File

@ -710,6 +710,7 @@
#define D_SENSOR_CSE7761_RX "CSE7761 Rx"
#define D_SENSOR_CSE7766_TX "CSE7766 Tx"
#define D_SENSOR_CSE7766_RX "CSE7766 Rx"
#define D_SENSOR_BL0939_RX "BL0939 Rx"
#define D_SENSOR_PN532_TX "PN532 Tx"
#define D_SENSOR_PN532_RX "PN532 Rx"
#define D_SENSOR_SM16716_CLK "SM16716 CLK"

View File

@ -710,6 +710,7 @@
#define D_SENSOR_CSE7761_RX "CSE7761 Rx"
#define D_SENSOR_CSE7766_TX "CSE7766 Tx"
#define D_SENSOR_CSE7766_RX "CSE7766 Rx"
#define D_SENSOR_BL0939_RX "BL0939 Rx"
#define D_SENSOR_PN532_TX "PN532 Tx"
#define D_SENSOR_PN532_RX "PN532 Rx"
#define D_SENSOR_SM16716_CLK "SM16716 CLK"

View File

@ -710,6 +710,7 @@
#define D_SENSOR_CSE7761_RX "CSE7761 Rx"
#define D_SENSOR_CSE7766_TX "CSE7766 Tx"
#define D_SENSOR_CSE7766_RX "CSE7766 Rx"
#define D_SENSOR_BL0939_RX "BL0939 Rx"
#define D_SENSOR_PN532_TX "PN532 Tx"
#define D_SENSOR_PN532_RX "PN532 Rx"
#define D_SENSOR_SM16716_CLK "SM16716 CLK"

View File

@ -710,6 +710,7 @@
#define D_SENSOR_CSE7761_RX "CSE7761 Rx"
#define D_SENSOR_CSE7766_TX "CSE7766 Tx"
#define D_SENSOR_CSE7766_RX "CSE7766 Rx"
#define D_SENSOR_BL0939_RX "BL0939 Rx"
#define D_SENSOR_PN532_TX "PN532 Tx"
#define D_SENSOR_PN532_RX "PN532 Rx"
#define D_SENSOR_SM16716_CLK "SM16716 CLK"

View File

@ -710,6 +710,7 @@
#define D_SENSOR_CSE7761_RX "CSE7761 Rx"
#define D_SENSOR_CSE7766_TX "CSE7766 Tx"
#define D_SENSOR_CSE7766_RX "CSE7766 Rx"
#define D_SENSOR_BL0939_RX "BL0939 Rx"
#define D_SENSOR_PN532_TX "PN532 Tx"
#define D_SENSOR_PN532_RX "PN532 Rx"
#define D_SENSOR_SM16716_CLK "SM16716 CLK"

View File

@ -710,6 +710,7 @@
#define D_SENSOR_CSE7761_RX "CSE7761 Rx"
#define D_SENSOR_CSE7766_TX "CSE7766 Tx"
#define D_SENSOR_CSE7766_RX "CSE7766 Rx"
#define D_SENSOR_BL0939_RX "BL0939 Rx"
#define D_SENSOR_PN532_TX "PN532 Tx"
#define D_SENSOR_PN532_RX "PN532 Rx"
#define D_SENSOR_SM16716_CLK "SM16716 CLK"

View File

@ -710,6 +710,7 @@
#define D_SENSOR_CSE7761_RX "CSE7761 Rx"
#define D_SENSOR_CSE7766_TX "CSE7766 Tx"
#define D_SENSOR_CSE7766_RX "CSE7766 Rx"
#define D_SENSOR_BL0939_RX "BL0939 Rx"
#define D_SENSOR_PN532_TX "PN532 Tx"
#define D_SENSOR_PN532_RX "PN532 Rx"
#define D_SENSOR_SM16716_CLK "SM16716 CLK"

View File

@ -710,6 +710,7 @@
#define D_SENSOR_CSE7761_RX "CSE7761 Rx"
#define D_SENSOR_CSE7766_TX "CSE7766 Tx"
#define D_SENSOR_CSE7766_RX "CSE7766 Rx"
#define D_SENSOR_BL0939_RX "BL0939 Rx"
#define D_SENSOR_PN532_TX "PN532 Tx"
#define D_SENSOR_PN532_RX "PN532 Rx"
#define D_SENSOR_SM16716_CLK "SM16716 CLK"

View File

@ -710,6 +710,7 @@
#define D_SENSOR_CSE7761_RX "CSE7761 Rx"
#define D_SENSOR_CSE7766_TX "CSE7766 Tx"
#define D_SENSOR_CSE7766_RX "CSE7766 Rx"
#define D_SENSOR_BL0939_RX "BL0939 Rx"
#define D_SENSOR_PN532_TX "PN532 Tx"
#define D_SENSOR_PN532_RX "PN532 Rx"
#define D_SENSOR_SM16716_CLK "SM16716 CLK"

View File

@ -321,6 +321,7 @@
#define LIGHT_VIRTUAL_CT false // [SetOption106] Virtual CT - Creates a virtual White ColorTemp for RGBW lights
#define LIGHT_VIRTUAL_CT_CW false // [SetOption107] Virtual CT Channel - signals whether the hardware white is cold CW (true) or warm WW (false)
#define LIGHT_VIRTUAL_CT_POINTS 3 // Number of reference points for Virtual CT (min 2, default 3)
#define USE_AC_ZERO_CROSS_DIMMER // Requires USE_COUNTER and USE_LIGHT
// -- Energy --------------------------------------
#define ENERGY_VOLTAGE_ALWAYS false // [SetOption21] Enable show voltage even if powered off
@ -623,7 +624,7 @@
// #define USE_DHT12 // [I2cDriver41] Enable DHT12 humidity and temperature sensor (I2C address 0x5C) (+0k7 code)
// #define USE_DS1624 // [I2cDriver42] Enable DS1624, DS1621 temperature sensor (I2C addresses 0x48 - 0x4F) (+1k2 code)
// #define USE_AHT1x // [I2cDriver43] Enable AHT10/15 humidity and temperature sensor (I2C address 0x38, 0x39) (+0k8 code)
// #define USE_AHT2x // [I2cDriver43] Enable AHT20 instead of AHT1x humidity and temperature sensor (I2C address 0x38) (+0k8 code)
// #define USE_AHT2x // [I2cDriver43] Enable AHT20 instead of AHT1x humidity and temperature sensor (I2C address 0x38) (+0k8 code)
// #define USE_WEMOS_MOTOR_V1 // [I2cDriver44] Enable Wemos motor driver V1 (I2C addresses 0x2D - 0x30) (+0k7 code)
// #define WEMOS_MOTOR_V1_ADDR 0x30 // Default I2C address 0x30
// #define WEMOS_MOTOR_V1_FREQ 1000 // Default frequency
@ -780,7 +781,7 @@
//#define USE_LE01MR // Add support for F&F LE-01MR Modbus energy monitor (+1k code)
#define LE01MR_SPEED 9600 // LE-01MR modbus baudrate (default: 9600)
#define LE01MR_ADDR 1 // LE-01MR modbus address (default: 0x01)
#define USE_BL0940 // Add support for BL0940 Energy monitor as used in Blitzwolf SHP-10 (+1k6 code)
#define USE_BL09XX // Add support for various BL09XX Energy monitor as used in Blitzwolf SHP-10 or Sonoff Dual R3 v2 (+1k6 code)
//#define USE_TELEINFO // Add support for Teleinfo via serial RX interface (+5k2 code, +168 RAM + SmartMeter LinkedList Values RAM)
//#define USE_IEM3000 // Add support for Schneider Electric iEM3000-Modbus series energy monitor (+0k8 code)
#define IEM3000_SPEED 19200 // iEM3000-Modbus RS485 serial speed (default: 19200 baud)

View File

@ -981,115 +981,6 @@ int GetStateNumber(const char *state_text)
return state_number;
}
String GetSerialConfig(void) {
// Settings->serial_config layout
// b000000xx - 5, 6, 7 or 8 data bits
// b00000x00 - 1 or 2 stop bits
// b000xx000 - None, Even or Odd parity
const static char kParity[] PROGMEM = "NEOI";
char config[4];
config[0] = '5' + (Settings->serial_config & 0x3);
config[1] = pgm_read_byte(&kParity[(Settings->serial_config >> 3) & 0x3]);
config[2] = '1' + ((Settings->serial_config >> 2) & 0x1);
config[3] = '\0';
return String(config);
}
#if defined(ESP32) && CONFIG_IDF_TARGET_ESP32C3
// temporary workaround, see https://github.com/espressif/arduino-esp32/issues/5287
#include <driver/uart.h>
uint32_t GetSerialBaudrate(void) {
uint32_t br;
uart_get_baudrate(0, &br);
return (br / 300) * 300; // Fix ESP32 strange results like 115201
}
#else
uint32_t GetSerialBaudrate(void) {
return (Serial.baudRate() / 300) * 300; // Fix ESP32 strange results like 115201
}
#endif
void SetSerialBegin(void) {
TasmotaGlobal.baudrate = Settings->baudrate * 300;
AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_SERIAL "Set to %s %d bit/s"), GetSerialConfig().c_str(), TasmotaGlobal.baudrate);
Serial.flush();
#ifdef ESP8266
Serial.begin(TasmotaGlobal.baudrate, (SerialConfig)pgm_read_byte(kTasmotaSerialConfig + Settings->serial_config));
#endif // ESP8266
#ifdef ESP32
delay(10); // Allow time to cleanup queues - if not used hangs ESP32
Serial.end();
delay(10); // Allow time to cleanup queues - if not used hangs ESP32
uint32_t config = pgm_read_dword(kTasmotaSerialConfig + Settings->serial_config);
Serial.begin(TasmotaGlobal.baudrate, config);
#endif // ESP32
}
void SetSerialConfig(uint32_t serial_config) {
if (serial_config > TS_SERIAL_8O2) {
serial_config = TS_SERIAL_8N1;
}
if (serial_config != Settings->serial_config) {
Settings->serial_config = serial_config;
SetSerialBegin();
}
}
void SetSerialBaudrate(uint32_t baudrate) {
TasmotaGlobal.baudrate = baudrate;
Settings->baudrate = TasmotaGlobal.baudrate / 300;
if (GetSerialBaudrate() != TasmotaGlobal.baudrate) {
SetSerialBegin();
}
}
void SetSerial(uint32_t baudrate, uint32_t serial_config) {
Settings->flag.mqtt_serial = 0; // CMND_SERIALSEND and CMND_SERIALLOG
Settings->serial_config = serial_config;
TasmotaGlobal.baudrate = baudrate;
Settings->baudrate = TasmotaGlobal.baudrate / 300;
SetSeriallog(LOG_LEVEL_NONE);
SetSerialBegin();
}
void ClaimSerial(void) {
TasmotaGlobal.serial_local = true;
AddLog(LOG_LEVEL_INFO, PSTR("SNS: Hardware Serial"));
SetSeriallog(LOG_LEVEL_NONE);
TasmotaGlobal.baudrate = GetSerialBaudrate();
Settings->baudrate = TasmotaGlobal.baudrate / 300;
}
void SerialSendRaw(char *codes)
{
char *p;
char stemp[3];
uint8_t code;
int size = strlen(codes);
while (size > 1) {
strlcpy(stemp, codes, sizeof(stemp));
code = strtol(stemp, &p, 16);
Serial.write(code);
size -= 2;
codes += 2;
}
}
// values is a comma-delimited string: e.g. "72,101,108,108,111,32,87,111,114,108,100,33,10"
void SerialSendDecimal(char *values)
{
char *p;
uint8_t code;
for (char* str = strtok_r(values, ",", &p); str; str = strtok_r(nullptr, ",", &p)) {
code = (uint8_t)atoi(str);
Serial.write(code);
}
}
uint32_t GetHash(const char *buffer, size_t size)
{
uint32_t hash = 0;
@ -1894,6 +1785,130 @@ uint32_t JsonParsePath(JsonParserObject *jobj, const char *spath, char delim, fl
#endif // USE_SCRIPT
/*********************************************************************************************\
* Serial
\*********************************************************************************************/
String GetSerialConfig(void) {
// Settings->serial_config layout
// b000000xx - 5, 6, 7 or 8 data bits
// b00000x00 - 1 or 2 stop bits
// b000xx000 - None, Even or Odd parity
const static char kParity[] PROGMEM = "NEOI";
char config[4];
config[0] = '5' + (Settings->serial_config & 0x3);
config[1] = pgm_read_byte(&kParity[(Settings->serial_config >> 3) & 0x3]);
config[2] = '1' + ((Settings->serial_config >> 2) & 0x1);
config[3] = '\0';
return String(config);
}
#if defined(ESP32) && CONFIG_IDF_TARGET_ESP32C3
// temporary workaround, see https://github.com/espressif/arduino-esp32/issues/5287
#include <driver/uart.h>
uint32_t GetSerialBaudrate(void) {
uint32_t br;
uart_get_baudrate(0, &br);
return (br / 300) * 300; // Fix ESP32 strange results like 115201
}
#else
uint32_t GetSerialBaudrate(void) {
return (Serial.baudRate() / 300) * 300; // Fix ESP32 strange results like 115201
}
#endif
#ifdef ESP8266
void SetSerialSwap(void) {
if ((15 == Pin(GPIO_TXD)) && (13 == Pin(GPIO_RXD))) {
Serial.flush();
Serial.swap();
AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_SERIAL "Serial pins swapped to alternate"));
}
}
#endif
void SetSerialBegin(void) {
TasmotaGlobal.baudrate = Settings->baudrate * 300;
AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_SERIAL "Set to %s %d bit/s"), GetSerialConfig().c_str(), TasmotaGlobal.baudrate);
Serial.flush();
#ifdef ESP8266
Serial.begin(TasmotaGlobal.baudrate, (SerialConfig)pgm_read_byte(kTasmotaSerialConfig + Settings->serial_config));
SetSerialSwap();
#endif // ESP8266
#ifdef ESP32
delay(10); // Allow time to cleanup queues - if not used hangs ESP32
Serial.end();
delay(10); // Allow time to cleanup queues - if not used hangs ESP32
uint32_t config = pgm_read_dword(kTasmotaSerialConfig + Settings->serial_config);
Serial.begin(TasmotaGlobal.baudrate, config);
#endif // ESP32
}
void SetSerialConfig(uint32_t serial_config) {
if (serial_config > TS_SERIAL_8O2) {
serial_config = TS_SERIAL_8N1;
}
if (serial_config != Settings->serial_config) {
Settings->serial_config = serial_config;
SetSerialBegin();
}
}
void SetSerialBaudrate(uint32_t baudrate) {
TasmotaGlobal.baudrate = baudrate;
Settings->baudrate = TasmotaGlobal.baudrate / 300;
if (GetSerialBaudrate() != TasmotaGlobal.baudrate) {
SetSerialBegin();
}
}
void SetSerial(uint32_t baudrate, uint32_t serial_config) {
Settings->flag.mqtt_serial = 0; // CMND_SERIALSEND and CMND_SERIALLOG
Settings->serial_config = serial_config;
TasmotaGlobal.baudrate = baudrate;
Settings->baudrate = TasmotaGlobal.baudrate / 300;
SetSeriallog(LOG_LEVEL_NONE);
SetSerialBegin();
}
void ClaimSerial(void) {
TasmotaGlobal.serial_local = true;
AddLog(LOG_LEVEL_INFO, PSTR("SNS: Hardware Serial"));
SetSeriallog(LOG_LEVEL_NONE);
TasmotaGlobal.baudrate = GetSerialBaudrate();
Settings->baudrate = TasmotaGlobal.baudrate / 300;
}
void SerialSendRaw(char *codes)
{
char *p;
char stemp[3];
uint8_t code;
int size = strlen(codes);
while (size > 1) {
strlcpy(stemp, codes, sizeof(stemp));
code = strtol(stemp, &p, 16);
Serial.write(code);
size -= 2;
codes += 2;
}
}
// values is a comma-delimited string: e.g. "72,101,108,108,111,32,87,111,114,108,100,33,10"
void SerialSendDecimal(char *values)
{
char *p;
uint8_t code;
for (char* str = strtok_r(values, ",", &p); str; str = strtok_r(nullptr, ",", &p)) {
code = (uint8_t)atoi(str);
Serial.write(code);
}
}
/*********************************************************************************************\
* Sleep aware time scheduler functions borrowed from ESPEasy
\*********************************************************************************************/

View File

@ -1450,6 +1450,10 @@ void CmndPwmfrequency(void)
if ((1 == XdrvMailbox.payload) || ((XdrvMailbox.payload >= PWM_MIN) && (XdrvMailbox.payload <= PWM_MAX))) {
Settings->pwm_frequency = (1 == XdrvMailbox.payload) ? PWM_FREQ : XdrvMailbox.payload;
analogWriteFreq(Settings->pwm_frequency); // Default is 1000 (core_esp8266_wiring_pwm.c)
#ifdef USE_LIGHT
LightReapplyColor();
LightAnimate();
#endif // USE_LIGHT
}
ResponseCmndNumber(Settings->pwm_frequency);
}

View File

@ -509,7 +509,7 @@ void ResponseAppendFeatures(void)
#if defined(USE_ENERGY_SENSOR) && defined(USE_LE01MR)
feature5 |= 0x08000000; // xnrg_13_fif_le01mr.ino
#endif
#if defined(USE_I2C) && defined(USE_AHT1x)
#if defined(USE_I2C) && (defined(USE_AHT1x) || defined(USE_AHT2x))
feature5 |= 0x10000000; // xsns_63_aht1x.ino
#endif
#if defined(USE_I2C) && defined(USE_WEMOS_MOTOR_V1)
@ -567,8 +567,8 @@ void ResponseAppendFeatures(void)
#if defined(USE_I2C) && defined(USE_MCP9808)
feature6 |= 0x00002000; // xsns_72_mcp9808.ino
#endif
#if defined(USE_ENERGY_SENSOR) && defined(USE_BL0940)
feature6 |= 0x00004000; // xnrg_14_bl0940.ino
#if defined(USE_ENERGY_SENSOR) && (defined(USE_BL0940) || defined(USE_BL09XX))
feature6 |= 0x00004000; // xnrg_14_bl09xx.ino
#endif
#ifdef USE_TELEGRAM
feature6 |= 0x00008000; // xdrv_40_telegram.ino

View File

@ -1779,6 +1779,7 @@ void GpioInit(void)
#ifdef ESP8266
if ((2 == Pin(GPIO_TXD)) || (H801 == TasmotaGlobal.module_type)) { Serial.set_tx(2); }
SetSerialSwap();
#endif
uint32_t sspi_mosi = (PinUsed(GPIO_SSPI_SCLK) && PinUsed(GPIO_SSPI_MOSI)) ? SPI_MOSI : SPI_NONE;

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