Merge branch 'arendst:development' into development

This commit is contained in:
Alexey Pavlov 2021-12-17 15:24:51 +03:00 committed by GitHub
commit aefdb06fa8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
311 changed files with 2651 additions and 4745 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -18,6 +18,7 @@ on:
jobs:
base-images:
runs-on: ubuntu-latest
if: github.repository == 'arendst/Tasmota'
strategy:
matrix:
variant:
@ -59,6 +60,7 @@ jobs:
language-images:
runs-on: ubuntu-latest
if: github.repository == 'arendst/Tasmota'
strategy:
matrix:
variant: [ tasmota ]

View File

@ -20,7 +20,9 @@
#if defined(ESP32) || defined(ESP8266)
#define _GNU_SOURCE
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#include "AudioFileSourceICYStream.h"
#include <string.h>

View File

@ -3,7 +3,9 @@
#ifdef DEBUG
#undef NDEBUG
#else
#define NDEBUG
#ifndef NDEBUG
#define NDEBUG
#endif
#endif
/* config.h. Generated from config.h.in by configure. */

View File

@ -1610,10 +1610,12 @@ void Adafruit_GFX_Button::drawButton(boolean inverted) {
text = _fillcolor;
}
#if defined USE_UFILESYS
if (_label[0]=='/') {
draw_picture(_label, _x1, _y1, _w, _h, outline, inverted);
_gfx->drawRect(_x1, _y1, _w, _h, text);
} else {
#endif
uint8_t r = min(_w, _h) / 4; // Corner radius
_gfx->fillRoundRect(_x1, _y1, _w, _h, r, fill);
_gfx->drawRoundRect(_x1, _y1, _w, _h, r, outline);
@ -1622,7 +1624,9 @@ void Adafruit_GFX_Button::drawButton(boolean inverted) {
_gfx->setTextColor(text);
_gfx->setTextSize(_textsize_x, _textsize_y);
_gfx->print(_label);
#if defined USE_UFILESYS
}
#endif
}
/**************************************************************************/

View File

@ -1,30 +0,0 @@
/********************************************************************
* Berry module `webserver`
*
* To use: `import webserver`
*
* Allows to respond to HTTP request
*******************************************************************/
#include "be_constobj.h"
extern int m_md5_init(bvm *vm);
extern int m_md5_update(bvm *vm);
extern int m_md5_finish(bvm *vm);
#include "../generate/be_fixed_be_class_md5.h"
void be_load_md5_lib(bvm *vm) {
be_pushntvclass(vm, &be_class_md5);
be_setglobal(vm, "MD5");
be_pop(vm, 1);
}
/* @const_object_info_begin
class be_class_md5 (scope: global, name: MD5) {
.p, var
init, func(m_md5_init)
update, func(m_md5_update)
finish, func(m_md5_finish)
}
@const_object_info_end */

View File

@ -1,96 +0,0 @@
#include "be_constobj.h"
static be_define_const_map_slots(be_class_tasmota_map) {
{ be_const_key(gc, -1), be_const_closure(Tasmota_gc_closure) },
{ be_const_key(read_sensors, 7), be_const_func(l_read_sensors) },
{ be_const_key(_get_cb, -1), be_const_func(l_get_cb) },
{ be_const_key(response_append, 50), be_const_func(l_respAppend) },
{ be_const_key(try_rule, 74), be_const_closure(Tasmota_try_rule_closure) },
{ be_const_key(eth, -1), be_const_func(l_eth) },
{ be_const_key(find_key_i, -1), be_const_closure(Tasmota_find_key_i_closure) },
{ be_const_key(exec_tele, 73), be_const_closure(Tasmota_exec_tele_closure) },
{ be_const_key(remove_driver, 28), be_const_closure(Tasmota_remove_driver_closure) },
{ be_const_key(load, -1), be_const_closure(Tasmota_load_closure) },
{ be_const_key(_settings_ptr, -1), be_const_comptr(&Settings) },
{ be_const_key(cmd_res, -1), be_const_var(0) },
{ be_const_key(time_str, 43), be_const_closure(Tasmota_time_str_closure) },
{ be_const_key(set_power, -1), be_const_func(l_setpower) },
{ be_const_key(yield, 20), be_const_func(l_yield) },
{ be_const_key(set_light, -1), be_const_closure(Tasmota_set_light_closure) },
{ be_const_key(find_op, 32), be_const_closure(Tasmota_find_op_closure) },
{ be_const_key(get_power, -1), be_const_func(l_getpower) },
{ be_const_key(add_rule, -1), be_const_closure(Tasmota_add_rule_closure) },
{ be_const_key(cb_dispatch, -1), be_const_closure(Tasmota_cb_dispatch_closure) },
{ be_const_key(global, -1), be_const_var(1) },
{ be_const_key(i2c_enabled, -1), be_const_func(l_i2cenabled) },
{ be_const_key(remove_cmd, 10), be_const_closure(Tasmota_remove_cmd_closure) },
{ be_const_key(millis, 18), be_const_func(l_millis) },
{ be_const_key(publish, 69), be_const_func(l_publish) },
{ be_const_key(_drivers, -1), be_const_var(2) },
{ be_const_key(resp_cmnd, -1), be_const_func(l_respCmnd) },
{ be_const_key(time_dump, -1), be_const_func(l_time_dump) },
{ be_const_key(web_send, -1), be_const_func(l_webSend) },
{ be_const_key(hs2rgb, -1), be_const_closure(Tasmota_hs2rgb_closure) },
{ be_const_key(memory, -1), be_const_func(l_memory) },
{ be_const_key(gen_cb, 0), be_const_closure(Tasmota_gen_cb_closure) },
{ be_const_key(rtc, -1), be_const_func(l_rtc) },
{ be_const_key(get_option, -1), be_const_func(l_getoption) },
{ be_const_key(add_cmd, -1), be_const_closure(Tasmota_add_cmd_closure) },
{ be_const_key(init, -1), be_const_closure(Tasmota_init_closure) },
{ be_const_key(_timers, -1), be_const_var(3) },
{ be_const_key(_global_addr, -1), be_const_comptr(&TasmotaGlobal) },
{ be_const_key(wd, -1), be_const_var(4) },
{ be_const_key(exec_cmd, -1), be_const_closure(Tasmota_exec_cmd_closure) },
{ be_const_key(wire_scan, -1), be_const_closure(Tasmota_wire_scan_closure) },
{ be_const_key(_global_def, 61), be_const_comptr(&be_tasmota_global_struct) },
{ be_const_key(resp_cmnd_failed, 11), be_const_func(l_respCmndFailed) },
{ be_const_key(chars_in_string, -1), be_const_closure(Tasmota_chars_in_string_closure) },
{ be_const_key(web_send_decimal, -1), be_const_func(l_webSendDecimal) },
{ be_const_key(_debug_present, 4), be_const_var(5) },
{ be_const_key(cmd, -1), be_const_closure(Tasmota_cmd_closure) },
{ be_const_key(_cb, -1), be_const_var(6) },
{ be_const_key(remove_rule, -1), be_const_closure(Tasmota_remove_rule_closure) },
{ be_const_key(run_deferred, -1), be_const_closure(Tasmota_run_deferred_closure) },
{ be_const_key(strftime, -1), be_const_func(l_strftime) },
{ be_const_key(add_driver, 3), be_const_closure(Tasmota_add_driver_closure) },
{ be_const_key(kv, 60), be_const_closure(Tasmota_kv_closure) },
{ be_const_key(set_timer, 58), be_const_closure(Tasmota_set_timer_closure) },
{ be_const_key(scale_uint, -1), be_const_func(l_scaleuint) },
{ be_const_key(remove_timer, -1), be_const_closure(Tasmota_remove_timer_closure) },
{ be_const_key(settings, 49), be_const_var(7) },
{ be_const_key(arch, -1), be_const_func(l_arch) },
{ be_const_key(_ccmd, 64), be_const_var(8) },
{ be_const_key(wire1, 46), be_const_var(9) },
{ be_const_key(exec_rules, 66), be_const_closure(Tasmota_exec_rules_closure) },
{ be_const_key(strptime, -1), be_const_func(l_strptime) },
{ be_const_key(_cmd, -1), be_const_func(l_cmd) },
{ be_const_key(resp_cmnd_error, -1), be_const_func(l_respCmndError) },
{ be_const_key(time_reached, -1), be_const_func(l_timereached) },
{ be_const_key(_rules, -1), be_const_var(10) },
{ be_const_key(publish_result, -1), be_const_func(l_publish_result) },
{ be_const_key(_settings_def, -1), be_const_comptr(&be_tasmota_settings_struct) },
{ be_const_key(get_switch, -1), be_const_func(l_getswitch) },
{ be_const_key(delay, 71), be_const_func(l_delay) },
{ be_const_key(resp_cmnd_str, -1), be_const_func(l_respCmndStr) },
{ be_const_key(wifi, -1), be_const_func(l_wifi) },
{ be_const_key(save, 15), be_const_func(l_save) },
{ be_const_key(log, 37), be_const_func(l_logInfo) },
{ be_const_key(resolvecmnd, -1), be_const_func(l_resolveCmnd) },
{ be_const_key(resp_cmnd_done, -1), be_const_func(l_respCmndDone) },
{ be_const_key(get_light, 5), be_const_closure(Tasmota_get_light_closure) },
{ be_const_key(get_free_heap, -1), be_const_func(l_getFreeHeap) },
{ be_const_key(wire2, -1), be_const_var(11) },
{ be_const_key(event, 34), be_const_closure(Tasmota_event_closure) },
};
static be_define_const_map(
be_class_tasmota_map,
80
);
BE_EXPORT_VARIABLE be_define_const_class(
be_class_tasmota,
12,
NULL,
Tasmota
);

View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

@ -6,57 +6,6 @@
*******************************************************************/
#include "be_constobj.h"
/********************************************************************
** Solidified function: init
********************************************************************/
be_local_closure(Driver_init, /* name */
be_nested_proto(
1, /* nstack */
1, /* argc */
0, /* varg */
0, /* has upvals */
NULL, /* no upvals */
0, /* has sup protos */
NULL, /* no sub protos */
0, /* has constants */
NULL, /* no const */
&be_const_str_init,
&be_const_str_solidified,
( &(const binstruction[ 1]) { /* code */
0x80000000, // 0000 RET 0
})
)
);
/*******************************************************************/
/********************************************************************
** Solidified function: get_tasmota
********************************************************************/
be_local_closure(Driver_get_tasmota, /* name */
be_nested_proto(
2, /* nstack */
1, /* argc */
0, /* varg */
0, /* has upvals */
NULL, /* no upvals */
0, /* has sup protos */
NULL, /* no sub protos */
1, /* has constants */
( &(const bvalue[ 1]) { /* constants */
/* K0 */ be_nested_str(tasmota),
}),
&be_const_str_get_tasmota,
&be_const_str_solidified,
( &(const binstruction[ 2]) { /* code */
0xB8060000, // 0000 GETNGBL R1 K0
0x80040200, // 0001 RET 1 R1
})
)
);
/*******************************************************************/
/********************************************************************
** Solidified function: add_cmd
********************************************************************/
@ -123,24 +72,22 @@ be_local_closure(Driver_add_cmd, /* name */
be_local_class(Driver,
13,
NULL,
be_nested_map(16,
be_nested_map(14,
( (struct bmapnode*) &(const bmapnode[]) {
{ be_const_key(web_add_main_button, 14), be_const_var(4) },
{ be_const_key(web_add_console_button, -1), be_const_var(7) },
{ be_const_key(web_add_management_button, 8), be_const_var(5) },
{ be_const_key(init, -1), be_const_closure(Driver_init_closure) },
{ be_const_key(json_append, -1), be_const_var(10) },
{ be_const_key(web_add_config_button, 7), be_const_var(6) },
{ be_const_key(every_100ms, -1), be_const_var(1) },
{ be_const_key(display, -1), be_const_var(12) },
{ be_const_key(web_add_button, 13), be_const_var(3) },
{ be_const_key(every_second, -1), be_const_var(0) },
{ be_const_key(save_before_restart, -1), be_const_var(8) },
{ be_const_key(get_tasmota, -1), be_const_closure(Driver_get_tasmota_closure) },
{ be_const_key(web_sensor, 6), be_const_var(9) },
{ be_const_key(web_add_handler, -1), be_const_var(2) },
{ be_const_key(button_pressed, 1), be_const_var(11) },
{ be_const_key(web_add_console_button, 6), be_const_var(7) },
{ be_const_key(web_add_config_button, -1), be_const_var(6) },
{ be_const_key(button_pressed, 9), be_const_var(11) },
{ be_const_key(every_second, 1), be_const_var(0) },
{ be_const_key(web_add_handler, 11), be_const_var(2) },
{ be_const_key(add_cmd, -1), be_const_closure(Driver_add_cmd_closure) },
{ be_const_key(web_sensor, -1), be_const_var(9) },
{ be_const_key(display, -1), be_const_var(12) },
{ be_const_key(web_add_main_button, 2), be_const_var(4) },
{ be_const_key(save_before_restart, -1), be_const_var(8) },
{ be_const_key(web_add_management_button, 0), be_const_var(5) },
{ be_const_key(every_100ms, 13), be_const_var(1) },
{ be_const_key(json_append, -1), be_const_var(10) },
{ be_const_key(web_add_button, -1), be_const_var(3) },
})),
be_str_literal("Driver")
);

View File

@ -712,7 +712,7 @@ be_local_closure(AXP192_web_sensor, /* name */
/* K4 */ be_nested_str(_X7Bs_X7DVBus_X20Current_X7Bm_X7D_X25_X2E1f_X20mA_X7Be_X7D),
/* K5 */ be_nested_str(_X7Bs_X7DBatt_X20Voltage_X7Bm_X7D_X25_X2E3f_X20V_X7Be_X7D),
/* K6 */ be_nested_str(_X7Bs_X7DBatt_X20Current_X7Bm_X7D_X25_X2E1f_X20mA_X7Be_X7D),
/* K7 */ be_nested_str(_X7Bs_X7DTemp_X20AXP_X7Bm_X7D_X25_X2E1f_X20_XB0C_X7Be_X7D),
/* K7 */ be_nested_str(_X7Bs_X7DTemp_X20AXP_X7Bm_X7D_X25_X2E1f_X20_X26deg_X3BC_X7Be_X7D),
/* K8 */ be_nested_str(get_vbus_voltage),
/* K9 */ be_nested_str(get_bat_voltage),
/* K10 */ be_nested_str(get_bat_current),

View File

@ -279,7 +279,7 @@ be_local_closure(I2C_Driver_read8, /* name */
********************************************************************/
be_local_closure(I2C_Driver_init, /* name */
be_nested_proto(
10, /* nstack */
9, /* nstack */
4, /* argc */
0, /* varg */
0, /* has upvals */
@ -288,7 +288,7 @@ be_local_closure(I2C_Driver_init, /* name */
NULL, /* no sub protos */
1, /* has constants */
( &(const bvalue[10]) { /* constants */
/* K0 */ be_nested_str(get_tasmota),
/* K0 */ be_nested_str(tasmota),
/* K1 */ be_nested_str(i2c_enabled),
/* K2 */ be_nested_str(addr),
/* K3 */ be_nested_str(wire),
@ -302,49 +302,49 @@ be_local_closure(I2C_Driver_init, /* name */
&be_const_str_init,
&be_const_str_solidified,
( &(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
0x4C100000, // 0000 LDNIL R4
0x20100604, // 0001 NE R4 R3 R4
0x78120005, // 0002 JMPF R4 #0009
0xB8120000, // 0003 GETNGBL R4 K0
0x8C100901, // 0004 GETMET R4 R4 K1
0x5C180600, // 0005 MOVE R6 R3
0x7C100400, // 0006 CALL R4 2
0x74120000, // 0007 JMPT R4 #0009
0x80000800, // 0008 RET 0
0x90020402, // 0009 SETMBR R0 K2 R2
0xB8120000, // 000A GETNGBL R4 K0
0x8C100904, // 000B GETMET R4 R4 K4
0x88180102, // 000C GETMBR R6 R0 K2
0x7C100400, // 000D CALL R4 2
0x90020604, // 000E SETMBR R0 K3 R4
0x88100103, // 000F GETMBR R4 R0 K3
0x78120019, // 0010 JMPF R4 #002B
0x60100004, // 0011 GETGBL R4 G4
0x5C140200, // 0012 MOVE R5 R1
0x7C100200, // 0013 CALL R4 1
0x1C100905, // 0014 EQ R4 R4 K5
0x78120004, // 0015 JMPF R4 #001B
0x5C100200, // 0016 MOVE R4 R1
0x5C140000, // 0017 MOVE R5 R0
0x7C100200, // 0018 CALL R4 1
0x90020C04, // 0019 SETMBR R0 K6 R4
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
0x88100106, // 001C GETMBR R4 R0 K6
0x4C140000, // 001D LDNIL R5
0x1C100805, // 001E EQ R4 R4 R5
0x78120001, // 001F JMPF R4 #0022
0x4C100000, // 0020 LDNIL R4
0x90020604, // 0021 SETMBR R0 K3 R4
0x88100103, // 0022 GETMBR R4 R0 K3
0x78120006, // 0023 JMPF R4 #002B
0x60100001, // 0024 GETGBL R4 G1
0x58140007, // 0025 LDCONST R5 K7
0x88180106, // 0026 GETMBR R6 R0 K6
0x581C0008, // 0027 LDCONST R7 K8
0x88200103, // 0028 GETMBR R8 R0 K3
0x88201109, // 0029 GETMBR R8 R8 K9
0x7C100800, // 002A CALL R4 4
0x80000000, // 002B RET 0
})
)

View File

@ -69,7 +69,7 @@ be_local_closure(LVGL_glob_widget_event_impl, /* name */
}),
&be_const_str_widget_event_impl,
&be_const_str_solidified,
( &(const binstruction[30]) { /* code */
( &(const binstruction[28]) { /* code */
0xA40E0000, // 0000 IMPORT R3 K0
0xB8120200, // 0001 GETNGBL R4 K1
0x8C100902, // 0002 GETMET R4 R4 K2
@ -81,25 +81,23 @@ be_local_closure(LVGL_glob_widget_event_impl, /* name */
0x7C140400, // 0008 CALL R5 2
0x88180B04, // 0009 GETMBR R6 R5 K4
0x8C1C0105, // 000A GETMET R7 R0 K5
0x60240009, // 000B GETGBL R9 G9
0x5C280C00, // 000C MOVE R10 R6
0x7C240200, // 000D CALL R9 1
0x7C1C0400, // 000E CALL R7 2
0x60200004, // 000F GETGBL R8 G4
0x5C240E00, // 0010 MOVE R9 R7
0x7C200200, // 0011 CALL R8 1
0x1C201106, // 0012 EQ R8 R8 K6
0x78220008, // 0013 JMPF R8 #001D
0x8C200707, // 0014 GETMET R8 R3 K7
0x5C280E00, // 0015 MOVE R10 R7
0x582C0008, // 0016 LDCONST R11 K8
0x7C200600, // 0017 CALL R8 3
0x78220003, // 0018 JMPF R8 #001D
0x8C200F08, // 0019 GETMET R8 R7 K8
0x5C280800, // 001A MOVE R10 R4
0x5C2C0A00, // 001B MOVE R11 R5
0x7C200600, // 001C CALL R8 3
0x80000000, // 001D RET 0
0x5C240C00, // 000B MOVE R9 R6
0x7C1C0400, // 000C CALL R7 2
0x60200004, // 000D GETGBL R8 G4
0x5C240E00, // 000E MOVE R9 R7
0x7C200200, // 000F CALL R8 1
0x1C201106, // 0010 EQ R8 R8 K6
0x78220008, // 0011 JMPF R8 #001B
0x8C200707, // 0012 GETMET R8 R3 K7
0x5C280E00, // 0013 MOVE R10 R7
0x582C0008, // 0014 LDCONST R11 K8
0x7C200600, // 0015 CALL R8 3
0x78220003, // 0016 JMPF R8 #001B
0x8C200F08, // 0017 GETMET R8 R7 K8
0x5C280800, // 0018 MOVE R10 R4
0x5C2C0A00, // 0019 MOVE R11 R5
0x7C200600, // 001A CALL R8 3
0x80000000, // 001B RET 0
})
)
);
@ -130,7 +128,7 @@ be_local_closure(LVGL_glob_lvgl_event_dispatch, /* name */
}),
&be_const_str_lvgl_event_dispatch,
&be_const_str_solidified,
( &(const binstruction[20]) { /* code */
( &(const binstruction[18]) { /* code */
0xA40A0000, // 0000 IMPORT R2 K0
0xB80E0200, // 0001 GETNGBL R3 K1
0x8C0C0702, // 0002 GETMET R3 R3 K2
@ -138,19 +136,17 @@ be_local_closure(LVGL_glob_lvgl_event_dispatch, /* name */
0x5C1C0200, // 0004 MOVE R7 R1
0x7C140400, // 0005 CALL R5 2
0x7C0C0400, // 0006 CALL R3 2
0x60100009, // 0007 GETGBL R4 G9
0x88140704, // 0008 GETMBR R5 R3 K4
0x7C100200, // 0009 CALL R4 1
0x88140105, // 000A GETMBR R5 R0 K5
0x94140A04, // 000B GETIDX R5 R5 R4
0x8C180106, // 000C GETMET R6 R0 K6
0x5C200800, // 000D MOVE R8 R4
0x7C180400, // 000E CALL R6 2
0x5C1C0A00, // 000F MOVE R7 R5
0x5C200C00, // 0010 MOVE R8 R6
0x5C240600, // 0011 MOVE R9 R3
0x7C1C0400, // 0012 CALL R7 2
0x80000000, // 0013 RET 0
0x88100704, // 0007 GETMBR R4 R3 K4
0x88140105, // 0008 GETMBR R5 R0 K5
0x94140A04, // 0009 GETIDX R5 R5 R4
0x8C180106, // 000A GETMET R6 R0 K6
0x5C200800, // 000B MOVE R8 R4
0x7C180400, // 000C CALL R6 2
0x5C1C0A00, // 000D MOVE R7 R5
0x5C200C00, // 000E MOVE R8 R6
0x5C240600, // 000F MOVE R9 R3
0x7C1C0400, // 0010 CALL R7 2
0x80000000, // 0011 RET 0
})
)
);
@ -229,7 +225,7 @@ be_local_closure(LVGL_glob_register_obj, /* name */
}),
&be_const_str_register_obj,
&be_const_str_solidified,
( &(const binstruction[13]) { /* code */
( &(const binstruction[11]) { /* code */
0x88080100, // 0000 GETMBR R2 R0 K0
0x4C0C0000, // 0001 LDNIL R3
0x1C080403, // 0002 EQ R2 R2 R3
@ -237,12 +233,10 @@ be_local_closure(LVGL_glob_register_obj, /* name */
0x60080013, // 0004 GETGBL R2 G19
0x7C080000, // 0005 CALL R2 0
0x90020002, // 0006 SETMBR R0 K0 R2
0x60080009, // 0007 GETGBL R2 G9
0x880C0301, // 0008 GETMBR R3 R1 K1
0x7C080200, // 0009 CALL R2 1
0x880C0100, // 000A GETMBR R3 R0 K0
0x980C0401, // 000B SETIDX R3 R2 R1
0x80000000, // 000C RET 0
0x88080301, // 0007 GETMBR R2 R1 K1
0x880C0100, // 0008 GETMBR R3 R0 K0
0x980C0401, // 0009 SETIDX R3 R2 R1
0x80000000, // 000A RET 0
})
)
);
@ -798,23 +792,23 @@ be_local_class(LVGL_glob,
NULL,
be_nested_map(20,
( (struct bmapnode*) &(const bmapnode[]) {
{ be_const_key(widget_ctor_cb, 9), be_const_var(4) },
{ be_const_key(widget_ctor_cb, 8), be_const_var(4) },
{ be_const_key(get_object_from_ptr, 4), be_const_closure(LVGL_glob_get_object_from_ptr_closure) },
{ be_const_key(cb_obj, 7), be_const_var(0) },
{ be_const_key(widget_struct_by_class, -1), be_const_var(8) },
{ be_const_key(widget_event_impl, -1), be_const_closure(LVGL_glob_widget_event_impl_closure) },
{ be_const_key(widget_dtor_cb, 6), be_const_var(5) },
{ be_const_key(cb_event_closure, -1), be_const_var(1) },
{ be_const_key(lvgl_event_dispatch, 16), be_const_closure(LVGL_glob_lvgl_event_dispatch_closure) },
{ be_const_key(widget_dtor_impl, -1), be_const_closure(LVGL_glob_widget_dtor_impl_closure) },
{ be_const_key(cb_do_nothing, 16), be_const_static_closure(LVGL_glob__anonymous__closure) },
{ be_const_key(null_cb, -1), be_const_var(3) },
{ be_const_key(register_obj, 8), be_const_closure(LVGL_glob_register_obj_closure) },
{ be_const_key(register_obj, -1), be_const_closure(LVGL_glob_register_obj_closure) },
{ be_const_key(widget_dtor_impl, 9), be_const_closure(LVGL_glob_widget_dtor_impl_closure) },
{ be_const_key(gen_cb, -1), be_const_closure(LVGL_glob_gen_cb_closure) },
{ be_const_key(widget_struct_default, -1), be_const_var(7) },
{ be_const_key(deregister_obj, 12), be_const_closure(LVGL_glob_deregister_obj_closure) },
{ be_const_key(deregister_obj, -1), be_const_closure(LVGL_glob_deregister_obj_closure) },
{ be_const_key(widget_struct_default, 12), be_const_var(7) },
{ be_const_key(widget_event_cb, -1), be_const_var(6) },
{ be_const_key(widget_cb, -1), be_const_closure(LVGL_glob_widget_cb_closure) },
{ be_const_key(cb_do_nothing, 3), be_const_closure(LVGL_glob__anonymous__closure) },
{ be_const_key(lvgl_event_dispatch, 3), be_const_closure(LVGL_glob_lvgl_event_dispatch_closure) },
{ be_const_key(event_cb, -1), be_const_var(2) },
{ be_const_key(create_custom_widget, -1), be_const_closure(LVGL_glob_create_custom_widget_closure) },
{ be_const_key(widget_ctor_impl, -1), be_const_closure(LVGL_glob_widget_ctor_impl_closure) },

View File

@ -0,0 +1,100 @@
/********************************************************************
* Berry module `webserver`
*
* To use: `import webserver`
*
* Allows to respond to HTTP request
*******************************************************************/
#include "be_constobj.h"
#include "be_mem.h"
#include "be_exec.h"
#include "esp_rom_md5.h"
int free_ctx(bvm* vm) {
int argc = be_top(vm);
if (argc > 0) {
be_getmember(vm, 1, ".p");
md5_context_t * ctx = (md5_context_t *) be_tocomptr(vm, -1);
if (ctx != NULL) {
be_os_free(ctx);
}
}
be_return_nil(vm);
}
// `Md5.init() -> `
int32_t m_md5_init(struct bvm *vm);
int32_t m_md5_init(struct bvm *vm) {
md5_context_t * ctx = (md5_context_t *) be_os_malloc(sizeof(md5_context_t));
if (!ctx) {
be_throw(vm, BE_MALLOC_FAIL);
}
esp_rom_md5_init(ctx);
be_newcomobj(vm, ctx, &free_ctx);
be_setmember(vm, 1, ".p");
be_return_nil(vm);
}
// `Md5.update(content:bytes()) -> nil`
//
// Add raw bytes to the MD5 calculation
int32_t m_md5_update(struct bvm *vm);
int32_t m_md5_update(struct bvm *vm) {
int32_t argc = be_top(vm); // Get the number of arguments
if (argc >= 2 && be_isinstance(vm, 2)) {
do {
be_getglobal(vm, "bytes"); /* get the bytes class */ /* TODO eventually replace with be_getbuiltin */
if (!be_isderived(vm, 2)) break;
size_t length = 0;
const void * bytes = be_tobytes(vm, 2, &length);
if (!bytes) break;
be_getmember(vm, 1, ".p");
md5_context_t * ctx;
ctx = (md5_context_t *) be_tocomptr(vm, -1);
if (!ctx) break;
if (length > 0) {
esp_rom_md5_update(ctx, (const uint8_t*) bytes, length);
}
be_return_nil(vm);
// success
} while (0);
}
be_raise(vm, "value_error", NULL);
}
// `Md5.update(content:bytes()) -> nil`
//
// Add raw bytes to the MD5 calculation
int32_t m_md5_finish(struct bvm *vm);
int32_t m_md5_finish(struct bvm *vm) {
be_getmember(vm, 1, ".p");
md5_context_t * ctx;
ctx = (md5_context_t *) be_tocomptr(vm, -1);
uint8_t output[16];
esp_rom_md5_final(output, ctx);
be_pushbytes(vm, output, sizeof(output));
be_return(vm);
}
#include "../generate/be_fixed_be_class_md5.h"
void be_load_md5_lib(bvm *vm) {
be_pushntvclass(vm, &be_class_md5);
be_setglobal(vm, "MD5");
be_pop(vm, 1);
}
/* @const_object_info_begin
class be_class_md5 (scope: global, name: MD5) {
.p, var
init, func(m_md5_init)
update, func(m_md5_update)
finish, func(m_md5_finish)
}
@const_object_info_end */

View File

@ -23,6 +23,10 @@ be_extern_native_module(solidify);
be_extern_native_module(introspect);
be_extern_native_module(strict);
/* Berry extensions */
#include "be_mapping.h"
be_extern_native_module(cb);
/* Tasmota specific */
be_extern_native_module(python_compat);
be_extern_native_module(re);
@ -85,6 +89,10 @@ BERRY_LOCAL const bntvmodule* const be_module_table[] = {
#if BE_USE_STRICT_MODULE
&be_native_module(strict),
#endif
/* Berry extensions */
&be_native_module(cb),
/* user-defined modules register start */
&be_native_module(python_compat),

View File

@ -16,7 +16,6 @@ extern int l_arch(bvm *vm);
extern int l_publish(bvm *vm);
extern int l_publish_result(bvm *vm);
extern int l_cmd(bvm *vm);
extern int l_get_cb(bvm *vm);
extern int l_getoption(bvm *vm);
extern int l_millis(bvm *vm);
extern int l_timereached(bvm *vm);
@ -384,7 +383,7 @@ be_local_closure(Tasmota_try_rule, /* name */
********************************************************************/
be_local_closure(Tasmota_gen_cb, /* name */
be_nested_proto(
7, /* nstack */
6, /* nstack */
2, /* argc */
0, /* varg */
0, /* has upvals */
@ -392,52 +391,18 @@ be_local_closure(Tasmota_gen_cb, /* name */
0, /* has sup protos */
NULL, /* no sub protos */
1, /* has constants */
( &(const bvalue[ 7]) { /* constants */
/* K0 */ be_nested_str(_cb),
/* K1 */ be_const_int(0),
/* K2 */ be_nested_str(find),
/* K3 */ be_nested_str(_get_cb),
/* K4 */ be_nested_str(stop_iteration),
/* K5 */ be_nested_str(internal_error),
/* K6 */ be_nested_str(No_X20callback_X20available),
( &(const bvalue[ 2]) { /* constants */
/* K0 */ be_nested_str(cb),
/* K1 */ be_nested_str(gen_cb),
}),
&be_const_str_gen_cb,
&be_const_str_solidified,
( &(const binstruction[34]) { /* code */
0x88080100, // 0000 GETMBR R2 R0 K0
0x4C0C0000, // 0001 LDNIL R3
0x1C080403, // 0002 EQ R2 R2 R3
0x780A0002, // 0003 JMPF R2 #0007
0x60080013, // 0004 GETGBL R2 G19
0x7C080000, // 0005 CALL R2 0
0x90020002, // 0006 SETMBR R0 K0 R2
0x60080010, // 0007 GETGBL R2 G16
0x540E0012, // 0008 LDINT R3 19
0x400E0203, // 0009 CONNECT R3 K1 R3
0x7C080200, // 000A CALL R2 1
0xA8020010, // 000B EXBLK 0 #001D
0x5C0C0400, // 000C MOVE R3 R2
0x7C0C0000, // 000D CALL R3 0
0x88100100, // 000E GETMBR R4 R0 K0
0x8C100902, // 000F GETMET R4 R4 K2
0x5C180600, // 0010 MOVE R6 R3
0x7C100400, // 0011 CALL R4 2
0x4C140000, // 0012 LDNIL R5
0x1C100805, // 0013 EQ R4 R4 R5
0x78120006, // 0014 JMPF R4 #001C
0x88100100, // 0015 GETMBR R4 R0 K0
0x98100601, // 0016 SETIDX R4 R3 R1
0x8C100103, // 0017 GETMET R4 R0 K3
0x5C180600, // 0018 MOVE R6 R3
0x7C100400, // 0019 CALL R4 2
0xA8040001, // 001A EXBLK 1 1
0x80040800, // 001B RET 1 R4
0x7001FFEE, // 001C JMP #000C
0x58080004, // 001D LDCONST R2 K4
0xAC080200, // 001E CATCH R2 1 0
0xB0080000, // 001F RAISE 2 R0 R0
0xB0060B06, // 0020 RAISE 1 K5 K6
0x80000000, // 0021 RET 0
( &(const binstruction[ 5]) { /* code */
0xA40A0000, // 0000 IMPORT R2 K0
0x8C0C0501, // 0001 GETMET R3 R2 K1
0x5C140200, // 0002 MOVE R5 R1
0x7C0C0400, // 0003 CALL R3 2
0x80040600, // 0004 RET 1 R3
})
)
);
@ -1605,53 +1570,6 @@ be_local_closure(Tasmota_exec_rules, /* name */
/*******************************************************************/
/********************************************************************
** Solidified function: cb_dispatch
********************************************************************/
be_local_closure(Tasmota_cb_dispatch, /* name */
be_nested_proto(
12, /* nstack */
6, /* 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_str(_cb),
/* K1 */ be_const_int(0),
/* K2 */ be_nested_str(find),
}),
&be_const_str_cb_dispatch,
&be_const_str_solidified,
( &(const binstruction[20]) { /* code */
0x88180100, // 0000 GETMBR R6 R0 K0
0x4C1C0000, // 0001 LDNIL R7
0x1C180C07, // 0002 EQ R6 R6 R7
0x781A0000, // 0003 JMPF R6 #0005
0x80060200, // 0004 RET 1 K1
0x88180100, // 0005 GETMBR R6 R0 K0
0x8C180D02, // 0006 GETMET R6 R6 K2
0x5C200200, // 0007 MOVE R8 R1
0x7C180400, // 0008 CALL R6 2
0x4C1C0000, // 0009 LDNIL R7
0x201C0C07, // 000A NE R7 R6 R7
0x781E0006, // 000B JMPF R7 #0013
0x5C1C0C00, // 000C MOVE R7 R6
0x5C200400, // 000D MOVE R8 R2
0x5C240600, // 000E MOVE R9 R3
0x5C280800, // 000F MOVE R10 R4
0x5C2C0A00, // 0010 MOVE R11 R5
0x7C1C0800, // 0011 CALL R7 4
0x80040E00, // 0012 RET 1 R7
0x80060200, // 0013 RET 1 K1
})
)
);
/*******************************************************************/
/********************************************************************
** Solidified function: hs2rgb
********************************************************************/
@ -2072,7 +1990,6 @@ class be_class_tasmota (scope: global, name: Tasmota) {
_timers, var
_ccmd, var
_drivers, var
_cb, var
wire1, var
wire2, var
global, var
@ -2094,7 +2011,6 @@ class be_class_tasmota (scope: global, name: Tasmota) {
publish, func(l_publish)
publish_result, func(l_publish_result)
_cmd, func(l_cmd)
_get_cb, func(l_get_cb)
get_option, func(l_getoption)
millis, func(l_millis)
time_reached, func(l_timereached)
@ -2155,7 +2071,6 @@ class be_class_tasmota (scope: global, name: Tasmota) {
hs2rgb, closure(Tasmota_hs2rgb_closure)
cb_dispatch, closure(Tasmota_cb_dispatch_closure)
gen_cb, closure(Tasmota_gen_cb_closure)
get_light, closure(Tasmota_get_light_closure)

View File

@ -65,20 +65,14 @@
**/
#define BE_DEBUG_VAR_INFO 0
/* Macro: BE_USE_OBSERVABILITY_HOOK
* Use the obshook function to report low-level actions.
* Default: 0
**/
#define BE_USE_OBSERVABILITY_HOOK 1
/* Macro: BE_USE_OBSERVABILITY_HOOK
/* Macro: BE_USE_PERF_COUNTERS
* Use the obshook function to report low-level actions.
* Default: 0
**/
#define BE_USE_PERF_COUNTERS 1
/* Macro: BE_VM_OBSERVABILITY_SAMPLING
* If BE_USE_OBSERVABILITY_HOOK == 1 and BE_USE_PERF_COUNTERS == 1
* If BE_USE_PERF_COUNTERS == 1
* then the observability hook is called regularly in the VM loop
* allowing to stop infinite loops or too-long running code.
* The value is a power of 2.

View File

@ -16,13 +16,6 @@ class Driver
var button_pressed
var display
def init()
end
def get_tasmota()
return tasmota
end
def add_cmd(c, f)
tasmota.add_cmd(c, / cmd, idx, payload, payload_json -> f(self, cmd, idx, payload, payload_json))
end

View File

@ -21,7 +21,6 @@ class Tasmota
var _timers
var _ccmd
var _drivers
var _cb
var wire1
var wire2
var cmd_res # store the command result, nil if disables, true if capture enabled, contains return value
@ -520,28 +519,11 @@ class Tasmota
end
end
#- dispatch callback number n, with parameters v0,v1,v2,v3 -#
def cb_dispatch(n,v0,v1,v2,v3)
if self._cb == nil return 0 end
var f = self._cb.find(n)
if f != nil
return f(v0,v1,v2,v3)
end
return 0
end
#- generate a new C callback and record the associated Berry closure -#
def gen_cb(f)
if self._cb == nil self._cb = {} end # create map if not already initialized
for i:0..19
if self._cb.find(i) == nil
#- free slot -#
self._cb[i] = f
return self._get_cb(i)
end
end
raise "internal_error", "No callback available"
# DEPRECATED
import cb
return cb.gen_cb(f)
end
#- convert hue/sat to rgb -#

View File

@ -153,7 +153,7 @@ class AXP192 : I2C_Driver
"{s}Batt Voltage{m}%.3f V{e}"..
"{s}Batt Current{m}%.1f mA{e}"..
#"{s}Batt Power{m}%.3f{e}"..
"{s}Temp AXP{m}%.1f °C{e}",
"{s}Temp AXP{m}%.1f &deg;C{e}",
self.get_vbus_voltage(), self.get_vbus_voltage(),
self.get_bat_voltage(), self.get_bat_current(),
#self.get_bat_power(),

View File

@ -29,8 +29,6 @@ class I2C_Driver
- i2c_index : Tasmota I2C index, see `I2CDEVICES.md` (int)
--#
def init(name_or_detect, addr, i2c_index)
var tasmota = self.get_tasmota() #- retrieve the 'tasmota' singleton -#
#- check if the i2c index is disabled by Tasmota configuration -#
if i2c_index != nil && !tasmota.i2c_enabled(i2c_index) return end

View File

@ -23,8 +23,7 @@ class LVGL_glob
#- register an lv.lv_* object in the mapping -#
def register_obj(obj)
if self.cb_obj == nil self.cb_obj = {} end
var native_ptr = int(obj._p)
self.cb_obj[native_ptr] = obj
self.cb_obj[obj._p] = obj
end
def get_object_from_ptr(ptr)
@ -38,7 +37,7 @@ class LVGL_glob
var event = lv.lv_event(introspect.toptr(event_ptr))
var target = int(event.target)
var target = event.target
var f = self.cb_event_closure[target]
var obj = self.get_object_from_ptr(target)
#print('>> lvgl_event_dispatch', f, obj, event)
@ -87,7 +86,7 @@ class LVGL_glob
var cl = lv.lv_obj_class(cl_ptr)
var event = lv.lv_event(e_ptr)
var obj_ptr = event.target
var obj = self.get_object_from_ptr(int(obj_ptr))
var obj = self.get_object_from_ptr(obj_ptr)
if type(obj) == 'instance' && introspect.get(obj, 'widget_event')
obj.widget_event(cl, event)
end

2
lib/libesp32/berry/gen.sh Executable file
View File

@ -0,0 +1,2 @@
#!/bin/bash
python3 tools/pycoc/main.py -o generate src default ../berry_mapping/src -c default/berry_conf.h

View File

@ -48,7 +48,6 @@ extern const bcstring be_const_str_I2C_X3A;
extern const bcstring be_const_str_LVG_X3A_X20call_X20to_X20unsupported_X20callback;
extern const bcstring be_const_str_Leds;
extern const bcstring be_const_str_MD5;
extern const bcstring be_const_str_No_X20callback_X20available;
extern const bcstring be_const_str_None;
extern const bcstring be_const_str_OPTION_A;
extern const bcstring be_const_str_OneWire;
@ -163,7 +162,7 @@ extern const bcstring be_const_str__X7B;
extern const bcstring be_const_str__X7B_X7D;
extern const bcstring be_const_str__X7Bs_X7DBatt_X20Current_X7Bm_X7D_X25_X2E1f_X20mA_X7Be_X7D;
extern const bcstring be_const_str__X7Bs_X7DBatt_X20Voltage_X7Bm_X7D_X25_X2E3f_X20V_X7Be_X7D;
extern const bcstring be_const_str__X7Bs_X7DTemp_X20AXP_X7Bm_X7D_X25_X2E1f_X20_XB0C_X7Be_X7D;
extern const bcstring be_const_str__X7Bs_X7DTemp_X20AXP_X7Bm_X7D_X25_X2E1f_X20_X26deg_X3BC_X7Be_X7D;
extern const bcstring be_const_str__X7Bs_X7DVBus_X20Current_X7Bm_X7D_X25_X2E1f_X20mA_X7Be_X7D;
extern const bcstring be_const_str__X7Bs_X7DVBus_X20Voltage_X7Bm_X7D_X25_X2E3f_X20V_X7Be_X7D;
extern const bcstring be_const_str__X7D;
@ -175,7 +174,6 @@ extern const bcstring be_const_str__archive;
extern const bcstring be_const_str__available;
extern const bcstring be_const_str__begin_transmission;
extern const bcstring be_const_str__buffer;
extern const bcstring be_const_str__cb;
extern const bcstring be_const_str__ccmd;
extern const bcstring be_const_str__class;
extern const bcstring be_const_str__cmd;
@ -187,7 +185,6 @@ extern const bcstring be_const_str__end_transmission;
extern const bcstring be_const_str__energy;
extern const bcstring be_const_str__error;
extern const bcstring be_const_str__filename;
extern const bcstring be_const_str__get_cb;
extern const bcstring be_const_str__global_addr;
extern const bcstring be_const_str__global_def;
extern const bcstring be_const_str__lvgl;
@ -250,7 +247,7 @@ extern const bcstring be_const_str_call;
extern const bcstring be_const_str_call_native;
extern const bcstring be_const_str_calldepth;
extern const bcstring be_const_str_can_show;
extern const bcstring be_const_str_cb_dispatch;
extern const bcstring be_const_str_cb;
extern const bcstring be_const_str_cb_do_nothing;
extern const bcstring be_const_str_cb_event_closure;
extern const bcstring be_const_str_cb_obj;
@ -384,6 +381,7 @@ extern const bcstring be_const_str_get_bat_power;
extern const bcstring be_const_str_get_bat_voltage;
extern const bcstring be_const_str_get_battery_chargin_status;
extern const bcstring be_const_str_get_bri;
extern const bcstring be_const_str_get_cb_list;
extern const bcstring be_const_str_get_coords;
extern const bcstring be_const_str_get_current_module_name;
extern const bcstring be_const_str_get_current_module_path;
@ -402,7 +400,6 @@ extern const bcstring be_const_str_get_style_bg_color;
extern const bcstring be_const_str_get_style_line_color;
extern const bcstring be_const_str_get_style_pad_right;
extern const bcstring be_const_str_get_switch;
extern const bcstring be_const_str_get_tasmota;
extern const bcstring be_const_str_get_temp;
extern const bcstring be_const_str_get_vbus_current;
extern const bcstring be_const_str_get_vbus_voltage;
@ -556,7 +553,6 @@ extern const bcstring be_const_str_readline;
extern const bcstring be_const_str_real;
extern const bcstring be_const_str_reapply;
extern const bcstring be_const_str_redirect;
extern const bcstring be_const_str_reduce;
extern const bcstring be_const_str_refr_size;
extern const bcstring be_const_str_register_obj;
extern const bcstring be_const_str_remove;

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