Merge branch 'arendst:development' into New-Venetian-Blind

This commit is contained in:
stefanbode 2021-11-09 08:43:36 +01:00 committed by GitHub
commit b6d3c449ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 45 additions and 35 deletions

View File

@ -217,18 +217,18 @@ static binstance* newobject(bvm *vm, bclass *c)
/* Instanciate new instance from stack with argc parameters */
/* Pushes the constructor on the stack to be executed if a construtor is found */
/* Returns true if a constructor is found */
bbool be_class_newobj(bvm *vm, bclass *c, bvalue *reg, int argc, int mode)
bbool be_class_newobj(bvm *vm, bclass *c, int32_t pos, int argc, int mode)
{
bvalue init;
size_t pos = reg - vm->reg;
binstance *obj = newobject(vm, c); /* create empty object hierarchy from class hierarchy */
reg = vm->reg + pos - mode; /* the stack may have changed, mode=1 when class is instanciated from module #104 */
var_setinstance(reg, obj);
var_setinstance(reg + mode, obj); /* copy to reg and reg+1 if mode==1 */
// reg = vm->reg + pos - mode; /* the stack may have changed, mode=1 when class is instanciated from module #104 */
var_setinstance(vm->reg + pos, obj);
var_setinstance(vm->reg + pos - mode, obj); /* copy to reg and reg+1 if mode==1 */
/* find constructor */
obj = instance_member(vm, obj, str_literal(vm, "init"), &init);
if (obj && var_type(&init) != MT_VARIABLE) {
/* copy argv */
bvalue * reg;
for (reg = vm->reg + pos + 1; argc > 0; --argc) {
reg[argc] = reg[argc - 2];
}

View File

@ -58,7 +58,7 @@ void be_prim_method_bind(bvm *vm, bclass *c, bstring *name, bntvfunc f);
void be_closure_method_bind(bvm *vm, bclass *c, bstring *name, bclosure *cl);
int be_class_closure_count(bclass *c);
void be_class_upvalue_init(bvm *vm, bclass *c);
bbool be_class_newobj(bvm *vm, bclass *c, bvalue *argv, int argc, int mode);
bbool be_class_newobj(bvm *vm, bclass *c, int32_t pos, int argc, int mode);
int be_instance_member_simple(bvm *vm, binstance *obj, bstring *name, bvalue *dst);
int be_instance_member(bvm *vm, binstance *obj, bstring *name, bvalue *dst);
int be_class_member(bvm *vm, bclass *obj, bstring *name, bvalue *dst);

View File

@ -142,7 +142,7 @@
_vm->cf->status = PRIM_FUNC; \
}
static void prep_closure(bvm *vm, bvalue *reg, int argc, int mode);
static void prep_closure(bvm *vm, int32_t pos, int argc, int mode);
static void attribute_error(bvm *vm, const char *t, bvalue *b, bvalue *c)
{
@ -1062,10 +1062,11 @@ newframe: /* a new call frame */
++var, --argc, mode = 1;
goto recall;
case BE_CLASS:
if (be_class_newobj(vm, var_toobj(var), var, ++argc, mode)) { /* instanciate object and find constructor */
if (be_class_newobj(vm, var_toobj(var), var - reg, ++argc, mode)) { /* instanciate object and find constructor */
reg = vm->reg + mode; /* constructor found */
mode = 0;
var = RA() + 1; /* to next register */
reg = vm->reg;
goto recall; /* call constructor */
}
break;
@ -1101,7 +1102,7 @@ newframe: /* a new call frame */
// *(reg + proto->argc - 1) = *(vm->top-2); /* change the vararg argument to now contain the list instance */
// vm->top = top_save; /* restore top of stack pointer */
// }
prep_closure(vm, var, argc, mode);
prep_closure(vm, var - reg, argc, mode);
reg = vm->reg; /* `reg` has changed, now new base register */
goto newframe; /* continue execution of the closure */
}
@ -1163,14 +1164,13 @@ newframe: /* a new call frame */
}
}
static void prep_closure(bvm *vm, bvalue *reg, int argc, int mode)
static void prep_closure(bvm *vm, int32_t pos, int argc, int mode)
{
bvalue *v, *end;
bproto *proto = var2cl(reg)->proto;
push_closure(vm, reg, proto->nstack, mode);
v = vm->reg + argc;
bproto *proto = var2cl(vm->reg + pos)->proto;
push_closure(vm, vm->reg + pos, proto->nstack, mode);
end = vm->reg + proto->argc;
for (; v <= end; ++v) {
for (v = vm->reg + argc; v <= end; ++v) {
var_setnil(v);
}
if (proto->varg) { /* there are vararg at the last argument, build the list */
@ -1189,7 +1189,7 @@ static void prep_closure(bvm *vm, bvalue *reg, int argc, int mode)
}
}
static void do_closure(bvm *vm, bvalue *reg, int argc)
static void do_closure(bvm *vm, int32_t pos, int argc)
{
// bvalue *v, *end;
// bproto *proto = var2cl(reg)->proto;
@ -1199,31 +1199,31 @@ static void do_closure(bvm *vm, bvalue *reg, int argc)
// for (; v <= end; ++v) {
// var_setnil(v);
// }
prep_closure(vm, reg, argc, 0);
prep_closure(vm, pos, argc, 0);
vm_exec(vm);
}
static void do_ntvclos(bvm *vm, bvalue *reg, int argc)
static void do_ntvclos(bvm *vm, int32_t pos, int argc)
{
bntvclos *f = var_toobj(reg);
push_native(vm, reg, argc, 0);
bntvclos *f = var_toobj(vm->reg + pos);
push_native(vm, vm->reg + pos, argc, 0);
f->f(vm); /* call C primitive function */
ret_native(vm);
}
static void do_ntvfunc(bvm *vm, bvalue *reg, int argc)
static void do_ntvfunc(bvm *vm, int32_t pos, int argc)
{
bntvfunc f = var_tontvfunc(reg);
push_native(vm, reg, argc, 0);
bntvfunc f = var_tontvfunc(vm->reg + pos);
push_native(vm, vm->reg + pos, argc, 0);
f(vm); /* call C primitive function */
ret_native(vm);
}
static void do_class(bvm *vm, bvalue *reg, int argc)
static void do_class(bvm *vm, int32_t pos, int argc)
{
if (be_class_newobj(vm, var_toobj(reg), reg, ++argc, 0)) {
if (be_class_newobj(vm, var_toobj(vm->reg + pos), pos, ++argc, 0)) {
be_incrtop(vm);
be_dofunc(vm, reg + 1, argc);
be_dofunc(vm, vm->reg + pos + 1, argc);
be_stackpop(vm, 1);
}
}
@ -1232,11 +1232,12 @@ void be_dofunc(bvm *vm, bvalue *v, int argc)
{
be_assert(vm->reg <= v && v < vm->stacktop);
be_assert(vm->stack <= vm->reg && vm->reg < vm->stacktop);
int32_t pos = v - vm->reg;
switch (var_type(v)) {
case BE_CLASS: do_class(vm, v, argc); break;
case BE_CLOSURE: do_closure(vm, v, argc); break;
case BE_NTVCLOS: do_ntvclos(vm, v, argc); break;
case BE_NTVFUNC: do_ntvfunc(vm, v, argc); break;
case BE_CLASS: do_class(vm, pos, argc); break;
case BE_CLOSURE: do_closure(vm, pos, argc); break;
case BE_NTVCLOS: do_ntvclos(vm, pos, argc); break;
case BE_NTVFUNC: do_ntvfunc(vm, pos, argc); break;
default: call_error(vm, v);
}
}

View File

@ -91,7 +91,7 @@ lib_extra_dirs = ${library.lib_extra_dirs}
[env:tasmota32_base]
; *** Uncomment next lines ";" to enable Beta Tasmota Arduino version ESP32 IDF4.4
;platform = https://github.com/platformio/platform-espressif32.git#feature/arduino-idf-master
;platform_packages = framework-arduinoespressif32 @ https://github.com/tasmota/arduino-esp32/releases/download/2.0.1rc1/framework-arduinoespressif32-release_IDF4.4.tar.gz
;platform_packages = framework-arduinoespressif32 @ https://github.com/tasmota/arduino-esp32/releases/download/2.0.1rc2/framework-arduinoespressif32-release_IDF4.4.tar.gz
; platformio/tool-esptoolpy @ https://github.com/tasmota/esptool/releases/download/v3.2/esptool-v3.2.zip
; platformio/tool-mklittlefs @ ~1.203.200522
build_unflags = ${esp32_defaults.build_unflags}

View File

@ -1,7 +1,16 @@
; *** Tasmota32 development core version ESP32 IDF4.4
[env:tasmota32-dev]
extends = env:tasmota32idf4
platform_packages = framework-arduinoespressif32 @ https://github.com/Jason2866/esp32-arduino-lib-builder/releases/download/516/framework-arduinoespressif32-release_v4.4-432c3c78c.tar.gz
platform_packages = framework-arduinoespressif32 @ https://github.com/tasmota/arduino-esp32/releases/download/2.0.1rc2/framework-arduinoespressif32-release_IDF4.4.tar.gz
platformio/tool-esptoolpy @ https://github.com/tasmota/esptool/releases/download/v3.2/esptool-v3.2.zip
platformio/tool-mklittlefs @ ~1.203.200522
build_flags = ${env:tasmota32idf4.build_flags}
-D FIRMWARE_TASMOTA32
[env:tasmota32idf4-solo1]
extends = env:tasmota32idf4
platform = ${env:tasmota32idf4.platform}
platform_packages = framework-arduinoespressif32 @ https://github.com/tasmota/arduino-esp32/releases/download/2.0.1rc2/framework-arduinoespressif32-solo1-release_IDF4.4.tar.gz
platformio/tool-esptoolpy @ https://github.com/tasmota/esptool/releases/download/v3.2/esptool-v3.2.zip
platformio/tool-mklittlefs @ ~1.203.200522
build_flags = ${env:tasmota32idf4.build_flags}
@ -14,7 +23,7 @@ extends = env:tasmota32-dev
platform_packages = ${env:tasmota32-dev.platform_packages}
board = esp32s2
build_flags = ${env:tasmota32idf4.build_flags}
-D FIRMWARE_TASMOTA32
-D FIRMWARE_TASMOTA32
lib_ignore =
ESP8266Audio
ESP8266SAM

View File

@ -36,7 +36,7 @@ lib_ignore =
[env:tasmota32idf4]
extends = env:tasmota32_base
platform = https://github.com/platformio/platform-espressif32.git#feature/arduino-idf-master
platform_packages = framework-arduinoespressif32 @ https://github.com/tasmota/arduino-esp32/releases/download/2.0.1rc1/framework-arduinoespressif32-release_IDF4.4.tar.gz
platform_packages = framework-arduinoespressif32 @ https://github.com/tasmota/arduino-esp32/releases/download/2.0.1rc2/framework-arduinoespressif32-release_IDF4.4.tar.gz
platformio/tool-esptoolpy @ https://github.com/tasmota/esptool/releases/download/v3.2/esptool-v3.2.zip
platformio/tool-mklittlefs @ ~1.203.200522
build_unflags = ${env:tasmota32_base.build_unflags}

View File

@ -778,7 +778,7 @@ void ThermostatCalculatePI(uint8_t ctr_output)
// Minimum action limiter
// If result is less than the minimum action time, adjust to minimum value
if ((Thermostat[ctr_output].time_total_pi <= abs(((uint32_t)Thermostat[ctr_output].time_min_action * 60)))
if ((Thermostat[ctr_output].time_total_pi <= abs(((int32_t)Thermostat[ctr_output].time_min_action * 60)))
&& (Thermostat[ctr_output].time_total_pi != 0)) {
Thermostat[ctr_output].time_total_pi = ((int32_t)Thermostat[ctr_output].time_min_action * 60);
}

View File

@ -265,7 +265,7 @@ void Core2EverySecond(void) {
if (core2_globs.ready) {
Core2GetADC();
if (Rtc.utc_time > START_VALID_TIME && core2_globs.tset==false && abs(Rtc.utc_time - Core2GetUtc()) > 3) {
if (Rtc.utc_time > START_VALID_TIME && core2_globs.tset==false && abs((int32_t)Rtc.utc_time - (int32_t)Core2GetUtc()) > 3) {
Core2SetUtc(Rtc.utc_time);
AddLog(LOG_LEVEL_INFO, PSTR("CR2: Write Time TO BM8563 from NTP (" D_UTC_TIME ") %s, (" D_DST_TIME ") %s, (" D_STD_TIME ") %s"),
GetDateAndTime(DT_UTC).c_str(), GetDateAndTime(DT_DST).c_str(), GetDateAndTime(DT_STD).c_str());